/// <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); } }
/// <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) { MessageBox.Show("ER9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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) { throw; } return(inNoOfDecimalPlaces); }
/// <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) { MessageBox.Show("ER13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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) { MessageBox.Show("ER10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }