예제 #1
0
 private void ShowInfo(int MeterID)
 {
     WebDemo.BLL.WebDemo.ActivityValveInfo   bll   = new WebDemo.BLL.WebDemo.ActivityValveInfo();
     WebDemo.Model.WebDemo.ActivityValveInfo model = bll.GetModel(MeterID);
     this.lblMeterID.Text           = model.MeterID.ToString();
     this.lblValveStatusBefore.Text = model.ValveStatusBefore.ToString();
     this.lblValveStatusAfter.Text  = model.ValveStatusAfter.ToString();
     this.lblOperTime.Text          = model.OperTime.ToString();
     this.lblOperFlag.Text          = model.OperFlag;
 }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMeterID.Text))
            {
                strErr += "MeterID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtValveStatusBefore.Text))
            {
                strErr += "ValveStatusBefore格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtValveStatusAfter.Text))
            {
                strErr += "ValveStatusAfter格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtOperTime.Text))
            {
                strErr += "OperTime格式错误!\\n";
            }
            if (this.txtOperFlag.Text.Trim().Length == 0)
            {
                strErr += "OperFlag不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      MeterID           = int.Parse(this.txtMeterID.Text);
            int      ValveStatusBefore = int.Parse(this.txtValveStatusBefore.Text);
            int      ValveStatusAfter  = int.Parse(this.txtValveStatusAfter.Text);
            DateTime OperTime          = DateTime.Parse(this.txtOperTime.Text);
            string   OperFlag          = this.txtOperFlag.Text;

            WebDemo.Model.WebDemo.ActivityValveInfo model = new WebDemo.Model.WebDemo.ActivityValveInfo();
            model.MeterID           = MeterID;
            model.ValveStatusBefore = ValveStatusBefore;
            model.ValveStatusAfter  = ValveStatusAfter;
            model.OperTime          = OperTime;
            model.OperFlag          = OperFlag;

            WebDemo.BLL.WebDemo.ActivityValveInfo bll = new WebDemo.BLL.WebDemo.ActivityValveInfo();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }