private void ShowInfo(int id) { Maticsoft.BLL.phototab bll = new Maticsoft.BLL.phototab(); Maticsoft.Model.phototab model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.lblPhotourl.Text = model.Photourl; this.lblbeizhu.Text = model.beizhu; this.lblBy1.Text = model.By1.ToString(); this.lblBy2.Text = model.By2.ToString(); this.lblBy3.Text = model.By3.ToString(); this.lblBy4.Text = model.By4; this.lblBy5.Text = model.By5; this.lblBy6.Text = model.By6; this.lblBy7.Text = model.By7; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtPhotourl.Text.Trim().Length == 0) { strErr += "Photourl不能为空!\\n"; } if (this.txtbeizhu.Text.Trim().Length == 0) { strErr += "beizhu不能为空!\\n"; } if (!PageValidate.IsDecimal(txtBy1.Text)) { strErr += "By1格式错误!\\n"; } if (!PageValidate.IsDecimal(txtBy2.Text)) { strErr += "By2格式错误!\\n"; } if (!PageValidate.IsDecimal(txtBy3.Text)) { strErr += "By3格式错误!\\n"; } if (this.txtBy4.Text.Trim().Length == 0) { strErr += "By4不能为空!\\n"; } if (this.txtBy5.Text.Trim().Length == 0) { strErr += "By5不能为空!\\n"; } if (this.txtBy6.Text.Trim().Length == 0) { strErr += "By6不能为空!\\n"; } if (this.txtBy7.Text.Trim().Length == 0) { strErr += "By7不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string Photourl = this.txtPhotourl.Text; string beizhu = this.txtbeizhu.Text; decimal By1 = decimal.Parse(this.txtBy1.Text); decimal By2 = decimal.Parse(this.txtBy2.Text); decimal By3 = decimal.Parse(this.txtBy3.Text); string By4 = this.txtBy4.Text; string By5 = this.txtBy5.Text; string By6 = this.txtBy6.Text; string By7 = this.txtBy7.Text; Maticsoft.Model.phototab model = new Maticsoft.Model.phototab(); model.Photourl = Photourl; model.beizhu = beizhu; model.By1 = By1; model.By2 = By2; model.By3 = By3; model.By4 = By4; model.By5 = By5; model.By6 = By6; model.By7 = By7; Maticsoft.BLL.phototab bll = new Maticsoft.BLL.phototab(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }