Ejemplo n.º 1
0
        protected void OnSubmit(object sender, EventArgs e)
        {
            ESMonitor.Model.Stats model = new ESMonitor.Model.Stats();

            string stateCode = txtNo.Text.Trim();

            model.Id           = Convert.ToInt32(HiddenId.Value);
            model.StatName     = txtName.Text.Trim();
            model.StatCode     = stateCode;
            model.Address      = txtAddr.Text.Trim();
            model.ChargeMan    = txtChargeMan.Text.Trim();
            model.Telepone     = txtMobile.Text.Trim();
            model.Department   = txtDept.Text.Trim();
            model.Country      = ddlCountry.SelectedValue;
            model.Street       = txtStreet.Text.Trim();
            model.Square       = decimal.Parse(txtSquare.Text.Trim());
            model.Stage        = int.Parse(ddlStage.SelectedValue);
            model.ProStartTime = Convert.ToDateTime(txtStartTime.Text);
            string[] location = txtLocation.Text.Trim().Split(';');

            model.Longitude = decimal.Parse(location[0]);
            model.Latitude  = decimal.Parse(location[1]);

            if (_bll.Update(model))
            {
                Response.Redirect("Stats.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "", "<script>alert(\"更新失败\");</script>");
            }
        }
Ejemplo n.º 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtStatCode.Text.Trim().Length == 0)
            {
                strErr += "StatCode不能为空!\\n";
            }
            if (this.txtStatName.Text.Trim().Length == 0)
            {
                strErr += "StatName不能为空!\\n";
            }
            if (this.txtChargeMan.Text.Trim().Length == 0)
            {
                strErr += "ChargeMan不能为空!\\n";
            }
            if (this.txtTelepone.Text.Trim().Length == 0)
            {
                strErr += "Telepone不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtLongitude.Text))
            {
                strErr += "Longitude格式错误!\\n";
            }
            if (this.txtDepartment.Text.Trim().Length == 0)
            {
                strErr += "Department不能为空!\\n";
            }
            if (this.txtAdress.Text.Trim().Length == 0)
            {
                strErr += "Adress不能为空!\\n";
            }
            if (this.txtCountry.Text.Trim().Length == 0)
            {
                strErr += "Country不能为空!\\n";
            }
            if (this.txtStreet.Text.Trim().Length == 0)
            {
                strErr += "Street不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtSquare.Text))
            {
                strErr += "Square格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtProStartTime.Text))
            {
                strErr += "ProStartTime格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStage.Text))
            {
                strErr += "Stage格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      Id           = int.Parse(this.lblId.Text);
            string   StatCode     = this.txtStatCode.Text;
            string   StatName     = this.txtStatName.Text;
            string   ChargeMan    = this.txtChargeMan.Text;
            string   Telepone     = this.txtTelepone.Text;
            decimal  Longitude    = decimal.Parse(this.txtLongitude.Text);
            string   Department   = this.txtDepartment.Text;
            string   Adress       = this.txtAdress.Text;
            string   Country      = this.txtCountry.Text;
            string   Street       = this.txtStreet.Text;
            decimal  Square       = decimal.Parse(this.txtSquare.Text);
            DateTime ProStartTime = DateTime.Parse(this.txtProStartTime.Text);
            int      Stage        = int.Parse(this.txtStage.Text);


            ESMonitor.Model.Stats model = new ESMonitor.Model.Stats();
            model.Id           = Id;
            model.StatCode     = StatCode;
            model.StatName     = StatName;
            model.ChargeMan    = ChargeMan;
            model.Telepone     = Telepone;
            model.Longitude    = Longitude;
            model.Department   = Department;
            model.Adress       = Adress;
            model.Country      = Country;
            model.Street       = Street;
            model.Square       = Square;
            model.ProStartTime = ProStartTime;
            model.Stage        = Stage;

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