public void INVOICE_DATE_CtrlEnter_Leave(object sender, EventArgs e)
{INVOICE_DATE_Leave(sender, e);
///////// Manoj Start
try{
if (sender.GetType().BaseType.BaseType.ToString() == new TextBox().GetType().ToString()){
TextBox txt = (TextBox)sender;
//if (string.IsNullOrEmpty(txt.Text.Trim()))//{//if (txt.Parent.Controls["ACCOUNT_NUMBER"].IsDisposed == false)//{
if (string.IsNullOrEmpty(txt.Parent.Controls["ACCOUNT_NUMBER"].Text) && string.IsNullOrEmpty(txt.Parent.Controls["INVOICE_NUMBER"].Text) && string.IsNullOrEmpty(txt.Text.Trim() )){
txt.Parent.Controls[
"ACCOUNT_NUMBER"].Focus();
// showTooltip(txt.Parent.Controls["ACCOUNT_NUMBER"], "ACCOUNT_NUMBER field is blank");//vinfo.Show("ACCOUNT_NUMBER field is blank", "Validation Info", txt.Parent.Controls["ACCOUNT_NUMBER"], 3);throw new Exception("ACCOUNT_NUMBER field is blank");
//throw new Exception("");}
elseif (string.IsNullOrEmpty(txt.Parent.Controls["ACCOUNT_NUMBER"].Text) && string.IsNullOrEmpty(txt.Parent.Controls["INVOICE_NUMBER"].Text) && !string.IsNullOrEmpty(txt.Text.Trim())){
txt.Parent.Controls[
"ACCOUNT_NUMBER"].Focus();
// showTooltip(txt.Parent.Controls["ACCOUNT_NUMBER"], "ACCOUNT_NUMBER field is blank");//vinfo.Show("ACCOUNT_NUMBER field is blank", "Validation Info", txt.Parent.Controls["ACCOUNT_NUMBER"], 3);throw new Exception("ACCOUNT_NUMBER field is blank");
//throw new Exception("");}
elseif (!string.IsNullOrEmpty(txt.Text.Trim()) && (txt.Parent.Controls["INVOICE_NUMBER"].Text != "")){
//MessageBox.Show("testtt"); txt.Parent.Controls["PO_NUMBER"].Focus();
// showTooltip(txt.Parent.Controls["ACCOUNT_NUMBER"], "ACCOUNT_NUMBER field is blank");//vinfo.Show("PO_NUMBER field is blank", "Validation Info", txt.Parent.Controls["PO_NUMBER field is blank"], 3);throw new Exception("PO_NUMBER field is blank");
//throw new Exception("");}
elseif ( (txt.Parent.Controls["INVOICE_NUMBER"].Text =="") && (txt.Text.Trim()) !="" ){
MessageBox.Show("testtt"); txt.Parent.Controls[
"ACCOUNT_NUMBER"].Focus();
// showTooltip(txt.Parent.Controls["ACCOUNT_NUMBER"], "ACCOUNT_NUMBER field is blank");//vinfo.Show("PO_NUMBER field is blank", "Validation Info", txt.Parent.Controls["PO_NUMBER field is blank"], 3);throw new Exception("ACCOUNT_NUMBER field is blank");
//throw new Exception("");}
//}//}else{
//if (txt.Parent.Controls["PO_NUMBER"].IsDisposed == false)//{if (string.IsNullOrEmpty(txt.Parent.Controls["PO_NUMBER"].Text)){
txt.Parent.Controls[
"PO_NUMBER"].Focus();
//showTooltip(txt.Parent.Controls["PO_NUMBER"], "PO_NUMBER field is blank");// vinfo.Show("PO_NUMBER field is blank", "Validation Info", txt.Parent.Controls["PO_NUMBER"], 3);throw new Exception("PO_NUMBER field is blank");
//throw new Exception("");}
//}}
}
else{
DataGridView dgv = (DataGridView)sender;
//if (string.IsNullOrEmpty(txt.Parent.Controls["ACCOUNT_NUMBER"].Text) && string.IsNullOrEmpty(txt.Parent.Controls["INVOICE_NUMBER"].Text) && string.IsNullOrEmpty(txt.Parent.Controls["INVOICE_DATE"].Text))// {
if (string.IsNullOrEmpty(dgv["ACCOUNT_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()) && string.IsNullOrEmpty(dgv["INVOICE_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()) && string.IsNullOrEmpty(dgv.EditingControl.Text.Trim() )){
dgv.Parent.Controls[
"ACCOUNT_NUMBER"].Focus();
throw new Exception("ACCOUNT_NUMBER field is blank");}
elseif (string.IsNullOrEmpty(dgv["ACCOUNT_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()) && string.IsNullOrEmpty(dgv["INVOICE_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()) && !string.IsNullOrEmpty(dgv.EditingControl.Text.Trim())){
dgv.Parent.Controls[
"ACCOUNT_NUMBER"].Focus();
throw new Exception("ACCOUNT_NUMBER field is blank");}
elseif (!string.IsNullOrEmpty(dgv["INVOICE_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()) && !string.IsNullOrEmpty(dgv.EditingControl.Text.Trim())){
dgv.Parent.Controls[
"PO_NUMBER"].Focus();
throw new Exception("PO_NUMBER field is blank");}
else{
if (string.IsNullOrEmpty(dgv["PO_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString())){
dgv.Parent.Controls[
"PO_NUMBER"].Focus();
throw new Exception("PO_NUMBER field is blank");}
}
}
}
catch (Exception){
throw;}
//try//{// if (sender.GetType().BaseType.BaseType.ToString() == new TextBox().GetType().ToString())// {// TextBox txt = (TextBox)sender;// if (txt.Text.Trim() != "")// {// // MessageBox.Show("TestDATE"); // txt.Parent.Controls["PO_NUMBER"].Focus();// // vinfo.Show("PO_NUMBER field is blank", "Validation Info", txt.Parent.Controls["PO_NUMBER"], 3);// throw new Exception("PO_NUMBER field is blank");// //throw new Exception("");// }
// }// else// {// DataGridView dgv = (DataGridView)sender;// //if (string.IsNullOrEmpty(dgv["PO_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()))// //{// if (dgv.EditingControl.Text.Trim() != "")// {// //if (string.IsNullOrEmpty(dgv["PO_NUMBER", dgv.CurrentRow.Index].EditedFormattedValue.ToString()))// //{// // dgv.EditingControl.Focus();// // throw new Exception("PO_NUMBER field is blank");// //}// dgv.CurrentCell = dgv["PO_NUMBER", dgv.CurrentRow.Index];// dgv.BeginEdit(true);// dgv.EditingControl.Focus();// throw new Exception("PO_NUMBER field is blank");// }// }//}//catch (Exception)//{// throw;//}
}
Comments
Post a Comment