public async Task <JsonResult> ImportForRequirementApplicant()
        {
            await Task.Run(new Action(() =>
            {
                ApplicantImport.ImportForRequirementApplicant(Path(), User.Identity.GetUserId());
            }));

            return(Json("Successfully Import For Requirement Applicant", JsonRequestBehavior.AllowGet));
        }
        public ActionResult ImportApplicant(HttpPostedFileBase file)
        {
            file.SaveAs(Server.MapPath("~/excel/" + file.FileName));
            var list = ApplicantImport.ImportApplicantList(Server.MapPath("~/excel/" + file.FileName));

            if ((from m in list
                 where m.educationattainment.ToUpper() != ("COLLEGE GRADUATE") &&
                 m.educationattainment.ToUpper() != ("ELEMENTARY GRADUATE") &&
                 m.educationattainment.ToUpper() != ("GRADUATE OF CERTIFICATE COURSE") &&
                 m.educationattainment.ToUpper() != ("GRADUATE OF VOCATIONAL COURSE") &&
                 m.educationattainment.ToUpper() != ("HIGH SCHOOL GRADUATE") &&

                 m.educationattainment.ToUpper() != ("POST GRADUATE") && m.educationattainment.ToUpper() != ("COLLEGE LEVEL")
                 select m).Count() > 0)
            {
                ViewBag.error = ("Invalid Education Attainment found in the file!");
                return(View());
            }
            else if ((from m in list
                      where m.age == 0 &&
                      m.age < 18
                      select m).Count() > 0)
            {
                ViewBag.error = ("Invalid Date of Birth found in the file!");
                return(View());
            }
            else if (
                (from m in list
                 where m.howdidyouknowtopserve.ToUpper() != ("BROCHURES") &&
                 m.howdidyouknowtopserve.ToUpper() != ("NEWS PAPER") &&
                 m.howdidyouknowtopserve.ToUpper() != ("ONLINE ADVERTISEMENT") &&
                 m.howdidyouknowtopserve.ToUpper() != ("SOCIAL MEDIA") &&
                 m.howdidyouknowtopserve.ToUpper() != ("WALK-IN")
                 select m).Count() > 0
                )
            {
                ViewBag.error = ("Invalid How did you know Topserve in the file!");
                return(View());
            }
            else if (
                (from m in list
                 where m.gender.ToUpper() != ("M") &&
                 m.gender.ToUpper() != ("F")
                 select m).Count() > 0
                )
            {
                ViewBag.error = ("Invalid entry on Gender, It should be either M or F");
                return(View());
            }
            else if (
                (from m in list
                 where m.contactnumber.Length != 10
                 select m).Count() > 0
                )
            {
                ViewBag.error = ("Invalid entry on Contact Number, It should be in this format 9123456789");
                return(View());
            }
            foreach (var i in list)
            {
                db.sp_import_applicant_list(i.surname, i.firstname, i.middleinitial, i.address, i.requiredposition, i.location, i.birthday, i.age, i.gender, i.religion, i.sssnumber, i.philhealth, i.pagibignumber, i.tinnumber, i.contactnumber, i.emailaddress, i.educationattainment, i.schoolname, i.course, i.certification, i.skills, i.jobfair, i.howdidyouknowtopserve, i.referrals, i.relativesworkingintopserve, i.relativeworkingindirectcompetitionoftopserve, i.invited, Tools.ToDateTime(i.dateinvited), i.oncall, i.reliever);
            }
            foreach (var i in db.sp_admin_list().ToList())
            {
                db.sp_add_notification(User.Identity.GetUserId(), i.UserId, "Successfully uploaded applicant list", "");
            }
            System.IO.File.Delete(Server.MapPath("~/excel/" + file.FileName));
            return(View(list));
        }
 public JsonResult ImportPassOnApplicant(string Mrfid)
 {
     ApplicantImport.ImportPassOnApplicant(Path(), Mrfid, User.Identity.GetUserId());
     return(Json("Successfully Import For Requirement Applicant", JsonRequestBehavior.AllowGet));
 }
        public JsonResult ImportConfirmInvitedApplicant()
        {
            ApplicantImport.ImportConfirmedInvitedApplicant(Path(), User.Identity.GetUserId());

            return(Json("Successfully Import Confirmed Applicant", JsonRequestBehavior.AllowGet));
        }