protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; TextBox updWebsiteName = (TextBox)row.FindControl("txtUptWebsiteName"); DropDownList updWebsiteCategoryId = (DropDownList)row.FindControl("ddlCategory"); //check website name if (!CheckInputEmptyAndLength(updWebsiteName, "E01301", "E01302", false)) { return; } //update Johnny.CMS.OM.SeH.Website model = new Johnny.CMS.OM.SeH.Website(); model.WebsiteId = DataConvert.GetInt32(strId); model.WebsiteName = updWebsiteName.Text; model.WebsiteCategoryId = DataConvert.GetInt32(updWebsiteCategoryId.SelectedValue); Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); bll.Update(model); } SetMessage(GetMessage("C00003")); //update grid getData(); }
protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text; TextBox updWebsiteName = (TextBox)row.FindControl("txtUptWebsiteName"); DropDownList updWebsiteCategoryId = (DropDownList)row.FindControl("ddlCategory"); //check website name if (!CheckInputEmptyAndLength(updWebsiteName, "E01301", "E01302", false)) return; //update Johnny.CMS.OM.SeH.Website model = new Johnny.CMS.OM.SeH.Website(); model.WebsiteId = DataConvert.GetInt32(strId); model.WebsiteName = updWebsiteName.Text; model.WebsiteCategoryId = DataConvert.GetInt32(updWebsiteCategoryId.SelectedValue); Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); bll.Update(model); } SetMessage(GetMessage("C00003")); //update grid getData(); }
protected void Page_Load(object sender, EventArgs e) { int categoryid = 0; Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); IList<Johnny.CMS.OM.SeH.Website> list = bll.GetList(); StringBuilder sb = new StringBuilder(); int ix = 0; for (ix = 0; ix < list.Count; ix++) { if (ix != 0 && !categoryid.Equals(list[ix].WebsiteCategoryId)) sb.Append("<p> </p>"); if (!categoryid.Equals(list[ix].WebsiteCategoryId)) { sb.Append("<div class=\"content-link\">"); sb.Append(string.Format("<h4>{0}</h4>", list[ix].WebsiteCategoryName)); sb.Append("<ul>"); } sb.Append(string.Format("<li><a href=\"{0}\" target=\"_blank\" title=\"{1}\">{2}</a></li>", list[ix].URL, list[ix].Description, list[ix].WebsiteName)); if (ix != 0 && (ix == list.Count - 1 || list[ix].WebsiteCategoryId != list[ix+1].WebsiteCategoryId)) { sb.Append("</ul>"); sb.Append("</div>"); } categoryid = list[ix].WebsiteCategoryId; } //lblWebsites.Text = StringHelper.ConvertToHtmlTags(sb.ToString()); lblWebsites.Text = sb.ToString(); }
protected void Page_Load(object sender, EventArgs e) { int categoryid = 0; Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); IList <Johnny.CMS.OM.SeH.Website> list = bll.GetList(); StringBuilder sb = new StringBuilder(); int ix = 0; for (ix = 0; ix < list.Count; ix++) { if (ix != 0 && !categoryid.Equals(list[ix].WebsiteCategoryId)) { sb.Append("<p> </p>"); } if (!categoryid.Equals(list[ix].WebsiteCategoryId)) { sb.Append("<div class=\"content-link\">"); sb.Append(string.Format("<h4>{0}</h4>", list[ix].WebsiteCategoryName)); sb.Append("<ul>"); } sb.Append(string.Format("<li><a href=\"{0}\" target=\"_blank\" title=\"{1}\">{2}</a></li>", list[ix].URL, list[ix].Description, list[ix].WebsiteName)); if (ix != 0 && (ix == list.Count - 1 || list[ix].WebsiteCategoryId != list[ix + 1].WebsiteCategoryId)) { sb.Append("</ul>"); sb.Append("</div>"); } categoryid = list[ix].WebsiteCategoryId; } //lblWebsites.Text = StringHelper.ConvertToHtmlTags(sb.ToString()); lblWebsites.Text = sb.ToString(); }
public override void getData() { Johnny.CMS.BLL.SeH.WebsiteCategory category = new Johnny.CMS.BLL.SeH.WebsiteCategory(); categoryList = category.GetList(); Johnny.CMS.BLL.SeH.Website website = new Johnny.CMS.BLL.SeH.Website(); myManageGridView.DataSource = website.GetList(); myManageGridView.DataBind(); }
protected void btnDelete_Click(object sender, EventArgs e) { foreach (GridViewRow row in myManageGridView.Rows) { TableCell cell = row.Cells[0]; Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect"); if (chkSelect.Checked) { string strId = ((Label)row.FindControl("lblId")).Text; //delete Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); bll.Delete(DataConvert.GetInt32(strId)); } } SetMessage(GetMessage("C00005")); //update grid getData(); }
protected void btnAdd_Click(object sender, System.EventArgs e) { //check category name if (!CheckInputEmptyAndLength(txtWebsiteName, "E01301", "E01302", false)) return; Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); Johnny.CMS.OM.SeH.Website model = new Johnny.CMS.OM.SeH.Website(); if (Request.QueryString["action"] == "modify") { //update model.WebsiteId = Convert.ToInt32(Request.QueryString["id"]); model.WebsiteName = txtWebsiteName.Text; model.WebsiteCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue); model.Description = txtDescription.Text; model.URL = txtURL.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.UpdatedTime = System.DateTime.Now; model.UpdatedById = DataConvert.GetInt32(Session["UserId"]); model.UpdatedByName = DataConvert.GetString(Session["UserName"]); bll.Update(model); SetMessage(GetMessage("C00003")); } else { //insert model.WebsiteName = txtWebsiteName.Text; model.WebsiteCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue); model.Description = txtDescription.Text; model.URL = txtURL.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.IsDisplay = rdbDisplay0.Checked; model.CreatedTime = System.DateTime.Now; model.CreatedById = DataConvert.GetInt32(Session["UserId"]); model.CreatedByName = DataConvert.GetString(Session["UserName"]); model.UpdatedTime = System.DateTime.Now; model.UpdatedById = DataConvert.GetInt32(Session["UserId"]); model.UpdatedByName = DataConvert.GetString(Session["UserName"]); if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); ddlCategory.SelectedIndex = 0; txtWebsiteName.Text = ""; txtDescription.Text = ""; txtURL.Text = ""; txtHits.Text = "0"; rdbDisplay1.Checked = false; lblCreatedTime.Text = ""; lblCreatedByName.Text = ""; lblUpdatedTime.Text = ""; lblUpdatedByName.Text = ""; } else SetMessage(GetMessage("C00002")); } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { litPageTitle.Text = GetLabelText("Website_Title"); litWebsiteCategory.Text = GetLabelText("Website_WebsiteCategoryId"); ddlCategory.ToolTip = GetLabelText("Website_WebsiteCategoryId"); litWebsiteName.Text = GetLabelText("Website_WebsiteName"); txtWebsiteName.ToolTip = GetLabelText("Website_WebsiteName"); litDescription.Text = GetLabelText("Website_Description"); txtDescription.ToolTip = GetLabelText("Website_Description"); litURL.Text = GetLabelText("Website_URL"); txtURL.ToolTip = GetLabelText("Website_URL"); litHits.Text = GetLabelText("Website_Hits"); txtHits.ToolTip = GetLabelText("Website_Hits"); litIsDisplay.Text = GetLabelText("Website_IsDisplay"); rdbDisplay0.Text = GetLabelText("Common_Yes"); rdbDisplay1.Text = GetLabelText("Common_No"); litRdbDisplayTip.Text = GetLabelText("Website_IsDisplay"); litCreatedTime.Text = GetLabelText("Common_CreatedTime"); litCreatedByName.Text = GetLabelText("Common_CreatedByName"); litUpdatedTime.Text = GetLabelText("Common_UpdatedTime"); litUpdatedByName.Text = GetLabelText("Common_UpdatedByName"); if (Request.QueryString["action"] == "modify") { //get WebsiteId int WebsiteId = Convert.ToInt32(Request.QueryString["id"]); Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); Johnny.CMS.OM.SeH.Website model = new Johnny.CMS.OM.SeH.Website(); model = bll.GetModel(WebsiteId); CreateddlCategory(); foreach (ListItem item in ddlCategory.Items) { if (DataConvert.GetInt32(item.Value) == model.WebsiteCategoryId) { item.Selected = true; break; } } txtWebsiteName.Text = model.WebsiteName; txtDescription.Text = model.Description; txtURL.Text = model.URL; txtHits.Text = DataConvert.GetString(model.Hits); if (model.IsDisplay) rdbDisplay0.Checked = true; else rdbDisplay1.Checked = true; lblCreatedTime.Text = DataConvert.GetLongDateString(model.CreatedTime); lblCreatedByName.Text = model.CreatedByName; lblUpdatedTime.Text = DataConvert.GetLongDateString(model.UpdatedTime); lblUpdatedByName.Text = model.UpdatedByName; btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save; //btnAdd.Text = CONST_BUTTONTEXT_SAVE; } else { CreateddlCategory(); rdbDisplay0.Checked = true; txtHits.Text = "0"; } //RFVldtPermissionName.ErrorMessage = GetMessage("E01301", txtPermissionName.MaxLength.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { //blog Johnny.CMS.BLL.SeH.Blog bll = new Johnny.CMS.BLL.SeH.Blog(); IList<Johnny.CMS.OM.SeH.Blog> list = bll.GetList(); StringBuilder sb = new StringBuilder(); foreach (Johnny.CMS.OM.SeH.Blog blog in list) { sb.Append(string.Format("<li><a href=\"blogdetail.aspx?blogid={0}\">{1}({2})</a></li>", blog.BlogId, blog.Title, DataConvert.GetShortDateString(blog.UpdatedTime))); } lblBlogList.Text = sb.ToString(); //website sb.Length = 0; Johnny.CMS.BLL.SeH.Website bllWebsite = new Johnny.CMS.BLL.SeH.Website(); IList<Johnny.CMS.OM.SeH.Website> listWebsite = bllWebsite.GetList(35); int ix = 0; for (ix = 0; ix < listWebsite.Count; ix++) { if (ix % 12 == 0) sb.Append("<ul>"); sb.Append(string.Format("<li><a href=\"{0}\" target=\"_blank\" title=\"{1}\">{2}</a></li>", listWebsite[ix].URL, listWebsite[ix].Description, listWebsite[ix].WebsiteName)); if (ix == listWebsite.Count - 1) sb.Append("<li><b><a href=\"websites.aspx\">更多 <img class=\"arrowimage\" src=\"images/arrow.png\" /></a></b></li>"); if (ix != 0 && (ix == listWebsite.Count - 1 || ix % 11 == 0)) sb.Append("</ul>"); } lblWebsites.Text = sb.ToString(); //software sb.Length = 0; Johnny.CMS.BLL.SeH.Software bllSoftware = new Johnny.CMS.BLL.SeH.Software(); IList<Johnny.CMS.OM.SeH.Software> listSoftware = bllSoftware.GetList(2); for (ix = 0; ix < listSoftware.Count; ix++) { sb.Append("<div class=\"home-block-inner\">"); sb.Append(string.Format(" <a href=\"softwaredetail.aspx?softwareid={0}\"><img class=\"shot\" src=\"{1}\" /></a>", listSoftware[ix].SoftwareId, listSoftware[ix].Image)); sb.Append(string.Format(" <h3><a href=\"softwaredetail.aspx?softwareid={0}\">{1}</a><span style=\"padding-left:10px\"><img style=\"position:relative;top:-7px;left:4px\" src=\"images/new.gif\"></span></h3>", listSoftware[ix].SoftwareId, listSoftware[ix].SoftwareName)); sb.Append(string.Format(" <p style=\"margin:0 0 8px 0\">{0}</p>", listSoftware[ix].ShortDescription)); sb.Append(" <ul>"); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature1)); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature2)); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature3)); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature4)); sb.Append(" </ul>"); sb.Append(string.Format(" <a href=\"softwaredetail.aspx?softwareid={0}\"><img class=\"learn-more\" src=\"images/learn-more.png\" /></a>", listSoftware[ix].SoftwareId)); sb.Append(" <div style=\"clear:both\"></div>"); sb.Append("</div>"); if (ix == 0) { lblSoftware1.Text = sb.ToString(); sb.Length = 0; } else lblSoftware2.Text = sb.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //blog Johnny.CMS.BLL.SeH.Blog bll = new Johnny.CMS.BLL.SeH.Blog(); IList <Johnny.CMS.OM.SeH.Blog> list = bll.GetList(); StringBuilder sb = new StringBuilder(); foreach (Johnny.CMS.OM.SeH.Blog blog in list) { sb.Append(string.Format("<li><a href=\"blogdetail.aspx?blogid={0}\">{1}({2})</a></li>", blog.BlogId, blog.Title, DataConvert.GetShortDateString(blog.UpdatedTime))); } lblBlogList.Text = sb.ToString(); //website sb.Length = 0; Johnny.CMS.BLL.SeH.Website bllWebsite = new Johnny.CMS.BLL.SeH.Website(); IList <Johnny.CMS.OM.SeH.Website> listWebsite = bllWebsite.GetList(35); int ix = 0; for (ix = 0; ix < listWebsite.Count; ix++) { if (ix % 12 == 0) { sb.Append("<ul>"); } sb.Append(string.Format("<li><a href=\"{0}\" target=\"_blank\" title=\"{1}\">{2}</a></li>", listWebsite[ix].URL, listWebsite[ix].Description, listWebsite[ix].WebsiteName)); if (ix == listWebsite.Count - 1) { sb.Append("<li><b><a href=\"websites.aspx\">更多 <img class=\"arrowimage\" src=\"images/arrow.png\" /></a></b></li>"); } if (ix != 0 && (ix == listWebsite.Count - 1 || ix % 11 == 0)) { sb.Append("</ul>"); } } lblWebsites.Text = sb.ToString(); //software sb.Length = 0; Johnny.CMS.BLL.SeH.Software bllSoftware = new Johnny.CMS.BLL.SeH.Software(); IList <Johnny.CMS.OM.SeH.Software> listSoftware = bllSoftware.GetList(2); for (ix = 0; ix < listSoftware.Count; ix++) { sb.Append("<div class=\"home-block-inner\">"); sb.Append(string.Format(" <a href=\"softwaredetail.aspx?softwareid={0}\"><img class=\"shot\" src=\"{1}\" /></a>", listSoftware[ix].SoftwareId, listSoftware[ix].Image)); sb.Append(string.Format(" <h3><a href=\"softwaredetail.aspx?softwareid={0}\">{1}</a><span style=\"padding-left:10px\"><img style=\"position:relative;top:-7px;left:4px\" src=\"images/new.gif\"></span></h3>", listSoftware[ix].SoftwareId, listSoftware[ix].SoftwareName)); sb.Append(string.Format(" <p style=\"margin:0 0 8px 0\">{0}</p>", listSoftware[ix].ShortDescription)); sb.Append(" <ul>"); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature1)); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature2)); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature3)); sb.Append(string.Format(" <li><span>{0}</span></li>", listSoftware[ix].Feature4)); sb.Append(" </ul>"); sb.Append(string.Format(" <a href=\"softwaredetail.aspx?softwareid={0}\"><img class=\"learn-more\" src=\"images/learn-more.png\" /></a>", listSoftware[ix].SoftwareId)); sb.Append(" <div style=\"clear:both\"></div>"); sb.Append("</div>"); if (ix == 0) { lblSoftware1.Text = sb.ToString(); sb.Length = 0; } else { lblSoftware2.Text = sb.ToString(); } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { //check category name if (!CheckInputEmptyAndLength(txtWebsiteName, "E01301", "E01302", false)) { return; } Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); Johnny.CMS.OM.SeH.Website model = new Johnny.CMS.OM.SeH.Website(); if (Request.QueryString["action"] == "modify") { //update model.WebsiteId = Convert.ToInt32(Request.QueryString["id"]); model.WebsiteName = txtWebsiteName.Text; model.WebsiteCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue); model.Description = txtDescription.Text; model.URL = txtURL.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.UpdatedTime = System.DateTime.Now; model.UpdatedById = DataConvert.GetInt32(Session["UserId"]); model.UpdatedByName = DataConvert.GetString(Session["UserName"]); bll.Update(model); SetMessage(GetMessage("C00003")); } else { //insert model.WebsiteName = txtWebsiteName.Text; model.WebsiteCategoryId = DataConvert.GetInt32(ddlCategory.SelectedValue); model.Description = txtDescription.Text; model.URL = txtURL.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.IsDisplay = rdbDisplay0.Checked; model.CreatedTime = System.DateTime.Now; model.CreatedById = DataConvert.GetInt32(Session["UserId"]); model.CreatedByName = DataConvert.GetString(Session["UserName"]); model.UpdatedTime = System.DateTime.Now; model.UpdatedById = DataConvert.GetInt32(Session["UserId"]); model.UpdatedByName = DataConvert.GetString(Session["UserName"]); if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); ddlCategory.SelectedIndex = 0; txtWebsiteName.Text = ""; txtDescription.Text = ""; txtURL.Text = ""; txtHits.Text = "0"; rdbDisplay1.Checked = false; lblCreatedTime.Text = ""; lblCreatedByName.Text = ""; lblUpdatedTime.Text = ""; lblUpdatedByName.Text = ""; } else { SetMessage(GetMessage("C00002")); } } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { litPageTitle.Text = GetLabelText("Website_Title"); litWebsiteCategory.Text = GetLabelText("Website_WebsiteCategoryId"); ddlCategory.ToolTip = GetLabelText("Website_WebsiteCategoryId"); litWebsiteName.Text = GetLabelText("Website_WebsiteName"); txtWebsiteName.ToolTip = GetLabelText("Website_WebsiteName"); litDescription.Text = GetLabelText("Website_Description"); txtDescription.ToolTip = GetLabelText("Website_Description"); litURL.Text = GetLabelText("Website_URL"); txtURL.ToolTip = GetLabelText("Website_URL"); litHits.Text = GetLabelText("Website_Hits"); txtHits.ToolTip = GetLabelText("Website_Hits"); litIsDisplay.Text = GetLabelText("Website_IsDisplay"); rdbDisplay0.Text = GetLabelText("Common_Yes"); rdbDisplay1.Text = GetLabelText("Common_No"); litRdbDisplayTip.Text = GetLabelText("Website_IsDisplay"); litCreatedTime.Text = GetLabelText("Common_CreatedTime"); litCreatedByName.Text = GetLabelText("Common_CreatedByName"); litUpdatedTime.Text = GetLabelText("Common_UpdatedTime"); litUpdatedByName.Text = GetLabelText("Common_UpdatedByName"); if (Request.QueryString["action"] == "modify") { //get WebsiteId int WebsiteId = Convert.ToInt32(Request.QueryString["id"]); Johnny.CMS.BLL.SeH.Website bll = new Johnny.CMS.BLL.SeH.Website(); Johnny.CMS.OM.SeH.Website model = new Johnny.CMS.OM.SeH.Website(); model = bll.GetModel(WebsiteId); CreateddlCategory(); foreach (ListItem item in ddlCategory.Items) { if (DataConvert.GetInt32(item.Value) == model.WebsiteCategoryId) { item.Selected = true; break; } } txtWebsiteName.Text = model.WebsiteName; txtDescription.Text = model.Description; txtURL.Text = model.URL; txtHits.Text = DataConvert.GetString(model.Hits); if (model.IsDisplay) { rdbDisplay0.Checked = true; } else { rdbDisplay1.Checked = true; } lblCreatedTime.Text = DataConvert.GetLongDateString(model.CreatedTime); lblCreatedByName.Text = model.CreatedByName; lblUpdatedTime.Text = DataConvert.GetLongDateString(model.UpdatedTime); lblUpdatedByName.Text = model.UpdatedByName; btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save; //btnAdd.Text = CONST_BUTTONTEXT_SAVE; } else { CreateddlCategory(); rdbDisplay0.Checked = true; txtHits.Text = "0"; } //RFVldtPermissionName.ErrorMessage = GetMessage("E01301", txtPermissionName.MaxLength.ToString()); } }