Exemplo n.º 1
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));
        }
Exemplo n.º 3
0
        public ActionResult Post_list_hot(int?cate_id)
        {
            PostModels    postModels = new PostModels();
            List <C_Post> listPost   = new List <C_Post>();

            postModels.ClearCache(CommonGlobal.Post + CommonGlobal.CateNews + LanguageModels.ActiveLanguage().LangCultureName + int.Parse(Util.GetConfigValue("NumberListLatestNews", "0")));
            listPost = postModels.TopPostHot(CommonGlobal.CateNews, cate_id, LanguageModels.ActiveLanguage().LangCultureName, int.Parse(Util.GetConfigValue("NumberListLatestNews", "0")));

            return(this.PartialView("../control/post_list_hot", listPost));
        }
Exemplo n.º 4
0
        public IActionResult ListUser(string type, string search, int?pageIndex, int?pageSize, string orderBy, string orderType)
        {
            IActionResult response   = null;
            BaseClass     baseClass  = new BaseClass();
            UserModels    userModels = new UserModels();
            RoleModels    roleModels = new RoleModels();
            User          cuser      = new User();

            var mess         = string.Empty;
            var listUserView = new AdminListUserView();
            var isOk         = true;

            string lang = LanguageModels.ActiveLanguage().LangCultureName;

            type = type ?? string.Empty;

            if (type == string.Empty)
            {
                isOk     = false;
                response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist });
            }

            if (!isOk)
            {
                return(response);
            }

            if (pageIndex == null || pageIndex == 0)
            {
                pageIndex = 1;
            }

            if (pageSize == null)
            {
                pageSize = 25;
            }

            if (string.IsNullOrEmpty(orderBy) || string.IsNullOrEmpty(orderType))
            {
                orderBy   = "Username";
                orderType = "asc";
            }

            listUserView.ListUser    = userModels.AdminGetAllUser(type, lang, search, (int)pageIndex, (int)pageSize, orderBy, orderType, out int totalRecord);
            listUserView.CateType    = roleModels.GetRoleByRole(type);
            listUserView.PageIndex   = (int)pageIndex;
            listUserView.PageSize    = (int)pageSize;
            listUserView.TotalPage   = totalRecord > 0 ? (int)System.Math.Ceiling((double)totalRecord / (double)pageSize) : 0;
            listUserView.TotalRecord = totalRecord;

            response = Json(listUserView);

            return(response);
        }
Exemplo n.º 5
0
        public IActionResult ListUserPage(string type, string search, int?parentId, int?pageIndex, int?pageSize)
        {
            IActionResult response   = null;
            BaseClass     baseClass  = new BaseClass();
            UserModels    userModels = new UserModels();
            RoleModels    roleModels = new RoleModels();
            User          cuser      = new User();

            var mess         = string.Empty;
            var listPageView = new AdminListPageView();
            var isOk         = true;

            string lang = LanguageModels.ActiveLanguage().LangCultureName;

            type = type ?? string.Empty;

            if (parentId == null)
            {
                parentId = -1; // get all
            }

            var action = userModels.GetActionByActionName(CommonGlobal.View);

            string typeAct = action != null?action.Id.ToString() : string.Empty;

            if (type == string.Empty)
            {
                isOk     = false;
                response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist });
            }

            if (!isOk)
            {
                return(response);
            }

            listPageView.ListUserPage = userModels.AdminGetAllPageFullTree(type, lang, search, (int)parentId, (int)pageIndex, (int)pageSize, out int totalRecord);
            listPageView.CateType     = roleModels.GetRoleByRole(type);
            listPageView.PageIndex    = (int)pageIndex;
            listPageView.PageSize     = (int)pageSize;
            listPageView.TotalPage    = totalRecord > 0 ? (int)System.Math.Ceiling((double)totalRecord / (double)pageSize) : 0;
            listPageView.TotalRecord  = totalRecord;

            response = Json(listPageView);

            return(response);
        }
Exemplo n.º 6
0
        public ActionResult Post_list_all(int?id, string link, string cate_type, string search, string tag, string param, string style_list)
        {
            WebInfoModels web_infor = new Models.WebInfoModels();
            int           page      = 1;                                                         ////start page
            int           page_size = int.Parse(Util.GetConfigValue("NumberPageSizeNews", "4")); ////start page size
            string        order     = "DateModified;desc";
            string        lang      = LanguageModels.ActiveLanguage().LangCultureName;

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

            if (string.IsNullOrEmpty(style_list))
            {
                style_list = "grid";
            }

            return(this.Post_list_all(lang, cate_type, id, link, search, tag, param, page, page_size, order, style_list));
        }
        public IActionResult ListUserPageActionByPageId(string type, int pageId)
        {
            IActionResult response   = null;
            BaseClass     baseClass  = new BaseClass();
            UserModels    userModels = new UserModels();
            RoleModels    roleModels = new RoleModels();
            User          cuser      = new User();

            var mess = string.Empty;
            var isOk = true;

            string lang = LanguageModels.ActiveLanguage().LangCultureName;

            type = type ?? "Admin";

            var action = userModels.GetActionByActionName(CommonGlobal.View);

            string typeAct = action != null?action.Id.ToString() : string.Empty;

            if (type == string.Empty)
            {
                isOk     = false;
                response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist });
            }

            if (!isOk)
            {
                return(response);
            }

            List <UserPageAction> listAllPageAction = userModels.AdminGetAllPageAction(type, lang, pageId);

            response = Json(listAllPageAction);

            return(response);
        }
Exemplo n.º 8
0
        public ActionResult Change_post(int?post_id, string type, string act, string ctrl, string type_act, string lang)
        {
            CatalogModels         cateModels          = new CatalogModels();
            PostModels            postModel           = new PostModels();
            C_Catalog             cate                = new C_Catalog();
            C_Post                objPost             = new C_Post();
            List <SelectListItem> list_select_catalog = new List <SelectListItem>();
            var           post_view = new Web.Areas.Admin.ViewModels.Post_view();
            StringBuilder sb        = new StringBuilder();
            int           level     = 0;

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

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

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

            if (post_id == null)
            {
                post_id = RouteData.Values["id"] != null?Convert.ToInt32(RouteData.Values["id"].ToString()) : 0;
            }

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

            if (string.IsNullOrEmpty(type_act))
            {
                type_act = Request.QueryString["type_act"] != null ? Request.QueryString["type_act"].ToString() : CommonGlobal.Add;
                if (post_id == 0)
                {
                    type_act = CommonGlobal.Add;
                }
                else
                {
                    type_act = CommonGlobal.Edit;
                }
            }

            if (type_act == CommonGlobal.Edit)
            {
                objPost                = postModel.GetbyID((int)post_id);
                post_view.PostID       = objPost.PostID;
                post_view.PostName     = objPost.PostName;
                post_view.PostContent  = objPost.PostContent;
                post_view.ImagePath    = objPost.ImagePath;
                post_view.Title        = objPost.Title;
                post_view.Keyword      = objPost.Keyword;
                post_view.Description  = objPost.Description;
                post_view.Summary      = objPost.Summary;
                post_view.Lang         = objPost.Lang;
                post_view.CatalogID    = (int)objPost.CatelogID;
                post_view.OrderDisplay = (int)objPost.OrderDisplay;
                post_view.Parent       = (int)objPost.CatelogID;
                post_view.CreateDate   = objPost.CreateDate ?? DateTime.Now;
                if ((objPost.IsHot ?? false) == true)
                {
                    post_view.IsHot         = true;
                    post_view.Is_short_text = "checked='checked'";
                }
                else
                {
                    post_view.IsHot         = false;
                    post_view.Is_short_text = string.Empty;
                }

                if ((objPost.Approve ?? false) == true)
                {
                    post_view.Approve   = true;
                    post_view.Show_text = "checked='checked'";
                }
                else
                {
                    post_view.Approve   = false;
                    post_view.Show_text = string.Empty;
                }

                cateModels.List_catalog_parent(0, level, (int)objPost.CatelogID, type, cate.Lang ?? objPost.Lang, ref list_select_catalog);

                ////Link tab
                sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "list_post", ctrl = "adminPost", type = type, page = "1", lang = objPost.Lang }) + "\"><span><span>Danh sách tin tức</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Cập nhật</span></span></a></li>");

                post_view.List_language = this.List_select_language(cate.Lang ?? objPost.Lang);
            }
            else
            {
                ////Link tab
                sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "list_post", ctrl = "adminPost", type = type, page = "1", lang = lang }) + "\"><span><span>Danh sách tin tức</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Thêm mới</span></span></a></li>");

                cateModels.List_catalog_parent(0, level, 0, type, lang, ref list_select_catalog);
                post_view.List_language = this.List_select_language(lang);
            }

            post_view.List_category = list_select_catalog;
            post_view.Type          = type;
            post_view.Type_act      = type_act;
            post_view.Html_link_tab = sb.ToString();
            ////action
            post_view.Act               = act;
            post_view.Ctrl              = ctrl;
            post_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            post_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/change_post", post_view));
        }
Exemplo n.º 9
0
        public ActionResult List_album_images(int?parent, int?id, string type, string act, string ctrl, string type_act, string lang, string search, int?page, int?page_size, string order_by, string order_type)
        {
            CatalogModels         cateModels          = new CatalogModels();
            GalleryModels         galleryModels       = new GalleryModels();
            C_Catalog             cate                = new C_Catalog();
            ImageAlbum            img                 = new ImageAlbum();
            StringBuilder         sb                  = new StringBuilder();
            List <SelectListItem> list_select_catalog = new List <SelectListItem>();
            var list_album_images_view                = new Web.Areas.Admin.ViewModels.List_album_images_view();
            int total_record = 0;
            int level        = 0;

            /////type is get type catalog
            /////ex   : LB - Lookbook
            /////     : GL - Gallery
            /////parent is array parent id
            if (string.IsNullOrEmpty(type))
            {
                type = Request.QueryString["type"] != null ? Request.QueryString["type"].ToString() : CommonGlobal.CateLookBook;
            }

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            if (parent == null)
            {
                parent = Request.QueryString["parent"] != null?Convert.ToInt32(Request.QueryString["parent"].ToString()) : 0;
            }

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

            if (id != null && type_act != null && type_act == CommonGlobal.Delete)
            {
                ////check permission delete
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type))
                {
                    img = galleryModels.GetImageById((int)id);
                    if (img != null)
                    {
                        ////delete old image
                        if (!string.IsNullOrEmpty(img.Images))
                        {
                            string strImg = img.Images;
                            strImg = "~" + strImg;
                            string fileDelete = Server.MapPath(strImg);
                            if (System.IO.File.Exists(fileDelete))
                            {
                                System.IO.File.Delete(fileDelete);
                            }

                            string fileDelete2 = Server.MapPath(strImg.Replace("sc_small_", "sc_full_"));
                            if (System.IO.File.Exists(fileDelete2))
                            {
                                System.IO.File.Delete(fileDelete2);
                            }
                        }
                        ////delete imgage album
                        bool rt = galleryModels.Delete_Images((int)id);
                        if (rt)
                        {
                            list_album_images_view.Message = "Bạn đã xóa ảnh " + id;
                        }
                        else
                        {
                            list_album_images_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_album_images_view.Message = "Không tìm thấy ảnh : " + id;
                    }
                }
                else
                {
                    list_album_images_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }

            if (string.IsNullOrEmpty(order_by) || string.IsNullOrEmpty(order_type))
            {
                order_by   = "ID";
                order_type = "asc";
            }

            if (parent != 0)
            {
                cate = cateModels.GetbyID((int)parent);
                list_album_images_view.Category_name = cate.CategoryName;
            }

            list_album_images_view.Type      = type;
            list_album_images_view.Cate_type = CommonGlobal.GetCatalogTypeName(type);
            list_album_images_view.Parent    = (int)parent;
            list_album_images_view.Lang      = lang;
            list_album_images_view.Type_act  = type_act;
            ////tab
            sb.Append("<li class=\"active\"><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_catalog", ctrl = "adminCatalog", type = type, page = "1", parent = parent }) + "\"><span><span>Danh sách " + CommonGlobal.GetCatalogTypeName(type) + "</span></span></a></li>");
            list_album_images_view.Html_link_tab = sb.ToString();
            ////list language
            list_album_images_view.List_language = this.List_select_language(this.Lang);
            ////list category for filter
            cateModels.List_catalog_parent(0, level, (int)parent, type, lang, ref list_select_catalog);
            list_album_images_view.List_parent = list_select_catalog;
            ////list page size and paging
            list_album_images_view.List_page_size = this.GetSizePagingPublic((int)page_size);
            list_album_images_view.Page           = (int)page;
            list_album_images_view.Page_size      = (int)page_size;
            ////list product
            list_album_images_view.Page_list_image = galleryModels.AdminGetAllImageGallery((int)parent, type, lang, (int)page, (int)page_size, order_by, order_type, out total_record);
            list_album_images_view.Order_by        = order_by;
            list_album_images_view.Order_type      = order_type;
            list_album_images_view.Total_record    = total_record;
            ////acton and parent action
            list_album_images_view.Act               = act;
            list_album_images_view.Ctrl              = ctrl;
            list_album_images_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_album_images_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            return(this.PartialView("../control/list_album_images", list_album_images_view));
        }
Exemplo n.º 10
0
        public IActionResult ListUserPageTree(string type, int parentId, int id)
        {
            IActionResult       response      = null;
            BaseClass           baseClass     = new BaseClass();
            UserModels          userModels    = new UserModels();
            RoleModels          roleModels    = new RoleModels();
            User                cuser         = new User();
            List <UserPageTree> userPageTrees = new List <UserPageTree>();

            var             mess         = string.Empty;
            List <UserPage> listUserPage = new List <UserPage>();
            int             total_record = 0;
            var             isOk         = true;

            string lang = LanguageModels.ActiveLanguage().LangCultureName;

            type = type ?? string.Empty;

            if (type == string.Empty)
            {
                isOk     = false;
                response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist });
            }

            if (!isOk)
            {
                return(response);
            }


            listUserPage = userModels.AdminGetAllPage(type, lang, "", -1, 1, 10000, "", "", out total_record);

            // create root
            UserPageTree userPageTree;

            if (parentId == 0)
            {
                userPageTree = new UserPageTree {
                    Id = "0", Parent = "#", Text = "Page cha", State = new UserPageTreeOption {
                        Selected = true, Opened = true, Disabled = false
                    }
                };
            }
            else
            {
                userPageTree = new UserPageTree {
                    Id = "0", Parent = "#", Text = "Page cha", State = new UserPageTreeOption {
                        Selected = false, Opened = true, Disabled = false
                    }
                };
            }

            userPageTrees.Add(userPageTree);

            // create child
            foreach (var item in listUserPage)
            {
                var idChild = "";
                var parent  = "";
                parent  = item.ParentId.ToString();
                idChild = item.Id.ToString();
                UserPageTree userPTree;
                var          disabled = false;

                if (item.Id == id)
                {
                    disabled = true;
                }

                if (item.Id == parentId)
                {
                    userPTree = new UserPageTree {
                        Id = idChild, Parent = parent, Text = item.Title, State = new UserPageTreeOption {
                            Selected = true, Opened = true, Disabled = disabled
                        }
                    };
                }
                else
                {
                    userPTree = new UserPageTree {
                        Id = idChild, Parent = parent, Text = item.Title, State = new UserPageTreeOption {
                            Selected = false, Opened = false, Disabled = disabled
                        }
                    };
                }

                userPageTrees.Add(userPTree);
            }

            response = Json(userPageTrees);

            return(response);
        }
