public Maticsoft.Model.CMS.ContentClass DataRowToModel(DataRow row) { Maticsoft.Model.CMS.ContentClass class2 = new Maticsoft.Model.CMS.ContentClass(); if (row != null) { if ((row["ClassID"] != null) && (row["ClassID"].ToString() != "")) { class2.ClassID = int.Parse(row["ClassID"].ToString()); } if (row["ClassName"] != null) { class2.ClassName = row["ClassName"].ToString(); } if (row["ClassIndex"] != null) { class2.ClassIndex = row["ClassIndex"].ToString(); } if ((row["Sequence"] != null) && (row["Sequence"].ToString() != "")) { class2.Sequence = int.Parse(row["Sequence"].ToString()); } if ((row["ParentId"] != null) && (row["ParentId"].ToString() != "")) { class2.ParentId = new int?(int.Parse(row["ParentId"].ToString())); } if ((row["State"] != null) && (row["State"].ToString() != "")) { class2.State = int.Parse(row["State"].ToString()); } if ((row["AllowSubclass"] != null) && (row["AllowSubclass"].ToString() != "")) { if ((row["AllowSubclass"].ToString() == "1") || (row["AllowSubclass"].ToString().ToLower() == "true")) { class2.AllowSubclass = true; } else { class2.AllowSubclass = false; } } if ((row["AllowAddContent"] != null) && (row["AllowAddContent"].ToString() != "")) { if ((row["AllowAddContent"].ToString() == "1") || (row["AllowAddContent"].ToString().ToLower() == "true")) { class2.AllowAddContent = true; } else { class2.AllowAddContent = false; } } if (row["ImageUrl"] != null) { class2.ImageUrl = row["ImageUrl"].ToString(); } if (row["Description"] != null) { class2.Description = row["Description"].ToString(); } if (row["Keywords"] != null) { class2.Keywords = row["Keywords"].ToString(); } if ((row["ClassTypeID"] != null) && (row["ClassTypeID"].ToString() != "")) { class2.ClassTypeID = int.Parse(row["ClassTypeID"].ToString()); } if ((row["ClassModel"] != null) && (row["ClassModel"].ToString() != "")) { class2.ClassModel = int.Parse(row["ClassModel"].ToString()); } if (row["PageModelName"] != null) { class2.PageModelName = row["PageModelName"].ToString(); } if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != "")) { class2.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if ((row["CreatedUserID"] != null) && (row["CreatedUserID"].ToString() != "")) { class2.CreatedUserID = int.Parse(row["CreatedUserID"].ToString()); } if (row["Path"] != null) { class2.Path = row["Path"].ToString(); } if ((row["Depth"] != null) && (row["Depth"].ToString() != "")) { class2.Depth = new int?(int.Parse(row["Depth"].ToString())); } if (row["Remark"] != null) { class2.Remark = row["Remark"].ToString(); } if (row["Meta_Title"] != null) { class2.Meta_Title = row["Meta_Title"].ToString(); } if (row["Meta_Description"] != null) { class2.Meta_Description = row["Meta_Description"].ToString(); } if (row["Meta_Keywords"] != null) { class2.Meta_Keywords = row["Meta_Keywords"].ToString(); } if (row["SeoUrl"] != null) { class2.SeoUrl = row["SeoUrl"].ToString(); } if (row["SeoImageAlt"] != null) { class2.SeoImageAlt = row["SeoImageAlt"].ToString(); } if (row["SeoImageTitle"] != null) { class2.SeoImageTitle = row["SeoImageTitle"].ToString(); } if (row["IndexChar"] != null) { class2.IndexChar = row["IndexChar"].ToString(); } } return class2; }
public static PageSetting GetContentClassSetting(Maticsoft.Model.CMS.ContentClass classModel, string pageName = "CMSSelf", ApplicationKeyType applicationType = 4) { if (classModel == null) { classModel = new Maticsoft.Model.CMS.ContentClass(); } PageSetting setting = new PageSetting(pageName, applicationType, "Base"); if (!string.IsNullOrWhiteSpace(classModel.Meta_Title)) { setting._title = classModel.Meta_Title; } else { setting._title = ConfigSystem.GetValueByCache(setting.KeyTitle, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._title)) { setting._title = ConfigSystem.GetValueByCache("Title", ApplicationKeyType.System); } } if (!string.IsNullOrWhiteSpace(classModel.Meta_Keywords)) { setting._keywords = classModel.Meta_Keywords; } else { setting._keywords = ConfigSystem.GetValueByCache(setting.KeyKeywords, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._keywords)) { setting._keywords = ConfigSystem.GetValueByCache("Keywords", ApplicationKeyType.System); } } if (!string.IsNullOrWhiteSpace(classModel.Meta_Description)) { setting._description = classModel.Meta_Description; } else { setting._description = ConfigSystem.GetValueByCache(setting.KeyDescription, setting._applicationType); if (string.IsNullOrWhiteSpace(setting._description)) { setting._description = ConfigSystem.GetValueByCache("Description", ApplicationKeyType.System); } } if (setting._title.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._title = ReplaceHostName(setting._title); } if (setting._keywords.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._keywords = ReplaceHostName(setting._keywords); } if (setting._description.IndexOf("{hostname}", StringComparison.Ordinal) > -1) { setting._description = ReplaceHostName(setting._description); } setting.Replace(new string[][] { new string[] { "{ctname}", classModel.ClassName }, new string[] { "{cateid}", classModel.ClassID.ToString() } }); return setting; }
protected void btnSave_Click(object sender, EventArgs e) { int classID = 0; if (this.dropParentID.SelectedIndex > 0) { classID = Globals.SafeInt(this.dropParentID.SelectedValue, 0); Maticsoft.Model.CMS.ContentClass class2 = this.bll.GetModel(classID); if ((class2 != null) && !class2.AllowSubclass) { MessageBox.ShowFailTip(this, CMS.CCErrorAddClass); return; } } Maticsoft.Model.CMS.ContentClass model = new Maticsoft.Model.CMS.ContentClass { ClassName = Globals.HtmlEncode(this.txtClassName.Text), ClassIndex = this.txtClassIndex.Text, ParentId = new int?(classID), State = Globals.SafeInt(this.radlState.SelectedValue, 0), AllowSubclass = this.chkAllowSubclass.Checked, AllowAddContent = this.chkAllowAddContent.Checked, ImageUrl = this.HiddenField_ICOPath.Value, Description = Globals.HtmlEncode(this.txtDescription.Text), Keywords = Globals.HtmlEncode(this.txtKeywords.Text), ClassTypeID = Globals.SafeInt(this.dropClassTypeID.SelectedValue, 0), ClassModel = Globals.SafeInt(this.radlClassModel.SelectedValue, 0), PageModelName = Globals.HtmlEncode(this.txtPageModelName.Text), IndexChar = this.txtIndexChar.Text, CreatedUserID = base.CurrentUser.UserID, Remark = Globals.HtmlEncode(this.txtRemark.Text) }; if (this.bll.AddExt(model)) { this.btnCancle.Enabled = false; this.btnSave.Enabled = false; MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK, "List.aspx"); } else { MessageBox.ShowFailTip(this, Site.TooltipSaveError); } }