Exemplo n.º 1
0
        public ActionResult AddCandidate(Candidate Model)
        {
            try
            {
                Model.RecId          = LoginHelper.GetCurrentLoginUser().Id;
                Model.ResumeSourceId = 1;

                ATSEntities db = new ATSEntities();

                if (Model.CanId > 0)
                {
                    //edit case
                    //db code for saving date
                    Model.UpdateDate = DateTime.Now;
                    db.Candidates.Attach(Model);
                    db.Entry(Model).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    //insert case
                    //db code for saving date
                    Model.CreateDate = DateTime.Now;
                    db.Candidates.Add(Model);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                string st = ex.Message;
            }
            return(RedirectToAction("Sourcing", "Recruiter"));
        }
Exemplo n.º 2
0
        public ActionResult AssignToJob(int CandidateId, int JobId)
        {
            ATSEntities db = new ATSEntities();

            using (db)
            {
                var jobObj       = db.Jobs.FirstOrDefault(x => x.JobId == JobId);
                var CandidateObj = db.Candidates.FirstOrDefault(x => x.CanId == CandidateId);
                CandidateObj.IsActive = false;
                db.Candidates.Attach(CandidateObj);
                db.Entry(CandidateObj).State = EntityState.Modified;
                db.SaveChanges();

                if (jobObj != null && CandidateObj != null)
                {
                    Applicant ApplicantObj = new Applicant();
                    ApplicantObj.ApplicantFullName = CandidateObj.FirstName + " " + CandidateObj.LastName;
                    ApplicantObj.CanId             = CandidateObj.CanId;
                    ApplicantObj.CreateDate        = DateTime.Now;
                    ApplicantObj.IsShortlisted     = true;
                    ApplicantObj.JobId             = jobObj.JobId;
                    db.Applicants.Add(ApplicantObj);
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("Sourcing", "Recruiter"));
        }
Exemplo n.º 3
0
 public ActionResult AddJobs(Job Model)
 {
     try
     {
         Model.QuestionairId = 1;
         ATSEntities db = new ATSEntities();
         using (db)
         {
             if (Model.JobId > 0)
             {
                 //edit case
                 //db code for saving date
                 Model.UpdateDate = DateTime.Now;
                 db.Jobs.Attach(Model);
                 db.Entry(Model).State = EntityState.Modified;
                 db.SaveChanges();
             }
             else
             {
                 //insert case
                 //db code for saving date
                 Model.CreateDate = DateTime.Now;
                 db.Jobs.Add(Model);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception ex)
     {
         string st = ex.Message;
     }
     return(RedirectToAction("Jobs", "Recruiter"));
 }
Exemplo n.º 4
0
        public ActionResult JobApplicationPage(JobApplicationPageViewModel Model)
        {
            int Marks = 0;

            try
            {
                ATSEntities db = new ATSEntities();
                using (db)
                {
                    foreach (var item in Model.AnswerList)
                    {
                        var obj = db.Answers.FirstOrDefault(x => x.AnswerId == item.AnswerId);
                        if (obj.IsRight)
                        {
                            Marks += 1;
                        }
                    }

                    Model.CandidateObj.MarksObtained = Marks;
                    int totalanswer = Model.AnswerList.Count;
                    totalanswer = totalanswer / 2;
                    if (Marks >= totalanswer)
                    {
                        Model.CandidateObj.IsQualified = true;
                    }
                    else
                    {
                        Model.CandidateObj.IsQualified = false;
                    }

                    Model.CandidateObj.ResumeSourceId = 1;
                    Model.CandidateObj.RecId          = Model.RecruiterObj.RecId;

                    if (Model.CandidateObj.CanId > 0)
                    {
                        //edit case
                        //db code for saving date
                        Model.CandidateObj.UpdateDate = DateTime.Now;
                        db.Candidates.Attach(Model.CandidateObj);
                        db.Entry(Model.CandidateObj).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    else
                    {
                        //insert case
                        //db code for saving date
                        Model.CandidateObj.IsActive   = true;
                        Model.CandidateObj.CreateDate = DateTime.Now;
                        db.Candidates.Add(Model.CandidateObj);
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                string st = ex.Message;
            }
            return(RedirectToAction("JobApplicationPage", "Home", new { Recruiter = Model.RecruiterObj.RecId, Job = Model.JobObj.JobId }));
        }
Exemplo n.º 5
0
        public ActionResult AddAnswer(Answer Model)
        {
            ATSEntities db = new ATSEntities();

            using (db)
            {
                if (Model.AnswerId > 0)
                {
                    //Edit
                    db.Answers.Attach(Model);
                    db.Entry(Model).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    db.Answers.Add(Model);
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("Answers", "Recruiter", new { QuestionId = Model.QuestionId }));
        }
Exemplo n.º 6
0
        public ActionResult AddQuestions(Question Model)
        {
            //Model.QuestionairId = 1;
            ATSEntities db = new ATSEntities();

            using (db)
            {
                if (Model.QuestionId > 0)
                {
                    db.Questions.Attach(Model);
                    db.Entry(Model).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    db.Questions.Add(Model);
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("Questions", "Recruiter", new { QuestionairId = Model.QuestionairId }));
        }
Exemplo n.º 7
0
        public ActionResult Questioner(Questionair Model)
        {
            Model.RecId = LoginHelper.GetCurrentLoginUser().Id;
            ATSEntities db = new ATSEntities();

            using (db)
            {
                if (Model.QuestionairId > 0)
                {
                    db.Questionairs.Attach(Model);
                    db.Entry(Model).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    db.Questionairs.Add(Model);
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("Questioner", "Recruiter"));
        }
Exemplo n.º 8
0
        public ActionResult RecruiterSetting(Recruiter Model, FormCollection fm, HttpPostedFileBase LogoFile)
        {
            ATSEntities db = new ATSEntities();

            using (db)
            {
                if (Model.RecId > 0)
                {
                    var       currentUser = LoginHelper.GetCurrentLoginUser();
                    Recruiter recruiter   = db.Recruiters.FirstOrDefault(x => x.RecId == currentUser.Id);

                    try
                    {
                        //Check if File is available.
                        if (LogoFile != null && LogoFile.ContentLength > 0)
                        {
                            //Save the File.
                            string DirectoryPath = Server.MapPath("~/Content/Images/RecLogo/" + Model.RecId + "/");
                            string filePath      = DirectoryPath + LogoFile.FileName;
                            Model.Logo = LogoFile.FileName;
                            if (!System.IO.Directory.Exists(DirectoryPath))
                            {
                                System.IO.Directory.CreateDirectory(DirectoryPath);
                            }
                            if (System.IO.Directory.Exists(DirectoryPath))
                            {
                                LogoFile.SaveAs(filePath);
                            }
                        }
                    }
                    catch (Exception ex) { }


                    recruiter.Username       = Model.Username;
                    recruiter.Password       = Model.Password;
                    recruiter.CompanyName    = Model.CompanyName;
                    recruiter.CompanyAddress = Model.CompanyAddress;
                    recruiter.City           = Model.City;
                    recruiter.State          = Model.State;
                    recruiter.Logo           = Model.Logo;
                    //recruiter.ExternalLogo = Model.ExternalLogo;

                    db.Recruiters.Attach(recruiter);
                    db.Entry(recruiter).State = EntityState.Modified;
                    db.SaveChanges();
                }

                return(RedirectToAction("RecruiterSetting", "Recruiter"));
            }
        }
Exemplo n.º 9
0
        public ActionResult IsRightAnswers(int QuestionId, int AnswerId, bool Value)
        {
            ATSEntities db = new ATSEntities();

            using (db)
            {
                var Answer = db.Answers.FirstOrDefault(x => x.AnswerId == AnswerId);

                Answer.IsRight = Value;
                db.Answers.Attach(Answer);
                db.Entry(Answer).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("Answers", "Recruiter", new { QuestionId = QuestionId }));
        }
Exemplo n.º 10
0
        public ActionResult PostJob(int id = 0)
        {
            if (id > 0)
            {
                Job         model = new Job();
                ATSEntities db    = new ATSEntities();
                using (db)
                {
                    model            = db.Jobs.FirstOrDefault(x => x.JobId == id);
                    model.IsPosted   = true;
                    model.UpdateDate = DateTime.Now;
                    db.Jobs.Attach(model);
                    db.Entry(model).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }

            return(RedirectToAction("Jobs", "Recruiter"));
        }
Exemplo n.º 11
0
 public ActionResult SignUp(FormCollection fm, Recruiter Newrecruiter)
 {
     try
     {
         ATSEntities db = new ATSEntities();
         using (db)
         {
             Newrecruiter.AdminId = 1;
             db.Recruiters.Add(Newrecruiter);
             db.SaveChanges();
         }
         ModelState.Clear();
         //return Content("Signup Confimed");
     }
     catch (Exception ex)
     {
         string st = ex.Message;
     }
     return(RedirectToAction("Login", "Recruiter"));
 }
Exemplo n.º 12
0
        public ActionResult Applicants(Applicant model, int jobid)
        {
            ATSEntities DB  = new ATSEntities();
            Job         job = new Job();

            job.JobId = 1;
            using (DB)
            {
                if (job.JobId == 1)
                {
                    DB.Applicants.Add(model);
                    DB.SaveChanges();
                }
                else
                {
                    string st = "Enter the Jobid";
                }
                return(View());
            }
        }
Exemplo n.º 13
0
        public ActionResult CareerPage(CareerPage Model, HttpPostedFileBase LogoFile)
        {
            try
            {
                if (LogoFile != null && LogoFile.ContentLength > 0)
                {
                    //Save the File.
                    string DirectoryPath = Server.MapPath("~/Content/Images/ExternalLogo/" + Model.RecId + "/");
                    string filePath      = DirectoryPath + LogoFile.FileName;
                    Model.ExternalLogo = LogoFile.FileName;
                    if (!System.IO.Directory.Exists(DirectoryPath))
                    {
                        System.IO.Directory.CreateDirectory(DirectoryPath);
                    }
                    if (System.IO.Directory.Exists(DirectoryPath))
                    {
                        LogoFile.SaveAs(filePath);
                    }
                }
            }
            catch (Exception ex) { }
            ATSEntities db = new ATSEntities();

            using (db)
            {
                if (Model.Id == 0)
                {
                    db.CareerPages.Add(Model);
                    db.SaveChanges();
                }
                else
                {
                    var DbCareerModel = db.CareerPages.FirstOrDefault(x => x.RecId == Model.RecId);
                    //Check if File is available.


                    if (!string.IsNullOrEmpty(Model.ExternalLogo) && DbCareerModel.ExternalLogo != Model.ExternalLogo)
                    {
                        DbCareerModel.ExternalLogo = Model.ExternalLogo;
                    }
                    if (!string.IsNullOrEmpty(Model.Intro) && DbCareerModel.Intro != Model.Intro)
                    {
                        DbCareerModel.Intro = Model.Intro;
                    }
                    if (!string.IsNullOrEmpty(Model.Description) && DbCareerModel.Description != Model.Description)
                    {
                        DbCareerModel.Description = Model.Description;
                    }

                    if (!string.IsNullOrEmpty(Model.Heading) && DbCareerModel.Heading != Model.Heading)
                    {
                        DbCareerModel.Heading = Model.Heading;
                    }
                    DbCareerModel.UpdateDate = DateTime.Now;

                    db.CareerPages.Attach(DbCareerModel);
                    db.Entry(DbCareerModel).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("CareerPage", "Recruiter"));
        }
Exemplo n.º 14
0
        public ActionResult SendEmail(DripEmail Model, int JobId)
        {
            ATSEntities db = new ATSEntities();

            try
            {
                if (Model.IsScheduled == true)
                {
                    var jobObj        = db.Jobs.FirstOrDefault(x => x.JobId == JobId);
                    var ApplicantList = db.Applicants.Where(x => x.JobId == JobId).ToList();
                    foreach (var item in ApplicantList)
                    {
                        Model.ApplicantId = item.ApplicantId;
                        Model.CandidateId = item.CanId;
                        Model.RecId       = LoginHelper.GetCurrentLoginUser().Id;

                        if (jobObj != null && ApplicantList.Count > 0)
                        {
                            //insert case
                            //db code for saving date
                            Model.CreatedDate = DateTime.Now;
                            db.DripEmails.Add(Model);
                            db.SaveChanges();
                        }
                    }
                }
                else
                {
                    //Save DripEmail
                    var jobObj        = db.Jobs.FirstOrDefault(x => x.JobId == JobId);
                    var ApplicantList = db.Applicants.Where(x => x.JobId == JobId).ToList();
                    foreach (var item in ApplicantList)
                    {
                        Model.ApplicantId = item.ApplicantId;
                        Model.CandidateId = item.CanId;
                        Model.RecId       = LoginHelper.GetCurrentLoginUser().Id;

                        if (jobObj != null && ApplicantList.Count > 0)
                        {
                            //insert case
                            //db code for saving date
                            Model.CreatedDate = DateTime.Now;
                            db.DripEmails.Add(Model);
                            db.SaveChanges();
                        }
                    }
                    //send email
                    Task task = new Task(() =>
                    {
                        while (true)
                        {
                            using (db)
                            {
                                var Records = db.DripEmails.Where(x => x.IsScheduled == true && x.ScheduledDateTime <= DateTime.Now && (x.IsSentSuccess == false || x.IsSentSuccess == null));
                                foreach (var item in Records)
                                {
                                    //Email Code here
                                    try
                                    {
                                        int canid             = (int)item.CandidateId;
                                        var candidate         = db.Candidates.FirstOrDefault(x => x.CanId == canid);
                                        MailMessage mail      = new MailMessage();
                                        SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                                        mail.From = new MailAddress("*****@*****.**");
                                        mail.To.Add(candidate.Email);
                                        mail.Subject = item.Subject;
                                        mail.Body    = item.EmailBodyText;

                                        SmtpServer.Port        = 587;
                                        SmtpServer.Credentials = new System.Net.NetworkCredential("recruiteragentproject", "newproject");
                                        SmtpServer.EnableSsl   = true;

                                        SmtpServer.Send(mail);

                                        item.IsSentSuccess = true;
                                        //Update Record Code
                                        db.DripEmails.Attach(Model);
                                        db.Entry(Model).State = EntityState.Modified;
                                        db.SaveChanges();
                                    }
                                    catch (Exception ex)
                                    {
                                        ////Update Record Code if error issent=false item update
                                        item.IsSentSuccess = false;
                                        db.DripEmails.Attach(item);
                                        db.Entry(item).State = EntityState.Modified;
                                        db.SaveChanges();
                                    }
                                }
                            }

                            Thread.Sleep(1000);
                        }
                    });
                    task.Start();
                }
            }
            catch (Exception ex)
            {
                string st = ex.Message;
            }
            return(RedirectToAction("Campaigns", "Recruiter"));
        }
Exemplo n.º 15
0
        protected void Application_Start()
        {
            //Code 3
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            Task task = new Task(() =>
            {
                while (true)
                {
                    ATSEntities db = new ATSEntities();
                    using (db)
                    {
                        var Records = db.DripEmails.Where(x => x.IsScheduled == true && x.ScheduledDateTime <= DateTime.Now && (x.IsSentSuccess == false || x.IsSentSuccess == null)).ToList();
                        foreach (var item in Records)
                        {
                            //Email Code here
                            try
                            {
                                int canId             = (int)item.CandidateId;
                                var candiate          = db.Candidates.FirstOrDefault(x => x.CanId == canId);
                                MailMessage mail      = new MailMessage();
                                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                                mail.From = new MailAddress("*****@*****.**");
                                mail.To.Add(candiate.Email);//candidate email
                                mail.Subject = item.Subject;
                                mail.Body    = item.EmailBodyText;

                                SmtpServer.Port        = 587;
                                SmtpServer.Credentials = new System.Net.NetworkCredential("recruiteragentproject", "newproject");
                                SmtpServer.EnableSsl   = true;

                                SmtpServer.Send(mail);

                                item.IsSentSuccess = true;
                                //Update Record Code
                                db.DripEmails.Attach(item);
                                db.Entry(item).State = EntityState.Modified;
                                db.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ////Update Record Code if error issent=false item update
                                //Update Record Code
                                item.IsSentSuccess = false;
                                db.DripEmails.Attach(item);
                                db.Entry(item).State = EntityState.Modified;
                                db.SaveChanges();
                            }
                        }
                    }

                    Thread.Sleep(1000);
                }
            });

            task.Start();
        }