Exemplo n.º 11
0
        public ActionResult List_user(string user_name, string act, string ctrl, string type_act, string type, string lang, string search, int?page, int?page_size, string order_by, string order_type)
        {
            UserModels    userModels     = new UserModels();
            RoleModels    roleModels     = new RoleModels();
            C_User        cuser          = new C_User();
            StringBuilder sb             = new StringBuilder();
            var           list_user_view = new Web.Areas.Admin.ViewModels.List_user_view();

            this.TryUpdateModel(list_user_view);
            int total_record = 0;

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

            if (type == string.Empty)
            {
                list_user_view.Message = "Chúng tôi không tìm thấy danh sách bạn yêu cầu";
            }

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

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

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            if (user_name != null && type_act != null && type_act == CommonGlobal.Delete)
            {
                ////check permission delete
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type ?? string.Empty))
                {
                    cuser = userModels.GetUserbyUserName(user_name);
                    if (cuser != null)
                    {
                        ////delete user
                        bool rt = userModels.Delete_User(user_name);
                        if (rt)
                        {
                            list_user_view.Message = "Bạn đã xóa " + user_name;
                        }
                        else
                        {
                            list_user_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_user_view.Message = "Không tìm thấy  : " + user_name;
                    }
                }
                else
                {
                    list_user_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }

            if (string.IsNullOrEmpty(order_by) || string.IsNullOrEmpty(order_type))
            {
                order_by   = "Username";
                order_type = "asc";
            }

            list_user_view.Type      = type;
            list_user_view.Cate_type = roleModels.GetRoleByRole(type);
            list_user_view.Lang      = lang;
            list_user_view.Type_act  = type_act;
            ////tab
            sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Danh sách " + list_user_view.Cate_type + "</span></span></a></li>");
            if (type == "Admin")
            {
                sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "change_user", ctrl = "adminUser", type = type, type_act = CommonGlobal.Add }) + "\"><span><span>Thêm " + list_user_view.Cate_type + "</span></span></a></li>");
            }

            list_user_view.Html_link_tab = sb.ToString();
            ////list language
            list_user_view.List_language = this.List_select_language(this.Lang);
            ////list page size and paging
            list_user_view.List_page_size = this.GetSizePagingPublic((int)page_size);
            list_user_view.Page           = (int)page;
            list_user_view.Page_size      = (int)page_size;
            ////list catalog
            list_user_view.Page_list_user = userModels.AdminGetAllUser(type, lang, search, (int)page, (int)page_size, order_by, order_type, out total_record);
            list_user_view.Search         = search;
            list_user_view.Order_by       = order_by;
            list_user_view.Order_type     = order_type;
            list_user_view.Total_record   = total_record;
            ////acton and parent action
            list_user_view.Act               = act;
            list_user_view.Ctrl              = ctrl;
            list_user_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_user_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            return(this.PartialView("../control/list_user", list_user_view));
        }
Exemplo n.º 12
0
        public ActionResult List_emailtemplate(int?email_id, string type, string act, string ctrl, string type_act, string lang, int?page, int?page_size)
        {
            EmailTemplateModels emailModels       = new EmailTemplateModels();
            var           list_emailtemplate_view = new Web.Areas.Admin.ViewModels.List_emailtemplate_view();
            StringBuilder sb = new StringBuilder();

            int total_record = 0;

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

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

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

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            list_emailtemplate_view.Page      = (int)page;
            list_emailtemplate_view.Page_size = (int)page_size;

            ////tab
            sb.Append("<li class=\"active\"><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_emailtemplate", ctrl = "adminEmail", type = type, page = "1" }) + "\"><span><span>Danh sách email template</span></a></li>");
            sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "change_emailtemplate", ctrl = "adminEmail", type_act = "add", lang = lang }) + "\"><span><span>Thêm mới</span></span></a></li>");
            list_emailtemplate_view.Html_link_tab = sb.ToString();

            if (email_id != null && email_id != 0 && type_act != null && type_act == CommonGlobal.Delete)
            {
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type))
                {
                    C_EmailTemplate objEmailTempate = new C_EmailTemplate();
                    objEmailTempate = emailModels.GetEmailTemplateById((int)email_id);
                    if (objEmailTempate != null)
                    {
                        ////delete post
                        bool rt = emailModels.Delete((int)email_id);
                        if (rt)
                        {
                            list_emailtemplate_view.Message = "Bạn đã xóa email template: " + objEmailTempate.name;
                        }
                        else
                        {
                            list_emailtemplate_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_emailtemplate_view.Message = "Không tìm thấy email template : " + objEmailTempate.name;
                    }
                }
                else
                {
                    list_emailtemplate_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }
            ////list post
            list_emailtemplate_view.List_page_size           = this.GetSizePagingPublic((int)page_size);
            list_emailtemplate_view.Page_list_email_template = emailModels.GetListEmailTemplateAll((int)page, (int)page_size, out total_record);
            list_emailtemplate_view.Total_record             = total_record;
            list_emailtemplate_view.Type_act = type_act;
            ////action
            list_emailtemplate_view.Act               = act;
            list_emailtemplate_view.Ctrl              = ctrl;
            list_emailtemplate_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_emailtemplate_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/list_emailtemplate", list_emailtemplate_view));
        }
Exemplo n.º 13
0
        public ActionResult List_showroom(int?city, int?district, int?showroom_id, string type, string act, string ctrl, string type_act, int?page, int?page_size)
        {
            ShowroomModels showroomModels = new ShowroomModels();
            CityModels     cityModels     = new CityModels();
            DistrictModels districtModels = new DistrictModels();

            List <SelectListItem> list_city     = new List <SelectListItem>();
            List <SelectListItem> list_district = new List <SelectListItem>();
            var           list_showroom_view    = new Web.Areas.Admin.ViewModels.List_showroom_view();
            StringBuilder sb = new StringBuilder();

            int total_record = 0;

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

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

            if (city == null)
            {
                city = Request.QueryString["city"] != null?Convert.ToInt32(Request.QueryString["city"].ToString()) : 0;
            }

            if (district == null)
            {
                district = Request.QueryString["district"] != null?Convert.ToInt32(Request.QueryString["district"].ToString()) : 0;
            }

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

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            list_showroom_view.Page      = (int)page;
            list_showroom_view.Page_size = (int)page_size;

            list_showroom_view.List_city     = cityModels.List_city((int)city);
            list_showroom_view.List_district = districtModels.List_district((int)city, (int)district);

            ////tab
            sb.Append("<li class=\"active\"><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_showroom", ctrl = "adminShowroom", type = type, page = "1", city = city, district = district, lang = Lang }) + "\"><span><span>Danh sách Showroom</span></span></a></li>");
            sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "change_showroom", ctrl = "adminShowroom", type = type, type_act = "add", city = city, district = district, lang = Lang }) + "\"><span><span>Thêm Showroom</span></span></a></li>");
            list_showroom_view.Html_link_tab = sb.ToString();

            if (showroom_id != null && showroom_id != 0 && type_act != null && type_act == CommonGlobal.Delete)
            {
                ////check permission delete
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type))
                {
                    Showroom objShowroom = new Showroom();
                    objShowroom = showroomModels.GetShowroomById((int)showroom_id);
                    if (objShowroom != null)
                    {
                        ////delete post
                        bool rt = showroomModels.Delete((int)showroom_id);
                        if (rt)
                        {
                            list_showroom_view.Message = "Bạn đã xóa showroom: " + objShowroom.Name;
                        }
                        else
                        {
                            list_showroom_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_showroom_view.Message = "Không tìm thấy showroom: " + objShowroom.Name;
                    }
                }
                else
                {
                    list_showroom_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }
            ////list post
            list_showroom_view.List_page_size     = this.GetSizePagingPublic((int)page_size);
            list_showroom_view.Page_list_showroom = showroomModels.GetListShowroom((int)district, (int)page, (int)page_size, out total_record);
            list_showroom_view.Total_record       = total_record;
            list_showroom_view.Type_act           = type_act;
            ////action
            list_showroom_view.Act               = act;
            list_showroom_view.Ctrl              = ctrl;
            list_showroom_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_showroom_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/list_showroom", list_showroom_view));
        }
