Exemplo n.º 1
0
        public bool UpdateProduct(string ProductID, string ProductName, string ProductPrice, string ProductCatagoryID, string ProductStock)
        {
            string qry = "UPDATE Products SET ProductName='" + ProductName + "' , ProductPrice='" + ProductPrice + "' , ProductCatagoryID='" + ProductCatagoryID + "' , ProductStock='" + ProductStock + "' WHERE ProductID='" + ProductID + "'";

            if (DBClient.QueryExecute(qry))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public bool Register()
        {
            string qry = "INSERT INTO Customer ([name],phone,[address],email,pass,registrationDate) " +
                         "VALUES('" + Name + "' , '" + Phone + "' , '" + Address + "' , '" + Email + "' , '" + Password + "','" + DateTime.Now + "')";

            if (DBClient.QueryExecute(qry))  // this method is bool,
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool GetProduct(TextBox ProductID, TextBox ProductName, TextBox ProductPrice, DropDownList ProductCatagoryID, TextBox ProductStock, Image ProductImagePath)
        {
            string qry = "SELECT * FROM Products WHERE ProductID = '" + ProductID.Text + "'";
            Dictionary <string, string> dict = new Dictionary <string, string>();

            if (DBClient.GetProduct(qry, dict))
            {
                ProductName.Text  = dict["ProductName"];
                ProductPrice.Text = dict["ProductPrice"];
                ProductCatagoryID.SelectedValue = dict["ProductCatagoryID"];
                ProductStock.Text         = dict["ProductStock"];
                ProductImagePath.ImageUrl = dict["ProductImagePath"];

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        public bool Login()
        {
            string qry = "SELECT * FROM Customer WHERE email='" + Email + "' AND pass='******'";
            Dictionary <string, string> dict = new Dictionary <string, string>();

            this.LoginStatus = DBClient.Login(qry, dict);
            if (LoginStatus == true)
            {
                this.id       = int.Parse(dict["id"]);
                this.Name     = dict["name"];
                this.Phone    = dict["phone"];
                this.Address  = dict["address"];
                this.Email    = dict["email"];
                this.Password = null;
                HttpContext.Current.Session["customerData"] = this;
                return(LoginStatus);
            }
            else
            {
                return(LoginStatus);
            }
        }
Exemplo n.º 5
0
        public void AddNewProduct()
        {
            string filePath = DBClient.AddNewProduct(ProductName, ProductPrice, ProductCatagoryID, ProductStock);

            ImageUpload.SaveAs(System.Web.HttpContext.Current.Server.MapPath(filePath));
        }