Example #1
0
        public IActionResult Submit(Guid id)
        {
            var vacancy = _vacancy.GetById(id);

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

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

            IsEriccson.Add("No", false);
            IsEriccson.Add("Yes", true);
            var GenderOption = from Gender g in Enum.GetValues(typeof(Gender)) select new { Id = (int)g, Name = g.ToString() };
            var AgentOpt     = from AgencyType g in Enum.GetValues(typeof(AgencyType)) select new { Id = (int)g, Name = g.ToString() };
            var MartialOpt   = from Martial g in Enum.GetValues(typeof(Martial)) select new { Id = (int)g, Name = g.ToString() };

            ViewBag.VacancyId  = id;
            ViewBag.Gender     = GenderOption.ToList();
            ViewBag.Agent      = AgentOpt.ToList();
            ViewBag.Martial    = MartialOpt.ToList();
            ViewBag.IsEriccson = IsEriccson.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList();

            return(View(new CandidateInfoModelForm()));
        }
Example #2
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)));
        }
Example #3
0
        public override IActionResult Details(Guid id)
        {
            var item = Service.GetById(id);

            //ViewBag.CostCenter = _costCenter.GetById(item.CostCenterId).Code;
            //ViewBag.NetworkNumber = _networkNumber.GetById(item.NetworkNumberId).DisplayName;
            //ViewBag.ActivityCode = _activityCode.GetById(item.ActivityCodeId).DisplayName;
            ViewBag.ContractorName = _vacancy.GetById(item.VacancyId).Name;
            ViewBag.Departure      = _city.GetById(item.DepartureId).Name;
            ViewBag.Destination    = _city.GetById(item.DestinationId).Name;
            ViewBag.ProjectManager = _profileUser.GetById(item.ClaimApproverOneId).Name;
            ViewBag.LineManager    = _profileUser.GetById(item.ClaimApproverTwoId).Name;
            return(base.Details(id));
        }
Example #4
0
        public JobStage GetByActiveUser(int UserId)
        {
            var CandidateInfo = _candidate
                                .GetAll()
                                .Where(x => x.AccountId == UserId)
                                .OrderByDescending(x => x.CreatedAt)
                                .FirstOrDefault();

            if (CandidateInfo != null)
            {
                var Vacancy = _vacancy.GetById(CandidateInfo.VacancyId);
                return(_repository.GetSingle(Vacancy.JobStageId));
            }

            return(null);
        }
Example #5
0
        public override IActionResult Details(Guid id)
        {
            var item = Service.GetById(id);

            //ViewBag.Department = _department.GetById(item.DepartmentId).Name;
            //ViewBag.SubDepartment = _departmentSub.GetById(item.DepartmentSubId).SubName;
            //ViewBag.CostCenter = _cost.GetById(item.CostId).DisplayName;
            //ViewBag.AccountName = _account.GetById(item.AccountNameId).Name;
            //ViewBag.Network = _network.GetById(item.NetworkId).DisplayName;
            //ViewBag.Project = _project.GetById(item.ProjectId).Description;
            //ViewBag.Activity = _actiivity.GetById(item.ActivityId).DisplayName;
            //ViewBag.SubOperation = _subOp.GetById(item.SubOpsId).Description;
            //ViewBag.Location = _city.GetById(item.LocationId).Name;
            //ViewBag.TimesheetType = _timesheet.GetById(item.TimeSheetTypeId).Type.ToString();
            //ViewBag.TimesheetPeriode = item.DateStart.ToString("dd MMM yyyy") + " - " + item.DateEnd.ToString("dd MMM yyyy");
            ViewBag.Description    = item.Description;
            ViewBag.ProjectManager = _profile.GetById(item.ApproverOneId).Name;
            ViewBag.LineManager    = _profile.GetById(item.ApproverTwoId).Name;
            ViewBag.ContractorName = _vacancy.GetById(item.VacancyId).Name;
            return(base.Details(id));
        }
        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());
        }
