public static void GetPostype(Model_PostType parameters) { //Model_Post p = new Model_Post { PostTypeID = 1 }; List <Model_PostType> ret = parameters.GetPostTypeAll(); AppTools.SendResponse(HttpContext.Current.Response, ret.ObjectToJSON()); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { byte intPostTypeID = byte.Parse(this.PostTypeID); Model_PostType cp = new Model_PostType(); cp = cp.GetPostTypeByID(intPostTypeID); Literal hTitle = this.Page.Master.FindControl("PageTitleHeader") as Literal; string Title = cp.Title; hTitle.Text = ": " + Title; //titlepage.Text = Title + " List"; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { byte intPostTypeID = byte.Parse(this.PostTypeID); byte intTaxTypeID = byte.Parse(this.TaxTypeID); Model_PostType cp = new Model_PostType(); cp = cp.GetPostTypeByID(intPostTypeID); Literal hTitle = this.Page.Master.FindControl("PageTitleHeader") as Literal; string Title = cp.Title + "-" + (intTaxTypeID == 1 ? "Category" : "Tags"); hTitle.Text = ": " + Title; titlepage.Text = Title + " List"; //addTax.Visible = false; //addTax.NavigateUrl = "/admin/Post/Taxonomy?TaxTypeID=" + this.TaxTypeID + "&PostTypeID=" + this.PostTypeID + "&Mode=Add"; HyperLink addTax = this.Page.Master.FindControl("AdnewBtn") as HyperLink; addTax.Visible = true; addTax.NavigateUrl = "/admin/Post/Taxonomy?TaxTypeID=" + this.TaxTypeID + "&PostTypeID=" + this.PostTypeID + "&Mode=Add"; } }
protected void Page_Load(object sender, EventArgs e) { //Response.Write(HttpUtility.UrlDecode(Request.Url.AbsolutePath)));Response.End(); if (!this.Page.IsPostBack) { string Pagetitle = string.Empty; string Pagedescription = string.Empty; string canonical = string.Empty; string fb_localte = string.Empty; string fb_type = string.Empty; string fb_title = string.Empty; string fb_des = string.Empty; string fb_url = string.Empty; string fb_site_name = string.Empty; string fb_image = string.Empty; string tw_card = string.Empty; string tw_title = string.Empty; string tw_des = string.Empty; string tw_image = string.Empty; string analytic = string.Empty; bool Metarobotfollow = false; Model_SiteInfo st = new Model_SiteInfo(); Model_MainSetting setting = new Model_MainSetting(); setting = setting.GetMainSetting(); Model_PageEngine PageEngine = new Model_PageEngine(); PageEngine.SiteInfo = st.GetSiteInfo(); PageEngine.MainSetting = setting; Model_PostType cPostType = new Model_PostType(); Model_Post post = new Model_Post(); Model_Menu m = new Model_Menu(); Model_PostTaxonomy tax = new Model_PostTaxonomy(); List <Model_Post> postArchive = new List <Model_Post>(); Model_Archive archive = new Model_Archive(); PageEngine.NavMenu = m.GetMenuAll(1); PageEngine.FooterMenu = m.GetMenuAll(2); //string[] dd = { "fixed-sidebar", "no-skin-config", "full-height-layout" }; //StyleCore dd = new StyleCore(); //StyleCore.arrayClass = dd; //Set Setting to MasterPage Class Master.PageEngine = PageEngine; byte bytPostTypeID = 0; string StrPost_slug = string.Empty; int intPostID = 0; string RouteSlug_1 = Page.RouteData.Values["Param1"] as string; string RouteSlug_2 = Page.RouteData.Values["Param2"] as string; string RouteSlug_3 = Page.RouteData.Values["Param3"] as string; string RouteSlug_4 = Page.RouteData.Values["Param4"] as string; string RouteSlug_5 = Page.RouteData.Values["Param5"] as string; Model_PostCustomItem pct = new Model_PostCustomItem(); //Case Route Slug if (!string.IsNullOrEmpty(RouteSlug_1)) { //1. Check Is Archive archive = archive.GetPostArchive(RouteSlug_1); if (archive != null) { //Is Archive bytPostTypeID = archive.PostTypeID; StrPost_slug = (string.IsNullOrEmpty(archive.Slug) ? archive.PostTypeSlug : archive.Slug); //postArchive = CmsController.GetPostArchive(bytPostTypeID); //Check PostType Archive switch (StrPost_slug) { case "hotelworld-products": //check Route Param2 if (string.IsNullOrEmpty(RouteSlug_2)) { //Case Product Page Archive SectionProductArchive.Visible = true; cPostType = cPostType.GetPostTypeBySlug(StrPost_slug); if (cPostType != null) { //product-type = 24 this.TaxForPostType = tax.FrontGetTaxonomyByID(24); if (this.TaxForPostType != null) { this.TaxList = tax.FrontGetTaxonomyByRefID(24); } } } else { //check Is Paging of Product Page Archive if (RouteSlug_2 == "page") { //Case Archive Paging SectionProductArchive.Visible = true; string pageno = RouteSlug_3; } else if (RouteSlug_2 == "category" || RouteSlug_2 == "tag") { //Tax Archive tax = tax.GetTaxBySlugAndPostType(RouteSlug_3, bytPostTypeID); if (tax != null) { //case Tax approve SectionProductTaxArchive.Visible = true; this.TaxForPostType = tax; this.TaxList = tax.GetTaxonomyTaxTypeAndPostType_withcountpost(bytPostTypeID, (byte)PostTaxonomyType.Categories); this.ContentBody = tax.BodyContent; //Case tax Archive Paging if (RouteSlug_4 == "page") { string pageno = RouteSlug_5; //Do something with paging } } } else { //Check Product SinglePage post = CmsController.GetPostSlug(RouteSlug_2, PostType.Products); if (post != null) { SectionProductSingle.Visible = true; this.PostDataUI = post; this.ContentBody = post.BodyContent; this.PageContentTitle = post.Title; this.CTF = pct.GetItemCustomByPostID(post.PostID); } } } break; case "ข่าวสาร": //check Route Param2 if (string.IsNullOrEmpty(RouteSlug_2)) { //Case Product Page Archive SectionBlogPageArchive.Visible = true; } else { //check Is Paging of Product Page Archive if (RouteSlug_2 == "page") { //Case Archive Paging SectionBlogPageArchive.Visible = true; string pageno = RouteSlug_3; } else if (RouteSlug_2 == "category" || RouteSlug_2 == "tag") { //Tax Archive tax = tax.GetTaxBySlugAndPostType(RouteSlug_3, bytPostTypeID); if (tax != null) { //case Tax approve //Same layout with blog archive // SectionBlogPageTaxArchive.Visible = true; SectionBlogPageArchive.Visible = true; //Case tax Archive Paging if (RouteSlug_4 == "page") { string pageno = RouteSlug_5; //Do something with paging } } } else { //Check Product SinglePage post = CmsController.GetPostSlug(RouteSlug_2, PostType.Blog); if (post != null) { SectionBlogPageSingle.Visible = true; } } } break; } HeaderSection.Text = GenerateHeaderBannerAndSlider(post, tax); } else { //Case PostType Page StrPost_slug = RouteSlug_1; post = CmsController.GetPostSlug(StrPost_slug, PostType.Pages); if (post != null) { bytPostTypeID = post.PostTypeID; intPostID = post.PostID; //page_header.Visible = true; if (StrPost_slug == "checkout") { section_checkout_page.Visible = true; } else { page_content.Visible = true; } HeaderSection.Text = GenerateHeaderBannerAndSlider(post); this.PostDataUI = post; this.ContentBody = post.BodyContent; this.PageContentTitle = post.Title; } } // content.Text = post.BodyContent; } else { //Case HomePage No Slug //Get PostID From Setting HomePage Slug intPostID = setting.HomePagePostID; post = CmsController.GetPostByID(intPostID); if (post != null) { StrPost_slug = post.Slug; bytPostTypeID = post.PostTypeID; HeaderSection.Text = GenerateHeaderBannerAndSlider(post); this.CTF = pct.GetItemCustomByPostID(intPostID); // content.Text = post.BodyContent; this.PostDataUI = post; this.ContentBody = post.BodyContent; this.PageContentTitle = post.Title; section_page_home.Visible = true; home_content.Text = this.ContentBody; } } //= null; Model_PostSeo posttype_postseo = new Model_PostSeo(); Model_PostSeo tax_postseo = new Model_PostSeo(); Model_PostSeo post_postseo = new Model_PostSeo(); if (bytPostTypeID != 0) { cPostType = cPostType.GetPostTypeByID(bytPostTypeID); posttype_postseo = cPostType.PosTypetSEO; } if (tax != null) { tax_postseo = tax.TaxSEO; } if (post != null) { post_postseo = post.PostSEO; } Pagetitle = checklv(posttype_postseo, tax_postseo, post_postseo, "SEOTitle"); Pagedescription = checklv(posttype_postseo, tax_postseo, post_postseo, "MetaDescription"); canonical = checklv(posttype_postseo, tax_postseo, post_postseo, "CanonicalUrl"); fb_localte = setting.htmlTagSiteLang; fb_type = "website"; fb_title = checklv(posttype_postseo, tax_postseo, post_postseo, "FaceBookTitle"); fb_des = checklv(posttype_postseo, tax_postseo, post_postseo, "FacebookDescription"); fb_url = Request.Url.ToString(); fb_site_name = PageEngine.SiteInfo.Slogan; fb_image = checklv(posttype_postseo, tax_postseo, post_postseo, "FacebookImage"); tw_card = "summary"; tw_title = checklv(posttype_postseo, tax_postseo, post_postseo, "TwitterTitle"); tw_des = checklv(posttype_postseo, tax_postseo, post_postseo, "TwitterDescription"); tw_image = checklv(posttype_postseo, tax_postseo, post_postseo, "TwitterImages"); analytic = checklv(posttype_postseo, tax_postseo, post_postseo, "GoogleAnalytic"); Metarobotfollow = checklv_bool(posttype_postseo, tax_postseo, post_postseo, "Metarobotsfollow"); this.Page.Title = string.IsNullOrEmpty(Pagetitle) ? setting.WebSiteTitle : Pagetitle; var MetaDescription = new HtmlMeta { Name = "description", Content = Pagedescription }; Header.Controls.Add(MetaDescription); var MetaFB_locate = new HtmlMeta { Name = "og:locale", Content = fb_localte }; Header.Controls.Add(MetaFB_locate); var MetaFB_Type = new HtmlMeta { Name = "og:type", Content = fb_type }; Header.Controls.Add(MetaFB_Type); var MetaFB_title = new HtmlMeta { Name = "og:title", Content = !string.IsNullOrEmpty(fb_title)? fb_title : string.IsNullOrEmpty(Pagetitle) ? setting.WebSiteTitle : Pagetitle }; Header.Controls.Add(MetaFB_title); var MetaFB_Des = new HtmlMeta { Name = "og:description", Content = !string.IsNullOrEmpty(fb_des) ? fb_des: Pagedescription }; Header.Controls.Add(MetaFB_Des); var MetaFB_Url = new HtmlMeta { Name = "og:url", Content = fb_url }; Header.Controls.Add(MetaFB_Url); var MetaFB_SiteName = new HtmlMeta { Name = "og:site_name", Content = fb_site_name }; Header.Controls.Add(MetaFB_SiteName); var MetaFB_image = new HtmlMeta { Name = "og:image", Content = fb_image }; Header.Controls.Add(MetaFB_image); var MetaTW_Card = new HtmlMeta { Name = "twitter:card", Content = tw_card }; Header.Controls.Add(MetaTW_Card); var MetaTW_Des = new HtmlMeta { Name = "twitter:description", Content = tw_des }; Header.Controls.Add(MetaTW_Des); var MetaTW_Title = new HtmlMeta { Name = "twitter:title", Content = tw_title }; Header.Controls.Add(MetaTW_Title); var Meta_Image = new HtmlMeta { Name = "twitter:image", Content = tw_image }; Header.Controls.Add(Meta_Image); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { if (this.TaxTypeID == "2") { taxParent.Visible = false; } byte intPostTypeID = byte.Parse(this.PostTypeID); byte intTaxTypeID = byte.Parse(this.TaxTypeID); Model_PostTaxonomy pt = new Model_PostTaxonomy { PostTypeID = intPostTypeID, TaxTypeID = intTaxTypeID }; List <Model_PostTaxonomy> Taxlistdrop = new List <Model_PostTaxonomy>(); List <Model_PostTaxonomy> Taxlist = pt.GetTaxonomyActiveOnly(pt); foreach (Model_PostTaxonomy i in Taxlist.Where(g => g.RefID == 0)) { Taxlistdrop.Add(i); if (Taxlist.Where(f => f.RefID == i.TaxID).Count() > 0) { Taxlistdrop.AddRange(getchild(Taxlist.Where(f => f.RefID == i.TaxID).ToList(), Taxlist, i.TaxID)); } } Model_PostType cp = new Model_PostType(); cp = cp.GetPostTypeByID(intPostTypeID); Literal hTitle = this.Page.Master.FindControl("PageTitleHeader") as Literal; hTitle.Text = ": " + cp.Title + "-" + (intTaxTypeID == 1 ? "Category" : "Tags"); ListItem listitem = new ListItem("None", "0"); if (!string.IsNullOrEmpty(this.Mode)) { switch (this.Mode) { case "Add": slug_form.Visible = false; btnPubish.Text = "Add New Now"; tab_seo.Visible = false; tab_facebook.Visible = false; tab_twitter.Visible = false; //form_status.Visible = false; //form_publish.Visible = false; //form_viewcount.Visible = false; cover_img.Visible = false; //cover_type.Visible = false; //master_slider.Visible = false; lbldatepublish.Text = "----"; dropStatus.SelectedValue = "True"; viewcount.Text = "0"; dropParent.DataSource = Taxlistdrop; dropParent.DataValueField = "TaxID"; dropParent.DataTextField = "TitleLevel"; dropParent.DataBind(); linkrestore.Visible = false; linktrash.Visible = false; dropParent.Items.Insert(0, listitem); break; case "Edit": HyperLink addTax = this.Page.Master.FindControl("AdnewBtn") as HyperLink; addTax.Visible = true; addTax.NavigateUrl = "/admin/Post/Taxonomy.aspx?TaxTypeID=" + this.TaxTypeID + "&PostTypeID=" + this.PostTypeID + "&Mode=Add"; Model_PostTaxonomy tax = new Model_PostTaxonomy(); int TaxID = int.Parse(Request.QueryString["TaxID"]); tax = tax.GetTaxonomyByID(int.Parse(Request.QueryString["TaxID"])); slug.Text = tax.Slug.Trim(); slug_form.Visible = true; viewcount.Text = tax.ViewCount.ToString(); txtTitle.Text = tax.Title.Trim(); lbldatepublish.Text = tax.DatePublish.ToThaiDateTime().ToString("dd MMM yyyy HH:mm tt"); dropStatus.SelectedValue = tax.Status.ToString(); txtContentBuilder.Text = tax.BodyContentBuilder; txtContent.Text = tax.BodyContent; if (tax.Trash) { linktrash.Visible = true; linkrestore.Visible = false; } else { linktrash.Visible = false; linkrestore.Visible = true; } if (tax.TaxSEO != null) { Model_PostSeo seo = tax.TaxSEO; seotitle.Text = seo.SEOTitle; metades.Text = seo.MetaDescription; Canonical.Text = seo.CanonicalUrl; droprebot.SelectedValue = seo.Metarobotsfollow.ToString(); facebookTitle.Text = seo.FaceBookTitle; facebookDes.Text = seo.FacebookDescription; facebookImg.Value = seo.FacebookImage; twTitle.Text = seo.TwitterTitle; twDes.Text = seo.TwitterDescription; twimg.Value = seo.TwitterImages; analytic.Text = seo.GoogleAnalytic; } if (tax.TaxMedia.Count > 0) { Model_TaxMedia cover = tax.TaxMedia.FirstOrDefault(r => r.TaxID == TaxID && r.TaxMediaTypeID == TaxMediaType.CoverImage); if (cover != null) { hd_MID.Value = cover.MID.ToString(); CoverImage1.Value = cover.MediaFullPath; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } Model_TaxMedia feature = tax.TaxMedia.FirstOrDefault(r => r.TaxID == TaxID && r.TaxMediaTypeID == TaxMediaType.FeatureImage); if (feature != null) { feature_image_mid.Value = feature.MID.ToString(); feature_image_url.Value = feature.MediaFullPath; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } Model_TaxMedia feature_full = tax.TaxMedia.FirstOrDefault(r => r.TaxID == TaxID && r.TaxMediaTypeID == TaxMediaType.Feature_Image_full_Width); if (feature_full != null) { image_full_width_mid.Value = feature_full.MID.ToString(); image_full_width_url.Value = feature_full.MediaFullPath; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } Model_TaxMedia upsell = tax.TaxMedia.FirstOrDefault(r => r.TaxID == TaxID && r.TaxMediaTypeID == TaxMediaType.Banner_Upsell); if (upsell != null) { banner_upsale_mid.Value = upsell.MID.ToString(); banner_upsale_url.Value = upsell.MediaFullPath; textCationUpsale.Text = upsell.Caption; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } } CoverType.Value = tax.BannerTypeID.ToString(); radioshowmMS.SelectedValue = tax.ShowMasterSlider.ToString(); dropParent.DataSource = Taxlistdrop.Where(r => r.TaxID != TaxID); dropParent.DataValueField = "TaxID"; dropParent.DataTextField = "TitleLevel"; dropParent.DataBind(); dropParent.Items.Insert(0, listitem); dropParent.SelectedValue = tax.RefID.ToString(); break; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { byte intPostTypeID = byte.Parse(this.PostTypeID); //byte intTaxTypeID = byte.Parse(this.TaxTypeID); //Model_PostTaxonomy pt = new Model_PostTaxonomy //{ // PostTypeID = intPostTypeID, // TaxTypeID = intTaxTypeID //}; //List<Model_PostTaxonomy> Taxlistdrop = new List<Model_PostTaxonomy>(); //List<Model_PostTaxonomy> Taxlist = pt.GetTaxonomyActiveOnly(pt); //foreach(Model_PostTaxonomy i in Taxlist.Where(g=>g.RefID == 0)) //{ // Taxlistdrop.Add(i); // if(Taxlist.Where(f => f.RefID == i.PostTypeID).Count() > 0) // { // Taxlistdrop.AddRange(getchild(Taxlist.Where(f => f.RefID == i.PostTypeID).ToList(),Taxlist, i.PostTypeID)); // } //} Model_PostType cp = new Model_PostType(); cp = cp.GetPostTypeByID(intPostTypeID); if (cp != null) { slug.Text = cp.Slug.Trim(); slug.Enabled = false; txtTitle.Text = cp.Title.Trim(); viewcount.Text = cp.ViewCount.ToString(); //HyperLink addTax = this.Page.Master.FindControl("AdnewBtn") as HyperLink; //addTax.Visible = true; //addTax.NavigateUrl = "/admin/Post/Taxonomy.aspx?TaxTypeID=" + this.TaxTypeID + "&PostTypeID=" + this.PostTypeID + "&Mode=Add"; if (cp.PosTypetSEO != null) { Model_PostSeo seo = cp.PosTypetSEO; seotitle.Text = seo.SEOTitle; metades.Text = seo.MetaDescription; Canonical.Text = seo.CanonicalUrl; droprebot.SelectedValue = seo.Metarobotsfollow.ToString(); facebookTitle.Text = seo.FaceBookTitle; facebookDes.Text = seo.FacebookDescription; facebookImg.Value = seo.FacebookImage; twTitle.Text = seo.TwitterTitle; twDes.Text = seo.TwitterDescription; twimg.Value = seo.TwitterImages; analytic.Text = seo.GoogleAnalytic; } CoverType.Value = cp.BannerTypeID.ToString(); radioshowmMS.SelectedValue = cp.ShowMasterSlider.ToString(); if (cp.PostTypeMedia.Count > 0) { Model_PostTypeMedia cover = cp.PostTypeMedia.FirstOrDefault(r => r.PostTypeID == intPostTypeID && r.PostTypeMediaTypeID == PostTypeMediaType.CoverImage); if (cover != null) { hd_MID.Value = cover.MID.ToString(); CoverImage1.Value = cover.MediaFullPath; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } Model_PostTypeMedia feature = cp.PostTypeMedia.FirstOrDefault(r => r.PostTypeID == intPostTypeID && r.PostTypeMediaTypeID == PostTypeMediaType.FeatureImage); if (feature != null) { feature_image_mid.Value = feature.MID.ToString(); feature_image_url.Value = feature.MediaFullPath; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } Model_PostTypeMedia feature_full = cp.PostTypeMedia.FirstOrDefault(r => r.PostTypeID == intPostTypeID && r.PostTypeMediaTypeID == PostTypeMediaType.Feature_Image_full_Width); if (feature_full != null) { image_full_width_mid.Value = feature_full.MID.ToString(); image_full_width_url.Value = feature_full.MediaFullPath; //hd_postMeidaID.Value = cover.PostMediaID.ToString(); } //Model_PostTypeMedia upsell = cp.PostTypeMedia.FirstOrDefault(r => r.PostTypeID == intPostTypeID && r.PostTypeMediaTypeID == PostTypeMediaType.Banner_Upsell); //if (upsell != null) //{ // banner_upsale_mid.Value = upsell.MID.ToString(); // banner_upsale_url.Value = this.MainSetting.WebSiteURL + upsell.MediaFullPath; // textCationUpsale.Text = upsell.Caption; // //hd_postMeidaID.Value = cover.PostMediaID.ToString(); //} } } //dropParent.DataSource = Taxlistdrop.Where(r => r.PostTypeID != PostTypeID); //dropParent.DataValueField = "PostTypeID"; //dropParent.DataTextField = "TitleLevel"; // dropParent.DataBind(); //dropParent.Items.Insert(0, listitem); //dropParent.SelectedValue = tax.RefID.ToString(); } }
public void Update() { byte intPostTypeID = byte.Parse(this.PostTypeID); Model_PostType cp = new Model_PostType { PostTypeID = intPostTypeID, Title = txtTitle.Text.Trim(), Slug = slug.Text.GenerateSlug(), // BodyContent = txtContent.Text.Trim(), //BodyContentBuilder = txtContentBuilder.Text.Trim(), //Status = bool.Parse(dropStatus.SelectedValue), BannerTypeID = byte.Parse(CoverType.Value), ShowMasterSlider = bool.Parse(radioshowmMS.SelectedValue), }; Model_PostTypeSEOMap seomap = new Model_PostTypeSEOMap(); seomap = seomap.GetSEOID(intPostTypeID); Model_PostSeo seo = new Model_PostSeo { SEOTitle = seotitle.Text.Trim(), MetaDescription = metades.Text.Trim(), CanonicalUrl = Canonical.Text.Trim(), Metarobotsfollow = bool.Parse(droprebot.SelectedValue), FaceBookTitle = facebookTitle.Text.Trim(), FacebookDescription = facebookDes.Text.Trim(), FacebookImage = facebookImg.Value, TwitterTitle = twTitle.Text.Trim(), TwitterDescription = twDes.Text.Trim(), TwitterImages = twimg.Value, GoogleAnalytic = analytic.Text.Trim(), }; if (seomap != null) { seo.PSID = seomap.PSID; seo.UpdateSEO(seo); } else { int PSID = seo.InsertSEO_step1(seo); if (PSID > 0) { seomap = new Model_PostTypeSEOMap { PostTypeID = intPostTypeID, PSID = PSID }; seomap.InsertMApSeo(seomap); } } if (!string.IsNullOrEmpty(hd_MID.Value)) { Model_PostTypeMedia pm = new Model_PostTypeMedia { PostTypeMediaTypeID = PostTypeMediaType.CoverImage, PostTypeID = intPostTypeID, MID = int.Parse(hd_MID.Value) }; pm.insertMediaPost(pm); } else { Model_PostTypeMedia pm = new Model_PostTypeMedia { PostTypeMediaTypeID = PostTypeMediaType.CoverImage, PostTypeID = intPostTypeID }; pm.DeletePostTypeMedia(pm); } //Feature image if (!string.IsNullOrEmpty(feature_image_mid.Value)) { Model_PostTypeMedia pm = new Model_PostTypeMedia { PostTypeMediaTypeID = PostTypeMediaType.FeatureImage, PostTypeID = intPostTypeID, MID = int.Parse(feature_image_mid.Value) }; pm.insertMediaPost(pm); } else { Model_PostTypeMedia pm = new Model_PostTypeMedia { PostTypeMediaTypeID = PostTypeMediaType.FeatureImage, PostTypeID = intPostTypeID }; pm.DeletePostTypeMedia(pm); } //Feature image full if (!string.IsNullOrEmpty(image_full_width_mid.Value)) { Model_PostTypeMedia pm = new Model_PostTypeMedia { PostTypeMediaTypeID = PostTypeMediaType.Feature_Image_full_Width, PostTypeID = intPostTypeID, MID = int.Parse(image_full_width_mid.Value) }; pm.insertMediaPost(pm); } else { Model_PostTypeMedia pm = new Model_PostTypeMedia { PostTypeMediaTypeID = PostTypeMediaType.Feature_Image_full_Width, PostTypeID = intPostTypeID }; pm.DeletePostTypeMedia(pm); } bool ret = cp.UpdatePostType(cp); if (ret) { Response.Redirect(Request.Url.ToString()); } //Response.Redirect("Taxonomy.aspx?TaxTypeID=" + this.TaxTypeID + "&PostTypeID=" + this.PostTypeID + "&Mode=Edit&PostTypeID=" + PostTypeID); }
public static bool InsertMenu(dynamic parameters) { string cmd = parameters["cmd"]; // int cmdarg = (int)parameters["cmdarg"]; string strpost = parameters["strpost"]; string strarch = parameters["strarch"]; string strtax = parameters["strtax"]; string CustomURl = parameters["url"]; string CustomURlTxt = parameters["txt"]; string MenuGroupID = parameters["GroupID"]; Model_PostType cpt = new Model_PostType(); string Title = string.Empty; if (!string.IsNullOrEmpty(cmd)) { switch (cmd) { case "menu_post": if (!string.IsNullOrEmpty(strarch)) { byte PostTypeID = byte.Parse(strarch); Model_PostType cPt = new Model_PostType(); cpt = cpt.GetPostTypeByID(PostTypeID); Model_Menu cme = new Model_Menu(); cme.MGID = int.Parse(MenuGroupID); cme.Title = "All " + cpt.Title; cme.TitleOrigin = cpt.Slug; cme.Slug = cpt.Slug; cme.CustomUrl = ""; cme.Status = true; cme.MenuRefID = 0; cme.Lv = 1; cme.Priority = 1; cme.MCategory = (byte)MenuCategory.Archive; cme.PostTypeID = cpt.PostTypeID; cme.InsertMenuFirst(cme); Model_Archive ma = new Model_Archive(); ma.inSertArchiveMap(cpt.PostTypeID, cpt.Slug); } if (!string.IsNullOrEmpty(strpost)) { foreach (string post in strpost.Split(',')) { int postID = int.Parse(post); Model_Post cP = new Model_Post(); cP = cP.GetPostByID(postID); Model_Menu cme = new Model_Menu(); cme.MGID = int.Parse(MenuGroupID); cme.Title = cP.Slug; cme.TitleOrigin = cP.Slug; cme.Slug = cP.Slug; cme.CustomUrl = ""; cme.Status = true; cme.MenuRefID = 0; cme.Lv = 1; cme.Priority = 1; cme.MCategory = (byte)MenuCategory.Post; cme.PostID = cP.PostID; cme.InsertMenuFirst(cme); } } break; case "menu_Tax": if (!string.IsNullOrEmpty(strtax)) { foreach (string tax in strtax.Split(',')) { int TaxId = int.Parse(tax); Model_PostTaxonomy mp = new Model_PostTaxonomy(); mp = mp.GetTaxonomyByID(TaxId); //if Tax Need to Check PostypeParent and Make Defaul Archive Page as well Model_PostType cPt = new Model_PostType(); cpt = cpt.GetPostTypeByID(mp.PostTypeID); Model_Menu cme = new Model_Menu(); cme.MGID = int.Parse(MenuGroupID); cme.Title = mp.Slug; cme.TitleOrigin = mp.Slug; cme.Slug = mp.Slug; cme.CustomUrl = ""; cme.Status = true; cme.MenuRefID = 0; cme.Lv = 1; cme.Priority = 1; cme.MCategory = (byte)MenuCategory.Taxonomy; cme.TaxID = mp.TaxID; cme.PostTypeID = mp.PostTypeID; cme.InsertMenuFirst(cme); Model_Archive ma = new Model_Archive(); ma.inSertArchiveMap(cpt.PostTypeID, cpt.Slug); } } // mCat = MenuCategory.Taxonomy; break; case "menu_custom": if (!string.IsNullOrEmpty(CustomURl) && !string.IsNullOrEmpty(CustomURlTxt)) { Model_Menu cme = new Model_Menu(); cme.MGID = int.Parse(MenuGroupID); cme.Title = CustomURlTxt; cme.TitleOrigin = CustomURlTxt; cme.Slug = CustomURlTxt; cme.CustomUrl = CustomURl; cme.Status = true; cme.MenuRefID = 0; cme.Lv = 1; cme.Priority = 1; cme.MCategory = (byte)MenuCategory.CustomLink; cme.PostTypeID = cpt.PostTypeID; cme.InsertMenuFirst(cme); } // mCat = MenuCategory.CustomLink; break; } } //Model_Menu cme = new Model_Menu //{ // Title = "", // TitleOrigin = "", // Slug="", // CustomUrl = "", // Status = true, // MenuRefID= 0, // Lv = 1, // IsCustomUrl = true, // Priority=1, // MCategory = (byte)mCat, // TaxID=1, // PostTypeID=1, // PostID = 1 //}; return(true); }