Example #1
0
        //public DataTable CartProducts()
        //{
        //    BLL.BLL balobj = new BLL.BLL();
        //    DataSet ds = new DataSet();
        //    Cart cart = new Cart();

        //    DataTable dt = cart.itemTable();
        //    DataTable dtt = cart.ViewCartTable();
        //    DataTable dtt1 = cart.ViewCartTable();

        //    ds = balobj.Get_Products("");
        //    dt = HttpContext.Current.Session["Cart"] as DataTable;

        //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //    {
        //        dtt.Rows.Add(ds.Tables[0].Rows[i]["ProductID"].ToString(),
        //                   ds.Tables[0].Rows[i]["Productname"].ToString(),
        //                   GlobalVarables.Image_Url() + ds.Tables[0].Rows[i]["Product_ImgUrl"].ToString(),
        //                   "0",
        //                   ds.Tables[0].Rows[i]["DistributorPrice"].ToString(),
        //                   ds.Tables[0].Rows[i]["DistributorPrice"].ToString());
        //    }
        //    if (dt != null & dtt != null)
        //    {
        //        if (dt.Rows.Count > 0 & dtt.Rows.Count > 0)
        //        {
        //            var result = from dataRows1 in dtt.AsEnumerable()
        //                         join dataRows2 in dt.AsEnumerable()
        //                         on dataRows1.Field<string>("ProductID") equals dataRows2.Field<string>("Productid")
        //                         select dtt1.LoadDataRow(new object[]
        //                    {
        //                        dataRows1.Field<string>("ProductID"),
        //                        dataRows1.Field<string>("Productname"),
        //                        dataRows1.Field<string>("Product_ImgUrl"),
        //                        dataRows2.Field<string>("Quantity"),
        //                        dataRows1.Field<string>("Unitmrpprice"),
        //                        (Convert.ToDouble(dataRows2.Field<string>("Quantity")) * Convert.ToDouble(dataRows1.Field<string>("Unitmrpprice"))).ToString(),
        //                        dataRows2.Field<string>("Size"),
        //                        dataRows2.Field<string>("Color")
        //                    }, false);
        //            return result.CopyToDataTable();
        //        }
        //        else
        //            return dtt1;
        //    }
        //    else
        //        return dtt1;
        //}
        public DataTable CartProducts()
        {
            BLL.BLL balobj = new BLL.BLL();
            DataSet ds     = new DataSet();
            Cart    cart   = new Cart();

            DataTable dt   = cart.itemTable();
            DataTable dtt  = cart.ViewCartTable();
            DataTable dtt1 = cart.ViewCartTable();

            ds = balobj.Get_Products("");
            dt = HttpContext.Current.Session["Cart"] as DataTable;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                dtt.Rows.Add(ds.Tables[0].Rows[i]["ProductID"].ToString(),
                             ds.Tables[0].Rows[i]["Productname"].ToString(),
                             GlobalVarables.Image_Url() + ds.Tables[0].Rows[i]["Product_ImgUrl"].ToString(),
                             "0",
                             ds.Tables[0].Rows[i]["DistributorPrice"].ToString(),
                             ds.Tables[0].Rows[i]["DistributorPrice"].ToString());
            }
            if (dt != null & dtt != null)
            {
                if (dt.Rows.Count > 0 & dtt.Rows.Count > 0)
                {
                    var result = from dataRows1 in dtt.AsEnumerable()
                                 join dataRows2 in dt.AsEnumerable()
                                 on dataRows1.Field <string>("ProductID") equals dataRows2.Field <string>("Productid")
                                 select dtt1.LoadDataRow(new object[]
                    {
                        dataRows1.Field <string>("ProductID"),
                        dataRows1.Field <string>("Productname"),
                        dataRows1.Field <string>("Product_ImgUrl"),
                        dataRows2.Field <string>("Quantity"),
                        dataRows1.Field <string>("Unitmrpprice"),
                        (Convert.ToDouble(dataRows2.Field <string>("Quantity")) * Convert.ToDouble(dataRows1.Field <string>("Unitmrpprice"))).ToString()
                    }, false);

                    return(result.CopyToDataTable());
                }
                else
                {
                    return(dtt1);
                }
            }
            else
            {
                return(dtt1);
            }
        }
Example #2
0
        public static bool login(System.Web.SessionState.HttpSessionState session, string accno, string pwd)
        {
            DataSet loginds = new DataSet();

            BLL.BLL balobj = new BLL.BLL();
            loginds = balobj.Account_Login(accno, pwd);
            if (GlobalVarables.chkdataset(loginds))
            {
                session["member"] = loginds.Tables[0].Rows[0]["AccountNo"].ToString();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public DataTable RemoveProd_Cart(string prodID)
        {
            DataTable dt_cart = new DataTable();
            DataTable dt      = HttpContext.Current.Session["Cart"] as DataTable;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["Productid"].ToString() == prodID)
                {
                    dt.Rows[i].Delete();
                }
            }
            HttpContext.Current.Session["Cart"] = dt;

            /*
             * var result = dt.AsEnumerable().Where(r => r.Field<string>("Productid") == prodID);
             * foreach (var row in result.ToList())
             *  row.Delete();
             */

            dt_cart = new GlobalVarables().CartProducts();
            return(dt_cart);
        }
Example #4
0
        public DataTable Update_SessionCart(string prodID, string Qty)
        {
            DataTable dt_cart = new DataTable();
            DataTable dt      = new DataTable();

            dt = HttpContext.Current.Session["Cart"] as DataTable;
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["Productid"].ToString() == prodID)
                {
                    dr["Quantity"] = Qty;
                }
            }
            HttpContext.Current.Session["Cart"] = dt;

            /*
             * var result = dt.AsEnumerable().Where(r => r.Field<string>("Productid") == prodID);
             * foreach (var row in result)
             *  row.SetField("Quantity", Qty);
             */

            dt_cart = new GlobalVarables().CartProducts();
            return(dt_cart);
        }