Пример #1
0
        private void BindAllProductsRptr()
        {
            DataTable categoryData = new DataTable();

            if (Request.QueryString["type"].Trim().Equals("All"))
            {
                //h1noOfItems.InnerText = "My Products if";
                SqlCommand cmd = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails");
                categoryData = access.SelectFromDatabase(cmd);
            }
            else
            {
                string gender = Request.QueryString["type"].Trim('#');
                h1noOfItems.InnerText = "My Products";
                SqlCommand cmd = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails where Gender=@gender");
                cmd.Parameters.AddWithValue("@gender", gender);
                categoryData = access.SelectFromDatabase(cmd);
            }

            if (categoryData.Rows.Count > 0)
            {
                h1noOfItems.InnerText     = "My Products";
                MyProductsRptr.DataSource = categoryData;
                MyProductsRptr.DataBind();
            }
            else
            {
                h1noOfItems.InnerText       = "No products";
                MyProductsRptr.DataSource   = null;
                MyProductsRptr.DataSourceID = null;
                MyProductsRptr.DataBind();
            }
        }
        public DataTable checkCategory(string cat)
        {
            DataTable  dt  = new DataTable();
            SqlCommand cmd = new SqlCommand("SELECT * FROM ProductCategory WHERE ProductCatName='" + cat + "'");

            dt = access.SelectFromDatabase(cmd);
            return(dt);
        }
Пример #3
0
        private void BrandRepeater()
        {
            SqlCommand cmd = new SqlCommand("Select TOP 3 ImageData from Vendor ORDER BY VendorId DESC");

            brandData = access.SelectFromDatabase(cmd);

            BrandRptr.DataSource = brandData;
            BrandRptr.DataBind();
        }
Пример #4
0
 public void BindCartNumber()
 {
     if (Session["Customer"] != null)
     {
         DataTable  idTab = new DataTable();
         SqlCommand cmd2  = new SqlCommand("SELECT CustomerID  FROM CustomerDetails WHERE CustomerEmailAddress = @email");
         cmd2.Parameters.AddWithValue("@email", Session["Customer"].ToString());
         idTab = access.SelectFromDatabase(cmd2);
         foreach (DataRow rows in idTab.Rows)
         {
             cId = Convert.ToInt64(rows["CustomerID"]);
         }
         if (Request.Cookies["OrderID" + cId.ToString()] != null)
         {
             string   CookiePID    = Request.Cookies["OrderID" + cId.ToString()]["ProductID"].Split('=')[0];
             string[] ProductArray = CookiePID.Split(',');
             int      ProductCount = ProductArray.Length;
             pCount.InnerText = ProductCount.ToString();
         }
         else
         {
             pCount.InnerText = 0.ToString();
         }
     }
     else
     {
         pCount.InnerText = 0.ToString();
     }
 }
Пример #5
0
        private string getUserName()
        {
            String     userName = string.Empty;
            DataTable  user     = new DataTable();
            SqlCommand cmd2     = new SqlCommand("SELECT CustomerName  FROM CustomerDetails WHERE CustomerEmailAddress = @email");

            cmd2.Parameters.AddWithValue("@email", Session["Customer"].ToString());
            user = access.SelectFromDatabase(cmd2);
            foreach (DataRow rows in user.Rows)
            {
                userName = rows["CustomerName"].ToString();
            }
            return(userName);
        }
