Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMeterId.Text))
            {
                strErr += "MeterId格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtCameraNo.Text))
            {
                strErr += "CameraNo格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtCutLocationX.Text))
            {
                strErr += "CutLocationX格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtCutLocationY.Text))
            {
                strErr += "CutLocationY格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtCutWidth.Text))
            {
                strErr += "CutWidth格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtCutHeight.Text))
            {
                strErr += "CutHeight格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastOperDate.Text))
            {
                strErr += "LastOperDate格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      MeterId      = int.Parse(this.txtMeterId.Text);
            int      CameraNo     = int.Parse(this.txtCameraNo.Text);
            int      CutLocationX = int.Parse(this.txtCutLocationX.Text);
            int      CutLocationY = int.Parse(this.txtCutLocationY.Text);
            int      CutWidth     = int.Parse(this.txtCutWidth.Text);
            int      CutHeight    = int.Parse(this.txtCutHeight.Text);
            DateTime LastOperDate = DateTime.Parse(this.txtLastOperDate.Text);

            WebDemo.Model.WebDemo.MeterImageCutArea model = new WebDemo.Model.WebDemo.MeterImageCutArea();
            model.MeterId      = MeterId;
            model.CameraNo     = CameraNo;
            model.CutLocationX = CutLocationX;
            model.CutLocationY = CutLocationY;
            model.CutWidth     = CutWidth;
            model.CutHeight    = CutHeight;
            model.LastOperDate = LastOperDate;

            WebDemo.BLL.WebDemo.MeterImageCutArea bll = new WebDemo.BLL.WebDemo.MeterImageCutArea();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Exemplo n.º 2
0
 private void ShowInfo(int Id)
 {
     WebDemo.BLL.WebDemo.MeterImageCutArea   bll   = new WebDemo.BLL.WebDemo.MeterImageCutArea();
     WebDemo.Model.WebDemo.MeterImageCutArea model = bll.GetModel(Id);
     this.lblId.Text           = model.Id.ToString();
     this.lblMeterId.Text      = model.MeterId.ToString();
     this.lblCameraNo.Text     = model.CameraNo.ToString();
     this.txtCutLocationX.Text = model.CutLocationX.ToString();
     this.txtCutLocationY.Text = model.CutLocationY.ToString();
     this.txtCutWidth.Text     = model.CutWidth.ToString();
     this.txtCutHeight.Text    = model.CutHeight.ToString();
     this.txtLastOperDate.Text = model.LastOperDate.ToString();
 }