예제 #1
0
 public List <Menu> GetAll()
 {
     using (var context = new KNSSContext <Menu>())
     {
         return(context.Set <Menu>().ToList());
     }
 }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
 public Menu GetDataById(string menuId)
 {
     using (KNSSContext <Menu> context = new KNSSContext <Menu>())
     {
         return(context.DBEntities.Where(i => i.MenuId == menuId).FirstOrDefault());
     }
 }
예제 #4
0
        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);
                }
            }
        }
예제 #5
0
 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());
     }
 }
예제 #6
0
 public Group GetDataById(string groupId)
 {
     using (KNSSContext <Group> context = new KNSSContext <Group>())
     {
         return(context.DBEntities.Where(i => i.GroupId == groupId).FirstOrDefault());
     }
 }
예제 #7
0
 public Report GetDataById(string reportId)
 {
     using (KNSSContext <Report> context = new KNSSContext <Report>())
     {
         return(context.DBEntities.Where(i => i.ReportId == Convert.ToInt16(reportId)).FirstOrDefault());
     }
 }
예제 #8
0
        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);
                }
            }
        }
예제 #9
0
        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);
                }
            }
        }