protected void Page_Load(object sender, EventArgs e) { if (Page.User.Identity.Name == "") { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { try { Tz888.SQLServerDAL.TPMerchant objtp = new Tz888.SQLServerDAL.TPMerchant(); string infoid = Request.QueryString["id"].ToString(); DataSet ds = objtp.GetOneNewsList(infoid); this.txtTitle.Value = ds.Tables[0].Rows[0]["Title"].ToString(); this.txtContent.Value = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["Content"].ToString()); this.txtInstruction.Value = ds.Tables[0].Rows[0]["PicAbout"].ToString(); this.txtSource.Value = ds.Tables[0].Rows[0]["Origin"].ToString(); ZoneSelectControl1.ProvinceID = ds.Tables[0].Rows[0]["ProvinceID"].ToString().Trim(); ZoneSelectControl1.CityID = ds.Tables[0].Rows[0]["CityID"].ToString().Trim(); ZoneSelectControl1.CountyID = ds.Tables[0].Rows[0]["CountyID"].ToString().Trim(); string strNewsType = "radioType" + ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim(); ViewState["NewsType"] = ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim(); System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.tbNews.FindControl(strNewsType); if (obj != null) { obj.Checked = true; } } catch { Response.Write("<script>alert('请重新选择要修改的数据!');window.close();</script>"); } } }
protected void btnOK_Click(object sender, EventArgs e) { Tz888.Model.TPMerchant TPMerchantModel = new Tz888.Model.TPMerchant(); TPMerchantModel.infoID = Convert.ToInt64(Request.QueryString["id"].ToString()); TPMerchantModel.NewsTypeID = ViewState["NewsType"].ToString(); TPMerchantModel.publishT = System.DateTime.Now; TPMerchantModel.KeyWord = ""; TPMerchantModel.Descript = ""; TPMerchantModel.DisplayTitle = ""; TPMerchantModel.HtmlFile = ""; TPMerchantModel.Hit = 0; TPMerchantModel.Title = this.txtTitle.Value.Trim(); TPMerchantModel.LoginName = Page.User.Identity.Name.ToString(); TPMerchantModel.Author = ""; TPMerchantModel.IsCore = 0; TPMerchantModel.Origin = this.txtSource.Value.Trim(); TPMerchantModel.Content = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtContent.Value.Trim()); TPMerchantModel.Pic1 = Convert.ToString(ViewState["strSavePath"]); TPMerchantModel.PicAbout = this.txtInstruction.Value.Trim(); TPMerchantModel.ProvinceID = this.ZoneSelectControl1.ProvinceID.Trim(); TPMerchantModel.CityID = this.ZoneSelectControl1.CityID.Trim(); TPMerchantModel.CountyID = this.ZoneSelectControl1.CountyID.Trim(); TPMerchantModel.IsRedirect = 0; TPMerchantModel.NewsLblStatus = ""; TPMerchantModel.NewsIndustryID = "*"; TPMerchantModel.PageCharCount = 0; TPMerchantModel.RedirectUrl = ""; TPMerchantModel.ResearchSpot = ""; TPMerchantModel.strRemark = ""; TPMerchantModel.Summary = ""; TPMerchantModel.subTitle = this.txtTitle.Value.Trim(); TPMerchantModel.ShortTitle = this.txtTitle.Value.Trim(); TPMerchantModel.ShortContent = ""; if (this.txtContent.Value.Trim().Length > 100) { TPMerchantModel.ShortContent = this.txtContent.Value.Trim().Substring(0, 100); } TPMerchantModel.PageStatus = 0; TPMerchantModel.ShortInfoControlID = ""; TPMerchantModel.InfoCode = "ZSNEWS"; TPMerchantModel.auditingstatus = 0; TPMerchantModel.AuditingRemark = ""; Tz888.SQLServerDAL.TPMerchant tpm = new Tz888.SQLServerDAL.TPMerchant(); bool infoID = tpm.UpdateMerchantNews(TPMerchantModel); if (infoID == true) { Response.Write("<script>alert('更新成功!');window.close();</script>"); } else { RegisterStartupScript("alertMessage", "<script>alert('更新失败!'); </script>"); } }
private void GetNewsType() { Tz888.SQLServerDAL.TPMerchant Newsobj = new Tz888.SQLServerDAL.TPMerchant(); DataSet ds = Newsobj.GetNewsType(); this.ddlType.DataSource = ds; this.ddlType.DataBind(); ListItem li = new ListItem(); li = new ListItem("资讯类型", "资讯类型"); ddlType.Items.Add(li); ddlType.Items[ddlType.Items.Count - 1].Selected = true; }
protected void btnOK_Click(object sender, EventArgs e) { if (this.hidradioType.Value != "67") { Tz888.Model.TPMerchant TPMerchantModel = new Tz888.Model.TPMerchant(); TPMerchantModel.infoID = 0; TPMerchantModel.NewsTypeID = this.hidradioType.Value.Trim(); TPMerchantModel.Title = this.txtTitle.Value.Trim(); //标题 TPMerchantModel.KeyWord = ""; TPMerchantModel.Descript = ""; TPMerchantModel.publishT = System.DateTime.Now; //时间 TPMerchantModel.Hit = 0; TPMerchantModel.LoginName = "262734254"; // Page.User.Identity.Name.ToString(); TPMerchantModel.Author = ""; TPMerchantModel.Origin = this.txtSource.Value.Trim(); //来源 TPMerchantModel.Content = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtContent.Value.Trim()); //正文 TPMerchantModel.Pic1 = Convert.ToString(ViewState["strSavePath"]); TPMerchantModel.PicAbout = this.txtInstruction.Value.Trim(); //图片说明 TPMerchantModel.ProvinceID = this.ZoneSelectControl1.ProvinceID.Trim(); TPMerchantModel.CityID = this.ZoneSelectControl1.CityID.Trim(); TPMerchantModel.CountyID = this.ZoneSelectControl1.CountyID.Trim(); TPMerchantModel.IsRedirect = 0; TPMerchantModel.NewsLblStatus = ""; TPMerchantModel.NewsIndustryID = "*"; TPMerchantModel.PageCharCount = 0; TPMerchantModel.RedirectUrl = ""; TPMerchantModel.ResearchSpot = ""; TPMerchantModel.strRemark = ""; TPMerchantModel.Summary = ""; TPMerchantModel.subTitle = this.txtTitle.Value.Trim(); //标题 TPMerchantModel.ShortTitle = this.txtTitle.Value.Trim(); //标题 TPMerchantModel.ShortContent = ""; if (this.txtContent.Value.Trim().Length > 100) { TPMerchantModel.ShortContent = this.txtContent.Value.Trim().Substring(0, 100); } TPMerchantModel.PageStatus = 0; TPMerchantModel.ShortInfoControlID = ""; TPMerchantModel.IsCore = 0; TPMerchantModel.InfoCode = "ZSNEWS"; TPMerchantModel.auditingstatus = 0; Tz888.SQLServerDAL.TPMerchant tpm = new Tz888.SQLServerDAL.TPMerchant(); bool infoID = tpm.InsertMerchantNews(TPMerchantModel); if (infoID == true) { RegisterStartupScript("alertMessage", "<script>alert('发布成功!'); </script>"); //Response.Redirect("NewsSuccess.aspx"); } else { RegisterStartupScript("alertMessage", "<script>alert('发布失败!'); </script>"); } } else { Tz888.Model.TPMerchant TPMerchantModel = new Tz888.Model.TPMerchant(); TPMerchantModel.infoID = 0; TPMerchantModel.NewsTypeID = this.hidradioType.Value.Trim(); TPMerchantModel.Title = this.txtName.Value.Trim(); TPMerchantModel.publishT = System.DateTime.Now; TPMerchantModel.Hit = 0; TPMerchantModel.KeyWord = ""; TPMerchantModel.Descript = ""; TPMerchantModel.LoginName = Page.User.Identity.Name.ToString(); TPMerchantModel.Author = ""; TPMerchantModel.Origin = ""; TPMerchantModel.Content = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtContent2.Value.Trim()); TPMerchantModel.Pic1 = Convert.ToString(ViewState["strSavePath"]); TPMerchantModel.PicAbout = this.txtRemarks.Value.Trim(); TPMerchantModel.ProvinceID = this.ZoneSelectControl1.ProvinceID.Trim(); TPMerchantModel.CityID = this.ZoneSelectControl1.CityID.Trim(); TPMerchantModel.CountyID = this.ZoneSelectControl1.CountyID.Trim(); TPMerchantModel.IsRedirect = 0; TPMerchantModel.NewsLblStatus = ""; TPMerchantModel.NewsIndustryID = "*"; TPMerchantModel.PageCharCount = 0; TPMerchantModel.RedirectUrl = ""; TPMerchantModel.ResearchSpot = ""; TPMerchantModel.strRemark = ""; TPMerchantModel.Summary = ""; TPMerchantModel.subTitle = this.txtName.Value.Trim(); TPMerchantModel.ShortTitle = this.txtName.Value.Trim(); TPMerchantModel.ShortContent = ""; if (this.txtContent.Value.Trim().Length > 100) { TPMerchantModel.ShortContent = this.txtContent.Value.Trim().Substring(0, 100); } TPMerchantModel.PageStatus = 0; TPMerchantModel.ShortInfoControlID = ""; TPMerchantModel.activeAdress = this.txtAddress.Value.Trim(); TPMerchantModel.activeDateFrom = this.stime.Value.Trim(); TPMerchantModel.activeDateTo = ""; TPMerchantModel.mainUnit = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtHostUnit.Value.Trim()); TPMerchantModel.secondUnit = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtHandleUnit.Value.Trim()); TPMerchantModel.OrganizationName = ""; TPMerchantModel.Name = this.txtNam.Value.Trim() + " " + this.txtNam1.Value.Trim() + " " + this.txtNam2.Value.Trim() + " " + this.txtNam3.Value.Trim() + " " + this.txtNam4.Value.Trim() + " " + this.txtNam5.Value.Trim(); TPMerchantModel.Mobile = this.txtPhone.Value.Trim() + " " + this.txtPhone1.Value.Trim() + " " + this.txtPhone2.Value.Trim() + " " + this.txtPhone3.Value.Trim() + " " + this.txtPhone4.Value.Trim() + " " + this.txtPhone5.Value.Trim(); TPMerchantModel.TelCountryCode = this.txtPhoneCountryCode.Value.Trim(); TPMerchantModel.TelStateCode = this.txtPhoneCityCode.Value.Trim(); TPMerchantModel.TelNum = this.txtPhoneNum.Value.Trim(); TPMerchantModel.FaxCountryCode = this.txtFaxCountryCode.Value.Trim(); TPMerchantModel.FaxStateCode = this.txtFaxCityCode.Value.Trim(); TPMerchantModel.FaxNum = this.txtFaxNum.Value.Trim(); TPMerchantModel.address = this.txtAddres.Value.Trim(); TPMerchantModel.WebSite = this.txtNet.Value.Trim(); TPMerchantModel.PostCode = this.txtZipCode.Value.Trim(); TPMerchantModel.Email = this.txtEmail.Value.Trim(); TPMerchantModel.IsCore = 0; TPMerchantModel.auditingstatus = 0; Tz888.SQLServerDAL.TPMerchant tpm = new Tz888.SQLServerDAL.TPMerchant(); bool infoID = tpm.InsertMerchantActiveNews(TPMerchantModel); if (infoID == true) { RegisterStartupScript("alertMessage", "<script>alert('发布成功!'); </script>"); //Response.Redirect("NewsSuccess.aspx"); } else { RegisterStartupScript("alertMessage", "<script>alert('发布失败!'); </script>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.User.Identity.Name == "") { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { ViewState["strSavePath"] = ""; try { Tz888.SQLServerDAL.TPMerchant objtp = new Tz888.SQLServerDAL.TPMerchant(); string infoid = Request.QueryString["id"].ToString(); DataSet ds = objtp.GetOneNewsList(infoid); this.txtName.Value = ds.Tables[0].Rows[0]["Title"].ToString(); this.txtAddress.Value = ds.Tables[0].Rows[0]["activeAdress"].ToString(); this.stime.Value = ds.Tables[0].Rows[0]["activeDateFrom"].ToString(); this.txtRemarks.Value = ds.Tables[0].Rows[0]["DesCript"].ToString(); this.txtHostUnit.Value = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["mainUnit"].ToString()); this.txtHandleUnit.Value = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["secondUnit"].ToString()); this.txtRemarks.Value = ds.Tables[0].Rows[0]["picAbout"].ToString(); string strName = ds.Tables[0].Rows[0]["Name"].ToString(); string strMobile = ds.Tables[0].Rows[0]["Mobile"].ToString(); string[] strnam = strName.Split(' '); string[] strmob = strMobile.Split(' '); this.txtNam.Value = strnam[0].ToString(); this.txtPhone.Value = strmob[0].ToString(); if (strnam.Length > 1) { this.txtNam1.Value = strnam[1].ToString(); this.txtPhone1.Value = strmob[1].ToString(); } if (strnam.Length > 2) { this.txtNam2.Value = strnam[2].ToString(); this.txtPhone2.Value = strmob[2].ToString(); } if (strnam.Length > 3) { this.txtNam3.Value = strnam[3].ToString(); this.txtPhone3.Value = strmob[3].ToString(); } if (strnam.Length > 4) { this.txtNam4.Value = strnam[4].ToString(); this.txtPhone4.Value = strmob[4].ToString(); } if (strnam.Length > 5) { this.txtNam5.Value = strnam[5].ToString(); this.txtPhone5.Value = strmob[5].ToString(); } ZoneSelectControl1.ProvinceID = ds.Tables[0].Rows[0]["ProvinceID"].ToString().Trim(); ZoneSelectControl1.CityID = ds.Tables[0].Rows[0]["CityID"].ToString().Trim(); ZoneSelectControl1.CountyID = ds.Tables[0].Rows[0]["CountyID"].ToString().Trim(); this.txtZipCode.Value = ds.Tables[0].Rows[0]["PostCode"].ToString(); this.txtAddres.Value = ds.Tables[0].Rows[0]["address"].ToString(); this.txtEmail.Value = ds.Tables[0].Rows[0]["Email"].ToString(); this.txtNet.Value = ds.Tables[0].Rows[0]["WebSite"].ToString(); this.txtContent.Value = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["Content"].ToString()); this.txtPhoneCountryCode.Value = ds.Tables[0].Rows[0]["TelCountryCode"].ToString().Trim(); this.txtPhoneCityCode.Value = ds.Tables[0].Rows[0]["TelStateCode"].ToString().Trim(); this.txtPhoneNum.Value = ds.Tables[0].Rows[0]["TelNum"].ToString().Trim(); this.txtFaxCountryCode.Value = ds.Tables[0].Rows[0]["FaxCountryCode"].ToString().Trim(); this.txtFaxCityCode.Value = ds.Tables[0].Rows[0]["FaxStateCode"].ToString().Trim(); this.txtFaxNum.Value = ds.Tables[0].Rows[0]["FaxNum"].ToString().Trim(); string strNewsType = "radioType" + ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim(); ViewState["NewsType"] = ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim(); string strIsPage = "radPage" + ds.Tables[0].Rows[0]["pagestatus"].ToString().Trim(); string strAuditingStatus = "radAuditingStatus" + ds.Tables[0].Rows[0]["AuditingStatus"].ToString().Trim(); System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl(strNewsType); if (obj != null) { obj.Checked = true; } System.Web.UI.HtmlControls.HtmlInputRadioButton obj1 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl(strIsPage); if (obj1 != null) { obj1.Checked = true; } System.Web.UI.HtmlControls.HtmlInputRadioButton obj2 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl(strAuditingStatus); if (obj2 != null) { obj2.Checked = true; } } catch (Exception ex) { Response.Write("<script>alert('请重新选择要修改的数据!');window.close();</script>"); } } btnOK.Attributes.Add("onclick", "return chkInput();"); }