Esempio n. 1
0
        public int ResumeImport(string path, ResumeUpload resumeUpload)
        {
            ResumeProcessor resumeProcessor = new ResumeProcessor();
            var             model           = resumeProcessor.ProcessModel(path);
            TblApplicants   tblApplicants   = new TblApplicants();

            tblApplicants.Name         = model.Name;
            tblApplicants.EmailAddress = model.EmailAddress;
            // tblApplicants.
            if (resumeUpload.SourceId == 1)
            {
                tblApplicants.Source = "Direct";
            }
            else if (resumeUpload.SourceId == 2)
            {
                tblApplicants.Source = "Vendor";
            }
            else if (resumeUpload.SourceId == 3)
            {
                tblApplicants.Source = "Portal";
            }
            else if (resumeUpload.SourceId == 4)
            {
                tblApplicants.Source = "Internal";
            }
            tblApplicants.VendorId     = resumeUpload.VendorId;
            tblApplicants.PortalId     = resumeUpload.PortalId;
            tblApplicants.EmailAddress = resumeUpload.EmployeeEmailId;
            return(ApplicantDAL.CreateApplicants(tblApplicants));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            ResumeUpload resumeUpload = db.ResumeUploads.Find(id);

            db.ResumeUploads.Remove(resumeUpload);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "ResumeID,ResumeName,isCurrent,UploadDate")] ResumeUpload resumeUpload)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resumeUpload).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(resumeUpload));
 }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "ResumeID,ResumeName,isCurrent,UploadDate")] ResumeUpload resumeUpload)
        {
            if (ModelState.IsValid)
            {
                db.ResumeUploads.Add(resumeUpload);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(resumeUpload));
        }
Esempio n. 5
0
    protected void ChangeResume_Click(object sender, EventArgs e)
    {
        try
        {
            if (ResumeUpload.HasFile)
            {

                string fileExtension = Path.GetExtension(ResumeUpload.PostedFile.FileName);

                if (fileExtension == ".pdf" || fileExtension == ".docx")
                {
                    Directory.CreateDirectory(Server.MapPath("~/Files/" + CurrentUserID + "/Resume/"));

                    DirectoryInfo directory = new DirectoryInfo(Server.MapPath("~/Files/" + CurrentUserID + "/Resume/"));
                    foreach (FileInfo file in directory.GetFiles())
                    {
                        file.Delete();
                    }
                    foreach (DirectoryInfo di in directory.GetDirectories())
                    {
                        di.Delete(true);
                    }

                    ResumeUpload.SaveAs(Server.MapPath("~/Files/" + CurrentUserID + "/" + "Resume/" + ResumeUpload.FileName));
                    PRMS Controller = new PRMS();
                    if (Controller.UpdateResume(CurrentUserID, ResumeUpload.FileName))
                    {
                        ResumeMsg.Text = "Your resume has been updated.";
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Resume has been updated')", true);
                    }
                    else
                    {
                        ResumeMsg.Text = "Your resume could not be udpated.";
                    }
                    ResumeMsg.Text = "Your resume has been updated.";
                }
                else
                {
                    ResumeMsg.Text = "Only .pdf and .docx resume files are accepted.";
                }
            }
            else
            {
                ResumeMsg.Text = "Please select a file to upload.";
            }
        }
        catch (Exception)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(‘Error occurred with updating the resume. Please contact customer support for assistance if this issue persists.’)", true);
        }

    }
Esempio n. 6
0
        // GET: ResumeUploads/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ResumeUpload resumeUpload = db.ResumeUploads.Find(id);

            if (resumeUpload == null)
            {
                return(HttpNotFound());
            }
            return(View(resumeUpload));
        }
Esempio n. 7
0
    protected void ResumeButton_Click(object sender, EventArgs e)
    {
        if (ResumeUpload.PostedFile.ContentLength > 0 && ResumeUpload.PostedFile.ContentLength <= 5000000)
        {
            if (ResumeUpload.PostedFile.ContentType == "application/pdf")
            {
                string extension;
                extension = ".pdf";
                string fileName = Request.Cookies["email"].Value.Replace('.', '_') + "_Resume";
                string file     = Server.MapPath("~/Uploads/simpleuser/" + fileName);
                if (File.Exists(file + ".pdf"))
                {
                    File.Delete(file + ".pdf");
                }

                fileName += extension;
                file     += extension;
                ResumeUpload.SaveAs(file);

                ResumeLabel.Text     = ResumeUpload.PostedFile.FileName + " uploaded";
                ResumeLabel.CssClass = "valid-input";

                ViewState["resume"] = fileName;
            }
            else
            {
                ResumeLabel.Text     = "Uploaded file should be of type pdf";
                ResumeLabel.CssClass = "invalid-input";
            }
        }
        else
        {
            ResumeLabel.Text     = "Uploaded file should have maximum size of 5MB";
            ResumeLabel.CssClass = "invalid-input";
        }
    }
Esempio n. 8
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        try
        {
            List <int> list;
            bool       dropdownsChecked = true;
            list = (List <int>)Session["professions"];
            if (list == null)
            {
                dropdownsChecked = false;
            }
            list = (List <int>)Session["skills"];
            if (list == null)
            {
                dropdownsChecked = false;
            }
            list = (List <int>)Session["regions"];
            if (list == null)
            {
                dropdownsChecked = false;
            }

            if (dropdownsChecked)
            {
                bool success      = false;
                User newCandidate = new User();
                newCandidate.UserEmail    = EmailTextBox.Text;
                newCandidate.FirstName    = FirstName.Text;
                newCandidate.LastName     = LastName.Text;
                newCandidate.Phone        = Phone.Text;
                newCandidate.Resume       = (ResumeUpload.PostedFile.FileName == "") ? null : ResumeUpload.PostedFile.FileName;
                newCandidate.CoverLetter  = (CoverLetterUpload.PostedFile.FileName == "") ? null : CoverLetterUpload.PostedFile.FileName;
                newCandidate.UserPassword = Password.Text;

                PRMS controller = new PRMS();



                #region add user
                success = controller.AddAccount(newCandidate);

                if (success)
                {
                    int userID;
                    userID = controller.GetUserIDByEmail(EmailTextBox.Text);

                    if (ResumeUpload.HasFile)
                    {
                        string fileExtension = Path.GetExtension(ResumeUpload.PostedFile.FileName);

                        if (fileExtension == ".pdf" || fileExtension == ".docx")
                        {
                            Directory.CreateDirectory(Server.MapPath("~/Files/" + userID + "/Resume/"));

                            DirectoryInfo directory = new DirectoryInfo(Server.MapPath("~/Files/" + userID + "/Resume/"));
                            foreach (FileInfo file in directory.GetFiles())
                            {
                                file.Delete();
                            }
                            foreach (DirectoryInfo di in directory.GetDirectories())
                            {
                                di.Delete(true);
                            }

                            ResumeUpload.SaveAs(Server.MapPath("~/Files/" + userID + "/" + "Resume/" + ResumeUpload.FileName));
                        }
                        else
                        {
                            Msg.Text = "Only .pdf and .docx resume files are accepted.";
                        }
                    }
                    if (CoverLetterUpload.HasFile)
                    {
                        string fileExtension = Path.GetExtension(CoverLetterUpload.PostedFile.FileName);

                        if (fileExtension == ".pdf" || fileExtension == ".docx")
                        {
                            Directory.CreateDirectory(Server.MapPath("~/Files/" + userID + "/CoverLetter/"));

                            DirectoryInfo directory = new DirectoryInfo(Server.MapPath("~/Files/" + userID + "/CoverLetter/"));
                            foreach (FileInfo file in directory.GetFiles())
                            {
                                file.Delete();
                            }
                            foreach (DirectoryInfo di in directory.GetDirectories())
                            {
                                di.Delete(true);
                            }

                            CoverLetterUpload.SaveAs(Server.MapPath("~/Files/" + userID + "/" + "CoverLetter/" + CoverLetterUpload.FileName));
                        }
                        else
                        {
                            Msg.Text = "Only .pdf and .docx cover letter files are accepted.";
                        }
                    }
                    #region add professions
                    int newUserID;
                    newUserID = controller.GetUserIDByEmail(EmailTextBox.Text);

                    List <int> professions = (List <int>)Session["professions"];
                    foreach (int profession in professions)
                    {
                        controller.AddUserProfessions(newUserID, profession);
                    }

                    #endregion

                    #region add skills
                    List <int> skills = (List <int>)Session["skills"];
                    foreach (int skill in skills)
                    {
                        controller.AddUserSkills(newUserID, skill);
                    }

                    #endregion
                    #region add regions
                    List <int> regions = (List <int>)Session["regions"];
                    foreach (int region in regions)
                    {
                        controller.AddUserRegions(newUserID, region);
                    }
                    #endregion
                    #region send email
                    using (SmtpClient smtpClient = new SmtpClient())
                    {
                        string email     = EmailTextBox.Text;
                        string firstName = FirstName.Text;

                        MailAddress from    = new MailAddress("*****@*****.**");
                        MailAddress to      = new MailAddress(email);
                        MailMessage message = new MailMessage(from, to);

                        message.Subject = "Placemejob Account Registration";

                        string note = "Dear " + firstName + ",<br /><br />";
                        note += "Thank you for your application on Placemejob. We shall check your profile with relevant openings and get back to you.";

                        message.Body         = note;
                        message.BodyEncoding = System.Text.Encoding.UTF8;
                        message.IsBodyHtml   = true;

                        SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
                        client.UseDefaultCredentials = false;
                        client.EnableSsl             = true;
                        client.Credentials           = new NetworkCredential("*****@*****.**", "mejob986");

                        try
                        {
                            client.Send(message);
                        }
                        catch
                        {
                            Results.Text = "Error occurred with sending email.";
                        }
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('You have successfully registered an account.');window.location ='RegisterAccount.aspx';", true);
                    #endregion
                }
                else //if(success)
                {
                    Results.Text = "An error has occurred with your account registration. Please try again. If this issue persists, please contact customer support for assistance.";
                }
                #endregion
            }
            else //if(dropdownsChecked)
            {
                Results.Text = "You must select at least one profession, skill, and region preference.";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(‘Must have at least one profession, skill, and region added.’)", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(''Error occurred with registering account. Please contact customer support for assistance if this issue persists.'')", true);
            Results.Text = ex.ToString();
        }
    }
Esempio n. 9
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        try
        {
            List <int> list;
            bool       dropdownsChecked = true;
            list = (List <int>)Session["professions"];
            if (list == null)
            {
                dropdownsChecked = false;
            }
            list = (List <int>)Session["skills"];
            if (list == null)
            {
                dropdownsChecked = false;
            }
            list = (List <int>)Session["regions"];
            if (list == null)
            {
                dropdownsChecked = false;
            }

            if (dropdownsChecked)
            {
                bool success      = false;
                User newCandidate = new User();
                newCandidate.UserEmail   = EmailTextBox.Text;
                newCandidate.FirstName   = FirstName.Text;
                newCandidate.LastName    = LastName.Text;
                newCandidate.Phone       = Phone.Text;
                newCandidate.Resume      = (ResumeUpload.PostedFile.FileName == "") ? null : ResumeUpload.PostedFile.FileName;
                newCandidate.CoverLetter = (CoverLetterUpload.PostedFile.FileName == "") ? null : CoverLetterUpload.PostedFile.FileName;

                PRMS controller = new PRMS();


                #region add user
                success = controller.AddCandidate(newCandidate);

                if (success)
                {
                    try
                    {
                        int userID;
                        userID = controller.GetUserIDByEmail(EmailTextBox.Text);

                        if (ResumeUpload.HasFile)
                        {
                            string fileExtension = Path.GetExtension(ResumeUpload.PostedFile.FileName);

                            if (fileExtension == ".pdf" || fileExtension == ".docx")
                            {
                                Directory.CreateDirectory(Server.MapPath("~/Files/" + userID + "/Resume/"));

                                DirectoryInfo directory = new DirectoryInfo(Server.MapPath("~/Files/" + userID + "/Resume/"));
                                foreach (FileInfo file in directory.GetFiles())
                                {
                                    file.Delete();
                                }
                                foreach (DirectoryInfo di in directory.GetDirectories())
                                {
                                    di.Delete(true);
                                }

                                ResumeUpload.SaveAs(Server.MapPath("~/Files/" + userID + "/" + "Resume/" + ResumeUpload.FileName));
                            }
                            else
                            {
                                Msg.Text = "Only .pdf and .docx resume files are accepted.";
                            }
                        }
                        if (CoverLetterUpload.HasFile)
                        {
                            string fileExtension = Path.GetExtension(CoverLetterUpload.PostedFile.FileName);

                            if (fileExtension == ".pdf" || fileExtension == ".docx")
                            {
                                Directory.CreateDirectory(Server.MapPath("~/Files/" + userID + "/CoverLetter/"));

                                DirectoryInfo directory = new DirectoryInfo(Server.MapPath("~/Files/" + userID + "/CoverLetter/"));
                                foreach (FileInfo file in directory.GetFiles())
                                {
                                    file.Delete();
                                }
                                foreach (DirectoryInfo di in directory.GetDirectories())
                                {
                                    di.Delete(true);
                                }

                                CoverLetterUpload.SaveAs(Server.MapPath("~/Files/" + userID + "/" + "CoverLetter/" + CoverLetterUpload.FileName));
                            }
                            else
                            {
                                Msg.Text = "Only .pdf and .docx cover letter files are accepted.";
                            }
                        }
                        //Set color to green
                        //Results.ForeColor = System.Drawing.Color.Green;
                        //Results.Text = "Candidate was added";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Candidate was added successfully.');window.location ='RegisterCandidate.aspx';", true);
                        #region add professions
                        int newUserID;
                        newUserID = controller.GetUserIDByEmail(EmailTextBox.Text);

                        List <int> professions = (List <int>)Session["professions"];
                        foreach (int profession in professions)
                        {
                            controller.AddUserProfessions(newUserID, profession);
                        }

                        #endregion

                        #region add skills
                        List <int> skills = (List <int>)Session["skills"];
                        foreach (int skill in skills)
                        {
                            controller.AddUserSkills(newUserID, skill);
                        }

                        #endregion
                        #region add regions
                        List <int> regions = (List <int>)Session["regions"];
                        foreach (int region in regions)
                        {
                            controller.AddUserRegions(newUserID, region);
                        }
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Candidate was not registered.')", true);
                        Results.Text = ex.ToString();
                    }
                }
                else //if(success)
                {
                    Results.Text = "Candidate was not added";
                }
                #endregion
            }
            else //if(dropdownsChecked)
            {
                Results.Text = "Candidate must have at least one profession, skill, and region added.";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(‘Error occurred with registering the candidate. Please contact customer support for assistance if this issue persists.’)", true);
            }
        }
        catch (Exception)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(‘Must have at least one profession, skill, and region added.’)", true);
            Results.Text = "Candidate must have at least one profession, skill, and region added.";
            throw;
        }
    }