public List <Menu> GetAll() { using (var context = new KNSSContext <Menu>()) { return(context.Set <Menu>().ToList()); } }
public void Update(Menu entity) { using (var context = new KNSSContext <Menu>()) { Menu data = context.DBEntities.Where(i => i.MenuId == entity.MenuId).FirstOrDefault(); if (data == null) { throw new Exception("Data Not Exist"); } else { spName = "uspg_MenuUpdate"; spType = "edit"; spParams.Clear(); spParams.Add("menuId", entity.MenuId); spParams.Add("menuName", entity.MenuName); spParams.Add("parentId", entity.ParentId); spParams.Add("url", entity.Url); spParams.Add("sort", entity.Sort.ToString()); spParams.Add("icon", entity.Icon); spParams.Add("siteMap", entity.SiteMap); spParams.Add("typeMenu", entity.TypeMenu); spParams.Add("isPublic", entity.IsPublic); spParams.Add("editDate", entity.EditDate.ToString()); spParams.Add("editBy", entity.EditBy); Library.ExecSP(spName, spType, spParams); } } }
public Menu GetDataById(string menuId) { using (KNSSContext <Menu> context = new KNSSContext <Menu>()) { return(context.DBEntities.Where(i => i.MenuId == menuId).FirstOrDefault()); } }
public void Add(Group entity) { using (var context = new KNSSContext <Group>()) { Group data = context.DBEntities.Where(x => x.GroupId == entity.GroupId).FirstOrDefault(); if (data != null) { throw new Exception("Data Already Exist"); } else { spName = "uspg_GroupInsert"; spType = "add"; spParams.Clear(); spParams.Add("groupId", entity.GroupId); spParams.Add("groupName", entity.GroupName); spParams.Add("createDate", entity.CreateDate.ToString()); spParams.Add("createBy", entity.CreateBy); spParams.Add("editDate", entity.EditDate.ToString()); spParams.Add("editBy", entity.EditBy); Library.ExecSP(spName, spType, spParams); } } }
public List <Group> GetDataByFilter(string groupId, string groupName) { using (KNSSContext <Group> context = new KNSSContext <Group>()) { return(context.DBEntities.Where(i => i.GroupId.Contains(groupId) || i.GroupName.Contains(groupName)).ToList()); } }
public Group GetDataById(string groupId) { using (KNSSContext <Group> context = new KNSSContext <Group>()) { return(context.DBEntities.Where(i => i.GroupId == groupId).FirstOrDefault()); } }
public Report GetDataById(string reportId) { using (KNSSContext <Report> context = new KNSSContext <Report>()) { return(context.DBEntities.Where(i => i.ReportId == Convert.ToInt16(reportId)).FirstOrDefault()); } }
public void Delete(Menu entity) { using (var context = new KNSSContext <Menu>()) { Menu data = context.DBEntities.Where(x => x.MenuId == entity.MenuId).FirstOrDefault(); if (data == null) { throw new Exception("Data Not Exist"); } else { spName = "uspg_MenuDelete"; spType = "delete"; spParams.Clear(); spParams.Add("menuId", entity.MenuId); Library.ExecSP(spName, spType, spParams); } } }
public void Update(Group entity) { using (var context = new KNSSContext <Group>()) { Group data = context.DBEntities.Where(i => i.GroupId == entity.GroupId).FirstOrDefault(); if (data == null) { throw new Exception("Data Not Exist"); } else { spName = "uspg_GroupUpdate"; spType = "edit"; spParams.Clear(); spParams.Add("groupId", entity.GroupId); spParams.Add("groupName", entity.GroupName); spParams.Add("editDate", entity.EditDate.ToString()); spParams.Add("editBy", entity.EditBy); Library.ExecSP(spName, spType, spParams); } } }