Пример #1
0
        /// <summary>
        /// Function for Tax View By ProductId
        /// </summary>
        /// <param name="strProductCode"></param>
        /// <returns></returns>
        public TaxInfo TaxViewByProductId(string strProductCode)
        {
            TaxInfo       taxInfo   = new TaxInfo();
            SqlDataReader sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("TaxViewByProductId", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.VarChar);
                sprmparam.Value = strProductCode;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    taxInfo.TaxId   = Convert.ToDecimal(sdrreader["taxId"].ToString());
                    taxInfo.TaxName = sdrreader["taxName"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(taxInfo);
        }
Пример #2
0
        /// <summary>
        /// Function for insert values and return id
        /// </summary>
        /// <param name="taxinfo"></param>
        /// <returns></returns>
        public decimal TaxAddWithIdentity(TaxInfo taxinfo)
        {
            decimal decTaxId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("TaxAddWithIdentity", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@taxName", SqlDbType.VarChar);
                sprmparam.Value = taxinfo.TaxName;
                sprmparam       = sccmd.Parameters.Add("@applicableOn", SqlDbType.VarChar);
                sprmparam.Value = taxinfo.ApplicableOn;
                sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
                sprmparam.Value = taxinfo.Rate;
                sprmparam       = sccmd.Parameters.Add("@calculatingMode", SqlDbType.VarChar);
                sprmparam.Value = taxinfo.CalculatingMode;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = taxinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
                sprmparam.Value = taxinfo.IsActive;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = taxinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = taxinfo.Extra2;
                object objTaxId = sccmd.ExecuteScalar();
                if (objTaxId != null)
                {
                    decTaxId = decimal.Parse(objTaxId.ToString());
                }
                else
                {
                    decTaxId = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decTaxId);
        }
Пример #3
0
 /// <summary>
 /// Function to insert values to  Tax Table
 /// </summary>
 /// <param name="taxinfo"></param>
 public void TaxAdd(TaxInfo taxinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("TaxAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = taxinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@taxName", SqlDbType.VarChar);
         sprmparam.Value = taxinfo.TaxName;
         sprmparam       = sccmd.Parameters.Add("@applicableOn", SqlDbType.VarChar);
         sprmparam.Value = taxinfo.ApplicableOn;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = taxinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@calculatingMode", SqlDbType.VarChar);
         sprmparam.Value = taxinfo.CalculatingMode;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = taxinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@isActive", SqlDbType.Bit);
         sprmparam.Value = taxinfo.IsActive;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = taxinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = taxinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = taxinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Пример #4
0
        /// <summary>
        /// Function to get particular values from Tax Table based on the parameter
        /// </summary>
        /// <param name="taxId"></param>
        /// <returns></returns>
        public TaxInfo TaxView(decimal taxId)
        {
            TaxInfo       taxinfo   = new TaxInfo();
            SqlDataReader sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("TaxView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
                sprmparam.Value = taxId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    taxinfo.TaxId           = decimal.Parse(sdrreader[0].ToString());
                    taxinfo.TaxName         = sdrreader[1].ToString();
                    taxinfo.ApplicableOn    = sdrreader[2].ToString();
                    taxinfo.Rate            = decimal.Parse(sdrreader[3].ToString());
                    taxinfo.CalculatingMode = sdrreader[4].ToString();
                    taxinfo.Narration       = sdrreader[5].ToString();
                    taxinfo.IsActive        = bool.Parse(sdrreader[6].ToString());
                    taxinfo.ExtraDate       = DateTime.Parse(sdrreader[7].ToString());
                    taxinfo.Extra1          = sdrreader[8].ToString();
                    taxinfo.Extra2          = sdrreader[9].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(taxinfo);
        }