private void btnSubmit_Click(object sender, EventArgs e) { Database db = new Database(); if (cmboTrain.Text.Equals("") || cmboRouteName.Text.Equals("")) { MessageBox.Show("invalid Fields"); } else { Schedule schedule = new Schedule(); schedule.setId(int.Parse(txtScheduleID.Text)); Route route = null; Train train = null; foreach (Train val in trainlist) { if (val.getRegNo().Equals(cmboTrain.Text)) { train = val; break; } } foreach (Route val in routes) { if (val.getName().Equals(cmboRouteName.Text)) { route = val; break; } } if (route != null && train != null) { schedule.setRoute(route); schedule.setTrain(train); } else { MessageBox.Show("Error nullsss"); } if (db.addSchedule(schedule)) { MessageBox.Show("Schedule Successfully added in database!"); this.Hide(); frmAdminPanel frm = new frmAdminPanel(emp); frm.Show(); } else { MessageBox.Show("Unable to add schedule!"); } } }
private void btnBack_Click(object sender, EventArgs e) { if (emp.getDesignation().Equals("Admin")) { this.Hide(); frmAdminPanel adminPanel = new frmAdminPanel(); adminPanel.Show(); } else if (emp.getDesignation().Equals("Operator")) { this.Hide(); frmOperatorPanel frm = new frmOperatorPanel(); frm.Show(); } }
private void a_auth_btn_Click(object sender, EventArgs e) { Database db = new Database(); if (db.loginAdmin(txtEmail.Text, txtPassword.Text)) { Employee emp = db.searchEmployee("" + db.getEmployeeID(txtEmail.Text, txtPassword.Text)); frmAdminPanel adminPanel = new frmAdminPanel(emp); this.Hide(); adminPanel.Show(); } else { MessageBox.Show("Invalid Credentials! Please Try Again..."); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "") { if (textBox2.Text != "") { if ((textBox1.Text == "admin" || textBox1.Text == "Admin" || textBox1.Text == "ADMIN") && textBox2.Text == "admin786") { frmAdminPanel admin = new frmAdminPanel(); this.Hide(); admin.Show(); } else { bool isval; bool isvalpass; localhost.Service1 ser = new localhost.Service1(); ser.isvaliduser(textBox1.Text, textBox2.Text, out isval, out isvalpass); if (isval) { //frmEmployee emp = new frmEmployee(); frmGenerateBill gb = new frmGenerateBill(); gb.Show(); //emp.Show(); this.Hide(); } else { MessageBox.Show("Invalid User"); } } } else { MessageBox.Show("Please Enter Password"); } } else { MessageBox.Show("Please Enter User Name"); } }
private void btnByName_Click(object sender, EventArgs e) { if (txtName.Text.Equals("")) { MessageBox.Show("Error name field is empty!"); } else { Database db = new Database(); if (db.removeStation(txtName.Text)) { MessageBox.Show("Station Successfully removed!"); this.Hide(); frmAdminPanel frm = new frmAdminPanel(); frm.Show(); } else { MessageBox.Show("Unable to remove station!"); } } }
private void btnSubmit_Click(object sender, EventArgs e) { String gender = null; if (rdoMale.Checked && !rdoFemale.Checked) { gender = "male"; } else if (!rdoMale.Checked && rdoFemale.Checked) { gender = "female"; } else { MessageBox.Show("Please Select a gender!"); return; } Person person = new Person(); EmployeeAddress address = new EmployeeAddress(); person.setFirstName(txtFirstName.Text); person.setMiddleName(txtMiddleName.Text); person.setLastName(txtLastName.Text); String[] phoneNo = { txtPhoneNo1.Text, txtPhoneNo2.Text, txtPhoneNo3.Text }; String[] cellNo = { txtCellNo1.Text, txtCellNo2.Text, txtCellNo3.Text }; person.setPhoneNo(phoneNo); person.setCellNo(cellNo); person.setCNIC(txtCNIC.Text); person.setGender(gender); person.setEmail(txtEmail.Text); person.setDateOfBirth(dateTimePickerDob.Value); address.setCity(txtCity.Text); address.setCountry(txtCountry.Text); address.setHouseNo(txtHouseNo.Text); address.setStreet(txtStreet.Text); address.setZipCode(int.Parse(txtZipCode.Text)); address.setProvince(txtProvince.Text); Employee emp = new Employee(); emp.setPersonalInformation(person); emp.setAddress(address); emp.setDesignation(txtDesignation.Text); emp.setRank(txtRank.Text); emp.setQualification(txtQualification.Text); emp.setPassword(txtPassword.Text); emp.setSalary(int.Parse(txtSalary.Text)); emp.setDateOfHire(dateTimePickerDoh.Value); emp.setAllowedSignIn(txtAllowedSignin.Text); Database db = new Database(); if (db.addEmployee(emp)) { MessageBox.Show("Employee Successfully Registered!"); this.Hide(); frmAdminPanel adminPanel = new frmAdminPanel(); adminPanel.Show(); } else { MessageBox.Show("Unable to register employee!"); } }