Esempio n. 1
0
    public static string AddToCart(String ItemNo)
    {
        string msg = string.Empty;

        try
        {
            string SplCustPriceGrp = SessionManager.GetSplCustomerPriceGroup(HttpContext.Current);
            Items  itemObj         = Qtm.Lib.Items.Find(Convert.ToString(ItemNo), SessionManager.GetCustomerPriceGroup(HttpContext.Current), Convert.ToString(Constant.ItemColor), SessionManager.GetSplCustomerPriceGroup(HttpContext.Current), SessionManager.GetCustDisPercentage(HttpContext.Current));
            if (itemObj != null)
            {
                if (itemObj.Description != null && itemObj.VariantCode != null && itemObj.UOMCode != null && itemObj.UnitPrice != null)                                                                                                                                                                               //&& itemObj.UnitPrice != null
                {
                    string strMsg = SessionManager.AddProductToCart(Convert.ToString(ItemNo), Convert.ToString(itemObj.Description), Convert.ToString(itemObj.VariantCode), Convert.ToString(itemObj.UOMCode), Convert.ToDecimal(itemObj.UnitPrice), Convert.ToDecimal(1), Convert.ToDecimal(itemObj.DicPercentage)); //Convert.ToDecimal(itemObj.UnitPrice)
                    if (strMsg != string.Empty)
                    {
                        msg = strMsg;
                        //msg = SessionManager.GetCartCount();
                    }
                    else
                    {
                        msg = SessionManager.GetCartCount();
                    }
                }
            }
            else
            {
                //msg = "There is no price available for the product.";
            }
            return(msg);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }