Example #1
0
 /// <summary>
 /// On datagridview cell double click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvExchangeRate_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         ExchangeRateSP spExcahangeRate = new ExchangeRateSP();
         if (e.RowIndex != -1)
         {
             decId = Convert.ToDecimal(dgvExchangeRate.Rows[e.RowIndex].Cells["dgvtxtExchangeRateId"].Value.ToString());
             bool Status = spExcahangeRate.ExchangeRateCheckExistanceForUpdationAndDelete(Convert.ToDateTime(txtDate.Text.ToString()), decId);
             if (Status)
             {
                 FillControls();
                 btnSave.Text      = "Update";
                 btnDelete.Enabled = true;
                 cmbCurrency.Focus();
             }
             else
             {
                 Messages.ReferenceExistsMessageForUpdate();
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER27:" + ex.Message;
     }
 }
Example #2
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)
     {
         formMDI.infoError.ErrorString = "ER2:" + ex.Message;
     }
 }
Example #3
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)
     {
         formMDI.infoError.ErrorString = "ER3:" + ex.Message;
     }
 }
Example #4
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         ExchangeRateSP spExchangeRaterate = new ExchangeRateSP();
         DataTable      dtbl = new DataTable();
         dtbl = spExchangeRaterate.ExchangeRateSearch(cmbCurrencyRate.Text.ToString(), Convert.ToDateTime(txtDatefrom.Text.ToString()), Convert.ToDateTime(txtDateTo.Text.ToString()));
         dgvExchangeRate.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER9:" + ex.Message;
     }
 }
Example #5
0
        public int NoofDecimalPlacesFind()
        {
            int inNoOfDecimalPlaces = 0;

            try
            {
                ExchangeRateSP spExchangeRate = new ExchangeRateSP();
                if (cmbCurrency.SelectedValue != null)
                {
                    inNoOfDecimalPlaces = spExchangeRate.NoOfDecimalNumberViewByCurrencyId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()));
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "ER16:" + ex.Message;
            }
            return(inNoOfDecimalPlaces);
        }
Example #6
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         ExchangeRateSP   spExchangeRate   = new ExchangeRateSP();
         infoExchangeRate = spExchangeRate.ExchangeRateView(decId);
         int inNoOfDecimalPlaces = spExchangeRate.NoOfDecimalNumberViewByExchangeRateId(decId);
         cmbCurrency.SelectedValue = infoExchangeRate.CurrencyId.ToString();
         dtpDate.Text         = infoExchangeRate.Date.ToString();
         txtExchangeRate.Text = Math.Round(Convert.ToDecimal(infoExchangeRate.Rate.ToString()), inNoOfDecimalPlaces).ToString();
         txtNarration.Text    = infoExchangeRate.Narration;
         decExchangeRateId    = infoExchangeRate.ExchangeRateId;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER13:" + ex.Message;
     }
 }
Example #7
0
 /// <summary>
 /// Function to delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ExchangeRateSP spExchangeRate = new ExchangeRateSP();
         if (spExchangeRate.ExchangeRateCheckReferences(decId) == -1)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Messages.DeletedMessage();
             Clear();
             GridFill();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ER10:" + ex.Message;
     }
 }