コード例 #1
0
ファイル: QuickView.aspx.cs プロジェクト: jahmed25/sfloor
 public void fillproductdetails()
 {
     style  = dt.Rows[0]["StyleCode"] + "".Trim() == "" ? dt.Rows[0]["SKUCode"] + "".Trim() : dt.Rows[0]["StyleCode"] + "";
     isSize = "Size".Equals(dt.Rows[0]["VariantType"] + "") ? "true" : "false";
     if (!StringUtil.isNullOrEmpty(style))
     {
         if ("true".Equals(isSize))
         {
             sizeDT = CatDetailsService.getSizeDT(style, true);
         }
         colorDT = CatDetailsService.getColorDT(style, true);
     }
     else
     {
         if ("true".Equals(isSize))
         {
             sizeDT = CatDetailsService.getSizeDT(style, false);
         }
         colorDT = CatDetailsService.getColorDT(dt.Rows[0]["SKUCode"] + "", false);
     }
     if (!CommonUtil.DT.isEmptyOrNull(colorDT))
     {
         color = colorDT.Rows[0]["Color"] + "";
     }
     isColor   = CommonUtil.DT.isEmptyOrNull(colorDT) ? "false" : "true";
     isSku     = StringUtil.isNullOrEmpty(dt.Rows[0]["StyleCode"] + "") ? "false" : "true";
     inventory = AjaxService.getInventory(dt.Rows[0]["SKUCode"] + "");
     if (inventory < 20)
     {
         if (inventory == 0)
         {
             avalibilty = "Sold Out.";
         }
     }
 }
コード例 #2
0
    private void checkRegMail()
    {
        Errors errors = new Errors();

        if (StringUtil.isNullOrEmpty(Request.Params["email"]))
        {
            errors.addError("email", "Email is required");
        }
        else if (!CommonUtil.isValidEmail(Request.Params["email"]))
        {
            errors.addError("email", "Email id is not valid");
        }
        if (errors.errors.Count == 0)
        {
            DataTable dt = AjaxService.getUser(Request.Params["email"]);
            if (!CommonUtil.DT.isEmptyOrNull(dt))
            {
                errors.addError("email", "Oops!! Email is already registerd");
            }
            else
            {
                errors.addError("info", "Congrats!! Email id is available ");
            }
        }
        if (errors.errors.Count > 0)
        {
            JavaScriptSerializer ser = new JavaScriptSerializer();
            string errorStr          = ser.Serialize(errors);
            Response.Write(errorStr);
            Response.AddHeader("Content-Length", errorStr.Length.ToString());
        }
        Response.ContentType = "application/json";
        Response.Flush();
        Response.Close();
    }
コード例 #3
0
    private void search()
    {
        string           serchKey   = Request.Params["searchKey"];
        List <SearchDTO> searchList = new List <SearchDTO>();
        DataTable        dt         = AjaxService.searchName(serchKey);

        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 10 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["SKUName"] + "";
                sDTO.SearchVal = dt.Rows[i]["SKUCode"] + "";
                sDTO.Src       = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type      = "product";
                searchList.Add(sDTO);
            }
        }
        dt = AjaxService.searchBrand(serchKey);
        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 20 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["SKUBrand"] + "";
                sDTO.SearchVal = dt.Rows[i]["SKUBrand"] + "";
                //   sDTO.Src = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type = "Brand";
                searchList.Add(sDTO);
            }
        }
        dt = AjaxService.searchSubCat(serchKey);
        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 10 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["CategoryTypeUrlName"] + "";
                sDTO.SearchVal = dt.Rows[i]["CategoryTypeID"] + "";
                // sDTO.Src = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type = "category";
                searchList.Add(sDTO);
            }
        }

        dt = AjaxService.searchPType(serchKey);
        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 10 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["SKUProductType"] + "";
                sDTO.SearchVal = dt.Rows[i]["ProductTypeID"] + "";
                //sDTO.Src = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type = "subcategory";
                searchList.Add(sDTO);
            }
        }
        sendResponse(searchList);
    }
コード例 #4
0
    private void toggleFav()
    {
        Session.Remove(Constant.Session.FAV_LIST);
        string sku = Request.Params["sku"];

        Logger.Info("########################  sku " + sku);
        JavaScriptSerializer ser = new JavaScriptSerializer();
        string userId            = "";

        if (Session[Constant.Session.LOGED_IN_USER_ID] != null)
        {
            userId = Session[Constant.Session.LOGED_IN_USER_ID] + "";
        }
        int count = AjaxService.toggleFav(sku, Session.SessionID, userId);

        Logger.Info("########################  count " + count);

        Dictionary <string, string> dic = new Dictionary <string, string>();

        if (count > 0)
        {
            dic.Add("status", "done");
        }
        else
        {
            dic.Add("status", "notDone");
        }
        sendResponse(dic);
    }
コード例 #5
0
ファイル: AjaxService.aspx.cs プロジェクト: jahmed25/sfloor
    private void addFav()
    {
        Session.Remove(Constant.Session.FAV_LIST);
        string sku    = Request.Params["sku"];
        string userId = "";

        if (Session[Constant.Session.LOGED_IN_USER_ID] != null)
        {
            userId = Session[Constant.Session.LOGED_IN_USER_ID] + "";
        }
        Dictionary <string, string> dic = AjaxService.addFav(sku, Session.SessionID, userId);

        if (dic.Count > 0)
        {
            JavaScriptSerializer ser = new JavaScriptSerializer();
            string json = ser.Serialize(dic);
            Response.Write(json);
            Response.AddHeader("Content-Length", json.Length.ToString());
        }
        else
        {
            string json = "Exist";
            Response.Write(json);
            Response.AddHeader("Content-Length", json.Length.ToString());
        }
        Response.Flush();
        Response.Close();
    }
コード例 #6
0
    private static void checkInventroy(string qty, Dictionary <string, string> dic, DataTable dt, string addQTY)
    {
        int inventory = 0;

        if (StringUtil.isNullOrEmpty(addQTY))
        {
            inventory = AjaxService.getInventory(dt.Rows[0]["SKUCode"] + "");
        }
        else
        {
            inventory = AjaxService.getInventory(dt.Rows[0]["SKU"] + "");
        }

        if (inventory == 0)
        {
            dic.Add("error", "Product is Sold Out!!");
        }
        else if (inventory < Int32.Parse(qty))
        {
            string msg = "Only " + inventory + " Product(s) are left in inventory!!";
            if (!StringUtil.isNullOrEmpty(addQTY))
            {
                msg += "You already added " + addQTY + " Items(s) in Your Cart";
            }
            dic.Add("error", msg);
        }
    }
コード例 #7
0
    private void checkInventory()
    {
        DataTable dt = CartDAO.getCartDT(Session.SessionID);
        List <Dictionary <string, string> > errorList = new List <Dictionary <string, string> >();

        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();
                int inventory = AjaxService.getInventory(dt.Rows[i]["SKU"] + "");
                if (inventory == 0)
                {
                    dic.Add("sku", dt.Rows[i]["SKU"] + "");
                    dic.Add("error", "Oops!! Sorry, Items is Sold Out");
                }
                else if (inventory < Int32.Parse(dt.Rows[i]["QTY"] + ""))
                {
                    string msg = "Only " + inventory + " Item(s) are left in inventory!!";
                    dic.Add("sku", dt.Rows[i]["SKU"] + "");
                    dic.Add("error", msg);
                }
                if (dic.Count > 0)
                {
                    errorList.Add(dic);
                }
            }
        }
        sendResponse(errorList);
    }
コード例 #8
0
ファイル: CompareItems.aspx.cs プロジェクト: jahmed25/fnf
    public String availbilty(string sku)
    {
        int inventory = AjaxService.getInventory(sku);

        if (inventory == 0)
        {
            return("Sold Out.");
        }
        return("Available In Stock");
    }
コード例 #9
0
    private void clearCart()
    {
        AjaxService.clearCart(Session.SessionID);
        Session.Remove(Constant.Session.CART_ITEMS);
        Session.Remove(Constant.Session.TOTAL);
        Dictionary <string, string> dic = new Dictionary <string, string>();

        dic.Add("status", "done");
        sendResponse(dic);
    }
コード例 #10
0
    private void getState()
    {
        string        startWith = Request.Params["startWith"];
        List <string> stareList = AjaxService.getStateDT(startWith);

        if (stareList.Count >= 10)
        {
            stareList = stareList.GetRange(0, 10);
        }
        sendResponse(stareList);
    }
コード例 #11
0
    private void getPin()
    {
        string        pinStartWith = Request.Params["startWith"];
        List <string> pinList      = AjaxService.getPinDT(pinStartWith);

        if (pinList.Count >= 10)
        {
            pinList = pinList.GetRange(0, 10);
        }
        sendResponse(pinList);
    }
コード例 #12
0
    private void getCity()
    {
        string        startWith = Request.Params["startWith"];
        List <string> cityList  = AjaxService.getCityDT(startWith);

        if (cityList.Count >= 10)
        {
            cityList = cityList.GetRange(0, 10);
        }
        sendResponse(cityList);
    }
コード例 #13
0
    private void login()
    {
        Errors errors = validateLogin();

        if (errors.errors.Count == 0)
        {
            try
            {
                DataTable dt = AjaxService.getUser(Request.Params["email"]);
                if (!CommonUtil.DT.isEmptyOrNull(dt))
                {
                    if (Request.Params["pwd"].Equals(dt.Rows[0]["PASSWORD"]))
                    {
                        Session[Constant.Session.LOGED_IN_USER_ID] = dt.Rows[0]["ID"];
                        Session[Constant.Session.LOGED_IN_EMAIL]   = dt.Rows[0]["EMAIL"];
                        JavaScriptSerializer        ser = new JavaScriptSerializer();
                        Dictionary <string, string> d   = new Dictionary <string, string>();
                        d.Add("info", "success");
                        updateSessionIdInTable();
                        string errorStr = ser.Serialize(d);
                        Response.Write(errorStr);
                        Response.AddHeader("Content-Length", errorStr.Length.ToString());
                    }
                    else
                    {
                        errors.addError("pwd", "Opps!! You typed wrong password");
                    }
                }
                else
                {
                    errors.addError("email", "Opps!! Email id is not Registerd");
                }
            }
            catch
            {
                errors.addError("system", "Oops!! internal server error, Please try again!");
            }
        }
        if (errors.errors.Count > 0)
        {
            JavaScriptSerializer ser = new JavaScriptSerializer();
            string errorStr          = ser.Serialize(errors);
            Response.Write(errorStr);
            Response.AddHeader("Content-Length", errorStr.Length.ToString());
        }
        Response.ContentType = "application/json";
        Response.Flush();
        Response.Close();
    }
コード例 #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         cartDT   = HomeService.getCartDT(Session.SessionID);
         subTotal = HomeService.getTotal();
         total    = (float.Parse(HomeService.getTotal()) + 49).ToString();
         invDic   = AjaxService.checkInventory(cartDT, Session.SessionID);
     }
     catch
     {
         invDic = new Dictionary <string, string>();
         cartDT = new DataTable();
     }
 }
コード例 #15
0
    private void addShipping()
    {
        string email     = Request.Params["email"];
        string name      = Request.Params["fname"];
        string phone     = Request.Params["phone"];
        string pin       = Request.Params["pin"];
        string city      = Request.Params["city"];
        string state     = Request.Params["state"];
        string address   = Request.Params["address"];
        string sessionId = Session.SessionID;
        string userId    = Session[Constant.Session.LOGED_IN_USER_ID] != null ? Session[Constant.Session.LOGED_IN_USER_ID] + "" : "";
        bool   status    = AjaxService.addShipping(email, name, phone, pin, city, state, address, sessionId, userId);
        Dictionary <string, string> dic = new Dictionary <string, string>();

        dic.Add("status", status.ToString());
        Session[Constant.Session.SHIPING_EMAIL] = email;
        sendResponse(dic);
    }
コード例 #16
0
ファイル: Checkout.aspx.cs プロジェクト: jahmed25/sfloor
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         cartDT   = HomeService.getCartDT(Session.SessionID);
         subTotal = HomeService.getTotal();
         total    = (float.Parse(HomeService.getTotal()) + 49).ToString();
         invDic   = AjaxService.checkInventory(cartDT, Session.SessionID);
         String userId = Session[Constant.Session.LOGED_IN_USER_ID] + "";
         if (!StringUtil.isNullOrEmpty(userId))
         {
             shipDT = ShippingDAO.getShippinByUserID(userId);
         }
     }
     catch
     {
         cartDT = new DataTable();
     }
 }
