private void saveCharge(RadTextBox txtChargeCode, RadComboBox cbChargeCcy, RadComboBox cbChargeAcc, RadNumericTextBox txtChargeAmt, RadComboBox cbChargeParty, RadComboBox cbChargeAmort, RadComboBox cbChargeStatus, Label lblTaxCode, Label lblTaxAmt, ref BEXPORT_LC_DOCS_SETTLEMENT_CHARGES ExLCCharge) { ExLCCharge.PaymentCode = tbLCCode.Text; ExLCCharge.ChargeCode = txtChargeCode.Text; ExLCCharge.ChargeCcy = cbChargeCcy.SelectedValue; ExLCCharge.ChargeAcc = cbChargeAcc.SelectedValue; ExLCCharge.ChargeAmt = txtChargeAmt.Value; ExLCCharge.PartyCharged = cbChargeParty.SelectedValue; ExLCCharge.AmortCharge = cbChargeAmort.SelectedValue; ExLCCharge.ChargeStatus = cbChargeStatus.SelectedValue; ExLCCharge.TaxCode = lblTaxCode.Text; if (!string.IsNullOrEmpty(lblTaxAmt.Text)) ExLCCharge.TaxAmt = Convert.ToDouble(lblTaxAmt.Text); }
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { var toolBarButton = e.Item as RadToolBarButton; var commandName = toolBarButton.CommandName.ToLower(); // string paymentCode = tbLCCode.Text.Trim(); var ExLCDocSettlement = dbEntities.findExportLCDocSettlement(paymentCode); // switch (commandName) { case bc.Commands.Commit: if (ExLCDocSettlement == null) { ExLCDocSettlement = new BEXPORT_LC_DOCS_SETTLEMENT(); ExLCDocSettlement.Status = bd.TransactionStatus.UNA; ExLCDocSettlement.CreateDate = DateTime.Now; ExLCDocSettlement.CreateBy = this.UserInfo.Username; saveSettlement(ref ExLCDocSettlement); dbEntities.BEXPORT_LC_DOCS_SETTLEMENT.Add(ExLCDocSettlement); } else { ExLCDocSettlement.Status = bd.TransactionStatus.UNA; ExLCDocSettlement.UpdateDate = DateTime.Now; ExLCDocSettlement.UpdatedBy = this.UserInfo.Username; saveSettlement(ref ExLCDocSettlement); //Xoa di insert lai var ExLCDocCharge = dbEntities.BEXPORT_LC_DOCS_SETTLEMENT_CHARGES.Where(p => p.PaymentCode.Trim().ToLower().Equals(paymentCode.ToLower())); if (ExLCDocCharge != null) { foreach (BEXPORT_LC_DOCS_SETTLEMENT_CHARGES ch in ExLCDocCharge) dbEntities.BEXPORT_LC_DOCS_SETTLEMENT_CHARGES.Remove(ch); } } if (ExLCDocSettlement.WaiveCharges.Equals(bd.YesNo.NO)) { BEXPORT_LC_DOCS_SETTLEMENT_CHARGES ExLCCharge; if (tbChargeAmt1.Value.HasValue) { ExLCCharge = new BEXPORT_LC_DOCS_SETTLEMENT_CHARGES(); saveCharge(txtChargeCode1, rcbChargeCcy1, rcbChargeAcct1, tbChargeAmt1, rcbPartyCharged1, rcbAmortCharge1, rcbChargeStatus1, lblTaxCode1, lblTaxAmt1, ref ExLCCharge); dbEntities.BEXPORT_LC_DOCS_SETTLEMENT_CHARGES.Add(ExLCCharge); } if (tbChargeAmt2.Value.HasValue) { ExLCCharge = new BEXPORT_LC_DOCS_SETTLEMENT_CHARGES(); saveCharge(txtChargeCode2, rcbChargeCcy2, rcbChargeAcct2, tbChargeAmt2, rcbPartyCharged2, rcbAmortCharge2, rcbChargeStatus2, lblTaxCode2, lblTaxAmt2, ref ExLCCharge); dbEntities.BEXPORT_LC_DOCS_SETTLEMENT_CHARGES.Add(ExLCCharge); } if (tbChargeAmt3.Value.HasValue) { ExLCCharge = new BEXPORT_LC_DOCS_SETTLEMENT_CHARGES(); saveCharge(txtChargeCode3, rcbChargeCcy3, rcbChargeAcct3, tbChargeAmt3, rcbPartyCharged3, rcbAmortCharge3, rcbChargeStatus3, lblTaxCode3, lblTaxAmt3, ref ExLCCharge); dbEntities.BEXPORT_LC_DOCS_SETTLEMENT_CHARGES.Add(ExLCCharge); } } // dbEntities.SaveChanges(); // Response.Redirect("Default.aspx?tabid=" + this.TabId); break; case bc.Commands.Authorize: case bc.Commands.Reverse: if (ExLCDocSettlement != null) { if (commandName.Equals(bc.Commands.Authorize)) { ExLCDocSettlement.Status = bd.TransactionStatus.AUT; ExLCDocSettlement.AuthorizedBy = this.UserInfo.Username; ExLCDocSettlement.AuthorizedDate = DateTime.Now; /* if (ExLCDoc.PaymentAmount.HasValue) ExLCDoc.PaymentAmount += ExLCDoc.Amount; else ExLCDoc.PaymentAmount = ExLCDoc.Amount; ExLCDoc.PaymentFull = (ExLC.PaymentAmount == ExLC.Amount); */ dbEntities.SaveChanges(); Response.Redirect("Default.aspx?tabid=" + this.TabId); } else { ExLCDocSettlement.Status = bd.TransactionStatus.REV; dbEntities.SaveChanges(); Response.Redirect("Default.aspx?tabid=" + this.TabId + "&code=" + tbLCCode.Text); } } break; } }