protected void btnSearchPlanReplace_Click(object sender, EventArgs e)
        {
            Position position = currentPosition;

            File searchPlan = FileBLL.SavePDF(fileSearchPlanReplace, SearchPlanFileType);

            if (searchPlan != null)
            {
                //Delete the old file
                FileBLL.DeletePDF(position.SearchPlanFile);

                //Save the new reference
                using (var ts = new TransactionScope())
                {
                    position.SearchPlanFile = searchPlan;

                    PositionBLL.EnsurePersistent(position);

                    ts.CommitTransaction();
                }
            }
            else
            {
                lblInvalidSearchPlanFileType.Text = " *Job Description Must Be a PDF File";
            }
        }
Esempio n. 2
0
        private void UploadFiles()
        {
            FileType selectedFileType = FileTypeBLL.GetByID(int.Parse(dlistFileTypes.SelectedValue));

            //For all fileTypes except for Publications we should remove existing files
            if (selectedFileType.FileTypeName != STR_Publication && selectedFileType.FileTypeName != STR_LetterOfRec)
            {
                RemoveAllFilesOfType(selectedFileType.FileTypeName);
            }

            File file = FileBLL.SavePDF(fileUpload, selectedFileType);

            using (var ts = new TransactionScope())
            {
                if (file != null)
                {
                    Application application = selectedApplication;

                    application.Files.Add(file);

                    ApplicationBLL.EnsurePersistent(application);

                    lblStatus.Text = "File Uploaded Successfully";
                }
                else
                {
                    lblStatus.Text = "File Upload Did Not Succeed: Ensure That File Is A PDF File";
                }

                ts.CommitTransaction();
            }
        }
Esempio n. 3
0
        private void UploadPublications()
        {
            FileType    publicationsFileType = FileTypeBLL.GetByName(STR_Publication);
            Application application          = selectedApplication;

            File file = FileBLL.SavePDF(fileUpload, publicationsFileType);

            using (var ts = new TransactionScope())
            {
                if (file != null)
                {
                    application.Files.Add(file);

                    ApplicationBLL.EnsurePersistent(application);

                    lblStatus.Text = "File Uploaded Successfully";
                }
                else
                {
                    lblStatus.Text = "File Upload Did Not Succeed: Ensure That File Is A PDF File";
                }

                ts.CommitTransaction();
            }

            rptPublications.DataSource = GetFilesOfType(STR_Publication);
            rptPublications.DataBind();
        }
Esempio n. 4
0
    /// <summary>
    /// Close the position and upload the final recruitment report
    /// </summary>
    protected void ClosePosition(object sender, EventArgs e)
    {
        Position position = CurrentPosition;

        File finalRecruitmentReport = FileBLL.SavePDF(fileFinalRecruitmentReport, FinalRecruitmentReportFileType);

        if (finalRecruitmentReport != null)
        {
            //Delete the old file
            if (position.FinalRecruitmentReportFile != null)
            {
                FileBLL.DeletePDF(position.FinalRecruitmentReportFile);
            }

            //Save the new reference
            using (var ts = new TransactionScope())
            {
                position.FinalRecruitmentReportFile = finalRecruitmentReport;
                position.Closed = true;

                PositionBLL.EnsurePersistent(position);

                ts.CommitTransaction();
            }

            Response.Redirect("ClosePositionSuccess.aspx");
        }
        else
        {
            lblFileError.Text = "Uploaded File Must Be In PDF Format";
        }
    }
        protected void btnModifyPosition_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            Position newPosition = new Position();

            if (currentPositionID.HasValue)
            {
                newPosition = currentPosition;
            }

            //Set the posted date to now
            newPosition.DatePosted = DateTime.Now;
            newPosition.Deadline   = DateTime.Parse(txtDeadline.Text);

            newPosition.PositionTitle  = txtPositionTitle.Text;
            newPosition.PositionNumber = txtPositionNumber.Text;

            newPosition.HRRep   = string.IsNullOrEmpty(txtHRRep.Text) ? null : txtHRRep.Text;
            newPosition.HRPhone = string.IsNullOrEmpty(txtHRPhone.Text) ? null : txtHRPhone.Text;
            newPosition.HREmail = string.IsNullOrEmpty(txtHREmail.Text) ? null : txtHREmail.Text;

            if (!updatePrimaryDepartmentStatus())
            {
                lblPrimaryDeptErrorMessage.Text = "You must select exactly one primary department for this position";
                return;
            }

            addDepartmentsToPosition(newPosition);

            addFileTypesToPosition(newPosition);

            addStepsToPosition(newPosition);

            newPosition.ShortDescription = txtShortDescription.Text;

            if (newPosition.ReferenceTemplate == null)
            {
                newPosition.ReferenceTemplate = new Template();
            }

            newPosition.ReferenceTemplate.TemplateType = ReferenceTemplateType;

            newPosition.ReferenceTemplate.TemplateText = txtReferenceTemplate.Text;

            newPosition.NumPublications = int.Parse(txtPublications.Text);
            newPosition.NumReferences   = int.Parse(txtReferences.Text);

            newPosition.AllowApps   = chkAllowApplications.Checked;
            newPosition.FacultyView = chkAllowFaculty.Checked;
            newPosition.Closed      = chkPositionClosed.Checked;

            // Only try modifying the position descriptions if an upload file exists (should be a new position only).
            if (filePositionDescription.HasFile)
            {
                File jobDescriptionFile = null;

                using (var ts = new TransactionScope())
                {
                    jobDescriptionFile = FileBLL.SavePDF(filePositionDescription, JobDescriptionFileType);

                    ts.CommitTransaction();
                }

                if (jobDescriptionFile == null)
                {
                    //Error message: Job Description Must Be a PDF File
                    lblInvalidFileType.Text = " *Job Description Must Be a PDF File";
                    return;
                }
                else
                {
                    newPosition.DescriptionFile = jobDescriptionFile;
                }
            }

            // Only try modifying the search plans if an upload file exists (new or legacy positions).
            if (fileSearchPlan.HasFile)
            {
                File searchPlanFile;

                using (var ts = new TransactionScope())
                {
                    searchPlanFile = FileBLL.SavePDF(fileSearchPlan, SearchPlanFileType);

                    ts.CommitTransaction();
                }

                if (searchPlanFile == null)
                {
                    //Error: Job description must be a PDF file
                    lblInvalidSearchPlanFileType.Text = "*Search Plan Must Be A PDF File";
                    return;
                }
                else
                {
                    newPosition.SearchPlanFile = searchPlanFile;
                }
            }

            if (newPosition.IsTransient())
            {
                //Since the position is new, send an email to the AppMailTo about the new pending position
                PositionBLL.SendNotificationEmail(newPosition, PendingPageURL);
            }

            using (var ts = new TransactionScope())
            {
                PositionBLL.EnsurePersistent(newPosition);

                ts.CommitTransaction();
            }

            //Redirect to the position modified page
            Response.Redirect("PositionModified.aspx");
        }