protected void btnUpdateList_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in gViewReferences.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    //Get the unsolicited check box and then current reference
                    CheckBox cboxUnsolicited = (CheckBox)row.FindControl("chkUnsolicited");

                    int       referenceID      = (int)gViewReferences.DataKeys[row.RowIndex]["id"];
                    Reference currentReference = ReferenceBLL.GetByID(referenceID);

                    //Only save the information if it has changed
                    if (currentReference.UnsolicitedReference != cboxUnsolicited.Checked)
                    {
                        using (var ts = new TransactionScope())
                        {
                            currentReference.UnsolicitedReference = cboxUnsolicited.Checked;

                            ReferenceBLL.EnsurePersistent(currentReference);

                            ts.CommitTransaction();
                        }
                    }
                }
            }

            //Notify the user that the update was successful
            lblResult.Text = "Unsolicited List Updated";
        }
        /// <summary>
        /// Sends a unsolicited letter to the selected reference
        /// </summary>
        protected void sendEmail_Click(object sender, EventArgs e)
        {
            Button btnSender = (Button)sender;

            int referenceID = int.Parse(btnSender.CommandArgument);

            Reference currentReference = ReferenceBLL.GetByID(referenceID);

            SmtpClient  client  = new SmtpClient();
            MailMessage message = new MailMessage(WebConfigurationManager.AppSettings["emailFromEmail"],
                                                  currentReference.Email,
                                                  "UC Davis Recruitment Unsolicited Letter Response",
                                                  new TemplateProcessing().ProcessTemplate(currentReference, currentReference.AssociatedApplication, UnsolicitedTemplate.TemplateText, false)
                                                  );

            message.IsBodyHtml = true;
            client.Send(message);

            //Record when the unsolicited email was sent out
            using (var ts = new TransactionScope())
            {
                currentReference.UnsolicitedEmailDate = DateTime.Now;

                ReferenceBLL.EnsurePersistent(currentReference);

                ts.CommitTransaction();
            }

            lblResult.Text = "Email sent successfully";
        }
예제 #3
0
        /// <summary>
        /// Called from the Refences Grid whenever a row is selected (Edited).
        /// Populates the reference's information into the info table and then shows the popup
        /// </summary>
        protected void gviewReferences_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridView referenceGrid = sender as GridView;

            //Grab the reference from the dataKey ID
            int       currentReferenceID = (int)referenceGrid.SelectedDataKey["ID"];
            Reference currentReference   = ReferenceBLL.GetByID(currentReferenceID);

            //Now fill in the form fields with the current reference
            txtReferencesTitle.Text     = currentReference.Title;
            txtReferencesFirstName.Text = currentReference.FirstName;
            txtReferencesLastName.Text  = currentReference.LastName;

            txtReferencesAcadTitle.Text = currentReference.AcadTitle;
            txtReferencesExpertise.Text = currentReference.Expertise;

            txtReferencesDepartment.Text = currentReference.Dept;
            txtReferencesInstitute.Text  = currentReference.Institution;

            txtReferencesAddress1.Text = currentReference.Address1;
            txtReferencesAddress2.Text = currentReference.Address2;
            txtReferencesCity.Text     = currentReference.City;
            txtReferencesState.Text    = currentReference.State;
            txtReferencesZip.Text      = currentReference.Zip;
            txtReferencesCountry.Text  = currentReference.Country;

            txtReferencesPhone.Text = currentReference.Phone;
            txtReferencesEmail.Text = currentReference.Email;

            //Now show the popup control
            mpopupReferencesEntry.Show();
        }
예제 #4
0
        /// <summary>
        /// Returns true if a file exists, else false
        /// </summary>
        protected bool GetRefernceFileStatusString(int referenceID)
        {
            Reference reference = ReferenceBLL.GetByID(referenceID);

            if (reference.ReferenceFile != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        private void UploadReferences()
        {
            FileType  referenceFileType = FileTypeBLL.GetByName(STR_LetterOfRec);
            Reference selectedReference = ReferenceBLL.GetByID(int.Parse(dlistReferences.SelectedValue));

            //If there is already a reference file, we need to delete it
            if (selectedReference.ReferenceFile != null)
            {
                using (var ts = new TransactionScope())
                {
                    FileBLL.DeletePDF(selectedReference.ReferenceFile);
                    selectedReference.ReferenceFile = null;

                    ReferenceBLL.EnsurePersistent(selectedReference);

                    ts.CommitTransaction();
                }
            }

            if (fileUpload.HasFile)
            {
                using (var ts = new TransactionScope())
                {
                    File file = FileBLL.SavePDFWithWatermark(fileUpload, referenceFileType);

                    if (file != null)
                    {
                        selectedReference.ReferenceFile        = file;
                        selectedReference.UnsolicitedReference = chkUnsolicited.Checked;

                        ReferenceBLL.EnsurePersistent(selectedReference);

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

                    ts.CommitTransaction();
                }
            }
        }