private bool valuesValidity() { bool flag = false; if (cbSelectedStudent.SelectedIndex == -1) { cbSelectedStudent.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (cbSelectedCourse.SelectedIndex == -1) { cbSelectedCourse.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtMarksObt.Text == String.Empty) { txtMarksObt.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtTotalMarks.Text == String.Empty) { txtTotalMarks.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } return(flag); }
private void btnRegister_Click(object sender, EventArgs e) { if (valuesValidity()) { return; } string group = ""; if (cbGroup.SelectedIndex == 0) { group = "Science"; } else { group = "Arts"; } if (!txtPassword.Text.Equals(txtConfirmPass.Text)) { DiaologForm dialog = new DiaologForm("Passwords Dont Match .."); dialog.Show(); return; } string section = getSection(classes.ElementAt(cbClasses.SelectedIndex).Class_Name1); string insertQry = "INSERT INTO APPLICATIONS values ('" + CNICTxt.Text + "','" + txtName.Text + "','" + txtFatherName.Text + "','" + txtDOB.Text + "','" + txtLastDegree.Text + "','" + txtInstitution.Text + "','" + txtMarksObtained.Text + "','" + txtTotalMarks.Text + "','" + classes.ElementAt(cbClasses.SelectedIndex).Class_Name1 + section + "','" + group + "','" + txtEMail.Text + "','" + txtPassword.Text + "','" + txtRollNo.Text + "','" + txtBoard.Text + "')"; SqlCommand cmd = new SqlCommand(); cmd.Connection = SMS.connect; cmd.CommandText = insertQry; SMS.connect.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { clearForm(); DiaologForm dialog = new DiaologForm("Application Sent Successfully.."); dialog.Show(); } SMS.connect.Close(); }
public void markAttendance() { if (!checkAttendanceStatus()) { return; } bool attFlag = false; foreach (var item in students) { string query = "INSERT INTO STUDENT_ATTENDANCE_ values ('" + DateTime.Now.ToString("d/M/yyyy") + "','" + item.St_id + "','" + item.Attendance + "')"; SqlCommand cmd = new SqlCommand(); cmd.Connection = SMS.connect; cmd.CommandText = query; SMS.connect.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { attFlag = true; DiaologForm dilog = new DiaologForm("Attendance Marked Successfully"); dilog.Show(); } else { DiaologForm dilog = new DiaologForm("Could not mark attendance.."); dilog.Show(); } SMS.connect.Close(); } if (attFlag) { DiaologForm dilog = new DiaologForm("Attendance Marked Successfully"); dilog.Show(); } else { DiaologForm dilog = new DiaologForm("Could not mark attendance.."); dilog.Show(); } }
private void login_Click_1(object sender, EventArgs e) { if (valuesValidity()) { return; } if (verifyStudent(txtCNIC_.Text, txtPassword.Text)) { this.Hide(); Student_portal portal = new Student_portal(this, txtCNIC_.Text); portal.Show(); } else { DiaologForm dialog = new DiaologForm("User does not exist with these credentials"); dialog.Show(); } }
private bool valuesValidity() { bool flag = false; if (txtTeacherCNIC.Text == String.Empty) { txtTeacherCNIC.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtTeacherName.Text == String.Empty) { txtTeacherName.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtTeacherDesignation.Text == String.Empty) { txtTeacherDesignation.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtTeacherPassword.Text == String.Empty) { txtTeacherPassword.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtTeacherClass.SelectedIndex == 0) { txtTeacherClass.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } return(flag); }
private void button1_Click(object sender, EventArgs e) { if (valuesValidity()) { return; } if (txtUser.Text.Equals("admin") && txtPass.Text.Equals("admin")) { this.Hide(); //AdminDashboard adminDashboard = new AdminDashboard(this); //adminDashboard.Show(); new Admin(this).Show(); } else { DiaologForm form = new DiaologForm("User Email or Password Not correct"); form.Show(); } }
bool valuesValidity() { bool flag = false; if (txtStudent.SelectedIndex == -1) { txtStudent.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtAmount2.Text == String.Empty) { txtamount.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtstatus.Text == String.Empty) { txtamount.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtremainingamount.Text == String.Empty) { txtamount.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (cbclass.SelectedIndex == 0) { txtamount.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } return(flag); }
private bool valuesValidity() { bool flag = false; if (textBox1.Text == String.Empty) { textBox1.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (textBox2.Text == String.Empty) { textBox2.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } return(flag); }
public bool checkAttendanceStatus() { string query = "select * from STUDENT_ATTENDANCE_ where Date_ = '" + DateTime.Now.ToString("d/M/yyyy") + "'"; SqlCommand cmd = new SqlCommand(); cmd.Connection = SMS.connect; cmd.CommandText = query; SMS.connect.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { DiaologForm form = new DiaologForm("Todays Attendance Already Marked You cannot Mark Again !!"); form.Show(); SMS.connect.Close(); return(false); } SMS.connect.Close(); return(true); }
bool valuesValidity() { bool flag = false; if (txtstaffid.Text == String.Empty) { txtstaffid.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtsalary.Text == String.Empty) { txtsalary.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtbonus.Text == String.Empty) { txtbonus.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txttax.Text == String.Empty) { txttax.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } return(flag); }
private void addStudentToDB() { try { int index = cbApplications.SelectedIndex; StudentData student = applications.ElementAt(index); string InsertQuery = "INSERT INTO Student (Student_ID,Name,St_Father_Name,Class_ID,password)VALUES('" + student.CNIC1 + "','" + student.Name1 + "','" + student.FathersName1 + "','" + student.Class_ + "','" + student.Password + "')"; SqlCommand cmd = new SqlCommand(); cmd.Connection = SMS.connect; cmd.CommandText = InsertQuery; SMS.connect.Open(); int rows = cmd.ExecuteNonQuery(); SMS.connect.Close(); if (rows > 0) { DiaologForm dialogForm = new DiaologForm("Student Approved Successfully"); dialogForm.Show(); removeApplication(); } else { DiaologForm dialogForm = new DiaologForm("Could Not Approve Student"); dialogForm.Show(); } clearForm(); } catch (Exception exception) { DiaologForm dialogForm = new DiaologForm("Something Went Wrong" + exception.ToString()); dialogForm.Show(); clearForm(); } }
private void assignGradesToStudent(string stId, string courseId, string marksObt, string totalMarks) { if (valuesValidity()) { return; } if (isGradeAlreadyAssigned(stId, courseId)) { DiaologForm form = new DiaologForm("This Course is Already Assigned Marks .."); form.Show(); return; } string query = "INSERT INTO Student_Grades values ('" + stId + "','" + marksObt + "','" + courseId + "','" + totalMarks + "')"; SqlCommand cmd = new SqlCommand(); cmd.Connection = SMS.connect; cmd.CommandText = query; SMS.connect.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { DiaologForm dilog = new DiaologForm("Marks Successfully Assigned"); dilog.Show(); clearForm(); } else { DiaologForm dilog = new DiaologForm("Could not assign marks.."); dilog.Show(); } SMS.connect.Close(); }
private bool valuesValidity() { bool flag = false; if (CNICTxt.Text == String.Empty) { CNICTxt.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtName.Text == String.Empty) { txtName.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtFatherName.Text == String.Empty) { txtFatherName.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtDOB.Text == String.Empty) { txtDOB.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtLastDegree.Text == String.Empty) { txtLastDegree.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtInstitution.Text == String.Empty) { txtInstitution.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtMarksObtained.Text == String.Empty) { txtMarksObtained.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtTotalMarks.Text == String.Empty) { txtTotalMarks.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (cbClasses.SelectedItem == null) { cbClasses.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (cbGroup.SelectedItem == null) { cbGroup.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtEMail.Text == String.Empty) { txtEMail.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtPassword.Text == String.Empty) { txtPassword.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtConfirmPass.Text == String.Empty) { txtConfirmPass.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtRollNo.Text == String.Empty) { txtRollNo.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } if (txtBoard.Text == String.Empty) { txtBoard.ForeColor = Color.Red; DiaologForm dialog = new DiaologForm("this field is madatory,please fill all the fields"); dialog.Show(); flag = true; } return(flag); }