本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}