Example #7
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());
            }
        }
Example #8
0
        private void Srf()
        {
            Data dt = new Data("srf");

            foreach (var row in dt.GetData())
            {
                int  index          = 1;
                var  Data           = (List <String>)row;
                var  Email          = Data[index].ToString(); index += 1;
                var  CreatedAt      = Data[index].ToString(); index += 1;
                var  SrfNumber      = Data[index].ToString(); index += 1;
                var  IsOps          = Data[index].ToString(); index += 1;
                var  SrfLineManager = Data[index].ToString(); index += 1;
                var  SrfHeadOfSL    = Data[index].ToString(); index += 1;
                var  SrfHeadOfOps   = Data[index].ToString(); index += 1;
                var  SrfOrNon       = Data[index].ToString(); index += 1;
                var  SrfHsrc        = Data[index].ToString(); index += 1;
                var  SerCoord       = Data[index].ToString(); index += 1;
                var  DateApprov1    = Data[index].ToString(); index += 1;
                var  DateApprov2    = Data[index].ToString(); index += 1;
                var  DateApprov3    = Data[index].ToString(); index += 1;
                var  DateApprov4    = Data[index].ToString(); index += 1;
                var  DateApprov5    = Data[index].ToString(); index += 1;
                var  DateApprov6    = Data[index].ToString(); index += 1;
                var  SrfStatus      = Data[index].ToString(); index += 1;
                var  SrfBegin       = Data[index].ToString(); index += 1;
                var  SrfEnd         = Data[index].ToString(); index += 1;
                var  RateType       = Data[index].ToString(); index += 1;
                var  ActivityCod    = Data[index].ToString(); index += 1;
                var  SRF_LM         = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(SrfLineManager)).FirstOrDefault();
                var  SRF_HSL        = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(SrfHeadOfSL)).FirstOrDefault();
                var  SRF_OPS        = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(SrfHeadOfOps)).FirstOrDefault();
                var  SRF_NONOPS     = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(SrfHeadOfOps)).FirstOrDefault();
                var  SRF_HOSRC      = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(SrfHsrc)).FirstOrDefault();
                var  SRF_SRCRD      = _userProfile.GetAll().Where(x => Truncate(x.Name) == Truncate(SerCoord)).FirstOrDefault();
                bool WhatOps        = !string.IsNullOrEmpty(SrfHeadOfOps) ? true : false;

                var Candidate = _candidate.GetAll().Where(x => Truncate(x.Email) == Truncate(Email)).FirstOrDefault();
                if (Candidate != null)
                {
                    var Vacancy           = _vacancy.GetById(Candidate.VacancyId);
                    var Network           = _networkNumber.GetById(Vacancy.NetworkId);
                    var Type              = SrfType.New;
                    var AnnualLeave       = MonthDistance(DateTime.Parse(SrfBegin), DateTime.Parse(SrfEnd));
                    var ParentId          = (String)null;
                    var CheckCandidateSrf = _srf.GetAll().Where(x => x.Candidate == Candidate).OrderByDescending(x => x.SrfEnd).FirstOrDefault();
                    if (CheckCandidateSrf != null)
                    {
                        Type        = SrfType.Extension;
                        ParentId    = CheckCandidateSrf.Id.ToString();
                        AnnualLeave = AnnualLeave + CheckCandidateSrf.AnnualLeave;
                    }

                    //# Create NewSrf SRF
                    SrfRequest NewSrf = new SrfRequest();
                    NewSrf.CreatedAt        = !string.IsNullOrEmpty(CreatedAt) ? DateTime.Parse(CreatedAt) : DateTime.MinValue;
                    NewSrf.Number           = SrfNumber;
                    NewSrf.Type             = Type;
                    NewSrf.ApproveStatusOne = SrfApproveStatus.Submitted;
                    if (Truncate(RateType) == Truncate("Normal"))
                    {
                        NewSrf.ApproveStatusTwo = SrfApproveStatus.Approved;
                        if (WhatOps == true)
                        {
                            NewSrf.ApproveStatusThree = SrfApproveStatus.Approved;
                            NewSrf.ApproveStatusFour  = SrfApproveStatus.Waiting;
                        }
                        else
                        {
                            NewSrf.ApproveStatusThree = SrfApproveStatus.Waiting;
                            NewSrf.ApproveStatusFour  = SrfApproveStatus.Approved;
                        }
                        NewSrf.ApproveStatusSix = SrfApproveStatus.Approved;
                    }
                    else
                    {
                        NewSrf.ApproveStatusFive = SrfApproveStatus.Approved;
                    }

                    NewSrf.RequestBy       = SRF_LM.Name;
                    NewSrf.SrfBegin        = !string.IsNullOrEmpty(SrfBegin) ? DateTime.Parse(SrfBegin) : DateTime.MinValue;
                    NewSrf.SrfEnd          = !string.IsNullOrEmpty(SrfEnd) ? DateTime.Parse(SrfEnd) : DateTime.MinValue;
                    NewSrf.ServiceLevel    = Vacancy.OtLevel;
                    NewSrf.isWorkstation   = Vacancy.isLaptop;
                    NewSrf.isCommunication = Vacancy.isUsim;
                    NewSrf.IsHrms          = Vacancy.isHrms;
                    NewSrf.IsOps           = WhatOps;
                    NewSrf.IsManager       = false;

                    if (Truncate(RateType) == Truncate("Normal"))
                    {
                        NewSrf.RateType = Domain.Models.Enum.RateType.Normal;
                    }
                    else
                    {
                        NewSrf.RateType   = Domain.Models.Enum.RateType.SpecialRate;
                        NewSrf.SpectValue = Vacancy.NoarmalRate;
                    }

                    NewSrf.IsExtended       = (Type == SrfType.New) ? false : true;
                    NewSrf.IsLocked         = false;
                    NewSrf.Status           = Domain.Models.Enum.SrfStatus.Done;
                    NewSrf.SpectValue       = 0;
                    NewSrf.IsActive         = false;
                    NewSrf.ServicePackId    = Vacancy.ServicePackId;
                    NewSrf.NetworkId        = Vacancy.NetworkId;
                    NewSrf.CostCenterId     = Vacancy.CostCodeId;
                    NewSrf.LineManagerId    = Vacancy.ApproverOneId.Value;
                    NewSrf.ActivityCode     = _activity.GetAll().Where(x => Truncate(x.Code) == Truncate(ActivityCod)).FirstOrDefault();
                    NewSrf.DepartmentId     = Vacancy.DepartmentId;
                    NewSrf.DepartmentSubId  = Vacancy.DepartmentSubId;
                    NewSrf.ProjectManagerId = Network.ProjectManagerId;
                    NewSrf.ApproveOneBy     = SRF_LM;
                    NewSrf.ApproveTwoBy     = SRF_HSL;
                    if (WhatOps == true)
                    {
                        NewSrf.ApproveThreeBy = SRF_OPS;
                    }
                    else
                    {
                        NewSrf.ApproveFourBy = SRF_NONOPS;
                    }
                    NewSrf.ApproveSixBy = SRF_SRCRD;
                    NewSrf.Candidate    = Candidate;
                    NewSrf.AccountId    = Vacancy.AccountNameId;

                    if (!string.IsNullOrEmpty(ParentId))
                    {
                        NewSrf.ExtendFrom = Guid.Parse(ParentId);
                    }

                    NewSrf.AnnualLeave = AnnualLeave;
                    _srf.Add(NewSrf);

                    if (Truncate(RateType) != Truncate("Normal"))
                    {
                        // # Create Escalasi in NewSrf

                        var Escalation = new SrfEscalationRequest();
                        Escalation.OtLevel            = NewSrf.ServiceLevel;
                        Escalation.IsWorkstation      = NewSrf.isWorkstation;
                        Escalation.IsCommnunication   = NewSrf.isCommunication;
                        Escalation.SparateValue       = Vacancy.NoarmalRate;
                        Escalation.Status             = StatusEscalation.Done;
                        Escalation.ApproveStatusOne   = SrfApproveStatus.Approved;
                        Escalation.ApproveStatusTwo   = SrfApproveStatus.Approved;
                        Escalation.ApproveStatusThree = SrfApproveStatus.Approved;
                        Escalation.ApproveStatusFour  = SrfApproveStatus.Approved;
                        Escalation.Note          = "";
                        Escalation.ServicePackId = NewSrf.ServicePackId;
                        Escalation.SrfRequest    = NewSrf;
                        _escalation.Add(Escalation);
                    }

                    if (NewSrf != null)
                    {
                        Count++;
                        Console.WriteLine(Data[0] + " " + Email + " Srf  with " + SrfNumber + "  from " + SrfBegin + " to " + SrfEnd + "  has been saved ");
                    }
                }
                else
                {
                    Console.WriteLine(Data[0] + " " + Email);
                }
            }

            Console.WriteLine(Count + " Srf record has been saved ");
        }
Example #9
0
        private void Upload()
        {
            var AllUser       = _userProfile.GetAll().ToList();
            var AllVacancy    = _vacancy.GetAll().ToList();
            var AllCandidate  = _candidate.GetAll().ToList();
            var AllEscalation = _escalation.GetAll().ToList();

            foreach (var row in AllUser)
            {
                String IdNumber = null;
                if (!string.IsNullOrEmpty(row.IdNumber))
                {
                    if (row.IdNumber.Length > 16)
                    {
                        IdNumber = row.IdNumber.Substring(0, 16);
                    }
                    else
                    {
                        IdNumber = row.IdNumber;
                    }
                }
                else
                {
                    Random random = new Random();
                    IdNumber = random.Next(0, 16).ToString();
                }

                var Pro = _userProfile.GetById(row.Id);

                // Upload User Profile
                if (!String.IsNullOrEmpty(row.Photo))
                {
                    var File = System.IO.File.Exists(Source + "/" + row.Photo);
                    if (File == true)
                    {
                        String   src    = Upload("temp", row.Photo);
                        FileInfo info   = new FileInfo(Source + "/" + row.Photo);
                        var      result = new Attachment()
                        {
                            Name     = info.Name,
                            FileType = info.Extension,
                            Type     = Attachment.FILE_TYPE_UPLOAD,
                            Path     = src,
                            Size     = info.Length / 1024
                        };
                        string output = JsonConvert.SerializeObject(result);
                        Pro.Photo = output;
                    }
                }


                Pro.IdNumber = IdNumber;
                _userProfile.Update(Pro);
            }



            // Vacancy

            foreach (var row in AllVacancy)
            {
                List <string> files = new List <string>();
                var           vac   = _vacancy.GetById(row.Id);

                if (!String.IsNullOrEmpty(row.Files))
                {
                    var attach = row.Files.Split(',');
                    if (attach != null)
                    {
                        foreach (var a in attach)
                        {
                            var File = System.IO.File.Exists(Source + "/" + a);
                            if (File == true)
                            {
                                String src = Upload("vacancy", a);
                                files.Add(src);
                            }
                        }
                    }
                }

                if (files != null)
                {
                    vac.Files = JsonConvert.SerializeObject(files);
                    _vacancy.Update(vac);
                }
            }


            // Candidate
            foreach (var row in AllCandidate)
            {
                List <string> files = new List <string>();
                var           can   = _candidate.GetById(row.Id);

                if (!String.IsNullOrEmpty(row.Attachments))
                {
                    var attach = row.Attachments.Split(',');
                    if (attach != null)
                    {
                        foreach (var a in attach)
                        {
                            var File = System.IO.File.Exists(Source + "/" + a);
                            if (File == true)
                            {
                                String src = Upload("candidate", a);
                                files.Add(src);
                            }
                        }
                    }
                }

                if (files != null)
                {
                    can.Attachments = JsonConvert.SerializeObject(files);
                    _candidate.Update(can);
                }
            }


            //Srf Escalation
            foreach (var row in AllEscalation)
            {
                List <string> files = new List <string>();
                var           esc   = _escalation.GetById(row.Id);

                if (!String.IsNullOrEmpty(row.Files))
                {
                    var attach = row.Files.Split(',');
                    if (attach != null)
                    {
                        foreach (var a in attach)
                        {
                            var File = System.IO.File.Exists(Source + "/" + a);
                            if (File == true)
                            {
                                String src = Upload("escalation", a);
                                files.Add(src);
                            }
                        }
                    }
                }

                if (files != null)
                {
                    esc.Files = JsonConvert.SerializeObject(files);
                    _escalation.Update(esc);
                }
            }
        }
