public bool TeacherFormValidation() { if (String.IsNullOrWhiteSpace(textBoxTeacherName.Text)) { MessageBox.Show("Please fill the Teacher name.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxTeacherName.Focus(); return(false); } if ((textBoxTeacherName.Text.Length) < 5) { MessageBox.Show("Teacher name should be atleast 6 characters long.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxTeacherName.Focus(); return(false); } if (String.IsNullOrWhiteSpace(textBoxContact.Text)) { MessageBox.Show("Please fill the Contact.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxContact.Focus(); return(false); } if ((textBoxContact.Text.Length) != 10) { MessageBox.Show("Contact should be 10 digits.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxContact.Focus(); return(false); } if (String.IsNullOrWhiteSpace(textBoxAddress.Text)) { MessageBox.Show("Please fill the Address.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxAddress.Focus(); return(false); } if ((textBoxAddress.Text.Length) < 4) { MessageBox.Show("Address should be atleast 5 characters long.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxAddress.Focus(); return(false); } if (String.IsNullOrWhiteSpace(textBoxEmail.Text)) { MessageBox.Show("Please fill the Email.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxEmail.Focus(); return(false); } Controller.Helper helper = new Controller.Helper(); if (!helper.IsValidEmail(textBoxEmail.Text)) { MessageBox.Show("Please write valid Email.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBoxEmail.Focus(); return(false); } return(true); }
private void AddSectionLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (sectionCount > 10) //To limit the credit Transactions upto 10 { return; } if (sectionCount == 9) { AddSectionLinkLabel.Visible = false; } sectionCount++; this.panelSubmit.Location = new System.Drawing.Point(panelSubmit.Location.X, (panelSubmit.Location.Y) + 31); Controller.Helper hepler = new Controller.Helper(); panelSectionTextbox.Controls.Remove(AddSectionLinkLabel); //Removes Add labelLink TextBox AddSectionTextbox = hepler.AddNewTextbox(sectionCount); //Calls the function for a textbox panelSectionTextbox.Controls.Add(AddSectionTextbox); //Adds textbox to the Section Panel panelSectionTextbox.Controls.Add(AddSectionLinkLabel); //Adds the previously removed Add labelLink //MessageBox.Show(sectionCount.ToString() + "\n" + AddSectionTextbox.Name); }
private bool StudentValidation() { //Student Name if (String.IsNullOrWhiteSpace(textBoxStudentName.Text)) { MessageBox.Show("Please fill student name.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxStudentName.Focus(); return(false); } if ((textBoxStudentName.Text).Length < 3) { MessageBox.Show("Student name should be atleast 3 character long.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxStudentName.Focus(); return(false); } //Id card if ((textBoxCardNumber.Text).Length < 4) { MessageBox.Show("Student ID card should be atleast 4 digits.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxCardNumber.Focus(); return(false); } //Student contact if ((textBoxStudentContact.Text).Length != 10) { MessageBox.Show("Student contact should be 10 digits.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxStudentContact.Focus(); return(false); } //Parent Contact if ((textBoxParentContact.Text).Length != 10) { MessageBox.Show("Parent contact card should be 10 digits.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxParentContact.Focus(); return(false); } //Student address if (String.IsNullOrWhiteSpace(textBoxAddress.Text)) { MessageBox.Show("Please fill student address.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxAddress.Focus(); return(false); } if ((textBoxAddress.Text).Length < 4) { MessageBox.Show("Student address should be atleast 4 characters long.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxAddress.Focus(); return(false); } //Student email if ((textBoxEmail.Text).Length < 8) { MessageBox.Show("Student address should be atleast 8 characters long.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxEmail.Focus(); return(false); } Controller.Helper helper = new Controller.Helper(); if (!helper.IsValidEmail(textBoxEmail.Text)) { MessageBox.Show("Enter valid Email.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); textBoxEmail.Focus(); return(false); } //Semester if (comboBoxSemester.SelectedItem == null) { MessageBox.Show("Please select the Semester.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); comboBoxSemester.Focus(); return(false); } //Section if (comboBoxSection.SelectedValue == null) { MessageBox.Show("Please select the Semester.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand); comboBoxSemester.Focus(); return(false); } return(true); }