/// <summary> /// Function to Update values in TaxDetails Table /// </summary> /// <param name="taxdetailsinfo"></param> public void TaxDetailsEdit(TaxDetailsInfo taxdetailsinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("TaxDetailsEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@taxdetailsId", SqlDbType.Decimal); sprmparam.Value = taxdetailsinfo.TaxdetailsId; sprmparam = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal); sprmparam.Value = taxdetailsinfo.TaxId; sprmparam = sccmd.Parameters.Add("@selectedtaxId", SqlDbType.Decimal); sprmparam.Value = taxdetailsinfo.SelectedtaxId; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = taxdetailsinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = taxdetailsinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = taxdetailsinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from TaxDetails Table based on the parameter /// </summary> /// <param name="taxdetailsId"></param> /// <returns></returns> public TaxDetailsInfo TaxDetailsView(decimal taxdetailsId) { TaxDetailsInfo taxdetailsinfo = new TaxDetailsInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("TaxDetailsView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@taxdetailsId", SqlDbType.Decimal); sprmparam.Value = taxdetailsId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { taxdetailsinfo.TaxdetailsId = decimal.Parse(sdrreader[0].ToString()); taxdetailsinfo.TaxId = decimal.Parse(sdrreader[1].ToString()); taxdetailsinfo.SelectedtaxId = decimal.Parse(sdrreader[2].ToString()); taxdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[3].ToString()); taxdetailsinfo.Extra1 = sdrreader[4].ToString(); taxdetailsinfo.Extra2 = sdrreader[5].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(taxdetailsinfo); }