Example #10
0
        public override IActionResult Edit(Guid id)
        {
            try
            {
                var item        = Service.GetById(id);
                var Contractor  = _contractor.GetById(item.CandidateId);
                var Vacancy     = _vacancy.GetById(Contractor.VacancyId);
                var PackageType = _packageType.GetById(Vacancy.PackageTypeId);
                var Ssow        = _servicePack.GetById(item.ServicePackId);
                var UserProfile = _userProfile.GetById(Contractor.AccountId);
                if (item == null)
                {
                    return(NotFound());
                }
                else
                {
                    var GenderOption  = from Gender g in Enum.GetValues(typeof(Gender)) select new { Id = (int)g, Name = g.ToString() };
                    var MartialOpt    = from Martial g in Enum.GetValues(typeof(Martial)) select new { Id = (int)g, Name = g.ToString() };
                    var PricelistType = from PackageTypes g in Enum.GetValues(typeof(PackageTypes)) select new { Id = (int)g, Name = g.ToString() };
                    var User          = _userManager.FindByIdAsync(UserProfile.ApplicationUserId).Result;

                    // Dropdown List
                    ViewBag.ServiceWorkPackage = _servicePackCategory.GetAll().ToList();
                    ViewBag.HomeBase           = _city.GetAll().ToList();
                    ViewBag.LineManager        = _userHelper.GetByRoleName("Line Manager").ToList();
                    ViewBag.ProjectManager     = _userHelper.GetByRoleName("Project Manager").ToList();
                    ViewBag.Gender             = GenderOption.ToList();
                    ViewBag.Martial            = MartialOpt.ToList();
                    ViewBag.PricelistType      = PricelistType.ToList();
                    ViewBag.ContractorId       = item.CandidateId;
                    ViewBag.UserProfile        = UserProfile;


                    // Set Data
                    var PackageTy             = (PackageTypes)Enum.Parse(typeof(PackageTypes), PackageType.Name);
                    ContractorModelForm model = new ContractorModelForm();
                    model.AhID                  = UserProfile.AhId;
                    model.SrfNumber             = item.Number;
                    model.ContrctorName         = Contractor.Name;
                    model.PricelistType         = PackageTy;
                    model.ServicePackId         = item.ServicePackId;
                    model.ServicePackCategoryId = Ssow.ServicePackCategoryId;
                    model.SrfBegin              = item.SrfBegin.Value;
                    model.SrfEnd                = item.SrfEnd.Value;

                    if (Contractor.HomeBaseId.HasValue)
                    {
                        model.HomeBaseId = Contractor.HomeBaseId.Value;
                    }

                    model.LineManagerId     = item.ApproveOneId.Value;
                    model.ProjectManagerId  = item.ProjectManagerId;
                    model.HomePhoneNumber   = Contractor.HomePhoneNumber;
                    model.MobilePhoneNumber = Contractor.MobilePhoneNumber;
                    model.IdNumber          = Contractor.IdNumber;
                    model.Email             = User.Email;
                    model.Nationality       = Contractor.Nationality;
                    model.DateOfBirth       = Contractor.DateOfBirth;
                    model.PlaceOfBirth      = Contractor.PlaceOfBirth;
                    model.Address           = Contractor.Address;
                    model.Gender            = Contractor.Gender;
                    model.Martial           = Contractor.Martial.Value;
                    model.ApplicationUserId = User.Id;
                    model.Username          = User.UserName;
                    model.Notes             = UserProfile.Description;
                    model.SrfId             = id;
                    return(View(model));
                }
            }
            catch (Exception e)
            {
                return(Content(e.ToString()));
            }
        }
