protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtYear.Text)) { strErr += "Year格式错误!\\n"; } if (!PageValidate.IsDateTime(txtStartDate.Text)) { strErr += "StartDate格式错误!\\n"; } if (!PageValidate.IsDateTime(txtEndDate.Text)) { strErr += "EndDate格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Year = int.Parse(this.txtYear.Text); DateTime StartDate = DateTime.Parse(this.txtStartDate.Text); DateTime EndDate = DateTime.Parse(this.txtEndDate.Text); WebDemo.Model.WebDemo.HeatingCycle model = new WebDemo.Model.WebDemo.HeatingCycle(); model.Year = Year; model.StartDate = StartDate; model.EndDate = EndDate; WebDemo.BLL.WebDemo.HeatingCycle bll = new WebDemo.BLL.WebDemo.HeatingCycle(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int ID) { WebDemo.BLL.WebDemo.HeatingCycle bll = new WebDemo.BLL.WebDemo.HeatingCycle(); WebDemo.Model.WebDemo.HeatingCycle model = bll.GetModel(ID); this.lblID.Text = model.ID.ToString(); this.txtYear.Text = model.Year.ToString(); this.txtStartDate.Text = model.StartDate.ToString(); this.txtEndDate.Text = model.EndDate.ToString(); }