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


C# dbEcustomEntities.Attach方法代码示例

本文整理汇总了C#中ECustoms.DAL.dbEcustomEntities.Attach方法的典型用法代码示例。如果您正苦于以下问题:C# dbEcustomEntities.Attach方法的具体用法?C# dbEcustomEntities.Attach怎么用?C# dbEcustomEntities.Attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ECustoms.DAL.dbEcustomEntities的用法示例。


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

示例1: UpdateVehicle

 /// <summary>
 /// Update Vehicle
 /// </summary>
 /// <param name="vehicle"></param>
 /// <returns></returns>
 public static int UpdateVehicle(tblVehicle vehicle )
 {
     var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     // Get orgin vehicle
     var vehicleOrgin = db.tblVehicles.Where(g => g.VehicleID == vehicle.VehicleID).FirstOrDefault();
     db.Attach(vehicleOrgin);
     db.ApplyPropertyChanges("tblVehicles", vehicle);
     return db.SaveChanges();
 }
开发者ID:gsb123,项目名称:ecustoms-project,代码行数:14,代码来源:VehicleFactory.cs

示例2: Update

 /// <summary>
 /// update declaration
 /// </summary>
 /// <param name="declaration"></param>
 /// <param name="modifiedByID"></param>
 /// <returns></returns>
 public static int Update(tblDeclaration declaration)
 {
     var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     declaration.ModifiedDate = DateTime.Now;
     // Get orgin object
     var objOrginDeclaration = db.tblDeclarations.Where(g => g.DeclarationID.Equals(declaration.DeclarationID)).FirstOrDefault();
     db.Attach(objOrginDeclaration);
     db.ApplyPropertyChanges("tblDeclarations", declaration);
     return db.SaveChanges();
 }
开发者ID:gsb123,项目名称:ecustoms-project,代码行数:16,代码来源:DeclarationFactory.cs

示例3: Update

 public static int Update(tblVehicleCheck vehicleCheck)
 {
     var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));            
     // Get orgin object
     var objOrginVehicleCheck = db.tblVehicleChecks.Where(g => g.VehicleCheckID == vehicleCheck.VehicleCheckID).FirstOrDefault();
     db.Attach(objOrginVehicleCheck);
     db.ApplyPropertyChanges("tblVehicleChecks", vehicleCheck);
     int re = db.SaveChanges();
     db.Connection.Close();
     return re;        
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:11,代码来源:VehicleCheckFactory.cs

示例4: Update

 public static int Update(tblGroup group)
 {          
   var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
   var groupOrgin = db.tblGroups.Where(g => g.GroupID == group.GroupID).FirstOrDefault();
   if (groupOrgin == null) return -1;
   db.Attach(groupOrgin);
   db.ApplyPropertyChanges("tblGroups", group);
   int re = db.SaveChanges();
   db.Connection.Close();
   return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:11,代码来源:GroupFactory.cs

示例5: Update

 public static int Update(tblCheck check)
 {
     check.ModifedDate = CommonFactory.GetCurrentDate();
     var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     var checkOrgin = db.tblChecks.Where(g => g.CheckID == check.CheckID).FirstOrDefault();
     if (checkOrgin == null) return -1;
     db.Attach(checkOrgin);
     db.ApplyPropertyChanges("tblChecks", check);
     int re = db.SaveChanges();
     db.Connection.Close();
     return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:12,代码来源:CheckFactory.cs

示例6: Update

 public static int Update(tblDeclarationLoan loan)
 {
     var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     loan.ModifiedDate = CommonFactory.GetCurrentDate();
     // Get orgin object
     var objOrginDeclaration = db.tblDeclarationLoans.Where(g => g.ID.Equals(loan.ID)).FirstOrDefault();
     db.Attach(objOrginDeclaration);
     db.ApplyPropertyChanges("tblDeclarationLoans", loan);
     int re = db.SaveChanges();
     db.Connection.Close();
     return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:12,代码来源:DeclarationLoanFactory.cs

示例7: Update

        public static int Update(tblTrain train)
        {
            var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
            train.ModifiedDate = CommonFactory.GetCurrentDate();
            var originTrain = _db.tblTrains.Where(g => g.TrainID == train.TrainID).FirstOrDefault();

            if (originTrain == null)
            {
                return -1;
            }
            _db.Attach(originTrain);
            _db.ApplyPropertyChanges("tblTrains", train);
            
            return _db.SaveChanges();
        }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:15,代码来源:TrainFactory.cs

示例8: UpdateVehicle

        /// <summary>
        /// Update Vehicle
        /// </summary>
        /// <param name="vehicle"></param>
        /// <param name="declerationID"></param>
        /// <returns></returns>
        public static int UpdateVehicle(tblVehicle vehicle, long declerationID)
        {
            // Set last modified date to now
            vehicle.ModifiedDate = CommonFactory.GetCurrentDate();
            var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
            switch (declerationID)
            {
                case 0:
                    {
                        // Get orgin vehicle
                        var vehicleOrgin = db.tblVehicles.Where(g => g.VehicleID == vehicle.VehicleID).FirstOrDefault();
                        if (vehicleOrgin != null)
                        {
                            db.Attach(vehicleOrgin);
                            db.ApplyPropertyChanges("tblVehicles", vehicle);

                            if (vehicle.ListVehicleChangeGood != null)
                            {
                                //update tblVehicleChange 
                                VehicleFactory.DeleteVehicleChangeByVehicleId(vehicle.VehicleID);
                                VehicleFactory.AddVehicleChangeByVehicleId(vehicle.VehicleID, vehicle.ListVehicleChangeGood.Select(x => x.VehicleId).ToList());
                            }
                            db.Connection.Close();
                            
                            int re = db.SaveChanges();
                            return re;
                        }
                        return -1;
                    }
                default:
                    {
                        var vehicleOrgin = db.tblVehicles.Where(g => g.VehicleID == vehicle.VehicleID).FirstOrDefault();
                        db.Attach(vehicleOrgin);
                        db.ApplyPropertyChanges("tblVehicles", vehicle);
                        //db.SaveChanges();
                        // Insert to tblVehicleDeclerateion
                        var vehicleDeclara = new tblDeclarationVehicle();
                        vehicleDeclara.VehicleID = vehicle.VehicleID;
                        vehicleDeclara.DeclarationID = declerationID;
                        db.AddTotblDeclarationVehicles(vehicleDeclara);
                        int re = db.SaveChanges();
                        db.Connection.Close();
                        db.Dispose();
                        return re;

                    }
            }
        }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:54,代码来源:VehicleFactory.cs

示例9: Update

        /// <summary>
        /// Update user
        /// </summary>
        /// <param name="userInfo">userInfo object</param>
        /// <returns>Number of rows are effected</returns>
        public static int Update(tblUser userInfo)
        {
            // Encode password & username
            userInfo.Password = Common.Encode(userInfo.Password);

            var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
            var usrOrgin = db.tblUsers.Where(g => g.UserID == userInfo.UserID).FirstOrDefault();
            if (usrOrgin == null) return -1;
            db.Attach(usrOrgin);
            db.ApplyPropertyChanges("tblUsers", userInfo);
            int re = db.SaveChanges();
            db.Connection.Close();
            return re;
        }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:19,代码来源:UserFactory.cs


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