/*
  * Method Revision History:
  * Version        Date            Author            Comment
  * ----------------------------------------------------------
  * 0.1            NA
  * 0.2            Sep 12, 2015    Hien Nguyen       Fix bug 65 _ remove Payment Method
  * 0.3            Sep 12, 2015    Hien Nguyen       Fix bug 66 _ remove Exchange Rate
  */
 private void SavePayment()
 {
     var outCoPayment =
                _entities.BOUTGOINGCOLLECTIONPAYMENTs.FirstOrDefault(q => q.PaymentId == txtCode.Text);
     if (outCoPayment == null) // insert
     {
         outCoPayment = new BOUTGOINGCOLLECTIONPAYMENT();
         outCoPayment.Id = Guid.NewGuid();
         outCoPayment.PaymentId = txtCode.Text;
         outCoPayment.PaymentNo = long.Parse(txtCode.Text.Substring(15));
         outCoPayment.ValueDate = dtValueDate.SelectedDate;
         outCoPayment.AmtCredited = double.Parse(lblCreditAmount.Text);
         outCoPayment.Status = "UNA";
         outCoPayment.CreateBy = UserId.ToString();
         //outCoPayment.PaymentMethod = comboPaymentMethod.SelectedValue; //fixed bug 65
         outCoPayment.PaymentRemarks1 = txtPaymentRemarks1.Text;
         outCoPayment.PaymentRemarks2 = txtPaymentRemarks2.Text;
         outCoPayment.CollectionPaymentCode = txtCode.Text.Substring(0, 14);
         outCoPayment.CreateDate = DateTime.Now.Date;
         outCoPayment.Currency = comboCreditCurrency.SelectedValue;
         outCoPayment.DrawType = comboDrawType.SelectedValue;
         outCoPayment.DrawingAmount = numDrawingAmount.Value;
         //outCoPayment.ExchRate = numExchangeRate.Value; //fixed bug 66
         outCoPayment.IncreaseMental = 0;
         outCoPayment.Currency = comboCurrency.SelectedValue;
         outCoPayment.CreditAccount = comboCreditAcct.SelectedValue;
         outCoPayment.CountryCode = comboCountryCode.SelectedValue;
         outCoPayment.PresentorCusNo = cbNostroAccount.SelectedValue;
         _entities.BOUTGOINGCOLLECTIONPAYMENTs.Add(outCoPayment);
     }
     else
     {
         outCoPayment.PaymentId = txtCode.Text;
         outCoPayment.PaymentNo = long.Parse(txtCode.Text.Substring(15));
         outCoPayment.ValueDate = dtValueDate.SelectedDate;
         outCoPayment.AmtCredited = double.Parse(lblCreditAmount.Text);
         outCoPayment.UpdatedBy = UserId.ToString();
         //outCoPayment.PaymentMethod = comboPaymentMethod.SelectedValue; //fixed bug 65
         outCoPayment.PaymentRemarks1 = txtPaymentRemarks1.Text;
         outCoPayment.PaymentRemarks2 = txtPaymentRemarks2.Text;
         outCoPayment.CollectionPaymentCode = txtCode.Text.Substring(0, 14);
         outCoPayment.UpdatedDate = DateTime.Now.Date;
         outCoPayment.Currency = comboCreditCurrency.SelectedValue;
         outCoPayment.DrawType = comboDrawType.SelectedValue;
         outCoPayment.DrawingAmount = numDrawingAmount.Value;
         outCoPayment.CountryCode = comboCountryCode.SelectedValue;
         //outCoPayment.ExchRate = numExchangeRate.Value; //fixed bug 66
         outCoPayment.IncreaseMental = 0;
         outCoPayment.CreditAccount = comboCreditAcct.SelectedValue;
         outCoPayment.PresentorCusNo = cbNostroAccount.SelectedValue;
     }
     _entities.SaveChanges();
     SaveCharges();
 }
 /*
  * Method Revision History:
  * Version        Date            Author            Comment
  * ----------------------------------------------------------
  * 0.1            NA
  * 0.2            Oct 03, 2015    Hien Nguyen       Fix bug 65 _ remove Payment Method
  * 0.3            Oct 03, 2015    Hien Nguyen       Fix bug 66 _ remove Exchange Rate
  */
 void LoadPaymentDetail(BOUTGOINGCOLLECTIONPAYMENT outColPayment)
 {
     var exportDoc = _entities.BEXPORT_DOCUMETARYCOLLECTION.FirstOrDefault(q => q.DocCollectCode == outColPayment.CollectionPaymentCode);
     if (exportDoc.CollectionType.Equals("DP"))
     {
         comboDrawType.SelectedValue = "SP";
     }
     else
     {
         comboDrawType.SelectedValue = "MA";
     }
     //comboDrawType.SelectedValue = outColPayment.DrawType;
     lblDrawType.Text = comboDrawType.SelectedItem.Attributes["Description"];
     dtValueDate.SelectedDate = outColPayment.ValueDate;
     numDrawingAmount.Value = outColPayment.DrawingAmount;
     comboCountryCode.SelectedValue = outColPayment.CountryCode;
     if (null == outColPayment.AmtCredited || outColPayment.AmtCredited == 0)
     {
         lblCreditAmount.Text = (numDrawingAmount.Value??0).ToString("#,##0.00");
     }
     else
     {
         lblCreditAmount.Text = (outColPayment.AmtCredited ?? 0).ToString("#,##0.00");
     }
     //comboPaymentMethod.SelectedValue = outColPayment.PaymentMethod; //fixed bug 65
     comboCreditCurrency.SelectedValue = outColPayment.Currency;
     LoadCreditAccount();
     comboCreditAcct.SelectedValue = outColPayment.CreditAccount;
     loadNostroAccount();
     cbNostroAccount.SelectedValue = outColPayment.PresentorCusNo;
     //numExchangeRate.Value = outColPayment.ExchRate; //fixed bug 66
     txtPaymentRemarks1.Text = outColPayment.PaymentRemarks1;
     txtPaymentRemarks2.Text = outColPayment.PaymentRemarks2;
     LoadCharges();
     //bc.Commont.initRadComboBox(ref cboNostroAcct, "Code", "AccountNo", _entities.BSWIFTCODEs.Where(q => q.Currency.Equals(outColPayment.Currency)).ToList());
 }