Пример #6
0
        public void BindCartProducts()
        {
            Int64      OrderID   = Convert.ToInt64(Request.QueryString["OrderID"]);
            DataTable  cartitems = new DataTable();
            SqlCommand cmd       = new SqlCommand("select p.ProductName,p.ImageData, o.OrderQnty, o.OrderTotalPrice from OrderDetails o JOIN PDetails p ON p.ProductCode=o.ProductCode  where OrderID=" + OrderID + "");

            cartitems = access.SelectFromDatabase(cmd);

            if (cartitems.Rows.Count > 0)
            {
                h2NoItems.InnerText         = "Items you buyed (" + cartitems.Rows.Count + ")";
                rptrCartProducts.DataSource = cartitems;
                rptrCartProducts.DataBind();
            }
            else
            {
                //TODO Show Empty Cart
                h2NoItems.InnerText = "Your Shopping Cart is Empty";
            }
        }
        protected bool checkingForPUpdate(int n)
        {
            if (Session["vendor"] != null)
            {
                SqlCommand cmd2 = new SqlCommand(" SELECT * FROM Product where ProductCode=@ProductCode and ProductSize=@Size");
                cmd2.Parameters.AddWithValue("@ProductCode", Request.QueryString["ProductCode"].ToString());
                cmd2.Parameters.AddWithValue("@Size", size[n]);

                DataTable productDetailData = access.SelectFromDatabase(cmd2);
                if (productDetailData.Rows.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
        public bool CheckCode(string code, string email, char t)
        {
            DataTable  dt = new DataTable();
            SqlCommand cmd;

            if (t == 'v')
            {
                cmd = new SqlCommand("SELECT VerificationCode FROM Vendor WHERE VendorEmail=@Email");
                cmd.Parameters.AddWithValue("@Email", email);
                dt = access.SelectFromDatabase(cmd);
            }

            else if (t == 'c')
            {
                cmd = new SqlCommand("SELECT VerificationCode FROM CustomerDetails WHERE CustomerEmailAddress=@Email");
                cmd.Parameters.AddWithValue("@Email", email);
                dt = access.SelectFromDatabase(cmd);
            }

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (code.Equals(dr["VerificationCode"]))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }
            return(false);
        }
Пример #9
0
        private void BindCityRptr()
        {
            DataTable  cityData = new DataTable();
            SqlCommand cmd      = new SqlCommand(" SELECT * from CityTable");

            cityData = access.SelectFromDatabase(cmd);

            if (cityData.Rows.Count != 0)
            {
                custCity.DataSource     = cityData;
                custCity.DataTextField  = "CityName";
                custCity.DataValueField = "Id";
                custCity.DataBind();
                custCity.Items.Insert(0, new ListItem("-Select-", "0"));
            }
        }
Пример #10
0
        private void BindMyProductsRptr()
        {
            DataTable  categoryData = new DataTable();
            SqlCommand cmd          = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails Where VendorId = @VId");

            cmd.Parameters.AddWithValue("@VId", currentVendorId);
            categoryData = access.SelectFromDatabase(cmd);

            if (categoryData.Rows.Count > 0)
            {
                h1noOfItems.InnerText     = "My Products";
                MyProductsRptr.DataSource = categoryData;
                MyProductsRptr.DataBind();
            }
            else
            {
                h1noOfItems.InnerText = "You have not added any product till now";
            }
        }
Пример #11
0
        protected void Signin_Click(object sender, EventArgs e)
        {
            //  int Cid;
            SqlCommand cmd = new SqlCommand("select * from CustomerDetails where CustomerEmailAddress='" + email.Text + "' and CustomerPassword='******'");
            DataTable  dt  = new DataTable();

            dt = access.SelectFromDatabase(cmd);
            if (dt.Rows.Count != 0)
            {
                if (access.checkifAlreadyVerified(email.Text, 'c'))
                {
                    Session["Customer"] = email.Text;
                    if (Request.QueryString["rurl"] != null)
                    {
                        if (Request.QueryString["rurl"] == "view")
                        {
                            Response.Redirect("~/ViewProduct.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("~/AllProducts.aspx");
                    }
                    Session.RemoveAll();
                }

                else
                {
                    Response.Redirect("/Activation.aspx?rurl=notVerifiedCust");
                }
            }
            else
            {
                lblError.Text      = "Invalid Username or password";
                lblError.ForeColor = Color.Red;
            }
        }
Пример #12
0
        private void AddToCart(string quantity, string size)
        {
            Int64 ProductID = Convert.ToInt64(Request.QueryString["ProductCode"]);
            Int64 cId       = 0;

            if (Session["Customer"] != null)
            {
                DataTable  idTab = new DataTable();
                SqlCommand cmd2  = new SqlCommand("SELECT CustomerID  FROM CustomerDetails WHERE CustomerEmailAddress = @email");
                cmd2.Parameters.AddWithValue("@email", Session["Customer"].ToString());
                idTab = access.SelectFromDatabase(cmd2);
                foreach (DataRow rows in idTab.Rows)
                {
                    cId = Convert.ToInt64(rows["CustomerID"]);
                }

                if (Request.Cookies["OrderID" + cId.ToString()] != null)
                {
                    string CookiePID = Request.Cookies["OrderID" + cId.ToString()]["ProductID"].Split('=')[0];
                    CookiePID = CookiePID + "," + ProductID;

                    HttpCookie Order = new HttpCookie("OrderID" + cId.ToString());
                    Order.Values["ProductID"] = CookiePID;

                    string CookieQnty = Request.Cookies["OrderID" + cId.ToString()]["Quantity"].Split('=')[0];
                    CookieQnty = CookieQnty + "," + quantity;
                    Order.Values["Quantity"] = CookieQnty;


                    string CookieSize = Request.Cookies["OrderID" + cId.ToString()]["Size"].Split('=')[0];
                    CookieSize           = CookieSize + "," + size;
                    Order.Values["Size"] = CookieSize;


                    Order.Expires = DateTime.Now.AddDays(30);
                    Response.Cookies.Add(Order);
                }
                else
                {
                    HttpCookie Order = new HttpCookie("OrderID" + cId.ToString());
                    //Order.Values["Customer"] = Session["Customer"].ToString();
                    Order.Values["ProductID"] = ProductID.ToString();
                    Order.Values["Quantity"]  = quantity;
                    Order.Values["Size"]      = size;
                    Order.Expires             = DateTime.Now.AddDays(30);
                    Response.Cookies.Add(Order);
                }
                Response.Redirect("~/Cart.aspx");
            }
            else
            {
                if (Session["vendor"] != null)
                {
                    Response.Redirect("~/MyProducts.aspx");
                }
                else
                {
                    Response.Redirect("/CustLogin.aspx?rurl=view");
                }
            }
        }