public static void Update(EquGroupVM item) { EquGroup dbItem = GetSingleById(item.Id); dbItem.UpdateEquGroup(item); RepositoryBase <EquGroup> .Update(dbItem); RepositoryBase <EquGroup> .SaveChanges(); }
public static void SetBlocked(string Id, bool value, string StaffID) { EquGroup model = GetSingleById(Id); model.Blocked = value; model.UpdatedDate = DateTime.Now; model.UpdatedBy = StaffID; RepositoryBase <EquGroup> .SaveChanges(); }
public static void SetActived(string Id, bool value) { EquGroup model = RepositoryBase <EquGroup> .GetSingleById(Id); model.Actived = value; model.UpdatedDate = DateTime.Now; model.UpdatedBy = HttpContext.Current.User.Identity.Name; RepositoryBase <EquGroup> .SaveChanges(); }
public static EquGroup Add(EquGroupVM item) { EquGroup dbItem = new EquGroup(); dbItem.UpdateEquGroup(item); dbItem.Id = item.Id; dbItem.Actived = item.Actived; dbItem.CreatedDate = DateTime.Now; dbItem.CreatedBy = HttpContext.Current.User.Identity.Name; EquGroup model = RepositoryBase <EquGroup> .Add(dbItem); RepositoryBase <EquGroup> .SaveChanges(); return(dbItem); }
public static void UpdateEquGroup(this EquGroup item, EquGroupVM itemVM) { item.Name = itemVM.Name; }
EquGroup _superG; //надгруппа #endregion Fields #region Constructors //конструктор public EquGroup(EquGroup superGroup, string name, int level, string cretereaType, string cretereaValue, string subGroupsCretereaType) { _superG = superGroup; _subG = new List<EquGroup>(); _name = name; _level = level; _repairsCount = 0; _equipmentCount = 0; _repairProbabitity = null; //признаки контроллеров в группе _cretereaType = cretereaType; _cretereaValue = cretereaValue; _subGroupsCretereaType = subGroupsCretereaType; }
//метод: создает новую подгруппу и обновляет коллекцию всех групп дерева EquGroup CreateNewSubGroup(EquGroup superGroup, string cretereaValue) { EquGroup group = new EquGroup(superGroup, superGroup.SubGroupName(cretereaValue), superGroup.Level + 1, superGroup.SubGroupsCretereaType, cretereaValue, GetCreterea(superGroup.Level + 2)); _allGroups.Add(group); superGroup.SubGroups.Add(group); return group; }
//конструктор public EquGroupTree(List<string> cretereas) { _cretereas = cretereas; _maxDepth = cretereas.Count; _topGroup = new EquGroup(null, "", 0, null, null,GetCreterea(1)); _allGroups = new List<EquGroup>(); _allGroups.Add(_topGroup); }