public AddReportViewModel(AddReportView addReportView, vwEmployee employee) { this.addReportView = addReportView; this.employee = employee; report = new vwReport(); report.EmployeeID = employee.EmployeeID; }
public EditEmployeeViewModel(EditEmployee editEmployeeOpen, vwEmployee employeeEdit) { eventObject = new EventClass(); editEmployee = editEmployeeOpen; selectedMenager = new vwMenager(); employee = employeeEdit; selctedLocation = new vwLOCATION(); selectedMenager = new vwMenager(); //selectedMenager.Menager = employee.MenagerName; StartDate = (DateTime)employee.DateOfBirth; Sector = employee.SectorName; locationService = new LocationService(); employeeService = new EmployeeService(); genderService = new GenderService(); sectorService = new SectorService(); LocationList = locationService.GetAllLocations().ToList(); LocationList.OrderByDescending(x => x.Location); LocationList.Reverse(); PotentialMenagers = employeeService.GetAllPotentialMenagersForEditWindow(employeeEdit.EmployeeID); eventObject.ActionPerformed += ActionPerformed; oldEmployee = new vwEmployee(); oldEmployee.FirstName = employee.FirstName; oldEmployee.LastName = employee.LastName; oldEmployee.JMBG = employee.JMBG; }
public hrRepo(string workNo) { ctx = new ApplicationDbContext(); emp = ctx.getUserByWorkNo(workNo); constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; con = new SqlConnection(constring); }
public ActionResult Create() { var user = new ApplicationUser(); vwEmployee model = new vwEmployee { Id = "", workNo = "", UserCName = "", UserEName = "", Title = "", Password = "", rePassword = "", beginWorkDate = DateTime.Today }; List <vwPoNo> poNoList = new List <vwPoNo>(); ViewBag.currentPoList = poNoList; setViewBagRoles(ctx, null); setViewBagPo(ctx); ViewBag.Title = "員工資料新增"; ViewBag.EditMode = "Create"; return(View("Edit", model)); }
public ActionResult Edit(string id) { var store = new UserStore <ApplicationUser>(ctx); var manager = new UserManager <ApplicationUser>(store); var user = store.Users.Where(x => x.Id == id).FirstOrDefault(); var getUserTitleObj = getUserTitle(user, ctx); List <string> usrTitle = getUserTitleObj.Item1; ViewBag.currentPoList = getUserTitleObj.Item2; vwEmployee model = new vwEmployee { Id = user.Id, workNo = user.workNo, UserCName = user.cName, UserEName = user.eName, Email = user.Email, beginWorkDate = user.beginWorkDate, Title = string.Join(",", usrTitle.ToArray()) }; setViewBagRoles(ctx, user); setViewBagPo(ctx); ViewBag.Title = "員工資料編輯"; ViewBag.EditMode = "Edit"; return(View(model)); }
public AddAbsenceViewModel(AddAbsenceView absenceView, vwEmployee employee) { this.absenceView = absenceView; Employee = employee; Absence = new vwAbsence(); Absence.UserId = employee.UserId; }
public SalaryViewModel(Salary salaryOpen, vwEmployee employeeEdit, vwManager managerLog) { salary = salaryOpen; employee = employeeEdit; manager = managerLog; serviceEmployee = new ServiceEmployee(); }
/// <summary> /// Constructor with employee window param /// </summary> /// <param name="AllUsers">opens the manager window</param> public AllUsersViewModel(Employee usersOpen) { empWindow = usersOpen; vwEmployee emp = service.GetEmployeeUserID(LoggedUser.CurrentUser.UserID); employeeInfoLabel = $"Responsibility: {emp.Responsibility}\nFloor: {emp.FloorNumber}"; }
public AddEmployeeViewModel(AddEmployee employeeView) { this.employeeView = employeeView; Employee = new vwEmployee(); EngagementList = engagement.GetEngagements(); GenderList = genders.GetGenders(); }
public List <string> getDepListByWorkNo(string workNo) { vwEmployee empObj = ctx.getUserByWorkNo(workNo); List <String> depList = (from item in empObj.poList select item.depNo).ToList <String>(); return(depList); }
/// <summary> /// Constructor with the add employee info window opening /// </summary> /// <param name="addEmployeeOpen">opends the add employee window</param> public AddEmployeeViewModel(AddEmployee addEmployeeOpen) { employee = new vwEmployee(); addEmployee = addEmployeeOpen; //bgWorker.DoWork += WorkerOnDoWork; EmployeeList = service.GetAllEmployees().ToList(); }
/// <summary> /// Method for changing employee data /// </summary> /// <param name="employee"></param> /// <returns></returns> public bool EditEmployee(vwEmployee employee) { try { using (DAN_LXEntities1 context = new DAN_LXEntities1()) { tblEmployee employeeToEdit = context.tblEmployees.Where(x => x.EmployeeID == employee.EmployeeID).FirstOrDefault(); employeeToEdit.NameandSurname = employee.NameandSurname; employeeToEdit.DateOfBirth = employee.DateOfBirth; employeeToEdit.JMBG = employee.JMBG; employeeToEdit.RegistrationNumber = employee.RegistrationNumber; employeeToEdit.Gender = employee.Gender; employeeToEdit.PhoneNumber = employee.PhoneNumber; employeeToEdit.SectorID = employee.SectorID; employeeToEdit.LocationID = employee.LocationID; employeeToEdit.Manager = employee.Manager; context.SaveChanges(); return(true); } } catch (Exception ex) { Debug.WriteLine("Exception" + ex.Message.ToString()); return(false); } }
public bool AddEmployee(vwEmployee employeeToAdd) { try { using (DAN_LXEntities1 context = new DAN_LXEntities1()) { tblEmployee employee = new tblEmployee { NameandSurname = employeeToAdd.NameandSurname, DateOfBirth = employeeToAdd.DateOfBirth, RegistrationNumber = employeeToAdd.RegistrationNumber, JMBG = employeeToAdd.JMBG, Gender = employeeToAdd.Gender, PhoneNumber = employeeToAdd.PhoneNumber, SectorID = employeeToAdd.SectorID, LocationID = employeeToAdd.LocationID, Manager = employeeToAdd.Manager }; context.tblEmployees.Add(employee); context.SaveChanges(); employeeToAdd.EmployeeID = employee.EmployeeID; return(true); } } catch (Exception ex) { Debug.WriteLine("Exception" + ex.Message.ToString()); return(false); } }
public AddEmployeeViewModel(AddEmployeeView addEmployeeViewOpen) { addEmployeeView = addEmployeeViewOpen; GenderList = serviceEmployee.GetAllGender(); LocationList = serviceEmployee.GetAllLocations(); ManagerList = serviceEmployee.GetAllEmployees(); employee = new vwEmployee(); }
public AddEmployeeViewModel(AddEmployeeView addEmployeeView) { this.addEmployeeView = addEmployeeView; GenderList = genders.GetAllGenders(); LocationList = locations.GetAllLocations(); ManagerList = employees.GetAllEmployees(); Employee = new vwEmployee(); }
public AddEmployeeViewModel(AddEmployeeView view) { this.view = view; LocationList = service.GetAllLocations(); ManagerList = service.GetAllEmployees(); SectorList = service.GetAllSectors(); Employee = new vwEmployee(); }
public AddEmployeeViewModel(AddEmployee addEmployeeOpen) { addEmployee = addEmployeeOpen; serviceEmployee = new ServiceEmployee(); serviceManager = new ServiceManager(); employee = new vwEmployee(); floorManager = serviceManager.GetManagerFloor().ToList(); }
/// <summary> /// Constructor with edit employee window opening /// </summary> /// <param name="addEmployeeOpen">opens the edit employee window</param> /// <param name="employeeEdit">gets the employee info that is being edited</param> public AddUserViewModel(AddEmployee addEmployeeOpen, vwEmployee employeeEdit) { employee = employeeEdit; addEmployee = addEmployeeOpen; AllInfoEmployeeList = service.GetAllEmployeesInfo().ToList(); EmployeeList = service.GetAllEmployees().ToList(); UserList = service.GetAllUsers().ToList(); }
public OwnerViewModel(OwnerView ownerView) { this.ownerView = ownerView; Manager = new vwManager(); Employee = new vwEmployee(); GenderList = users.GetGenders(); EngagementList = users.GetEngagements(); LevelPQList = users.GetLevelsPQ(); }
public AddWindowViewModel(AddAndEditEmployeeWindow addEmployeeOpen) { addEmployee = addEmployeeOpen; newEmployee = new vwEmployee(); locationList = Service.Service.GetAllLocations(); managerList = Service.Service.GetAllManagers(); genderList = Service.Service.GetAllGenders(); backgroundWorker.DoWork += DoWorkAdd; }
/// <summary> /// Constructor for updating employee /// </summary> public AddWindowViewModel(AddAndEditEmployeeWindow addEmployeeOpen, vwEmployee employee) { isEditingWindow = true; addEmployee = addEmployeeOpen; newEmployee = employee; locationList = Service.Service.GetAllLocations(); managerList = Service.Service.GetAllManagers(employee.employeeId); genderList = Service.Service.GetAllGenders(); backgroundWorker.DoWork += DoWorkAdd; }
internal MainWindowViewModel(MainWindow view) { this.view = view; Employees = LoadEmpolyees(); Locations = LoadLocations(); selectedEmployee = new tblEmployee(); Employee = new vwEmployee(); AddLocations(); workerDelete.DoWork += LogDeletedEmployee; }
//poziva pri otvaranju prozora AddEmployee pri dodavanju novih employee public AddEmployeeViewModel(AddEmployee addEmployeeOpen) { employee = new vwEmployee(); addEmployee = addEmployeeOpen; using (Service1Client wcf = new Service1Client()) { BossList = wcf.GetAllBoss(null).ToList(); } }
//poziva pri otvaranju prozora AddEmployee ali pri editovanju nekog employee public AddEmployeeViewModel(AddEmployee addEmployeeOpen, vwEmployee EmployeeEdit) { employee = EmployeeEdit; addEmployee = addEmployeeOpen; edited = true; using (Service1Client wcf = new Service1Client()) { BossList = wcf.GetAllBoss(null).ToList(); } }
public EmployeeAbsencesView(vwEmployee employee) { InitializeComponent(); this.Name = "Absences"; this.DataContext = new EmployeeAbsencesViewModel(this, employee); btnApprove.Visibility = Visibility.Collapsed; btnReject.Visibility = Visibility.Collapsed; btnDelete.Visibility = Visibility.Collapsed; columEmployee.Visibility = Visibility.Collapsed; }
/// <summary> /// Constructor with the add employee info window opening /// </summary> /// <param name="addEmployeeOpen">opends the add employee window</param> public AddUserViewModel(AddEmployee addEmployeeOpen) { employee = new vwEmployee(); addEmployee = addEmployeeOpen; AllInfoEmployeeList = service.GetAllEmployeesInfo().ToList(); ManagerList = service.GetAllManagers().ToList(); EmployeeList = service.GetAllEmployees().ToList(); FloorNumberList = service.GetAllFloorNumbers().ToList(); UserList = service.GetAllUsers().ToList(); }
/// <summary> /// Constructor with the add employee info window opening /// </summary> /// <param name="addEmployeeOpen">opends the add employee window</param> public AddUserViewModel(AddEmployee addEmployeeOpen) { employee = new vwEmployee(); addEmployee = addEmployeeOpen; AllInfoEmployeeList = service.GetAllEmployeesInfo().ToList(); EmployeeList = service.GetAllEmployees().ToList(); UserList = service.GetAllUsers().ToList(); AllInfoManagerList = service.GetAllManagersInfo().ToList(); PositionList = service.GetAllPosition().ToList(); SectorList = service.GetAllSectors().ToList(); }
/// <summary> /// Creates a employee /// </summary> /// <param name="manager">employee to add</param> /// <returns>a new employee</returns> public vwEmployee AddEmployee(vwEmployee employee) { if (v.ValidEmployeeInput(employee)) { try { using (HotelDBEntities context = new HotelDBEntities()) { employee.DateOfBirth = employee.DateOfBirth; //user tblUser newManager = new tblUser(); newManager.Name = employee.Name; newManager.DateOfBirth = employee.DateOfBirth; newManager.Email = employee.Email; newManager.Username = employee.Username; newManager.Password = employee.Password; context.tblUsers.Add(newManager); context.SaveChanges(); //employee int id = getUserId(employee.Username); tblEmployee man = new tblEmployee(); man.Floor = employee.Floor; man.Citizenship = employee.Citizenship; man.Gender = employee.Gender; man.Engagement = employee.Engagement; man.UserID = id; man.Salary = "0"; context.tblEmployees.Add(man); context.SaveChanges(); employee.UserID = newManager.UserID; return(employee); } } catch (Exception ex) { Debug.WriteLine("Exception" + ex.Message.ToString()); return(null); } } else { MessageBox.Show("Wrong data input. Please provide valid data to add new employee."); return(null); } }
public double CalculateSalary(int userID, vwEmployee emp, int value) { vwManager man = GetManagerUserID(userID); int educationValue = 0; double genderValue = 0; switch (man.EducationDegree) { case "I": educationValue = 1; break; case "II": educationValue = 2; break; case "III": educationValue = 3; break; case "IV": educationValue = 4; break; case "V": educationValue = 5; break; case "VI": educationValue = 6; break; case "VII": educationValue = 7; break; default: educationValue = 0; break; } if (emp.Gender == "M") { genderValue = 1.12; } else { genderValue = 1.15; } return(Math.Round((1000 * man.YearsOfExperience * 0.75 * educationValue * 0.15 * genderValue + value), 2));; }
public LocalAdministratorViewModel(LocalAdministrator open) { la = open; //manager manager = new vwManager(); managerList = Service.Service.GetVwManagerList(); //employee employee = new vwEmployee(); employeeList = Service.Service.GetVwEmployeeList(); //admin administrator = new vwAdministrator(); administratorList = Service.Service.GetVwAdministratorList(); }