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)); }
public static MvcHtmlString OrderHistoryMemberName_UserName(this HtmlHelper helper, int?UserId, string MemberGuid) { string html = string.Empty; if (UserId.HasValue) { qtUserService _user = new qtUserService(); qtUser user = _user.FindByKey(UserId); if (user != null) { html = user.UserName; } } if (!string.IsNullOrEmpty(MemberGuid) || !string.IsNullOrWhiteSpace(MemberGuid)) { shMemberService _member = new shMemberService(); shMember member = _member.FindByKey(MemberGuid); if (member != null) { html = member.MemberName; } } return(new MvcHtmlString(html)); }
public static MvcHtmlString GetFileImage(this HtmlHelper helper, int UserId) { qtUserService _user = new qtUserService(); return new MvcHtmlString(_user.GetFileImage(UserId)); }
public ActionResult Index(string urlPrefix, string Username, string Password, bool?Remember) { qtUserService _user = new qtUserService(); if (_user.CheckUserLogin(Username, EncryptUtil.EncryptMD5(Password))) { qtUser user = _user.GetUserLogin(Username, EncryptUtil.EncryptMD5(Password)); if (user != null) { if (Remember != null && Remember == true) { HttpCookie ckUsername = new HttpCookie("username"); ckUsername.Expires = DateTime.Now.AddSeconds(3600); ckUsername.Value = Username; Response.Cookies.Add(ckUsername); HttpCookie ckPassword = new HttpCookie("password"); ckPassword.Expires = DateTime.Now.AddSeconds(3600); ckPassword.Value = EncryptUtil.EncryptMD5(Password); Response.Cookies.Add(ckPassword); } HttpContext.User.Identity.SetUserLogin( new Account(user.UserId, user.UserName, user.UserLogin, user.Password, user.Address, user.Sex.ToString(), user.Email, user.Tel, user.Phone, user.Notes, user.UnitId.ToString(), string.Empty, user.DepartmentId.ToString(), string.Empty, user.PositionId.ToString(), string.Empty) ); string url = String.Empty; if (String.IsNullOrEmpty(urlPrefix)) { url = QuanTriHelper.GetFirstPermissionUrlByUser(user, Config.Application); } else { url = urlPrefix; } // fix url = "/DanhMuc/BaoCao/Index"; if (!string.IsNullOrEmpty(url)) { return(Redirect(url)); } else { ModelState.AddModelError("", "Tài khoản chưa được phân quyền"); } return(View()); } else { ModelState.AddModelError("", "Tài khoản không tồn tại trong hệ thống"); } } else { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu không đúng"); } return(View()); }
public ActionResult Create(int?UserId, string UserName, string UserLogin, string Password, string Email, string Tel, int?SortOrder, int?UnitId, int?DepartmentId, int?PositionId, bool?IsAdmin, bool?Status) { qtUserService _user = new qtUserService(); qtUser user = new qtUser(); if (!UserId.HasValue) { UserId = 0; } user = _user.ThemMoi_HieuChinhThongTinUser( UserId.Value, UserName, UserLogin, Password, SortOrder, null, null, null, Email, Tel, null, IsAdmin, null, UnitId, DepartmentId, PositionId, Status, DateTime.Now); return(RedirectToAction("Index")); }
private string DanhSachNguoiDung(int?phongid, int?SubstituteId) { string html = ""; if (phongid.HasValue) { qtUserService _user = new qtUserService(); IEnumerable <qtUser> list = _user.FindList().Where(m => m.DepartmentId == phongid && m.Status == true); if (list.Count() > 0) { html += "<table class='grid' style='width: 100%;'>" + "<thead>" + "<tr>" + "<th>#</th>" + "<th> Họ và tên </th>" + "<th> Chức vụ </th>" + "</thead>"; foreach (C.Core.Model.qtUser user in list) { string check = checkUser(SubstituteId, user.UserId); html += "<tr>" + "<td><input type='checkbox' value=" + user.UserId + " name='cbxItem' id='cbxItem' " + check + " ></td>" + "<td>" + user.UserName + "</td>" + "<td>" + user.qtPosition.PositionName + "</td>" + "</tr>"; } html += "</table>"; } } ViewBag.dsNguoiDung = html; return(html); }
public void DsDropDown(int?UserId) { qtUserService _user = new qtUserService(); IEnumerable <qtUser> dsUser = _user.DanhSachUser(null, TypeHelper.ToInt32(User.Identity.GetUserLogin().Unitid), null); ViewBag.UserId = new SelectList(dsUser, "UserId", "UserName", null); }
public static MvcHtmlString UnitLink(this HtmlHelper helper, int?UnitId, int?UserId) { qtUserService _user = new qtUserService(); string UserName = _user.UserName(UserId); string html = "<a href='/QuanTri/UnitManager/Create/" + UnitId + "'>" + UserName + "</a>"; return(new MvcHtmlString(html)); }
public static MvcHtmlString NhanVienXuLyChinh(this HtmlHelper helper, int? UserId) { qtUserService _user = new qtUserService(); string UserName = _user.UserName(UserId); UserName = "******" + UserName + "</span>"; return new MvcHtmlString(UserName); }
public ActionResult Index() { qtUserService _user = new qtUserService(); int userid = User.Identity.GetUserLogin().Userid; var user = _user.FindByKey(userid); ThongTin(user); ViewBag.hdUserId = userid; return(View(user)); }
public ActionResult Create(int?Id) { qtUserService _user = new qtUserService(); IEnumerable <qtUser> list = _user.FindList().Where(m => m.Status == true && m.IsAdmin == false).OrderBy(m => m.SortOrder); ViewBag.User = list.ToSelectList(u => u.UserName + "-" + u.qtPosition.PositionName + "-" + u.qtDepartment.DepartmentName + "-" + u.qtUnit.UnitName, u => u.UserId.ToString(), Id.ToString()); GetUnit(Id); ViewBag.UserId = Id; return(View()); }
public ActionResult ChuyenNhanVienTheoDoi(string CategoryGuid) { shCategoryService _category = new shCategoryService(); shCategory category = _category.FindByKey(CategoryGuid); qtUserService _user = new qtUserService(); IEnumerable <qtUser> ds = _user.DanhSachUser(null, TypeHelper.ToInt32(User.Identity.GetUserLogin().Unitid), null); ViewBag.UserId = new SelectList(ds, "UserId", "UserName", category.UserId); return(PartialView("ChuyenNhanVienTheoDoi", category)); }
public ActionResult ChuyenXuLyDonHang(string OrderGuid) { shOrderService _order = new shOrderService(); shOrder order = _order.FindByKey(OrderGuid); qtUserService _user = new qtUserService(); IEnumerable <qtUser> ds = _user.DanhSachUser(null, TypeHelper.ToInt32(User.Identity.GetUserLogin().Unitid), null); ViewBag.UserId = new SelectList(ds, "UserId", "UserName", order.UserId); return(PartialView("ChuyenXuLyDonHang", order)); }
public ActionResult Index(string urlPrefix) { ViewBag.urlPrefix = urlPrefix; qtUser userCookie = CheckCookie(); if (userCookie != null) { qtUserService _user = new qtUserService(); if (_user.CheckUserLogin(userCookie.UserLogin, userCookie.Password)) { qtUser user = _user.GetUserLogin(userCookie.UserLogin, userCookie.Password); if (user != null) { HttpContext.User.Identity.SetUserLogin( new Account(user.UserId, user.UserName, user.UserLogin, user.Password, user.Address, user.Sex.ToString(), user.Email, user.Tel, user.Phone, user.Notes, user.UnitId.ToString(), string.Empty, user.DepartmentId.ToString(), string.Empty, user.PositionId.ToString(), string.Empty) ); string url = String.Empty; if (String.IsNullOrEmpty(urlPrefix)) { url = QuanTriHelper.GetFirstPermissionUrlByUser(user, Config.Application); } else { url = urlPrefix; } // fix url = "/DanhMuc/BaoCao/Index"; if (!string.IsNullOrEmpty(url)) { return(Redirect(url)); } else { ModelState.AddModelError("", "Tài khoản chưa được phân quyền"); } return(View()); } else { ModelState.AddModelError("", "Tài khoản không tồn tại trong hệ thống"); } } else { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu không đúng"); } } return(View()); }
private void DanhSachNguoiDung(int?donviId, int?UserConfigId) { string html = ""; if (donviId.HasValue) { qtUserService _user = new qtUserService(); qtDepartmentService _dep = new qtDepartmentService(); IEnumerable <qtDepartment> listdep = _dep.FindList().Where(m => m.UnitId == donviId && m.Status == true); if (listdep.Count() > 0) { html += "<table class='grid' style='width: 100%;'>" + "<thead>" + "<tr>" + "<th width='15%' >#</th>" + "<th width='35%'> Họ và tên </th>" + "<th width='15%'> Thứ tự </th>" + "<th width='40%'> Chức vụ </th>" + "</thead>"; foreach (qtDepartment item in listdep) { html += "<tr>" + "<td colspan='4'>" + item.DepartmentName + "</td>" + "</tr>"; IEnumerable <qtUser> list = _user.FindList().Where(m => m.UnitId == donviId && m.DepartmentId == item.DepartmentId && m.Status == true); if (list.Count() > 0) { foreach (C.Core.Model.qtUser user in list) { qtUserConfigDetail check = checkUser(UserConfigId, user.UserId, null); string _checked = check != null ? "checked='checked'" : ""; string value = check != null?check.OrderBy.ToString() : ""; html += "<tr>" + "<td><input type='checkbox' value=" + user.UserId + " name='cbxItem' id='cbxItem' " + _checked + " ></td>" + "<td>" + user.UserName + "</td>" + //"<td> </td>"+ "<td>" + " <input type='text' class='width-10' id='OrderBy" + user.UserId + "' name='OrderBy" + user.UserId + "' value='" + value + "' />" + "</td>" + "<td>" + user.qtPosition.PositionName + "</td>" + "</tr>"; } } } html += "</table>"; } } ViewBag.dsNguoiDung = html; }
public ActionResult CapNhatThongTin(int hdUserId, string Tel, string Email) { qtUserService _user = new qtUserService(); var user = _user.FindByKey(hdUserId); if (user != null) { user.Tel = Tel; user.Email = Email; _user.Update(user); } UserHelper.SaveFileImage(hdUserId, Request.Files); return(RedirectToAction("Index")); }
public PartialViewResult ListUsers(int?page, int?UnitId, int?DepartmentId, string TenNguoiDung) { int pageCurrent = 1; if (page.HasValue) { pageCurrent = page.Value; } qtUserService _user = new qtUserService(); IPagedList pageList_dsUser = _user.DanhSachUser_PhanTrang(TenNguoiDung, UnitId, DepartmentId, pageCurrent, Config.PAGE_SIZE_10); ViewBag.ListUsers = pageList_dsUser; return(PartialView("ListUsers", pageList_dsUser)); }
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); } } } }
public static MvcHtmlString NhanVienXuLyDanhMuChinh(this HtmlHelper helper, shCategory category) { qtUserService _user = new qtUserService(); string UserName = string.Empty; if (!string.IsNullOrEmpty(category.ParentId) || !string.IsNullOrWhiteSpace(category.ParentId)) { shCategoryService _category = new shCategoryService(); shCategory parent = _category.FindByKey(category.ParentId); if (parent != null) { UserName = "******" + _user.UserName(parent.UserId) + " » </span>"; } } UserName += "<span data-toggle='tooltip' title='Theo dõi chính' data-original-title='Theo dõi chính' style='font-weight: 600; color: #72afd2;'>" + _user.UserName(category.UserId) + "</span>"; return new MvcHtmlString(UserName); }
public void DropDownList(string TuNgay, string DenNgay, string TuKhoa, int?TrangThai, int?NguoiTao) { /* * Trạng thái đơn nhập , xuất hàng */ ViewBag.TuNgay = TuNgay; ViewBag.DenNgay = DenNgay; ViewBag.TuKhoa = TuKhoa; List <DropDownList> ds = GoodReceiptIsuueHelper.DanhSachTrangThaiNhapXuatKho(null); ViewBag.TrangThai = new SelectList(ds, "Value", "Text", TrangThai); qtUserService _user = new qtUserService(); IEnumerable <qtUser> dsU = _user.DanhSachUser(null, TypeHelper.ToInt32(User.Identity.GetUserLogin().Unitid), null); ViewBag.NguoiTao = new SelectList(dsU, "UserId", "UserName", NguoiTao); }
public static void SaveFileImage(int userid, HttpFileCollectionBase FileDinhKem) { qtUserService _user = new qtUserService(); qtUser user = new qtUser(); if (userid > 0) user = _user.FindByKey(userid); if (FileDinhKem.Count >= 1) { HttpPostedFileBase file = FileDinhKem[0]; if (file.FileName != null && file.FileName != "") { string ramdom = Guid.NewGuid().ToString(); string fordelUpload = HttpContext.Current.Server.MapPath("~/AttachFile/") + ramdom + "_" + file.FileName; file.SaveAs(fordelUpload); user.ImageFile = "~/AttachFile/" + ramdom + "_" + file.FileName; if (userid > 0) _user.Update(user); else _user.Insert(user); } } }
public ActionResult Create(int?id, int?UnitId) { qtUserService _user = new qtUserService(); qtUser user = new qtUser(); if (id.HasValue) { ViewBag.UserId = id; user = _user.FindByKey(id); if (user == null) { ModelState.AddModelError("", "Dữ liệu không tồn tại trong hệ thống. Vui lòng kiểm tra lại"); Departments(null, null); return(View(new qtUser())); } } Departments(user.UnitId, user.DepartmentId); return(View(user)); }
public static MvcHtmlString UserName(this HtmlHelper helper, int? UserId) { qtUserService _user = new qtUserService(); return new MvcHtmlString(_user.UserName(UserId)); }