public ActionResult DeleteConfirmed(int id) { WorkRole workRole = db.WorkRoles.Find(id); db.WorkRoles.Remove(workRole); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "WorkRoleId,RoleName,RoleDescription")] WorkRole workRole) { if (ModelState.IsValid) { db.Entry(workRole).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workRole)); }
public MatchedWorkerDto(int id, Worker w, WorkRole role) { RouteWorkerId = id; Id = w.Id; Cn = w.Cn; Name = w.Name; Rfid = w.Rfid; Photo = w.Photo != null?Convert.ToBase64String(w.Photo) : null; ArticleTypeList = role.ArticleTypeList; Duties = role.Duties; WorkRoleName = role.Name; }
// GET: WorkRoles/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkRole workRole = db.WorkRoles.Find(id); if (workRole == null) { return(HttpNotFound()); } return(View(workRole)); }
private string GetAnotherRoleName(WorkRole workRole) { string doubleRoles = SettingManager.GetSettingValueAsync(AppSettingNames.Rule.DoubleArticleRoles).Result; string[] array = doubleRoles.Split('|'); if (array[0] == workRole.Name) { return(array[1]); } if (array[1] == workRole.Name) { return(array[0]); } return(null); }
public ActionResult Create([Bind(Include = "WorkRoleId,RoleName,RoleDescription")] WorkRole workRole) { if (ModelState.IsValid) { string currentUserId = User.Identity.GetUserId(); Company company = db.Companies.Where(c => c.CAId == currentUserId) .FirstOrDefault(); int companyID = company.CompanyId; workRole.CompanyId = companyID; db.WorkRoles.Add(workRole); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workRole)); }
private static Employee GetSuperior(DataContext ctx, WorkRole workRole) { if (WorkRole.BusinessAnalyst == workRole || WorkRole.TeamLeader == workRole || WorkRole.HumanResourceManager == workRole || WorkRole.ProjectManager == workRole || WorkRole.OfficeAssistant == workRole) { return(ctx.Employees.SingleOrDefault(e => e.WorkRole == WorkRole.CEO)); } else if (WorkRole.SoftwareTester == workRole || WorkRole.SoftwareEngineer == workRole) { return(ctx.Employees.SingleOrDefault(e => e.WorkRole == WorkRole.TeamLeader)); } else if (WorkRole.CEO == workRole) { throw new CeoSuperiorException(); } throw new InvalidWorkRoleException(workRole.ToString()); }
private static OrganizationUnit GetOrganizationUnit(DataContext ctx, WorkRole workRole) { if (WorkRole.BusinessAnalyst == workRole || WorkRole.CEO == workRole || WorkRole.HumanResourceManager == workRole || WorkRole.ProjectManager == workRole) { return(ctx.OrganizationUnits.SingleOrDefault(o => o.Abbreviation == "MGT")); } else if (WorkRole.SoftwareTester == workRole || WorkRole.SoftwareEngineer == workRole || WorkRole.TeamLeader == workRole) { return(ctx.OrganizationUnits.SingleOrDefault(o => o.Abbreviation == "IT")); } else if (WorkRole.OfficeAssistant == workRole) { return(ctx.OrganizationUnits.SingleOrDefault(o => o.Abbreviation == "BO")); } throw new InvalidWorkRoleException(workRole.ToString()); }
public static string[] GetWorkRoleTitles(this WorkRole workRole) { return(WorkRoleTitles.Values.ToArray()); }
public static string GetTitleFromWorkRole(this WorkRole workRole) { return(WorkRoleTitles[workRole]); }
private RouteWorkerCacheItem FindAnotherRouteWorker(List <RouteWorkerCacheItem> workers, WorkRole workRole) { string anotherRole = GetAnotherRoleName(workRole); if (anotherRole != null) { foreach (var w in workers) { var role = _workRoleCache[w.WorkRoleId]; if (role.Name == anotherRole) { return(w); } } } return(null); }