Exemplo n.º 14
0
        public ActionResult List_catalog(int?parent, int?cate_id, string act, string ctrl, string type, string type_act, string lang, string search, int?page, int?page_size, string order_by, string order_type)
        {
            CatalogModels         cateModels          = new CatalogModels();
            C_Catalog             cate                = new C_Catalog();
            StringBuilder         sb                  = new StringBuilder();
            List <SelectListItem> list_select_catalog = new List <SelectListItem>();
            var list_catalog_view = new Web.Areas.Admin.ViewModels.List_catalog_view();
            int total_record      = 0;
            int level             = 0;

            /////type is get type catalog
            /////ex   : SP - product
            /////     : TT - news
            /////     : CL - collection
            /////     : LB - lookbook
            /////     : GL - gallery
            /////parent is parent id
            if (string.IsNullOrEmpty(type))
            {
                type = Request.QueryString["type"] != null ? Request.QueryString["type"].ToString() : CommonGlobal.CateProduct;
            }

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

            if (parent == null)
            {
                parent = Request.QueryString["parent"] != null?Convert.ToInt32(Request.QueryString["parent"].ToString()) : 0;
            }

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

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            if (string.IsNullOrEmpty(order_by) || string.IsNullOrEmpty(order_type))
            {
                order_by   = "OrderDisplay";
                order_type = "asc";
            }

            ////type act delete
            if (cate_id != null && type_act != null && type_act == CommonGlobal.Delete)
            {
                ////check permission delete
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type))
                {
                    cate = cateModels.GetbyID((int)cate_id);
                    if (cate != null)
                    {
                        ////delete old image
                        if (!string.IsNullOrEmpty(cate.ImagePath))
                        {
                            string strImg = cate.ImagePath;
                            strImg = "~" + strImg;
                            string fileDelete = Server.MapPath(strImg);
                            if (System.IO.File.Exists(fileDelete))
                            {
                                System.IO.File.Delete(fileDelete);
                            }

                            string fileDelete2 = Server.MapPath(strImg.Replace("sc_small_", "sc_full_"));
                            if (System.IO.File.Exists(fileDelete2))
                            {
                                System.IO.File.Delete(fileDelete2);
                            }
                        }

                        ////delete category
                        bool rt = cateModels.Delete((int)cate_id);
                        if (rt)
                        {
                            list_catalog_view.Message = "Bạn đã xóa danh mục " + cate_id;
                        }
                        else
                        {
                            list_catalog_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_catalog_view.Message = "Không tìm thấy danh mục : " + cate_id;
                    }
                }
                else
                {
                    list_catalog_view.Message = " Bạn không có quyền thực thi hành động xóa cho danh mục này ";
                }
            }

            if (parent != 0)
            {
                cate = cateModels.GetbyID((int)parent);
                list_catalog_view.Category_name = cate.CategoryName;
            }

            list_catalog_view.Type      = type;
            list_catalog_view.Cate_type = CommonGlobal.GetCatalogTypeName(type);
            list_catalog_view.Parent    = (int)parent;
            list_catalog_view.Lang      = lang;
            list_catalog_view.Type_act  = type_act;
            ////tab
            var link_dashboard      = Url.Action("index", "dashboard", new { act = "list_catalog", ctrl = "adminCatalog", type_act = CommonGlobal.View, type = type, page = "1", parent = parent, lang = lang });
            var link_change_catalog = Url.Action("index", "dashboard", new { act = "change_catalog", ctrl = "adminCatalog", type_act = CommonGlobal.Add, type = type, parent = parent, lang = lang });

            sb.Append("<li class=\"active\"><a class=\"active\" href=\"" + link_dashboard + "\"><span><span>Danh sách " + CommonGlobal.GetCatalogTypeName(type) + "</span></span></a></li>");
            sb.Append("<li><a href=\"" + link_change_catalog + "\"><span><span>Thêm mới</span></span></a></li>");
            list_catalog_view.Html_link_tab = sb.ToString();
            ////list language
            list_catalog_view.List_language = this.List_select_language(this.Lang);
            ////list category
            cateModels.List_catalog_parent(0, level, (int)parent, type, lang, ref list_select_catalog);
            list_catalog_view.List_parent = list_select_catalog;
            ////list page size and paging
            list_catalog_view.List_page_size = this.GetSizePagingPublic((int)page_size);
            list_catalog_view.Page           = (int)page;
            list_catalog_view.Page_size      = (int)page_size;
            ////list catalog
            list_catalog_view.Page_list_catalog = cateModels.GetAllCatalogByParentID((int)parent, type, lang, search, (int)page, (int)page_size, order_by, order_type, out total_record);
            list_catalog_view.Search            = search;
            list_catalog_view.Order_by          = order_by;
            list_catalog_view.Order_type        = order_type;
            list_catalog_view.Total_record      = total_record;
            ////acton and parent action
            list_catalog_view.Act               = act;
            list_catalog_view.Ctrl              = ctrl;
            list_catalog_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_catalog_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            return(this.PartialView("../control/list_catalog", list_catalog_view));
        }
Exemplo n.º 15
0
        public ActionResult Change_general(string type, string act, string ctrl, string type_act)
        {
            var           general_content_view = new Web.Areas.Admin.ViewModels.General_content_view();
            GeneralModels generalModels        = new GeneralModels();
            C_General     general = new C_General();

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

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

            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.Edit;
            }

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

            try
            {
                general = generalModels.GetGeneral(type, this.Lang);
                general_content_view.Id                = general.GeneralID;
                general_content_view.GeneralName       = general.GeneralName;
                general_content_view.General_name_text = CommonGlobal.GetLinkADTypeName(type);
                general_content_view.GeneralContent    = general.GeneralContent;
                general_content_view.Lang              = general.Lang;
                general_content_view.Show              = general.Show ?? false;
                if (general.Show == true)
                {
                    general_content_view.Show        = true;
                    general_content_view.IsShow_text = "checked='checked'";
                }
                else
                {
                    general_content_view.Show        = false;
                    general_content_view.IsShow_text = string.Empty;
                }
                ////list language
                general_content_view.List_language = this.List_select_language(general.Lang);
            }
            catch (Exception)
            {
                general_content_view.Message = "Đã xảy ra lỗi trong quá trình lấy dữ liệu.";
            }

            general_content_view.Type     = type;
            general_content_view.Type_act = type_act;
            ////Link tab
            StringBuilder sb = new StringBuilder();

            sb.Append("<li class=\"active\"><a href=\"#\"><span>" + CommonGlobal.GetLinkADTypeName(type) + "</span></a></li>");
            general_content_view.Html_link_tab = sb.ToString();

            ////action
            general_content_view.Act               = act;
            general_content_view.Ctrl              = ctrl;
            general_content_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            general_content_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/change_general", general_content_view));
        }
Exemplo n.º 16
0
        public IActionResult Get(int?parent, string type, string lang, string search, int?pageIndex, int?pageSize, string orderBy, string orderType)
        {
            IActionResult         response          = null;
            CatalogModels         cateModels        = new CatalogModels();
            Catalog               cate              = new Catalog();
            StringBuilder         sb                = new StringBuilder();
            List <SelectListItem> listSelectCatalog = new List <SelectListItem>();
            BaseClass             baseClass         = new BaseClass();
            var listCatalogView = new AdminListCatalogView();
            var isOk            = true;

            /////type is get type catalog
            /////ex   : SP - product
            /////     : TT - news
            /////     : CL - collection
            /////     : LB - lookbook
            /////     : GL - gallery
            /////parent is parent id
            type = type ?? CommonGlobal.CateProduct;

            if (type == string.Empty)
            {
                isOk     = false;
                response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist });
            }

            if (!isOk)
            {
                return(response);
            }

            if (pageIndex == null || pageIndex == 0)
            {
                pageIndex = 1;
            }

            if (pageSize == null)
            {
                pageSize = 25;
            }

            parent = parent ?? 0;

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

            if (parent != 0)
            {
                // cate = cateModels.GetbyID((int)parent);
            }

            listCatalogView.PageListCatalog = cateModels.AdminGetAllCatalogFullTree(type, lang, search, (int)parent, (int)pageIndex, (int)pageSize, out int totalRecord);
            listCatalogView.CateType        = CommonGlobal.GetCatalogTypeName(type);
            listCatalogView.PageIndex       = (int)pageIndex;
            listCatalogView.PageSize        = (int)pageSize;
            listCatalogView.TotalPage       = totalRecord > 0 ? (int)System.Math.Ceiling((double)totalRecord / (double)pageSize) : 0;
            listCatalogView.TotalRecord     = totalRecord;

            response = Json(listCatalogView);

            return(response);
        }
