コード例 #1
0
ファイル: Show.aspx.cs プロジェクト: MrwycHub/WebDemo
 private void ShowInfo(int id)
 {
     WebDemo.BLL.WebDemo.FreezeMonthDosage   bll   = new WebDemo.BLL.WebDemo.FreezeMonthDosage();
     WebDemo.Model.WebDemo.FreezeMonthDosage model = bll.GetModel(id);
     this.lblid.Text                = model.id.ToString();
     this.lblMeterID.Text           = model.MeterID.ToString();
     this.lblBeginMonth.Text        = model.BeginMonth;
     this.lblBeginNumber.Text       = model.BeginNumber.ToString();
     this.lblFreezeMonth.Text       = model.FreezeMonth;
     this.lblEndNumber.Text         = model.EndNumber.ToString();
     this.lblUseNumber.Text         = model.UseNumber.ToString();
     this.lblInsertDate.Text        = model.InsertDate.ToString();
     this.lblUseActiveSharp.Text    = model.UseActiveSharp.ToString();
     this.lblUseActivePeak.Text     = model.UseActivePeak.ToString();
     this.lblUseActiveShoulder.Text = model.UseActiveShoulder.ToString();
     this.lblUseActiveOffPeak.Text  = model.UseActiveOffPeak.ToString();
     this.lblSyncFlag.Text          = model.SyncFlag.ToString();
 }
コード例 #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtBeginMonth.Text.Trim().Length == 0)
            {
                strErr += "BeginMonth不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtBeginNumber.Text))
            {
                strErr += "BeginNumber格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtEndNumber.Text))
            {
                strErr += "EndNumber格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseNumber.Text))
            {
                strErr += "UseNumber格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtInsertDate.Text))
            {
                strErr += "InsertDate格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseActiveSharp.Text))
            {
                strErr += "UseActiveSharp格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseActivePeak.Text))
            {
                strErr += "UseActivePeak格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseActiveShoulder.Text))
            {
                strErr += "UseActiveShoulder格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseActiveOffPeak.Text))
            {
                strErr += "UseActiveOffPeak格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtSyncFlag.Text))
            {
                strErr += "SyncFlag格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      id                = int.Parse(this.lblid.Text);
            int      MeterID           = int.Parse(this.lblMeterID.Text);
            string   BeginMonth        = this.txtBeginMonth.Text;
            decimal  BeginNumber       = decimal.Parse(this.txtBeginNumber.Text);
            string   FreezeMonth       = this.lblFreezeMonth.Text;
            decimal  EndNumber         = decimal.Parse(this.txtEndNumber.Text);
            decimal  UseNumber         = decimal.Parse(this.txtUseNumber.Text);
            DateTime InsertDate        = DateTime.Parse(this.txtInsertDate.Text);
            decimal  UseActiveSharp    = decimal.Parse(this.txtUseActiveSharp.Text);
            decimal  UseActivePeak     = decimal.Parse(this.txtUseActivePeak.Text);
            decimal  UseActiveShoulder = decimal.Parse(this.txtUseActiveShoulder.Text);
            decimal  UseActiveOffPeak  = decimal.Parse(this.txtUseActiveOffPeak.Text);
            int      SyncFlag          = int.Parse(this.txtSyncFlag.Text);


            WebDemo.Model.WebDemo.FreezeMonthDosage model = new WebDemo.Model.WebDemo.FreezeMonthDosage();
            model.id                = id;
            model.MeterID           = MeterID;
            model.BeginMonth        = BeginMonth;
            model.BeginNumber       = BeginNumber;
            model.FreezeMonth       = FreezeMonth;
            model.EndNumber         = EndNumber;
            model.UseNumber         = UseNumber;
            model.InsertDate        = InsertDate;
            model.UseActiveSharp    = UseActiveSharp;
            model.UseActivePeak     = UseActivePeak;
            model.UseActiveShoulder = UseActiveShoulder;
            model.UseActiveOffPeak  = UseActiveOffPeak;
            model.SyncFlag          = SyncFlag;

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