//BtnReset_Click... private void BtnReset_Click_Extend(object sender, EventArgs e) { //调用模版提供的默认实现.--默认实现可能会调用相应的Action. List <UFIDA.U9.Cust.GS.FT.SoBP.ReturnDiscountDTOData> dtoList = new List <SoBP.ReturnDiscountDTOData>(); foreach (SODiscountRecord record in this.Model.SODiscount.SelectRecords) { UFIDA.U9.Cust.GS.FT.SoBP.ReturnDiscountDTOData dto = new SoBP.ReturnDiscountDTOData(); dto.SoLineID = record.SOLine.Value; dto.DiscountType = record.DiscountType.Value; dto.DiscountPrices = record.DiscountPrice ?? decimal.Zero; dto.DiscountRatio = record.DiscountRate ?? decimal.Zero; dto.DiscountID = record.DiscountLine.Value; dto.IsReset = true; dtoList.Add(dto); } if (dtoList.Count > 0 && this.NameValues["SO"] != null) { UFIDA.U9.Cust.GS.FT.SoBP.Proxy.ModifySOPricesProxy bp = new SoBP.Proxy.ModifySOPricesProxy(); bp.IsAll = false; bp.SO = long.Parse(this.NameValues["SO"].ToString()); bp.ReturnDiscountDTOs = dtoList; bp.Do(); } BtnReset_Click_DefaultImpl(sender, e); }
//BtnOk_Click... private void BtnOk_Click_Extend(object sender, EventArgs e) { //调用模版提供的默认实现.--默认实现可能会调用相应的Action. List <UFIDA.U9.Cust.GS.FT.SoBP.ReturnDiscountDTOData> dtoList = new List <SoBP.ReturnDiscountDTOData>(); foreach (SODiscountRecord record in this.Model.SODiscount.Records) { if (record.DiscountType.Value == 0)//固定值 { decimal DiscountPrice = record.DiscountPrice ?? decimal.Zero; decimal beforePrice = record.BeforePrice ?? decimal.Zero; if (DiscountPrice <= 0) { throw new Exception("第" + record.SOLine_DocLineNo.ToString() + "行:当折扣方式为固定值时,折扣单价必须大于0!"); } if (DiscountPrice > beforePrice) { throw new Exception("第" + record.SOLine_DocLineNo.ToString() + "行:当折扣方式为固定值时,修改后的折扣单价不能高于系统预设的折扣单价!"); } } if (record.DiscountType.Value == 1)//百分比 { decimal DiscountRate = record.DiscountRate ?? decimal.Zero; decimal BeforeRate = record.BeforeRate ?? decimal.Zero; if (DiscountRate <= 0) { throw new Exception("第" + record.SOLine_DocLineNo.ToString() + "行:当折扣方式为百分比时,折扣率必须大于0!"); } if (DiscountRate > BeforeRate) { throw new Exception("第" + record.SOLine_DocLineNo.ToString() + "行:当折扣方式为百分比时,修改后的折扣率不能高于系统预设的折扣率!"); } } if (record.DataRecordState == DataRowState.Modified) { UFIDA.U9.Cust.GS.FT.SoBP.ReturnDiscountDTOData dto = new SoBP.ReturnDiscountDTOData(); dto.SoLineID = record.SOLine.Value; dto.DiscountType = record.DiscountType.Value; dto.DiscountPrices = record.DiscountPrice ?? decimal.Zero; dto.DiscountRatio = record.DiscountRate ?? decimal.Zero; dto.DiscountID = record.DiscountLine.Value; dto.IsReset = false; dtoList.Add(dto); } } if (dtoList.Count > 0 && this.NameValues["SO"] != null) { UFIDA.U9.Cust.GS.FT.SoBP.Proxy.ModifySOPricesProxy bp = new SoBP.Proxy.ModifySOPricesProxy(); bp.IsAll = false; bp.SO = long.Parse(this.NameValues["SO"].ToString()); bp.ReturnDiscountDTOs = dtoList; bp.Do(); } this.CloseDialog(false); //BtnOk_Click_DefaultImpl(sender,e); }