Exemplo n.º 1
0
 private void ShowInfo(int ID)
 {
     WebDemo.BLL.WebDemo.BlockUpInfo   bll   = new WebDemo.BLL.WebDemo.BlockUpInfo();
     WebDemo.Model.WebDemo.BlockUpInfo model = bll.GetModel(ID);
     this.lblID.Text         = model.ID.ToString();
     this.lblMeterID.Text    = model.MeterID.ToString();
     this.lblStopYear.Text   = model.StopYear.ToString();
     this.lblOperDate.Text   = model.OperDate.ToString();
     this.lblStopReason.Text = model.StopReason;
     this.lblOperatorID.Text = model.OperatorID.ToString();
 }
Exemplo n.º 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMeterID.Text))
            {
                strErr += "MeterID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStopYear.Text))
            {
                strErr += "StopYear格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtOperDate.Text))
            {
                strErr += "OperDate格式错误!\\n";
            }
            if (this.txtStopReason.Text.Trim().Length == 0)
            {
                strErr += "StopReason不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtOperatorID.Text))
            {
                strErr += "OperatorID格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ID         = int.Parse(this.lblID.Text);
            int      MeterID    = int.Parse(this.txtMeterID.Text);
            int      StopYear   = int.Parse(this.txtStopYear.Text);
            DateTime OperDate   = DateTime.Parse(this.txtOperDate.Text);
            string   StopReason = this.txtStopReason.Text;
            int      OperatorID = int.Parse(this.txtOperatorID.Text);


            WebDemo.Model.WebDemo.BlockUpInfo model = new WebDemo.Model.WebDemo.BlockUpInfo();
            model.ID         = ID;
            model.MeterID    = MeterID;
            model.StopYear   = StopYear;
            model.OperDate   = OperDate;
            model.StopReason = StopReason;
            model.OperatorID = OperatorID;

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