private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { FirstPage obj = new FirstPage(userName); this.Close(); obj.Show(); }
private void button1_Click(object sender, EventArgs e) { var data = _con.Departments.SingleOrDefault(c => c.name == txt_department.Text.ToUpper()); if (data == null) { var datas = new tbl_department { name = txt_department.Text.ToUpper() }; _con.Departments.Add(datas); _con.SaveChanges(); MessageBox.Show("Saved Successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Department Already Exist!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (MessageBox.Show("Want to Add more department?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Add_Department obj = new Add_Department(userName); obj.Show(); this.Close(); } else { FirstPage obj = new FirstPage(userName); obj.Show(); this.Close(); } }
private void btnSave_Click(object sender, EventArgs e) { var dept = _con.Departments.SingleOrDefault(c => c.name == box_dept.SelectedItem.ToString()); var course = _con.Courses.SingleOrDefault(c => c.name == box_course.SelectedItem.ToString()); var type = _con.Type.SingleOrDefault(c => c.name == box_type.SelectedItem.ToString()); var sem = _con.Semester.SingleOrDefault(c => c.name == box_semester.SelectedItem.ToString()); for (int i = 1; i < a; i++) { dynamic txtSubject = "txt_subject" + i.ToString(); dynamic txtSubCode = "txt_subcode" + i.ToString(); string dataSubject = ((TextBox)panel2.Controls[txtSubject]).Text; string dataSubCode = ((TextBox)panel2.Controls[txtSubCode]).Text; string subject = "(" + dataSubCode + ") " + dataSubject; //Checking with Subject Code var data = new tbl_subject { name = subject, tbl_typeId = type.id, tbl_courseId = course.id, tbl_semesterId = sem.id }; _con.Subject.Add(data); _con.SaveChanges(); } if (MessageBox.Show("Subjects Saved!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { FirstPage obj = new FirstPage(userName); obj.Show(); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { var dept = _con.Departments.SingleOrDefault(c => c.name == box_dept.SelectedItem.ToString()); for (int i = 1; i < a; i++) { dynamic txtCourse = "txt_course" + i.ToString(); dynamic boxSemester = "box_semester" + i.ToString(); string dataSubject = ((TextBox)panel2.Controls[txtCourse]).Text; string dataSubCode = ((ComboBox)panel2.Controls[boxSemester]).SelectedItem.ToString(); //Checking with Subject Code int noOfSem = Int32.Parse(dataSubCode); var data = _con.Courses.SingleOrDefault(c => (c.tbl_departmentId == dept.id) && (c.name == dataSubject.ToUpper()) && (c.total_number_of_Semester == noOfSem)); if (data != null) { MessageBox.Show("Course Already Exist!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { var dataCode = new tbl_course { name = dataSubject.ToUpper(), total_number_of_Semester = Convert.ToInt32(dataSubCode), tbl_departmentId = dept.id }; _con.Courses.Add(dataCode); _con.SaveChanges(); } } if (MessageBox.Show("Saved Successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { FirstPage obj = new FirstPage(userName); this.Close(); obj.Show(); } }
private void button1_Click(object sender, EventArgs e) { var data = _con.Users.SingleOrDefault(c => c.uname.Equals(txtbox_uname.Text) && (c.password.Equals(txtbox_password.Text))); if (data == null) { MessageBox.Show("Username or password is incorrect"); txtbox_uname.Text = null; txtbox_password.Text = null; } else if (txtbox_uname.Text == null || txtbox_password.Text == null) { MessageBox.Show("Field must be filled"); txtbox_uname.Text = null; txtbox_password.Text = null; } else { //MessageBox.Show("Login Successfully"); FirstPage obj = new FirstPage(data.uname); this.Hide(); obj.Show(); } }