protected void SubmitRequest(object sender, EventArgs e) { if (this.txtReviewers.Text.Length == 0) { this.blstErrors.Items.Add(Resources.Resources.ReviewerRequired); this.programmaticModalPopup.Show(); } else { OdsFinder odsFinder = new OdsFinder(); SWN.TTR.Repository.Dto.Employee reviewer = odsFinder.GetEmployeeByFullName(this.txtReviewers.Text); if (reviewer == null) { this.blstErrors.Items.Add(string.Format(Resources.Resources.ReviewerSelectedInvalid, this.txtReviewers.Text)); this.programmaticModalPopup.Show(); } else { TravelAndTrainingRequest request = PackRequest(); ValidationResults results = Microsoft.Practices.EnterpriseLibrary.Validation.Validation.Validate<TravelAndTrainingRequest>(request, "Save", "Event", "Estimates"); // add any UI validation that failed while gather the request object foreach (string packingError in this.packingErrors) results.AddResult(new ValidationResult(packingError, null, "", "", null)); if (results.IsValid) { try { request.RouteTo(new System.Net.Mail.MailAddress(reviewer.EmailAddress)); Response.Redirect("~/RequestConfirmation.aspx", false); } catch (InvalidOperationException ioex) { this.blstErrors.Items.Add(ioex.Message); this.programmaticModalPopup.Show(); } } else { foreach (ValidationResult vr in results) this.blstErrors.Items.Add(vr.Message); this.programmaticModalPopup.Show(); } } } }
protected void LoadEmployees(object sender, EventArgs e) { DropDownList ddl = (DropDownList)sender; OdsFinder odsFinder = new OdsFinder(); ddl.DataSource = odsFinder.GetActiveEmployees(); ddl.DataBind(); }