public void CurrencyEdit(CurrencyInfo currencyinfo) { try { SpCurrency.CurrencyEdit(currencyinfo); } catch (Exception ex) { MessageBox.Show("C4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public decimal CurrencyAddwithIdentity(CurrencyInfo currencyinfo) { decimal decCurrencyId = 0; try { decCurrencyId = SpCurrency.CurrencyAddwithIdentity(currencyinfo); } catch (Exception ex) { MessageBox.Show("C3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return decCurrencyId; }
/// <summary> /// Function to insert values to Currency Table /// </summary> /// <param name="currencyinfo"></param> public void CurrencyAdd(CurrencyInfo currencyinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("CurrencyAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal); sprmparam.Value = currencyinfo.CurrencyId; sprmparam = sccmd.Parameters.Add("@currencySymbol", SqlDbType.VarChar); sprmparam.Value = currencyinfo.CurrencySymbol; sprmparam = sccmd.Parameters.Add("@currencyName", SqlDbType.VarChar); sprmparam.Value = currencyinfo.CurrencyName; sprmparam = sccmd.Parameters.Add("@subunitName", SqlDbType.VarChar); sprmparam.Value = currencyinfo.SubunitName; sprmparam = sccmd.Parameters.Add("@noOfDecimalPlaces", SqlDbType.Int); sprmparam.Value = currencyinfo.NoOfDecimalPlaces; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = currencyinfo.Narration; sprmparam = sccmd.Parameters.Add("@isDefault", SqlDbType.Bit); sprmparam.Value = currencyinfo.IsDefault; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = currencyinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = currencyinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = currencyinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to insert values to table and return id /// </summary> /// <param name="currencyinfo"></param> /// <returns></returns> public decimal CurrencyAddwithIdentity(CurrencyInfo currencyinfo) { decimal decCurrencyId = 0; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("CurrencyAddwithIdentity", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@currencySymbol", SqlDbType.VarChar); sprmparam.Value = currencyinfo.CurrencySymbol; sprmparam = sccmd.Parameters.Add("@currencyName", SqlDbType.VarChar); sprmparam.Value = currencyinfo.CurrencyName; sprmparam = sccmd.Parameters.Add("@subunitName", SqlDbType.VarChar); sprmparam.Value = currencyinfo.SubunitName; sprmparam = sccmd.Parameters.Add("@noOfDecimalPlaces", SqlDbType.Int); sprmparam.Value = currencyinfo.NoOfDecimalPlaces; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = currencyinfo.Narration; sprmparam = sccmd.Parameters.Add("@isDefault", SqlDbType.Bit); sprmparam.Value = currencyinfo.IsDefault; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = currencyinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = currencyinfo.Extra2; object ObjCurrencytId = sccmd.ExecuteScalar(); if (ObjCurrencytId != null) { decCurrencyId = Convert.ToDecimal(ObjCurrencytId.ToString()); } else { decCurrencyId = 0; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return decCurrencyId; }
/// <summary> /// Function to get all the values from Currency Table based on the parameter /// </summary> /// <param name="currencyId"></param> /// <returns></returns> public CurrencyInfo CurrencyView(decimal currencyId) { CurrencyInfo currencyinfo = new CurrencyInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("CurrencyView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal); sprmparam.Value = currencyId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { currencyinfo.CurrencyId = decimal.Parse(sdrreader[0].ToString()); currencyinfo.CurrencySymbol = sdrreader[1].ToString(); currencyinfo.CurrencyName = sdrreader[2].ToString(); currencyinfo.SubunitName = sdrreader[3].ToString(); currencyinfo.NoOfDecimalPlaces = int.Parse(sdrreader[4].ToString()); currencyinfo.Narration = sdrreader[5].ToString(); currencyinfo.IsDefault = bool.Parse(sdrreader[6].ToString()); currencyinfo.Extra1 = sdrreader[8].ToString(); currencyinfo.Extra2 = sdrreader[9].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return currencyinfo; }
public CurrencyInfo CurrencyView(decimal currencyId) { CurrencyInfo currencyinfo = new CurrencyInfo(); try { currencyinfo = SpCurrency.CurrencyView(currencyId); } catch (Exception ex) { MessageBox.Show("C1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return currencyinfo; }