示例#1
0
        // GET: Departements/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var departements = iDepatementService.GetById(id.GetValueOrDefault());

            if (departements == null)
            {
                return(NotFound());
            }

            return(View(departements));
        }
示例#2
0
        public override IActionResult Details(Guid id)
        {
            var networkNumber = Service.GetById(id);

            ViewBag.Departements    = departement.GetById(networkNumber.DepartmentId);
            ViewBag.Project         = projects.GetById(networkNumber.ProjectId);
            ViewBag.LineManagers    = _userHelper.GetUserProfile(networkNumber.LineManagerId);
            ViewBag.ProjectManagers = _userHelper.GetUserProfile(networkNumber.ProjectManagerId);
            ViewBag.AccountNames    = accountName.GetById(networkNumber.AccountNameId);
            return(base.Details(id));
        }
示例#3
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var user = _userHelper.GetUser(User);

            var roles = _userManager
                        .GetRolesAsync(user)
                        .Result
                        .ToList();

            if (User.IsInRole("Contractor"))
            {
                var srf            = _userHelper.GetCurrentSrfByLogin(User);
                var ContractorInfo = _candidate.GetById(srf.CandidateId);
                var Vacancy        = _vacancy.GetById(ContractorInfo.VacancyId);
                ViewBag.Srf            = srf;
                ViewBag.ContractorInfo = ContractorInfo;
                ViewBag.Departement    = _department.GetById(srf.DepartmentId);
                ViewBag.DepartmentSub  = _departmentSub.GetById(srf.DepartmentSubId);
                ViewBag.LineManager    = _userHelper.GetUserProfile(srf.ApproveOneId.Value);
                ViewBag.ProjectManager = _userHelper.GetUserProfile(srf.ProjectManagerId);
                ViewBag.SSOW           = _ssow.GetById(Vacancy.ServicePackId);
                if (ContractorInfo.HomeBaseId.HasValue)
                {
                    ViewBag.HomeBase = _city.GetById(ContractorInfo.HomeBaseId).Name;
                }
                else
                {
                    ViewBag.HomeBase = "-";
                }
            }
            else
            {
                ViewBag.Srf            = null;
                ViewBag.ContractorInfo = null;
                ViewBag.Departement    = null;
                ViewBag.DepartmentSub  = null;
                ViewBag.LineManager    = null;
            }


            ViewBag.ModelForm   = _mapper.Map <UpdateProfileForm>(user);
            ViewBag.CurretRoles = roles;
            return(View(_mapper.Map <ApplicationUserViewModel>(user)));
        }
