Пример #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMeterID.Text))
            {
                strErr += "MeterID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtBookIDBefore.Text))
            {
                strErr += "BookIDBefore格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtBookNumBefore.Text))
            {
                strErr += "BookNumBefore格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtBookIDAfter.Text))
            {
                strErr += "BookIDAfter格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtBookNumAfter.Text))
            {
                strErr += "BookNumAfter格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtOperTime.Text))
            {
                strErr += "OperTime格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ID            = int.Parse(this.lblID.Text);
            int      MeterID       = int.Parse(this.txtMeterID.Text);
            int      BookIDBefore  = int.Parse(this.txtBookIDBefore.Text);
            int      BookNumBefore = int.Parse(this.txtBookNumBefore.Text);
            int      BookIDAfter   = int.Parse(this.txtBookIDAfter.Text);
            int      BookNumAfter  = int.Parse(this.txtBookNumAfter.Text);
            DateTime OperTime      = DateTime.Parse(this.txtOperTime.Text);


            WebDemo.Model.WebDemo.SwitchBookLog model = new WebDemo.Model.WebDemo.SwitchBookLog();
            model.ID            = ID;
            model.MeterID       = MeterID;
            model.BookIDBefore  = BookIDBefore;
            model.BookNumBefore = BookNumBefore;
            model.BookIDAfter   = BookIDAfter;
            model.BookNumAfter  = BookNumAfter;
            model.OperTime      = OperTime;

            WebDemo.BLL.WebDemo.SwitchBookLog bll = new WebDemo.BLL.WebDemo.SwitchBookLog();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Пример #2
0
 private void ShowInfo(int ID)
 {
     WebDemo.BLL.WebDemo.SwitchBookLog   bll   = new WebDemo.BLL.WebDemo.SwitchBookLog();
     WebDemo.Model.WebDemo.SwitchBookLog model = bll.GetModel(ID);
     this.lblID.Text            = model.ID.ToString();
     this.lblMeterID.Text       = model.MeterID.ToString();
     this.lblBookIDBefore.Text  = model.BookIDBefore.ToString();
     this.lblBookNumBefore.Text = model.BookNumBefore.ToString();
     this.lblBookIDAfter.Text   = model.BookIDAfter.ToString();
     this.lblBookNumAfter.Text  = model.BookNumAfter.ToString();
     this.lblOperTime.Text      = model.OperTime.ToString();
 }