Ejemplo n.º 1
0
        public DataSet CreateOrderID(IAddress AddressObj, ICardDetails CardObj, IUserProfile UserProfileObj)
        {
            string Source = "sp_CreateOrderID";

            try
            {
                object[] paramToken =
                {
                    new MySqlParameter("@aID",        AddressObj.GetAddressID()),
                    new MySqlParameter("@caID",       CardObj.GetCardID()),
                    new MySqlParameter("@paramToken", UserProfileObj.GetToken())
                };
                return(MySQLCommands.Instance().ExecuteQuery(Source, CommandType.StoredProcedure, paramToken));
            }
            catch (Exception ex)
            {
                Logger.Instance().Log(Fatal.Instance(), ex);
                throw ex;
            }
        }
Ejemplo n.º 2
0
 public List <ITaxProducts> CalculateTaxByProduct(ICart cartObj, IAddress AddressObj, IUserProfile UserProfile)
 {
     try
     {
         List <ITaxProducts> ProductList = new List <ITaxProducts>();
         ISecurity           Security    = new Security(UserProfile);
         if (Security.AuthenticateUser() == true)
         {
             DataSet TaxDS     = new TaxManagementDataLayer().GetTaxDetailsFromDB(AddressObj.GetAddressID());
             double  TaxFromDB = Math.Round(double.Parse(TaxDS.Tables[0].Rows[0]["Tax"].ToString()), 2);
             foreach (CartItems Items in cartObj.GetCartItems())
             {
                 double TotalAmount = Math.Round(Items.ProductObj.Price * Items.ProductObj.Quantity * 0.01 * TaxFromDB, 2);
                 ProductList.Add(new TaxProduct(Items.ProductObj.pbsID, TotalAmount));
             }
         }
         return(ProductList);
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }
Ejemplo n.º 3
0
 public ITaxResult CalculateTaxFromCartItems(ICart CartObj, IAddress AddressObj, IUserProfile UserProfile)
 {
     try
     {
         ISecurity Security = new Security(UserProfile);
         if (Security.AuthenticateUser() == true)
         {
             double  PreTaxAmount    = CalculateCartPrice(CartObj);
             DataSet TaxResultFromDB = new TaxManagementDataLayer().GetTaxDetailsFromDB(AddressObj.GetAddressID());
             double  FinalAmount     = PreTaxAmount + CalculateCartTax(PreTaxAmount, TaxResultFromDB);
             return(new TaxResult(true, TaxResultFromDB.Tables[0].Rows[0]["tax_type"].ToString(), double.Parse(TaxResultFromDB.Tables[0].Rows[0]["tax"].ToString()), CalculateCartTax(PreTaxAmount, TaxResultFromDB), FinalAmount, PreTaxAmount));
         }
         return(new TaxResult(false));
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }