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


C# dbEcustomEntities.DeleteObject方法代码示例

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


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

示例1: DeleteByID

 /// <summary>
 /// Delete Decleration by ID
 /// </summary>
 /// <param name="declerationID">DeclerationID</param>
 /// <returns>Number of rows are effected</returns>
 public static int DeleteByID(int declerationID)
 {
     var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     var declaration = db.tblDeclarations.Where(g => g.DeclarationID == declerationID).FirstOrDefault();
     db.DeleteObject(declaration);
     return db.SaveChanges();
 }
开发者ID:gsb123,项目名称:ecustoms-project,代码行数:12,代码来源:DeclarationFactory.cs

示例2: DeleteByID

 /// <summary>
 /// Delete vehicle by ID
 /// </summary>
 /// <param name="vehicleID">Vehicle ID</param>
 /// <returns>Number of rows are effected</returns>
 public static int DeleteByID(int vehicleID)
 {
     var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     var vehicle = db.tblVehicles.Where(g => g.VehicleID == vehicleID).FirstOrDefault();
     db.DeleteObject(vehicle);
     return db.SaveChanges();
 }
开发者ID:gsb123,项目名称:ecustoms-project,代码行数:12,代码来源:VehicleFactory.cs

示例3: DeleteUserInGroup

 public static int DeleteUserInGroup(int groupID, int userID)
 {
   var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
   tblUserInGroup tblUserInGroup = db.tblUserInGroups.Where(g => g.GroupID == groupID && g.UserID == userID).FirstOrDefault();
   if(tblUserInGroup != null)
     db.DeleteObject(tblUserInGroup);
   int re = db.SaveChanges();
   db.Connection.Close();
   return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:10,代码来源:UserInGroupFactory.cs

示例4: Delete

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

示例5: DeleteUserInGroupByGroupID

 public static int DeleteUserInGroupByGroupID(Int32 groupID)
 {
   var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
   List<tblUserInGroup> listTblUserInGroup = db.tblUserInGroups.Where(g => g.GroupID == groupID).ToList();
   foreach (tblUserInGroup userInGroup in listTblUserInGroup)
   {
     db.DeleteObject(userInGroup);
   }
   int re = db.SaveChanges();
   db.Connection.Close();
   return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:12,代码来源:UserInGroupFactory.cs

示例6: DeleteUserGroupPermissionByUserID

 public static int DeleteUserGroupPermissionByUserID(int userID)
 {
   var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
   List<tblUserGroupPermission> listUserGroupPermission = db.tblUserGroupPermissions.Where(g => g.UserID == userID && g.PermissionType == PERMISSION_TYPE_USER).ToList();
   foreach (tblUserGroupPermission userGroupPermission in listUserGroupPermission)
   {
     db.DeleteObject(userGroupPermission);
   }
   int re = db.SaveChanges();
   db.Connection.Close();
   return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:12,代码来源:UserGroupPermissionFactory.cs

示例7: DeleteVehicleByDecarationID

        public static void DeleteVehicleByDecarationID(long declarationID)
        {
            var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
            var declarationVehicles =
                db.tblDeclarationVehicles.Where((g => g.DeclarationID == declarationID)).ToList();

            foreach (var tblDeclarationVehicle in declarationVehicles)
            {
                db.DeleteObject(tblDeclarationVehicle);
                db.SaveChanges();
            }
            db.Connection.Close();
        }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:13,代码来源:DeclarationVehicleFactory.cs

示例8: DeleteByVehicleDeclarationID

        public static int DeleteByVehicleDeclarationID(long vehicleID, long declarationID)
        {
            var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
            var declarationVehicle =
                db.tblDeclarationVehicles.Where((g => g.DeclarationID == declarationID && g.VehicleID == vehicleID)).
                    FirstOrDefault();
            if (declarationVehicle != null)
            {
                db.DeleteObject(declarationVehicle);
                int re = db.SaveChanges();
                db.Connection.Close();
                return re;
            }
            return -1;

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

示例9: Delete

 public static int Delete(long trainId)
 {
     var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     try
     {
         if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
         var train = _db.tblTrains.FirstOrDefault(g => g.TrainID == trainId);
         _db.DeleteObject(train);
         return _db.SaveChanges();
     }
     catch
     {
         return -1;
     }
     finally
     {
         _db.Connection.Close();
     }
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:19,代码来源:TrainFactory.cs

示例10: DeleteVehicleType

 public static void DeleteVehicleType(int vehicleTypeID)
 {
     dbEcustomEntities _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     try
     {
         if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
         var tblVehicleTypes = _db.tblVehicleTypes.FirstOrDefault(vt => vt.VehicleTypeID == vehicleTypeID);
         _db.DeleteObject(tblVehicleTypes);
         _db.SaveChanges();
     }
     catch
     {
     }
     finally
     {
         _db.Connection.Close();
     }
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:18,代码来源:VehicleTypeFactory.cs

示例11: DeleteByID

 /// <summary>
 /// Delete Decleration by ID
 /// </summary>
 /// <param name="declerationID">DeclerationID</param>
 /// <returns>Number of rows are effected</returns>
 public static int DeleteByID(long declerationID)
 {
     var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     var declaration = db.tblDeclarations.Where(g => g.DeclarationID == declerationID).FirstOrDefault();
     db.DeleteObject(declaration);
     // Delete all record in VehicleDeclerat Table
     var vehicleDeclere = db.tblDeclarationVehicles.Where(g => g.DeclarationID == declerationID).ToList();
     db.SaveChanges();
     foreach (var item in vehicleDeclere)
     {
         var vehicleDeclereTemp = db.tblDeclarationVehicles.Where(g => g.DeclarationID == declerationID).FirstOrDefault();
         if (vehicleDeclereTemp != null)
             db.DeleteObject(vehicleDeclereTemp);
         db.SaveChanges();
     }
     int re = db.SaveChanges();
     db.Connection.Close();
     return re;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:24,代码来源:DeclarationFactory.cs

示例12: DeleteVehicleChangeByVehicleId

 public static int DeleteVehicleChangeByVehicleId(long vehicleId)
 {
     var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     var list = db.tblVehicleChanges.Where(x => x.VehicleFromID == vehicleId || x.VehicleToID == vehicleId);
     foreach (var vehicleChange in list)
     {
         db.DeleteObject(vehicleChange);
     }
     return db.SaveChanges();
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:10,代码来源:VehicleFactory.cs

示例13: DeleteByID

 /// <summary>
 /// Delete vehicle by ID
 /// </summary>
 /// <param name="vehicleID">Vehicle ID</param>
 /// <returns>Number of rows are effected</returns>
 public static int DeleteByID(long vehicleID)
 {
     var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     var vehicle = db.tblVehicles.Where(g => g.VehicleID == vehicleID).FirstOrDefault();
     if (vehicle != null)
         db.DeleteObject(vehicle);
     db.SaveChanges();
     // Revmove from vehicleDecleration
     var vehicleDeclere = db.tblDeclarationVehicles.Where(g => g.VehicleID == vehicleID).ToList();
     foreach (var item in vehicleDeclere)
     {
         var vehicleDeclereTemp = db.tblDeclarationVehicles.Where(g => g.VehicleID == vehicleID).FirstOrDefault();
         if (vehicleDeclereTemp != null)
             db.DeleteObject(vehicleDeclereTemp);
         db.SaveChanges();
     }
     // TODO:
     db.Connection.Close();
     return 1;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:25,代码来源:VehicleFactory.cs

示例14: DeleteGroupByGroupID

        public static int DeleteGroupByGroupID(int groupID)
        {
          var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
          
          var group = db.tblGroups.Where(g => g.GroupID == groupID).FirstOrDefault();

          if (group == null)
          {
            return 0;
          }

          //delete group
          db.DeleteObject(group);

          //delete group's users in tblUserInGroup
          List<tblUserInGroup> listTblUserInGroup = db.tblUserInGroups.Where(g => g.GroupID == groupID).ToList();
          foreach (tblUserInGroup userInGroup in listTblUserInGroup)
          {
            db.DeleteObject(userInGroup);
          }

          //delete group's permission in tblUserGroupPermistion
          List<tblUserGroupPermission> listUserGroupPermission = db.tblUserGroupPermissions.Where(g => g.GroupID == groupID && g.PermissionType == UserGroupPermissionFactory.PERMISSION_TYPE_GROUP).ToList();
          foreach (tblUserGroupPermission userGroupPermission in listUserGroupPermission)
          {
            db.DeleteObject(userGroupPermission);
          }

          int re = db.SaveChanges();
          db.Connection.Close();
          return re;
        }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:32,代码来源:GroupFactory.cs

示例15: Delete

 public static int Delete (tblVehicleFeeSetting vehicleFee)
 {
     var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     _db.Connection.Open();
     var _vehicleFee = _db.tblVehicleFeeSettings.Where(g => g.VehicleTypeId == vehicleFee.VehicleTypeId && g.GoodsTypeId == vehicleFee.GoodsTypeId).FirstOrDefault();
     if (vehicleFee != null)
     {
         try
         {
             if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
             _db.DeleteObject(_vehicleFee);
             return _db.SaveChanges();
         }
         catch (Exception ex)
         {
             return 0;
         }
         finally
         {
             _db.Connection.Close();
         }
     }
     return 0;
 }
开发者ID:ViniciusConsultor,项目名称:ecustomsgs1,代码行数:24,代码来源:VehicleFeeSettingFactory.cs


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