Beispiel #1
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date       = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate       = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration  = txtNarration.Text.Trim();
         infoExchangeRate.Extra1     = string.Empty;
         infoExchangeRate.Extra2     = string.Empty;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), 0) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateAddParticularFields(infoExchangeRate);
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void Editfunction()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate.CurrencyId     = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoExchangeRate.Date           = Convert.ToDateTime(dtpDate.Text.Trim().ToString());
         infoExchangeRate.Rate           = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString());
         infoExchangeRate.Narration      = txtNarration.Text.Trim();
         infoExchangeRate.Extra1         = String.Empty;
         infoExchangeRate.Extra2         = String.Empty;
         infoExchangeRate.ExchangeRateId = decId;
         if (spExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false)
         {
             if (ExchangeRateCheck())
             {
                 spExchangeRate.ExchangeRateEdit(infoExchangeRate);
                 Messages.UpdatedMessage();
                 SearchClear();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             cmbCurrency.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ER3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }