private bool checking() { bool returnValue = true; List <Inv_ProductionConfiguration> inv_ProductionConfigurations = Inv_ProductionConfigurationManager.GetAllInv_ProductionConfigurations(); foreach (GridViewRow gvr in gvInv_Item.Rows) { HiddenField hfInv_ItemID = (HiddenField)gvr.FindControl("hfInv_ItemID"); Label lblPurchaseID = (Label)gvr.FindControl("lblPurchaseID"); Label lblQualityValue = (Label)gvr.FindControl("lblQualityValue"); HiddenField hfQualityUnitID = (HiddenField)gvr.FindControl("hfQualityUnitID"); HiddenField hfRawMaterialID = (HiddenField)gvr.FindControl("hfRawMaterialID"); TextBox txtIssueQuantity = (TextBox)gvr.FindControl("txtIssueQuantity"); HiddenField hfQuantityUnitID = (HiddenField)gvr.FindControl("hfQuantityUnitID"); TextBox txtApproximateQuantity = (TextBox)gvr.FindControl("txtApproximateQuantity"); DropDownList ddlProduct = (DropDownList)gvr.FindControl("ddlProduct"); HiddenField hfRawMaterialTypeID = (HiddenField)gvr.FindControl("hfRawMaterialTypeID"); Label lblAvailableInstock = (Label)gvr.FindControl("lblExtraFieldQuantity1"); Label lblItemCode = (Label)gvr.FindControl("lblItemCode"); if (hfRawMaterialTypeID.Value != "2" || (txtApproximateQuantity.Text != "" && txtApproximateQuantity.Text != "0")) { continue; } if (ddlProduct.SelectedValue == "0" && txtApproximateQuantity.Text == "0") { continue; } if (txtIssueQuantity.Text == "" || txtIssueQuantity.Text == "0") { continue; } if (decimal.Parse(txtIssueQuantity.Text) > decimal.Parse(lblAvailableInstock.Text)) { showAlartMessage("Issue is not permited more than stock for " + lblItemCode.Text); returnValue = false; continue; } if (ddlProduct.SelectedValue == "0") { showAlartMessage("Please Select the product for " + lblItemCode.Text); returnValue = false; continue; } bool found = false; if (txtApproximateQuantity.Text != "0") { foreach (Inv_ProductionConfiguration confi in inv_ProductionConfigurations) { if (confi.ProductID.ToString() == ddlProduct.SelectedValue && confi.QualityUnitID.ToString() == hfQualityUnitID.Value && confi.QuantityUnitID.ToString() == hfQuantityUnitID.Value && confi.QualityValue == decimal.Parse(lblQualityValue.Text) && confi.RawMaterialID.ToString() == hfRawMaterialID.Value ) { txtApproximateQuantity.Text = (decimal.Parse(txtIssueQuantity.Text) / confi.QuantityValue).ToString("0"); found = true; break; } } } else { found = true; } if (!found) { showAlartMessage("Configuration missing for " + lblItemCode.Text); returnValue = false; } } return(returnValue); }
private void showInv_ProductionConfigurationGrid() { gvInv_ProductionConfiguration.DataSource = Inv_ProductionConfigurationManager.GetAllInv_ProductionConfigurations(); gvInv_ProductionConfiguration.DataBind(); }