Exemple #1
0
        private void btnSaves_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.tbCityName.Text))
            {
                MessageBox.Show("请填写完整信息!");
                return;
            }

            IRestResponse response;

            if (this.maintainType == MaintainType.New)
            {
                response = WebRequestUtil.AddCity(this.tbCityName.Text);
            }
            else
            {
                response = WebRequestUtil.UpdateCity(this.cityModel.CityId, this.tbCityName.Text);
            }

            if (response == null || response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                if (maintainType == MaintainType.New)
                {
                    MessageBox.Show("新增省份失败!");
                }
                else
                {
                    MessageBox.Show("更新省份失败!");
                }
            }
            else
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }