protected void GvSubCategoryList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        //TblAddEdit.Visible = false;
        //ButAdd.Visible = true;
        int intSubCategoryId = Convert.ToInt32(GvSubCategoryList.DataKeys[e.RowIndex].Value);

        CSubCategoryMaster ObjSubCategory = new CSubCategoryMaster(intSubCategoryId);

        if (ObjSubCategory.IsExit == true)
        {
            Txtsubcategoryid.Text          = ObjSubCategory.SubCategoryId.ToString();
            Dropcategoryname.SelectedValue = ObjSubCategory.CategoryId.ToString();
            Txtsubcategoryname.Text        = ObjSubCategory.SubCategoryName;

            DropStatus.SelectedValue = ObjSubCategory.Status;
        }
        int intResultValue = CSubCategoryMasterServices.SubCategoryDelete(intSubCategoryId);

        if (intResultValue > 0)
        {
            BindGrid();
            lblmsgbox.Text          = "SubCategory Delete.";
            Txtsubcategoryid.Text   = "";
            Txtsubcategoryname.Text = "";
        }
        else
        {
            lblmsgbox.Text = "Error occured while Deleting Data.";
        }
    }
Example #2
0
    protected void droplistcategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        CSubCategoryMaster ObjsubCategory = new CSubCategoryMaster(Convert.ToInt32(droplistcategory.SelectedValue));

        BindSubCategoryName(Convert.ToInt32(ObjsubCategory.CategoryId));

        //CCoSubCategoryMaster ObjCosubCategory = new CCoSubCategoryMaster(Convert.ToInt32(droplistsubcategory.SelectedValue));
        // BindCosubcategoryName(Convert.ToInt32(ObjCosubCategory.SubcategoryId));
    }
    protected void DropCategoryname_SelectedIndexChanged(object sender, EventArgs e)
    {
        CSubCategoryMaster ObjsubCategory = new CSubCategoryMaster((Convert.ToInt32(DropCategoryname.SelectedValue)));

        BindSubcategoryname(Convert.ToInt32(ObjsubCategory.CategoryId));

        //BindSubcategoryname(ObjsubCategory.CategoryId.ToString());
        // DropSubCategory.SelectedValue = "SubCategoryId";

        // BindSubcategoryname(Convert.ToInt32(CategoryId));
    }
    public void BindCategoryname()
    {
        DataSet dsCategoryMasterList = CCategorymasterServices.CategorymasterList();

        DropCategoryname.DataSource = dsCategoryMasterList;
        DropCategoryname.Items.Clear();
        DropCategoryname.DataTextField  = "Categoryname";
        DropCategoryname.DataValueField = "CategoryId";
        DropCategoryname.DataBind();

        CSubCategoryMaster ObjsubCategory = new CSubCategoryMaster((Convert.ToInt32(DropCategoryname.SelectedValue)));

        BindSubcategoryname(Convert.ToInt32(ObjsubCategory.CategoryId));
    }
    protected void GvSubCategoryList_RowEditing(object sender, GridViewEditEventArgs e)
    {
        TblAddEdit.Visible = true;
        ButAdd.Visible     = true;
        ButUpdate.Visible  = true;
        ButCancle.Visible  = true;
        ButInsert.Visible  = false;

        int intSubCategoryId = Convert.ToInt32(GvSubCategoryList.DataKeys[e.NewEditIndex].Value);

        CSubCategoryMaster ObjSubCategory = new CSubCategoryMaster(intSubCategoryId);

        if (ObjSubCategory.IsExit == true)
        {
            Txtsubcategoryid.Text          = ObjSubCategory.SubCategoryId.ToString();
            Dropcategoryname.SelectedValue = ObjSubCategory.CategoryId.ToString();
            Txtsubcategoryname.Text        = ObjSubCategory.SubCategoryName;
            //TxtSubCategoryDescription.Text=ObjSubCategory.SubcategoryDesc;
            DropStatus.SelectedValue = ObjSubCategory.Status;
        }
    }
Example #6
0
    protected void gvProductlist_RowEditing(object sender, GridViewEditEventArgs e)
    {
        TblAddEdit.Visible = true;
        ButUpdate.Visible  = true;
        ButCancle.Visible  = true;
        Butinsert.Visible  = false;
        int intProductId = Convert.ToInt32(gvProductlist.DataKeys[e.NewEditIndex].Value);
        //CProductMaster ObjProduct = new CProductMaster(intProductId);

        //if (ObjProduct.IsExit == true)
        //{
        //    TxtproductId.Text = ObjProduct.ProductId.ToString();
        //    droplistcategory.SelectedValue = ObjProduct.CategoryId.ToString();
        //    droplistsubcategory.SelectedValue = ObjProduct.SubCategoryId.ToString();
        //    //DroplistColour.SelectedValue = ObjProduct.Colour;
        //    TxtProductName.Text = ObjProduct.ProductName;
        //    TxtPrice.Text = ObjProduct.Price.ToString();
        //    Txtproductdescription.Text = ObjProduct.ProductDesc;
        //    LblTotalQty.Text = ObjProduct.Qty.ToString();
        //    //FileUpload1.FileName = ObjProduct.Image.ToString();
        //    CheckStatus.Checked = ObjProduct.Status;
        //}

        DataSet ds = CProductMasterServices.DisplayData(intProductId);
        {
            //TxtproductId.Text = intProductId.ToString();
            TxtproductId.Text          = ds.Tables[0].Rows[0]["ProductId"].ToString();
            TxtProductName.Text        = ds.Tables[0].Rows[0]["ProductName"].ToString();
            Txtproductdescription.Text = ds.Tables[0].Rows[0]["ProductDesc"].ToString();

            droplistcategory.SelectedValue = ds.Tables[0].Rows[0]["CategoryId"].ToString();

            CSubCategoryMaster ObjsubCategory = new CSubCategoryMaster(Convert.ToInt32(droplistcategory.SelectedValue));
            BindSubCategoryName(Convert.ToInt32(ObjsubCategory.CategoryId));


            //droplistsubcategory.SelectedValue = ds.Tables[0].Rows[0]["SubCategoryId"].ToString();

            droplistsubcategory.ClearSelection();
            droplistsubcategory.Items.FindByValue(ds.Tables[0].Rows[0]["SubCategoryId"].ToString()).Selected = true;

            CCoSubCategoryMaster ObjCosubCategory = new CCoSubCategoryMaster(Convert.ToInt32(droplistsubcategory.SelectedValue));
            BindCosubcategoryName(Convert.ToInt32(ObjCosubCategory.SubcategoryId));
            DropCosubcategoryList.ClearSelection();
            // DropCosubcategoryList.SelectedValue = ds.Tables[0].Rows[0]["CosubcategoryId"].ToString();
            DropCosubcategoryList.SelectedValue = ds.Tables[0].Rows[0]["CosubcategoryId"].ToString();
            // DropCosubcategoryList.SelectedValue = ds.Tables[0].Rows[0]["CosubcategoryId"].ToString();

            TxtColor.Text    = ds.Tables[0].Rows[0]["Colour"].ToString();
            LblTotalQty.Text = ds.Tables[0].Rows[0]["Qty"].ToString();
            //TxtPrice.Text = ds.Tables[0].Rows[0]["Price"].ToString();
            CheckStatus.Checked = Convert.ToBoolean(ds.Tables[0].Rows[0]["Status"].ToString());
            // LblTotalAmount.Text = ds.Tables[2].Rows[0]["Total"].ToString();

            //Image1.ImageUrl = "~/Image/" + dt.Rows[0]["Image"];
            Image1.ImageUrl = "~/Image/" + ds.Tables[0].Rows[0]["Image"].ToString();
            string ImageFile = ds.Tables[0].Rows[0]["Image"].ToString();
            ViewState["Imagename"] = ImageFile;
            TxtAddLess.Text        = ds.Tables[2].Rows[0]["Addless"].ToString();
            LblNetAmount.Text      = ds.Tables[2].Rows[0]["Netamount"].ToString();



            //SetInitialRow();
            for (int i = 0; i < ds.Tables[2].Rows.Count; i++)
            {
                if (i <= 0)
                {
                    AddNewRowToGrid();
                }
                DropDownList Size1 = (DropDownList)GvStockList.Rows[i].FindControl("DropSize");
                Size1.SelectedValue = ds.Tables[2].Rows[i]["SizeId"].ToString();

                TextBox qty = (TextBox)GvStockList.Rows[i].FindControl("TxtQty");
                qty.Text = ds.Tables[2].Rows[i]["PQty"].ToString();

                TextBox PRate = (TextBox)GvStockList.Rows[i].FindControl("TxtPRate");
                PRate.Text = ds.Tables[2].Rows[i]["PRate"].ToString();


                Label Amount = (Label )GvStockList.Rows[i].FindControl("LblAmount");
                Amount.Text = ds.Tables[2].Rows[i]["Amount"].ToString();

                HiddenField StockId = (HiddenField)GvStockList.Rows[i].FindControl("hidStockId");
                StockId.Value = ds.Tables[1].Rows[i]["StockId"].ToString();
                //StockId.Value = ds.Table[1].Rows[i]["StockId"].Tostring();
                HiddenField PurchaseId = (HiddenField)GvStockList.Rows[i].FindControl("hidPurchaseId");
                PurchaseId.Value = ds.Tables[2].Rows[i]["PurchseId"].ToString();


                string temp_ProductID = ds.Tables[2].Rows[i]["ProductId"].ToString();
                string temp_SizeID    = ds.Tables[2].Rows[i]["SizeID"].ToString();

                DataRow[] mfetchrow;
                mfetchrow = ds.Tables[1].Select("ProductId=" + temp_ProductID + " AND SizeID=" + temp_SizeID);

                TextBox SRate = (TextBox)GvStockList.Rows[i].FindControl("TxtSRate");
                //SRate.Text = ds.Tables[1].Rows[i]["SRate"].ToString();
                if (mfetchrow.Length > 0)
                {
                    SRate.Text = mfetchrow[0]["SRate"].ToString();
                }
                //DataTable dt1=new DataTable();
                //dr = dt.NewRow();
                //            dr[1] = ((TextBox)Gridview1.Rows[i].Cells[1].FindControl("TextBox1")).Text;

                //           dr[2] = ((TextBox)Gridview1.Rows[i].Cells[2].FindControl("TextBox2")).Text;

                //           dr[3] = ((TextBox)Gridview1.Rows[i].Cells[3].FindControl("TextBox3")).Text;
                //           dt.Rows.Add(dr);
                //           dt.Rows.Add(dr);
                //           ViewState["Stock"] = dt;
                //           GvStockList.DataSource = dt;

                //           GvStockList.DataBind();
            }

            LblTotalAmount.Text      = ds.Tables[2].Rows[0]["Total"].ToString();
            TxtPurchaseBillno.Text   = ds.Tables[2].Rows[0]["PurchaseBillno"].ToString();
            TxtPurchaseBillDate.Text = Convert.ToDateTime(ds.Tables[2].Rows[0]["PurchaseBillDate"]).ToString();
        }
    }
    protected void DropCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        CSubCategoryMaster ObjsubCategory = new CSubCategoryMaster(Convert.ToInt32(DropCategory.SelectedValue));

        BindSubCategoryName(Convert.ToInt32(ObjsubCategory.CategoryId));
    }