private void ShowInfo(int WebSiteID) { WebSiteData.WebSite bll = new WebSiteData.WebSite(); WebSiteModel.WebSite model = bll.GetModel(WebSiteID); this.lblWebSiteID.Text = model.WebSiteID.ToString(); this.txtWebSiteName.Text = model.WebSiteName; ddlWebStatus.SelectedValue = model.WebStatusID.ToString(); ddlPartner.SelectedValue = model.PartnerID.ToString(); ddlWebSiteType.SelectedValue = model.WebSiteType; this.txtBackground.Text = model.Background; ddBrands.SelectedValue = model.BrandsID.ToString(); this.txtTemplate.Text = model.Template; this.txtTemplatePic.Text = model.TemplatePic; this.txtLanguage.Text = model.Language; //设置radio的值 this.txtOwner.SelectedValue = model.Owner.ToString(); this.txtServer.Text = model.Server; this.txtIPAddress.Text = model.IPAddress; this.txtPayment.Value = model.Payment; //this.txtIseffective.Text = model.Iseffective.ToString(); this.txtProgramsType.Text = model.ProgramsType; //this.txtSortIndex.Text = model.SortIndex.ToString(); //this.txtIshidden.Text = model.Ishidden.ToString(); this.txtAddDate.Text = model.AddDate.ToString(); this.txtOfflineDate.Text = model.OfflineDate.ToString(); this.txtRemark.Value = model.Remark; }
private bool DoEdit(int id) { bool result = true; WebSiteData.WebSite bll = new WebSiteData.WebSite(); //先获取在修改,这样就会覆盖掉model本身的默认字段值,因为有些字段值在编辑页面没有显示 WebSiteModel.WebSite model = bll.GetModel(id); int WebSiteID = id; string WebSiteName = this.txtWebSiteName.Text; int WebStatusID = int.Parse(ddlWebStatus.SelectedValue); int PartnerID = int.Parse(ddlPartner.SelectedValue); string WebSiteType = ddlWebSiteType.SelectedValue; string Background = this.txtBackground.Text; int BrandsID = int.Parse(ddBrands.SelectedValue); string Template = this.txtTemplate.Text; string TemplatePic = this.txtTemplatePic.Text; string Language = this.txtLanguage.Text; int Owner = 0; if (this.txtOwner.SelectedValue == "1") { Owner = 1; } string Server = this.txtServer.Text; string IPAddress = this.txtIPAddress.Text; string Payment = this.txtPayment.Value; //int Iseffective = int.Parse(this.txtIseffective.Text); string ProgramsType = this.txtProgramsType.Text; //int SortIndex = int.Parse(this.txtSortIndex.Text); //int Ishidden = int.Parse(this.txtIshidden.Text); DateTime AddDate; if (Maticsoft.Common.PageValidate.IsDateTime(this.txtAddDate.Text)) { AddDate = DateTime.Parse(this.txtAddDate.Text); } else { AddDate = DateTime.Now; } DateTime OfflineDate; if (Maticsoft.Common.PageValidate.IsDateTime(this.txtOfflineDate.Text)) { OfflineDate = DateTime.Parse(this.txtOfflineDate.Text); } else { OfflineDate = DateTime.Now; } string Remark = this.txtRemark.Value; model.WebSiteID = WebSiteID; model.WebSiteName = WebSiteName; model.WebStatusID = WebStatusID; model.PartnerID = PartnerID; model.WebSiteType = WebSiteType; model.Background = Background; model.BrandsID = BrandsID; model.Template = Template; model.TemplatePic = TemplatePic; model.Language = Language; model.Owner = Owner; model.Server = Server; model.IPAddress = IPAddress; model.Payment = Payment; //model.Iseffective = Iseffective; model.ProgramsType = ProgramsType; //model.SortIndex = SortIndex; //model.Ishidden = Ishidden; model.AddDate = AddDate; model.OfflineDate = OfflineDate; model.Remark = Remark; if (!bll.Update(model)) { result = false; } return(result); }