Example #11
0
        public override IActionResult Edit(Guid id)
        {
            try
            {
                var item = Service.GetById(id);
                //var Srf = _userHelper.GetCurrentSrfByLogin(User);
                //var Candidate = _candidate.GetById(Srf.CandidateId);
                var Vacancy = _vacancy.GetById(item.VacancyId);

                var CheckTravel = Service
                                  .GetAll()
                                  .Where(x => x.ClaimType == ClaimType.TravelClaim && x.ContractorId.Equals(_userHelper.GetLoginUser(User)) && x.StatusOne == StatusOne.Approved && x.StatusTwo == StatusTwo.Approved)
                                  .ToList()
                                  .Count();

                //ViewBag.CostCenter = _costCenter.GetAll().Where(x => x.Status == Status.Active).ToList();
                //ViewBag.NetworkCode = _networkNumber.GetAll().Where(x => x.IsClosed == false).ToList();
                ViewBag.Project = _project.GetAll().ToList();
                //ViewBag.SubOrganizationUnit = _departmentSub.GetAll().ToList();
                //ViewBag.Activity = _activity.GetAll().ToList();

                if (CheckTravel > 0)
                {
                    ViewBag.ClaimCategory = _claimCategory.GetAll().ToList();
                }
                else
                {
                    ViewBag.ClaimCategory = _claimCategory.GetAll().Where(x => !x.Name.Equals("Travel Allowance")).ToList();
                }

                ViewBag.ProjectManager = _userHelper.GetByRoleName("Regional Project Manager").ToList();
                ViewBag.LineManager    = _userHelper.GetByRoleName("Line Manager").ToList();
                ViewBag.DayType        = Enum.GetValues(typeof(DayType)).Cast <DayType>().Select(v => new SelectListItem
                {
                    Text  = Extension.GetEnumDescription(v),
                    Value = ((int)v).ToString()
                }).ToList();
                ViewBag.Option = Enum.GetValues(typeof(AllowanceOptions)).Cast <AllowanceOptions>().Select(v => new SelectListItem
                {
                    Text  = Extension.GetEnumDescription(v),
                    Value = ((int)v).ToString()
                }).ToList();
                ViewBag.TripType = Enum.GetValues(typeof(TripType)).Cast <TripType>().Select(v => new SelectListItem
                {
                    Text  = Extension.GetEnumDescription(v),
                    Value = ((int)v).ToString()
                }).ToList();
                ViewBag.AllowForm = JsonConvert.SerializeObject(_allowForm.GetAll().OrderBy(x => x.Name).Select(x => x.Value).ToList());
                if (Vacancy.isManager)
                {
                    ViewBag.IsManager = '1';
                }
                else
                {
                    ViewBag.IsManager = '0';
                }
                //ViewBag.DepartmentSubId = Srf.DepartmentSubId;
                ViewBag.Id = id;

                var model = Mapper.Map <ClaimModelForm>(item);
                if (!string.IsNullOrWhiteSpace(item.Files))
                {
                    var attachments = JsonConvert.DeserializeObject <List <string> >(item.Files);
                    model.Files = string.Join("|", attachments.ToArray()) + "|";
                }

                return(View(model));
            }
            catch (Exception e)
            {
                return(Content(e.ToString()));
            }
        }