Exemple #1
0
    private void updateRecentView(string skuOrStyle)
    {
        int?   pId    = new FrontViewProductDetailsDAO().getProductIDBySkuOrStyle(skuOrStyle);
        String userId = Session["UserID"] == null ? "" : Session["UserID"].ToString();
        String ip     = CommonUtil.GetUser_IP();

        RecentViewDAO.addRecentViewItems(pId, userId, ip, DateTime.Now);
    }
Exemple #2
0
        public static String addToWishList(String sku, string quantity, string userId, String Size)
        {
            FrontViewProductDetailsDAO fvpd = new FrontViewProductDetailsDAO();
            DataTable dt = fvpd.getaddtowishlistdetails(sku);

            if (dt.Rows.Count > 0)
            {
                string VariantType = dt.Rows[0]["VariantType"].ToString();
                if (VariantType == "Size" && Size == null)
                {
                    return(SIZE_NOT_DEFINE);
                }
                int                         t          = Convert.ToInt32(quantity);
                int                         u          = Convert.ToInt32(dt.Rows[0]["SpecialPrice"].ToString());
                int                         TotalPrice = t * u;
                FrontendCartDAO             fec        = new FrontendCartDAO();
                Dictionary <string, string> paramDic   = new Dictionary <string, string>();
                paramDic.Add("@AddToWaitList_UserID", userId);
                paramDic.Add("@AddToWaitList_ProductID", dt.Rows[0]["ImageNewID"].ToString());
                paramDic.Add("@AddToWaitList_AddToWaitListName", userId);
                paramDic.Add("@AddToWaitList_ImagePath", dt.Rows[0]["PathInternaldetailsSmallImage"].ToString());
                paramDic.Add("@AddToWaitList_BrandName", dt.Rows[0]["SKUBrand"].ToString());
                paramDic.Add("@AddToWaitList_ProductName", dt.Rows[0]["SKUName"].ToString());
                paramDic.Add("@AddToWaitList_Color", dt.Rows[0]["Color"].ToString());
                paramDic.Add("@AddToWaitList_Size", dt.Rows[0]["Size"].ToString());
                paramDic.Add("@AddToWaitList_EstimatedDelivery", "03/12/13 - 03/18/13");
                paramDic.Add("@AddToWaitList_TimeRemainning", "This item is no longer reserved.");
                paramDic.Add("@AddToWaitList_UnitPrice", dt.Rows[0]["SpecialPrice"].ToString());
                paramDic.Add("@AddToWaitList_Quantity", quantity);
                paramDic.Add("@AddToWaitList_TotalPrice", TotalPrice.ToString());
                paramDic.Add("@AddToWaitList_Description", "International orders are final sale and non-returnable.");
                paramDic.Add("@AddToWaitList_CreatedName", "MegaFactoryOutlet");
                paramDic.Add("@AddToWaitList_RecordStatus", "1");
                paramDic.Add("@AddToWaistList_ProductSKUCode", sku);
                fec.AddToWishlistByUser(paramDic);
                return(SUCCESS);
            }
            return(FAIL);
        }
Exemple #3
0
    private Dictionary <string, string> validateProduct()
    {
        Dictionary <string, string> dic = new Dictionary <string, string>();
        string size    = Request.QueryString["size"];
        string color   = Request.QueryString["color"];
        string isSize  = Request.QueryString["isSize"];
        string isColor = Request.QueryString["isColor"];
        string isSku   = Request.QueryString["isSku"];
        string style   = Request.QueryString["sku"];
        FrontViewProductDetailsDAO fvpd = new FrontViewProductDetailsDAO();
        DataTable dt = null;

        if ("true".Equals(isColor) && "true".Equals(isSize))
        {
            if (StringUtil.isNullOrEmpty(color))
            {
                dic.Add("error", "Please select the color");
            }
            else if (StringUtil.isNullOrEmpty(size))
            {
                dic.Add("error", "Please select the Size");
            }
            else
            {
                if ("true".Equals(isSku))
                {
                    dt = fvpd.getProdBySkuColorSize(style, color, size);
                }
                else
                {
                    dt = fvpd.getProdByStyleColorSize(style, color, size);
                }
            }
        }
        else if ("true".Equals(isColor))
        {
            if (StringUtil.isNullOrEmpty(color))
            {
                dic.Add("error", "Please select the color");
            }
            else
            {
                if ("true".Equals(isSku))
                {
                    dt = fvpd.getProdBySkuColor(style, color);
                }
                else
                {
                    dt = fvpd.getProdByStyleColor(style, color);
                }
            }
        }
        else if ("true".Equals(isSize))
        {
            if (StringUtil.isNullOrEmpty(size))
            {
                dic.Add("error", "Please select the size");
            }
            else
            {
                if ("true".Equals(isSku))
                {
                    dt = fvpd.getProdBySkuSize(style, size);
                }
                else
                {
                    dt = fvpd.getProdByStyleSize(style, size);
                }
            }
        }
        return(dic);
    }
