public List <TPayslip> AddPayslipToDB() { PayrollQuery pq = new PayrollQuery(); var query = pq.AddToPayslip(UserId, DateStart, DateEnd, TotalHours, TotalPay); return(query); }
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 static void LoadPayslip(DataGridView payslipDataGrid, int id) { PayrollQuery payroll = new PayrollQuery(); //employeeName = payroll.GetEmployeeInfo(UserId).ToList()[0].FirstName + payroll.GetEmployeeInfo(UserId).ToList()[0].LastName; payslipDataGrid.DataSource = payroll.GetUserPaySlip(id); payslipDataGrid.Columns.Remove("TEmployee"); }
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; }
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 searchScheduleForThatDateButton_Click(object sender, EventArgs e) { try { string schedule = scheduleDate.Value.ToString().Substring(0, 10); PayrollQuery pq = new PayrollQuery(); searchDataGridView.DataSource = pq.GetEmployeeScheduled(schedule); searchDataGridView.Columns.Remove("TEmployee"); } catch (Exception ex) { MessageBox.Show("Something went wrong! Please check your input"); } }
private void searchEmployeeDetailsButton_Click(object sender, EventArgs e) { try { string firstName = getEmployeeTextBox.Text; employeeTable = new DataTable(); PayrollQuery pq = new PayrollQuery(); searchDataGridView.DataSource = pq.GetEmployeeDetails(firstName); } catch (Exception ex) { MessageBox.Show("Something went wrong! Please check your input"); } }
public void PopulateTimesheet(DataGridView dg) { PayrollQuery pq = new PayrollQuery(); DateTime dateInc = StartDate; dg.Rows.Clear(); for (int i = 0; i <= (EndDate - StartDate).Days; i++) { string clockIn; string clockOut; string shift; try { clockIn = pq.GetTimesheetInfo(UserId, dateInc)[0].CLockInTime.ToString(); } catch (Exception) { clockIn = "---"; } try { clockOut = pq.GetTimesheetInfo(UserId, dateInc)[0].ClockOutTime.ToString(); } catch (Exception) { clockOut = "---"; } try { shift = pq.GetScheduleInfo(UserId, dateInc)[0].Shift; } catch (Exception) { shift = "OFF"; } dg.Rows.Add(dateInc.ToString().Substring(0, 10), dateInc.DayOfWeek, shift, clockIn, clockOut); dateInc = dateInc.AddDays(1); } }
void CalculatePay() { PayrollQuery pq = new PayrollQuery(); DateTime date = DateStart; decimal hours; for (int i = 0; i < (DateEnd - DateStart).Days; i++) { try { hours = pq.GetTimesheetInfo(UserId, date)[0].TotalHours; } catch (Exception e) { hours = 0; } TotalHours += hours; date = date.AddDays(1); } TotalPay = TotalHours * PayRate; }
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)); }