private EmployeeExperiencesWithDetailsViewModel GetByEmployeeCodeID(int id) { EmployeesCodesBLL EmployeesCodesBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(id); EmployeeExperiencesWithDetailsViewModel EmployeeExperienceVM = new EmployeeExperiencesWithDetailsViewModel(); int year, month, days; new EmployeeExperiencesWithDetailsBLL().GetTotalEmployeeExperienceInYMD(id, out year, out month, out days); EmployeeExperienceVM.TotalYears = year; EmployeeExperienceVM.TotalMonths = month; EmployeeExperienceVM.TotalDays = days; EmployeeExperienceVM.EmployeeVM = new EmployeesViewModel() { EmployeeCodeID = EmployeesCodesBLL.EmployeeCodeID, EmployeeCodeNo = EmployeesCodesBLL.EmployeeCodeNo, EmployeeNameAr = EmployeesCodesBLL.Employee.EmployeeNameAr, EmployeeJobName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.Job.JobName : null, EmployeeRankName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.Rank.RankName : null, EmployeeOrganizationName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationName : null, HiringDate = EmployeesCodesBLL.HiringRecord != null ? EmployeesCodesBLL.HiringRecord.JoinDate : (DateTime?)null, EmployeeIDNo = EmployeesCodesBLL.Employee.EmployeeIDNo, EmployeeJobNo = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.JobNo : null }; return(EmployeeExperienceVM); }
private void SetAuthentications(EmployeeExperiencesWithDetailsViewModel VM) { AuthenticationResult Authentication = (AuthenticationResult)Session["Authentication"]; if (Authentication != null && Authentication.User != null && Authentication.User.IsAdmin) { VM.HasCreatingAccess = VM.HasDeletingAccess = VM.HasUpdatingAccess = true; } else { GroupsObjects Privilage = Authentication.Privilages.FirstOrDefault(e => e.Object.ObjectID == (int)ObjectsEnum.EmployeesExperiencesManage); if (Privilage != null) { VM.HasCreatingAccess = Privilage.Creating; VM.HasDeletingAccess = Privilage.Deleting; VM.HasUpdatingAccess = Privilage.Updating; } else { VM.HasCreatingAccess = VM.HasDeletingAccess = VM.HasUpdatingAccess = false; } } }
public ActionResult Manage(int id) { EmployeeExperiencesWithDetailsViewModel VM = this.GetByEmployeeCodeID(id); //int total = new EmployeeExperiencesWithDetailsBLL().GetTotalDaysByEmployeeExperience(22915); SetAuthentications(VM); return(View(VM)); }
public JsonResult Create(EmployeeExperiencesWithDetailsViewModel EmployeeExperienceVM) { EmployeeExperiencesWithDetailsBLL EmployeeExperiencesWithDetails = new EmployeeExperiencesWithDetailsBLL(); EmployeeExperiencesWithDetails.JobName = EmployeeExperienceVM.JobName; EmployeeExperiencesWithDetails.FromDate = EmployeeExperienceVM.FromDate; EmployeeExperiencesWithDetails.ToDate = EmployeeExperienceVM.ToDate; EmployeeExperiencesWithDetails.SectorName = EmployeeExperienceVM.SectorName; EmployeeExperiencesWithDetails.SectorsTypes = new SectorsTypesBLL() { SectorTypeID = EmployeeExperienceVM.SectorTypeID }; EmployeeExperiencesWithDetails.EmployeesCodes = new EmployeesCodesBLL() { EmployeeCodeID = EmployeeExperienceVM.EmployeeVM.EmployeeCodeID.Value }; EmployeeExperiencesWithDetails.LoginIdentity = UserIdentity; Result result = EmployeeExperiencesWithDetails.Add(); return(Json(new { data = EmployeeExperiencesWithDetails.EmployeeExperienceWithDetailID }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetEmployeeExperiencesWithDetails() { EmployeeExperiencesWithDetailsViewModel VW = new EmployeeExperiencesWithDetailsViewModel(); CultureInfo enCul = new CultureInfo("en-US"); var data = new EmployeeExperiencesWithDetailsBLL().GetEmployeesExperiences() .Select(x => new { EmployeeExperienceWithDetailID = x.EmployeeExperienceWithDetailID, EmployeeCodeNo = x.EmployeesCodes.EmployeeCodeNo, EmployeeNameAr = x.EmployeesCodes.Employee.EmployeeNameAr, x.SectorsTypes.SectorTypeName, x.SectorName, x.JobName, FromDate = Globals.Calendar.GetUmAlQuraDate(x.FromDate), ToDate = Globals.Calendar.GetUmAlQuraDate(x.ToDate), FromDateGr = x.FromDate.ToString(ConfigurationManager.AppSettings["DateFormat"], enCul.DateTimeFormat), ToDateGr = x.ToDate.ToString(ConfigurationManager.AppSettings["DateFormat"], enCul.DateTimeFormat), CreatedBy = VW.GetCreatedByDisplayed(x.CreatedBy), CreatedDate = Globals.Calendar.GetUmAlQuraDate(x.CreatedDate) }); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }