private void saveLC(ref BEXPORT_LC ExLC)
 {
     ExLC.ReceivingLCVia = rcbReceivingLCVia.SelectedValue.Trim();
     ExLC.ImportLCCode = txtImportLCNo.Text.Trim();
     ExLC.LCType = rcbLCType.SelectedValue;
     //
     ExLC.IssuingBankType = rcbIssuingBankType.SelectedValue.Trim();
     ExLC.IssuingBankNo = txtIssuingBankNo.Text.Trim();
     ExLC.IssuingBankName = txtIssuingBankName.Text.Trim();
     ExLC.IssuingBankAddr1 = txtIssuingBankAddr1.Text.Trim();
     ExLC.IssuingBankAddr2 = txtIssuingBankAddr2.Text.Trim();
     ExLC.IssuingBankAddr3 = txtIssuingBankAddr3.Text.Trim();
     //
     ExLC.AdvisingBankType = rcbAdvisingBankType.SelectedValue.Trim();
     ExLC.AdvisingBankNo = txtAdvisingBankNo.Text.Trim();
     ExLC.AdvisingBankName = txtAdvisingBankName.Text.Trim();
     ExLC.AdvisingBankAddr1 = txtAdvisingBankAddr1.Text.Trim();
     ExLC.AdvisingBankAddr2 = txtAdvisingBankAddr2.Text.Trim();
     ExLC.AdvisingBankAddr3 = txtAdvisingBankAddr3.Text.Trim();
     //
     ExLC.FormOfDocumentaryCredit = rcbFormOfDocumentaryCredit.SelectedValue.Trim();
     ExLC.DateOfIssue = txtDateOfIssue.SelectedDate;
     ExLC.DateOfExpiry = txtDateOfExpiry.SelectedDate;
     ExLC.PlaceOfExpiry = txtPlaceOfExpiry.Text.Trim();
     //
     ExLC.ApplicableRule = rcbApplicableRule.SelectedValue.Trim();
     ExLC.ApplicantName = txtApplicantName.Text.Trim();
     ExLC.ApplicantAddr1 = tbApplicantAddr1.Text.Trim();
     ExLC.ApplicantAddr2 = tbApplicantAddr2.Text.Trim();
     ExLC.ApplicantAddr3 = tbApplicantAddr3.Text.Trim();
     //
     ExLC.BeneficiaryNo = rcbBeneficiaryNumber.SelectedValue;
     ExLC.BeneficiaryName = txtBeneficiaryName.Text.Trim();
     ExLC.BeneficiaryAddr1 = txtBeneficiaryAddr1.Text.Trim();
     ExLC.BeneficiaryAddr2 = txtBeneficiaryAddr2.Text.Trim();
     ExLC.BeneficiaryAddr3 = txtBeneficiaryAddr3.Text.Trim();
     //
     ExLC.Currency = rcbCurrency.SelectedValue.Trim();
     ExLC.Amount = txtAmount.Value;
     ExLC.PercentageCreditAmountTolerance1 = txtPercentCreditAmountTolerance1.Value;
     ExLC.PercentageCreditAmountTolerance2 = txtPercentCreditAmountTolerance2.Value;
     ExLC.MaximunCreditAmount = rcbMaximumCreditAmount.SelectedValue.Trim();
     //
     ExLC.AvailableWithType = rcbAvailableWithType.SelectedValue.Trim();
     ExLC.AvailableWithNo = txtAvailableWithNo.Text.Trim();
     ExLC.AvailableWithName = tbAvailableWithName.Text.Trim();
     ExLC.AvailableWithAddr1 = tbAvailableWithAddr1.Text.Trim();
     ExLC.AvailableWithAddr2 = tbAvailableWithAddr2.Text.Trim();
     ExLC.AvailableWithAddr3 = tbAvailableWithAddr3.Text.Trim();
     ExLC.AvailableWithBy = rcbAvailableWithBy.SelectedValue;
     //
     ExLC.DraftsAt = txtDraftsAt1.Text.Trim() + bc.Commont.breakLine + txtDraftsAt2.Text.Trim();
     ExLC.Tenor = rcbTenor.SelectedValue;
     ExLC.MixedPaymentDetails = txtMixedPaymentDetails1.Text.Trim() + bc.Commont.breakLine + txtMixedPaymentDetails2.Text.Trim() + bc.Commont.breakLine + txtMixedPaymentDetails3.Text.Trim() + bc.Commont.breakLine + txtMixedPaymentDetails4.Text.Trim();
     ExLC.DeferedPaymentDetails = txtDeferredPaymentDetails1.Text.Trim() + bc.Commont.breakLine + txtDeferredPaymentDetails2.Text.Trim() + bc.Commont.breakLine + txtDeferredPaymentDetails3.Text.Trim() + bc.Commont.breakLine + txtDeferredPaymentDetails4.Text.Trim();
     ExLC.PartialShipment = rcbPartialShipment.SelectedValue;
     ExLC.TranShipment = rcbTranshipment.SelectedValue;
     ExLC.PlaceOfTakingInCharge = txtPlaceOfTakingInCharge.Text.Trim();
     ExLC.PortOfLoading = txtPortOfLoading.Text.Trim();
     ExLC.PortOfDischarge = txtPortOfDischarge.Text.Trim();
     ExLC.PlaceOfFinalDestination = txtPlaceOfFinalDestination.Text.Trim();
     ExLC.LatesDateOfShipment = txtLatesDateOfShipment.SelectedDate;
     ExLC.ShipmentPeriod = txtShipmentPeriod1.Text.Trim() + bc.Commont.breakLine + txtShipmentPeriod2.Text.Trim() + bc.Commont.breakLine + txtShipmentPeriod3.Text.Trim() + bc.Commont.breakLine + txtShipmentPeriod4.Text.Trim() + bc.Commont.breakLine + txtShipmentPeriod5.Text.Trim() + bc.Commont.breakLine + txtShipmentPeriod6.Text.Trim();
     //
     ExLC.DescriptionOfGoodsServices = txtDescriptionOfGoodsServices.Text.Trim();
     ExLC.Commodity = rcbCommodity.SelectedValue;
     ExLC.DocsRequired = txtDocsRequired.Text.Trim();
     ExLC.AdditionalConditions = txtAdditionalConditions.Text.Trim();
     ExLC.Charges = txtCharges.Text.Trim();
     ExLC.PeriodForPresentation = txtPeriodForPresentation.Text.Trim();
     ExLC.ConfirmationInstructions = rcbConfimationInstructions.SelectedValue;
     //
     ExLC.ReimbBankType = rcbReimbBankType.SelectedValue.Trim();
     ExLC.ReimbBankNo = txtReimbBankNo.Text.Trim();
     ExLC.ReimbBankName = tbReimbBankName.Text.Trim();
     ExLC.ReimbBankAddr1 = tbReimbBankAddr1.Text.Trim();
     ExLC.ReimbBankAddr2 = tbReimbBankAddr2.Text.Trim();
     ExLC.ReimbBankAddr3 = tbReimbBankAddr3.Text.Trim();
     //
     ExLC.InstrToPaygAccptgNegotgBank = txtInstrToPaygAccptgNegotgBank.Text.Trim();
     //
     ExLC.AdviseThroughNo = txtAdviseThroughBankNo.Text.Trim();
     ExLC.AdviseThroughName = txtAdviseThroughBankName.Text.Trim();
     ExLC.AdviseThroughAddr1 = txtAdviseThroughBankAddr1.Text.Trim();
     ExLC.AdviseThroughAddr2 = txtAdviseThroughBankAddr2.Text.Trim();
     ExLC.AdviseThroughAddr3 = txtAdviseThroughBankAddr3.Text.Trim();
     //
     ExLC.SenderToReceiverInformation = txtSenderToReceiverInformation.Text.Trim();
     //
     ExLC.WaiveCharges = rcbWaiveCharges.SelectedValue;
     ExLC.ChargeRemarks = tbChargeRemarks.Text.Trim();
     ExLC.VATNo = tbVatNo.Text.Trim();
 }
 private void saveDataCharge(BEXPORT_LC ExLC)
 {
     if (ExLC.WaiveCharges.Equals(bd.YesNo.NO))
     {
         BEXPORT_LC_CHARGES ExLCCharge;
         if (tbChargeAmt1.Value.HasValue)
         {
             ExLCCharge = new BEXPORT_LC_CHARGES();
             saveCharge(txtChargeCode1, rcbChargeCcy1, rcbChargeAcct1, tbChargeAmt1, rcbPartyCharged1, rcbAmortCharge1, rcbChargeStatus1, lblTaxCode1, lblTaxAmt1, ref ExLCCharge);
             dbEntities.BEXPORT_LC_CHARGES.Add(ExLCCharge);
         }
         if (tbChargeAmt2.Value.HasValue)
         {
             ExLCCharge = new BEXPORT_LC_CHARGES();
             saveCharge(txtChargeCode2, rcbChargeCcy2, rcbChargeAcct2, tbChargeAmt2, rcbPartyCharged2, rcbAmortCharge2, rcbChargeStatus2, lblTaxCode2, lblTaxAmt2, ref ExLCCharge);
             dbEntities.BEXPORT_LC_CHARGES.Add(ExLCCharge);
         }
         if (tbChargeAmt3.Value.HasValue)
         {
             ExLCCharge = new BEXPORT_LC_CHARGES();
             saveCharge(txtChargeCode3, rcbChargeCcy3, rcbChargeAcct3, tbChargeAmt3, rcbPartyCharged3, rcbAmortCharge3, rcbChargeStatus3, lblTaxCode3, lblTaxAmt3, ref ExLCCharge);
             dbEntities.BEXPORT_LC_CHARGES.Add(ExLCCharge);
         }
     }
 }
        private void loadLC(BEXPORT_LC ExLC)
        {
            switch (TabId)
            {
                case ExportLC.Actions.Confirm:
                    rcbGenerateDelivery.SelectedValue = ExLC.ConfirmGenerateDelivery;
                    txtDateConfirm.SelectedDate = ExLC.ConfirmDay;
                    //rcbConfirmInstr
                    break;
                case ExportLC.Actions.Cancel:
                    txtCancelDate.SelectedDate = ExLC.CancelDay;
                    txtContingentExpiryDate.SelectedDate = ExLC.CancelContingentExpiryDate;
                    txtCancelRemark.Text = ExLC.CancelRemark;
                    break;
                case ExportLC.Actions.Close:
                    break;
            }
            //
            txtCreatedDate.SelectedDate = ExLC.CreateDate;
            rcbReceivingLCVia.SelectedValue = ExLC.ReceivingLCVia;
            txtImportLCNo.Text = ExLC.ImportLCCode;
            txtImportLCNo_TextChanged(null, null);
            //

            rcbLCType.SelectedValue = ExLC.LCType;
            rcbIssuingBankType.SelectedValue = ExLC.IssuingBankType;
            rcbIssuingBankType_OnSelectedIndexChanged(null, null);
            txtIssuingBankNo.Text = ExLC.IssuingBankNo;
            txtIssuingBankName.Text = ExLC.IssuingBankName;
            txtIssuingBankAddr1.Text = ExLC.IssuingBankAddr1;
            txtIssuingBankAddr2.Text = ExLC.IssuingBankAddr2;
            txtIssuingBankAddr3.Text = ExLC.IssuingBankAddr3;
            //
            rcbAdvisingBankType.SelectedValue = ExLC.AdvisingBankType;
            rcbAdvisingBankType_OnSelectedIndexChanged(null, null);
            txtAdvisingBankNo.Text = ExLC.AdvisingBankNo;
            txtAdvisingBankName.Text = ExLC.AdvisingBankName;
            txtAdvisingBankAddr1.Text = ExLC.AdvisingBankAddr1;
            txtAdvisingBankAddr2.Text = ExLC.AdvisingBankAddr2;
            txtAdvisingBankAddr3.Text = ExLC.AdvisingBankAddr3;
            //
            rcbFormOfDocumentaryCredit.SelectedValue = ExLC.FormOfDocumentaryCredit;
            txtDateOfIssue.SelectedDate = ExLC.DateOfIssue;
            txtDateOfExpiry.SelectedDate = ExLC.DateOfExpiry;
            txtPlaceOfExpiry.Text = ExLC.PlaceOfExpiry;
            //
            rcbApplicableRule.SelectedValue = ExLC.ApplicableRule;
            txtApplicantName.Text = ExLC.ApplicantName;
            tbApplicantAddr1.Text = ExLC.ApplicantAddr1;
            tbApplicantAddr2.Text = ExLC.ApplicantAddr2;
            tbApplicantAddr3.Text = ExLC.ApplicantAddr3;
            //
            rcbBeneficiaryNumber.SelectedValue = ExLC.BeneficiaryNo;
            txtBeneficiaryName.Text = ExLC.BeneficiaryName;
            txtBeneficiaryAddr1.Text = ExLC.BeneficiaryAddr1;
            txtBeneficiaryAddr2.Text = ExLC.BeneficiaryAddr2;
            txtBeneficiaryAddr3.Text = ExLC.BeneficiaryAddr3;
            //
            rcbCurrency.SelectedValue = ExLC.Currency;
            txtAmount.Value = ExLC.Amount;
            if (ExLC.PaymentAmount.HasValue) lblPaymentAmount.Text = "Payment Amount : " + String.Format("{0:C}", ExLC.PaymentAmount.Value).Replace("$", "");
            txtPercentCreditAmountTolerance1.Value = ExLC.PercentageCreditAmountTolerance1;
            txtPercentCreditAmountTolerance2.Value = ExLC.PercentageCreditAmountTolerance2;
            rcbMaximumCreditAmount.SelectedValue = ExLC.MaximunCreditAmount;
            //
            rcbAvailableWithType.SelectedValue = ExLC.AvailableWithType;
            rcbAvailableWithType_OnSelectedIndexChanged(null, null);
            txtAvailableWithNo.Text = ExLC.AvailableWithNo;
            tbAvailableWithName.Text = ExLC.AvailableWithName;
            tbAvailableWithAddr1.Text = ExLC.AvailableWithAddr1;
            tbAvailableWithAddr2.Text = ExLC.AvailableWithAddr2;
            tbAvailableWithAddr3.Text = ExLC.AvailableWithAddr3;
            rcbAvailableWithBy.SelectedValue = ExLC.AvailableWithBy;
            //
            if (!string.IsNullOrEmpty(ExLC.DraftsAt))
            {
                string[] DraftsAt = ExLC.DraftsAt.Split(new string[] { bc.Commont.breakLine }, StringSplitOptions.None);
                txtDraftsAt1.Text = DraftsAt[0];
                if (DraftsAt.Length > 1) txtDraftsAt2.Text = DraftsAt[1];
            }
            rcbTenor.SelectedValue = ExLC.Tenor;
            if (!string.IsNullOrEmpty(ExLC.MixedPaymentDetails))
            {
                string[] MixedPaymentDetails = ExLC.MixedPaymentDetails.Split(new string[] { bc.Commont.breakLine }, StringSplitOptions.None);
                txtMixedPaymentDetails1.Text = MixedPaymentDetails[0];
                if (MixedPaymentDetails.Length > 1)
                {
                    txtMixedPaymentDetails2.Text = MixedPaymentDetails[1];
                    if (MixedPaymentDetails.Length > 2)
                    {
                        txtMixedPaymentDetails3.Text = MixedPaymentDetails[2];
                        if (MixedPaymentDetails.Length > 3)
                            txtMixedPaymentDetails4.Text = MixedPaymentDetails[3];
                    }
                }
            }
            if (!string.IsNullOrEmpty(ExLC.DeferedPaymentDetails))
            {
                string[] DeferedPaymentDetails = ExLC.DeferedPaymentDetails.Split(new string[] { bc.Commont.breakLine }, StringSplitOptions.None);
                txtDeferredPaymentDetails1.Text = DeferedPaymentDetails[0];
                if (DeferedPaymentDetails.Length > 1)
                {
                    txtDeferredPaymentDetails2.Text = DeferedPaymentDetails[1];
                    if (DeferedPaymentDetails.Length > 2)
                    {
                        txtDeferredPaymentDetails3.Text = DeferedPaymentDetails[2];
                        if (DeferedPaymentDetails.Length > 3)
                            txtDeferredPaymentDetails4.Text = DeferedPaymentDetails[3];
                    }
                }
            }
            rcbPartialShipment.SelectedValue = ExLC.PartialShipment;
            rcbTranshipment.SelectedValue = ExLC.TranShipment;
            txtPlaceOfTakingInCharge.Text = ExLC.PlaceOfTakingInCharge;
            txtPortOfLoading.Text = ExLC.PortOfLoading;
            txtPortOfDischarge.Text = ExLC.PortOfDischarge;
            txtPlaceOfFinalDestination.Text = ExLC.PlaceOfFinalDestination;
            txtLatesDateOfShipment.SelectedDate = ExLC.LatesDateOfShipment;
            if (!string.IsNullOrEmpty(ExLC.ShipmentPeriod))
            {
                string[] ShipmentPeriod = ExLC.ShipmentPeriod.Split(new string[] { bc.Commont.breakLine }, StringSplitOptions.None);
                txtShipmentPeriod1.Text = ShipmentPeriod[0];
                if (ShipmentPeriod.Length > 1)
                {
                    txtShipmentPeriod2.Text = ShipmentPeriod[1];
                    if (ShipmentPeriod.Length > 2)
                    {
                        txtShipmentPeriod3.Text = ShipmentPeriod[2];
                        if (ShipmentPeriod.Length > 3)
                        {
                            txtShipmentPeriod4.Text = ShipmentPeriod[3];
                            if (ShipmentPeriod.Length > 4)
                            {
                                txtShipmentPeriod5.Text = ShipmentPeriod[4];
                                if (ShipmentPeriod.Length > 4)
                                    txtShipmentPeriod6.Text = ShipmentPeriod[4];
                            }
                        }
                    }
                }
            }
            //
            txtDescriptionOfGoodsServices.Text = ExLC.DescriptionOfGoodsServices;
            rcbCommodity.SelectedValue = ExLC.Commodity;
            txtDocsRequired.Text = ExLC.DocsRequired;
            txtAdditionalConditions.Text = ExLC.AdditionalConditions;
            txtCharges.Text = ExLC.Charges;
            txtPeriodForPresentation.Text = ExLC.PeriodForPresentation;
            rcbConfimationInstructions.SelectedValue = ExLC.ConfirmationInstructions;
            //
            rcbReimbBankType.SelectedValue = ExLC.ReimbBankType;
            rcbReimbBankType_OnSelectedIndexChanged(null, null);
            txtReimbBankNo.Text = ExLC.ReimbBankNo;
            tbReimbBankName.Text = ExLC.ReimbBankName;
            tbReimbBankAddr1.Text = ExLC.ReimbBankAddr1;
            tbReimbBankAddr2.Text = ExLC.ReimbBankAddr2;
            tbReimbBankAddr3.Text = ExLC.ReimbBankAddr3;
            //
            txtInstrToPaygAccptgNegotgBank.Text = ExLC.InstrToPaygAccptgNegotgBank;
            //
            txtAdviseThroughBankNo.Text = ExLC.AdviseThroughNo;
            txtAdviseThroughBankName.Text = ExLC.AdviseThroughName;
            txtAdviseThroughBankAddr1.Text = ExLC.AdviseThroughAddr1;
            txtAdviseThroughBankAddr2.Text = ExLC.AdviseThroughAddr2;
            txtAdviseThroughBankAddr3.Text = ExLC.AdviseThroughAddr3;
            //
            txtSenderToReceiverInformation.Text = ExLC.SenderToReceiverInformation;
            //
            rcbWaiveCharges.SelectedValue = ExLC.WaiveCharges;
            tbChargeRemarks.Text = ExLC.ChargeRemarks;
            tbVatNo.Text = ExLC.VATNo;
            //
            if (ExLC.WaiveCharges.Equals(bd.YesNo.NO)) loadCharges();
        }
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            var toolBarButton = e.Item as RadToolBarButton;
            var ExLC = dbEntities.findExportLC(tbLCCode.Text);
            var commandName = toolBarButton.CommandName.ToLower();
            #region Register
            if (TabId == ExportLC.Actions.Register)
            {
                switch (commandName)
                {
                    case bc.Commands.Commit:
                    case bc.Commands.Hold:
                        if (ExLC == null)
                        {
                            ExLC = new BEXPORT_LC();
                            ExLC.ExportLCCode = tbLCCode.Text.Trim();
                            ExLC.Status = (commandName.Equals(bc.Commands.Commit) ? bd.TransactionStatus.UNA : bd.TransactionStatus.HLD);
                            ExLC.CreateDate = DateTime.Now;
                            ExLC.CreateBy = this.UserInfo.Username;
                            saveLC(ref ExLC);
                            dbEntities.BEXPORT_LC.Add(ExLC);
                        }
                        else
                        {
                            ExLC.Status = (commandName.Equals(bc.Commands.Commit) ? bd.TransactionStatus.UNA : bd.TransactionStatus.HLD);
                            ExLC.UpdateDate = DateTime.Now;
                            ExLC.UpdatedBy = this.UserInfo.Username;
                            saveLC(ref ExLC);
                            //Xoa di insert lai
                            var ExLCCharge = dbEntities.BEXPORT_LC_CHARGES.Where(p => p.ExportLCCode.Trim().ToLower().Equals(tbLCCode.Text.Trim().ToLower()));
                            if (ExLCCharge != null)
                            {
                                foreach (BEXPORT_LC_CHARGES ch in ExLCCharge)
                                {
                                    dbEntities.BEXPORT_LC_CHARGES.Remove(ch);
                                }
                            }
                        }
                        saveDataCharge(ExLC);
                        //
                        dbEntities.SaveChanges();
                        //
                        Response.Redirect("Default.aspx?tabid=" + this.TabId + (commandName.Equals(bc.Commands.Commit) ? "" : "&code=" + tbLCCode.Text));
                        break;
                    case bc.Commands.Authorize:
                    case bc.Commands.Reverse:
                        if (ExLC != null)
                        {
                            if (commandName.Equals(bc.Commands.Authorize))
                            {
                                ExLC.Status = bd.TransactionStatus.AUT;
                                ExLC.AuthorizedBy = this.UserInfo.Username;
                                ExLC.AuthorizedDate = DateTime.Now;
                                //
                                dbEntities.SaveChanges();
                                Response.Redirect("Default.aspx?tabid=" + this.TabId);
                                return;
                            }
                            //
                            ExLC.Status = bd.TransactionStatus.REV;
                            dbEntities.SaveChanges();
                            Response.Redirect("Default.aspx?tabid=" + this.TabId + "&code=" + tbLCCode.Text);
                        }
                        break;
                }

                return;
            }
            #endregion
            #region Cancel
            if (TabId == ExportLC.Actions.Cancel)
            {
                switch (commandName)
                {
                    case bc.Commands.Commit:
                        if (ExLC != null)
                        {
                            ExLC.CancelStatus = bd.TransactionStatus.UNA;
                            ExLC.CancelDate = DateTime.Now;
                            ExLC.CancelDay = txtCancelDate.SelectedDate;
                            ExLC.CancelContingentExpiryDate = txtContingentExpiryDate.SelectedDate;
                            ExLC.CancelRemark = txtCancelRemark.Text;
                            ExLC.ImportLCCode = txtImportLCNo.Text;

                            ExLC.WaiveCharges = rcbWaiveCharges.SelectedValue;

                            saveDataCharge(ExLC);
                            //
                            dbEntities.SaveChanges();
                        }
                        //
                        Response.Redirect("Default.aspx?tabid=" + this.TabId);
                        break;
                    case bc.Commands.Authorize:
                    case bc.Commands.Reverse:
                        if (ExLC != null)
                        {
                            if (commandName.Equals(bc.Commands.Authorize))
                            {
                                ExLC.CancelStatus = bd.TransactionStatus.AUT;
                                //
                                dbEntities.SaveChanges();
                                Response.Redirect("Default.aspx?tabid=" + this.TabId);
                                return;
                            }
                            //
                            ExLC.CancelStatus = bd.TransactionStatus.REV;
                            dbEntities.SaveChanges();
                            Response.Redirect("Default.aspx?tabid=" + this.TabId + "&code=" + tbLCCode.Text);
                        }
                        break;
                }

                return;
            }
            #endregion
            #region Close
            if (TabId == ExportLC.Actions.Close)
            {
                switch (commandName)
                {
                    case bc.Commands.Commit:
                        if (ExLC != null)
                        {
                            ExLC.ClosedStatus = bd.TransactionStatus.UNA;
                            ExLC.ClosedDate = DateTime.Now;
                            //
                            dbEntities.SaveChanges();
                        }
                        //
                        Response.Redirect("Default.aspx?tabid=" + this.TabId);
                        break;
                    case bc.Commands.Authorize:
                    case bc.Commands.Reverse:
                        if (ExLC != null)
                        {
                            if (commandName.Equals(bc.Commands.Authorize))
                            {
                                ExLC.ClosedStatus = bd.TransactionStatus.AUT;
                                //
                                dbEntities.SaveChanges();
                                Response.Redirect("Default.aspx?tabid=" + this.TabId);
                                return;
                            }
                            //
                            ExLC.ClosedStatus = bd.TransactionStatus.REV;
                            dbEntities.SaveChanges();
                            Response.Redirect("Default.aspx?tabid=" + this.TabId + "&code=" + tbLCCode.Text);
                        }
                        break;
                }

                return;
            }
            #endregion
        }
 private void loadLC(BEXPORT_LC ExLC)
 {
     txtImportLCNo.Text = ExLC.ImportLCCode;
     txtImportLCNo_TextChanged(null, null);
     //
     txtSenderReference.Text = "";
     txtReceiverReference.Text = "";
     txtIssuingBankReference.Text = "";
     //
     rcbIssuingBankType.SelectedValue = ExLC.IssuingBankType;
     rcbIssuingBankType_OnSelectedIndexChanged(null, null);
     txtIssuingBankNo.Text = ExLC.IssuingBankNo;
     txtIssuingBankName.Text = ExLC.IssuingBankName;
     txtIssuingBankAddr1.Text = ExLC.IssuingBankAddr1;
     txtIssuingBankAddr2.Text = ExLC.IssuingBankAddr2;
     txtIssuingBankAddr3.Text = ExLC.IssuingBankAddr3;
     //
     txtDateOfIssue.SelectedDate = ExLC.DateOfIssue;
     rcbCurrency.SelectedValue = ExLC.Currency;
     decreaseCurrency.SelectedValue = ExLC.Currency;
     newCreaditAmountCurrency.SelectedValue = ExLC.Currency;
     //txtDateOfAmendment.SelectedDate = DateTime.Now;
     //
     rcbBeneficiaryNumber.SelectedValue = ExLC.BeneficiaryNo;
     txtBeneficiaryName.Text = ExLC.BeneficiaryName;
     txtBeneficiaryAddr1.Text = ExLC.BeneficiaryAddr1;
     txtBeneficiaryAddr2.Text = ExLC.BeneficiaryAddr2;
     txtBeneficiaryAddr3.Text = ExLC.BeneficiaryAddr3;
     //
     //txtNewDateOfExpiry.SelectedDate
     //txtIncreaseOfDocumentaryCreditAmount.Value
     //txtDecreaseOfDocumentaryCreditAmount.Value
     if (ExLC.Amount.ToString() != "")
     {
         txtDocumentaryCreditAmount.Value = ExLC.Amount.ToString();
     }
     else
     {
         txtDocumentaryCreditAmount.Value = "0";
     }
     txtNewDocumentaryCreditAmountAfterAmendment.Value = ExLC.Amount;
     //txtNewDocumentaryCreditAmountAfterAmendment.Text
     txtPercentCreditAmountTolerance1.Value = ExLC.PercentageCreditAmountTolerance1;
     txtPercentCreditAmountTolerance2.Value = ExLC.PercentageCreditAmountTolerance2;
     //
     txtPlaceOfTakingInCharge.Text = ExLC.PlaceOfTakingInCharge;
     txtPortOfLoading.Text = ExLC.PortOfLoading;
     txtPortOfDischarge.Text = ExLC.PortOfDischarge;
     txtPlaceOfFinalDestination.Text = ExLC.PlaceOfFinalDestination;
     txtLatesDateOfShipment.SelectedDate = ExLC.LatesDateOfShipment;
     //txtNarrative.Text
     txtSenderToReceiverInformation.Text = ExLC.SenderToReceiverInformation;
 }
 private void loadLC(BEXPORT_LC ExLC)
 {
     txtBeneficiaryNumber.Text = ExLC.BeneficiaryNo;
     txtBeneficiaryName.Text = ExLC.BeneficiaryName;
     txtBeneficiaryAddr1.Text = ExLC.BeneficiaryAddr1;
     txtBeneficiaryAddr2.Text = ExLC.BeneficiaryAddr2;
     txtBeneficiaryAddr3.Text = ExLC.BeneficiaryAddr3;
     //
     txtApplicantName.Text = ExLC.ApplicantName;
     txtApplicantAddr1.Text = ExLC.ApplicantAddr1;
     txtApplicantAddr2.Text = ExLC.ApplicantAddr2;
     txtApplicantAddr3.Text = ExLC.ApplicantAddr3;
     //
     txtIssuingBankNo.Text = ExLC.IssuingBankNo;
     txtIssuingBankName.Text = ExLC.IssuingBankName;
     txtIssuingBankAddr1.Text = ExLC.IssuingBankAddr1;
     txtIssuingBankAddr2.Text = ExLC.IssuingBankAddr2;
     txtIssuingBankAddr3.Text = ExLC.IssuingBankAddr3;
     //
     txtDocumentaryCreditNo.Text = ExLC.ImportLCCode;
     txtCommodity.Value = ExLC.Commodity;
     txtCommodityName.Text = getCommodityName(ExLC.Commodity);
     rcbCurrency.SelectedValue = ExLC.Currency;
     txtAmount.Value = ExLC.Amount;
     txtTenor.Text = ExLC.Tenor;
 }