/// <summary> /// Method to get recoders with condition /// </summary> public IList <Johnny.CMS.OM.SeH.Software> GetList(int?top) { IList <Johnny.CMS.OM.SeH.Software> list = new List <Johnny.CMS.OM.SeH.Software>(); StringBuilder strSql = new StringBuilder(); if (top != null) { strSql.Append(string.Format("SELECT TOP {0} [SoftwareId], [SoftwareName], [ShortDescription], [Description], [Image], [Feature1], [Feature2], [Feature3], [Feature4], [DownloadUrl], [DocumentTitle], [DocumentDescription], [DocumentUrl], [Hits], [Downloads], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ", top)); } else { strSql.Append("SELECT [SoftwareId], [SoftwareName], [ShortDescription], [Description], [Image], [Feature1], [Feature2], [Feature3], [Feature4], [DownloadUrl], [DocumentTitle], [DocumentDescription], [DocumentUrl], [Hits], [Downloads], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] "); } strSql.Append(" FROM [seh_software] "); strSql.Append(" ORDER BY [Sequence] DESC"); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { Johnny.CMS.OM.SeH.Software item = new Johnny.CMS.OM.SeH.Software(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetString(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetInt32(13), sdr.GetInt32(14), sdr.GetBoolean(15), sdr.GetDateTime(16), sdr.GetInt32(17), sdr.GetString(18), sdr.GetDateTime(19), sdr.GetInt32(20), sdr.GetString(21), sdr.GetInt32(22)); list.Add(item); } } return(list); }
/// <summary> /// Method to get one recoder by primary key /// </summary> public Johnny.CMS.OM.SeH.Software GetModel(int softwareid) { //Set up a return value Johnny.CMS.OM.SeH.Software model = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT [SoftwareId], [SoftwareName], [ShortDescription], [Description], [Image], [Feature1], [Feature2], [Feature3], [Feature4], [DownloadUrl], [DocumentTitle], [DocumentDescription], [DocumentUrl], [Hits], [Downloads], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] "); strSql.Append(" FROM [seh_software] "); strSql.Append(" WHERE [SoftwareId]=@softwareid"); SqlParameter[] parameters = { new SqlParameter("@softwareid", SqlDbType.Int, 4) }; parameters[0].Value = softwareid; using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters)) { if (sdr.Read()) { model = new Johnny.CMS.OM.SeH.Software(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetString(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetInt32(13), sdr.GetInt32(14), sdr.GetBoolean(15), sdr.GetDateTime(16), sdr.GetInt32(17), sdr.GetString(18), sdr.GetDateTime(19), sdr.GetInt32(20), sdr.GetString(21), sdr.GetInt32(22)); } else { model = new Johnny.CMS.OM.SeH.Software(); } } return(model); }
protected void Page_Load(object sender, EventArgs e) { int softwareid = Convert.ToInt32(Request.QueryString["softwareid"]); Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = bll.GetModel(softwareid); if (model != null) { lblSoftwareName.Text = model.SoftwareName; lblDocumentTitle.Text = model.DocumentTitle; lblDocumentDescription.Text = model.DocumentDescription; lblDocumentUrl.Text = string.Format("<a href=\"{0}\">下载</a>", model.DownloadUrl); Johnny.CMS.BLL.SeH.Release bllRelease = new Johnny.CMS.BLL.SeH.Release(); Johnny.CMS.OM.SeH.Release modelRelease = bllRelease.GetLatestModel(softwareid); if (modelRelease != null) { lblReleaseName.Text = modelRelease.ReleaseName; lblReleaseDescription.Text = StringHelper.htmlOutputText(modelRelease.Description); lblDownloadUrl.Text = string.Format("<a href=\"{0}\">下载</a>", model.DownloadUrl); } } }
protected void Page_Load(object sender, EventArgs e) { int softwareid = Convert.ToInt32(Request.QueryString["softwareid"]); Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = bll.GetModel(softwareid); if (model != null) { lblSoftwareName.Text = model.SoftwareName; Johnny.CMS.BLL.SeH.Release bllRelease = new Johnny.CMS.BLL.SeH.Release(); IList <Johnny.CMS.OM.SeH.Release> list = bllRelease.GetList(softwareid); StringBuilder sb = new StringBuilder(); foreach (Johnny.CMS.OM.SeH.Release release in list) { sb.Append("<tr>"); sb.Append(" <td>"); sb.Append(string.Format(" <p class=\"date\">{0}</p>", DataConvert.GetShortDateString(release.ReleaseDate))); sb.Append(string.Format(" <p class=\"release\">{0}</p>", release.ReleaseName)); sb.Append(string.Format(" {0}", release.Description)); sb.Append(" </td>"); sb.Append("</tr>"); } lblReleaseList.Text = StringHelper.htmlOutputText(sb.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { int softwareid = Convert.ToInt32(Request.QueryString["softwareid"]); Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = bll.GetModel(softwareid); if (model != null) { lblSoftwareName.Text = model.SoftwareName; lblUpdateTime.Text = DataConvert.GetString(model.UpdatedTime); lblDescription.Text = model.Description; } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); Johnny.CMS.OM.SeH.Software model = new Johnny.CMS.OM.SeH.Software(); base.ManageTable = model.TableName; base.ManageKey = model.PrimaryKey; base.IsDesc = model.IsDesc; if (!IsPostBack) { myManageGridView.Columns[2].HeaderText = GetLabelText("Software_SoftwareName"); getData(); } }
/// <summary> /// Method to get one recoder by primary key /// </summary> public Johnny.CMS.OM.SeH.Software GetModel(int softwareid) { //Set up a return value Johnny.CMS.OM.SeH.Software model = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT [SoftwareId], [SoftwareName], [ShortDescription], [Description], [Image], [Feature1], [Feature2], [Feature3], [Feature4], [DownloadUrl], [DocumentTitle], [DocumentDescription], [DocumentUrl], [Hits], [Downloads], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] "); strSql.Append(" FROM [seh_software] "); strSql.Append(" WHERE [SoftwareId]=@softwareid"); SqlParameter[] parameters = { new SqlParameter("@softwareid", SqlDbType.Int,4)}; parameters[0].Value = softwareid; using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters)) { if (sdr.Read()) model = new Johnny.CMS.OM.SeH.Software(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetString(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetInt32(13), sdr.GetInt32(14), sdr.GetBoolean(15), sdr.GetDateTime(16), sdr.GetInt32(17), sdr.GetString(18), sdr.GetDateTime(19), sdr.GetInt32(20), sdr.GetString(21), sdr.GetInt32(22)); else model = new Johnny.CMS.OM.SeH.Software(); } return model; }
/// <summary> /// Method to get recoders with condition /// </summary> public IList<Johnny.CMS.OM.SeH.Software> GetList(int? top) { IList<Johnny.CMS.OM.SeH.Software> list = new List<Johnny.CMS.OM.SeH.Software>(); StringBuilder strSql = new StringBuilder(); if (top != null) strSql.Append(string.Format("SELECT TOP {0} [SoftwareId], [SoftwareName], [ShortDescription], [Description], [Image], [Feature1], [Feature2], [Feature3], [Feature4], [DownloadUrl], [DocumentTitle], [DocumentDescription], [DocumentUrl], [Hits], [Downloads], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ", top)); else strSql.Append("SELECT [SoftwareId], [SoftwareName], [ShortDescription], [Description], [Image], [Feature1], [Feature2], [Feature3], [Feature4], [DownloadUrl], [DocumentTitle], [DocumentDescription], [DocumentUrl], [Hits], [Downloads], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] "); strSql.Append(" FROM [seh_software] "); strSql.Append(" ORDER BY [Sequence] DESC"); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { Johnny.CMS.OM.SeH.Software item = new Johnny.CMS.OM.SeH.Software(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetString(5), sdr.GetString(6), sdr.GetString(7), sdr.GetString(8), sdr.GetString(9), sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetInt32(13), sdr.GetInt32(14), sdr.GetBoolean(15), sdr.GetDateTime(16), sdr.GetInt32(17), sdr.GetString(18), sdr.GetDateTime(19), sdr.GetInt32(20), sdr.GetString(21), sdr.GetInt32(22)); list.Add(item); } } return list; }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SeH.Software model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [seh_software] SET "); strSql.Append("[SoftwareName]=@softwarename,"); strSql.Append("[ShortDescription]=@shortdescription,"); strSql.Append("[Description]=@description,"); strSql.Append("[Image]=@image,"); strSql.Append("[Feature1]=@feature1,"); strSql.Append("[Feature2]=@feature2,"); strSql.Append("[Feature3]=@feature3,"); strSql.Append("[Feature4]=@feature4,"); strSql.Append("[DownloadUrl]=@downloadurl,"); strSql.Append("[DocumentTitle]=@documenttitle,"); strSql.Append("[DocumentDescription]=@documentdescription,"); strSql.Append("[DocumentUrl]=@documenturl,"); strSql.Append("[Hits]=@hits,"); strSql.Append("[Downloads]=@downloads,"); strSql.Append("[IsDisplay]=@isdisplay,"); //strSql.Append("[CreatedTime]=@createdtime,"); //strSql.Append("[CreatedById]=@createdbyid,"); //strSql.Append("[CreatedByName]=@createdbyname,"); strSql.Append("[UpdatedTime]=@updatedtime,"); strSql.Append("[UpdatedById]=@updatedbyid,"); strSql.Append("[UpdatedByName]=@updatedbyname"); strSql.Append(" WHERE [SoftwareId]=@softwareid "); SqlParameter[] parameters = { new SqlParameter("@softwareid", SqlDbType.Int, 4), new SqlParameter("@softwarename", SqlDbType.VarChar, 200), new SqlParameter("@shortdescription", SqlDbType.VarChar, 500), new SqlParameter("@description", SqlDbType.Text), new SqlParameter("@image", SqlDbType.VarChar, 200), new SqlParameter("@feature1", SqlDbType.VarChar, 100), new SqlParameter("@feature2", SqlDbType.VarChar, 100), new SqlParameter("@feature3", SqlDbType.VarChar, 100), new SqlParameter("@feature4", SqlDbType.VarChar, 100), new SqlParameter("@downloadurl", SqlDbType.VarChar, 500), new SqlParameter("@documenttitle", SqlDbType.VarChar, 100), new SqlParameter("@documentdescription", SqlDbType.VarChar, 500), new SqlParameter("@documenturl", SqlDbType.VarChar, 500), new SqlParameter("@hits", SqlDbType.Int, 4), new SqlParameter("@downloads", SqlDbType.Int, 4), new SqlParameter("@isdisplay", SqlDbType.Bit), //new SqlParameter("@createdtime", SqlDbType.DateTime), //new SqlParameter("@createdbyid", SqlDbType.Int,4), //new SqlParameter("@createdbyname", SqlDbType.VarChar,50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int, 4), new SqlParameter("@updatedbyname", SqlDbType.VarChar, 50), }; parameters[0].Value = model.SoftwareId; parameters[1].Value = model.SoftwareName; parameters[2].Value = model.ShortDescription; parameters[3].Value = model.Description; parameters[4].Value = model.Image; parameters[5].Value = model.Feature1; parameters[6].Value = model.Feature2; parameters[7].Value = model.Feature3; parameters[8].Value = model.Feature4; parameters[9].Value = model.DownloadUrl; parameters[10].Value = model.DocumentTitle; parameters[11].Value = model.DocumentDescription; parameters[12].Value = model.DocumentUrl; parameters[13].Value = model.Hits; parameters[14].Value = model.Downloads; parameters[15].Value = model.IsDisplay; //parameters[16].Value = model.CreatedTime; //parameters[17].Value = model.CreatedById; //parameters[18].Value = model.CreatedByName; parameters[16].Value = model.UpdatedTime; parameters[17].Value = model.UpdatedById; parameters[18].Value = model.UpdatedByName; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { litPageTitle.Text = GetLabelText("Software_Title"); litSoftwareName.Text = GetLabelText("Software_SoftwareName"); txtSoftwareName.ToolTip = GetLabelText("Software_SoftwareName"); litShortDescription.Text = GetLabelText("Software_ShortDescription"); txtShortDescription.ToolTip = GetLabelText("Software_ShortDescription"); litContent.Text = GetLabelText("Software_Description"); litImage.Text = GetLabelText("Software_Image"); txtImage.ToolTip = GetLabelText("Software_Image"); litFeature1.Text = GetLabelText("Software_Feature1"); txtFeature1.ToolTip = GetLabelText("Software_Feature1"); litFeature2.Text = GetLabelText("Software_Feature2"); txtFeature2.ToolTip = GetLabelText("Software_Feature2"); litFeature3.Text = GetLabelText("Software_Feature3"); txtFeature3.ToolTip = GetLabelText("Software_Feature3"); litFeature4.Text = GetLabelText("Software_Feature4"); txtFeature4.ToolTip = GetLabelText("Software_Feature4"); litDownloadUrl.Text = GetLabelText("Software_DownloadUrl"); txtDownloadUrl.ToolTip = GetLabelText("Software_DownloadUrl"); litDocumentTitle.Text = GetLabelText("Software_DocumentTitle"); txtDocumentTitle.ToolTip = GetLabelText("Software_DocumentTitle"); litDocumentDescription.Text = GetLabelText("Software_DocumentDescription"); txtDocumentDescription.ToolTip = GetLabelText("Software_DocumentDescription"); litDocumentUrl.Text = GetLabelText("Software_DocumentUrl"); txtDocumentUrl.ToolTip = GetLabelText("Software_DocumentUrl"); litHits.Text = GetLabelText("Software_Hits"); txtHits.ToolTip = GetLabelText("Software_Hits"); litDownloads.Text = GetLabelText("Software_Downloads"); txtDownloads.ToolTip = GetLabelText("Software_Downloads"); litIsDisplay.Text = GetLabelText("Software_IsDisplay"); rdbDisplay0.Text = GetLabelText("Common_Yes"); rdbDisplay1.Text = GetLabelText("Common_No"); litRdbDisplayTip.Text = GetLabelText("Software_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 id int SoftwareId = Convert.ToInt32(Request.QueryString["id"]); Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = new Johnny.CMS.OM.SeH.Software(); model = bll.GetModel(SoftwareId); txtSoftwareName.Text = model.SoftwareName; txtShortDescription.Text = model.ShortDescription; fckContent.Value = StringHelper.htmlOutputText(model.Description); txtImage.Text = model.Image; txtFeature1.Text = model.Feature1; txtFeature2.Text = model.Feature2; txtFeature3.Text = model.Feature3; txtFeature4.Text = model.Feature4; txtDownloadUrl.Text = model.DownloadUrl; txtDocumentTitle.Text = model.DocumentTitle; txtDocumentDescription.Text = model.DocumentDescription; txtDocumentUrl.Text = model.DocumentUrl; txtHits.Text = DataConvert.GetString(model.Hits); txtDownloads.Text = DataConvert.GetString(model.Downloads); 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 { rdbDisplay0.Checked = true; txtHits.Text = "0"; txtDownloads.Text = "0"; } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { //validation if (!CheckInputEmptyAndLength(txtSoftwareName, "E00901", "E00902", false)) { return; } if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false)) { return; } Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = new Johnny.CMS.OM.SeH.Software(); if (Request.QueryString["action"] == "modify") { //update model.SoftwareId = Convert.ToInt32(Request.QueryString["id"]); model.SoftwareName = txtSoftwareName.Text; model.ShortDescription = txtShortDescription.Text; model.Description = StringHelper.htmlInputText(fckContent.Value); model.Image = txtImage.Text; model.Feature1 = txtFeature1.Text; model.Feature2 = txtFeature2.Text; model.Feature3 = txtFeature3.Text; model.Feature4 = txtFeature4.Text; model.DownloadUrl = txtDownloadUrl.Text; model.DocumentTitle = txtDocumentTitle.Text; model.DocumentDescription = txtDocumentDescription.Text; model.DocumentUrl = txtDocumentUrl.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.Downloads = DataConvert.GetInt32(txtDownloads.Text); model.IsDisplay = rdbDisplay0.Checked; 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.SoftwareName = txtSoftwareName.Text; model.ShortDescription = txtShortDescription.Text; model.Description = StringHelper.htmlInputText(fckContent.Value); model.Image = txtImage.Text; model.Feature1 = txtFeature1.Text; model.Feature2 = txtFeature2.Text; model.Feature3 = txtFeature3.Text; model.Feature4 = txtFeature4.Text; model.DownloadUrl = txtDownloadUrl.Text; model.DocumentTitle = txtDocumentTitle.Text; model.DocumentDescription = txtDocumentDescription.Text; model.DocumentUrl = txtDocumentUrl.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.Downloads = DataConvert.GetInt32(txtDownloads.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")); txtSoftwareName.Text = ""; txtShortDescription.Text = ""; fckContent.Value = ""; txtImage.Text = ""; txtFeature1.Text = ""; txtFeature2.Text = ""; txtFeature3.Text = ""; txtFeature4.Text = ""; txtDownloadUrl.Text = ""; txtDocumentTitle.Text = ""; txtDocumentDescription.Text = ""; txtDocumentUrl.Text = ""; txtHits.Text = "0"; txtDownloads.Text = "0"; rdbDisplay0.Checked = true; 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("Software_Title"); litSoftwareName.Text = GetLabelText("Software_SoftwareName"); txtSoftwareName.ToolTip = GetLabelText("Software_SoftwareName"); litShortDescription.Text = GetLabelText("Software_ShortDescription"); txtShortDescription.ToolTip = GetLabelText("Software_ShortDescription"); litContent.Text = GetLabelText("Software_Description"); litImage.Text = GetLabelText("Software_Image"); txtImage.ToolTip = GetLabelText("Software_Image"); litFeature1.Text = GetLabelText("Software_Feature1"); txtFeature1.ToolTip = GetLabelText("Software_Feature1"); litFeature2.Text = GetLabelText("Software_Feature2"); txtFeature2.ToolTip = GetLabelText("Software_Feature2"); litFeature3.Text = GetLabelText("Software_Feature3"); txtFeature3.ToolTip = GetLabelText("Software_Feature3"); litFeature4.Text = GetLabelText("Software_Feature4"); txtFeature4.ToolTip = GetLabelText("Software_Feature4"); litDownloadUrl.Text = GetLabelText("Software_DownloadUrl"); txtDownloadUrl.ToolTip = GetLabelText("Software_DownloadUrl"); litDocumentTitle.Text = GetLabelText("Software_DocumentTitle"); txtDocumentTitle.ToolTip = GetLabelText("Software_DocumentTitle"); litDocumentDescription.Text = GetLabelText("Software_DocumentDescription"); txtDocumentDescription.ToolTip = GetLabelText("Software_DocumentDescription"); litDocumentUrl.Text = GetLabelText("Software_DocumentUrl"); txtDocumentUrl.ToolTip = GetLabelText("Software_DocumentUrl"); litHits.Text = GetLabelText("Software_Hits"); txtHits.ToolTip = GetLabelText("Software_Hits"); litDownloads.Text = GetLabelText("Software_Downloads"); txtDownloads.ToolTip = GetLabelText("Software_Downloads"); litIsDisplay.Text = GetLabelText("Software_IsDisplay"); rdbDisplay0.Text = GetLabelText("Common_Yes"); rdbDisplay1.Text = GetLabelText("Common_No"); litRdbDisplayTip.Text = GetLabelText("Software_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 id int SoftwareId = Convert.ToInt32(Request.QueryString["id"]); Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = new Johnny.CMS.OM.SeH.Software(); model = bll.GetModel(SoftwareId); txtSoftwareName.Text = model.SoftwareName; txtShortDescription.Text = model.ShortDescription; fckContent.Value = StringHelper.htmlOutputText(model.Description); txtImage.Text = model.Image; txtFeature1.Text = model.Feature1; txtFeature2.Text = model.Feature2; txtFeature3.Text = model.Feature3; txtFeature4.Text = model.Feature4; txtDownloadUrl.Text = model.DownloadUrl; txtDocumentTitle.Text = model.DocumentTitle; txtDocumentDescription.Text = model.DocumentDescription; txtDocumentUrl.Text = model.DocumentUrl; txtHits.Text = DataConvert.GetString(model.Hits); txtDownloads.Text = DataConvert.GetString(model.Downloads); 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 { rdbDisplay0.Checked = true; txtHits.Text = "0"; txtDownloads.Text = "0"; } } }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SeH.Software model) { StringBuilder strSql = new StringBuilder(); strSql.Append("DECLARE @Sequence int"); strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_software]"); strSql.Append(" if @Sequence is NULL"); strSql.Append(" Set @Sequence=1"); strSql.Append("INSERT INTO [seh_software]("); strSql.Append("[SoftwareName],[ShortDescription],[Description],[Image],[Feature1],[Feature2],[Feature3],[Feature4],[DownloadUrl],[DocumentTitle],[DocumentDescription],[DocumentUrl],[Hits],[Downloads],[IsDisplay],[CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName],[Sequence]"); strSql.Append(")"); strSql.Append(" VALUES ("); strSql.Append("@softwarename,@shortdescription,@description,@image,@feature1,@feature2,@feature3,@feature4,@downloadurl,@documenttitle,@documentdescription,@documenturl,@hits,@downloads,@isdisplay,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence"); strSql.Append(")"); strSql.Append(";SELECT @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@softwarename", SqlDbType.VarChar, 200), new SqlParameter("@shortdescription", SqlDbType.VarChar, 500), new SqlParameter("@description", SqlDbType.Text), new SqlParameter("@image", SqlDbType.VarChar, 200), new SqlParameter("@feature1", SqlDbType.VarChar, 100), new SqlParameter("@feature2", SqlDbType.VarChar, 100), new SqlParameter("@feature3", SqlDbType.VarChar, 100), new SqlParameter("@feature4", SqlDbType.VarChar, 100), new SqlParameter("@downloadurl", SqlDbType.VarChar, 500), new SqlParameter("@documenttitle", SqlDbType.VarChar, 100), new SqlParameter("@documentdescription", SqlDbType.VarChar, 500), new SqlParameter("@documenturl", SqlDbType.VarChar, 500), new SqlParameter("@hits", SqlDbType.Int, 4), new SqlParameter("@downloads", SqlDbType.Int, 4), new SqlParameter("@isdisplay", SqlDbType.Bit), new SqlParameter("@createdtime", SqlDbType.DateTime), new SqlParameter("@createdbyid", SqlDbType.Int, 4), new SqlParameter("@createdbyname", SqlDbType.VarChar, 50), new SqlParameter("@updatedtime", SqlDbType.DateTime), new SqlParameter("@updatedbyid", SqlDbType.Int, 4), new SqlParameter("@updatedbyname", SqlDbType.VarChar, 50) }; parameters[0].Value = model.SoftwareName; parameters[1].Value = model.ShortDescription; parameters[2].Value = model.Description; parameters[3].Value = model.Image; parameters[4].Value = model.Feature1; parameters[5].Value = model.Feature2; parameters[6].Value = model.Feature3; parameters[7].Value = model.Feature4; parameters[8].Value = model.DownloadUrl; parameters[9].Value = model.DocumentTitle; parameters[10].Value = model.DocumentDescription; parameters[11].Value = model.DocumentUrl; parameters[12].Value = model.Hits; parameters[13].Value = model.Downloads; parameters[14].Value = model.IsDisplay; parameters[15].Value = model.CreatedTime; parameters[16].Value = model.CreatedById; parameters[17].Value = model.CreatedByName; parameters[18].Value = model.UpdatedTime; parameters[19].Value = model.UpdatedById; parameters[20].Value = model.UpdatedByName; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
protected void btnAdd_Click(object sender, System.EventArgs e) { //validation if (!CheckInputEmptyAndLength(txtSoftwareName, "E00901", "E00902", false)) return; if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false)) return; Johnny.CMS.BLL.SeH.Software bll = new Johnny.CMS.BLL.SeH.Software(); Johnny.CMS.OM.SeH.Software model = new Johnny.CMS.OM.SeH.Software(); if (Request.QueryString["action"] == "modify") { //update model.SoftwareId = Convert.ToInt32(Request.QueryString["id"]); model.SoftwareName = txtSoftwareName.Text; model.ShortDescription = txtShortDescription.Text; model.Description = StringHelper.htmlInputText(fckContent.Value); model.Image = txtImage.Text; model.Feature1 = txtFeature1.Text; model.Feature2 = txtFeature2.Text; model.Feature3 = txtFeature3.Text; model.Feature4 = txtFeature4.Text; model.DownloadUrl = txtDownloadUrl.Text; model.DocumentTitle = txtDocumentTitle.Text; model.DocumentDescription = txtDocumentDescription.Text; model.DocumentUrl = txtDocumentUrl.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.Downloads = DataConvert.GetInt32(txtDownloads.Text); model.IsDisplay = rdbDisplay0.Checked; 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.SoftwareName = txtSoftwareName.Text; model.ShortDescription = txtShortDescription.Text; model.Description = StringHelper.htmlInputText(fckContent.Value); model.Image = txtImage.Text; model.Feature1 = txtFeature1.Text; model.Feature2 = txtFeature2.Text; model.Feature3 = txtFeature3.Text; model.Feature4 = txtFeature4.Text; model.DownloadUrl = txtDownloadUrl.Text; model.DocumentTitle = txtDocumentTitle.Text; model.DocumentDescription = txtDocumentDescription.Text; model.DocumentUrl = txtDocumentUrl.Text; model.Hits = DataConvert.GetInt32(txtHits.Text); model.Downloads = DataConvert.GetInt32(txtDownloads.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")); txtSoftwareName.Text = ""; txtShortDescription.Text = ""; fckContent.Value = ""; txtImage.Text = ""; txtFeature1.Text = ""; txtFeature2.Text = ""; txtFeature3.Text = ""; txtFeature4.Text = ""; txtDownloadUrl.Text = ""; txtDocumentTitle.Text = ""; txtDocumentDescription.Text = ""; txtDocumentUrl.Text = ""; txtHits.Text = "0"; txtDownloads.Text = "0"; rdbDisplay0.Checked = true; lblCreatedTime.Text = ""; lblCreatedByName.Text = ""; lblUpdatedTime.Text = ""; lblUpdatedByName.Text = ""; } else SetMessage(GetMessage("C00002")); } }
/// <summary> /// Update one record /// </summary> public void Update(Johnny.CMS.OM.SeH.Software model) { dal.Update(model); }
/// <summary> /// Add one record /// </summary> public int Add(Johnny.CMS.OM.SeH.Software model) { return(dal.Add(model)); }