Exemplo n.º 17
0
        public ActionResult Gallery_lookbook()
        {
            ///// Lấy danh sách gallery mới nhất
            CatalogModels cateModels = new CatalogModels();
            var           lstGallery = cateModels.GetMenubyParentID(0, CommonGlobal.CateLookBook, LanguageModels.ActiveLanguage().LangCultureName);

            return(this.PartialView("../control/gallery_lookbook", lstGallery));
        }
Exemplo n.º 18
0
        public ActionResult System_config(FormCollection collection, string lang, string act, string ctrl, string type_act, string type, HttpPostedFileBase file_img)
        {
            var           system_config_view = new Web.Areas.Admin.ViewModels.System_config_view();
            GeneralModels generalModel       = new GeneralModels();
            WebInfoModels webInfoModels      = new WebInfoModels();

            this.TryUpdateModel(system_config_view);

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

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

            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.Edit;
            }

            system_config_view.Type_act = type_act;

            ////Update data
            if (system_config_view.Is_update > 0 && system_config_view.Type_act == CommonGlobal.Edit)
            {
                ////Pagename
                C_General pagename = new C_General();
                pagename.GeneralName    = CommonGlobal.PageName;
                pagename.GeneralContent = system_config_view.Page_name;
                pagename.Show           = true;
                pagename.Lang           = system_config_view.Lang;
                pagename.Datemodified   = DateTime.Now;
                generalModel.Update(pagename);

                ////Keyword
                C_General keyword = new C_General();
                keyword.GeneralName    = CommonGlobal.Keyword;
                keyword.GeneralContent = system_config_view.Keywords;
                keyword.Show           = true;
                keyword.Lang           = system_config_view.Lang;
                keyword.Datemodified   = DateTime.Now;
                generalModel.Update(keyword);

                ////Description
                C_General description = new C_General();
                description.GeneralName    = CommonGlobal.Description;
                description.GeneralContent = system_config_view.Description;
                description.Show           = true;
                description.Lang           = system_config_view.Lang;
                description.Datemodified   = DateTime.Now;
                generalModel.Update(description);

                ////Support
                C_General support = new C_General();
                support.GeneralName    = CommonGlobal.Support;
                support.GeneralContent = system_config_view.Support;
                support.Show           = true;
                support.Lang           = system_config_view.Lang;
                support.Datemodified   = DateTime.Now;
                generalModel.Update(support);

                ////Address
                C_General address = new C_General();
                address.GeneralName    = CommonGlobal.Address;
                address.GeneralContent = system_config_view.Address;
                address.Show           = true;
                address.Lang           = system_config_view.Lang;
                address.Datemodified   = DateTime.Now;
                generalModel.Update(address);

                ////Hotline
                C_WebInfo hotline = new C_WebInfo();
                hotline.GeneralName    = CommonGlobal.Hotline;
                hotline.GeneralContent = system_config_view.Hotline;
                hotline.Datemodified   = DateTime.Now;
                webInfoModels.Update(hotline);

                ////Skyper
                C_WebInfo skyper = new C_WebInfo();
                skyper.GeneralName    = CommonGlobal.Skyper;
                skyper.GeneralContent = system_config_view.Skype;
                skyper.Datemodified   = DateTime.Now;
                webInfoModels.Update(skyper);

                ////Slogan
                C_General slogan = new C_General();
                slogan.GeneralName    = CommonGlobal.Slogan;
                slogan.GeneralContent = system_config_view.Slogan;
                slogan.Show           = true;
                slogan.Datemodified   = DateTime.Now;
                slogan.Lang           = system_config_view.Lang;
                generalModel.Update(slogan);

                ////facebook
                C_WebInfo facebook = new C_WebInfo();
                facebook.GeneralName    = CommonGlobal.Facebook;
                facebook.GeneralContent = system_config_view.Facebook;
                facebook.Datemodified   = DateTime.Now;
                webInfoModels.Update(facebook);

                ////Fees
                C_WebInfo fees = new C_WebInfo();
                fees.GeneralName    = CommonGlobal.Fees;
                fees.GeneralContent = system_config_view.Fees;
                fees.Datemodified   = DateTime.Now;
                webInfoModels.Update(fees);

                ////Fees
                C_WebInfo min_fees = new C_WebInfo();
                min_fees.GeneralName    = CommonGlobal.MinFees;
                min_fees.GeneralContent = system_config_view.Min_fees;
                min_fees.Datemodified   = DateTime.Now;
                webInfoModels.Update(min_fees);

                ////Fees
                C_WebInfo tax = new C_WebInfo();
                tax.GeneralName    = CommonGlobal.Tax;
                tax.GeneralContent = system_config_view.Tax;
                tax.Datemodified   = DateTime.Now;
                webInfoModels.Update(tax);

                ////google_analysis
                C_WebInfo google_analysis = new C_WebInfo();
                google_analysis.GeneralName    = CommonGlobal.GoogleAnalysis;
                google_analysis.GeneralContent = system_config_view.Google_analysis;
                google_analysis.Datemodified   = DateTime.Now;
                webInfoModels.Update(google_analysis);

                ////app_extend_one
                C_WebInfo app_extend_one = new C_WebInfo();
                app_extend_one.GeneralName    = CommonGlobal.AppExtendOne;
                app_extend_one.GeneralContent = system_config_view.App_extend_one;
                app_extend_one.Datemodified   = DateTime.Now;
                webInfoModels.Update(app_extend_one);

                ////app_extend_two
                C_WebInfo app_extend_two = new C_WebInfo();
                app_extend_two.GeneralName    = CommonGlobal.AppExtendTwo;
                app_extend_two.GeneralContent = system_config_view.App_extend_two;
                app_extend_two.Datemodified   = DateTime.Now;
                webInfoModels.Update(app_extend_two);

                ////latitude
                C_WebInfo latitude = new C_WebInfo();
                latitude.GeneralName    = CommonGlobal.Latitude;
                latitude.GeneralContent = system_config_view.Latitude;
                latitude.Datemodified   = DateTime.Now;
                webInfoModels.Update(latitude);

                ////latitude
                C_WebInfo longitude = new C_WebInfo();
                longitude.GeneralName    = CommonGlobal.Longitude;
                longitude.GeneralContent = system_config_view.Longitude;
                longitude.Datemodified   = DateTime.Now;
                webInfoModels.Update(longitude);

                ////image
                C_WebInfo imgmap = new C_WebInfo();
                imgmap.GeneralName = CommonGlobal.ImageMap;
                //// imgmap. = system_config_view.imgmap;
                imgmap.Datemodified = DateTime.Now;

                var imgPathTemp = "images/icon/"; ////+ DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/";
                var name_time   = DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + string.Empty;
                if (file_img != null && file_img.ContentLength > 0 && CommonGlobal.IsImage(file_img) == true)
                {
                    string image_name = imgPathTemp + "sc_original_" + name_time + "_" + CommonGlobal.CompleteNamefileImages(file_img.FileName);

                    ////save image and delete old file
                    this.SavephotoOriginal(imgmap.GeneralContent, file_img, imgPathTemp, image_name);

                    ////set image thumb to link catalog
                    imgmap.GeneralContent        = "/" + image_name;
                    system_config_view.Image_map = "/" + image_name;
                }
                else if (string.IsNullOrEmpty(imgmap.GeneralContent))
                {
                    imgmap.GeneralContent = "0";
                }
                else
                {
                    imgmap.GeneralContent = system_config_view.Image_map;
                }

                webInfoModels.Update(imgmap);

                system_config_view.Message = "Cập nhật thành công.";
            }

            ////list language
            system_config_view.List_language = this.List_select_language(lang);
            try
            {
                ////General
                system_config_view.Page_name   = GeneralModels.GetContent(CommonGlobal.PageName, lang);
                system_config_view.Keywords    = GeneralModels.GetContent(CommonGlobal.Keyword, lang);
                system_config_view.Description = GeneralModels.GetContent(CommonGlobal.Description, lang);
                system_config_view.Support     = GeneralModels.GetContent(CommonGlobal.Support, lang);
                system_config_view.Address     = GeneralModels.GetContent(CommonGlobal.Address, lang);
                system_config_view.Slogan      = GeneralModels.GetContent(CommonGlobal.Slogan, lang);
                ////webinfo
                system_config_view.Hotline         = webInfoModels.GetContent(CommonGlobal.Hotline);
                system_config_view.Facebook        = webInfoModels.GetContent(CommonGlobal.Facebook);
                system_config_view.Skype           = webInfoModels.GetContent(CommonGlobal.Skyper);
                system_config_view.Fees            = webInfoModels.GetContent(CommonGlobal.Fees);
                system_config_view.Min_fees        = webInfoModels.GetContent(CommonGlobal.MinFees);
                system_config_view.Tax             = webInfoModels.GetContent(CommonGlobal.Tax);
                system_config_view.Google_analysis = webInfoModels.GetContent(CommonGlobal.GoogleAnalysis);
                system_config_view.App_extend_one  = webInfoModels.GetContent(CommonGlobal.AppExtendOne);
                system_config_view.App_extend_two  = webInfoModels.GetContent(CommonGlobal.AppExtendTwo);
                system_config_view.Latitude        = webInfoModels.GetContent(CommonGlobal.Latitude);
                system_config_view.Longitude       = webInfoModels.GetContent(CommonGlobal.Longitude);
                system_config_view.Image_map       = webInfoModels.GetContent(CommonGlobal.ImageMap);
            }
            catch (Exception)
            {
                system_config_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 class=\"active\"><a href=\"#\"><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><a href=\"" + Url.Action("index", "dashboard", new { act = "footer", ctrl = "adminGeneral", type_act = CommonGlobal.Edit }) + "\"><span>Footer</span></a></li>");

            system_config_view.Html_link_tab = sb.ToString();
            system_config_view.Type_act      = type_act;
            system_config_view.Type          = type;
            ////action
            system_config_view.Act               = act;
            system_config_view.Ctrl              = ctrl;
            system_config_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            system_config_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/system_config", system_config_view));
        }
