コード例 #1
0
        /// <summary>
        /// Send an email to the checked applicants based on whatever template is currently selected (in txtEmailTemplate)
        /// </summary>
        protected void btnSendTemplate_Click(object sender, EventArgs e)
        {
            StringBuilder errorEmails = new StringBuilder();

            var bccAddress = txtBccAddress.Text;

            //Go through each of the applications
            foreach (var row in lviewApplications.Items)
            {
                CheckBox cEmail = (CheckBox)row.FindControl("chkEmailApplicant");

                if (cEmail.Checked) //Should we send to this applicant?
                {
                    //Get the user and email them
                    int         userID = (int)lviewApplications.DataKeys[row.DataItemIndex]["id"];
                    Application selectedApplication = ApplicationBLL.GetByID(userID);

                    var bodyFromTemplate = new TemplateProcessing().ProcessTemplate(null, selectedApplication,
                                                                                    txtEmailTemplate.Text,
                                                                                    false);

                    bool success = MessageBLL.SendMessage(WebConfigurationManager.AppSettings["emailFromEmail"],
                                                          selectedApplication.Email,
                                                          bccAddress,
                                                          "UC Davis Recruitment Message",
                                                          bodyFromTemplate);

                    if (success == false)
                    {
                        errorEmails.AppendFormat("{0}, ", selectedApplication.Email);
                    }
                }
            }

            //Notify the user of the message results
            if (errorEmails.Length != 0)
            {
                errorEmails.Remove(errorEmails.Length - 2, 2);
                lblSentEmail.Text = string.Format("Could not send email to the following address(es): {0}", errorEmails.ToString());
            }
            else
            {
                lblSentEmail.Text = "Email(s) sent successfully";
            }
        }
コード例 #2
0
        protected void dlistApplications_SelectedIndexChanged(object sender, EventArgs e)
        {
            int applicationID = 0;

            if (!int.TryParse(dlistApplications.SelectedValue, out applicationID))
            {
                gViewReferences.Visible = false;
                btnUpdateList.Visible   = false;
                reqValApplications.Validate();
                return; //Return if the selected value is not a valid applicationID
            }

            Application currentApplication = ApplicationBLL.GetByID(applicationID);

            gViewReferences.DataSource = currentApplication.References;
            gViewReferences.DataBind();

            gViewReferences.Visible = true; //Show the references grid

            btnUpdateList.Visible = gViewReferences.Rows.Count > 0;
        }
コード例 #3
0
        protected void btnUpdateList_Click(object sender, EventArgs e)
        {
            using (var ts = new TransactionScope())
            {
                foreach (var row in lviewApplications.Items)
                {
                    int         applicationID = (int)lviewApplications.DataKeys[row.DataItemIndex]["id"];
                    Application app           = ApplicationBLL.GetByID(applicationID);

                    app.InterviewList   = ((CheckBox)row.FindControl("chkShortList")).Checked;
                    app.GetReferences   = ((CheckBox)row.FindControl("chkReferences")).Checked;
                    app.NoConsideration = ((CheckBox)row.FindControl("chkNoConsideration")).Checked;

                    ApplicationBLL.EnsurePersistent(app);
                }

                ts.CommitTransaction();
            }

            lblResult.Text = "Application List Updated";
            lviewReferencesToBeNotified.DataBind();
        }
コード例 #4
0
        public override void LoadData()
        {
            base.LoadData();

            var application = ApplicationBLL.GetByID(StaticProperties.ExistingApplicationID);

            //Add some applications info
            CurrentPosition currentPosition = new CurrentPosition
            {
                Address1              = StaticProperties.TestString,
                City                  = StaticProperties.TestString,
                Country               = StaticProperties.TestString,
                Department            = StaticProperties.TestString,
                Institution           = StaticProperties.TestString,
                Title                 = StaticProperties.TestString,
                Zip                   = StaticProperties.TestString,
                State                 = StaticProperties.TestString,
                ApplicationStepType   = ApplicationStepType.CurrentPosition,
                AssociatedApplication = application
            };

            Education education = new Education
            {
                ApplicationStepType   = ApplicationStepType.Education,
                AssociatedApplication = application,
                Date        = DateTime.Now,
                Discipline  = StaticProperties.TestString,
                Institution = StaticProperties.TestString
            };

            Reference reference = new Reference {
                AssociatedApplication = application
            };

            Survey survey = new Survey {
                AssociatedApplication = application, Other = StaticProperties.TestString
            };

            File file = new File
            {
                FileName = StaticProperties.TestString,
            };

            FileType fileType = new FileType {
                ApplicationFile = true, FileTypeName = StaticProperties.TestString
            };

            file.FileType = fileType;

            using (var ts = new TransactionScope())
            {
                FileTypeBLL.EnsurePersistent(fileType);
                FileBLL.EnsurePersistent(file);

                application.CurrentPositions = new List <CurrentPosition> {
                    currentPosition
                };
                application.Education = new List <Education> {
                    education
                };
                application.References = new List <Reference> {
                    reference
                };
                application.Surveys = new List <Survey> {
                    survey
                };
                application.Files = new List <File> {
                    file
                };

                ApplicationBLL.EnsurePersistent(application);

                ts.CommitTransaction();
            }
        }