Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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"));
        }
Ejemplo n.º 4
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 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);
         }
     }
 }
Ejemplo n.º 6
0
        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));
        }