Ejemplo n.º 1
0
        public IActionResult Delete(int id, string lang)
        {
            IActionResult response      = null;
            GeneralModels generalModels = new GeneralModels();
            General       general       = null;

            general = generalModels.GetGeneral((int)id, lang);

            if (general != null)
            {
                ////delete category
                bool rt = generalModels.DeleteById((int)id);

                if (rt)
                {
                    response = Json(new { code = Constant.Success, message = Constant.MessageDeleteCompleted });
                }
                else
                {
                    response = Json(new { code = Constant.Fail, message = Constant.MessageDeleteUncompleted });
                }
            }
            else
            {
                response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist });
            }

            return(response);
        }
Ejemplo n.º 2
0
        public IActionResult Post([FromBody] AdminGeneralEditView generalView)
        {
            IActionResult response      = null;
            GeneralModels generalModels = new GeneralModels();
            General       general       = new General();
            var           rt            = false;

            general.GeneralName    = generalView.GeneralName;
            general.GeneralContent = generalView.GeneralContent;
            general.Show           = generalView.Show;
            general.Lang           = generalView.Lang;

            rt = generalModels.Add(general);

            if (rt)
            {
                response = Json(new { code = Constant.Success, message = Constant.MessageCreateCompleted });
            }
            else
            {
                response = Json(new { code = Constant.Fail, message = Constant.MessageCreateUncompleted });
            }

            return(response);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Contents the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>the content</returns>
        public ActionResult Content(int id)
        {
            PageModels pageModels = new PageModels();
            var        page_view  = new Page_static_view();

            id = Convert.ToInt16(RouteData.Values["id"].ToString());
            page_view.C_pages = pageModels.GetbyID(id);

            string strBread;

            if (page_view.C_pages.Title != string.Empty)
            {
                ViewBag.Title = page_view.C_pages.Title + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread      = "<li>" + page_view.C_pages.Title + "</li>";
            }
            else
            {
                ViewBag.Title = page_view.C_pages.PageName + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread      = "<li>" + page_view.C_pages.PageName + "</li>";
            }

            this.AddMeta(CommonGlobal.Keyword, page_view.C_pages.Keyword);
            this.AddMeta(CommonGlobal.Description, page_view.C_pages.Description);
            page_view.Str_breadcrumbs = strBread;

            return(this.PartialView("../page/content", page_view));
        }
Ejemplo n.º 4
0
        public IActionResult GetGeneral(string name, string lang)
        {
            IActionResult response      = null;
            GeneralModels generalModels = new GeneralModels();
            General       general       = new General();
            var           generalView   = new AdminGeneralView();

            if (string.IsNullOrEmpty(lang))
            {
                lang = LanguageModels.ActiveLanguage().LangCultureName;
            }

            general = generalModels.GetGeneral(name, lang);
            if (general != null)
            {
                generalView.GeneralId      = general.GeneralId;
                generalView.GeneralName    = general.GeneralName;
                generalView.GeneralContent = general.GeneralContent;
                generalView.Show           = general.Show;
                generalView.Lang           = general.Lang;

                response = Json(generalView);
            }

            return(response);
        }
        public ActionResult Footer(string act, string ctrl, string type_act, string type, string lang)
        {
            var           footer_view   = new Web.Areas.Admin.ViewModels.Footer_view();
            WebInfoModels webInfoModels = new WebInfoModels();

            if (string.IsNullOrEmpty(act))
            {
                act = Request.QueryString["act"] != null ? Request.QueryString["act"].ToString() : "footer";
            }

            if (string.IsNullOrEmpty(ctrl))
            {
                ctrl = Request.QueryString["ctrl"] != null ? Request.QueryString["ctrl"].ToString() : "adminGeneral";
            }

            if (string.IsNullOrEmpty(type_act))
            {
                type_act = Request.QueryString["type_act"] != null ? Request.QueryString["type_act"].ToString() : CommonGlobal.View;
            }

            if (string.IsNullOrEmpty(lang))
            {
                lang = LanguageModels.ActiveLanguage().LangCultureName;
            }

            try
            {
                footer_view.Footer  = GeneralModels.GetContent(CommonGlobal.PageFooter, lang);
                footer_view.Footer1 = GeneralModels.GetContent(CommonGlobal.PageFooter1, lang);
                footer_view.Footer2 = GeneralModels.GetContent(CommonGlobal.PageFooter2, lang);
                footer_view.Footer3 = GeneralModels.GetContent(CommonGlobal.PageFooter3, lang);
                footer_view.Footer4 = GeneralModels.GetContent(CommonGlobal.PageFooter4, lang);
                footer_view.Footer5 = GeneralModels.GetContent(CommonGlobal.PageFooter5, lang);
            }
            catch (Exception)
            {
                footer_view.Message = "Đã xảy ra lỗi trong quá trình lấy dữ liệu.";
            }

            ////Link tab
            StringBuilder sb = new StringBuilder();

            sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "system_config", ctrl = "adminGeneral", type_act = CommonGlobal.Edit }) + "\"><span>Cấu hình chung</span></a></li>");
            sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "system_email", ctrl = "adminGeneral", type_act = CommonGlobal.Edit }) + "\"><span>Cấu hình email</span></a></li>");
            sb.Append("<li class=\"active\"><a href=\"#\"><span>Footer</span></a></li>");
            footer_view.Html_link_tab = sb.ToString();
            ////list language
            footer_view.List_language = this.List_select_language(lang);
            ////action
            footer_view.Type              = type;
            footer_view.Type_act          = type_act;
            footer_view.Act               = act;
            footer_view.Ctrl              = ctrl;
            footer_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            footer_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/footer", footer_view));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Posts the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="cate_id">The cate identifier.</param>
        /// <param name="cate_type">Type of the cate.</param>
        /// <returns>Posts the specified</returns>
        public ActionResult LookbookDetail(int?id, string cate_type)
        {
            /////lookbook detail
            GalleryModels sv         = new GalleryModels();
            CatalogModels cateModels = new CatalogModels();
            C_Catalog     cateItem   = new C_Catalog();

            id = RouteData.Values["id"] != null?Convert.ToInt16(RouteData.Values["id"].ToString()) : 0;

            var link = RouteData.Values["Link"] != null ? RouteData.Values["Link"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(cate_type))
            {
                cate_type = CommonGlobal.CateGallery;
            }

            if (id == 0)
            {
                return(this.HttpNotFound());
            }
            else
            {
                cateItem = cateModels.GetbyID((int)id);

                if (cateItem.CatalogID == 0)
                {
                    return(this.HttpNotFound());
                }

                ViewBag.Title = cateItem.CategoryName + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);

                ////breadcrumbs
                string strbreadcrumbs = string.Empty;

                strbreadcrumbs = string.Format("<li><a href=\"" + Url.Action("lookbook", "gallery") + "\">" + App_GlobalResources.Lang.mnuGallery + "</a></li>");
                if (cateItem != null)
                {
                    strbreadcrumbs   += string.Format("<li><a href=\"" + Url.RouteUrl("_lookbook", new { controller = "gallery", action = "LookbookDetail", id = id, Link = cateItem.Link != null ? cateItem.Link : string.Empty, cate_type = cate_type }) + "\">" + cateItem.CategoryName + "</a></li>");
                    ViewBag.cate_name = cateItem.CategoryName;
                }

                strbreadcrumbs += string.Format("<li>" + cateItem.CategoryName + "</li>");

                ViewBag.str_breadcrumbs = strbreadcrumbs;
                ViewBag.back_link       = Url.RouteUrl("_lookbook", new { controller = "gallery", action = "LookbookDetail", id = id, Link = cateItem.Link != null ? cateItem.Link : string.Empty, cate_type = cate_type });
                ViewBag.heading         = cateItem.CategoryName;

                this.AddMeta(CommonGlobal.Keyword, cateItem.CategoryName);
                this.AddMeta(CommonGlobal.Description, this.ClearHtml(HttpUtility.HtmlDecode(cateItem.Description)));
                ViewBag.id        = id;
                ViewBag.cate_id   = id;
                ViewBag.cate_type = cate_type;
                ViewBag.ImagePath = cateItem.ImagePath;
                ViewBag.MoreInfo  = cateItem.MoreInfo;

                return(this.PartialView("../page/lookbookDetail"));
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Posts the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="search">The search.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="param">The parameter.</param>
        /// <param name="style_list">The style list.</param>
        /// <param name="type">The type.</param>
        /// <returns>the post</returns>
        public ActionResult Posts(int?id, string search, string tag, string param, string style_list, string type)
        {
            /////list post
            var    posts_view = new Posts_view();
            string strBread;

            id = RouteData.Values["id"] != null?Convert.ToInt16(RouteData.Values["id"].ToString()) : 0;

            var link = RouteData.Values["Link"] != null ? RouteData.Values["Link"].ToString() : string.Empty;

            if (Request.QueryString["search"] != null && Request.QueryString["search"].ToString() != string.Empty)
            {
                search = HttpUtility.HtmlDecode(Request.QueryString["search"].ToString());
            }

            if (id == 0)
            {
                ViewBag.Title           = App_GlobalResources.Lang.strPost + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread                = "<li>" + App_GlobalResources.Lang.strPost + "</li>";
                posts_view.Heading      = App_GlobalResources.Lang.strPost;
                ViewBag.str_breadcrumbs = strBread;
            }
            else
            {
                CatalogModels cateModels = new CatalogModels();
                C_Catalog     obj        = cateModels.GetbyID((int)id);
                if (obj.Title != string.Empty)
                {
                    ViewBag.Title      = obj.Title + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                    strBread           = "<li>" + obj.Title + "</li>";
                    posts_view.Heading = obj.Title;
                }
                else
                {
                    ViewBag.Title      = obj.CategoryName + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                    strBread           = "<li>" + obj.CategoryName + "</li>";
                    posts_view.Heading = obj.CategoryName;
                }

                this.AddMeta(CommonGlobal.Keyword, obj.Keyword);
                this.AddMeta(CommonGlobal.Description, obj.Description);
                ViewBag.str_breadcrumbs = strBread;
            }

            posts_view.Link        = link;
            posts_view.Cate_id     = id ?? 0;
            posts_view.Text_search = search;
            posts_view.Tag         = tag;
            posts_view.Param       = param;
            posts_view.Style_list  = style_list;
            posts_view.Cate_type   = type;

            return(this.PartialView("../page/posts", posts_view));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns>the index</returns>
        public ActionResult Index()
        {
            ViewBag.Title = GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            this.AddMeta(CommonGlobal.Keyword, GeneralModels.GetContent(CommonGlobal.Keyword, this.Lang));
            this.AddMeta(CommonGlobal.Description, GeneralModels.GetContent(CommonGlobal.Description, this.Lang));
            WebInfoModels web_infor = new Models.WebInfoModels();

            ViewBag.slogan = GeneralModels.GetContent(CommonGlobal.Slogan, this.Lang);

            return(this.PartialView("../page/index"));
        }
Ejemplo n.º 9
0
        public Position RegisterPosition(GeneralModels model)
        {
            Position position = new Position();

            position.Createdate  = DateTime.Now;
            position.Description = model.Description;
            position.Name        = model.Name;
            _context.Position.Add(position);
            this.SaveChanges();
            return(position);
        }
Ejemplo n.º 10
0
        public ActionResult Menu_account_head()
        {
            WebInfoModels web_infor = new Models.WebInfoModels();

            ViewBag.hotline  = web_infor.GetContent(CommonGlobal.Hotline);
            ViewBag.email    = web_infor.GetContent(CommonGlobal.Email);
            ViewBag.address  = GeneralModels.GetContent(CommonGlobal.Address, this.Lang);
            ViewBag.slogan   = GeneralModels.GetContent(CommonGlobal.Slogan, this.Lang);
            ViewBag.facebook = web_infor.GetContent(CommonGlobal.Facebook);

            return(this.PartialView("../control/menu_account_head"));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Look books this instance.
        /// </summary>
        /// <returns>Look books this instance</returns>
        public ActionResult Lookbook()
        {
            /////list album
            string strBread;

            ViewBag.Title           = App_GlobalResources.Lang.mnuGallery + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            strBread                = "<li>" + App_GlobalResources.Lang.mnuGallery + "</li>";
            ViewBag.heading         = App_GlobalResources.Lang.mnuGallery;
            ViewBag.str_breadcrumbs = strBread;
            this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.mnuGallery);
            this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.mnuGallery);

            return(this.PartialView("../page/lookbook"));
        }
 public IActionResult Register(GeneralModels model)
 {
     try
     {
         PositionRepository posRepo  = new PositionRepository();
         Position           position = posRepo.RegisterPosition(model);
         Helper.Alert("Register Position Success");
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         Helper.Alert(ex.Message);
         return(View(model));
     }
 }
 public IActionResult Register(GeneralModels model)
 {
     try
     {
         SubDeparmentRepository subdepRepo = new SubDeparmentRepository();
         Subdepartment          subDept    = subdepRepo.RegisterSubdepartment(model);
         Helper.Alert("Register Subdepartment Success");
         return(RedirectToAction("Index", "Department"));
     }
     catch (Exception ex)
     {
         Helper.Alert(ex.Message);
         return(View(model));
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// the Contacts this instance.
        /// </summary>
        /// <returns>the Contact</returns>
        public ActionResult Contact()
        {
            string contact_content;
            string strBread;

            ViewBag.Title           = App_GlobalResources.Lang.mnuContact + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            strBread                = "<li>" + App_GlobalResources.Lang.mnuContact + "</li>";
            ViewBag.heading         = App_GlobalResources.Lang.mnuContact;
            ViewBag.str_breadcrumbs = strBread;
            this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.mnuContact);
            this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.mnuContact);

            contact_content = GeneralModels.GetContent(CommonGlobal.Contact, this.Lang);

            return(this.PartialView("../page/contact"));
        }
Ejemplo n.º 15
0
        public Position UpdatePosition(GeneralModels model)
        {
            Position position = this.GetPositionById(model.Id);

            if (position != null)
            {
                position.Description = model.Description;
                position.Name        = model.Name;
                position.Updatedate  = DateTime.Now;
                this.SaveChanges();
                return(position);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// About this instance.
        /// </summary>
        /// <returns>About this instance</returns>
        public ActionResult About()
        {
            string about_content;
            string strBread;

            ViewBag.Title           = App_GlobalResources.Lang.mnuAbout + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            strBread                = "<li>" + App_GlobalResources.Lang.mnuAbout + "</li>";
            ViewBag.heading         = App_GlobalResources.Lang.mnuAbout;
            ViewBag.str_breadcrumbs = strBread;
            this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.mnuAbout);
            this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.mnuAbout);

            about_content         = GeneralModels.GetContent(CommonGlobal.AboutContent, this.Lang);
            ViewBag.short_content = GeneralModels.GetContent(CommonGlobal.AcountShort, this.Lang);

            return(this.PartialView("../page/about", about_content));
        }
Ejemplo n.º 17
0
        public ActionResult Forgot_password(FormCollection collection)
        {
            OrderModels   orderModels = new OrderModels();
            WebInfoModels web_infor   = new WebInfoModels();
            UserModels    sv          = new UserModels();
            C_User        it          = new C_User();
            var           login_view  = new Login_view();

            this.TryUpdateModel(login_view);

            login_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            login_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            login_view.Return_url        = Url.Action("login", "dashboard", new { area = "admin" });

            ////check user_name or email
            it = sv.GetUserbyUserName(login_view.User_name);
            if (it != null)
            {
                login_view.Message = App_GlobalResources.Lang.strMessageSendNewPassword;
                string code = GetCodeUniqueKey(8); ////orderModels.getOrderCodeUnique();
                string link = Url.Action("change_password", "dashboard", new { cfcode = MD5Extend.EncodePassword(code + " " + login_view.User_name), area = "admin" });
                //// send email to client
                var strBody_email_client = GeneralModels.GetContent(CommonGlobal.EmailConfirmForgotPassword, Lang).ToString(); ////get from email template
                strBody_email_client = strBody_email_client.Replace("{domain}", Util.GetConfigValue("Domain", Request.UserHostName).ToString());
                strBody_email_client = strBody_email_client.Replace("{store_name}", GeneralModels.GetContent(CommonGlobal.PageName, Lang).ToString());
                strBody_email_client = strBody_email_client.Replace("{email}", web_infor.GetContent(CommonGlobal.Email).ToString());
                strBody_email_client = strBody_email_client.Replace("{email_client}", login_view.User_name);
                strBody_email_client = strBody_email_client.Replace("{code}", code);
                strBody_email_client = strBody_email_client.Replace("{link}", Util.GetConfigValue("Domain", Request.UserHostName).ToString() + link);
                ////send email to email system
                if (login_view.User_name == "Admin")
                {
                    CommonGlobal.SendMail(web_infor.GetContent(CommonGlobal.Email), App_GlobalResources.Lang.strSubjectConfirmForgotPassword + "- " + Util.GetConfigValue("Domain", Request.UserHostName).ToString(), strBody_email_client);
                }
                else
                {
                    CommonGlobal.SendMail(login_view.User_name, App_GlobalResources.Lang.strSubjectConfirmForgotPassword + "- " + Util.GetConfigValue("Domain", Request.UserHostName).ToString(), strBody_email_client);
                }
            }
            else
            {
                login_view.Message = App_GlobalResources.Lang.strMessageForgotPassword;
            }

            return(this.PartialView("../page/forgot_password", login_view));
        }
        public IActionResult Edit(int Id)
        {
            PositionRepository posRepo  = new PositionRepository();
            Position           position = posRepo.GetPositionById(Id);

            if (position != null)
            {
                GeneralModels model = new GeneralModels();
                model.Id          = position.Id;
                model.Description = position.Description;
                model.Name        = position.Name;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Register"));
            }
        }
Ejemplo n.º 19
0
        public Subdepartment RegisterSubdepartment(GeneralModels model)
        {
            Department    department = _context.Department.FirstOrDefault(x => x.Id == model.DepartmentId);
            Subdepartment subDep     = new Subdepartment();

            subDep.Createdate   = DateTime.Now;
            subDep.Departmentid = model.DepartmentId;
            subDep.Description  = model.Description;
            subDep.Name         = model.Name;
            if (department != null)
            {
                subDep.Department = department;
            }

            _context.Subdepartment.Add(subDep);
            this.SaveChanges();
            return(subDep);
        }
        public IActionResult Edit(int Id)
        {
            SubDeparmentRepository subDeptRepo = new SubDeparmentRepository();
            Subdepartment          subDept     = subDeptRepo.GetSubdepartmentById(Id);

            if (subDept != null)
            {
                GeneralModels model = new GeneralModels();
                model.Id          = subDept.Id;
                model.Description = subDept.Description;
                model.Name        = subDept.Name;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Register"));
            }
        }
 public IActionResult Edit(GeneralModels model)
 {
     try
     {
         SubDeparmentRepository subDeparmentRepository = new SubDeparmentRepository();
         Subdepartment          subdepartment          = subDeparmentRepository.UpdateSubdeparment(model);
         if (subdepartment == null)
         {
             throw new Exception("Subdepartment not found.");
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         Helper.Alert(ex.Message);
         return(View(model));
     }
 }
 public IActionResult Edit(GeneralModels model)
 {
     try
     {
         PositionRepository posRepo  = new PositionRepository();
         Position           position = posRepo.UpdatePosition(model);
         if (position == null)
         {
             throw new Exception("Position not found.");
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         Helper.Alert(ex.Message);
         return(View(model));
     }
 }
Ejemplo n.º 23
0
        public Subdepartment UpdateSubdeparment(GeneralModels model)
        {
            Subdepartment subDep     = _context.Subdepartment.FirstOrDefault(x => x.Id == model.Id);
            Department    department = _context.Department.FirstOrDefault(x => x.Id == model.DepartmentId);

            if (subDep != null)
            {
                subDep.Description = model.Description;
                subDep.Name        = model.Name;
                subDep.Updatedate  = DateTime.Now;
                if (department != null)
                {
                    subDep.Department   = department;
                    subDep.Departmentid = model.DepartmentId;
                }
                this.SaveChanges();
                return(subDep);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 24
0
        public ActionResult Forgot_password()
        {
            if (this.CheckMemberlogin())
            {
                return(this.RedirectToAction("index", "home"));
            }
            else
            {
                string strBread;
                ViewBag.Title           = App_GlobalResources.Lang.strForgotPassword + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread                = "<li>" + App_GlobalResources.Lang.strForgotPassword + "</li>";
                ViewBag.heading         = App_GlobalResources.Lang.strForgotPassword;
                ViewBag.str_breadcrumbs = strBread;

                var login_view = new Login_view();
                login_view.Message          = App_GlobalResources.Lang.strMessageForgotPassword;
                login_view.ParentAction     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
                login_view.ParentController = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
                login_view.ReturnUrl        = Url.Action("login", "account");

                return(this.PartialView("../page/forgot_password", login_view));
            }
        }
Ejemplo n.º 25
0
        public ActionResult Change_password(string cfcode)
        {
            string strBread;

            ViewBag.Title           = App_GlobalResources.Lang.strChangePassword + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            strBread                = "<li>" + App_GlobalResources.Lang.strChangePassword + "</li>";
            ViewBag.heading         = App_GlobalResources.Lang.strChangePassword;
            ViewBag.str_breadcrumbs = strBread;

            var login_view = new Login_view();

            login_view.ParentAction     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            login_view.ParentController = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            login_view.ReturnUrl        = Url.Action("login", "account");

            if (Request.QueryString["cfcode"] != null && Request.QueryString["cfcode"].ToString() != string.Empty)
            {
                ////client reset pasword
                login_view.Message     = App_GlobalResources.Lang.strMessageClientResetPassword;
                login_view.IsChange    = 0;
                login_view.ConfirmCode = Request.QueryString["cfcode"].ToString();

                return(this.PartialView("../page/change_password", login_view));
            }
            else
            {
                ////user change password
                if (!this.CheckMemberlogin())
                {
                    return(this.RedirectToAction("index", "home"));
                }
                else
                {
                    login_view.Message     = App_GlobalResources.Lang.strMessageUserChangePassword;
                    login_view.IsChange    = 1;
                    login_view.ConfirmCode = string.Empty;

                    return(this.PartialView("../page/change_password", login_view));
                }
            }
        }
Ejemplo n.º 26
0
        public ActionResult Change_password(FormCollection collection)
        {
            UserModels sv = new UserModels();
            C_User     it = new C_User();
            string     strBread;

            ViewBag.Title           = App_GlobalResources.Lang.strChangePassword + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
            strBread                = "<li>" + App_GlobalResources.Lang.strChangePassword + "</li>";
            ViewBag.heading         = App_GlobalResources.Lang.strChangePassword;
            ViewBag.str_breadcrumbs = strBread;

            var login_view = new Login_view();

            this.TryUpdateModel(login_view);
            login_view.ParentAction     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            login_view.ParentController = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            if (login_view.IsChange == 1 && string.IsNullOrEmpty(login_view.ConfirmCode) && (!string.IsNullOrEmpty(login_view.Password)) && (!string.IsNullOrEmpty(login_view.ConfirmPassword)))
            {
                ////user change password
                it = sv.GetUserbyUserName(login_view.UserName);
                if (it != null && MD5Extend.EncodePassword(login_view.OldPassword) == it.Password)
                {
                    if (login_view.Password == login_view.ConfirmPassword)
                    {
                        it.Password = MD5Extend.EncodePassword(login_view.Password);
                        sv.Update_User(it);
                        login_view.Message = App_GlobalResources.Lang.strMessageChangePasswordSuccess;
                    }
                    else
                    {
                        login_view.Message = App_GlobalResources.Lang.strMessageConfirmPassword;
                    }
                }
            }
            else if (login_view.IsChange == 0 && (!string.IsNullOrEmpty(login_view.ConfirmCode)) && (!string.IsNullOrEmpty(login_view.Password)) && (!string.IsNullOrEmpty(login_view.ConfirmPassword)))
            {
                ////client reset pasword
                if (MD5Extend.EncodePassword(login_view.Code + " " + login_view.UserName) == login_view.ConfirmCode)
                {
                    if (login_view.Password == login_view.ConfirmPassword)
                    {
                        it          = sv.GetUserbyUserName(login_view.UserName);
                        it.Password = MD5Extend.EncodePassword(login_view.Password);
                        sv.Update_User(it);
                        login_view.Message = App_GlobalResources.Lang.strMessageChangePasswordSuccess;
                    }
                    else
                    {
                        login_view.Message = App_GlobalResources.Lang.strMessageConfirmPassword;
                    }
                }
                else
                {
                    login_view.Message = App_GlobalResources.Lang.strMessageErrorConfirmCode;
                }
            }

            return(this.PartialView("../page/change_password", login_view));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Orders the view.
        /// </summary>
        /// <param name="fcode">The order code.</param>
        /// <returns>Order view</returns>
        public ActionResult Order_view(string fcode)
        {
            if (!this.CheckMemberlogin())
            {
                return(this.RedirectToAction("login", "account", new { return_url = string.Empty + Url.Action("order_view", "account", new { fcode = fcode }) }));
            }
            else
            {
                var    order_view = new Order_register_view();
                string strBread;
                ViewBag.Title           = App_GlobalResources.Lang.strOrderCode + "  " + fcode;
                strBread                = string.Format("<li><a href=\"" + Url.Action("my_account", "account") + "\">" + App_GlobalResources.Lang.strPersonalInformation + "</a></li>");
                strBread                = string.Format("<li><a href=\"" + Url.Action("order_history", "account") + "\">" + App_GlobalResources.Lang.strOrderHistory + "</a></li>");
                strBread               += "<li>" + fcode + "</li>";
                ViewBag.heading         = App_GlobalResources.Lang.strOrderCode + "  " + fcode;
                ViewBag.str_breadcrumbs = strBread;
                this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.strOrderCode + "  " + fcode);
                this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.strOrderCode + "  " + fcode);

                DetailOrderModels detailsv    = new DetailOrderModels();
                OrderModels       orderModels = new OrderModels();

                if (string.IsNullOrEmpty(fcode))
                {
                    return(this.HttpNotFound());
                }

                C_User usr = new C_User();
                order_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
                order_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
                order_view.ContentShipping   = GeneralModels.GetContent(CommonGlobal.ContentShipping, this.Lang);
                UserModels sv = new UserModels();
                usr = sv.GetUserbyUserName(Session["mem"].ToString());

                var orders = orderModels.GetOrdersbyCode(fcode, usr.Username);
                if (orders == null)
                {
                    order_view.Message = App_GlobalResources.Lang.messOrderNotFound;
                    return(this.PartialView("../page/order_view", order_view));
                }

                order_view.Message             = string.Empty;
                order_view.Email               = orders.Email;
                order_view.Name                = orders.Name;
                order_view.Phone               = orders.Phone;
                order_view.Address             = orders.Address;
                order_view.Gender              = orders.Gender;
                order_view.Sub_total           = CommonGlobal.FormatMoney(orders.Total);
                order_view.Content             = orders.Note;
                order_view.Order_code          = fcode;
                order_view.Payment_status_text = CommonGlobal.GetPaymentStatusString(int.Parse(orders.Payment ?? "0"));
                order_view.Process_status_text = CommonGlobal.GetOrderStatusString(orders.Process ?? 0);

                var list_order_detail = detailsv.GetAllOrderDetail(fcode);
                if (list_order_detail.Count > 0)
                {
                    order_view.ShoppingCart = new ArrayList(list_order_detail.ToArray());
                }

                return(this.PartialView("../page/order_view", order_view));
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Orders the history.
        /// </summary>
        /// <returns>order history</returns>
        public ActionResult Order_history()
        {
            if (!this.CheckMemberlogin())
            {
                return(this.RedirectToAction("login", "account", new { return_url = string.Empty + Url.Action("order_history", "account") }));
            }
            else
            {
                string strBread;
                ViewBag.Title           = App_GlobalResources.Lang.strOrderHistory + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread                = "<li>" + App_GlobalResources.Lang.strOrderHistory + "</li>";
                ViewBag.heading         = App_GlobalResources.Lang.strOrderHistory;
                ViewBag.str_breadcrumbs = strBread;
                this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.strOrderHistory);
                this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.strOrderHistory);

                return(this.PartialView("../page/order_history"));
            }
        }
Ejemplo n.º 29
0
        public ActionResult My_account()
        {
            if (!this.CheckMemberlogin())
            {
                return(this.RedirectToAction("login", "account", new { return_url = string.Empty + Url.Action("my_account", "account") }));
            }
            else
            {
                UserModels sv  = new UserModels();
                C_UserInfo iit = new C_UserInfo();
                string     strBread;
                ViewBag.Title           = App_GlobalResources.Lang.strMyAccount + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread                = "<li>" + App_GlobalResources.Lang.strMyAccount + "</li>";
                ViewBag.heading         = App_GlobalResources.Lang.strMyAccount;
                ViewBag.str_breadcrumbs = strBread;
                this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.strMyAccount);
                this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.strMyAccount);

                iit = sv.GetUserInforByEmail(Session["mem"].ToString());
                var register_view = new Register_view();
                register_view.Message           = string.Empty;
                register_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
                register_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
                if (iit == null)
                {
                    return(this.RedirectToAction("login", "account", new { return_url = string.Empty + Url.Action("my_account", "account") }));
                }
                else
                {
                    register_view.FirstName = iit.FName;
                    register_view.Address   = iit.Address;
                    register_view.Phone     = iit.Phone;
                }

                if (iit.Birthday != null)
                {
                    register_view.Birthday = Convert.ToDateTime(iit.Birthday).ToString("dd/M/yyyy").Replace('-', '/');
                }

                register_view.Email = iit.Email;

                return(this.PartialView("../page/my_account", register_view));
            }
        }
Ejemplo n.º 30
0
        public ActionResult Login(string return_url)
        {
            if (this.CheckMemberlogin())
            {
                return(this.RedirectToAction("index", "home"));
            }
            else
            {
                string strBread;
                ViewBag.Title           = App_GlobalResources.Lang.strLogin + " | " + GeneralModels.GetContent(CommonGlobal.PageName, this.Lang);
                strBread                = "<li>" + App_GlobalResources.Lang.strLogin + "</li>";
                ViewBag.heading         = App_GlobalResources.Lang.strLogin;
                ViewBag.str_breadcrumbs = strBread;

                var login_view = new Login_view();
                login_view.Message          = App_GlobalResources.Lang.strMessageLogin;
                login_view.ParentAction     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
                login_view.ParentController = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
                if (string.IsNullOrEmpty(return_url))
                {
                    login_view.ReturnUrl = Request.UrlReferrer != null?Request.UrlReferrer.ToString() : string.Empty;
                }
                else
                {
                    login_view.ReturnUrl = return_url;
                }

                return(this.PartialView("../page/login", login_view));
            }
        }