protected void ButSearch_Click(object sender, EventArgs e) { DataSet dsStockRep = CStockMasterServices.DisplayStockRep(Convert.ToInt32(DropProductname.SelectedValue), Convert.ToInt32(DropCategory.SelectedValue), Convert.ToInt32(DropSubcategory.SelectedValue), Convert.ToInt32(DropCosubcategory.SelectedValue)); GVStockList.DataSource = dsStockRep; GVStockList.DataBind(); }
private void BindProductSize(int ProductId) { DataSet dsStockMasterListbyProductId = CStockMasterServices.StockMasterListbyProductId(Convert.ToInt32(LblProductId.Text)); DropdownSize.DataSource = dsStockMasterListbyProductId; DropdownSize.Items.Clear(); DropdownSize.DataValueField = "SizeId"; DropdownSize.DataTextField = "Desc"; DropdownSize.DataBind(); if (DropdownSize.Items.Count > 0) { LblPrice.Text = (CStockMasterServices.SRatetbySize(Convert.ToInt32(LblProductId.Text), Convert.ToInt32(DropdownSize.SelectedValue))).ToString(); } }
protected void ButUpdate_Click(object sender, EventArgs e) { TblAddEdit.Visible = true; ButUpdate.Visible = true; Butinsert.Visible = false; ButCancle.Visible = true; int intReturnvalue2 = 0; int intReturnValues3 = 0; int intReturnValue = CProductMasterServices.ProductMasterUpdate( Convert.ToInt32(TxtproductId.Text), Convert.ToInt32(Dropsupplierlist.SelectedValue), Convert.ToInt32(droplistcategory.SelectedValue), Convert.ToInt32(droplistsubcategory.SelectedValue), Convert.ToInt32(DropCosubcategoryList.SelectedValue), Convert.ToInt32(DropFabric.SelectedValue), TxtColor.Text, // DroplistColour.SelectedValue, TxtProductName.Text, Txtproductdescription.Text, Convert.ToInt32(LblTotalQty.Text), //FileUpload1.FileName, ViewState["Imagename"].ToString(), CheckStatus.Checked); foreach (GridViewRow gvrow in GvStockList.Rows) { DropDownList Size1 = (DropDownList)gvrow.FindControl("DropSize"); int Size = Convert.ToInt32(Size1.SelectedValue); TextBox Qty1 = (TextBox)gvrow.FindControl("TxtQty"); int Qty = Convert.ToInt32(Qty1.Text); TextBox PRate1 = (TextBox)gvrow.FindControl("TxtPRate"); double PRate = Convert.ToDouble(PRate1.Text); TextBox SRate1 = (TextBox)gvrow.FindControl("TxtSRate"); double SRate = Convert.ToDouble(SRate1.Text); Label Amount1 = (Label)gvrow.FindControl("LblAmount"); decimal Amount = Convert.ToDecimal(Amount1.Text); HiddenField StockId1 = (HiddenField)gvrow.FindControl("hidStockId"); int StockId = Convert.ToInt32(StockId1.Value); HiddenField PurchseId1 = (HiddenField)gvrow.FindControl("hidPurchaseId"); int PurchseId = Convert.ToInt32(PurchseId1.Value); //int PurchaseBillno = Convert.ToInt32(PurchaseBillno1.Text); //TextBox PurchaseBillDate1 = (TextBox)gvrow.FindControl("TxtPBillDate"); //DateTime PurchaseBillDate=Convert.ToDateTime(PurchaseBillDate1.Text); //TextBox ReturnStatus1 = (TextBox)gvrow.FindControl("TxtReturnStatus"); //string purchaseId = GvStockList.DataKeys[gvrow.RowIndex][0].ToString(); CPurchseMasterServices objCPurchseMasterServices = new CPurchseMasterServices(); intReturnvalue2 = objCPurchseMasterServices.PurchseUpdate (PurchseId, Convert.ToInt32(TxtPurchaseBillno.Text), Convert.ToDateTime(TxtPurchaseBillDate.Text), Size, Qty, PRate, SRate, Amount, Convert.ToDecimal(LblTotalQty.Text), Convert.ToDecimal(TxtAddLess.Text), Convert.ToDecimal(LblTotalAmount.Text)); CStockMasterServices ObjCStockMasterServices = new CStockMasterServices(); intReturnValues3 = ObjCStockMasterServices.StockMasterUpdate(StockId, Convert.ToInt32(TxtproductId.Text), Size, Qty, PRate, SRate); } if (intReturnValue > 0) { lblmsgbox.Text = "Product Update"; BindgvProdutlist(); TxtproductId.Text = ""; TxtProductName.Text = ""; TxtColor.Text = ""; LblTotalQty.Text = ""; LblTotalQty.Text = ""; LblNetAmount.Text = ""; LblTotalAmount.Text = ""; TxtAddLess.Text = ""; CheckStatus.Checked = false; } else { lblmsgbox.Text = "Error occured while Updateing Product"; } if (intReturnvalue2 > 0) { SetInitialRow(); lblmsgbox.Text = "Update Purchse"; } else { lblmsgbox.Text = "Error occured while Updateing Purchse"; } }
protected void Butinsert_Click(object sender, EventArgs e) { { TblAddEdit.Visible = true; ButUpdate.Visible = false; ButCancle.Visible = true; // } //} int intReturnValue = CProductMasterServices.ProductMasterInsert( Convert.ToInt32(Dropsupplierlist.SelectedValue), Convert.ToInt32(droplistcategory.SelectedValue), Convert.ToInt32(droplistsubcategory.SelectedValue), Convert.ToInt32(DropCosubcategoryList.SelectedValue), TxtProductName.Text, Convert.ToInt32(DropFabric.SelectedValue), TxtColor.Text, //DroplistColour.SelectedValue, Convert.ToInt32(LblTotalQty.Text), Txtproductdescription.Text, //Convert.ToDouble(TxtPrice.Text), //strFileName, ViewState["Imagename"].ToString(), CheckStatus.Checked); LblProductno.Text = intReturnValue.ToString(); int intReturnValue1 = 0; foreach (GridViewRow gvrow in GvStockList.Rows) { DropDownList Size1 = (DropDownList)gvrow.FindControl("DropSize"); int Size = Convert.ToInt32(Size1.Text); TextBox Qty1 = (TextBox)gvrow.FindControl("TxtQty"); int Qty = Convert.ToInt32(Qty1.Text); TextBox PRate1 = (TextBox)gvrow.FindControl("TxtPRate"); double PRate = Convert.ToDouble(PRate1.Text); TextBox SRate1 = (TextBox)gvrow.FindControl("TxtSRate"); double SRate = Convert.ToDouble(SRate1.Text); Label Amount1 = (Label)gvrow.FindControl("LblAmount"); decimal Amount = Convert.ToInt32(Amount1.Text); //TextBox PurchaseBillDate1 = (TextBox)gvrow.FindControl("TxtPBillDate"); //DateTime PurchaseBillDate = Convert.ToDateTime(PurchaseBillDate1.Text); //TextBox ReturnStatus1 = (TextBox)gvrow.FindControl("TxtReturnStatus"); //string purchaseId = GvStockList.DataKeys[gvrow.RowIndex][0].ToString(); //int ReturnStatus = 0; //if (ReturnStatus1.Text != "") //{ // ReturnStatus = Convert.ToInt32(ReturnStatus1.Text); //} CPurchseMasterServices objCPurchseMasterServices = new CPurchseMasterServices(); intReturnValue1 = objCPurchseMasterServices.PurchseEnteryInsert(Convert.ToInt32(LblProductno.Text), Convert.ToInt32(TxtPurchaseBillno.Text), Convert.ToDateTime(TxtPurchaseBillDate.Text), Size, Qty, PRate, Amount, Convert.ToDecimal(LblTotalAmount.Text), Convert.ToDecimal(TxtAddLess.Text), Convert.ToDecimal(LblNetAmount.Text)); int intReturnValues = CStockMasterServices.StockMasterInsert(Convert.ToInt32(LblProductno.Text), Size, Qty, PRate, SRate); } if (intReturnValue > 0) { lblmsgbox.Text = "Insert Data"; BindgvProdutlist(); BindCategoryName(); //BindgvProductlist(); TxtproductId.Text = ""; TxtProductName.Text = ""; Txtproductdescription.Text = ""; TxtColor.Text = ""; TxtPurchaseBillno.Text = ""; // TxtPrice.Text = ""; LblTotalQty.Text = ""; LblNetAmount.Text = ""; LblTotalAmount.Text = ""; TxtAddLess.Text = ""; } else { lblmsgbox.Text = "Error occured while insering Product"; } if (intReturnValue1 > 0) { SetInitialRow(); } else { lblmsgbox.Text = "Error occured while insering Purchse"; } } }
protected void gvProductlist_RowDeleting(object sender, GridViewDeleteEventArgs e) { TblAddEdit.Visible = false; Butinsert.Visible = false; ButCancle.Visible = true; ButUpdate.Visible = true; //int inReturnValue1=0; //int intReturnValue2=0; int intProductId = Convert.ToInt32(gvProductlist.DataKeys[e.RowIndex].Value); CProductMaster ObjProduct = new CProductMaster(intProductId); if (ObjProduct.IsExit == true) { lblmsgbox.Text = ""; TxtproductId.Text = ObjProduct.ProductId.ToString(); droplistcategory.SelectedValue = ObjProduct.CategoryId.ToString(); droplistsubcategory.SelectedValue = ObjProduct.SubCategoryId.ToString(); //DroplistColour.SelectedValue = ObjProduct.Colour; TxtProductName.Text = ObjProduct.ProductName; Txtproductdescription.Text = ObjProduct.ProductDesc; //TxtPrice.Text = ObjProduct.Price.ToString(); LblTotalQty.Text = ObjProduct.Qty.ToString(); CheckStatus.Checked = ObjProduct.Status; } int intReturnValue = CProductMasterServices.ProductMasterDelete(Convert.ToInt32(TxtproductId.Text)); //int intstockid = Convert.ToInt32(GvStockList.DataKeys[e.RowIndex].Value); //CStockMaster Objstockid = new CStockMaster(intstockid); //if (Objstockid.IsExit == true) //{ //} foreach (GridViewRow gvrow in GvStockList.Rows) { HiddenField StockId1 = (HiddenField)gvrow.FindControl("hidStockId"); int StockId = Convert.ToInt32(StockId1.Value); HiddenField PurchseId1 = (HiddenField)gvrow.FindControl("hidPurchaseId"); int PurchseId = Convert.ToInt32(PurchseId1.Value); int intReturnValues = CStockMasterServices.StockMasterDelete(StockId); int inReturnValue1 = CPurchseMasterServices.PurchaseDelete(PurchseId); } //CPurchseMasterServices ObjCPurchseMasterServices = new CPurchseMasterServices(); if (intReturnValue > 0) { lblmsgbox.Text = "Product Delete"; BindgvProdutlist(); TxtproductId.Text = ""; Txtproductdescription.Text = ""; TxtProductName.Text = ""; TxtColor.Text = ""; //TxtPrice.Text = ""; LblTotalQty.Text = ""; } else { lblmsgbox.Text = "Error occured while Deleting Data."; } }