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

            IRestResponse response;

            if (this.maintainType == MaintainType.New)
            {
                response = WebRequestUtil.AddExLogistic(this.tbExName.Text);
            }
            else
            {
                response = WebRequestUtil.UpdateExLogistic(this.exModel.ExId, this.tbExName.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();
            }
        }