private void btnUpdate_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Update")) { return; } for (int i = 0; i < lCountCol; i++) { lRecord[i] = dgvLists.CurrentRow.Cells[i].Value.ToString(); } if (lRecord.Length > 0) { if (lRecord[0].ToString() != "") { switch (lType.Name) { case "Employee": EmployeeDetailUI loEmployeeDetail = new EmployeeDetailUI(lRecord); loEmployeeDetail.ParentList = this; loEmployeeDetail.ShowDialog(); break; case "EmploymentType": EmploymentTypeDetailUI loEmploymentTypeDetail = new EmploymentTypeDetailUI(lRecord); loEmploymentTypeDetail.ParentList = this; loEmploymentTypeDetail.ShowDialog(); break; case "Designation": DesignationDetailUI loDesignationDetail = new DesignationDetailUI(lRecord); loDesignationDetail.ParentList = this; loDesignationDetail.ShowDialog(); break; case "Department": DepartmentDetailUI loDepartmentDetail = new DepartmentDetailUI(lRecord); loDepartmentDetail.ParentList = this; loDepartmentDetail.ShowDialog(); break; case "LeaveType": LeaveTypeDetailUI loLeaveTypeDetail = new LeaveTypeDetailUI(lRecord); loLeaveTypeDetail.ParentList = this; loLeaveTypeDetail.ShowDialog(); break; case "Holiday": HolidayDetailUI loHolidayDetail = new HolidayDetailUI(lRecord); loHolidayDetail.ParentList = this; loHolidayDetail.ShowDialog(); break; case "WorkSchedule": WorkScheduleDetailUI loWorkScheduleDetail = new WorkScheduleDetailUI(lRecord); loWorkScheduleDetail.ParentList = this; loWorkScheduleDetail.ShowDialog(); break; } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click"); em.ShowDialog(); return; } }
private void btnCreate_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Create")) { return; } if (dgvLists.Rows.Count == 0) { refresh("ViewAll", "", "", false); } switch (lType.Name) { case "Employee": EmployeeDetailUI loEmployeeDetail = new EmployeeDetailUI(); loEmployeeDetail.ParentList = this; loEmployeeDetail.ShowDialog(); break; case "EmploymentType": EmploymentTypeDetailUI loEmploymentTypeDetail = new EmploymentTypeDetailUI(); loEmploymentTypeDetail.ParentList = this; loEmploymentTypeDetail.ShowDialog(); break; case "Designation": DesignationDetailUI loDesignationDetail = new DesignationDetailUI(); loDesignationDetail.ParentList = this; loDesignationDetail.ShowDialog(); break; case "Department": DepartmentDetailUI loDepartmentDetail = new DepartmentDetailUI(); loDepartmentDetail.ParentList = this; loDepartmentDetail.ShowDialog(); break; case "LeaveType": LeaveTypeDetailUI loLeaveTypeDetail = new LeaveTypeDetailUI(); loLeaveTypeDetail.ParentList = this; loLeaveTypeDetail.ShowDialog(); break; case "Holiday": HolidayDetailUI loHolidayDetail = new HolidayDetailUI(); loHolidayDetail.ParentList = this; loHolidayDetail.ShowDialog(); break; case "WorkSchedule": WorkScheduleDetailUI loWorkScheduleDetail = new WorkScheduleDetailUI(); loWorkScheduleDetail.ParentList = this; loWorkScheduleDetail.ShowDialog(); break; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCreate_Click"); em.ShowDialog(); return; } }