本文整理汇总了C#中ECustoms.DAL.dbEcustomEntities类的典型用法代码示例。如果您正苦于以下问题:C# dbEcustomEntities类的具体用法?C# dbEcustomEntities怎么用?C# dbEcustomEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
dbEcustomEntities类属于ECustoms.DAL命名空间,在下文中一共展示了dbEcustomEntities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllVehicleNotCompleted
public static List<ViewVehicleOverdue> GetAllVehicleNotCompleted()
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
List<ViewVehicleOverdue> data = db.ViewVehicleOverdues.Where(g => g.IsCompleted != true).ToList();
db.Connection.Close();
return data;
}
示例2: GetPermissionByType
public static List<tblPermission> GetPermissionByType(string type)
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
List<tblPermission> list = db.tblPermissions.Where(g => g.TypeCode == type).ToList();
db.Connection.Close();
return list;
}
示例3: SelectByID
public static ViewAllCheckResult SelectByID(int vehicleCheckID)
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
ViewAllCheckResult allCheckResult = db.ViewAllCheckResults.Where(g => g.VehicleCheckID == vehicleCheckID).FirstOrDefault();
db.Connection.Close();
return allCheckResult;
}
示例4: GetTblUserInGroupByGroupID
public static List<tblUserInGroup> GetTblUserInGroupByGroupID(int groupID)
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
var userGroups = db.tblUserInGroups.Where(g => g.GroupID == groupID).ToList();
db.Connection.Close();
return userGroups;
}
示例5: Update
public static int Update(tblVehicleType vehicletype)
{
var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
_db.Connection.Open();
var _vehicletype = (from vt in _db.tblVehicleTypes
where vt.VehicleTypeID == vehicletype.VehicleTypeID
select vt).First();
_vehicletype.Name = vehicletype.Name;
_vehicletype.Capacity = vehicletype.Capacity;
_vehicletype.Description = vehicletype.Description;
vehicletype.UpdatedDate = CommonFactory.GetCurrentDate();
try
{
if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
_db.SaveChanges();
}
catch (Exception ex)
{
return 1;
}
finally
{
if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
_db.Connection.Close();
}
return 0;
}
示例6: GetAllAllVehicleCompleted
/// <summary>
/// Hien lên những xe đã hoàn thành thủ tục và đã trả hồ sơ của ngày hiện tại
/// </summary>
/// <returns></returns>
public static List<ViewAllVehicleHasGood> GetAllAllVehicleCompleted()
{
DateTime today = CommonFactory.GetCurrentDate();
var startToday = new DateTime(today.Year, today.Month, today.Day, 0, 0, 0);
var endToday = new DateTime(today.Year, today.Month, today.Day, 23, 59, 59);
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
//var data = db.ViewAllVehicleHasGoods.Where(g => g.ConfirmStatus != null && g.IsGoodsImported == true && g.IsCompleted == true && g.ConfirmDate >= startToday && g.ConfirmDate <= endToday).OrderByDescending(g => g.ImportDate).ToList();
//tim cac xe da nhap canh co hang, nhung chua vao noi dia, va co to khai da xac nhan tra ho so, chi hien thi theo ngay tra so so = ngay hien tai
List<ViewAllVehicleHasGood> data = db.ViewAllVehicleHasGoods.Where(g => g.HasGoodsImported == true && g.IsCompleted != true && g.ConfirmStatus != null && g.ConfirmDate >= startToday && g.ConfirmDate <= endToday).OrderByDescending(g => g.ConfirmDate).ToList();
db.Connection.Close();
List<ViewAllVehicleHasGood> list = new List<ViewAllVehicleHasGood>();
HashSet<long> listVehicleId = new HashSet<long>();
if (data != null && data.Count > 0)
{
foreach (ViewAllVehicleHasGood obj in data)
{
if (listVehicleId.Add(obj.VehicleID))
{
list.Add(obj);
}
}
}
return list;
}
示例7: Update
public static int Update(tblType typeObj)
{
dbEcustomEntities _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
_db.Connection.Open();
tblType originType = _db.tblTypes.Where(g => g.TypeCode == typeObj.TypeCode).FirstOrDefault();
if (originType == null)
{
return -1;
}
originType.TypeName = typeObj.TypeName;
originType.Description = typeObj.Description;
originType.ModifiedBy = typeObj.ModifiedBy;
originType.ModifiedDate = CommonFactory.GetCurrentDate();
try
{
return _db.SaveChanges();
}
catch (Exception ex)
{
return -1;
}
finally
{
_db.Connection.Close();
}
}
示例8: DeleteItem
public bool DeleteItem(string[] itemParams)
{
if (itemParams.Length < 3) return false;
int id = itemParams[0].StringToInt();
int verhiceId = itemParams[1].StringToInt();
string branchId = itemParams[2];
var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
try
{
var deleteItem =
_db.tblDeclarationVehicles.FirstOrDefault(
item => item.DeclarationID == id && item.VehicleID == verhiceId && item.BranchId == branchId);
if (deleteItem != null)
{
_db.DeleteDirectly(deleteItem);
_db.SaveChanges();
}
return true;
}
catch (Exception exception)
{
LogManager.GetLogger("ECustoms.DeclarationVehicleFactory").Error(exception.ToString());
throw;
}
finally
{
_db.Connection.Close();
}
}
示例9: 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();
}
示例10: 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;
}
示例11: GetCurrentDate
public static DateTime GetCurrentDate()
{
var db = new dbEcustomEntities(Utilities.Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
var objCurentDate = db.ViewGetCurrentDates.FirstOrDefault();
db.Connection.Close();
return objCurentDate.CurrentDateTime;
}
示例12: SelectVehicleCheckByID
public static tblVehicleCheck SelectVehicleCheckByID(int vehicleCheckID)
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
tblVehicleCheck vehicleCheck = db.tblVehicleChecks.Where(g => g.VehicleCheckID == vehicleCheckID).FirstOrDefault();
db.Connection.Close();
return vehicleCheck;
}
示例13: GetTypeNameById
public static string GetTypeNameById(int goodTypeId)
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
var typeName = db.tblGoodsTypes.Where(g => g.TypeId == goodTypeId).Select(g=>g.TypeName).FirstOrDefault();
db.Connection.Close();
return typeName;
}
示例14: GetByUserID
public static List<ViewUserGroup> GetByUserID(int userID)
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
List<ViewUserGroup> list= db.ViewUserGroups.Where(g => g.UserID == userID).ToList();
db.Connection.Close();
return list;
}
示例15: GetAllPermissionType
public static List<tblPermissionType> GetAllPermissionType()
{
var db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
List<tblPermissionType> list = db.tblPermissionTypes.ToList();
db.Connection.Close();
return list;
}