private void ShowInfo(int ID) { WebDemo.BLL.WebDemo.RemnantTbl bll = new WebDemo.BLL.WebDemo.RemnantTbl(); WebDemo.Model.WebDemo.RemnantTbl model = bll.GetModel(ID); this.lblID.Text = model.ID.ToString(); this.lblMeterID.Text = model.MeterID.ToString(); this.lblRemnant.Text = model.Remnant.ToString(); this.lblReadDate.Text = model.ReadDate.ToString(); this.lblCollectorReadDate.Text = model.CollectorReadDate.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtMeterID.Text)) { strErr += "MeterID格式错误!\\n"; } if (!PageValidate.IsDecimal(txtRemnant.Text)) { strErr += "Remnant格式错误!\\n"; } if (!PageValidate.IsDateTime(txtReadDate.Text)) { strErr += "ReadDate格式错误!\\n"; } if (!PageValidate.IsDateTime(txtCollectorReadDate.Text)) { strErr += "CollectorReadDate格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int MeterID = int.Parse(this.txtMeterID.Text); decimal Remnant = decimal.Parse(this.txtRemnant.Text); DateTime ReadDate = DateTime.Parse(this.txtReadDate.Text); DateTime CollectorReadDate = DateTime.Parse(this.txtCollectorReadDate.Text); WebDemo.Model.WebDemo.RemnantTbl model = new WebDemo.Model.WebDemo.RemnantTbl(); model.MeterID = MeterID; model.Remnant = Remnant; model.ReadDate = ReadDate; model.CollectorReadDate = CollectorReadDate; WebDemo.BLL.WebDemo.RemnantTbl bll = new WebDemo.BLL.WebDemo.RemnantTbl(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }