protected void BtnGetProductDetails_Click(object sender, EventArgs e) { if (txtProductCode.Text != string.Empty) { CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global(); string queryFillProductDetails = "Select ITEMID +'-(' + PRODUCT_NAME+')' as PRODUCT_NAME, ITEMID,PRODUCT_GROUP, PRODUCT_SUBCATEGORY " + "from ax.INVENTTABLE where replace(replace(ITEMID, char(9), ''), char(13) + char(10), '')= '" + txtProductCode.Text.Trim().ToString() + "'"; DataTable dtProductDetails = obj.GetData(queryFillProductDetails); if (dtProductDetails.Rows.Count > 0 && dtProductDetails.Rows.Count == 1) { DDLProductGroup.Items.Clear(); DDLProdSubCategory.Items.Clear(); DDLProductDesc.Items.Clear(); DDLProductGroup.Items.Add(dtProductDetails.Rows[0]["PRODUCT_GROUP"].ToString()); DDLProductGroup.SelectedItem.Text = dtProductDetails.Rows[0]["PRODUCT_GROUP"].ToString(); DDLProdSubCategory.Items.Add(dtProductDetails.Rows[0]["PRODUCT_SUBCATEGORY"].ToString()); DDLProdSubCategory.SelectedItem.Text = dtProductDetails.Rows[0]["PRODUCT_SUBCATEGORY"].ToString(); DDLProductDesc.Items.Add(dtProductDetails.Rows[0]["PRODUCT_NAME"].ToString()); DDLProductDesc.SelectedItem.Text = dtProductDetails.Rows[0]["PRODUCT_NAME"].ToString(); DDLProductGroup.Enabled = false; DDLProdSubCategory.Enabled = false; DDLProductDesc.Enabled = false; DDLReason.Focus(); } if (dtProductDetails.Rows.Count > 1) { DDLProductGroup.Items.Clear(); DDLProdSubCategory.Items.Clear(); DDLProductDesc.Items.Clear(); string message = "alert('Product Code Issue: We Have Duplicate Records for this Product Code !');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true); //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('Product Code Issue: We Have Duplicate Records for this Product Code !');", true); } if (dtProductDetails.Rows.Count == 0) { DDLProductGroup.Items.Clear(); DDLProdSubCategory.Items.Clear(); DDLProductDesc.Items.Clear(); string message = "alert('Product Code Issue: No Such Produt Code Exist !');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true); //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('Product Code Issue: No Such Produt Code Exist !');", true); } } else { txtProductCode.Focus(); string message = "alert('Please Provide Product Code Here !');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true); //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('Please Provide Product Code Here !');", true); } }
private bool ValidateLineItemAdd() // Add Items Validation Logic // { bool b = false; LblProductMessage.Text = string.Empty; if (DDLWarehouseFrom.Text == "-Select-") { this.LblMessage.Text = "► Please Select the Warehouse From Location First !"; DDLWarehouseFrom.Focus(); b = false; return(b); } if (DDLWarehouseTo.Text == "-Select-") { this.LblMessage.Text = "► Please Select the Warehouse To Location First !"; DDLWarehouseFrom.Focus(); b = false; return(b); } if (DDLWarehouseTo.Text.ToString().Trim() == DDLWarehouseFrom.Text.ToString().Trim()) { this.LblMessage.Text = "► Please Warehouse From and Warehouse To Location different!"; DDLWarehouseTo.Focus(); b = false; return(b); } if (DDLProductGroup.Text == string.Empty) { this.LblMessage.Text = "► Product Group Not Available." + Environment.NewLine + " First Type Product Code to Get Details for Product Group !"; txtProductCode.Focus(); b = false; return(b); } if (DDLProdSubCategory.Text == string.Empty) { this.LblMessage.Text = "► Product Sub Category Group Not Available For This Item !"; DDLProdSubCategory.Focus(); b = false; return(b); } if (DDLProductDesc.Text == string.Empty) { this.LblMessage.Text = "► Product Description Not Available For This Item !"; DDLProductDesc.Focus(); b = false; return(b); } if (DDLReason.Text == "-Select-") { this.LblMessage.Text = "► Select Reason Type !"; DDLReason.Focus(); b = false; return(b); } if (txtStockMoveQty.Text == string.Empty) { this.LblMessage.Text = "► Please Provide Stock Moving Quantity Value !"; txtStockMoveQty.Focus(); b = false; return(b); } if (txtStockMoveQty.Text.Length > 0 && txtStockMoveQty.Text != string.Empty) { if (Convert.ToDecimal(txtStockMoveQty.Text) == 0) { this.LblMessage.Text = "► Stock Moving Quantity Value should be greater than zero (0)!"; txtStockMoveQty.Focus(); b = false; return(b); } else { LblMessage.Text = string.Empty; b = true; return(b); } } return(b); }