Example #1
0
 /// <summary>
 /// Function to insert values to PurchaseBillTax Table
 /// </summary>
 /// <param name="purchasebilltaxinfo"></param>
 public void PurchaseBillTaxAdd(PurchaseBillTaxInfo purchasebilltaxinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseBillTaxAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@purchaseMasterId", SqlDbType.Decimal);
         sprmparam.Value = purchasebilltaxinfo.PurchaseMasterId;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = purchasebilltaxinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
         sprmparam.Value = purchasebilltaxinfo.TaxAmount;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = purchasebilltaxinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = purchasebilltaxinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = purchasebilltaxinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Example #2
0
        /// <summary>
        /// Function to get particular values from PurchaseBillTax table based on the parameter
        /// </summary>
        /// <param name="purchaseBillTaxId"></param>
        /// <returns></returns>
        public PurchaseBillTaxInfo PurchaseBillTaxView(decimal purchaseBillTaxId)
        {
            PurchaseBillTaxInfo purchasebilltaxinfo = new PurchaseBillTaxInfo();
            SqlDataReader       sdrreader           = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PurchaseBillTaxView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@purchaseBillTaxId", SqlDbType.Decimal);
                sprmparam.Value = purchaseBillTaxId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    purchasebilltaxinfo.PurchaseBillTaxId = decimal.Parse(sdrreader[0].ToString());
                    purchasebilltaxinfo.PurchaseMasterId  = decimal.Parse(sdrreader[1].ToString());
                    purchasebilltaxinfo.TaxId             = decimal.Parse(sdrreader[2].ToString());
                    purchasebilltaxinfo.TaxAmount         = decimal.Parse(sdrreader[3].ToString());
                    purchasebilltaxinfo.ExtraDate         = DateTime.Parse(sdrreader[4].ToString());
                    purchasebilltaxinfo.Extra1            = sdrreader[5].ToString();
                    purchasebilltaxinfo.Extra2            = sdrreader[6].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(purchasebilltaxinfo);
        }