コード例 #17
0
    private void addFav()
    {
        Session.Remove(Constant.Session.FAV_LIST);
        string sku = Request.Params["sku"];
        JavaScriptSerializer ser = new JavaScriptSerializer();
        string userId            = "";

        if (Session[Constant.Session.LOGED_IN_USER_ID] != null)
        {
            userId = Session[Constant.Session.LOGED_IN_USER_ID] + "";
        }
        Dictionary <string, string> dic = AjaxService.addFav(sku, Session.SessionID, userId);

        if (dic.Count == 0)
        {
            dic = new Dictionary <string, string>();
            dic.Add("error", "Exist");
        }
        sendResponse(dic);
    }
コード例 #18
0
    private void doPaymint()
    {
        Dictionary <string, string> inventDic = AjaxService.checkInventory(null, Session.SessionID);

        if (inventDic.Count == 0)
        {
            String payMode = "COD";// this is hard code need to be change when paymint gatway will intigrate
            string orderId = AjaxService.createOrder(Session.SessionID, Session[Constant.Session.SHIPING_EMAIL] + "", payMode, Session[Constant.Session.LOGED_IN_USER_ID] + "");
            Session[Constant.Session.CURRENT_ORDER] = orderId;
            AjaxService.updateInventroy(Session.SessionID);
            AjaxService.clearCart(Session.SessionID);
            Session.Remove(Constant.Session.CART_ITEMS);
            Session.Remove(Constant.Session.TOTAL);
            EmailTemplateService.sendOrderPlacedEmail();
            Response.Redirect(ConfigUtil.hostURL() + "order-summary");
        }
        else
        {
            Response.Redirect(ConfigUtil.hostURL() + "check-out");
        }
    }
コード例 #19
0
    private void register()
    {
        Dictionary <String, String> param = new Dictionary <String, String>();
        Errors errors = validateRegister(param);

        if (errors.errors.Count == 0)
        {
            try
            {
                param.Add("@SESSION_ID", Session.SessionID);
                int userId = AjaxService.register(param);
                Session[Constant.Session.LOGED_IN_USER_ID] = userId.ToString();
                Session[Constant.Session.LOGED_IN_EMAIL]   = Request.Params["email"];
                JavaScriptSerializer        ser = new JavaScriptSerializer();
                Dictionary <string, string> d   = new Dictionary <string, string>();
                d.Add("info", "success");
                string errorStr = ser.Serialize(d);
                Response.Write(errorStr);
                Response.AddHeader("Content-Length", errorStr.Length.ToString());
            }
            catch (NotSupportedException e)
            {
                errors.addError("email", "Email id is already Registerd");
            }
            catch
            {
                errors.addError("system", "Oops!! internal server error, Please try again!");
            }
        }
        if (errors.errors.Count > 0)
        {
            JavaScriptSerializer ser = new JavaScriptSerializer();
            string errorStr          = ser.Serialize(errors);
            Response.Write(errorStr);
            Response.AddHeader("Content-Length", errorStr.Length.ToString());
        }
        Response.ContentType = "application/json";
        Response.Flush();
        Response.Close();
    }
コード例 #20
0
    private async Task Fail()
    {
        var option = new AjaxOption
        {
            Url  = "/api/Login",
            Data = new User()
            {
                UserName = "******", Password = "******"
            }
        };
        var result = await AjaxService.GetMessage(option);

        if (result == null)
        {
            ResultMessage = "响应失败";
        }
        else
        {
            ResultMessage = result;
            var doc = JsonDocument.Parse(result);
            if (200 == doc.RootElement.GetProperty("code").GetInt32())
            {
                await SwalService.Show(new SwalOption()
                {
                    Content = "登录成功!", Category = SwalCategory.Success
                });
            }
            else
            {
                await SwalService.Show(new SwalOption()
                {
                    Content = $"登录失败:{doc.RootElement.GetProperty("message").GetString()}", Category = SwalCategory.Error
                });
            }
        }
    }