Exemple #4
0
    protected void addToCart()
    {
        string qty     = Request.QueryString["qty"];
        string size    = Request.QueryString["size"];
        string color   = Request.QueryString["color"];
        string isSize  = Request.QueryString["isSize"];
        string isColor = Request.QueryString["isColor"];
        string isSku   = Request.QueryString["isSku"];
        string style   = Request.QueryString["sku"];

        Session.Remove("sessExpire");
        FrontViewProductDetailsDAO fvpd = new FrontViewProductDetailsDAO();

        Session.Remove(Constant.Session.PRODUCT_COUNT);
        DataTable dt = null;

        if ("true".Equals(isColor) && "true".Equals(isSize))
        {
            if (StringUtil.isNullOrEmpty(color))
            {
                string msg = "<error>please select the color<error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
                return;
            }
            else if (StringUtil.isNullOrEmpty(size))
            {
                string msg = "<error>please select the size<error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
                return;
            }
            else
            {
                if ("true".Equals(isSku))
                {
                    dt = fvpd.getProdBySkuColorSize(style, color, size);
                }
                else
                {
                    dt = fvpd.getProdByStyleColorSize(style, color, size);
                }
            }
        }
        else if ("true".Equals(isColor))
        {
            if (StringUtil.isNullOrEmpty(color))
            {
                string msg = "<error>please select the color<error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
                return;
            }
            else
            {
                if ("true".Equals(isSku))
                {
                    dt = fvpd.getProdBySkuColor(style, color);
                }
                else
                {
                    dt = fvpd.getProdByStyleColor(style, color);
                }
            }
        }
        else if ("true".Equals(isSize))
        {
            if (StringUtil.isNullOrEmpty(size))
            {
                string msg = "<error>please select the size<error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
                return;
            }
            else
            {
                if ("true".Equals(isSku))
                {
                    dt = fvpd.getProdBySkuSize(style, size);
                }
                else
                {
                    dt = fvpd.getProdByStyleSize(style, size);
                }
            }
        }
        else
        {
            dt = GenericDAO.getDataTable("select * from View_ImageProductNew_Master where SKUCode='" + style + "'");
        }

        string    skuCode = dt.Rows[0]["SKUCode"] + "";
        DataTable dt1     = GenericDAO.getDataTable("select * from CART where SESSION_ID='" + Session.SessionID + "' and  SKU ='" + skuCode + "'");

        if (!CommonUtil.DT.isEmptyOrNull(dt1))
        {
            int cartQuantity = Int32.Parse(dt1.Rows[0]["QTY"] + "");
            int t            = Convert.ToInt32(qty) + cartQuantity;
            int u            = Convert.ToInt32(dt1.Rows[0]["UNIT_PRICE"] + "");
            int TotalPrice   = t * u;
            if (t <= 20)
            {
                GenericDAO.updateQuery("update   CART set QTY ='" + t + "', TOTAL='" + TotalPrice + "' where SESSION_ID='" + Session.SessionID + "' and SKU ='" + skuCode + "'");
                Session.Remove(Constant.Session.CART_ITEMS);
                Session.Remove(Constant.Session.TOTAL);

                string msg = "success";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
            }
            else
            {
                string msg = "<error>Item is More Than 20</error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
            }
        }
        else
        {
            int inventory = 0;
            if (StringUtil.isNullOrEmpty(dt.Rows[0]["Inventory"] + ""))
            {
                inventory = 0;
            }
            else
            {
                inventory = (int)float.Parse(dt.Rows[0]["Inventory"] as String);
            }
            if (inventory == 0)
            {
                string msg = "<error>Product is Sold Out!!</error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
            }
            else if (inventory < Int32.Parse(qty))
            {
                string msg = "<error>Only " + inventory + " Product(s) are left in inventory!!</error>";
                Response.Write(msg);
                Response.AddHeader("Content-Length", msg.Length.ToString());
                Response.Flush();
                Response.Close();
            }
            else
            {
                string userID = "";
                int    price  = Convert.ToInt32("" + dt.Rows[0]["SpecialPrice"]);
                int    Total  = price * Int32.Parse(qty);
                if (Session[Constant.Session.LOGED_IN_EMAIL] != null)
                {
                    userID = Session[Constant.Session.LOGED_IN_EMAIL].ToString();
                }
                CartDAO.addToCart(Session.SessionID, qty, price.ToString(), Total.ToString(), dt.Rows[0]["SKUCode"] + "", userID);
                Session.Remove(Constant.Session.CART_ITEMS);
                Session.Remove(Constant.Session.TOTAL);
                Response.Write("success");
                Response.AddHeader("Content-Length", "success".Length.ToString());
                Response.Flush();
                Response.Close();
            }
        }
    }
Exemple #5
0
        public static String initAddToCart(HttpContext context, String htm, string quantity)
        {
            HttpSessionState           Session      = context.Session;
            HttpResponse               Response     = context.Response;
            HttpRequest                Request      = context.Request;
            String                     finalSkuCode = "";
            DataTable                  dtSku        = null;
            FrontendCartDAO            fec1         = new FrontendCartDAO();
            FrontViewProductDetailsDAO fvpd         = new FrontViewProductDetailsDAO();

            if (("true".Equals(Session["isSize"]) && "true".Equals(Session["isColor"])) || (Session["pSize"] != null && Session["pColor"] != null))
            {
                dtSku = fvpd.getProdBySkuColorSize(Session["PSKUCode"] as String, Session["pColor"] as String, Session["pSize"] as String);
                if (dtSku.Rows.Count == 0)
                {
                    dtSku = fvpd.getProdBySkuColorSize(Session["PSKUCode"] as String, Session["pColor"] as String, Session["pSize"] as String);
                }
            }
            else if (("true".Equals(Session["isSize"]) && !"true".Equals(Session["isColor"])) || (Session["pSize"] != null && Session["pColor"] == null))
            {
                dtSku = fvpd.getProdByStyleSize(Session["PSKUCode"] as String, Session["pSize"] as String);
                if (dtSku.Rows.Count == 0)
                {
                    dtSku = fvpd.getSkuCodeBySize1(Session["PSKUCode"] as String, Session["pColor"] as String);
                }
            }
            else if ((!"true".Equals(Session["isSize"]) && "true".Equals(Session["isColor"])) || (Session["pSize"] == null && Session["pColor"] != null))
            {
                dtSku = fvpd.getProdByStyleColor(Session["PSKUCode"] as String, Session["pColor"] as String);
                if (dtSku.Rows.Count == 0)
                {
                    dtSku = fvpd.getSkuCodeByColor1(Session["PSKUCode"] as String, Session["pColor"] as String);
                }
            }
            if (null != dtSku && dtSku.Rows.Count > 0)
            {
                finalSkuCode = dtSku.Rows[0]["SKUCode"] as String;
            }
            if ("".Equals(finalSkuCode) || null == finalSkuCode)
            {
                finalSkuCode = htm;
            }
            if (null == dtSku || dtSku.Rows.Count > 0)
            {
                dtSku = fec1.getproductdetails(finalSkuCode);
            }
            if (Session["UserID"] == null)
            {
                Response.Redirect(Request.UrlReferrer.ToString());
            }
            DataTable dt_addToCart = fec1.getaddtocartproductfornew(Convert.ToInt32(Session["UserID"].ToString()), finalSkuCode);

            if (dt_addToCart.Rows.Count > 0)
            {
                int cartQuantity = Int32.Parse(dt_addToCart.Rows[0]["Quantity"] as string);
                int t            = Convert.ToInt32(quantity) + cartQuantity;
                int u            = Convert.ToInt32(dt_addToCart.Rows[0]["UnitPrice"] as string);
                int TotalPrice   = t * u;
                if (t <= 20)
                {
                    fec1.updateaddtocartproductdetails(Session["UserID"].ToString() as string, finalSkuCode, t, TotalPrice);
                    Response.Redirect(ConfigUtil.hostURL() + "Add-To-Cart");
                }
                else
                {
                    return(MORE_THAN_FIVE_ITEM);
                }
            }
            else if (dtSku.Rows.Count > 0)
            {
                if ("Size".Equals(dtSku.Rows[0]["VariantType"]))
                {
                    if (Session["pSize"] == null)
                    {
                        return(SIZE_NOT_DEFINE);
                    }
                    else
                    {
                        addToCart(dtSku, quantity, Session);
                        Response.Redirect(ConfigUtil.hostURL() + "Add-To-Cart");
                    }
                }
                else
                {
                    addToCart(dtSku, quantity, Session);
                    Response.Redirect(ConfigUtil.hostURL() + "Add-To-Cart");
                }
            }
            return(SIZE_NOT_DEFINE);
        }