コード例 #1
0
 private void ShowInfo(int ID)
 {
     WebDemo.BLL.WebDemo.LocationInfo   bll   = new WebDemo.BLL.WebDemo.LocationInfo();
     WebDemo.Model.WebDemo.LocationInfo model = bll.GetModel(ID);
     this.lblID.Text         = model.ID.ToString();
     this.txtOperatorID.Text = model.OperatorID.ToString();
     this.txtDateTime.Text   = model.DateTime.ToString();
     this.txtLocationX.Text  = model.LocationX.ToString();
     this.txtLocationY.Text  = model.LocationY.ToString();
 }
コード例 #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtOperatorID.Text))
            {
                strErr += "OperatorID格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtDateTime.Text))
            {
                strErr += "DateTime格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtLocationX.Text))
            {
                strErr += "LocationX格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtLocationY.Text))
            {
                strErr += "LocationY格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ID         = int.Parse(this.lblID.Text);
            int      OperatorID = int.Parse(this.txtOperatorID.Text);
            DateTime DateTime   = DateTime.Parse(this.txtDateTime.Text);
            decimal  LocationX  = decimal.Parse(this.txtLocationX.Text);
            decimal  LocationY  = decimal.Parse(this.txtLocationY.Text);


            WebDemo.Model.WebDemo.LocationInfo model = new WebDemo.Model.WebDemo.LocationInfo();
            model.ID         = ID;
            model.OperatorID = OperatorID;
            model.DateTime   = DateTime;
            model.LocationX  = LocationX;
            model.LocationY  = LocationY;

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