public Model.Profile Single(int profileID) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Profiles.Single(pro => pro.ProfileID == profileID); } }
public List<Model.Profile> AllByUserID(int userID) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Profiles.Where(pro => pro.UserID == userID && pro.Active == true).ToList(); } }
public List<Model.Profile> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Profiles.Where(p => p.Active == true).ToList(); } }
/// <summary> /// Lay tac ca ChucVu hien co /// </summary> /// <returns>List<ChucVu></returns> public List<WebPortal.Model.ChucVu> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.ChucVus.ToList(); } }
public List<WebPortal.Model.ChucVu_GiaoVien> chucvu(int idGiaoVien) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.ChucVu_GiaoVien.Where(app => app.IDGiaoVien == idGiaoVien).ToList(); } }
public List<Model.InRole> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.InRoles.ToList(); } }
public Model.Setting Single(int settingID) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Settings.Single(setting => setting.SettingID == settingID); } }
public WebPortal.Model.ToChuc Single(int idToChuc) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.ToChucs.Single(app => app.IDToChuc == idToChuc); } }
public List<WebPortal.Model.ToChuc_GiaoVien> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.ToChuc_GiaoVien.ToList(); } }
public List<Model.User> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Users.Where(user => user.Active == true).ToList(); } }
public List<WebPortal.Model.TaiNguyen> Paging(int start, int numberRecords) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.TaiNguyens.Skip(start).Take(numberRecords).ToList(); } }
public List<Model.Group> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Groups.Where(gr => gr.Active == true).ToList(); } }
public List<Model.Setting> Paging(int start, int numberRecords) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Settings.Skip(start).Take(numberRecords).ToList(); } }
public List<Model.Permission> Get_All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Permissions.ToList(); } }
public List<WebPortal.Model.TaiNguyen_TinTuc> LayTaiNguyenTheoTin(int idTinTuc) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.TaiNguyen_TinTuc.Where(app => app.IDTinTuc == idTinTuc).ToList(); } }
public List<Model.Permission> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Permissions.Where(per=>per.Active==true).ToList(); } }
public WebPortal.Model.TaiNguyen Single(int idTaiNguyen) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.TaiNguyens.Single(app => app.IDTaiNguyen == idTaiNguyen); } }
public List<WebPortal.Model.TinTuc> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.TinTucs.ToList(); } }
public List<WebPortal.Model.TaiNguyen> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.TaiNguyens.ToList(); } }
public List<WebPortal.Model.LoaiTin_Lv1> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.LoaiTin_Lv1.ToList(); } }
public List<Model.Group> Get_All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Groups.ToList(); } }
public List<WebPortal.Model.GiaoVien> Paging(int start, int numberRecords) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.GiaoViens.OrderBy(gv => gv.IDGiaoVien).Skip(start).Take(numberRecords).ToList(); } }
public List<Model.Setting> All() { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return dataEntities.Settings.ToList(); } }
public List<WebPortal.Model.TinTuc> Paging(int start, int numberRecords,List<WebPortal.Model.TinTuc> listTin) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { return listTin.OrderByDescending(tt => tt.IDTinTuc).Skip(start).Take(numberRecords).ToList(); } }
public bool DecentralizeGroupWithApps(int groupID, List<int> appIDList) { DbTransaction dbTransaction = null; using (WebPortalEntities dataEntities = new WebPortalEntities()) { try { if (dataEntities.Connection.State == System.Data.ConnectionState.Closed) { dataEntities.Connection.Open(); } dbTransaction = dataEntities.Connection.BeginTransaction(); //Delete old data for apps & groups var oldInRoleList = dataEntities.InRoles; foreach (var inrole in oldInRoleList) { if (inrole.GroupID == groupID) { dataEntities.InRoles.DeleteObject(inrole); } } //Insert new data for apps & groups foreach (var id in appIDList) { var newInRole = new Model.InRole(); newInRole.ApplicationID = id; newInRole.GroupID = groupID; newInRole.DateCreate = DateTime.Now; newInRole.Active = true; dataEntities.InRoles.AddObject(newInRole); } if (dataEntities.SaveChanges() != 0) { dbTransaction.Commit(); return true; } else { dbTransaction.Rollback(); return false; } } catch { dbTransaction.Rollback(); return false; } finally { if (dataEntities.Connection.State == System.Data.ConnectionState.Open) { dataEntities.Connection.Close(); } } } }
public bool DecentralizeGroupWithPermission(int groupID, List<int> permissionIDList) { DbTransaction dbTransaction = null; using (WebPortalEntities dataEntities = new WebPortalEntities()) { try { if (dataEntities.Connection.State == System.Data.ConnectionState.Closed) { dataEntities.Connection.Open(); } dbTransaction = dataEntities.Connection.BeginTransaction(); //Delete old data for permission & groups var oldFilePermissionList = dataEntities.FilePermissions; foreach (var filePermission in oldFilePermissionList) { if (filePermission.GroupID == groupID) { dataEntities.FilePermissions.DeleteObject(filePermission); } } //Insert new data for permission & groups foreach (var id in permissionIDList) { var per = dataEntities.Permissions.Single(p => p.PermissionID == id); var newFilePermission = new Model.FilePermission(); newFilePermission.PermissionID = id; newFilePermission.GroupID = groupID; newFilePermission.FolderPath = per.Name; dataEntities.FilePermissions.AddObject(newFilePermission); } if (dataEntities.SaveChanges() != 0) { dbTransaction.Commit(); return true; } else { dbTransaction.Rollback(); return false; } } catch { dbTransaction.Rollback(); return false; } finally { if (dataEntities.Connection.State == System.Data.ConnectionState.Open) { dataEntities.Connection.Close(); } } } }
public bool DecentralizeUserWithGroups(int userID, List<int> groupIDList) { DbTransaction dbTransaction = null; using (WebPortalEntities dataEntities = new WebPortalEntities()) { try { if (dataEntities.Connection.State == System.Data.ConnectionState.Closed) { dataEntities.Connection.Open(); } dbTransaction = dataEntities.Connection.BeginTransaction(); //Delete old data for groups & user var oldInGroupList = dataEntities.InGroups; foreach (var ingroup in oldInGroupList) { if (ingroup.UserID == userID) { dataEntities.InGroups.DeleteObject(ingroup); } } //Insert new data for groups & user foreach (var id in groupIDList) { var newInGroup = new Model.InGroup(); newInGroup.UserID = userID; newInGroup.GroupID = id; newInGroup.DateCreate = DateTime.Now; newInGroup.Active = true; dataEntities.InGroups.AddObject(newInGroup); } if (dataEntities.SaveChanges() != 0) { dbTransaction.Commit(); return true; } else { dbTransaction.Rollback(); return false; } } catch { dbTransaction.Rollback(); return false; } finally { if (dataEntities.Connection.State == System.Data.ConnectionState.Open) { dataEntities.Connection.Close(); } } } }
public int Delete(Model.Setting setting) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { dataEntities.DeleteObject(setting); return dataEntities.SaveChanges(); } }
public int Delete(Model.Permission permission) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { dataEntities.DeleteObject(permission); return dataEntities.SaveChanges(); } }
public int Add(Model.Setting setting) { using (WebPortalEntities dataEntities = new WebPortalEntities()) { dataEntities.AddToSettings(setting); return dataEntities.SaveChanges(); } }