当前位置: 首页>>代码示例>>C#>>正文


C# Entities类代码示例

本文整理汇总了C#中Entities的典型用法代码示例。如果您正苦于以下问题:C# Entities类的具体用法?C# Entities怎么用?C# Entities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Entities类属于命名空间,在下文中一共展示了Entities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnBlockPlaced

 public override bool OnBlockPlaced(World world, Vector3 position, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     Metadata = (byte)MathHelper.DirectionByRotationFlat(usedBy);
     switch ((Direction)Metadata)
     {
         case Direction.North:
             Metadata = (byte)StairDirections.North;
             break;
         case Direction.South:
             Metadata = (byte)StairDirections.South;
             break;
         case Direction.West:
             Metadata = (byte)StairDirections.West;
             break;
         case Direction.East:
             Metadata = (byte)StairDirections.East;
             break;
     }
     if (clickedSide == Vector3.Down)
         Metadata |= 4;
     else if (clickedSide != Vector3.Up)
     {
         if (cursorPosition.Y >= 8)
             Metadata |= 4;
     }
     return true;
 }
开发者ID:seaboy1234,项目名称:Craft.Net,代码行数:27,代码来源:StairBlock.cs

示例2: Delete

 //delete
 public int Delete(Entities.KhoHang kh1)
 {
     int tra = 0;
     try
     {
         kh = new Constants.KhoHang();
         Entities.KhoHang khohang = new Entities.KhoHang();
         Sql = new Constants.Sql();
         string sql = Sql.DeleteKhoHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
         cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
         tra = cmd.ExecuteNonQuery();
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
         cn = null;
         conn = null;
     }
     catch (Exception ex)
     { string s = ex.Message; tra = 0; }
     return tra;
 }
开发者ID:mrk29vn,项目名称:vna-accounting,代码行数:26,代码来源:KhoHang.cs

示例3: SummaryForApprove

        public ActionResult SummaryForApprove(int id, FormCollection form)
        {
            var campaign = OperationContext.ServiceSession.EM_CampaignsService.Get(c => c.CampaignID == id).FirstOrDefault();
            if (campaign != null)
            {
                campaign.Approved = true;
                campaign.ApprovedBy = OperationContext.CurrentUser.employeeLoginName;
                campaign.ApprovedDate=DateTime.Now;
                OperationContext.ServiceSession.SaveChange();

                //invoke stored procedure, populate data to campaignInstance.
                Entities entity = new Entities();
                var emailInstanceId =
                    OperationContext.ServiceSession.EM_EmailInstancesService.Get(e => e.CampaignID == id)
                        .FirstOrDefault()
                        .EmailInstanceID;
                entity.EM_CampaignInstances_INSERT(emailInstanceId);

                return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null);
            }
            else
            {
                return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "campaign is not found", "",
                    null);
            }
        }
开发者ID:simon8029,项目名称:EmailPromotionManagementDemo,代码行数:26,代码来源:SummaryController.cs

示例4: AddMetaTitle

 public void AddMetaTitle(Entities.AuxEntities.language Language)
 {
     lock (this.meta_title)
     {
         this.meta_title.Add(Language);
     }
 }
开发者ID:Newturko,项目名称:PrestaSharp,代码行数:7,代码来源:category.cs

示例5: frmXuLyPhieuTTNCC

        /// <summary>
        ///  xử lý giá trị truyền tới
        /// </summary>
        /// <param name="hdbh"></param>
        public frmXuLyPhieuTTNCC(Entities.HoaDonNhap[] hdbh)
        {
            try
            {
                InitializeComponent();
                dateserver = DateServer.Date();
                sochungtu = txtsochungtu.Text = ProID("PhieuTTNCC");
                SelectHoaDonNhap();
                SelectNCC();
                LayTenTT();
                this.Text = "Quản Lý Thanh Toán Của Nhà Cung Cấp - Thêm Phiếu Thanh Toán";
                txtmancc.Text = hdbh[0].MaNhaCungCap;
                txtnohienthoi.Text = LaySoDuNo(txtmancc.Text);

                cbbtientetygia.SelectedIndex = 0;
                Entities.HDThanhToanKH[] hd = new Entities.HDThanhToanKH[1];
                Double tongtien = Convert.ToDouble(hdbh[0].TongTien);
                string thanhtoanngay = hdbh[0].ThanhToanNgay;
                thanhtoansaukhilapphieu = hdbh[0].ThanhToanSauKhiLapPhieu;
                Double sono = Convert.ToDouble(tongtien) - Convert.ToDouble(thanhtoanngay) - Convert.ToDouble(thanhtoansaukhilapphieu);
                hd[0] = new Entities.HDThanhToanKH(hdbh[0].MaHoaDonNhap,  new Common.Utilities().FormatMoney(tongtien), new Common.Utilities().FormatMoney(sono), new Common.Utilities().FormatMoney(sono),thanhtoansaukhilapphieu);
                dtgvNCC.DataSource = hd;
                mskngaychungtu.Text = new Common.Utilities().XuLy(2,dateserver.ToShortDateString());
                txttongthanhtoan.Text = new Common.Utilities().FormatMoney(TinhTien());
                fix();
            }
            catch (Exception ex)
            {

            }
        }
