Exemple #1
0
        public override IActionResult Create()
        {
            ViewBag.Departements    = departement.GetAll().ToList();
            ViewBag.Projects        = projects.GetAll().ToList();
            ViewBag.LineManagers    = _userHelper.GetByRoleName("Project Manager").ToList();
            ViewBag.ProjectManagers = _userHelper.GetByRoleName("Project Manager").ToList();
            ViewBag.AccountNames    = accountName.GetAll().ToList();

            Dictionary <string, bool> Status = new Dictionary <string, bool>();

            Status.Add("Active", false);
            Status.Add("Close", true);
            ViewBag.ListStatus = Status.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();

            return(base.Create());
        }
Exemple #2
0
        public string PieChartAccountNameBySrf(int Id, ClaimsPrincipal User)
        {
            Expression <Func <SrfRequest, object> >[] Includes = new Expression <Func <SrfRequest, object> > [6];
            Includes[0] = pack => pack.Candidate;
            Includes[1] = pack => pack.Candidate.Agency;
            Includes[2] = pack => pack.Candidate.Vacancy;
            Includes[3] = pack => pack.Candidate.Vacancy.JobStage;
            Includes[4] = pack => pack.Candidate.Vacancy.PackageType;
            Includes[5] = pack => pack.Candidate.Account;

            var FirstDateYear = new DateTime(DateTime.Now.Year, 1, 1);

            var AccountId = _repository
                            .GetAll(Includes)
                            .Where(x => x.IsActive == true && x.IsLocked == false && x.Candidate.IsUser == true && x.SrfEnd.HasValue && x.SrfEnd.Value <= DateTime.Now && x.Candidate.Account.IsBlacklist == false && x.Candidate.Account.IsTerminate == false)
                            .Select(x => x.AccountId)
                            .ToList();

            var Result = _account.GetAll().Where(x => AccountId.Contains(x.Id)).ToList();
            var random = new Random();

            object[] PieChart = new object[Result.Count()];
            if (Result != null)
            {
                int i = 0;
                foreach (var row in Result)
                {
                    var color        = String.Format("#{0:X6}", random.Next(0x1000000));
                    var Account      = _account.GetById(row.Id);
                    var CountAccount = CountPieChartAppover(row.Id, Id, User);
                    PieChart[i] = new Dictionary <string, object>
                    {
                        { "provider", Account.Name },
                        { "allocation", CountAccount },
                        { "color", color.ToString() }
                    };
                    i++;
                }
            }
            else
            {
                var color = String.Format("#{0:X6}", random.Next(0x1000000));
                PieChart[0] = new Dictionary <string, object>
                {
                    { "provider", "No Account Name" },
                    { "allocation", 0 },
                    { "color", color.ToString() }
                };
            }
            return(JsonConvert.SerializeObject(PieChart));
        }
