public void btnSave_Click(object sender, EventArgs e) { Maticsoft.Model.Shop.Shipping.ShippingType model = new Maticsoft.Model.Shop.Shipping.ShippingType { AddPrice = new decimal?(Globals.SafeDecimal(this.tAddPrice.Text, (decimal) 0M)), Price = Globals.SafeDecimal(this.tPrice.Text, (decimal) 0M), Weight = Globals.SafeInt(this.tWeight.Text, 0), AddWeight = new int?(Globals.SafeInt(this.tAddWeight.Text, 0)), Description = this.tDesc.Text, DisplaySequence = -1, ExpressCompanyName = this.ddlType.SelectedItem.Text, ExpressCompanyEn = this.ddlType.SelectedValue, Name = this.tName.Text }; int num = this.typeBll.Add(model); if (num > 0) { for (int i = 0; i < this.ckPayType.Items.Count; i++) { if (this.ckPayType.Items[i].Selected) { Maticsoft.Model.Shop.Shipping.ShippingPayment payment = new Maticsoft.Model.Shop.Shipping.ShippingPayment { PaymentModeId = Globals.SafeInt(this.ckPayType.Items[i].Value, 0), ShippingModeId = num }; this.payBll.Add(payment); } } base.Response.Redirect("ShippingType.aspx"); } else { MessageBox.ShowFailTip(this, "添加失败!请重试。"); } }
public void btnSave_Click(object sender, EventArgs e) { Maticsoft.Model.Shop.Shipping.ShippingType model = this.typeBll.GetModel(this.ModeId); model.AddPrice = new decimal?(Globals.SafeDecimal(this.tAddPrice.Text, (decimal) 0M)); model.Price = Globals.SafeDecimal(this.tPrice.Text, (decimal) 0M); model.Weight = Globals.SafeInt(this.tWeight.Text, 0); model.AddWeight = new int?(Globals.SafeInt(this.tAddWeight.Text, 0)); model.Description = this.tDesc.Text; model.ExpressCompanyName = this.ddlType.SelectedItem.Text; model.ExpressCompanyEn = this.ddlType.SelectedValue; model.Name = this.tName.Text; if (this.typeBll.Update(model)) { this.payBll.Delete(this.ModeId); for (int i = 0; i < this.ckPayType.Items.Count; i++) { if (this.ckPayType.Items[i].Selected) { Maticsoft.Model.Shop.Shipping.ShippingPayment payment = new Maticsoft.Model.Shop.Shipping.ShippingPayment { PaymentModeId = Globals.SafeInt(this.ckPayType.Items[i].Value, 0), ShippingModeId = this.ModeId }; this.payBll.Add(payment); } } base.Response.Redirect("ShippingType.aspx"); } else { MessageBox.ShowFailTip(this, "添加失败!请重试。"); } }