private void clockOutButton_Click(object sender, EventArgs e) { bool validInput = Int32.TryParse(employeeNumberTextBox.Text, out int Id); PayrollQuery pq = new PayrollQuery(); if (validInput) { if (pq.GetEmployeeInfo(Id).Count <= 0) { MessageBox.Show("Please enter a valid employee number!"); employeeNumberTextBox.Text = ""; } else { pq.EmployeeClockOut(Id); pq.InsertTotalHours(Id); } } else { MessageBox.Show("Please enter a valid employee number!"); employeeNumberTextBox.Text = ""; } }
public Payslip(int userId, DateTime start, DateTime end) { PayrollQuery pq = new PayrollQuery(); this.UserId = userId; this.DateStart = start; this.DateEnd = end; this.PayRate = pq.GetEmployeeInfo(UserId)[0].HourlyRate; CalculatePay(); }
private void Admin_Form_Load(object sender, EventArgs e) { PayrollQuery payroll = new PayrollQuery(); adminNameLabel.Text = payroll.GetEmployeeInfo(this._UserId).ToList()[0].FirstName + " " + payroll.GetEmployeeInfo(this._UserId).ToList()[0].LastName; // TODO: This line of code loads data into the 'payrollDataSet.TTimesheet' table. You can move, or remove it, as needed. this.tTimesheetTableAdapter.Fill(this.payrollDataSet.TTimesheet); // TODO: This line of code loads data into the 'payrollDataSet.TEmployee' table. You can move, or remove it, as needed. this.tEmployeeTableAdapter.Fill(this.payrollDataSet.TEmployee); // TODO: This line of code loads data into the 'payrollDataSet.TSchedule' table. You can move, or remove it, as needed. this.tScheduleTableAdapter.Fill(this.payrollDataSet.TSchedule); }
private void loginButton_Click(object sender, EventArgs e) { PayrollQuery pq = new PayrollQuery(); string userName = usernameTextBox.Text; List <TUserLogin> userCredential = pq.GetUserLoginsPermission(userName); if (userCredential.Count <= 0) { MessageBox.Show("Username or Password is incorrect!"); usernameTextBox.Text = string.Empty; passwordTextBox.Text = string.Empty; } else { int empId = (int)userCredential[0].EmployeeId; string position = pq.GetEmployeeInfo(empId)[0].Position; string userPasswordFromDatabase = userCredential[0].Password; string inputPassword = passwordTextBox.Text; if (usernameTextBox.Text == "" & passwordTextBox.Text == "") { MessageBox.Show("Fields are required"); } else if (userPasswordFromDatabase == inputPassword) { if (position == "Admin") { MessageBox.Show("Login Successful"); EmpId = Int32.Parse((pq.GetUserLoginsPermission(userName)[0].EmployeeId).ToString()); Admin_Form admin = new Admin_Form(this._EmpId); admin.Show(); } else { MessageBox.Show("Login Successful"); EmpId = Int32.Parse((pq.GetUserLoginsPermission(userName)[0].EmployeeId).ToString()); Payroll payroll = new Payroll(this._EmpId); payroll.Show(); } } else { MessageBox.Show("Username or Password is incorrect!"); usernameTextBox.Text = string.Empty; passwordTextBox.Text = string.Empty; } } }
private void printPayslip_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Bitmap bmp = Properties.Resources.Editing_Circle_SGBerlin; Image image = bmp; PayrollQuery payroll = new PayrollQuery(); int index = showPayslipOnDataGridView.CurrentRow.Index; employeeName = payroll.GetEmployeeInfo(_UserId).ToList()[0].FirstName + payroll.GetEmployeeInfo(_UserId).ToList()[0].LastName; dateFrom = showPayslipOnDataGridView.Rows[index].Cells["DateFrom"].Value.ToString(); endDate = showPayslipOnDataGridView.Rows[index].Cells["EndDate"].Value.ToString(); totalHours = (decimal)showPayslipOnDataGridView.Rows[index].Cells["TotalHours"].Value; totalMoney = totalHours * payroll.GetEmployeeInfo(_UserId)[0].HourlyRate; e.Graphics.DrawImage(bmp, 365, 0, 150, 150); e.Graphics.DrawString("Employee Name : " + employeeName, new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 200)); e.Graphics.DrawString("-----------------------------------------------------", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 250)); e.Graphics.DrawString("DateFrom : " + dateFrom.ToString(), new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 300)); e.Graphics.DrawString("-----------------------------------------------------", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 350)); e.Graphics.DrawString("EndDate : " + endDate.ToString(), new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 400)); e.Graphics.DrawString("-----------------------------------------------------", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 450)); e.Graphics.DrawString("TotalHours : " + totalHours.ToString(), new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 500)); e.Graphics.DrawString("-----------------------------------------------------", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 550)); e.Graphics.DrawString("TotalMoney :" + totalMoney.ToString(), new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(300, 600)); }
private void SetInfo() { PayrollQuery payroll = new PayrollQuery(); this.FirstName = payroll.GetEmployeeInfo(EmployeeId).ToList()[0].FirstName; this.LastName = payroll.GetEmployeeInfo(EmployeeId).ToList()[0].LastName; this.DateOfBirth = payroll.GetEmployeeInfo(EmployeeId).ToList()[0].DOB.ToShortDateString(); this.Position = payroll.GetEmployeeInfo(EmployeeId).ToList()[0].Position; this.DateHired = payroll.GetEmployeeInfo(EmployeeId).ToList()[0].DateHired.ToShortDateString(); this.PayRate = payroll.GetEmployeeInfo(EmployeeId).ToList()[0].HourlyRate; }