private bool CheckData() { bool blValue = true; if (cbEcode.SelectedIndex == -1) { MessageBox.Show("Select Ecode!"); blValue = false; cbEcode.Focus(); return(blValue); } else if ((!IsNumeric(txtFrNo.Text.Trim())) || (!IsNumeric(txtToNo.Text.Trim()))) { txtFrNo.Focus(); MessageBox.Show("Enter valid Numbers !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); blValue = false; } else if (Convert.ToInt32(txtFrNo.Text) > Convert.ToInt32(txtToNo.Text)) { MessageBox.Show("From No Must be Less Than To No", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); blValue = false; } else if (strECode == "0") { MessageBox.Show("Please Select E Code.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); blValue = false; } GetTotalOrders(); if (nTotOrders > 100) { blValue = false; MessageBox.Show("OrderSheet Issues Should Be less than 100 Only At a time", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blValue); } //else if ((meInvoiceDate.Text.IndexOf(" ") >= 0) || (meInvoiceDate.Text.Length < 10)) //{ // MessageBox.Show("Enter Order Issue date!"); // blValue = false; // meInvoiceDate.Focus(); // return blValue; //} //else //{ if (General.IsDateTime(meInvoiceDate.Text.ToString())) { if (Convert.ToInt32(Convert.ToDateTime(meInvoiceDate.Text).ToString("yyyy")) < 1950) { MessageBox.Show("Enter valid Date !"); blValue = false; meInvoiceDate.CausesValidation = true; //meInvoiceDate.Focus(); return(blValue); } } else { MessageBox.Show("Enter valid Order Issue Date!"); meInvoiceDate.CausesValidation = true; blValue = false; //meInvoiceDate.Focus(); return(blValue); } //} return(blValue); }
private bool CheackData() { bool blData = true; if (txtIndentNo.Text == "") { MessageBox.Show("Enter Indent No.", "Indent"); blData = false; txtIndentNo.Focus(); return(blData); } objData = new IndentDB(); int Trano = objData.CheckIndentNoDeliver(Convert.ToInt32(txtIndentNo.Text.ToString())); if (Trano > 0) { MessageBox.Show("Indent No already delivered. So you cannot modify.", "Indent"); blData = false; txtIndentNo.Focus(); return(blData); } objData = null; if ((meIndentDate.Text.IndexOf(" ") >= 0) || (meIndentDate.Text.Length < 10)) { MessageBox.Show("Enter Indent date!"); blData = false; meIndentDate.Focus(); return(blData); } else { if (General.IsDateTime(meIndentDate.Text.ToString())) { if (Convert.ToInt32(Convert.ToDateTime(meIndentDate.Text).ToString("yyyy")) < 1950) { MessageBox.Show("Enter valid Date !"); blData = false; meIndentDate.CausesValidation = true; meIndentDate.Focus(); return(blData); } if (Convert.ToDateTime(Convert.ToDateTime(meIndentDate.Text).ToString("dd/MM/yyyy")) > Convert.ToDateTime(Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MM/yyyy"))) { MessageBox.Show("Date should be less than to day"); meIndentDate.CausesValidation = true; blData = false; meIndentDate.Focus(); return(blData); } } else { MessageBox.Show("Enter valid Indent Date!"); meIndentDate.CausesValidation = true; blData = false; meIndentDate.Focus(); return(blData); } } bool isItemExisted = false; for (int nRow = 0; nRow < gvIndentDetails.Rows.Count; nRow++) { if (gvIndentDetails.Rows[nRow].Cells["Qty"].Value.ToString().Trim().Length > 0) { if (Convert.ToDouble(gvIndentDetails.Rows[nRow].Cells["Qty"].Value.ToString().Trim()) > 0) { isItemExisted = true; break; } } } if (isItemExisted == false) { blData = false; MessageBox.Show("Enter product quantity"); return(blData); } return(blData); }