Example #1
0
        protected void submitBtnClicked(object sender, EventArgs e)
        {
            string validationErrors = string.Empty;

            if (!ValidateFields(out validationErrors))
            {
                rg_errorMsg.InnerHtml          = String.Format("Please complete the missing fields. <p>{0}</p>", validationErrors);
                rg_errorMsg.Attributes["role"] = "alert";

                string script = "<script type=\"text/javascript\"> $(function() { $('#contactOverlay').modal('show'); }); </script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "contact_validation_errors", script);

                //RegisterJSAlert(rg_errorMsg.InnerText);

                return;
            }

            try
            {
                using (cec_publicservice.CECInputFormService websrv = new CECInputFormService())
                {
                    System.Collections.Specialized.NameValueCollection data =
                        new NameValueCollection();
                    data.Add("first_name", cu_firstName.Text);
                    data.Add("last_name", cu_lastName.Text);
                    data.Add("institution_affiliation", cu_organization.Text);
                    data.Add("phone_number", cu_phone.Text);
                    data.Add("email_address", cu_email.Text);
                    data.Add("topic", cu_topic.SelectedItem.Text);
                    data.Add("email", cu_email.Text);
                    websrv.CreateEmailAndSend(helper.CreateTemporaryToken(), "helpdesk_inbound", data);

                    data.Clear();
                    data.Add("to", cu_email.Text);
                    websrv.CreateEmailAndSend(helper.CreateTemporaryToken(), "helpdesk_outbound", data);
                }
            }
            catch (Exception ex)
            {
                rg_errorMsg.InnerText = "Failed to send email";

#if (DEBUG || DEBUGDEV)
                rg_errorMsg.InnerText += String.Format(" ({0})", ex.Message);
#endif
                //LogError(rg_errorMsg.InnerText, ex);
            }
        }
Example #2
0
        private void SendEmailConfirmation()
        {
            using (cec_publicservice.CECInputFormService websrv = new CECInputFormService())
            {
                UserData ud = websrv.GetUserInformationByUserID(UserToken, UserToken.userid);
                System.Collections.Specialized.NameValueCollection data =
                    new NameValueCollection();
                data.Add("name", ud.display_name);
                data.Add("to", ud.email);

                websrv.CreateEmailAndSend(UserToken, "user_info_update", data);
            }
        }