public IActionResult AddDriver(AddWorker model, string depart) { worker worker = new worker() { age = model.age, fullname = model.fullname, namber = model.namber, }; _context.workers.Add(worker); _context.SaveChanges(); work_data work_Data = new work_data() { department = _context.departments.Where(e => e.Department_Key == Convert.ToInt32(depart)).FirstOrDefault(), worker = _context.workers.Where(e => e.fullname == worker.fullname).FirstOrDefault(), profession = _context.professions.Where(e => e.Profession_Key == 1).FirstOrDefault(), date_start = model.date_start, date_end = model.date_end }; work_Data.Department_Key = work_Data.department.Department_Key; work_Data.Worker_Key = work_Data.worker.Worker_Key; work_Data.Profession_Key = work_Data.profession.Profession_Key; _context.work_data.Add(work_Data); _context.SaveChanges(); return(RedirectToAction("AddDriverToAvto", "AddSome", new { id = model.Avto_Key })); }
public IActionResult EditWorker(AddWorker model, string depart, string professionss) { worker worker = new worker() { Worker_Key = model.Avto_Key, age = model.age, fullname = model.fullname, namber = model.namber, }; _context.workers.Update(worker); _context.SaveChanges(); work_data work_Data = new work_data() { Work_data_Key = model.work_data_key, department = _context.departments.Where(e => e.Department_Key == Convert.ToInt32(depart)).FirstOrDefault(), worker = _context.workers.Where(e => e.fullname == worker.fullname).FirstOrDefault(), profession = _context.professions.Where(e => e.Profession_Key == Convert.ToInt32(professionss)).FirstOrDefault(), date_start = model.date_start, date_end = model.date_end }; work_Data.Department_Key = work_Data.department.Department_Key; work_Data.Worker_Key = work_Data.worker.Worker_Key; work_Data.Profession_Key = work_Data.profession.Profession_Key; _context.work_data.Update(work_Data); _context.SaveChanges(); return(RedirectToAction("ShowsWorker", "Shows")); }
public WorkerViewModel() { addWorker = new AddWorker(this); UpdateWorker = new UpdateWorker(this); DeleteWorker = new DeleteWorker(this); CurrentWorker = new WorkerEntity(); SelectWorker = new WorkerEntity(); }
public IActionResult AddWorker() { AddWorker addWorker = new AddWorker() { departmentsmass = _context.departments, professionsmass = _context.professions }; return(View(addWorker)); }
public IActionResult AddDriver(int id) { AddWorker addWorker = new AddWorker() { Avto_Key = id, departmentsmass = _context.departments, professionsmass = _context.professions }; return(View(addWorker)); }
public AddWorkerViewModel(AddWorker addEmployeeOpen) { _addWorker = addEmployeeOpen; _worker = new vwWorker(); _location = new vwLocation(); LocationList = _dbService.GetAllLocations(); WorkerList = _dbService.GetAllWorkerRecords(); GenderList = _dbService.GetAllGenders(); SectorList = _dbService.GetAllSectors(); ManagerList = _dbService.GetAllManagers(); actionEventObject = new ActionEvent(); actionEventObject.ActionPerformed += ActionPerformed; }
private void AddNewWorkerExecute() { try { AddWorker addWorker = new AddWorker(); addWorker.ShowDialog(); if ((addWorker.DataContext as AddWorkerViewModel).IsUpdateWorker == true) { WorkerList = _dataBaseService.GetAllWorkerRecords().ToList(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Executes the edit command /// </summary> public void EditWorkerExecute() { try { if (Worker() != null) { AddWorker addWorker = new AddWorker(Worker()); addWorker.ShowDialog(); if ((addWorker.DataContext as AddWorkerViewModel).IsUpdateWorker == true) { WorkerList = service.GetAllWorkers().ToList(); UserList = service.GetAllUsers().ToList(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public IActionResult EditWorker(int id) { var item = _context.workers.Include(e => e.work_data).ThenInclude(e => e.profession).Where(e => e.Worker_Key == id).FirstOrDefault(); AddWorker addWorker = new AddWorker() { work_data_key = item.work_data.First().Work_data_Key, Avto_Key = id, departmentsmass = _context.departments, professionsmass = _context.professions, age = item.age, date_end = item.work_data.First().date_end, date_start = item.work_data.First().date_start, Department_Key = item.work_data.First().Department_Key, fullname = item.fullname, namber = item.namber, Profession_Key = item.work_data.First().Profession_Key, Worker_Key = item.Worker_Key }; return(View(addWorker)); }
public BtnOk(AddWorker addWorker) { this.addWorker = addWorker; }
/// <summary> /// Constructor with edit worker window opening /// </summary> /// <param name="addWorkerOpen">opens the add worker window</param> /// <param name="workerEdit">gets the worker info that is being edited</param> public AddWorkerViewModel(AddWorker addWorkerOpen, vwUser workerEdit) { worker = workerEdit; addWorker = addWorkerOpen; WorkerList = service.GetAllWorkers().ToList(); }
/// <summary> /// Constructor with the add worker info window opening /// </summary> /// <param name="addWorkerOpen">opends the add worker window</param> public AddWorkerViewModel(AddWorker addWorkerOpen) { worker = new vwUser(); addWorker = addWorkerOpen; WorkerList = service.GetAllWorkers().ToList(); }
public BtnCencel(AddWorker addWorker) { this.addWorker = addWorker; }
private void button3_Click_1(object sender, EventArgs e) { AddWorker = new AddWorker(); AddWorker.MdiParent = this; AddWorker.Show(); }