Пример #1
0
    protected void _rowdeleting(object sender, GridViewDeleteEventArgs e)
    {
        /* GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
         *
         * Label lbldeleteid = (Label)row.FindControl("lblproid");
         *
         * string query="delete Products where ProductID='" + lbldeleteid.Text + "'";
         * obj.UDI(query);*/
        string query = "delete Products where ProductID='" + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()) + "'";

        obj.UDI(query);

        bind();

        bind();
    }
Пример #2
0
    protected void _rowdeleting(object sender, GridViewDeleteEventArgs e)
    {
        /*GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
         * Label lbldeletename = (Label)row.FindControl("lblcatname");
         *
         * string query="delete Categories where CategoryName='" + lbldeletename.Text + "'";
         *
         * db.UDI(query);
         *
         * //conn.Close();
         * bind();*/

        string query = "delete Categories where CategoryName='" + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()) + "'";

        db.UDI(query);

        bind();
    }
Пример #3
0
    //ecprops prop = new ecprops();


    public bool dal_insert(ecprops p)
    {
        String query = "INSERT INTO Categories VALUES('" + p.CatName + "')";

        b = obj.UDI(query);



        if (b)
        {
            return(true);
        }

        else
        {
            return(false);
        }
    }
    /* public void bind()
     * {
     *   string query = "select Products.ProductID,Products.ProductName,OrderDetails.UnitCost,OrderDetails.Quantity from Products RIGHT JOIN OrderDetails on Products.ProductID=OrderDetails.ProductID where OrderID='" + Request.QueryString["ID"] + "'";
     *   DataSet ds = obj.fillgrid(query);
     *   GridView1.DataSource = ds.Tables[0];
     *   GridView1.DataBind();
     * }*/
    protected void Button1_Click(object sender, EventArgs e)
    {
        dbcon db = new dbcon();


        string query = "update  Orders set Status='" + DropDownList1.Text + "' where OrderID='" + Request.QueryString["ID"] + "'";

        bool b = db.UDI(query);

        if (b == true)
        {
            lblshow.Text = "OrderInformation Updated Successfully";
        }
        else
        {
            lblshow.Text = " Operation Not successful";
        }

        if (DropDownList1.Text == "Completed")
        {
            for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
            {
                GridViewRow row = GridView1.Rows[i];
                if (row.RowType == DataControlRowType.DataRow)
                {
                    ShoppingCartItem item = new ShoppingCartItem();

                    item.ProductID = (int)GridView1.DataKeys[i].Value;
                    item.Quantity  = int.Parse(((Label)(row.FindControl("lblqty"))).Text);
                    //  Label lbldeleteid = (Label)row.FindControl("lblproid");



                    dbcon db1             = new dbcon();
                    int   orderedQuantity = System.Convert.ToInt32(item.Quantity);

                    string query1 = "update Products set productquantity=productquantity-'" + orderedQuantity + "' where ProductID='" + item.ProductID + "'";
                    //bool b = db.UDI(query);
                    bool c = db1.UDI(query1);
                    if (c == true)
                    {
                        // lblshow.Text = "Product Delivered and Added to DataBase Sucessfully";
                    }

                    else
                    {
                        //lblshow.Text = " Operation Not successful";
                    }
                }
            }
        }
    }
Пример #5
0
    protected void _rowdel(object sender, GridViewDeleteEventArgs e)
    {
        GridViewRow row           = (GridViewRow)GridView2.Rows[e.RowIndex];
        Label       lbldeletename = (Label)row.FindControl("lblusername");
        Label       lblmyrolename = (Label)row.FindControl("lblrolename");

        //MAconn.Open();
        //string query = "Delete FROM roles WHERE UserID = (SELECT UserID FROM users WHERE UserName= '******')";
        string query = "Delete FROM roles WHERE UserID = (SELECT UserID FROM users WHERE UserName= '******') and GroupID=(SELECT GroupID FROM groups WHERE RoleName= '" + lblmyrolename.Text + "')";

        obj.UDI(query);
        userinrole();
    }
Пример #6
0
    protected void _rowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        dbcon       db       = new dbcon();
        GridViewRow row      = (GridViewRow)GridView1.Rows[e.RowIndex];
        Label       lblproid = (Label)row.FindControl("lblproid");

        string query = "delete ShoppingCart where ProductID='" + lblproid.Text + "'";

        db.UDI(query);


        bind();
        Response.Redirect("shoppingcart.aspx");
    }
Пример #7
0
    protected void btnOrder_Click(object sender, EventArgs e)
    {
        string status = "Pending";
        string query1 = "insert into stock(productid,productname,supplierName,SupplierCell,SupplierAddress,OrderDate,OrderedQuantity,DelivaryStatus)select productID,'" + lblproname.Text + "','" + DropDownList1.Text + "','" + lblcell.Text + "','" + lbladdress.Text + "','" + DateTime.Now + "','" + txtOrderedQuantity.Text + "','" + status + "' from Products where ProductName='" + lblproname.Text + "'";
        // string query1 = "insert into stock(productid,productname,OrderDate,OrderedQuantity,DelivaryStatus)select productID,'" + lblproname.Text + "','" + DateTime.Now + "','" + txtOrderedQuantity.Text + "','" + status + "' from Products where ProductName='" + lblproname.Text + "'";
        // string query2 = "Select (StockId,supplierName,SupplierCell,SupplierAddress)select stockID,'" + lblproname.Text + "','" + txtsuppliername.Text + "','" + txtsuppliercell.Text + "','" + txtSupplierAddress.Text + "','" + DateTime.Now + "','" + txtOrderedQuantity.Text + "','" + status + "' from Products where ProductName='" + lblproname.Text + "'";
        bool b = obj.UDI(query1);

        //bool b = obj.mdi(query, query1);

        if (b)
        {
            lblresult.Text = "Inserted";
            //Response.Redirect("Products.aspx");
        }
        else
        {
            lblresult.Text = "Not Inserted";
        }
    }
Пример #8
0
    protected void btnOrder_Click(object sender, EventArgs e)
    {
        //string query = "insert into Products(CategoryID,ProductName,ProductImage,UnitCost,Description,origionalPrice,StockQuantity)select CategoryID,'" + txtproname.Text + "','" + "Images/" + filename + "'," + txtproprice.Text + ",'" + txtprodesc.Text + "','" + txtOrigional.Text + "','" + dpquantity.Text + "' from Categories where CategoryName='" + DropDownList1.Text + "'";
        // string query1 = "insert into stock(productid,productname,supplierName,SupplierCell,SupplierAddress,OrderDate,OrderedQuantity)select productID,'" + dpproductname.Text + "','" + txtsuppliername.Text + "','" + txtsuppliercell.Text + "','" + txtSupplierAddress.Text + "','" + DateTime.Now + "','" + txtOrderedQuantity.Text + "' from Products where ProductName='" + dpproductname.Text + "'";

        string query1 = "insert into stock(productid,productname,supplierName,SupplierCell,SupplierAddress,OrderDate,OrderedQuantity)select productID,'" + dpproductname.Text + "','" + txtsuppliername.Text + "','" + txtsuppliercell.Text + "','" + txtSupplierAddress.Text + "','" + DateTime.Now + "','" + txtOrderedQuantity.Text + "' from Products where ProductName='" + lblproname.Text + "'";
        bool   b      = obj.UDI(query1);

        //bool b = obj.mdi(query, query1);

        if (b)
        {
            lblresult.Text = "Inserted";
            //Response.Redirect("Products.aspx");
        }
        else
        {
            lblresult.Text = "Not Inserted";
        }
    }