Пример #1
0
 public CountryTaxRate this[int CountryID, int TaxClassID]
 {
     get
     {
         for (int i = 0; i < m_CountryTaxRates.Count; i++)
         {
             CountryTaxRate str = (CountryTaxRate)m_CountryTaxRates.GetByIndex(i);
             if (str.CountryID == CountryID && str.TaxClassID == TaxClassID)
             {
                 return(str);
             }
         }
         return(null);
     }
 }
Пример #2
0
 public decimal GetTaxRate(int CountryID, int TaxClassID)
 {
     if (CountryID == 0)
     {
         return(System.Decimal.Zero);
     }
     for (int i = 0; i < m_CountryTaxRates.Count; i++)
     {
         CountryTaxRate ctr = (CountryTaxRate)m_CountryTaxRates.GetByIndex(i);
         if (ctr.CountryID == CountryID && ctr.TaxClassID == TaxClassID)
         {
             return(ctr.TaxRate);
         }
     }
     return(System.Decimal.Zero);
 }
Пример #3
0
        static public CountryTaxRate Create(int CountryID, int TaxClassID, decimal TaxRate)
        {
            int           CountryTaxID = 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_insCountryTaxRate";

            cmd.Parameters.Add(new SqlParameter("@CountryID", 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("@CountryTaxID", SqlDbType.Int, 4)).Direction = ParameterDirection.Output;

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


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

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

            if (CountryTaxID > 0)
            {
                CountryTaxRate ctr = new CountryTaxRate(CountryTaxID);
                return(ctr);
            }

            return(null);
        }
Пример #4
0
 /// <summary>
 /// Creates a new CountryTaxRate record and adds it to the collection
 /// </summary>
 public void Add(int CountryID, int TaxClassID, decimal TaxRate)
 {
     this.Add(CountryTaxRate.Create(CountryID, TaxClassID, TaxRate));
 }
Пример #5
0
 /// <summary>
 /// Adds an existing CountryTaxRate object to the collection
 /// </summary>
 public void Add(CountryTaxRate countrytaxrate)
 {
     m_CountryTaxRates.Add(countrytaxrate.CountryTaxID, countrytaxrate);
 }