示例#4
0
        public override IActionResult Edit(string id, RecoveryForm model)
        {
            if (ModelState.IsValid)
            {
                var User = _userHelper.GetUser(id);
                if (User != null)
                {
                    // Insert Vacancy
                    var NewVacancy = new VacancyList();
                    NewVacancy.AccountNameId         = model.AccountNameId;
                    NewVacancy.ApproverOneId         = model.ApproverOneId;
                    NewVacancy.ApproverTwoId         = model.SourcingId;
                    NewVacancy.CostCodeId            = model.CostCodeId;
                    NewVacancy.CreatedAt             = DateTime.Now;
                    NewVacancy.DepartmentId          = model.DepartmentId;
                    NewVacancy.DepartmentSubId       = model.DepartmentSubId;
                    NewVacancy.JobStageId            = model.JobStageId;
                    NewVacancy.JoinDate              = model.JoinDate;
                    NewVacancy.NetworkId             = model.NetworkId;
                    NewVacancy.NoarmalRate           = model.NoarmalRate;
                    NewVacancy.OtLevel               = model.OtLevel;
                    NewVacancy.RequestBy             = _userHelper.GetUserProfile(model.ApproverOneId);
                    NewVacancy.PackageTypeId         = model.PackageTypeId;
                    NewVacancy.ServicePackCategoryId = model.ServicePackCategoryId;
                    NewVacancy.ServicePackId         = model.ServicePackId;
                    //NewVacancy.Status = VacanStatusFive.Done;
                    NewVacancy.VacancyStatus = ApproverStatus.Completed;
                    NewVacancy.isHrms        = model.isHrms;
                    NewVacancy.isLaptop      = model.isLaptop == 1 ? true : false;
                    NewVacancy.isManager     = model.isManager;
                    NewVacancy.isUsim        = model.isUsim;
                    NewVacancy.StatusOne     = SrfApproveStatus.Approved;
                    NewVacancy.StatusTwo     = SrfApproveStatus.Approved;
                    NewVacancy.StatusThree   = SrfApproveStatus.Approved;
                    NewVacancy.StatusFourth  = SrfApproveStatus.Approved;
                    _vacancy.Add(NewVacancy);

                    if (NewVacancy.Id != null)
                    {
                        // Insert Candidate
                        var UserProfile  = _profileService.GetByUserId(id);
                        var GetCandidate = _candidate.GetAll().Where(x => x.AccountId == UserProfile.Id).FirstOrDefault();

                        if (GetCandidate == null)
                        {
                            var Candidate = new CandidateInfo();
                            Candidate.Account           = UserProfile;
                            Candidate.Address           = UserProfile.Address;
                            Candidate.AgencyId          = model.AgencyId;
                            Candidate.AgencyType        = AgencyType.Agency;
                            Candidate.ApproveOneDate    = DateTime.Now;
                            Candidate.ApproveOneStatus  = ApproverStatus.Selected;
                            Candidate.ApproveTwoeDate   = DateTime.Now;
                            Candidate.CreatedAt         = DateTime.Now;
                            Candidate.Email             = User.Email;
                            Candidate.Gender            = UserProfile.Gender.Value;
                            Candidate.HomePhoneNumber   = UserProfile.HomePhoneNumber;
                            Candidate.IdNumber          = UserProfile.IdNumber;
                            Candidate.IsCandidate       = false;
                            Candidate.IsContractor      = true;
                            Candidate.IsUser            = true;
                            Candidate.Martial           = Martial.M1;
                            Candidate.MobilePhoneNumber = UserProfile.MobilePhoneNumber;
                            Candidate.Name             = UserProfile.Name;
                            Candidate.Nationality      = "Indonesia";
                            Candidate.NickName         = UserProfile.Name;
                            Candidate.PlaceOfBirth     = UserProfile.Birthplace;
                            Candidate.DateOfBirth      = UserProfile.Birthdate.Value;
                            Candidate.RequestBy        = _userHelper.GetUserProfile(model.AgencyId);
                            Candidate.ApproveTwoStatus = ApproverStatus.Completed;
                            Candidate.Vacancy          = NewVacancy;
                            GetCandidate = _candidate.Add(Candidate);
                        }

                        if (GetCandidate != null)
                        {
                            var Department = _department.GetById(model.DepartmentId);
                            var Network    = _network.GetById(model.NetworkId);
                            // Insert SRF
                            SrfRequest NewSrf = new SrfRequest();
                            NewSrf.CreatedAt          = DateTime.Now;
                            NewSrf.Number             = "0000";
                            NewSrf.Type               = SrfType.New;
                            NewSrf.ApproveStatusOne   = SrfApproveStatus.Approved;
                            NewSrf.ApproveStatusTwo   = SrfApproveStatus.Approved;
                            NewSrf.ApproveStatusThree = SrfApproveStatus.Approved;
                            NewSrf.ApproveStatusFour  = SrfApproveStatus.Approved;
                            NewSrf.ApproveStatusFive  = SrfApproveStatus.Approved;
                            NewSrf.ApproveStatusSix   = SrfApproveStatus.Approved;
                            NewSrf.RequestBy          = _userHelper.GetUserProfile(model.ApproverOneId).Name;
                            NewSrf.SrfBegin           = model.SrfBegin;
                            NewSrf.SrfEnd             = model.SrfEnd;
                            NewSrf.ServiceLevel       = model.OtLevel;
                            NewSrf.isWorkstation      = model.isLaptop == 1 ? true  : false;
                            NewSrf.isCommunication    = model.isUsim;
                            NewSrf.IsHrms             = model.isHrms;
                            NewSrf.IsOps              = Department.OperateOrNon == 1 ? true : false;
                            NewSrf.IsManager          = false;
                            NewSrf.RateType           = Domain.Models.Enum.RateType.Normal;
                            NewSrf.IsExtended         = false;
                            NewSrf.IsLocked           = false;
                            NewSrf.Status             = Domain.Models.Enum.SrfStatus.Done;
                            NewSrf.SpectValue         = 0;
                            NewSrf.IsActive           = false;
                            NewSrf.ServicePackId      = model.ServicePackId;
                            NewSrf.NetworkId          = model.NetworkId;
                            NewSrf.CostCenterId       = model.CostCodeId;
                            NewSrf.LineManagerId      = model.ApproverOneId;
                            NewSrf.ActivityCode       = _activity.GetAll().OrderBy(x => Guid.NewGuid()).FirstOrDefault();
                            NewSrf.DepartmentId       = model.DepartmentId;
                            NewSrf.DepartmentSubId    = model.DepartmentSubId;
                            NewSrf.ProjectManagerId   = Network.ProjectManagerId;
                            NewSrf.ApproveOneId       = model.ApproverOneId;
                            NewSrf.ApproveTwoId       = model.ApproveTwoId;
                            NewSrf.ApproveThreeId     = model.ApproveThreeId;
                            NewSrf.ApproveFourId      = model.ApproveFourId;
                            NewSrf.ApproveSixId       = model.ApproveSixId;
                            NewSrf.Candidate          = GetCandidate;
                            NewSrf.AccountId          = model.AccountNameId;
                            NewSrf.IsLocked           = false;
                            NewSrf.IsActive           = true;
                            var AnnualLeave = MonthDistance(model.SrfBegin, model.SrfEnd);
                            NewSrf.AnnualLeave = AnnualLeave;
                            Service.Add(NewSrf);
                            if (NewSrf.Id != null)
                            {
                                TempData["Success"] = true;
                            }
                        }
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
        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());
        }
示例#6
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());
            }
        }
