Ejemplo n.º 1
0
 public StateTaxRate this[int StateID, int TaxClassID]
 {
     get
     {
         for (int i = 0; i < m_StateTaxRates.Count; i++)
         {
             StateTaxRate str = (StateTaxRate)m_StateTaxRates.GetByIndex(i);
             if (str.StateID == StateID && str.TaxClassID == TaxClassID)
             {
                 return(str);
             }
         }
         return(null);
     }
 }
Ejemplo n.º 2
0
        public decimal GetTaxRate(int StateID, int TaxClassID)
        {
            if (StateID == 0)
            {
                return(0.0M);
            }

            for (int i = 0; i < m_StateTaxRates.Count; i++)
            {
                StateTaxRate str = (StateTaxRate)m_StateTaxRates.GetByIndex(i);
                if (str.StateID == StateID && str.TaxClassID == TaxClassID)
                {
                    return(str.TaxRate);
                }
            }
            return(0.0M);
        }
Ejemplo n.º 3
0
        static public StateTaxRate Create(int StateID, int TaxClassID, decimal TaxRate)
        {
            int           StateTaxID = 0;
            string        err        = String.Empty;
            SqlConnection cn         = new SqlConnection(DB.GetDBConn());

            cn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "dbo.aspdnsf_insStateTaxRate";

            cmd.Parameters.Add(new SqlParameter("@StateID", SqlDbType.Int, 4));
            cmd.Parameters.Add(new SqlParameter("@TaxClassID", SqlDbType.Int, 4));
            cmd.Parameters.Add(new SqlParameter("@TaxRate", SqlDbType.Decimal, 8));
            cmd.Parameters.Add(new SqlParameter("@StateTaxID", SqlDbType.Int, 4)).Direction = ParameterDirection.Output;

            cmd.Parameters["@StateID"].Value    = StateID;
            cmd.Parameters["@TaxClassID"].Value = TaxClassID;
            cmd.Parameters["@TaxRate"].Value    = TaxRate;

            try
            {
                cmd.ExecuteNonQuery();
                StateTaxID = Int32.Parse(cmd.Parameters["@StateTaxID"].Value.ToString());
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            cn.Close();
            cmd.Dispose();
            cn.Dispose();

            if (StateTaxID > 0)
            {
                StateTaxRate str = new StateTaxRate(StateTaxID);
                return(str);
            }

            return(null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new CountryTaxRate record and adds it to the collection
        /// </summary>
        public void Add(int StateID, int TaxClassID, decimal TaxRate)
        {
            StateTaxRate str = StateTaxRate.Create(StateID, TaxClassID, TaxRate);

            this.Add(str);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Adds an existing StateTaxRate object to the collection
 /// </summary>
 public void Add(StateTaxRate statetaxrate)
 {
     m_StateTaxRates.Add(statetaxrate.StateTaxID, statetaxrate);
 }