public void LoadComboBox() { try { EList = new List <EmpCombo>(); db = new LetranIntegratedSystemEntities(); var emp = db.Employees.Where(m => m.Archive == false).ToList(); foreach (var i in emp) { EmpCombo ec = new EmpCombo(); ec.EmployeeID = i.EmployeeID; ec.EmployeeNumber = i.EmployeeNo; ec.EmployeeName = i.LastName.ToUpper() + ", " + i.FirstName.ToUpper(); EList.Add(ec); } cbEmployee.ItemsSource = EList.OrderBy(m => m.EmployeeName); cbEmployee.DisplayMemberPath = "EmployeeName"; cbEmployee.SelectedValuePath = "EmployeeID"; cbType.ItemsSource = db.LeaveTypes.OrderBy(m => m.LeaveCode).ToList(); cbType.DisplayMemberPath = "LeaveDescription"; cbType.SelectedValuePath = "LeaveTypeID"; } catch (Exception) { MessageBox.Show("Something went wrong!", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetCertificate() { try { ECList = new List <HRiSClass.EmploymentCertificateList>(); using (var db = new LetranIntegratedSystemEntities()) { var appcert = db.HRISApplicationCertificateEmployments.ToList(); foreach (var x in appcert) { HRiSClass.EmploymentCertificateList ecl = new HRiSClass.EmploymentCertificateList(); ecl.ApplicantID = x.CetificateEmploymentID; ecl.EmployeeName = x.LastName.ToUpper() + ", " + x.FirstName.ToUpper() + " " + x.MiddleName.ToUpper(); ecl.DepartmentID = x.DepartmentID; ecl.Department = x.AcademicDepartment.AcaDepartmentName; ecl.Sendee = x.Sendee; ecl.SendeeAddress = x.SendeeAddress; ecl.DateFile = x.DateFile; ecl.DateNeeded = x.DateNeeded; ecl.Purpose = x.Purpose; ECList.Add(ecl); } dgEmpCert.ItemsSource = ECList.OrderByDescending(m => m.DateFile); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void cbDepartment_SelectionChanged(object sender, SelectionChangedEventArgs e) { var deptid = Convert.ToInt32(cbDepartment.SelectedValue); try { using (var db = new LetranIntegratedSystemEntities()) { lEmployeeShiftList = new List <HRiSClass.EmployeeShiftList>(); var empSchedule = db.GetEmployeeSchedules().Where(m => m.AcaDeptID == deptid).ToList().OrderBy(m => m.Name); foreach (var x in empSchedule) { HRiSClass.EmployeeShiftList employeeShift = new HRiSClass.EmployeeShiftList(); employeeShift.EmployeeNo = x.Employeeno; employeeShift.EmployeeName = x.Name; employeeShift.ShiftCode = x.EmployeeShiftCode; employeeShift.EmployeeID = x.EmployeeID; employeeShift.Department = x.AcaAcronym; lEmployeeShiftList.Add(employeeShift); } dgEmployeeScheduleList.ItemsSource = lEmployeeShiftList.OrderBy(m => m.EmployeeName); } } catch (Exception) { throw; } }
private void cbEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { using (var db = new LetranIntegratedSystemEntities()) { BList = new List <BalanceList>(); var empid = Convert.ToInt32(cbEmployee.SelectedValue); var x = db.GetHRiSLeaveBalances().Where(m => m.EmployeeID == empid).OrderBy(m => m.EmployeeName).FirstOrDefault(); BalanceList bl = new BalanceList(); if (x != null) { bl.Department = x.Department; bl.Designation = x.Designation; bl.EmployeeID = x.EmployeeID; bl.EmployeeName = x.EmployeeName.ToUpper(); bl.EmployeeNumber = x.EmployeeNo; bl.LeaveBalanceID = x.LeaveBalanceID; bl.SickLeaveBalance = x.SickLeaveBalance.Value; bl.VacationLeaveBalance = x.VacationLeaveBalance.Value; bl.ServiceIncentiveLeave = x.ServiceIncentiveLeave.Value; //el.NickName = x.Nickname == null ? " " : x.Nickname; BList.Add(bl); dgBalances.ItemsSource = BList.OrderBy(m => m.EmployeeName); } } } catch (Exception) { throw; } }
public void GridRefresh() { try { db = new LetranIntegratedSystemEntities(); EGList = new List <EmployeeGenderList>(); var emp = db.GetHRiSListbyGender().ToList(); foreach (var x in emp) { EmployeeGenderList egl = new EmployeeGenderList(); egl.Department = x.AcaDepartmentName; egl.EmployeeName = x.EmployeeName; egl.Gender = x.Gender; EGList.Add(egl); } EGList = EGList.OrderBy(m => m.Department).ToList(); ListCollectionView eglcollection = new ListCollectionView(EGList); eglcollection.GroupDescriptions.Add(new PropertyGroupDescription("Department")); dgEmployeeGender.ItemsSource = eglcollection; } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { using (var db = new LetranIntegratedSystemEntities()) { var empid = Convert.ToInt32(cbEmployee.SelectedValue); var employee = db.Employees.Where(m => m.EmployeeID == empid).FirstOrDefault(); var dept = db.AcademicDepartments.Where(m => m.AcaDeptID == employee.EmployeeDepartmentID).FirstOrDefault(); var pos = db.EmployeePositions.Where(m => m.EmployeePositionID == employee.EmployeePositionID).FirstOrDefault(); EmployeeHistory eh = new EmployeeHistory(); eh.EmployeeID = empid; eh.DepartmentID = dept.AcaDeptID; eh.EmployeePositionID = pos.EmployeePositionID; eh.StartDate = startDate.SelectedDate; eh.Remark = txtRemark.Text; eh.EndDate = endDate.SelectedDate; db.EmployeeHistories.Add(eh); db.SaveChanges(); Clear(); MessageBox.Show("Successfully added.", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnLoad_Click(object sender, RoutedEventArgs e) { try { Mouse.OverrideCursor = Cursors.Wait; db = new LetranIntegratedSystemEntities(); EDList = new List <EmployeeDepartmentList>(); var dept = cbDepartment.SelectedValue.ToString(); var emp = db.GetHRiSEmployeebyDepartment().ToList(); foreach (var x in emp) { EmployeeDepartmentList edl = new EmployeeDepartmentList(); edl.Department = x.AcaDepartmentName; edl.EmployeeDesignation = x.EmployeeStatusName; edl.EmployeeLevel = x.EmployeeLevel; edl.EmployeeName = x.EmployeeName; edl.EmployeePosition = x.EmployeePositionName; EDList.Add(edl); } EDList = EDList.OrderBy(m => m.Department).Where(m => m.Department == dept).ToList(); ListCollectionView edlcollection = new ListCollectionView(EDList); edlcollection.GroupDescriptions.Add(new PropertyGroupDescription("Department")); dgEmployeeDepartment.ItemsSource = edlcollection; Mouse.OverrideCursor = null; } catch (Exception) { Mouse.OverrideCursor = null; MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetSubstitute() { try { SCList = new List <HRiSClass.SubstituteClassList>(); using (var db = new LetranIntegratedSystemEntities()) { var sub = db.HRISSubstituteClasses.ToList(); foreach (var x in sub) { HRiSClass.SubstituteClassList sc = new HRiSClass.SubstituteClassList(); sc.SubstituteClassID = x.SubstitutionClassID; sc.EmployeeID = x.Employee.EmployeeID; sc.EmployeeNumber = x.Employee.EmployeeNo; sc.EmployeeName = x.Employee.LastName.ToUpper() + ", " + x.Employee.FirstName.ToUpper(); sc.SubEmployeeID = x.Employee1.EmployeeID; sc.SubEmployeeNumber = x.Employee1.EmployeeNo; sc.SubEmployeeName = x.Employee1.LastName.ToUpper() + ", " + x.Employee1.FirstName.ToUpper(); sc.DateFile = x.DateFiled; sc.Reason = x.Reason; SCList.Add(sc); } dgSubstitute.ItemsSource = SCList.OrderByDescending(m => m.DateFile); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetNOA() { try { NOAList = new List <HRiSClass.NoticeOfAbscenceList>(); using (var db = new LetranIntegratedSystemEntities()) { var noa = db.HRISNoticeofAbsences.ToList(); foreach (var x in noa) { HRiSClass.NoticeOfAbscenceList noal = new HRiSClass.NoticeOfAbscenceList(); noal.NoticeAbsenceID = x.NoticeAbsenceID; noal.EmployeeID = x.Employee.EmployeeID; noal.EmployeeNumber = x.Employee.EmployeeNo; noal.EmployeeName = x.Employee.LastName.ToUpper() + ", " + x.Employee.FirstName.ToUpper(); noal.DateFiled = x.DateFiled.Value; noal.StartDate = x.DateStart.Value; noal.EndDate = x.DateEnd.Value; noal.Reason = x.Reason; noal.Days = x.NumberDays; NOAList.Add(noal); } dgNoticeOfAbscence.ItemsSource = NOAList.OrderByDescending(m => m.DateFiled); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetJobTitle() { try { OJTList = new List <OnlineJobTitleList>(); using (var db = new LetranIntegratedSystemEntities()) { var jobtitle = db.EmployeeJobs.ToList(); foreach (var x in jobtitle) { OnlineJobTitleList ojtl = new OnlineJobTitleList(); ojtl.EmployeeJobID = x.EmployeeJobID; ojtl.JobTitle = x.JobTitle; ojtl.Qualifications = x.Qualifications; ojtl.Description = x.Description; ojtl.Type = x.Type; ojtl.IsActive = x.Status.Value; OJTList.Add(ojtl); } dgJobTitle.ItemsSource = OJTList.OrderBy(m => m.JobTitle); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetHolidays() { try { using (var db = new LetranIntegratedSystemEntities()) { lHRISHoliday = new List <HRISHoliday>(); var holidays = db.HRISHolidays.ToList(); foreach (var x in holidays) { HRISHoliday ho = new HRISHoliday(); ho.Date = x.Date; ho.Description = x.Description; lHRISHoliday.Add(ho); } dgHolidaysList.ItemsSource = lHRISHoliday.OrderBy(m => m.Date); } } catch (Exception) { throw; } }
private void viewApplication_Click(object sender, RoutedEventArgs e) { if (dgAppJob.SelectedItem != null) { try { using (var db = new LetranIntegratedSystemEntities()) { var selectedItem = (OnlineJobApplicantList)(dgAppJob.SelectedItem); UpdateOnlineApplication uoa = new UpdateOnlineApplication(); uoa.lblPos.Content += db.EmployeeJobs.Find(selectedItem.EmployeeJobID).JobTitle.ToUpper(); uoa.ApplicationID = selectedItem.ApplicationID; uoa.Owner = this; uoa.ShowDialog(); GetJobTitle(); TextClear(); dgAppJob.ItemsSource = null; } } catch (Exception) { MessageBox.Show("Something went wrong.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { using (var db = new LetranIntegratedSystemEntities()) { if (dgLeave.SelectedItem != null) { var selectedItem = (LeaveType)(dgLeave.SelectedItem); var find = db.LeaveTypes.Find(selectedItem.LeaveTypeID); find.LeaveCode = txtLeaveCode.Text; find.LeaveDescription = txtLeaveName.Text; db.SaveChanges(); MessageBox.Show("Update Successful", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information); TextClear(); GetLeave(); } } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { using (var db = new LetranIntegratedSystemEntities()) { if (!String.IsNullOrEmpty(txtLeaveName.Text) || !String.IsNullOrEmpty(txtLeaveCode.Text)) { LeaveType lt = new LeaveType(); lt.LeaveCode = txtLeaveCode.Text; lt.LeaveDescription = txtLeaveName.Text; db.LeaveTypes.Add(lt); db.SaveChanges(); MessageBox.Show("Add Successful", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information); TextClear(); GetLeave(); } else { MessageBox.Show("Required fields cannot be empty.", "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); } } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetEmployeeHistory() { try { using (var db = new LetranIntegratedSystemEntities()) { lEmployeeHistoryList = new List <EmployeHistoryList>(); var emphistory = db.EmployeeHistories.ToList(); foreach (var x in emphistory) { EmployeHistoryList eh = new EmployeHistoryList(); var emp = db.Employees.Where(m => m.EmployeeID == x.EmployeeID).FirstOrDefault(); var dep = db.AcademicDepartments.Where(m => m.AcaDeptID == x.DepartmentID).FirstOrDefault(); var pos = db.EmployeePositions.Where(m => m.EmployeePositionID == x.EmployeePositionID).FirstOrDefault(); eh.EmployeeName = emp.LastName + ", " + emp.FirstName; eh.EmployeeNo = emp.EmployeeNo; eh.Remark = x.Remark; eh.Department = dep.AcaAcronym; eh.Position = pos.EmployeePositionName; eh.StartDate = x.StartDate.Value.Date; eh.EndDate = x.EndDate.Value.Date; lEmployeeHistoryList.Add(eh); } dgEmployeeHistory.ItemsSource = lEmployeeHistoryList.OrderBy(m => m.EmployeeName); } } catch (Exception) { throw; } }
public void GetJobPosition() { try { EPList = new List <EmployeePositionList>(); using (var db = new LetranIntegratedSystemEntities()) { var jobpos = db.EmployeePositions.ToList(); foreach (var x in jobpos) { EmployeePositionList epl = new EmployeePositionList(); epl.PositionID = x.EmployeePositionID; if (x.EmployeeRank != null) { epl.PositionRankID = x.EmployeeRank.EmployeeRankID; epl.PositionRank = x.EmployeeRank.EmployeeRankName; } epl.Description = x.Description; epl.IsActive = x.Active; epl.PositionName = x.EmployeePositionName; EPList.Add(epl); } dgJobPosition.ItemsSource = EPList.OrderBy(m => m.PositionName); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { db = new LetranIntegratedSystemEntities(); var L = db.Leaves.Find(LeaveID); if (L != null) { var typeid = Convert.ToInt32(cbLeaveType.SelectedValue); L.StartDate = Convert.ToDateTime(dpStart.SelectedDate); L.EndDate = Convert.ToDateTime(dpEnd.SelectedDate); L.LeaveTypeID = typeid; L.Reason = txtReason.Text; L.Days = Convert.ToDecimal(txtDays.Text); //if (!String.IsNullOrEmpty(cbSickLeaveType.Text)) // L.SickLeaveReasonID = Convert.ToInt32(cbSickLeaveType.SelectedValue); //L.LeaveApprovedStatusID = 3; db.SaveChanges(); MessageBox.Show("Save Successful", "System Sucess!", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { MessageBox.Show("Leave not found", "System Warning.", MessageBoxButton.OK, MessageBoxImage.Warning); this.Close(); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { using (var db = new LetranIntegratedSystemEntities()) { HRISOffCampusActivity oca = new HRISOffCampusActivity(); oca.EmployeeID = Convert.ToInt32(cbEmp.SelectedValue); oca.DateStart = startDate.SelectedDate; oca.DateEnd = startDate.SelectedDate; oca.DateFiled = dateFile.SelectedDate; oca.Reason = txtReason.Text; TimeSpan duration = DateTime.Parse(endTime.Text).Subtract(DateTime.Parse(startTime.Text)); oca.TotalHours = duration.ToString(@"h\:mm"); oca.StartTime = startTime.Text; oca.EndTime = endTime.Text; db.HRISOffCampusActivities.Add(oca); db.SaveChanges(); MessageBox.Show("Success!.", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information); Clear(); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetLeave() { try { db = new LetranIntegratedSystemEntities(); dl = new List <DisapprovedList>(); var x = db.GetHRiSLeaveCancelled().ToList(); foreach (var i in x) { DisapprovedList Dlist = new DisapprovedList(); Dlist.LeaveID = i.LeaveID; Dlist.EmployeeNo = i.EmployeeNo; Dlist.EmployeeName = i.EmployeeName.ToUpper(); Dlist.DateFiled = i.FiledDate.Value; Dlist.StartDate = i.StartDate.Value; Dlist.EndDate = i.EndDate.Value; Dlist.Type = i.LeaveCode; Dlist.Days = i.Days.Value; Dlist.Status = i.Status; Dlist.Reason = i.Reason; Dlist.LeaveStatusID = i.LeaveApprovedStatusID.Value; dl.Add(Dlist); } dgDisapproved.ItemsSource = dl.OrderByDescending(m => m.DateFiled); } catch (Exception) { MessageBox.Show("Something went wrong!", "System Warning.", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public void ResetPassword() { try { using (var db = new LetranIntegratedSystemEntities()) { string userid = ""; var a = ((HRiSClass.AccountManagementList)dgAdmin.SelectedItem); var b = ((HRiSClass.AccountManagementList)dgEmployee.SelectedItem); var c = ((HRiSClass.AccountManagementList)dgFaculty.SelectedItem); var d = ((HRiSClass.AccountManagementList)dgFacultyHead.SelectedItem); var f = ((HRiSClass.AccountManagementList)dgGuidance.SelectedItem); var g = ((HRiSClass.AccountManagementList)dgHR.SelectedItem); var h = ((HRiSClass.AccountManagementList)dgRegistrar.SelectedItem); if (a != null) { userid = a.AccountID; } else if (b != null) { userid = b.AccountID; } else if (c != null) { userid = c.AccountID; } else if (d != null) { userid = d.AccountID; } else if (f != null) { userid = f.AccountID; } else if (g != null) { userid = g.AccountID; } else if (h != null) { userid = h.AccountID; } if (!String.IsNullOrEmpty(userid)) { AspNetUser search = db.AspNetUsers.Where(m => m.Id == userid).FirstOrDefault(); var passwordHasher = new Microsoft.AspNet.Identity.PasswordHasher(); search.PasswordHash = passwordHasher.HashPassword("letran1620"); db.SaveChanges(); MessageBox.Show("Password has been reset.", "Successful", MessageBoxButton.OK, MessageBoxImage.Information); GetAccount(); } } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GridRefresh() { try { db = new LetranIntegratedSystemEntities(); EDList = new List <EmployeeDepartmentList>(); var emp = db.GetHRiSEmployeebyDepartment().ToList(); foreach (var x in emp) { EmployeeDepartmentList edl = new EmployeeDepartmentList(); edl.Department = x.AcaDepartmentName; edl.EmployeeDesignation = x.EmployeeStatusName; edl.EmployeeLevel = x.EmployeeLevel; edl.EmployeeName = x.EmployeeName.ToUpper(); edl.EmployeePosition = x.EmployeePositionName; EDList.Add(edl); } EDList = EDList.OrderBy(m => m.Department).ToList(); ListCollectionView edlcollection = new ListCollectionView(EDList); edlcollection.GroupDescriptions.Add(new PropertyGroupDescription("Department")); dgEmployeeDepartment.ItemsSource = edlcollection; } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetOffCampus() { try { OCAList = new List <HRiSClass.OffCampusActivityList>(); using (var db = new LetranIntegratedSystemEntities()) { var offcampus = db.HRISOffCampusActivities.ToList(); foreach (var x in offcampus) { HRiSClass.OffCampusActivityList oca = new HRiSClass.OffCampusActivityList(); oca.OffCampusActivityID = x.OffCampusActivityID; oca.EmployeeID = x.Employee.EmployeeID; oca.EmployeeNumber = x.Employee.EmployeeNo; oca.EmployeeName = x.Employee.LastName.ToUpper() + ", " + x.Employee.FirstName.ToUpper(); oca.Reason = x.Reason; oca.DateStart = x.DateStart.Value; oca.DateEnd = x.DateEnd.Value; oca.DateFiled = x.DateFiled.Value; OCAList.Add(oca); } dgOffCampus.ItemsSource = OCAList.OrderByDescending(m => m.DateFiled); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void LoadComboBox() { try { List <EmpCombo> EList = new List <EmpCombo>(); using (var db = new LetranIntegratedSystemEntities()) { var emp = (from a in db.LeaveBalances join b in db.Employees on a.EmployeeID equals b.EmployeeID select new { b.FirstName, b.LastName, b.EmployeeNo, b.EmployeeID }).ToList(); foreach (var i in emp) { EmpCombo ec = new EmpCombo(); ec.EmployeeID = i.EmployeeID; ec.EmployeeNumber = i.EmployeeNo; ec.EmployeeName = i.LastName.ToUpper() + ", " + i.FirstName.ToUpper(); EList.Add(ec); } cbEmployee.ItemsSource = EList.OrderBy(m => m.EmployeeName); cbEmployee.DisplayMemberPath = "EmployeeName"; cbEmployee.SelectedValuePath = "EmployeeID"; } } catch (Exception) { throw; } }
private void cbShiftCode_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { using (var db = new LetranIntegratedSystemEntities()) { var shiftCode = Convert.ToString(cbShiftCode.SelectedValue); if (shiftCode != "") { var shift = db.HRISShifts.Where(m => m.ShiftCode == shiftCode).FirstOrDefault(); txtDescription.Text = shift.Description; txtEndTime.Text = shift.EndTime; txtStartTime.Text = shift.StartTime; } else { return; } } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnLoad_Click(object sender, RoutedEventArgs e) { try { db = new LetranIntegratedSystemEntities(); EGList = new List <EmployeeGenderList>(); var emp = db.GetHRiSListbyGender().ToList(); foreach (var x in emp) { EmployeeGenderList egl = new EmployeeGenderList(); egl.Department = x.AcaDepartmentName; egl.EmployeeName = x.EmployeeName; egl.Gender = x.Gender; EGList.Add(egl); } if (!String.IsNullOrEmpty(cbDepartment.Text)) { string dept = cbDepartment.SelectedValue.ToString(); EGList = EGList.Where(m => m.Department == dept).ToList(); } EGList = EGList.OrderBy(m => m.Department).ToList(); ListCollectionView eglcollection = new ListCollectionView(EGList); eglcollection.GroupDescriptions.Add(new PropertyGroupDescription("Department")); dgEmployeeGender.ItemsSource = eglcollection; } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { this.Cursor = Cursors.Wait; db = new LetranIntegratedSystemEntities(); var passwordHasher = new Microsoft.AspNet.Identity.PasswordHasher(); AspNetUser search = db.AspNetUsers.Where(m => m.UserName == App.EmployeeNumber).FirstOrDefault(); string compare = passwordHasher.VerifyHashedPassword(search.PasswordHash, pbCurrent.Password).ToString(); if (compare != "Success") { MessageBox.Show("Incorrect current password.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (pbNew.Password != pbVerify.Password) { MessageBox.Show("Verify password does not match.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (String.IsNullOrEmpty(pbCurrent.Password) || String.IsNullOrEmpty(pbNew.Password) || String.IsNullOrEmpty(pbVerify.Password)) { MessageBox.Show("Password cannot be empty.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } search.PasswordHash = passwordHasher.HashPassword(pbVerify.Password); db.SaveChanges(); MessageBox.Show("Password has been changed.", "Successful", MessageBoxButton.OK); pbCurrent.Clear(); pbNew.Clear(); pbVerify.Clear(); this.Cursor = Cursors.Arrow; }
//public void GetEmployeeScheduleList() //{ // try // { // using (var db = new LetranIntegratedSystemEntities()) // { // lEmployeeShiftList = new List<HRiSClass.EmployeeShiftList>(); // var empSchedule = (from a in db.HRISEmployeeSchedules // join b in db.Employees on a.EmployeeNumber equals b.EmployeeNo // join c in db.HRISShifts on a.ShiftCode equals c.ShiftCode // where b.Archive == false // select new { b.EmployeeNo, EmployeeName = b.LastName.ToUpper() + ", " + b.FirstName.ToUpper(), a.ShiftCode, c.StartTime, c.EndTime }).ToList(); // foreach (var x in empSchedule) // { // HRiSClass.EmployeeShiftList employeeShift = new HRiSClass.EmployeeShiftList(); // employeeShift.EmployeeNo = x.EmployeeNo; // employeeShift.EmployeeName = x.EmployeeName; // employeeShift.ShiftCode = x.ShiftCode; // employeeShift.StartTime = x.StartTime; // employeeShift.EndTime = x.EndTime; // lEmployeeShiftList.Add(employeeShift); // } // dgEmployeeScheduleList.ItemsSource = lEmployeeShiftList.OrderBy(m => m.EmployeeName); // } // } // catch (Exception) // { // throw; // } //} private void GetEmployeeSchedules() { try { using (var db = new LetranIntegratedSystemEntities()) { lEmployeeShiftList = new List <HRiSClass.EmployeeShiftList>(); var empSchedule = db.GetEmployeeSchedules().ToList().OrderBy(m => m.Name); foreach (var x in empSchedule) { HRiSClass.EmployeeShiftList employeeShift = new HRiSClass.EmployeeShiftList(); employeeShift.EmployeeNo = x.Employeeno; employeeShift.EmployeeName = x.Name; employeeShift.ShiftCode = x.EmployeeShiftCode; employeeShift.EmployeeID = x.EmployeeID; employeeShift.Department = x.AcaAcronym; lEmployeeShiftList.Add(employeeShift); } dgEmployeeScheduleList.ItemsSource = lEmployeeShiftList.OrderBy(m => m.EmployeeName); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetLeaveBalance() { try { db = new LetranIntegratedSystemEntities(); var leavebal = db.LeaveBalances.Find(leavebalanceid); if (leavebal != null) { lblEmpNo.Content = leavebal.Employee.EmployeeNo; lblEmpName.Content = leavebal.Employee.LastName.ToUpper() + ", " + leavebal.Employee.FirstName.ToUpper(); txtSL.Text = leavebal.SickLeaveBalance.Value.ToString(); txtVL.Text = leavebal.VacationLeaveBalance.Value.ToString(); //txtEL.Text = leavebal.EmergencyLeaveBalance.Value.ToString(); //txtBL.Text = leavebal.BereavementLeaveBalance.Value.ToString(); //txtSPL.Text = leavebal.SoloParentLeaveBalance.Value.ToString(); } else { MessageBox.Show("Leave balance not found", "System Warning.", MessageBoxButton.OK, MessageBoxImage.Warning); this.Close(); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void LoadComboBox() { try { using (var db = new LetranIntegratedSystemEntities()) { EList = new List <HRiSClass.EmpCombo>(); var emp = db.Employees.Where(m => m.Archive == false).ToList(); foreach (var i in emp) { HRiSClass.EmpCombo ec = new HRiSClass.EmpCombo(); ec.EmployeeID = i.EmployeeID; ec.EmployeeNumber = i.EmployeeNo; ec.EmployeeName = i.LastName.ToUpper() + ", " + i.FirstName.ToUpper(); EList.Add(ec); } cbEmployee.ItemsSource = EList.OrderBy(m => m.EmployeeName); cbEmployee.DisplayMemberPath = "EmployeeName"; cbEmployee.SelectedValuePath = "EmployeeID"; var dept = db.AcademicDepartments.ToList(); cbDepartment.ItemsSource = dept.OrderBy(m => m.AcaDepartmentName); cbDepartment.DisplayMemberPath = "AcaDepartmentName"; cbDepartment.SelectedValuePath = "AcaDeptID"; } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GetOT() { try { OTRList = new List <HRiSClass.OvertimeRequestList>(); using (var db = new LetranIntegratedSystemEntities()) { //var otreq = db.HRISOvertimes.ToList(); var otreq = (from a in db.HRISOvertimes join b in db.HRISOvertimeDetails on a.EmployeeOvertimeID equals b.EmployeeOvertimeID join c in db.Employees on a.EmployeeID equals c.EmployeeID select new { a.EmployeeOvertimeID, a.EmployeeID, c.EmployeeNo, Name = c.LastName + ", " + c.FirstName, a.DateFiled, b.Date, Time = b.StartTime + " - " + b.EndTime, b.Reason }).ToList(); foreach (var x in otreq) { HRiSClass.OvertimeRequestList otr = new HRiSClass.OvertimeRequestList(); otr.OTID = x.EmployeeOvertimeID; otr.EmployeeID = x.EmployeeID; otr.EmployeeNumber = x.EmployeeNo; otr.EmployeeName = x.Name.ToUpper(); otr.DateFiled = x.DateFiled; otr.OTDate = x.Date; otr.Time = x.Time; otr.Reason = x.Reason; OTRList.Add(otr); } dgOTReq.ItemsSource = OTRList.OrderByDescending(m => m.DateFiled); } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }