예제 #1
0
    public void updateProduct(DataManager.product prod, string name)
    {
        string command = "UPDATE [Product] SET category='" + prod.category + "', name='" + prod.name + "',image='" + prod.img + "' WHERE company_name='" + prod.company + "' AND name='" + name + "'";

        con.Open();
        SqlCommand com2 = new SqlCommand(command, con);

        com2.ExecuteNonQuery();
        con.Close();
    }
 public void SetPickUp(DataManager.product product)
 {
     if (hasProduct)
     {
         return;
     }
     hasProduct = true;
     productSystem[product].productPrefab.SetActive(true);
     currentProduct = product;
 }
예제 #3
0
    public void deleteProduct(DataManager.product prod)
    {
        string command = "DELETE FROM Product WHERE company_name='" + prod.company + "' AND name='" + prod.name + "'";

        con.Open();
        SqlCommand com2 = new SqlCommand(command, con);

        com2.ExecuteNonQuery();
        con.Close();
    }
예제 #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataManager.product deleteProd = new DataManager.product();
        deleteProd.company = company;
        deleteProd.name    = name;
        TaskManager ts = new TaskManager();

        ts.deleteProduct(deleteProd);
        Response.Redirect("Products_A.aspx");
    }
예제 #5
0
    public bool addProdcut(DataManager.product prodcut)
    {
        string command = "INSERT INTO Product (company_name,category,name,image) VALUES('" + prodcut.company + "','" + prodcut.category + "','" + prodcut.name + "','" + prodcut.img + "')";

        con.Open();
        SqlCommand com2 = new SqlCommand(command, con);

        com2.ExecuteNonQuery();
        con.Close();
        return(true);
    }
예제 #6
0
    protected void CreateUser_Click(object sender, EventArgs e)
    {
        string folderPath = Server.MapPath("~/ProdcutsImage/");

        if (!Directory.Exists(folderPath))
        {
            Directory.CreateDirectory(folderPath);
        }
        FileUpload1.SaveAs(folderPath + Path.GetFileName(FileUpload1.FileName));
        DataManager.product product = new DataManager.product();
        product.company  = DropDownList1.SelectedItem.ToString();
        product.category = Category.Text;
        product.name     = Name.Text;
        product.img      = "ProdcutsImage/" + Path.GetFileName(FileUpload1.FileName);
        ts.addProdcut(product);
    }
예제 #7
0
    public List <DataManager.product> getProducts()
    {
        List <DataManager.product> retVal = new List <DataManager.product>();
        string        command             = "SELECT * FROM Product";
        SqlCommand    com = new SqlCommand(command, con);
        SqlDataReader reader;

        con.Open();
        reader = com.ExecuteReader();
        while (reader.Read())
        {
            DataManager.product temp = new DataManager.product();
            temp.company  = reader.GetString(0);
            temp.category = reader.GetString(1);
            temp.name     = reader.GetString(2);
            temp.img      = reader.GetString(3);
            retVal.Add(temp);
        }
        reader.Close();
        con.Close();
        return(retVal);
    }
예제 #8
0
    protected void CreateUser_Click(object sender, EventArgs e)
    {
        DataManager.product updateProd = new DataManager.product();
        updateProd.company  = company;
        updateProd.name     = Name.Text;
        updateProd.category = Category.Text;
        if (FileUpload1.FileName != null && FileUpload1.FileName.Length > 0)
        {
            string folderPath = Server.MapPath("~/ProdcutsImage/");
            FileUpload1.SaveAs(folderPath + Path.GetFileName(FileUpload1.FileName));
            updateProd.img = "ProdcutsImage/" + Path.GetFileName(FileUpload1.FileName);
        }
        else
        {
            updateProd.img = Image1.ImageUrl;
        }
        TaskManager ts = new TaskManager();

        ts.updateProduct(updateProd, name);

        Response.Redirect("Products_A.aspx");
    }