Exemple #3
0
        public override IActionResult Edit(string id)
        {
            var UserProfile             = _profileService.GetByUserId(id);
            Dictionary <string, int> ws = new Dictionary <string, int>();

            ws.Add("No", 0);
            ws.Add("Yes", 1);
            Dictionary <string, bool> com = new Dictionary <string, bool>();

            com.Add("No USIM", false);
            com.Add("USIM", true);
            Dictionary <string, bool> sign = new Dictionary <string, bool>();

            sign.Add("Non-HRMS", false);
            sign.Add("HRMS", true);
            ViewBag.Profile              = UserProfile.Id;
            ViewBag.OrganizationUnit     = _department.GetAll().ToList();
            ViewBag.AccountName          = _account.GetAll().ToList();
            ViewBag.PackageType          = _packageType.GetAll().ToList();
            ViewBag.ServicePackCategory  = _ssowCategory.GetAll().ToList();
            ViewBag.BasicServiceLevel    = new List <int>(new int[] { 0, 20, 30, 40 }).Select(x => new { Id = x, Name = x.ToString() });
            ViewBag.WorkstationService   = ws.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
            ViewBag.CommunicationService = com.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
            ViewBag.Signum                = sign.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
            ViewBag.Jobstage              = _jobStage.GetAll().Where(x => !string.IsNullOrEmpty(x.Description)).ToList();
            ViewBag.LineManager           = _userHelper.GetByRoleName("Line Manager").ToList();
            ViewBag.Sourcing              = _userHelper.GetByRoleName("Sourcing").ToList();
            ViewBag.HeadOperation         = _userHelper.GetByRoleName("Head Of Operation").ToList();
            ViewBag.HeadOperation         = _userHelper.GetByRoleName("Head Of Non Operation").ToList();
            ViewBag.ListServiceLine       = _userHelper.GetByRoleName("Head Of Service Line").ToList();
            ViewBag.ListServiceCordinator = _userHelper.GetByRoleName("Service Coordinator").ToList();
            ViewBag.ListAgency            = _userHelper.GetByRoleName("HR Agency").ToList();
            ViewBag.CandidateName         = UserProfile.Name;
            ViewBag.CanidateEmail         = UserProfile.Email;

            var Model = new RecoveryForm();

            return(View(Model));
        }
        public IActionResult Add(Guid id)
        {
            try
            {
                var srf         = Service.GetById(id);
                var Candidate   = _candidate.GetById(srf.CandidateId);
                var Vacancy     = _vacancy.GetById(Candidate.VacancyId);
                var CurrentSSO  = _ssow.GetById(Vacancy.ServicePackId);
                var Departement = _department.GetById(Vacancy.DepartmentId);

                ViewBag.Candidate       = Candidate;
                ViewBag.Vacancy         = Vacancy;
                ViewBag.Departement     = Departement;
                ViewBag.SSOW            = CurrentSSO;
                ViewBag.SCategory       = _ssowCategory.GetById(CurrentSSO.ServicePackCategoryId);
                ViewBag.JobsStage       = _jobStage.GetById(Vacancy.JobStageId);
                ViewBag.ListDepartement = _department.GetAll().ToList();

                if (Departement.OperateOrNon == 1)
                {
                    ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Operation").ToList();
                }
                else
                {
                    ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Non Operation").ToList();
                }
                ViewBag.ListServiceLine       = _userHelper.GetByRoleName("Head Of Service Line").ToList();
                ViewBag.ListServiceCordinator = _userHelper.GetByRoleName("Service Coordinator").ToList();
                ViewBag.ListHeadOperation     = _userHelper.GetByRoleName("Head Of Operation").ToList();
                ViewBag.ListHeadNonOperation  = _userHelper.GetByRoleName("Head Of Non Operation").ToList();
                ViewBag.ListHeadSourcing      = _userHelper.GetByRoleName("Head Of Sourcing").ToList();
                ViewBag.ListAccount           = _account.GetAll().ToList();
                ViewBag.ListSubDepartment     = _departmentSub.GetAll().Where(x => x.DepartmentId.Equals(srf.DepartmentId)).ToList();
                ViewBag.ListCostCenter        = _costCenter.GetAll().Where(x => x.DepartmentId.Equals(srf.DepartmentId)).ToList();
                ViewBag.ListNetwork           = _network.GetAll().Where(x => x.DepartmentId.Equals(srf.DepartmentId)).ToList();
                //ViewBag.ListSSOW = _ssow.GetAll().Where(x => x.Type.Equals(CurrentSSO.Type)).ToList();
                ViewBag.PackageType         = _packageType.GetAll().ToList();
                ViewBag.ServicePackCategory = _ssowCategory.GetAll().ToList();
                ViewBag.BasicServiceLevel   = new List <int>(new int[] { 0, 20, 30, 40 }).Select(x => new { Id = x, Name = x.ToString() });


                Dictionary <string, bool> ws = new Dictionary <string, bool>();
                ws.Add("No", false);
                ws.Add("Yes", true);

                Dictionary <string, bool> com = new Dictionary <string, bool>();
                com.Add("No USIM", false);
                com.Add("USIM", true);

                ViewBag.WorkstationService   = ws.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
                ViewBag.CommunicationService = com.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();

                var ProfileId = _userHelper.GetLoginUser(User).Id;
                ViewBag.ProfileId = ProfileId;

                if (srf != null)
                {
                    var Model = new EscalationModelForm();
                    Model.Srf   = Mapper.Map <SrfRequestModelForm>(srf);
                    Model.SrfId = id;
                    return(View(Model));
                }
            }
            catch (Exception e)
            {
                return(Content(e.ToString()));
            }
            return(NoContent());
        }
