public ActionResult Delete(int[] cbxItem) { qtUserConfigService _userconfig = new qtUserConfigService(); qtUserConfig userconfig = new qtUserConfig(); if (cbxItem != null && cbxItem.Count() > 0) { qtUserConfigDetailService _userconfigdetail = new qtUserConfigDetailService(); foreach (int item in cbxItem) { try { userconfig = _userconfig.FindByKey(item); if (userconfig != null) { _userconfigdetail.DeleteObject(_userconfigdetail.FindList().Where(m => m.UserConfigId == item).ToList()); _userconfig.Delete(userconfig); } } catch (Exception) { } } } return(RedirectToAction("Index")); }
public static IEnumerable <int?> GetUserTheoMaCauHinhHeThong_GetTheoUserId(string app_code, int?UnitId) { qtUserService _userService = new qtUserService(); qtUser user = new qtUser(); qtUserConfigService _userConfigService = new qtUserConfigService(); IEnumerable <qtUserConfig> danhSachCauhinhUserTheoDonVi = _userConfigService.FindList().Where(x => x.IsActive == true && x.AppCode == app_code); if (UnitId.HasValue) { danhSachCauhinhUserTheoDonVi = danhSachCauhinhUserTheoDonVi.Where(x => x.UnitId == UnitId); } qtUserConfigDetailService _userConfigDetailService = new qtUserConfigDetailService(); List <qtUserConfigDetail> danhSachUserCauHinhTheoDonVi_LanhDao = new List <qtUserConfigDetail>(); foreach (var userConfig in danhSachCauhinhUserTheoDonVi) { IEnumerable <qtUserConfigDetail> danhSachUserMotDonVi = _userConfigDetailService.FindList().Where(x => x.UserConfigId == userConfig.UserConfigId); danhSachUserCauHinhTheoDonVi_LanhDao.AddRange(danhSachUserMotDonVi); } danhSachUserCauHinhTheoDonVi_LanhDao = danhSachUserCauHinhTheoDonVi_LanhDao.OrderBy(x => x.OrderBy).ToList(); return(danhSachUserCauHinhTheoDonVi_LanhDao.Select(x => x.UserId)); }
private qtUserConfigDetail checkUser(int?UserConfigId, int UserId, int?id) { qtUserConfigDetailService _user = new qtUserConfigDetailService(); var item = _user.FindList().Where(m => m.UserId == UserId && m.UserConfigId == UserConfigId).FirstOrDefault(); if (item != null && item.UserConfigDetailId > 0) { return(item); } return(null); }
private string checkUser(int?UserConfigId, int UserId) { qtUserConfigDetailService _user = new qtUserConfigDetailService(); var item = _user.FindList().Where(m => m.UserId == UserId && m.UserConfigId == UserConfigId).Count(); if (item > 0) { return("checked='checked'"); } return(""); }
public static IEnumerable <qtUser> GetUserTheoMaCauHinhHeThong_GetTheoUser(string app_code, int?UnitId) { qtUserService _userService = new qtUserService(); qtUser user = new qtUser(); qtUserConfigService _userConfigService = new qtUserConfigService(); IEnumerable <qtUserConfig> danhSachCauhinhUserTheoDonVi = _userConfigService.FindList().Where(x => x.IsActive == true && x.AppCode == app_code); if (UnitId.HasValue) { danhSachCauhinhUserTheoDonVi = danhSachCauhinhUserTheoDonVi.Where(x => x.UnitId == UnitId); } qtUserConfigDetailService _userConfigDetailService = new qtUserConfigDetailService(); List <qtUserConfigDetail> danhSachUserCauHinhTheoDonVi_LanhDao = new List <qtUserConfigDetail>(); foreach (var userConfig in danhSachCauhinhUserTheoDonVi) { IEnumerable <qtUserConfigDetail> danhSachUserMotDonVi = _userConfigDetailService.FindList().Where(x => x.UserConfigId == userConfig.UserConfigId); danhSachUserCauHinhTheoDonVi_LanhDao.AddRange(danhSachUserMotDonVi); } danhSachUserCauHinhTheoDonVi_LanhDao = danhSachUserCauHinhTheoDonVi_LanhDao.OrderBy(x => x.OrderBy).ToList(); List <qtUser> danhSanhUser_La_LanhDao = new List <qtUser>(); foreach (var userConfigDetail in danhSachUserCauHinhTheoDonVi_LanhDao) { user = _userService.FindByKey(userConfigDetail.UserId); if (user != null) { if (user.Status.GetValueOrDefault(false)) { yield return(user); } } } }