Exemplo n.º 19
0
        public ActionResult List_post(int?parent, int?cate_id, int?post_id, string type, string act, string ctrl, string type_act, string lang, string search, int?page, int?page_size, string order_by, string order_type)
        {
            CatalogModels         cataModel           = new CatalogModels();
            PostModels            postModel           = new PostModels();
            C_Post                post                = new C_Post();
            List <SelectListItem> list_select_catalog = new List <SelectListItem>();
            var           list_post_view              = new Web.Areas.Admin.ViewModels.List_post_view();
            StringBuilder sb = new StringBuilder();

            int total_record = 0;
            int level        = 0;

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

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

            if (parent == null)
            {
                parent = Request.QueryString["parent"] != null?Convert.ToInt32(Request.QueryString["parent"].ToString()) : 0;
            }

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

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            list_post_view.Page      = (int)page;
            list_post_view.Page_size = (int)page_size;

            list_post_view.Cate_type = CommonGlobal.GetCatalogTypeName(type);

            ////list category
            cataModel.List_catalog_parent(0, level, (int)parent, type, lang, ref list_select_catalog);
            list_post_view.List_parent = list_select_catalog;

            ////list language
            list_post_view.List_language = this.List_select_language(lang);

            ////tab
            sb.Append("<li class=\"active\"><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_post", ctrl = "adminPost", type = type, page = "1", parent = parent, lang = lang }) + "\"><span><span>Danh mục " + CommonGlobal.GetCatalogTypeName(type) + "</span></span></a></li>");
            sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "change_post", ctrl = "adminPost", type = type, type_act = "add", parent = parent, lang = lang }) + "\"><span><span>Thêm bài viết</span></span></a></li>");
            list_post_view.Html_link_tab = sb.ToString();

            if (post_id != null && post_id != 0 && type_act != null && type_act == CommonGlobal.Delete)
            {
                ////check permission delete
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type))
                {
                    post = postModel.GetbyID((int)post_id);
                    if (post != null)
                    {
                        ////delete old image
                        if (!string.IsNullOrEmpty(post.ImagePath))
                        {
                            string strImg = post.ImagePath;
                            strImg = "~" + strImg;
                            string fileDelete = Server.MapPath(strImg);
                            if (System.IO.File.Exists(fileDelete))
                            {
                                System.IO.File.Delete(fileDelete);
                            }

                            string fileDelete2 = Server.MapPath(strImg.Replace("sc_small_", "sc_full_"));
                            if (System.IO.File.Exists(fileDelete2))
                            {
                                System.IO.File.Delete(fileDelete2);
                            }
                        }
                        ////delete post
                        bool rt = postModel.Delete((int)post_id);
                        if (rt)
                        {
                            list_post_view.Message = "Bạn đã xóa bài viết: " + post_id;
                        }
                        else
                        {
                            list_post_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_post_view.Message = "Không tìm thấy bài viết : " + post_id;
                    }
                }
                else
                {
                    list_post_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }

            ////list post
            list_post_view.List_page_size = this.GetSizePagingPublic((int)page_size);
            list_post_view.Page_list_post = postModel.GetListPostAll(lang, type, (int)parent, search, (int)page, (int)page_size, order_by, order_type, out total_record);
            list_post_view.Total_record   = total_record;
            list_post_view.Search         = search;
            list_post_view.Type_act       = type_act;
            list_post_view.Type           = type;
            ////action
            list_post_view.Act               = act;
            list_post_view.Ctrl              = ctrl;
            list_post_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_post_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/list_post", list_post_view));
        }