示例#7
0
        public IActionResult Approval(string CandidateId, bool ApprovalStatus, string ApprovalNotes = null)
        {
            var Candidate = Service.GetById(Guid.Parse(CandidateId));

            var callbackUrl = Url.Action("Details",
                                         "Vacancy",
                                         new { area = "Admin", id = Candidate.VacancyId },
                                         _hostConfiguration.Protocol,
                                         _hostConfiguration.Name);


            if (ApprovalStatus == true)
            {
                if (User.IsInRole("Line Manager") && User.IsInRole("Sourcing"))
                {
                    Candidate.ApproveOneStatus = ApproverStatus.Selected;
                    Candidate.ApproveOneDate   = DateTime.Now;
                    Candidate.ApproveOneNotes  = ApprovalNotes;
                    Candidate.ApproveTwoStatus = ApproverStatus.Completed;
                    Candidate.ApproveTwoeDate  = DateTime.Now;
                    Candidate.ApproveTwoNotes  = ApprovalNotes;

                    // Update Another Candidate
                    var Temp = Service.GetAll().Where(x => x.VacancyId.Equals(Candidate.VacancyId) && x.Id != Candidate.Id).ToList();
                    foreach (var row in Temp)
                    {
                        var c = Service.GetById(row.Id);
                        c.ApproveTwoStatus = ApproverStatus.Shortlist;
                        Service.Update(c);
                    }
                }
                else if (User.IsInRole("Line Manager"))
                {
                    Candidate.ApproveOneStatus = ApproverStatus.Selected;
                    Candidate.ApproveOneDate   = DateTime.Now;
                    Candidate.ApproveOneNotes  = ApprovalNotes;
                    Service.Update(Candidate);

                    // Send Notif To Sourcing

                    var Vacancy  = _vacancy.GetById(Candidate.VacancyId);
                    var Sourcing = _user.GetById(Vacancy.ApproverTwoId);
                    var SrcUser  = _userService.GetById(Sourcing.ApplicationUserId);

                    _notif.Send(
                        User,                                                                       // User From
                        "Job vacancy CV is approved by " + _userHelper.GetLoginUser(User).Name,     // Subject
                        Sourcing.Name,                                                              // User target name
                        SrcUser.Email,                                                              // User target email
                        callbackUrl,                                                                // Link CallBack
                        "New Job vacancy CV is approved by " + _userHelper.GetLoginUser(User).Name, // Email content or descriptions
                        ApprovalNotes,                                                              // Description
                        NotificationInboxStatus.Approval,                                           // Notif Status
                        Activities.Vacant                                                           // Activity Status
                        );
                }

                else if (User.IsInRole("Sourcing"))
                {
                    Candidate.ApproveTwoStatus = ApproverStatus.Completed;
                    Candidate.ApproveTwoeDate  = DateTime.Now;
                    Candidate.ApproveTwoNotes  = ApprovalNotes;
                    Service.Update(Candidate);

                    // Update Another Candidate
                    var Temp = Service.GetAll().Where(x => x.VacancyId.Equals(Candidate.VacancyId) && x.Id != Candidate.Id).ToList();
                    foreach (var row in Temp)
                    {
                        var c = Service.GetById(row.Id);
                        c.ApproveTwoStatus = ApproverStatus.Shortlist;
                        Service.Update(c);
                    }
                }

                TempData["Approved"] = "OK";
            }
            else
            {
                // Send Correction To Agency
                var Up      = _userHelper.GetUserProfile(Candidate.AgencyId.Value);
                var AppUser = _userHelper.GetUser(Up.ApplicationUserId);

                _notif.Send(
                    User,                           // User From
                    "Correction CV",                // Subject
                    Up.Name,                        // User target name
                    Up.Email,                       // User target email
                    callbackUrl,                    // Link CallBack
                    "Rejected CV",                  // Email content or descriptions
                    ApprovalNotes,                  // Description
                    NotificationInboxStatus.Reject, // Notif Status
                    Activities.Vacant               // Activity Status
                    );

                Candidate.ApproveOneStatus = ApproverStatus.Shortlist;
                Candidate.ApproveTwoStatus = ApproverStatus.Shortlist;
                Candidate.ApproveOneDate   = DateTime.Now;
                Candidate.ApproveOneNotes  = ApprovalNotes;
                Service.Update(Candidate);
            }

            var Success = Service.GetAll().Where(x => x.ApproveTwoStatus == ApproverStatus.Completed && x.VacancyId.Equals(Candidate.VacancyId)).FirstOrDefault();

            if (Success != null)
            {
                var vc = _vacancy.GetById(Candidate.VacancyId);
                vc.VacancyStatus = ApproverStatus.Completed;
                _vacancy.Update(vc);

                var Dp      = _department.GetById(vc.DepartmentId);
                var Network = _network.GetById(vc.NetworkId);

                // SEND TO SRF
                var LineManager = _user.GetById(vc.ApproverOneId);

                SrfRequest Srf = new SrfRequest
                {
                    Type               = SrfType.New,
                    ApproveOneBy       = vc.ApproverOne,
                    CandidateId        = Candidate.Id,
                    CreatedAt          = DateTime.Now,
                    RequestBy          = _userHelper.GetLoginUser(User).Name,
                    ServicePackId      = vc.ServicePackId,
                    ServiceLevel       = vc.OtLevel,
                    isWorkstation      = vc.isLaptop,
                    isCommunication    = vc.isUsim,
                    NetworkId          = vc.NetworkId,
                    IsManager          = vc.isManager,
                    DepartmentId       = vc.DepartmentId,
                    DepartmentSubId    = vc.DepartmentSubId,
                    CostCenterId       = vc.CostCodeId,
                    IsHrms             = vc.isHrms,
                    IsOps              = Dp.OperateOrNon == 1 ? true : false,
                    LineManagerId      = LineManager.Id,
                    Status             = SrfStatus.Waiting,
                    AccountId          = Network.AccountNameId,
                    ApproveStatusOne   = SrfApproveStatus.Waiting, // Line Manager
                    ApproveStatusTwo   = SrfApproveStatus.Waiting, // Head Of Service Line
                    ApproveStatusThree = SrfApproveStatus.Waiting, // Head Of Operation
                    ApproveStatusFour  = SrfApproveStatus.Waiting, // Head Of Non Operation
                    ApproveStatusFive  = SrfApproveStatus.Waiting, // Head Of Sourcing
                    ApproveStatusSix   = SrfApproveStatus.Waiting, // Service Cordinator
                    ProjectManagerId   = Network.ProjectManagerId,
                    SrfBegin           = null,
                    SrfEnd             = null,
                    IsActive           = false,
                    IsLocked           = false,
                    AnnualLeave        = 0
                };
                _srf.Add(Srf);

                // Send Notif To Line Manager

                var LmUser = _userService.GetById(LineManager.ApplicationUserId);
                _notif.Send(
                    User,                                                                   // User From
                    "Job vacancy CV is approved by " + _userHelper.GetLoginUser(User).Name, // Subject
                    LineManager.Name,                                                       // User target name
                    LmUser.Email,                                                           // User target email
                    callbackUrl,                                                            // Link CallBack
                    "Job vacancy CV is approved by " + _userHelper.GetLoginUser(User).Name, // Email content or descriptions
                    ApprovalNotes,                                                          // Description
                    NotificationInboxStatus.Request,                                        // Notif Status
                    Activities.SRF                                                          // Activity Status
                    );

                TempData["Approved"] = "OK";
            }
            else
            {
                var Selected = Service.GetAll().Where(x => x.ApproveOneStatus == ApproverStatus.Selected && x.VacancyId.Equals(Candidate.VacancyId)).Count();
                var vc       = _vacancy.GetById(Candidate.VacancyId);
                if (Selected > 0)
                {
                    vc.VacancyStatus = ApproverStatus.Selected;
                }
                else
                {
                    TempData["Rejected"] = "OK";
                    vc.VacancyStatus     = ApproverStatus.Rejected;
                }
                _vacancy.Update(vc);
            }



            return(RedirectToAction("Details", "Vacancy", new { id = Candidate.VacancyId }));
        }
 public Departement GetByIdDepartement(int id)
 {
     return(_deptService.GetById(id));
 }
        public string CurrentTemplate()
        {
            string   sWebRootFolder = _environment.WebRootPath;
            string   sFileName      = @"report/TRCP_TEMPLATE.xlsx";
            string   URL            = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, sFileName);
            FileInfo file           = new FileInfo(Path.Combine(sWebRootFolder, sFileName));

            if (file.Exists)
            {
                file.Delete();
                file = new FileInfo(Path.Combine(sWebRootFolder, sFileName));
            }
            using (ExcelPackage package = new ExcelPackage(file))
            {
                ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Sheet1");
                int            i         = 0;
                int            index     = 1;
                worksheet.Cells[index, i += 1].Value = "Organization / Sub Organization";
                worksheet.Cells[index, i += 1].Value = "TRCP Approved";
                worksheet.Cells[index, i += 1].Value = "TRCP Forecast";
                worksheet.Cells[index, i += 1].Value = "Date SRF";

                for (int i_temp = 1; i_temp <= i; i_temp++)
                {
                    worksheet.Cells[index, i_temp].Style.Font.Bold        = true;
                    worksheet.Cells[index, i_temp].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
                    worksheet.Cells[index, i_temp].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(79, 129, 189));
                    worksheet.Cells[index, i_temp].Style.Font.Color.SetColor(System.Drawing.Color.White);
                }


                index += 1;
                var Data = Service.GetAll().ToList();
                if (Data != null)
                {
                    foreach (var row in Data)
                    {
                        if (row.DepartmentId.HasValue && row.DepartmentSubId == null)
                        {
                            var Temp = _dept.GetById(row.DepartmentId);
                            worksheet.Cells[index, 1].Value = Temp.Name;
                        }
                        else
                        {
                            var Temp = _deptSub.GetById(row.DepartmentSubId);
                            worksheet.Cells[index, 1].Value = Temp.SubName;
                        }
                        worksheet.Cells[index, 2].Value = row.Approved;
                        worksheet.Cells[index, 3].Value = row.Forecast;
                        if (row.DateSrf.HasValue)
                        {
                            worksheet.Cells[index, 4].Value = row.DateSrf.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            worksheet.Cells[index, 4].Value = "";
                        }
                        index++;
                    }
                }
                worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
                package.Save();
            }
            return(URL);
        }
