Ejemplo n.º 1
0
        private void Save()
        {
            this.advModel.CityId = (this.cmbCity.SelectedItem as CityModel).CityId;
            this.advModel.ExId   = (this.cmbEx.SelectedItem as ExLogisticModel).ExId;
            double amount = 0;

            double.TryParse(this.tbAmount.Text, out amount);
            this.advModel.Amount = amount;
            if (this.maintainType == MaintainType.New)
            {
                var addResult = WebRequestUtil.AddCityExLogisticsAmount(JsonUtil.Serialize(this.advModel));
                if (addResult == null || addResult.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    MessageBox.Show("新建地区快递物流金额失败!");
                }
            }
            else
            {
                var updateResult = WebRequestUtil.UpdateCityExLogisticsAmount(this.advModel.id, JsonUtil.Serialize(this.advModel));
                if (updateResult == null || updateResult.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    MessageBox.Show("更新地区快递物流金额!");
                }
            }
        }