コード例 #21
0
    private void BindGrid()
    {
        String productType = Request.Params["Pid"] == null ? null : Request.Params["Pid"].Trim();
        String catType     = Request.Params["CategoryType"] == null ? null : Request.Params["CategoryType"].Trim();

        if (Request.Params["searchId"] != null)
        {
            string searchType = Request.Params["searchType"].Trim().ToLower();
            string searchId   = Request.Params["searchId"].Trim();
            switch (searchType)
            {
            case "product": {
                prodDt = AjaxService.getProdBySKU(searchId);
                prodDt = addColm(prodDt);
                //ProdList.DataBind();
                if (!CommonUtil.DT.isEmptyOrNull(prodDt))
                {
                    productType = prodDt.Rows[0]["ProductTypeID"] as string;
                }
                break;
            }

            case "category":
            {
                catType = searchId;
                break;
            }

            case "subcategory":
            {
                productType = searchId;
                break;
            }

            case "brand":
            {
                dt = CategoriesService.getProductByBrand(searchId, 1);
                break;
            }
            }
        }
        if (!StringUtil.isNullOrEmpty(productType))
        {
            dt = CategoriesService.getProductByPTypeId(productType, 1);
            if (!CommonUtil.DT.isEmptyOrNull(dt))
            {
                PType = productType;
            }
        }
        else if (!StringUtil.isNullOrEmpty(catType))
        {
            dt = CategoriesService.getProductByCatType(catType, 1);
        }
        CommonUtil.DtNullCheck(dt);
        if (null != dt && dt.Rows.Count > 0)
        {
            fillCategory(dt);
            fillCategoryNamePanal();
            fillBrandPanal();
        }
        String pType = getProductType();
    }
コード例 #22
0
ファイル: AjaxService.aspx.cs プロジェクト: jahmed25/sfloor
 private void clearCart()
 {
     AjaxService.clearCart(Session.SessionID);
     Session.Remove(Constant.Session.CART_ITEMS);
     Session.Remove(Constant.Session.TOTAL);
 }
コード例 #23
0
    protected void addToCart()
    {
        string qty   = Request.Params["qty"];
        string style = Request.Params["sku"];
        string size  = Request.Params["size"] == null ? "" : Request.Params["size"].Trim();
        string color = Request.Params["color"] == null ? "" : Request.Params["color"].Trim();
        Dictionary <string, string> dic = new Dictionary <string, string>();
        DataTable dt = AjaxService.getProdBySKU(style);

        if (!"Normal".Equals(dt.Rows[0]["SKUClassification"] + ""))
        {
            if (validateProduct().Count > 0)
            {
                sendResponse(dic);
                return;
            }
            else
            {
                if ("Variant".Equals(dt.Rows[0]["SKUClassification"] + ""))
                {
                    style = dt.Rows[0]["StyleCode"] + "";
                }
                dt = AjaxService.getVarientProd(style, size, color);
            }
        }
        DataTable dt1 = GenericDAO.getDataTable("select * from CART where SESSION_ID='" + Session.SessionID + "' and  SKU ='" + dt.Rows[0]["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;
            checkInventroy(t.ToString(), dic, dt1, cartQuantity.ToString());
            if (dic.Count == 0)
            {
                GenericDAO.updateQuery("update CART set QTY ='" + t + "', TOTAL='" + TotalPrice + "' where SESSION_ID='" + Session.SessionID + "' and SKU ='" + dt1.Rows[0]["SKU"] + "'");
                Session.Remove(Constant.Session.CART_ITEMS);
                Session.Remove(Constant.Session.TOTAL);
                dic.Add("success", "done");
            }
        }
        else
        {
            checkInventroy(qty, dic, dt, null);
            if (dic.Count == 0)
            {
                string userID = "";
                int    price  = Convert.ToInt32("" + dt.Rows[0]["SpecialPrice"]);
                int    Total  = price * Int32.Parse(qty);
                if (Session[Constant.Session.LOGED_IN_USER_ID] != null)
                {
                    userID = Session[Constant.Session.LOGED_IN_USER_ID].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);
                dic.Add("success", "success");
            }
        }
        sendResponse(dic);
    }
コード例 #24
0
 private async Task Goto()
 {
     await AjaxService.Goto("/introduction");
 }
コード例 #25
0
 private async Task GotoSelf()
 {
     await AjaxService.Goto("/ajaxs");
 }
コード例 #26
0
 private void clearFav()
 {
     AjaxService.clearFav(Session.SessionID);
     Session.Remove(Constant.Session.FAV_LIST);
 }
コード例 #27
0
 private void getCityState()
 {
     sendResponse(AjaxService.getCityState(Request.Params["pin"]));
 }