Exemplo n.º 20
0
        public ActionResult Change_catalog(int?parent, int?cate_id, string type, string act, string ctrl, string lang, string type_act)
        {
            CatalogModels         cateModels          = new CatalogModels();
            C_Catalog             cate                = new C_Catalog();
            StringBuilder         sb                  = new StringBuilder();
            List <SelectListItem> list_select_catalog = new List <SelectListItem>();
            var catalog_view = new Web.Areas.Admin.ViewModels.Catalog_view();
            int level        = 0;

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

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

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

            if (cate_id == null)
            {
                cate_id = RouteData.Values["id"] != null?Convert.ToInt32(RouteData.Values["id"].ToString()) : 0;
            }

            if (parent == null)
            {
                parent = string.IsNullOrEmpty(Request.QueryString["parent"]) ? 0 : Convert.ToInt32(Request.QueryString["parent"].ToString());
            }

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

            if (string.IsNullOrEmpty(type_act))
            {
                type_act = Request.QueryString["type_act"] != null ? Request.QueryString["type_act"].ToString() : CommonGlobal.Add;
                if (cate_id == 0)
                {
                    type_act = CommonGlobal.Add;
                }
                else
                {
                    type_act = CommonGlobal.Edit;
                }
            }

            if (type_act == CommonGlobal.Edit)
            {
                cate = cateModels.GetbyID((int)cate_id);
                cateModels.List_catalog_parent(0, level, cate.ParentID ?? 0, type, cate.Lang ?? lang, ref list_select_catalog);
                var link_catalog = Url.Action("index", "dashboard", new { act = "list_catalog", ctrl = "adminCatalog", type_act = CommonGlobal.View, type = type, page = "1", parent = parent, lang = cate.Lang ?? lang });
                sb.Append("<li><a class=\"active\" href=\"" + link_catalog + "\"><span><span>Danh mục " + CommonGlobal.GetCatalogTypeName(type) + "</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>" + cate.CategoryName + "</span></span></a></li>");
                catalog_view.Lang          = cate.Lang ?? lang;
                catalog_view.Cate_id       = cate.CatalogID;
                catalog_view.Category_name = cate.CategoryName;
                catalog_view.ImagePath     = cate.ImagePath;
                catalog_view.Intro         = cate.Intro;
                catalog_view.MoreInfo      = cate.MoreInfo;
                catalog_view.Keyword       = cate.Keyword;
                catalog_view.Description   = cate.Description;
                catalog_view.Title         = cate.Title;
                catalog_view.Link          = cate.Link;
                catalog_view.Parent        = cate.ParentID ?? 0;
                if ((cate.Show ?? false) == true)
                {
                    catalog_view.Show      = true;
                    catalog_view.Show_text = "checked='checked'";
                }
                else
                {
                    catalog_view.Show      = false;
                    catalog_view.Show_text = string.Empty;
                }

                catalog_view.List_language = this.List_select_language(cate.Lang ?? this.Lang);
                catalog_view.OrderDisplay  = (int)cate.OrderDisplay;
            }
            else
            {
                cateModels.List_catalog_parent(0, level, (int)parent, type, lang, ref list_select_catalog);
                var link_catalog = Url.Action("index", "dashboard", new { act = "list_catalog", ctrl = "adminCatalog", type = type, page = "1", parent = parent, lang = lang });
                sb.Append("<li><a class=\"active\" href=\"" + link_catalog + "\"><span><span>Danh mục " + CommonGlobal.GetCatalogTypeName(type) + "</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Thêm danh mục</span></span></a></li>");
                catalog_view.Lang          = lang;
                catalog_view.List_language = this.List_select_language(this.Lang);
                catalog_view.OrderDisplay  = cateModels.GetMaxOrderDisplay(type);
                catalog_view.Parent        = (int)parent;
            }

            catalog_view.List_parent   = list_select_catalog;
            catalog_view.Html_link_tab = sb.ToString();
            catalog_view.Type          = type;
            catalog_view.Type_act      = type_act;

            ////action and parent action
            catalog_view.Act               = act;
            catalog_view.Ctrl              = ctrl;
            catalog_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            catalog_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            return(this.PartialView("../control/change_catalog", catalog_view));
        }
Exemplo n.º 21
0
        public ActionResult Post_category_host(int?parent_id)
        {
            ///// Lấy danh sách collection mới nhất
            CatalogModels cateModels  = new CatalogModels();
            var           lstCategory = cateModels.GetbyParentID(0, CommonGlobal.CateService, LanguageModels.ActiveLanguage().LangCultureName, int.Parse(Util.GetConfigValue("NumberListCategory", "0")));

            return(this.PartialView("../control/post_category_host", lstCategory));
        }
Exemplo n.º 22
0
        public ActionResult Change_showroom(int?showroomID, string type, string act, string ctrl, string type_act, string lang)
        {
            ShowroomModels showroomModels = new ShowroomModels();
            CityModels     cityModels     = new CityModels();
            DistrictModels districtModels = new DistrictModels();
            Showroom       objShowroom    = new Showroom();
            var            showroom_view  = new Web.Areas.Admin.ViewModels.Showroom_view();
            StringBuilder  sb             = new StringBuilder();

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

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

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

            if (showroomID == null)
            {
                showroomID = RouteData.Values["showroom_id"] != null?Convert.ToInt32(RouteData.Values["ShowroomID"].ToString()) : 0;
            }

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

            if (string.IsNullOrEmpty(type_act))
            {
                type_act = Request.QueryString["type_act"] != null ? Request.QueryString["type_act"].ToString() : CommonGlobal.Add;
                if (showroomID == 0)
                {
                    type_act = CommonGlobal.Add;
                }
                else
                {
                    type_act = CommonGlobal.Edit;
                }
            }

            if (type_act == CommonGlobal.Edit)
            {
                objShowroom = showroomModels.GetShowroomById((int)showroomID);
                showroom_view.ShowroomID = objShowroom.ShowroomID;
                showroom_view.DistrictID = objShowroom.DistrictID;
                showroom_view.Longitude  = objShowroom.Longitude;
                showroom_view.Latitude   = objShowroom.Latitude;
                showroom_view.Name       = objShowroom.Name;
                showroom_view.Address    = objShowroom.Address;
                showroom_view.Phone      = objShowroom.Phone;
                showroom_view.Image      = objShowroom.Image;

                ////Link tab
                sb.Append("<li><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_showroom", ctrl = "adminShowroom", page = "1" }) + "\"><span><span>Danh sách Showroom</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Cập nhật</span></span></a></li>");

                District objDistrict = districtModels.GetDistrictByID(objShowroom.DistrictID);
                ////City and District
                showroom_view.List_city     = cityModels.List_city(objDistrict.CityID);
                showroom_view.List_district = districtModels.List_district(objDistrict.CityID, objShowroom.DistrictID);

                showroom_view.City     = objDistrict.CityID;
                showroom_view.District = objDistrict.DistrictID;
            }
            else
            {
                ////Link tab
                sb.Append("<li><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_showroom", ctrl = "adminShowroom", page = "1", lang = lang }) + "\"><span><span>Danh sách Showroom</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Thêm mới</span></span></a></li>");

                ////City and District
                showroom_view.List_city     = cityModels.List_city(0);
                showroom_view.List_district = districtModels.List_district(0, 0);
            }

            showroom_view.Type          = type;
            showroom_view.Type_act      = type_act;
            showroom_view.Html_link_tab = sb.ToString();
            ////action
            showroom_view.Act               = act;
            showroom_view.Ctrl              = ctrl;
            showroom_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            showroom_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/change_showroom", showroom_view));
        }
