internal void EditEmployeeGV(DataGridView dg_employeeWages, EmployeeWages employeeWages) { try { DataGridViewRow row = (DataGridViewRow)dg_employeeWages.Rows[0].Clone(); for (int i = 0; i < dg_employeeWages.Rows.Count - 1; i++) { string id = dg_employeeWages.Rows[i].Cells[0].Value.ToString(); if (Int32.Parse(id) == employeeWages.EmpID) { dg_employeeWages.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Yellow; dg_employeeWages.Rows[i].Cells[1].Value = employeeWages.PayDate; dg_employeeWages.Rows[i].Cells[2].Value = employeeWages.EmpName; dg_employeeWages.Rows[i].Cells[3].Value = employeeWages.Role; dg_employeeWages.Rows[i].Cells[4].Value = employeeWages.StartTime; dg_employeeWages.Rows[i].Cells[5].Value = employeeWages.FinishTime; dg_employeeWages.Rows[i].Cells[6].Value = employeeWages.TotalHours; dg_employeeWages.Rows[i].Cells[7].Value = employeeWages.TotalAmount; dg_employeeWages.Rows[i].Cells[8].Value = employeeWages.TotalPaid; dg_employeeWages.Rows[i].Cells[9].Value = employeeWages.PayDue; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void PostEmployeeWagesGVRecords(APIHandler apiHandler, DataGridView dg_employeeWages) { List <EmployeeWages> empWagesList = new List <EmployeeWages>(); EmployeeWages empWages = null;; foreach (DataGridViewRow row in dg_employeeWages.Rows) { if (row.Cells[0].Value != null) { empWages = new EmployeeWages(); empWages.EmpID = Convert.ToInt32(row.Cells[0].Value.ToString()); empWages.PayDate = Convert.ToDateTime(row.Cells[1].Value.ToString()); empWages.EmpName = row.Cells[2].Value.ToString(); empWages.Role = row.Cells[3].Value.ToString(); empWages.StartTime = Convert.ToDateTime(row.Cells[4].Value.ToString()); empWages.FinishTime = Convert.ToDateTime(row.Cells[5].Value.ToString()); empWages.TotalHours = Convert.ToDouble(row.Cells[6].Value.ToString()); empWages.TotalAmount = Convert.ToDouble(row.Cells[7].Value.ToString()); empWages.TotalPaid = Convert.ToDouble(row.Cells[8].Value.ToString()); empWages.PayDue = Convert.ToDouble(row.Cells[9].Value.ToString()); empWagesList.Add(empWages); } } if (empWagesList.Count > 0) { apiHandler.AddEmployeeWagesData(empWagesList); } }
//internal void EditEmployeeWagesGV(int empID, EmployeeWages employeeWages, DataGridView dg_employeeWages, int rowIndex) //{ // foreach (DataGridViewRow row in dg_employeeWages.Rows) // { // if (rowIndex != 0) // { // rowIndex = rowIndex - 1; // } // if ( row.Index== rowIndex) // { // row.Cells[1].Value = employeeWages.PayDate; // row.Cells[2].Value = employeeWages.EmpName; // row.Cells[3].Value = employeeWages.Role; // row.Cells[4].Value = employeeWages.StartTime; // row.Cells[5].Value = employeeWages.FinishTime; // row.Cells[6].Value = employeeWages.TotalHours; // row.Cells[7].Value = employeeWages.TotalAmount; // row.Cells[8].Value = employeeWages.IsPaid; // row.Cells[9].Value = employeeWages.PayDue; // } // } //} internal void AddEmployeeGV(DataGridView dg_employeeWages, EmployeeWages empWages) { { try { DataGridViewRow row = (DataGridViewRow)dg_employeeWages.Rows[0].Clone(); dg_employeeWages.Rows.Add(empWages.EmpID, empWages.PayDate, empWages.EmpName, empWages.Role, empWages.StartTime.TimeOfDay, empWages.FinishTime.TimeOfDay, empWages.TotalHours, empWages.TotalAmount, empWages.TotalPaid, empWages.PayDue); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public ManagerPanel() { EmployeeNameRole = new Dictionary <string, string>(); SupplierNameID = new Dictionary <int, string>(); empNameList = new List <string>(); supplierNameList = new List <string>(); apiHandler = new APIHandler(); dataBaseHandler = new DataBaseHandler(); moneyHandler = new MoneyHandler(); dataHandler = new DataHandler(); dgHandler = new DataGridViewHandler(); empRoleList = new List <string>(); employeeWagesList = new List <EmployeeWages>(); employeeWages = new EmployeeWages(); sales = new Sales(); supplier = new Supplier(); salesList = new List <Sales>(); ListAllEmployees(); InitializeComponent(); initializeValues(); ChangeDateTimePickerFormat(); //txtSupplierAmount.TextChanged += TextChanged; }
private void EditEmployeeWagesGV(int empID, EmployeeWages employeeWagesReceived) { employeeWages = employeeWagesReceived; employeeWages.EmpID = empID; }