예제 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string sqlinsert = "";
        ylibWebClass ylib = new ylibWebClass(constring.connect());

        if (Request.QueryString["WarCode"] == null)
        {
            sqlinsert = "insert into Bas_Warranties(WatName,inactive) values ('" + txtWatName.Text + "',0)";
            ylib.ExecuateSQLStatement(sqlinsert);
            Response.Redirect("WarrantyAdd.aspx?ID=True");
        }
        else
        {
            WarCode=Convert.ToInt16( Request.QueryString["WarCode"]);
            sqlinsert = "update Bas_Warranties set WatName='" + txtWatName.Text + "' where WarCode=" + WarCode;
            ylib.ExecuateSQLStatement(sqlinsert);
            Response.Redirect("Warranty.aspx");
        }
    }
예제 #2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        string sqlinsert = "";
        ylib = new ylibWebClass(ConStr.connect());

        sqlinsert = "insert into ProductPricing(ProductId,Price,Date) values (" + lblProductId.Text + ",'"+ txtPrice.Text  +"','"+ DateTime.Now +"')";
        ylib.ExecuateSQLStatement(sqlinsert);
        //Update the record here

        this.ModalPopupExtender1.Hide();
        //imgbtn_Click
    }
예제 #3
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sqldelet = "";
        if (e.CommandName == "Delete")
        {
            ylib = new ylibWebClass(constring.connect());
            int WarCode = Convert.ToInt32(e.CommandArgument);
            sqldelet = "delete from Bas_Warranties where WarCode=" + WarCode;
            ylib.ExecuateSQLStatement(sqldelet);
            BindData();

        }

        if (e.CommandName == "Edit")
        {
            int WarCode = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("WarrantyAdd.aspx?WarCode=" + WarCode);

        }
    }
예제 #4
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        ylib = new ylibWebClass(ConStr.connect());

        if (e.CommandName == "Delete")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            taProduct.DeleteProduct(ProductId);
            BindData();
        }

        if (e.CommandName == "Edit")
        {
            DataTable DT = new DataTable();
            int ProductId = Convert.ToInt32(e.CommandArgument);
            DT = ylib.GiveDataTable_BySQLStatement("select CompanyId,CategoryId,SubCategoryId,ProductGroupCode from v_products where productid=" + ProductId);
            if (DT.Rows.Count > 0)
            {
                DataRow row = DT.Rows[0];
                Response.Redirect("ProductAdd.aspx?ProductId=" + ProductId + "&CompanyId=" + Convert.ToInt16(row["CompanyId"]) + "&CategoryId=" + Convert.ToInt16(row["CategoryId"]) + "&SubCategoryId=" + Convert.ToInt16(row["SubCategoryId"]) + "&ProductGroupCode=" + Convert.ToInt16(row["ProductGroupCode"]) );
            }
            else
                Response.Redirect("ProductAdd.aspx?ProductId=" + ProductId);
        }

        if (e.CommandName == "Image")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("ProductImages.aspx?ProductId=" + ProductId);
        }

        if (e.CommandName == "Features")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("ProductKeyFeatures.aspx?ProductId=" + ProductId);
        }

        if (e.CommandName == "Color")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("ProductColors.aspx?ProductId=" + ProductId);
        }

        if (e.CommandName == "TechnicalSpecs")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("TechnicalSpecsEdit.aspx?ProductId=" + ProductId);
        }

        if (e.CommandName == "Documents")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("DocumentsDetails.aspx?ProductId=" + ProductId + "&DocumenType=0&osDocumenType=0");
        }
        if (e.CommandName == "Drivers")
        {
            int ProductId = Convert.ToInt32(e.CommandArgument);
            Response.Redirect("DocumentsDetails.aspx?ProductId=" + ProductId + "&DocumenType=1&osDocumenType=1");
        }
        if (e.CommandName == "FreeShipment")
        {
            string sqlupdate;
            Boolean IsFreeShipment = false;
            string[] Str= new string[2];

            Str = e.CommandArgument.ToString().Split(';');
            int ProductId = Convert.ToInt32(Str[0]);
            IsFreeShipment = Convert.ToBoolean(Str[1]);

            if (IsFreeShipment == false) IsFreeShipment = true; else IsFreeShipment = false;

            sqlupdate = "";

            if (IsFreeShipment == true)
                sqlupdate = "update product set freeshipment=1 where productid=" + ProductId;
            else
                sqlupdate = "update product set freeshipment=0 where productid=" + ProductId;

            ylib.ExecuateSQLStatement(sqlupdate);

            BindData();
        }

        if (e.CommandName == "InStock")
        {

            string sqlupdate;
            Boolean IsInStock = false;
            string[] Str = new string[2];

            Str = e.CommandArgument.ToString().Split(';');
            int ProductId = Convert.ToInt32(Str[0]);
            IsInStock = Convert.ToBoolean(Str[1]);

            sqlupdate = "";

            if (IsInStock == false) IsInStock = true; else IsInStock = false;

            if (IsInStock == true)
                sqlupdate = "update product set InStock=1 where productid=" + ProductId;
            else
                sqlupdate = "update product set InStock=0 where productid=" + ProductId;

            ylib.ExecuateSQLStatement(sqlupdate);

            BindData();

        }
    }