Exemple #5
0
        public override IActionResult Edit(Guid id)
        {
            try
            {
                var item = Service.GetById(id);
                var Vacancy = _vacancy.GetById(_candidate.GetById(item.CandidateId).VacancyId);
                var Departement = _department.GetById(item.DepartmentId);
                var PackageType = _packageType.GetById(Vacancy.PackageTypeId);
                ViewBag.PriceType = PackageType.Name;
                ViewBag.Vacancy = Vacancy;
                ViewBag.Candidate = _candidate.GetById(item.CandidateId);
                ViewBag.Departement = _department.GetById(item.DepartmentId);
                ViewBag.SSOW = _ssow.GetById(item.ServicePackId);
                ViewBag.SCategory = _ssowCategory.GetById(_ssow.GetById(item.ServicePackId).ServicePackCategoryId);
                ViewBag.JobsStage = _jobStage.GetById(Vacancy.JobStageId);
                ViewBag.ListDepartement = _department.GetAll().ToList();
                if (Departement.OperateOrNon == 1)
                {
                    ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Operation").ToList();
                }
                else
                {
                    ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Non Operation").ToList();
                }
                ViewBag.isOperation = Departement.OperateOrNon;
                ViewBag.ListServiceLine = _userHelper.GetByRoleName("Head Of Service Line").ToList();
                ViewBag.ListServiceCordinator = _userHelper.GetByRoleName("Service Coordinator").ToList();
                ViewBag.ListAccount = _account.GetAll().ToList();
                ViewBag.ListSubDepartment = _departmentSub.GetAll().Where(x => x.DepartmentId.Equals(item.DepartmentId)).ToList();
                ViewBag.ListCostCenter = _costCenter.GetAll().Where(x => x.DepartmentId.Equals(item.DepartmentId)).ToList();
                ViewBag.ListNetwork = _network.GetAll().Where(x => x.DepartmentId.Equals(item.DepartmentId) && x.IsClosed == false).ToList();
                ViewBag.Id = id;
                ViewBag.isOperation = Departement.OperateOrNon;
                ViewBag.txtOperaion = (Departement.OperateOrNon == 1) ? "Operational" : "Non Operational";
                ViewBag.FormDisable = 1;
                ViewBag.SrfNumber = Service.GenerateNumnber();
                ViewBag.NowYear = DateTime.Now.Year.ToString("yy");

                // Aditional
                Dictionary<string, int> ws = new Dictionary<string, int>();
                ws.Add("No", 0);
                ws.Add("Yes", 1);

                Dictionary<string, bool> com = new Dictionary<string, bool>();
                com.Add("No USIM", false);
                com.Add("USIM", true);

                Dictionary<string, bool> sign = new Dictionary<string, bool>();
                sign.Add("Non-HRMS", false);
                sign.Add("HRMS", true);

                Dictionary<string, bool> manager = new Dictionary<string, bool>();
                manager.Add("Manager", true);
                manager.Add("Non Manager", false);

                ViewBag.PackageType = _packageType.GetAll().ToList();
                ViewBag.ServicePackCategory = _ssowCategory.GetAll().ToList();
                ViewBag.ServicePack = _ssow.GetAll().Where(x => x.Type == (PackageTypes)Enum.Parse(typeof(PackageTypes), PackageType.Name)).ToList();
                ViewBag.BasicServiceLevel = new List<int>(new int[] { 0, 20, 30, 40 }).Select(x => new { Id = x, Name = x.ToString() });
                ViewBag.WorkstationService = ws.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
                ViewBag.CommunicationService = com.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
                ViewBag.Signum = sign.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
                ViewBag.IsManager = manager.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();
                ViewBag.Jobstage = _jobStage.GetAll().Where(x => !string.IsNullOrEmpty(x.Description)).ToList();
                ViewBag.ListAgency = _userHelper.GetByRoleName("HR Agency").ToList();
                ViewBag.ListActivity = _activity.GetAll().ToList();
                ViewBag.ListExtended = Service.GetAll().Where(x => x.CandidateId.Equals(item.CandidateId) && x.SrfEnd >= item.SrfBegin).ToList();
                ViewBag.ListLineManager = _userHelper.GetByRoleName("Line Manager").ToList();
                ViewBag.ListHeadOfSourcing = _userHelper.GetByRoleName("Head Of Sourcing").ToList();
                ViewBag.ListSrfStatus = new List<SrfApproveStatus>(new SrfApproveStatus[] { SrfApproveStatus.Waiting, SrfApproveStatus.Approved }).Select(x => new { Id = x, Name = x.ToString() });
                ViewBag.ListTypeSRF = new List<SrfType>(new SrfType[] { SrfType.New, SrfType.Extension }).Select(x => new { Id = x, Name = x.ToString() });
                ViewBag.LisStatusSrf = new List<SrfStatus>(new SrfStatus[] { SrfStatus.Done,SrfStatus.Terminate,SrfStatus.Blacklist }).Select(x => new { Id = x, Name = x.ToString() });

                var Model = Mapper.Map<SrfRequestModelForm>(item);
                Model.FormVacancy = Mapper.Map<VacancyListFormModel>(Vacancy);
                if(item.Status == SrfStatus.Waiting)
                {
                    Model.Status = SrfStatus.Done;
                }

                var CandidateInfo = _candidate.GetById(item.CandidateId);
                if(CandidateInfo!=null)
                {
                    Model.AgencyId = CandidateInfo.AgencyId.Value;
                }

                var Esc = _escalation.GetAll().Where(x => x.SrfId.Equals(id)).FirstOrDefault();
                if(Esc==null)
                {
                    ViewBag.IsEscalation = false;
                }
                else
                {
                    ViewBag.IsEscalation = true;
                }
                    
                return View(Model);


            }
            catch (Exception e)
            {
                return Content(e.ToString());
            }
        }
Exemple #6
0
        private void VacancyAndCandidate()
        {
            Data dt = new Data("vacany_candidate");

            foreach (var row in dt.GetData())
            {
                int index   = 1;
                var Data    = (List <String>)row;
                var Org     = _department.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var SubOrg  = _departmentSub.GetAll().Where(x => Truncate(x.SubName) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var CostCr  = _costCenter.GetAll().Where(x => Truncate(x.Code) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var AnnName = _account.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var Net     = _networkNumber.GetAll().Where(x => Truncate(x.Code) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                if (Net == null)
                {
                    Net = _networkNumber.GetAll().OrderBy(x => Guid.NewGuid()).FirstOrDefault();
                }
                var JoinDate         = DateTime.Parse(Data[index].ToString()); index += 1;
                var PackageType      = _packageType.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var SsowCategory     = _ssow_category.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var Ssow             = _ssow.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var BasiServiceLevel = int.Parse(Data[index].ToString()); index += 1;
                var IsWorkstation    = int.Parse(Data[index].ToString()); index += 1;
                var IsUsim           = int.Parse(Data[index].ToString()); index += 1;
                var IsManager        = int.Parse(Data[index].ToString()); index += 1;
                var NormalRate       = int.Parse(Data[index].ToString()); index += 1;
                var IsSignum         = int.Parse(Data[index].ToString()); index += 1;
                var Jobstage         = _jobstage.GetAll().Where(x => Truncate(x.Stage) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var LineManager      = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;
                var Sourcing         = _userProfile.GetAll().Where(x => Truncate(x.Email) == Truncate(Data[index].ToString())).FirstOrDefault(); index += 1;

                var NewVacancy = new VacancyList();
                NewVacancy.AccountName         = AnnName;
                NewVacancy.ApproverOne         = LineManager;
                NewVacancy.ApproverTwo         = Sourcing;
                NewVacancy.CostCenter          = CostCr;
                NewVacancy.CreatedAt           = JoinDate;
                NewVacancy.Departement         = Org;
                NewVacancy.DepartementSub      = SubOrg;
                NewVacancy.JobStage            = Jobstage;
                NewVacancy.JoinDate            = JoinDate;
                NewVacancy.Network             = Net;
                NewVacancy.NoarmalRate         = NormalRate;
                NewVacancy.OtLevel             = BasiServiceLevel;
                NewVacancy.RequestBy           = LineManager;
                NewVacancy.PackageType         = PackageType;
                NewVacancy.ServicePackCategory = SsowCategory;
                NewVacancy.ServicePack         = Ssow;
                NewVacancy.Status        = VacanStatusFive.Done;
                NewVacancy.VacancyStatus = ApproverStatus.Completed;
                NewVacancy.isHrms        = IsSignum == 1 ? true : false;
                NewVacancy.isLaptop      = IsWorkstation == 1 ? true : false;
                NewVacancy.isManager     = IsManager == 1 ? true : false;
                NewVacancy.isUsim        = IsUsim == 1 ? true : false;
                NewVacancy.StatusOne     = VacanStatusFirst.Selected;
                NewVacancy.StatusTwo     = VacanStatusSecond.Approved;
                NewVacancy.StatusThree   = VacanStatusThirth.Done;
                NewVacancy.StatusFourth  = VacanStatusFourth.Approved;

                var AgencyType    = int.Parse(Data[index].ToString()); index += 1;
                var CandidateName = Data[index].ToString(); index += 1;
                var NickName      = Data[index].ToString(); index += 1;
                var Email         = Data[index].ToString(); index += 1;
                var IdNumber      = Data[index].ToString(); index += 1;
                if (IdNumber.Length > 16)
                {
                    IdNumber = IdNumber.Substring(0, 16);
                }
                var Nationality  = Data[index].ToString(); index += 1;
                var PlaceOfBirth = Data[index].ToString(); index += 1;
                var DateOfBirth  = DateTime.Parse(Data[index].ToString()); index += 1;
                var Address      = Data[index].ToString(); index += 1;
                var Gender       = Data[index].ToString(); index += 1;
                var Martial      = Data[index].ToString(); index += 1;
                var PhoneNMobile = Data[index].ToString(); index += 1;
                var PhoneHome    = Data[index].ToString(); index += 1;
                var Description  = Data[index].ToString(); index += 1;
                var HomeBase     = Data[index].ToString(); index += 1;
                var AhId         = Data[index].ToString(); index += 1;
                var FormEricsson = int.Parse(Data[index].ToString()); index += 1;
                var Agency       = Data[index].ToString();

                var UserCurrent = _userManager.FindByEmailAsync(Email).Result;
                if (UserCurrent != null)
                {
                    var delete = _userManager.DeleteAsync(UserCurrent).Result;
                }

                var UserAgency  = _userProfile.GetAll().Where(x => Truncate(x.Email) == Truncate(Agency)).FirstOrDefault();
                var UserProfile = new UserProfile();
                UserProfile.Address           = Address;
                UserProfile.Birthdate         = DateOfBirth;
                UserProfile.Email             = Email;
                UserProfile.Gender            = Gender.Equals(Truncate("F")) ? Domain.Models.Enum.Gender.Female : Domain.Models.Enum.Gender.Male;
                UserProfile.HomePhoneNumber   = PhoneHome;
                UserProfile.IdNumber          = IdNumber;
                UserProfile.IsActive          = true;
                UserProfile.MobilePhoneNumber = PhoneNMobile;
                UserProfile.Name        = CandidateName;
                UserProfile.Roles       = "Contractor";
                UserProfile.UserName    = Email;
                UserProfile.IsBlacklist = false;
                UserProfile.IsTerminate = false;
                UserProfile.AhId        = AhId;

                List <String> Role = new List <string>()
                {
                    "Contractor"
                };
                ApplicationUser NewUser = new ApplicationUser()
                {
                    Email       = Email,
                    UserName    = Email,
                    UserProfile = UserProfile
                };
                var created = _userManager.CreateAsync(NewUser, "welcome1!").Result;
                if (created.Succeeded)
                {
                    var addRole = _userManager.AddToRolesAsync(NewUser, Role).Result;
                    if (addRole.Succeeded)
                    {
                        _vacancy.Add(NewVacancy);

                        var code      = _userManager.GenerateEmailConfirmationTokenAsync(NewUser).Result;
                        var Succseed  = _userManager.ConfirmEmailAsync(NewUser, code).Result;
                        var Candidate = new CandidateInfo();
                        Candidate.Account           = NewUser.UserProfile;
                        Candidate.Address           = Address;
                        Candidate.Agency            = UserAgency;
                        Candidate.AgencyType        = (AgencyType)AgencyType;
                        Candidate.ApproveOneDate    = JoinDate;
                        Candidate.ApproveOneStatus  = ApproverStatus.Selected;
                        Candidate.ApproveTwoeDate   = JoinDate;
                        Candidate.CreatedAt         = JoinDate;
                        Candidate.Email             = Email;
                        Candidate.Gender            = Gender.Equals(Truncate("F")) ? Domain.Models.Enum.Gender.Female : Domain.Models.Enum.Gender.Male;
                        Candidate.HomePhoneNumber   = PhoneNMobile;
                        Candidate.IdNumber          = IdNumber;
                        Candidate.IsCandidate       = false;
                        Candidate.IsContractor      = true;
                        Candidate.IsUser            = true;
                        Candidate.Martial           = (Martial)Enum.Parse(typeof(Martial), Martial, true);
                        Candidate.MobilePhoneNumber = PhoneNMobile;
                        Candidate.Name             = CandidateName;
                        Candidate.Nationality      = Nationality;
                        Candidate.NickName         = NickName;
                        Candidate.PlaceOfBirth     = PlaceOfBirth;
                        Candidate.DateOfBirth      = DateOfBirth;
                        Candidate.RequestBy        = UserAgency;
                        Candidate.ApproveTwoStatus = ApproverStatus.Completed;
                        Candidate.Vacancy          = NewVacancy;
                        _candidate.Add(Candidate);

                        if (Candidate != null)
                        {
                            Console.WriteLine(Email + " has been added ");
                        }

                        Count++;
                    }
                }
            }
            Console.WriteLine(Count + " Candidate record has been saved ");
        }
Exemple #7
0
        public override IActionResult Edit(Guid id)
        {
            var item = Service.GetById(id);
            var Srf  = _userHelper.GetCurrentSrfByLogin(User);

            ViewBag.Id = id;
            ViewBag.OrganizationUnit = _department.GetAll().ToList();
            ViewBag.CostCenter       = _cost.GetAll().Where(x => x.Status == Status.Active).ToList();
            ViewBag.AccountName      = _account.GetAll().ToList();
            ViewBag.NetworkNumber    = _network.GetAll().Where(x => x.IsClosed == false).ToList();
            ViewBag.Project          = _project.GetAll().ToList();
            ViewBag.Code             = _code.GetAll().ToList();
            ViewBag.SubOperasional   = _subOp.GetAll().ToList();
            ViewBag.City             = _city.GetAll().ToList();
            ViewBag.Annual           = Srf.AnnualLeave;
            // Start - Menampilkan Time Sheet
            var jan1 = new DateTime(DateTime.Today.Year, 1, 1);

            if (DateTime.Now.Month == 1)
            {
                jan1 = new DateTime(DateTime.Today.Year - 1, 12, 1);
            }

            var firstWeek = jan1.AddDays(1 - (int)(jan1.DayOfWeek));
            var weeks     = Enumerable.Range(0, 54).Select(i => new
                                                           { weekStart = firstWeek.AddDays(i * 7) })
                            .TakeWhile(x => x.weekStart.Year <= jan1.Year)
                            .Select(x => new { x.weekStart, weekFinish = x.weekStart.AddDays(6) })
                            .SkipWhile(x => x.weekFinish < jan1.AddDays(1))
                            .Select((x, i) => new
                                    { x.weekStart, x.weekFinish, weekNum = i + 1 });

            if (DateTime.Now.Month == 1)
            {
                weeks = Enumerable.Range(0, 54).Select(i => new
                                                       { weekStart = firstWeek.AddDays(i * 7) })
                        .TakeWhile(x => x.weekStart.Year <= DateTime.Now.Year)
                        .Select(x => new { x.weekStart, weekFinish = x.weekStart.AddDays(6) })
                        .SkipWhile(x => x.weekFinish < jan1.AddDays(1))
                        .Select((x, i) => new
                                { x.weekStart, x.weekFinish, weekNum = i + 1 });
            }

            DateTime         Today       = Convert.ToDateTime(DateTime.Now.Date.ToString());
            string           SelectWeeks = "";
            List <WeeksList> WeekList    = new List <WeeksList>();
            List <DateList>  DateList    = new List <DateList>();
            int num = 0;

            foreach (var X in weeks)
            {
                DateTime CurrentDay = Today.Date;
                if (Today.DayOfWeek != DayOfWeek.Sunday)
                {
                    CurrentDay = Today.Date.AddDays(7);
                }

                if (DateTime.Now.Month == 1)
                {
                    if (X.weekStart.Date <= CurrentDay.Date && X.weekFinish.Date <= CurrentDay.Date)
                    {
                        SelectWeeks = X.weekStart.ToString("dd MMM yyyy") + " - " + X.weekFinish.ToString("dd MMM yyyy");
                        var Value = X.weekStart.ToString("yyyy-MM-dd") + ";" + X.weekFinish.ToString("yyyy-MM-dd") + ";" + X.weekNum;
                        WeekList.Add(new WeeksList {
                            Weeks = Value, SelectDates = SelectWeeks
                        });
                        for (var dt = X.weekStart; dt <= X.weekFinish; dt = dt.AddDays(1))
                        {
                            DateList.Add(new DateList {
                                Weeks = X.weekNum, Date = dt, DateName = dt.DayOfWeek.ToString()
                            });
                            num = X.weekNum;
                        }
                    }
                }
                else
                {
                    if (X.weekStart.Date <= CurrentDay.Date && X.weekFinish.Date <= CurrentDay.Date && X.weekFinish.Year == Today.Year)
                    {
                        SelectWeeks = X.weekStart.ToString("dd MMM yyyy") + " - " + X.weekFinish.ToString("dd MMM yyyy");
                        var Value = X.weekStart.ToString("yyyy-MM-dd") + ";" + X.weekFinish.ToString("yyyy-MM-dd") + ";" + X.weekNum;
                        WeekList.Add(new WeeksList {
                            Weeks = Value, SelectDates = SelectWeeks
                        });
                        for (var dt = X.weekStart; dt <= X.weekFinish; dt = dt.AddDays(1))
                        {
                            DateList.Add(new DateList {
                                Weeks = X.weekNum, Date = dt, DateName = dt.DayOfWeek.ToString()
                            });
                            num = X.weekNum;
                        }
                    }
                }
            }

            var TimeSelected = (string)item.DateStart.ToString("yyyy-MM-dd") + ";" + item.DateEnd.ToString("yyyy-MM-dd") + ";" + num;
            var Selected     = item.DateStart.ToString("dd MMM yyyy") + " - " + item.DateEnd.ToString("dd MMM yyyy");

            DateList.Add(new DateList {
                Weeks = num, Date = item.DateStart, DateName = item.DateStart.DayOfWeek.ToString()
            });
            WeekList.Add(new WeeksList {
                Weeks = TimeSelected, SelectDates = Selected
            });

            ViewBag.TimeSelected   = TimeSelected;
            ViewBag.Weeks          = JsonConvert.SerializeObject(WeekList);
            ViewBag.Dates          = JsonConvert.SerializeObject(DateList);
            ViewBag.LineManager    = _userHelper.GetByRoleName("Line Manager").ToList();
            ViewBag.ProjectManager = _userHelper.GetByRoleName("Project Manager").ToList();
            ViewBag.Activity       = _actiivity.GetAll().ToList();
            ViewBag.TimeSheetType  = _timesheet.GetAll().ToList();
            if (item != null)
            {
                var model     = Mapper.Map <AttendaceExceptionListModelForm>(item);
                var ListHours = string.Join(",", _attendanceRecord.GetAll().Where(x => x.AttendaceExceptionListId.Equals(item.Id)).Select(x => x.Hours).ToArray());
                var ListDate  = string.Join(",", _attendanceRecord.GetAll().Where(x => x.AttendaceExceptionListId.Equals(item.Id)).Select(x => x.AttendanceRecordDate.ToString("yyyy-MM-dd")).ToArray());
                model.Hours = ListHours;
                model.AttendanceRecordDate = ListDate;
                return(View(model));
            }
            return(NotFound());
        }