开发者ID:mrk29vn,项目名称:vna-accounting,代码行数:35,代码来源:frmXuLyPhieuTTNCC.cs

示例6: GetProperty

 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     CultureInfo ci = formatProvider;
     if (strPropertyName.ToLower() == CultureDropDownTypes.EnglishName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.EnglishName), strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.Lcid.ToString().ToLowerInvariant())
     {
         return ci.LCID.ToString();
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.Name.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.Name, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.NativeName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.NativeName), strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.TwoLetterIsoCode.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.TwoLetterISOLanguageName, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.ThreeLetterIsoCode.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.ThreeLetterISOLanguageName, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.DisplayName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.DisplayName, strFormat);
     }
     PropertyNotFound = true;
     return string.Empty;
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:34,代码来源:CulturePropertyAccess.cs

示例7: OnItemUsedOnBlock

 public override void OnItemUsedOnBlock(World world, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     var block = new MelonStemBlock();
     if (block.OnBlockPlaced(world, clickedBlock + clickedSide, clickedBlock, clickedSide, cursorPosition, usedBy))
         world.SetBlock(clickedBlock + clickedSide, block);
     base.OnItemUsedOnBlock(world, clickedBlock, clickedSide, cursorPosition, usedBy);
 }
开发者ID:cpancake,项目名称:Craft.Net,代码行数:7,代码来源:MelonSeedsItem.cs

示例8: UpdatePack

        private static GenericResponse UpdatePack(PackInformation pkinfo)
        {
            try
            {
                var response = new GenericResponse();
                using (var context = new Entities())
                {
                    var yd = (from yard in context.Yards
                        where yard.Id == pkinfo.YardId
                        select yard.CustomerNumberPrefix).First() ?? string.Empty;
                    pkinfo.NumberPrefix = yd;
                    pkinfo.InternalPackNumber = yd.Trim() + pkinfo.TagNumber;

                    var pack = (from pk in context.Packs
                        where pk.Id == pkinfo.Id
                        select pk).FirstOrDefault();
                    if (pack == null)
                    {
                        var pk = new Pack();
                        Mapper.Map(pkinfo, pk);
                        context.Packs.AddObject(pk);
                    }
                    else Mapper.Map(pkinfo, pack);
                    context.SaveChanges();
                }
                response.Success = true;
                return response;
            }
            catch (Exception ex)
            {
                LoggingMediator.Log("UpdatePack");
                LoggingMediator.Log(ex);
                return new GenericResponse {Success = false, FailureInformation = "Error in PAPService:UpdatePack"};
            }
        }
开发者ID:sotolorin,项目名称:PAPMobileSyncInterface,代码行数:35,代码来源:PAPService.cs

示例9: AddUser

        public void AddUser(Entities.User u)
        {
            try
              {
            var db = new CapstoneDbContext();
            db.Users.Add(u);

                db.SaveChanges();
              }
              catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) //Catches errors in creating the db User table for the first time
              {
              Exception raise = dbEx;
              foreach (var validationErrors in dbEx.EntityValidationErrors)
              {
                  foreach (var validationError in validationErrors.ValidationErrors)
                  {
                      string message = string.Format("{0}:{1}",
                          validationErrors.Entry.Entity.ToString(),
                          validationError.ErrorMessage);
                      // raise a new exception nesting
                      // the current instance as InnerException
                      raise = new InvalidOperationException(message, raise);
                  }
              }
              throw raise;
              }
        }
开发者ID:JEMMtastic,项目名称:Capstone2,代码行数:27,代码来源:UserRepository.cs

示例10: Create

 public void Create(Entities.CTB_CONTR Model)
 {
     try
     {
         db.CTB_CONTR.Add(Model);
         db.SaveChanges();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
     {
         Exception raise = dbEx;
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 string message = string.Format("{0}:{1}",
                     validationErrors.Entry.Entity.ToString(),
                     validationError.ErrorMessage);
                 // raise a new exception nesting
                 // the current instance as InnerException
                 raise = new InvalidOperationException(message, raise);
             }
         }
         throw raise;
     }
 }
开发者ID:jarochp,项目名称:appSIC,代码行数:25,代码来源:ContribuyenteRepositorio.cs

示例11: Add

        public void Add(Entities entityType, int value, IOwner owner)
        {
            if(!entities.ContainsKey(entityType))
                entities.Add(entityType, ids);

            ids.ObjectIds.Add(value, owner);
        }
开发者ID:Zerophase,项目名称:DyMProject,代码行数:7,代码来源:EntityManager.cs

示例12: sp_ThongTinCongTy

        /// <summary>
        /// lay bang cong ty
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        public Entities.ThongTinCongTy sp_ThongTinCongTy(Entities.TruyenGiaTri ct)
        {
            Entities.ThongTinCongTy banghi = new Entities.ThongTinCongTy();
            try
            {
                string sql = "exec sp_ThongTinCongTy @MaCongTy";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add("MaCongTy", SqlDbType.VarChar, 20).Value = ct.Giatritruyen;
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                ArrayList arr = new ArrayList();
                while (dr.Read())
                {

                    banghi.MaCongTy = dr[0].ToString();
                    banghi.TenCongTy = dr[1].ToString();
                    banghi.DiaChi = dr[2].ToString();
                    banghi.SoDienThoai = dr[3].ToString();
                    banghi.Email = dr[4].ToString();
                    banghi.Website = dr[5].ToString();
                    banghi.Fax = dr[6].ToString();
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); banghi = null; }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return banghi;
        }
开发者ID:mrk29vn,项目名称:vna-accounting,代码行数:39,代码来源:ThongTinCongTy.cs

示例13: OnItemUsed

 public override void OnItemUsed(World world, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     var block = world.GetBlock(clickedBlock);
     if (block is DirtBlock || block is GrassBlock)
         world.SetBlock(clickedBlock, new FarmlandBlock());
     base.OnItemUsed(world, clickedBlock, clickedSide, cursorPosition, usedBy);
 }
开发者ID:pdelvo,项目名称:Craft.Net,代码行数:7,代码来源:HoeItem.cs

示例14: Handle

 public static void Handle(Entities.GameClient client, ItemPacket packet)
 {
     if (client.Booth != null)
         return;
     packet.Data1 = client.WarehouseMoney;
     client.Send(packet);
 }
开发者ID:kenlacoste843,项目名称:ProjectXV3,代码行数:7,代码来源:QueryMoneySaved.cs

示例15: InsertUpdate

 //insert update
 public Entities.KhoHang InsertUpdate(Entities.KhoHang kh1)
 {
     Entities.KhoHang k = new Entities.KhoHang();
     try
     {
         kh = new Constants.KhoHang();
         Sql = new Constants.Sql();
         string sql = Sql.InsertUpdateKhoHang;
         Connection conn = new Connection();
         SqlConnection cn = conn.openConnection();
         SqlCommand cmd = new SqlCommand(sql, cn);
         cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
         cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
         cmd.Parameters.Add(kh.MaKho, SqlDbType.VarChar, 20).Value = kh1.MaKho;
         cmd.Parameters.Add(kh.TenKho, SqlDbType.NVarChar, 200).Value = kh1.TenKho;
         cmd.Parameters.Add(kh.DiaChi, SqlDbType.NVarChar, 200).Value = kh1.DiaChi;
         cmd.Parameters.Add(kh.DienThoai, SqlDbType.NVarChar, 200).Value = kh1.DienThoai;
         cmd.Parameters.Add(kh.MaNhanVien, SqlDbType.NVarChar, 200).Value = kh1.MaNhanVien;
         cmd.Parameters.Add(kh.GhiChu, SqlDbType.NVarChar, 100).Value = kh1.GhiChu;
         cmd.Parameters.Add(kh.Deleted, SqlDbType.Bit).Value = kh1.Deleted;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         while (dr.Read())
         {
             k.GhiChu = dr[0].ToString();
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); k.GhiChu = null; }
     return k;
 }
开发者ID:mrk29vn,项目名称:vna-accounting,代码行数:31,代码来源:KhoHang.cs


注:本文中的Entities类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。