protected void Page_Load(object sender, EventArgs e) { string idFromSearch = (string)Session["IdFromSearch"]; // string CityFromSearch = (string)Session["CityFromSearch"]; // ClientsBL cbl = new ClientsBL(); if (cbl.ClientExist(idFromSearch)) { Client clientToDisplay = cbl.getClientByID(idFromSearch); } }
protected bool validUserField() { ExistUserErrorLabel.Visible = false; NewUserErrorLabel.Visible = false; ClientsBL cbl = new ClientsBL(); if (RadioButtonExist.Checked) { if (TextBoxID.Text != "") // Only If The Word Isnt Empty Do The Rest { if (GeneralMethods.IsDigitsOnly(TextBoxID.Text)) { if (!cbl.ClientExist(TextBoxID.Text)) { ExistUserErrorLabel.Text = "מספר הזהות שגוי או שאינו קיים במערכת"; ExistUserErrorLabel.Visible = true; return(false); } } else { ExistUserErrorLabel.Text = "אנא הכנס ספרות בלבד בתעודת הזהות"; ExistUserErrorLabel.Visible = true; return(false); } } else { ExistUserErrorLabel.Text = "חובה להכניס תעודת זהות"; ExistUserErrorLabel.Visible = true; return(false); } } // End Of Existing User else if (RadioButtonNew.Checked) { if (TextBoxID.Text != "" && TextBoxFName.Text != "" && TextBoxLName.Text != "" && TextBoxP1.Text != "") // Check If Id ,fName ,Lname And Phone1 TextBoxes Are Filled { if (cbl.ClientExist(TextBoxID.Text)) { NewUserErrorLabel.Text = "מספר הזהות כבר קיים במערכת"; NewUserErrorLabel.Visible = true; return(false); } else { if (!GeneralMethods.IsDigitsOnly(TextBoxID.Text) || !GeneralMethods.IsDigitsOnly(TextBoxP1.Text) || !GeneralMethods.IsDigitsOnly(TextBoxP2.Text) || !GeneralMethods.IsDigitsOnly(TextBoxP3.Text)) { NewUserErrorLabel.Text = "תעודת זהות ומספרי טלפון חייבים להכיל ספרות בלבד"; NewUserErrorLabel.Visible = true; return(false); } else if (!((Regex.IsMatch(TextBoxFName.Text, @"^[a-zA-Z ]+$") && Regex.IsMatch(TextBoxLName.Text, @"^[a-zA-Z ]+$")) || (Regex.IsMatch(TextBoxFName.Text, @"^[א-ת ]+$") && Regex.IsMatch(TextBoxLName.Text, @"^[א-ת ]+$"))))// Check If Only Letters In The FirstName And LastNmae TextBoxes Hebrow And English { NewUserErrorLabel.Text = "שם פרטי ומשפחה חייבים להכיל אותיות בלבד"; NewUserErrorLabel.Visible = true; return(false); } } } else { NewUserErrorLabel.Text = "חובה למלא את השדות הבאים : תעודת זהות , שם פרטי , שם משפחה ושדה טלפון1 לפחות"; NewUserErrorLabel.Visible = true; return(false); } } return(true); }