Ejemplo n.º 1
0
        //shortlist-tab confirm shortlist applicant
        public async Task <JsonResult> ConfirmShortlistApplicant(string mrfid, string applicant, bool sendsms = false)
        {
            SmsBlaster sms            = new SmsBlaster();
            var        classification = db.fn_get_manpower_classification(mrfid);

            if (classification == "One Time Placement")
            {
                await sms.SendBlastAccepted(mrfid, applicant, User.Identity.GetUserId(), sendsms);

                foreach (var i in applicant.Split(','))
                {
                    db.sp_confirm_shorlist_applicant(mrfid, i);
                    db.sp_confirm_accepted_applicant(mrfid, i);
                }
                return(Json("Successfully added applicant(s) in Hired Tab", JsonRequestBehavior.AllowGet));
            }
            else
            {
                await sms.SendBlastForRequirement(mrfid, applicant, User.Identity.GetUserId(), sendsms);

                foreach (var i in applicant.Split(','))
                {
                    db.sp_confirm_shorlist_applicant(mrfid, i);
                }
                Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Confirm Applicant to For Requirement", mrfid);

                return(Json("Successfully added in For Requirement Tab", JsonRequestBehavior.AllowGet));
            }
        }
        public async Task <ActionResult> CancelManpower(string mrfid, string reason)
        {
            db.sp_cancel_manpower(mrfid);
            var user_involved = db.sp_get_mrf_user_involved(mrfid).FirstOrDefault();
            var user          = User.Identity.GetUserId();

            db.sp_add_notification(user, user_involved.coordinator_id, $"Manpower is Cancelled {Environment.NewLine + reason}", mrfid);
            var manpower = await unitOfWork.ManpowerRepo.FindAsync(m => m.mrfid == mrfid);

            if (manpower.Classification == ManpowerClassification.New ||
                manpower.Classification == ManpowerClassification.Replacement)
            {
                manpower.RequiredNumber = 0;
                await unitOfWork.SaveAsync();
            }
            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Cancelled Manpower", mrfid);


            await Task.Run(new Action(() =>
            {
                new EmailSender().EmailNotificationRejectCancelled(mrfid, string.Format("{0} Has been cancelled", mrfid), string.Format("{0} Has been cancelled", mrfid), "", Recruitment.Class.Users.EmailAddress(user_involved.coordinator_id), Url.Action("ManpowerRequestDetail", "manpower", new { mrfid = mrfid }));
            }));

            return(RedirectToAction("dashboard", "recruitmentprocess", new { mrfid = mrfid }));
        }
Ejemplo n.º 3
0
        public async Task Test_ChangePersonalInformation_NotPossible()
        {
            //Take the personal from the inserted offer and change attributes that cannot be updated
            Personal personal   = _offer.personals[0];
            var      idOriginal = personal.id;

            personal.id = 999999;

            //Try to update
            var changedRows = await _resourceStockUpdateService.ChangeInformationAsync(_token, personal);

            Assert.True(changedRows == 0);

            //The personal in the original manpower should still be findable
            Manpower queryManpower = _captainHookGenerator.GenerateQueryManpower();
            var      response      = await _resourceStockQueryService.QueryOffersAsync(queryManpower, "de")
                                     .ToListAsync();

            //Assert
            Assert.NotNull(response);
            Assert.NotEmpty(response);
            var personalFromQuery = response.First().resource;

            Assert.True(personalFromQuery.id == idOriginal);
        }
Ejemplo n.º 4
0
        //applicant-list-tab

        public async Task <JsonResult> InviteApplicantListSearch(string mrfid, string applicant, bool sendsms = false)
        {
            SmsBlaster sms    = new SmsBlaster();
            var        retval = await sms.SendBlastInvited(mrfid, applicant, User.Identity.GetUserId(), sendsms);

            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Send Invitation", mrfid);
            return(Json(retval, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
 //invited-tab confirm invited
 public JsonResult ConfirmedInvitedApplicant(string mrfid, string applicant, bool sendsms = false)
 {
     foreach (var i in applicant.Split(','))
     {
         db.sp_confirm_applicant_invited_applicant(mrfid, i);
     }
     Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Confirmed Invited Applicant", mrfid);
     return(Json("Successfully added in Confirm Tab", JsonRequestBehavior.AllowGet));
 }
 public void ReAssignedManpower()
 {
     Manpower.AddAuditTrail(User.Identity.GetUserId(), mrfid + " has been re-assign to " + Users.Fullname(RecruiterId), mrfid);
     db.sp_add_notification(User.Identity.GetUserId(), RecruiterId, mrfid + " has been re-assign to " + Users.Fullname(RecruiterId), mrfid);
     foreach (var i in db.sp_admin_list())
     {
         db.sp_add_notification(User.Identity.GetUserId(), i.UserId, mrfid + " has been re-assign to " + Users.Fullname(RecruiterId), mrfid);
     }
     db.ExecuteCommand("update tbl_manpower_request set recruiter_id={0} where mrfid={1}", RecruiterId, mrfid);
 }
Ejemplo n.º 7
0
        public ActionResult ConfirmVarianceApplicant(string mrfid, string applicant, int tab)
        {
            foreach (var i in applicant.Split(','))
            {
                db.sp_confirm_variance_applicant(mrfid, i);
            }
            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Confirm Applicant to Variance", mrfid);

            return(RedirectToAction("dashboard", new RecruitmentManpowerProcessViewModel()
            {
                tab = tab, mrfid = mrfid, SuccessMessage = "Successfully added in For Variance Tab"
            }));
        }
Ejemplo n.º 8
0
        //for-requirement-tab confirm requirement applicant
        public async Task <JsonResult> ConfirmForRequirementApplicant(string mrfid, string applicant, bool sendsms = false)
        {
            SmsBlaster sms = new SmsBlaster();
            await sms.SendBlastAccepted(mrfid, applicant, User.Identity.GetUserId(), sendsms);

            foreach (var i in applicant.Split(','))
            {
                db.sp_confirm_accepted_applicant(mrfid, i);
            }
            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Successfully added in Hired Tab", mrfid);

            return(Json("Successfully added in For Accepted Tab", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        //confirm-tab confirm confirmed applicant
        public async Task <JsonResult> ConfirmedApplicant(string mrfid, string applicant, bool sendsms = false)
        {
            SmsBlaster sms    = new SmsBlaster();
            var        retval = await sms.SendBlastShortlist(mrfid, applicant, User.Identity.GetUserId(), sendsms);

            foreach (var i in applicant.Split(','))
            {
                db.sp_confirm_applicant(mrfid, i);
                db.sp_add_applicant_history(i, mrfid + " - Confirm");
            }
            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Confirm Applicant to Shortlist", mrfid);
            return(Json("Successfully added in Shortlist Tab", JsonRequestBehavior.AllowGet));
        }
        public async Task <ActionResult> CancelManpower(string mrfid)
        {
            db.sp_cancel_manpower(mrfid);
            var user_involved = db.sp_get_mrf_user_involved(mrfid).FirstOrDefault();
            var user          = User.Identity.GetUserId();

            db.sp_add_notification(user, user_involved.coordinator_id, "Manpower is Cancelled", mrfid);
            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Cancelled Manpower", mrfid);

            await Task.Run(new Action(() =>
            {
                new EmailSender().EmailNotificationRejectCancelled(mrfid, string.Format("{0} Has been cancelled", mrfid), string.Format("{0} Has been cancelled", mrfid), "", Recruitment.Class.Users.EmailAddress(user_involved.coordinator_id), Url.Action("ManpowerRequestDetail", "manpower", new { mrfid = mrfid }));
            }));

            return(RedirectToAction("dashboard", "recruitmentprocess", new { mrfid = mrfid }));
        }
Ejemplo n.º 11
0
        public async Task Test_ChangePersonalInformation_Possible()
        {
            //Take the personal from the inserted offer and change attributes
            Personal personal = _offer.personals[0];

            personal.qualification     = "Kapitän";
            personal.area              = "Piratenforschung";
            personal.annotation        = "Hier ein neuer Text";
            personal.experience_rt_pcr = false;
            personal.researchgroup     = "Akademische Piraten";
            personal.institution       = "TU Pirates";

            //Update
            var changedRows = await _resourceStockUpdateService.ChangeInformationAsync(_token, personal);

            Assert.True(changedRows == 1);

            //Create manpower to find the updated personal
            Manpower queryManpower = new Manpower()
            {
                qualification = new List <string>()
                {
                    "Kapitän"
                },
                area = new List <string>()
                {
                    "Piratenforschung"
                },
                address = new Address()
                {
                    PostalCode = _offer.provider.address.PostalCode,
                    Country    = _offer.provider.address.Country,
                }
            };
            var response = await _resourceStockQueryService.QueryOffersAsync(queryManpower, "de")
                           .ToListAsync();

            //Assert
            Assert.NotNull(response);
            Assert.NotEmpty(response);
            Personal personalFromQuery = response.First().resource;

            Console.Out.WriteLine(personalFromQuery);
            Console.Out.WriteLine(personal);
            Assert.Equal(personal, personalFromQuery);
        }
        public async Task <ActionResult> RejectManpower(string remarks, string mrfid)
        {
            var user_involved = db.sp_get_mrf_user_involved(mrfid).FirstOrDefault();
            var user          = User.Identity.GetUserId();

            db.sp_add_notification(user, user_involved.coordinator_id, Users.Fullname(User.Identity.GetUserId()) + " updated, to Rejected", mrfid);
            db.sp_reject_manpower_request(remarks, mrfid);
            Manpower.AddAuditTrail(user, "Manpower is rejected", mrfid);
            await Task.Run(new Action(() =>
            {
                new EmailSender().EmailNotificationRejectCancelled(mrfid, string.Format("{0} Has been rejected", mrfid), string.Format("{0} Has been rejected", mrfid), remarks, Recruitment.Class.Users.EmailAddress(user_involved.coordinator_id), Url.Action("ManpowerRequestDetail", "manpower", new { mrfid = mrfid }));
            }));

            foreach (var i in db.sp_admin_list())
            {
                db.sp_add_notification(user, i.UserId, mrfid + " Has been rejected by " + Users.Fullname(User.Identity.GetUserId()), mrfid);
            }
            return(RedirectToAction("dashboard", "recruitmentprocess", new { mrfid = mrfid, reject = "rejected" }));
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> GetAsync([FromQuery][Required] string region,
                                                   [FromQuery] Manpower manpower, [FromQuery] Address address)
        {
            NullCheck.ThrowIfNull <Manpower>(manpower);
            NullCheck.ThrowIfNull <Address>(address);

            try
            {
                _configurationService.ThrowIfUnknownRegion(region);
                manpower.address = address;
                _resourceStockInputValidatorService.ValidateForStockQuery(manpower);
                return(Ok(await _resourceStockQueryService.QueryOffersAsync(manpower, region).ToListAsync()));
            }
            catch (ArgumentException e)
            {
                return(BadRequest(e.Message));
            }
            catch (UnknownAdressException e)
            {
                return(BadRequest(e.Message));
            }
        }
 public ActionResult CancelRequirement(int numbercancelrequirement, string mrfid)
 {
     db.sp_cancelled_requirement(mrfid, (int)numbercancelrequirement);
     Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Update Number of Cancelled", mrfid);
     return(RedirectToAction("dashboard", "recruitmentprocess", new { mrfid = mrfid }));
 }
        public async Task <ActionResult> ApproveManpower(string mrfid, string Remarks, string oic_recruiter_id = "", string recruiter_id = "", string recruitment_supervisor_id = "")
        {
            var    detail          = db.sp_manpower_detail(mrfid).FirstOrDefault();
            var    userid          = User.Identity.GetUserId();
            var    role            = Users.Role(userid);
            var    user_involved   = db.sp_get_mrf_user_involved(mrfid).FirstOrDefault();
            var    adminlist       = db.sp_admin_list().ToList();
            string approvedmessage = "";
            List <ManpowerViewModel.ManpowerNotification> Notification = new List <ManpowerViewModel.ManpowerNotification>();

            //approved accountmanager
            if (detail.am_approved == false && role == "Account Manager")
            {
                approvedmessage = mrfid + " Has been approved and assigned to " + Users.Fullname(recruitment_supervisor_id);
                db.sp_approved_manpower_accountmanager(mrfid, recruitment_supervisor_id);
                db.ExecuteCommand("update tbl_manpower_request set remarks={0} where mrfid={1}", Remarks, mrfid);
                foreach (var m in new string[] { user_involved.coordinator_id, recruitment_supervisor_id })
                {
                    Notification.Add(new ManpowerViewModel.ManpowerNotification()
                    {
                        from = userid, to = m, notification_message = approvedmessage, mrfid = mrfid
                    });
                }

                //send email to supervisor
                await Task.Run(new Action(() =>
                {
                    EmailSender email = new EmailSender();
                    email.EmailNotification(generateurl(Users.EmailAddress(recruitment_supervisor_id), mrfid), mrfid, recruitment_supervisor_id);
                }));
            }
            //approved supervisor
            else if (detail.am_approved == true && detail.recruitment_supervisor_approved == false && User.IsInRole("Recruitment Supervisor"))
            {
                approvedmessage = mrfid + " Has been assigned to " + Users.Fullname(recruiter_id) + " for Recruiter allocation";
                db.sp_approved_manpower_recruitment_supervisor(mrfid, recruiter_id);
                foreach (var m in new string[] { user_involved.coordinator_id, user_involved.am_1_id, user_involved.am_2_id, recruiter_id })
                {
                    Notification.Add(new ManpowerViewModel.ManpowerNotification()
                    {
                        from = userid, to = m, notification_message = approvedmessage, mrfid = mrfid
                    });
                }
                //email send to oic
                await Task.Run(new Action(() =>
                {
                    EmailSender email = new EmailSender();
                    email.EmailNotification(generateurl(Users.EmailAddress(recruiter_id), mrfid), mrfid, recruiter_id);
                }));
            }

            //notification loop all added in list of notification
            foreach (var m in Notification)
            {
                db.sp_add_notification(m.from, m.to, m.notification_message, m.mrfid);
            }
            //notify admin
            foreach (var i in adminlist)
            {
                db.sp_add_notification(userid, i.UserId, approvedmessage, mrfid);
            }

            Manpower.AddAuditTrail(User.Identity.GetUserId(), Users.Fullname(User.Identity.GetUserId()) + " Approved the Manpower Request", mrfid);

            await Task.Run(new Action(() =>
            {
                new EmailSender().EmailNotificationRejectCancelled(mrfid, string.Format("{0} Has been approved.", mrfid), string.Format("{0} Has been approved.", mrfid), "", Recruitment.Class.Users.EmailAddress(user_involved.coordinator_id), Url.Action("ManpowerRequestDetail", "manpower", new { mrfid = mrfid }));
            }));

            return(RedirectToAction("dashboard", "RecruitmentProcess", new { mrfid = mrfid, approved = approvedmessage }));
        }
        public ErrorHandlers ImportCompany(DataTable dt)
        {
            ErrorHandlers           ErrorHandler = null;
            List <CompanyViewModel> list         = new List <CompanyViewModel>();
            string Message   = "Imported file is empty";
            string ClassName = "alert alert-danger";
            bool   error     = true;
            int    row       = 1;

            foreach (DataRow dr in dt.Rows)
            {
                CompanyViewModel model = new CompanyViewModel()
                {
                    company_name  = Tools.ToTitleCase(dr[0].ToString()),
                    branch        = Tools.ToTitleCase(dr[1].ToString()),
                    brand         = Tools.ToTitleCase(dr[2].ToString()),
                    officeaddress = Tools.ToTitleCase(dr[3].ToString()),
                    industry      = dr[4].ToString()
                };

                if (model.company_name == "")
                {
                    Message   = "Client Name* field is required at row " + row;
                    ClassName = "alert alert-danger";
                    error     = true;
                    break;
                }
                if (model.branch == "")
                {
                    Message   = "Branch* field is required at row " + row;
                    ClassName = "alert alert-danger";
                    error     = true;
                    break;
                }

                if (model.officeaddress == "")
                {
                    Message   = "Office Address* field is required at row " + row;
                    ClassName = "alert alert-danger";
                    error     = true;
                    break;
                }
                if (model.industry == "")
                {
                    Message   = "Industry* field is required at row " + row;
                    ClassName = "alert alert-danger";
                    error     = true;
                    break;
                }
                var IndustryName = Manpower.GetIndustryID(model.industry);
                if (IndustryName == "")
                {
                    Message   = "Invalid entry on the Industry field at row " + row;
                    ClassName = "alert alert-danger";
                    error     = true;
                    break;
                }
                else
                {
                    model.industry = IndustryName;
                }
                row++;
                list.Add(model);
            }
            if (error == false && list.Count() > 0)
            {
                foreach (var i in list)
                {
                    db.sp_add_companies(i.company_name, i.branch, i.branch, i.officeaddress, i.industry);
                }
                Message   = "Successfully Import Client Information";
                ClassName = "alert alert-success";
            }
            ErrorHandler = new ErrorHandlers()
            {
                Message = Message, _Class = ClassName
            };
            //Manpower.GetIndustryID()
            return(ErrorHandler);
        }
        public void ValidateForStockQuery(Manpower manpower)
        {
            NullCheck.ThrowIfNull <Manpower>(manpower);

            validateAddress(manpower.address);
        }
Ejemplo n.º 18
0
        public async IAsyncEnumerable <OfferResource <Personal> > QueryOffersAsync(Manpower manpower, string region)
        {
            NullCheck.ThrowIfNull <Manpower>(manpower);

            var maxDistance     = manpower.kilometer;
            var manpowerAddress = manpower.address;
            var location        = new AddressEntity().build(manpowerAddress);

            _addressMaker.SetCoordinates(location);

            var query = from o in _context.offer as IQueryable <OfferEntity>
                        join personal in _context.personal on o.id equals personal.offer_id
                        join ap in _context.address on o.address_id equals ap.Id
                        where !personal.is_deleted && o.region == region
                        select new { o, personal, ap };

            if (!string.IsNullOrEmpty(manpower.institution))
            {
                query = query.Where(collection => manpower.institution == collection.personal.institution);;
            }

            if (manpower.qualification.Any())
            {
                query = query.Where(collection => manpower.qualification.Contains(collection.personal.qualification));
            }
            if (manpower.area.Any())
            {
                query = query.Where(collection => manpower.area.Contains(collection.personal.area));
            }

            if (!string.IsNullOrEmpty(manpower.researchgroup))
            {
                query = query.Where(collection => manpower.researchgroup == collection.personal.researchgroup);;
            }
            if (manpower.experience_rt_pcr)
            {
                query = query.Where(collection => collection.personal.experience_rt_pcr);;
            }

            List <OfferResource <Personal> > resources = new List <OfferResource <Personal> >();
            var results = await query.ToListAsync();

            foreach (var data in results)
            {
                var resource = new Personal().build(data.personal);

                var yLatitude  = data.ap.Latitude;
                var yLongitude = data.ap.Longitude;
                var distance   = DistanceCalculator.computeDistance(location.Latitude, location.Longitude, yLatitude, yLongitude);
                if (distance > maxDistance && maxDistance != 0)
                {
                    continue;
                }
                resource.kilometer = (int)Math.Round(distance);

                var provider        = new Provider().Build(data.o);
                var providerAddress = new Address().Build(data.ap);

                provider.address = providerAddress;

                var offer = new OfferResource <Personal>()
                {
                    resource = resource
                };

                // ---- HOTFIX
                // Vorerst sollen keine persönliche Daten veröffentlicht werden.
                provider.ispublic = false;
                // ---- END HOTFIX

                if (provider.ispublic)
                {
                    offer.provider = provider;
                }

                yield return(offer);
            }
        }