/// <summary> /// Function to SalesBill Tax Edit By using SalesMasterId And TaxId /// </summary> /// <param name="salesbilltaxinfo"></param> public void SalesBillTaxEditBySalesMasterIdAndTaxId(SalesBillTaxInfo salesbilltaxinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalesBillTaxEditBySalesMasterIdAndTaxId", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@salesMasterId", SqlDbType.Decimal); sprmparam.Value = salesbilltaxinfo.SalesMasterId; sprmparam = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal); sprmparam.Value = salesbilltaxinfo.TaxId; sprmparam = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal); sprmparam.Value = salesbilltaxinfo.TaxAmount; sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime); sprmparam.Value = salesbilltaxinfo.ExtraDate; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = salesbilltaxinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = salesbilltaxinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to get particular values from SalesBillTax Table based on the parameter /// </summary> /// <param name="salesBillTaxId"></param> /// <returns></returns> public SalesBillTaxInfo SalesBillTaxView(decimal salesBillTaxId) { SalesBillTaxInfo salesbilltaxinfo = new SalesBillTaxInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalesBillTaxView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@salesBillTaxId", SqlDbType.Decimal); sprmparam.Value = salesBillTaxId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { salesbilltaxinfo.SalesBillTaxId = decimal.Parse(sdrreader[0].ToString()); salesbilltaxinfo.SalesMasterId = decimal.Parse(sdrreader[1].ToString()); salesbilltaxinfo.TaxId = decimal.Parse(sdrreader[2].ToString()); salesbilltaxinfo.TaxAmount = decimal.Parse(sdrreader[3].ToString()); salesbilltaxinfo.ExtraDate = DateTime.Parse(sdrreader[4].ToString()); salesbilltaxinfo.Extra1 = sdrreader[5].ToString(); salesbilltaxinfo.Extra2 = sdrreader[6].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(salesbilltaxinfo); }