Esempio n. 1
0
        private void Activation()
        {
            var AllSrf        = _srf.GetAll().ToList();
            var AllUser       = _userProfile.GetAll().ToList();
            var AllVacancy    = _vacancy.GetAll().ToList();
            var AllCandidate  = _candidate.GetAll().ToList();
            var AllEscalation = _escalation.GetAll().ToList();
            var GetLastSrf    = _srf.GetAll().OrderByDescending(x => x.CreatedAt).GroupBy(x => x.CandidateId).Select(x => x.Key).ToArray();
            var SrfCandidate  = _srf.GetAll().Where(x => GetLastSrf.Contains(x.CandidateId)).ToArray();

            foreach (var srf in SrfCandidate)
            {
                // Set Active Srf To User
                var _temp = _srf.GetById(srf.Id);
                _temp.IsActive = true;


                // Set Terminate
                if (!string.IsNullOrEmpty(srf.TeriminateNote))
                {
                    var Candidate = _candidate.GetById(srf.CandidateId);
                    if (Candidate.Account != null)
                    {
                        var pro = _userProfile.GetById(Candidate.AccountId);
                        pro.IsBlacklist = false;
                        pro.IsTerminate = true;
                        _userProfile.Update(pro);
                    }
                    _temp.Status = SrfStatus.Terminate;
                }

                _srf.Update(_temp);
            }



            // Generate SRF NUMBER
            //foreach (var row in AllSrf)
            //{
            //    String SrfNumber = null;
            //    if (string.IsNullOrEmpty(row.Number))
            //    {
            //        SrfNumber = "0000";
            //    }
            //    else
            //    {
            //        if (row.Number.Length > 4)
            //        {
            //            SrfNumber = row.Number.Substring(0, 4);
            //        }
            //        else
            //        {
            //            SrfNumber = row.Number;
            //        }
            //    }
            //    var _temp = _srf.GetById(row.Id);
            //    _temp.Number = SrfNumber;
            //    _srf.Update(_temp);
            //}
        }
Esempio n. 2
0
        public IActionResult ResetNumber()
        {
            var All = _srf.GetAll().OrderBy(x => x.CreatedAt).ToList();

            foreach (var row in All)
            {
                var temp = _srf.GetById(row.Id);
                temp.Number = null;
                _srf.Update(temp);
            }

            var After = _srf.GetAll().OrderBy(x => x.CreatedAt).ToList();

            foreach (var af in After)
            {
                var temp = _srf.GetById(af.Id);
                temp.Number = _srf.GenerateNumnber();
                _srf.Update(temp);
            }

            return(Content("OK"));
        }
Esempio n. 3
0
        protected override void AfterUpdateData(AttendaceExceptionList before, AttendaceExceptionList after)
        {
            int  ProfileId = 0;
            bool Send      = false;

            if (after.StatusOne == StatusOne.Reject)
            {
                ProfileId = after.ApproverOneId.Value;
                Send      = true;
            }

            if (after.StatusTwo == StatusTwo.Rejected)
            {
                ProfileId = after.ApproverTwoId.Value;
                Send      = true;
            }

            if (Send == true)
            {
                var callbackUrl = Url.Action("Index",
                                             "Registration",
                                             new { area = "Admin" },
                                             _hostConfiguration.Protocol,
                                             _hostConfiguration.Name);

                var AppProfile = _profile.GetById(ProfileId);
                var AppUser    = _userHelper.GetUser(AppProfile.ApplicationUserId);

                _notif.Send(
                    User,                                                   // User From
                    "Activity Request Correction",                          // Subject
                    AppProfile.Name,                                        // User target name
                    AppUser.Email,                                          // User target email
                    callbackUrl,                                            // Link CallBack
                    "Activity request has been correction please confirm.", // Email content or descriptions
                    after.Description,                                      // Description
                    NotificationInboxStatus.Request,                        // Notif Status
                    Activities.Request                                      // Activity Status
                    );

                // Update Status
                var item = Service.GetById(after.Id);
                if (after.StatusOne == StatusOne.Reject)
                {
                    item.StatusOne     = StatusOne.Waiting;
                    item.RequestStatus = ActiveStatus.Active;
                }

                if (after.StatusTwo == StatusTwo.Rejected)
                {
                    item.StatusTwo     = StatusTwo.Waiting;
                    item.RequestStatus = ActiveStatus.Active;
                }

                Service.Update(item);
            }

            var TimeSheetType = _timesheet.GetById(after.TimeSheetTypeId);

            if (TimeSheetType.Type.ToLower().Trim().Equals("Annual leave".ToLower().Trim()))
            {
                var ContratorSrf = _userHelper.GetCurrentSrfByLogin(User);
                if (ContratorSrf != null)
                {
                    var srf    = _srf.GetById(ContratorSrf.Id);
                    var Annual = (after.DateEnd.Month - after.DateStart.Month) <= 0 ? 0 : (after.DateEnd.Month - after.DateStart.Month);
                    srf.AnnualLeave = srf.AnnualLeave - Annual;
                    _srf.Update(srf);
                }
            }
        }
Esempio n. 4
0
        public IActionResult Add(Guid id)
        {
            try
            {
                var srf         = _srf.GetById(id);
                var Candidate   = _candidate.GetById(srf.CandidateId);
                var CurrentSSO  = _ssow.GetById(srf.ServicePackId);
                var Departement = _department.GetById(srf.DepartmentId);
                var Vacancy     = _vacancy.GetById(Candidate.VacancyId);

                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) && x.IsClosed == false).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());
        }