示例#10
0
        public IActionResult GetOptionFormSrf(string id)
        {
            var Dept = _department.GetById(Guid.Parse(id));
            Dictionary <string, object> Data = new Dictionary <string, object>();

            String DepartmentSub     = "<option disabled selected>-- Select Sub Organizational Unit --</option>";
            var    ListDepartmentSub = _departmentSub.GetAll().Where(x => x.DepartmentId.Equals(Guid.Parse(id))).ToList();

            foreach (var row in ListDepartmentSub)
            {
                if (ListDepartmentSub.Count == 1)
                {
                    DepartmentSub += "<option value='" + row.Id + "' selected>" + row.SubName + "</option>";
                }
                else
                {
                    DepartmentSub += "<option value='" + row.Id + "'>" + row.SubName + "</option>";
                }
            }
            DepartmentSub += "<option></option>";

            String CostCenter     = "<option disabled selected>-- Select Cost Center --</option>";
            var    ListCostCenter = _costCenter.GetAll().Where(x => x.DepartmentId.Equals(Guid.Parse(id))).ToList();

            foreach (var row in ListCostCenter)
            {
                if (ListCostCenter.Count == 1)
                {
                    CostCenter += "<option value='" + row.Id + "' selected>" + row.DisplayName + "</option>";
                }
                else
                {
                    CostCenter += "<option value='" + row.Id + "'>" + row.DisplayName + "</option>";
                }
            }
            CostCenter += "<option></option>";

            String NetworkNumber     = "<option disabled selected>-- - Select Network Number -- --</option>";
            var    ListNetworkNumber = _networkNumber.GetAll().Where(x => x.DepartmentId.Equals(Guid.Parse(id))).ToList();

            foreach (var row in ListNetworkNumber)
            {
                if (ListNetworkNumber.Count == 1)
                {
                    NetworkNumber += "<option value='" + row.Id + "' selected>" + row.DisplayName + "</option>";
                }
                else
                {
                    NetworkNumber += "<option value='" + row.Id + "'>" + row.DisplayName + "</option>";
                }
            }
            NetworkNumber += "<option></option>";

            Data.Add("DepartementSub", DepartmentSub);
            Data.Add("CostCenter", CostCenter);
            Data.Add("NetworkNumber", NetworkNumber);

            if (Dept.OperateOrNon == 1)
            {
                Data.Add("IsOperation", true);
            }
            else
            {
                Data.Add("IsOperation", false);
            }
            return(Ok(Data));
        }