Exemplo n.º 23
0
        public ActionResult Post_detail(int?id, int?cate_id, string back_link, string cate_type)
        {
            string       url          = Request.Url.ToString();
            RatingModels ratingModels = new RatingModels();
            PostModels   postModels   = new PostModels();

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

            var post_view = new ViewModels.Post_detail_view();

            if (id == 0)
            {
                return(this.HttpNotFound());
            }
            else
            {
                postModels.ClearCache(CommonGlobal.Post + string.Empty + id);
                C_Post obj = postModels.GetbyID((int)id);
                if (obj.PostID == 0)
                {
                    return(this.HttpNotFound());
                }

                ////post_view.listRating = ratingModels.GetListRatingByItem(obj.PostID);
                ////StringBuilder _html5 = new StringBuilder();
                ////for (int j = 0; j < post_view.listRating.Count; j++)
                ////{

                ////    _html5.Append("<div class=\"review-header\">");
                ////    _html5.Append("   <h5>" + HttpUtility.HtmlDecode(post_view.listRating[j].name) + "</h5>");
                ////    _html5.Append("   <div class=\"product-rating\">");
                ////    _html5.Append("      <div class=\"stars\">");
                ////    var start = post_view.listRating[j].Rating ?? 0;
                ////    var other = 5 - start;
                ////    for (int jj = 0; jj < other; jj++)
                ////    {
                ////        _html5.Append("<span class=\"star\"></span>");
                ////    }
                ////    for (int ii = 0; ii < start; ii++)
                ////    {
                ////        _html5.Append("<span class=\"star active\"></span>");
                ////    }
                ////    _html5.Append("      </div>");
                ////    _html5.Append("   </div>");
                ////    _html5.Append("</div>");
                ////    _html5.Append("<div class=\"review-body\">");
                ////    _html5.Append("   <p>" + HttpUtility.HtmlDecode(post_view.listRating[j].contents) + "</p>");
                ////    _html5.Append("</div>");
                ////    _html5.Append("<hr>");
                ////}
                ////post_view.ltrRating = _html5.ToString();
                ////post_view.ratingSum = ratingModels.GetRatingSumforItem(obj.PostID);
                ////post_view.ratingTotal = ratingModels.GetRatingTotalforItem(obj.PostID);

                ////StringBuilder _html6 = new StringBuilder();
                ////var start_no = post_view.ratingTotal != 0 ? (post_view.ratingSum / post_view.ratingTotal) : 0;
                ////var other_no = 5 - start_no;
                ////for (int jj = 0; jj < other_no; jj++)
                ////{
                ////    _html6.Append("<span class=\"star\"></span>");
                ////}
                ////for (int ii = 0; ii < start_no; ii++)
                ////{
                ////    _html6.Append("<span class=\"star active\"></span>");
                ////}
                ////post_view.ratingStart = _html6.ToString();

                post_view.ListOther = postModels.GetOthers(obj.PostID, obj.CatelogID ?? 0, LanguageModels.ActiveLanguage().LangCultureName, int.Parse(Util.GetConfigValue("NumberOtherNews", "3")));

                CatalogModels catalogModel = new CatalogModels();
                C_Catalog     cateItem     = new C_Catalog();

                if (cate_id == 0)
                {
                    if (obj.CatelogID != null && obj.CatelogID != 0)
                    {
                        cate_id = obj.CatelogID;
                    }
                }

                cateItem = catalogModel.GetbyID((int)cate_id);

                post_view.PostID       = obj.PostID;
                post_view.PostName     = obj.PostName;
                post_view.Title        = obj.Title;
                post_view.Summary      = CommonGlobal.CutString(obj.Summary, 500);
                post_view.CatalogID    = obj.CatelogID;
                post_view.ImagePath    = obj.ImagePath;
                post_view.Link         = obj.Link;
                post_view.PostContent  = obj.PostContent;
                post_view.DateModified = obj.DateModified;
                post_view.IsHot        = obj.IsHot;
                post_view.Lang         = obj.Lang;
                post_view.Keyword      = obj.Keyword;
                post_view.Description  = obj.Description;
                post_view.OrderDisplay = obj.OrderDisplay;
                post_view.Approve      = obj.Approve;
                post_view.Cate_id      = cate_id ?? 0;
                post_view.Cate_type    = cate_type;
                post_view.Url          = url;
            }

            return(this.PartialView("../control/post_detail", post_view));
        }
Exemplo n.º 24
0
        public ActionResult List_page_static(int?id, string act, string ctrl, string type_act, string type, string lang, string search, int?page, int?page_size, string order_by, string order_type)
        {
            PageModels    pageModels     = new PageModels();
            StringBuilder sb             = new StringBuilder();
            C_Pages       cpage          = new C_Pages();
            var           list_page_view = new Web.Areas.Admin.ViewModels.List_page_view();
            int           total_record   = 0;

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

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

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

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

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

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            if (id != null && type_act != null && type_act == CommonGlobal.Delete)
            {
                ////check permission delete
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type ?? string.Empty))
                {
                    cpage = pageModels.GetbyID((int)id);
                    if (cpage != null)
                    {
                        ////delete old image
                        if (!string.IsNullOrEmpty(cpage.ImagePath))
                        {
                            string strImg = cpage.ImagePath;
                            strImg = "~" + strImg;
                            string fileDelete = Server.MapPath(strImg);
                            if (System.IO.File.Exists(fileDelete))
                            {
                                System.IO.File.Delete(fileDelete);
                            }

                            string fileDelete2 = Server.MapPath(strImg.Replace("sc_small_", "sc_full_"));
                            if (System.IO.File.Exists(fileDelete2))
                            {
                                System.IO.File.Delete(fileDelete2);
                            }
                        }

                        ////delete category
                        bool rt = pageModels.Delete((int)id);
                        if (rt)
                        {
                            list_page_view.Message = "Bạn đã xóa page " + id;
                        }
                        else
                        {
                            list_page_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_page_view.Message = "Không tìm thấy page : " + id;
                    }
                }
                else
                {
                    list_page_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }

            if (string.IsNullOrEmpty(order_by) || string.IsNullOrEmpty(order_type))
            {
                order_by   = "OrderDisplay";
                order_type = "asc";
            }

            list_page_view.Type_act  = type_act;
            list_page_view.Cate_type = "Danh sách trang tĩnh ";
            list_page_view.Lang      = lang;
            ////tab
            sb.Append("<li class=\"active\"><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_page_static", ctrl = "adminStatic", page = "1" }) + "\"><span><span>Danh sách trang tĩnh</span></span></a></li>");
            sb.Append("<li><a href=\"" + Url.Action("index", "dashboard", new { act = "change_static", ctrl = "adminStatic", type_act = CommonGlobal.Add }) + "\"><span><span>Thêm trang tĩnh</span></span></a></li>");
            list_page_view.Html_link_tab = sb.ToString();
            ////list language
            list_page_view.List_language = this.List_select_language(this.Lang);
            ////list page size and paging
            list_page_view.List_page_size = this.GetSizePagingPublic((int)page_size);
            list_page_view.Page           = (int)page;
            list_page_view.Page_size      = (int)page_size;
            ////list catalog
            list_page_view.Page_list    = pageModels.GetAllPageStaticAdmin(lang, search, (int)page, (int)page_size, order_by, order_type, out total_record);
            list_page_view.Search       = search;
            list_page_view.Order_by     = order_by;
            list_page_view.Order_type   = order_type;
            list_page_view.Total_record = total_record;
            ////acton and parent action
            list_page_view.Act               = act;
            list_page_view.Ctrl              = ctrl;
            list_page_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_page_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            return(this.PartialView("../control/list_page_static", list_page_view));
        }
Exemplo n.º 25
0
        public ActionResult Change_emailtemplate(int?id, string type, string act, string ctrl, string type_act, string lang)
        {
            EmailTemplateModels emailTemplateModels = new EmailTemplateModels();
            C_EmailTemplate     objEmailTemplate    = new C_EmailTemplate();
            var           email_template_view       = new Web.Areas.Admin.ViewModels.Email_template_view();
            StringBuilder sb = new StringBuilder();

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

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

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

            if (id == null)
            {
                id = RouteData.Values["id"] != null?Convert.ToInt32(RouteData.Values["id"].ToString()) : 0;
            }

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

            if (string.IsNullOrEmpty(type_act))
            {
                type_act = Request.QueryString["type_act"] != null ? Request.QueryString["type_act"].ToString() : CommonGlobal.Add;
                if (id == 0)
                {
                    type_act = CommonGlobal.Add;
                }
                else
                {
                    type_act = CommonGlobal.Edit;
                }
            }

            if (type_act == CommonGlobal.Edit)
            {
                objEmailTemplate             = emailTemplateModels.GetEmailTemplateById((int)id);
                email_template_view.Id       = objEmailTemplate.id;
                email_template_view.Name     = objEmailTemplate.name;
                email_template_view.Template = objEmailTemplate.template;

                ////Link tab
                sb.Append("<li><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_emailtemplate", ctrl = "adminEmail", page = "1" }) + "\"><span><span>Danh sách email template</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Cập nhật</span></span></a></li>");
            }
            else
            {
                ////Link tab
                sb.Append("<li><a class=\"active\" href=\"" + Url.Action("index", "dashboard", new { act = "list_emailtemplate", ctrl = "adminEmail", page = "1", lang = lang }) + "\"><span><span>Danh sách email template</span></span></a></li>");
                sb.Append("<li class=\"active\"><a href=\"#\"><span><span>Thêm mới</span></span></a></li>");
            }

            email_template_view.Type          = type;
            email_template_view.Type_act      = type_act;
            email_template_view.Html_link_tab = sb.ToString();
            ////action
            email_template_view.Act               = act;
            email_template_view.Ctrl              = ctrl;
            email_template_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            email_template_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            ////end action

            return(this.PartialView("../control/change_emailtemplate", email_template_view));
        }