Пример #1
0
        private Boolean SaveDataToReportDB()
        {
            bool blnDataSaved = false;

            try
            {
                string FirstName = "";
                string Surname = "";

                if (txtName.Value.IndexOf(" ") != -1)
                {
                    FirstName = txtName.Value.Substring(0, txtName.Value.IndexOf(" ")).Trim();
                    Surname = txtName.Value.Substring(txtName.Value.IndexOf(" ") + 1).Trim();
                }
                else
                {
                    FirstName = txtName.Value.Trim();
                }

                //Store Feedback Entitiy Details
                Feedback objFeedback = new Feedback();

                //Store Customer Entitiy Details
                Customer objCustomer = new Customer();
                objCustomer.EmailAddress = txtEmail.Value.Trim();
                objCustomer.Firstname = FirstName;
                objCustomer.Surname = Surname;
                objCustomer.HomeClubID = currentClub.ClubId.Rendered;
                objCustomer.SubscribeToNewsletter = chkSubscribe.Checked;
                objCustomer.TelephoneNumber = txtPhone.Value.Trim();
                objFeedback.Customer = objCustomer;
                objFeedback.FeedbackSubject = "Club Enquiry";
                objFeedback.FeedbackSubjectDetail = "Virgin Active Website";
                objFeedback.FeedbackTypeID = Constants.FeedbackType.ClubEnquiry;
                objFeedback.PrimaryClubID = currentClub.ClubId.Rendered;
                objFeedback.SubmissionDate = DateTime.Now;

                //Add Comment
                Comment objComment = new Comment();

                objComment.CommentDetail = drpHowDidYouFindUs.SelectedValue.ToString();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 1;
                objComment.Subject = "How did you find out about us";

                List<Comment> objComments = new List<Comment>();
                objComments.Add(objComment);
                objFeedback.Comments = objComments;

                string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                DataAccessLayer dal = new DataAccessLayer(connection);
                if (dal.SaveFeedback(Context.User.Identity.Name, enquiryItem.DisplayName, objFeedback) > 0)
                {
                    blnDataSaved = true;
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error saving form data to reports db {1}: {0}", ex.Message, currentClub.Clubname.Raw), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }

            return blnDataSaved;
        }
        private Boolean SaveDataToReportDB()
        {
            bool blnDataSaved = false;

            try
            {
                string FirstName = "";
                string Surname = "";

                if (txtName.Value.IndexOf(" ") != -1)
                {
                    FirstName = txtName.Value.Substring(0, txtName.Value.IndexOf(" ")).Trim();
                    Surname = txtName.Value.Substring(txtName.Value.IndexOf(" ") + 1).Trim();
                }
                else
                {
                    FirstName = txtName.Value.Trim();
                }

                //Store Feedback Entitiy Details
                Feedback objFeedback = new Feedback();

                //Store Customer Entitiy Details
                Customer objCustomer = new Customer();
                objCustomer.EmailAddress = txtEmail.Value.Trim();
                objCustomer.Firstname = FirstName;
                objCustomer.Surname = Surname;
                objCustomer.MembershipNumber = txtMembership.Value.Trim();
                objCustomer.HomeClubID = club.ClubId.Rendered;
                objCustomer.TelephoneNumber = txtPhone.Value;
                objFeedback.Customer = objCustomer;
                objFeedback.FeedbackSubject = "Health And Beauty Enquiry";
                objFeedback.FeedbackSubjectDetail = "Virgin Active Website";
                objFeedback.FeedbackTypeID = Constants.FeedbackType.HealthAndBeautyFeedback;
                objFeedback.PrimaryClubID = club.ClubId.Rendered;
                objFeedback.SubmissionDate = DateTime.Now;
                //objFeedback.PreferredCallbackDate = Convert.ToDateTime(txtPreferredDay.Value.Trim(), System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");
                //objFeedback.PreferredCallbackTime = drpPreferredTime.SelectedValue.ToString() != Translate.Text("Select") ? drpPreferredTime.SelectedValue.ToString() : "";

                //Add Comment
                Comment objComment = new Comment();

                objComment.CommentDetail = drpTreatment.SelectedValue.ToString() != Translate.Text("Select") ? drpTreatment.SelectedValue.ToString() : "";
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 1;
                objComment.Subject = "Treatment";

                List<Comment> objComments = new List<Comment>();
                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtPreferredDay.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 2;
                objComment.Subject = "Preferred Treatment Day";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = drpPreferredTime.SelectedValue.ToString() != Translate.Text("Select") ? drpPreferredTime.SelectedValue.ToString() : "";
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 3;
                objComment.Subject = "Preferred Treatment Time";

                objComments.Add(objComment);

                objFeedback.Comments = objComments;

                string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                DataAccessLayer dal = new DataAccessLayer(connection);
                if (dal.SaveFeedback(Context.User.Identity.Name, listing.DisplayName, objFeedback) > 0)
                {
                    blnDataSaved = true;
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error saving form data to reports db {1}: {0}", ex.Message, club.Clubname.Raw), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }

            return blnDataSaved;
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    //Get User from Session
                    //Check Session
                    User objUser = new User();
                    if (Session["sess_User_landing"] != null)
                    {
                        objUser = (User)Session["sess_User_landing"];

                        clubId = objUser.BrowsingHistory.LandingClubID;
                        profile = objUser.BrowsingHistory.LandingProfile;
                        region = objUser.BrowsingHistory.LandingRegion;
                    }

                    //Get Club Data

                    if (!String.IsNullOrEmpty(clubId))
                    {
                        clubItem = SitecoreHelper.GetClubOnClubId(clubId);

                        if (clubItem != null)
                        {

                            //Store Feedback Entitiy Details
                            Feedback objFeedback = new Feedback();

                            //Store Customer Entitiy Details
                            Customer objCustomer = new Customer();

                            string FirstName = "";
                            string Surname = "";

                            if (txtName.Value.IndexOf(" ") != -1)
                            {
                                FirstName = txtName.Value.Substring(0, txtName.Value.IndexOf(" ")).Trim();
                                Surname = txtName.Value.Substring(txtName.Value.IndexOf(" ") + 1).Trim();
                            }
                            else
                            {
                                FirstName = txtName.Value.Trim();
                            }

                            objCustomer.EmailAddress = txtEmail.Value;
                            objCustomer.Firstname = FirstName;
                            objCustomer.Surname = Surname;
                            objCustomer.HomeClubID = clubItem.ClubId.Rendered;
                            objCustomer.TelephoneNumber = txtPhone.Value;
                            objCustomer.SubscribeToNewsletter = chkSubscribe.Checked;

                            objFeedback.Customer = objCustomer;
                            objFeedback.FeedbackSubject = "Landing Enquiry"; //Landing Enquiry
                            objFeedback.FeedbackSubjectDetail = "Virgin Active Website Landing Page"; //Virgin Active Website Landing Page
                            objFeedback.FeedbackTypeID = Convert.ToInt32(currentLanding.LandingBase.LandingId.Rendered);
                            objFeedback.PrimaryClubID = clubItem.ClubId.Rendered;
                            objFeedback.SubmissionDate = DateTime.Now;

                            //Add Comment
                            Comment objComment = new Comment();

                            //objComment.CommentDetail = source.Items[source.SelectedIndex].Value;
                            objComment.CommentDetail = currentLanding.LandingBase.LandingIdName.Rendered;// "Q1 Landing Page -2013"; //Other
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 1;
                            objComment.Subject = Translate.Text("How did you hear about us?");

                            List<Comment> objComments = new List<Comment>();
                            objComments.Add(objComment);

                            objFeedback.Comments = objComments;

                            string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                            DataAccessLayer dal = new DataAccessLayer(connection);
                            int successFlag = dal.SaveFeedback(Context.User.Identity.Name, currentItem.DisplayName, objFeedback);

                            if (successFlag > 0)
                            {
                                //Data is sent to client via email
                                SendAdminEmail();

                                //Data is sent to client via service
                                SendEnquiryDataService();

                                //Data is sent to customer via email
                                SendConfirmationEmail();

                                //Save objFeedback back to session
                                Session["sess_Customer"] = objCustomer;

                                //Redirect to 'Whats Next' Page
                                Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions();
                                urlOptions.AlwaysIncludeServerUrl = true;
                                urlOptions.AddAspxExtension = false;
                                urlOptions.LanguageEmbedding = LanguageEmbedding.Never;

                                Item whatNextItem = currentItem.InnerItem.Parent.Axes.SelectSingleItem(String.Format("descendant-or-self::*[@@tid = '{0}']", Settings.LandingPagesWhatsNextTemplate));

                                string whatNextUrl = Sitecore.Links.LinkManager.GetItemUrl(whatNextItem, urlOptions)+"?_clubid=" + clubItem.ClubId.Rendered;

                                Response.Redirect(whatNextUrl);
                            }
                            else
                            {
                                //imageStatic.Attributes.Add("style", "display:none;");
                                //formToComplete.Attributes.Add("style", "display:block;");
                                //formCompleted.Attributes.Add("style", "display:none;");
                                //pnlForm.Update();

                                Log.Error(String.Format("Error storing campaign details"), this);
                            }
                        }
                        else
                        {
                            //imageStatic.Attributes.Add("style", "display:none;");
                            //formToComplete.Attributes.Add("style", "display:block;");
                            //formCompleted.Attributes.Add("style", "display:none;");
                            //pnlForm.Update();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error processing club enquiry form {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
Пример #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {

                //Store Feedback Entitiy Details
                Feedback objFeedback = new Feedback();

                //Store Customer Entitiy Details
                Customer objCustomer = new Customer();

                objCustomer.EmailAddress = email.Value;
                //objCustomer.Firstname = "";
                //objCustomer.Surname = "";
                //objCustomer.HomeClubID = "";
                //objCustomer.SubscribeToNewsletter = false;
                //objCustomer.TelephoneNumber = "";
                //objCustomer.MembershipNumber = "";
                //objCustomer.Gender = "";
                //objCustomer.AddressLine1 = "";
                //objCustomer.AddressLine2 = "";
                //objCustomer.AddressLine3 = "";
                //objCustomer.AddressLine4 = "";
                //objCustomer.Postcode = "";

                objFeedback.Customer = objCustomer;
                objFeedback.FeedbackSubject = campaign.CampaignBase.Campaigntype.Raw;
                objFeedback.FeedbackSubjectDetail = campaign.CampaignBase.Campaignname.Rendered;
                objFeedback.FeedbackTypeID = Convert.ToInt32(campaign.CampaignBase.CampaignId.Rendered);
                objFeedback.PrimaryClubID = "";
                objFeedback.SubmissionDate = DateTime.Now;

                string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                DataAccessLayer dal = new DataAccessLayer(connection);
                int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                //Data is sent to client via email
                SendAdminEmail();

                if (campaign.CampaignBase.Sendconfirmationemail.Checked == true)
                {
                    //Data is sent to customer via email
                    SendConfirmationEmail();
                }

                formToComplete.Visible = false;
                formCompleted.Visible = true;

                //System.Threading.Thread.Sleep(5000);
                pnlForm.Update();
                //ClearFormFields();

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error storing campaign details: {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
Пример #5
0
        private Boolean SaveDataToReportDB()
        {
            bool blnDataSaved = false;

            try
            {
                //Store Feedback Entitiy Details
                Feedback objFeedback = new Feedback();

                //Store Customer Entitiy Details
                Customer objCustomer = new Customer();
                objCustomer.EmailAddress = txtEmail.Value.Trim();
                objCustomer.Firstname = txtFirstName.Value.Trim();
                objCustomer.Surname = txtSurname.Value.Trim();
                objCustomer.MembershipNumber = txtMembership.Value.Trim();
                objCustomer.HomeClubID = "";

                DateTime datDateOfBirth;
                if (DateTime.TryParse(drpDOBDay.SelectedValue + "/" + drpDOBMonth.SelectedValue + "/" + drpDOBYear.SelectedValue, out datDateOfBirth))
                {
                    objCustomer.DateOfBirth = datDateOfBirth;
                }
                objCustomer.AddressLine1 = txtAddress1.Value.Trim();
                objCustomer.AddressLine2 = txtAddress2.Value.Trim();
                objCustomer.AddressLine3 = txtAddress3.Value.Trim();
                objCustomer.AddressLine4 = (txtAddress4.Value.Trim() + " " + txtAddress5.Value.Trim()).Trim();
                objCustomer.Postcode = txtPostcode2.Value.Trim();
                //objCustomer.PublishDetails = false;
                //objCustomer.SubscribeToNewsletter = false;
                objCustomer.TelephoneNumber = txtHomeNo.Value.Trim();
                objCustomer.AlternativeTelephoneNumber = txtMobileNo.Value.Trim();
                objFeedback.Customer = objCustomer;
                objFeedback.FeedbackSubject = "Personal Details Update";
                objFeedback.FeedbackSubjectDetail = "Virgin Active Website";
                objFeedback.FeedbackTypeID = Constants.FeedbackType.PersonalDetails;
                objFeedback.PrimaryClubID = "";
                objFeedback.SubmissionDate = DateTime.Now;

                //Add Comment
                Comment objComment = new Comment();

                objComment.CommentDetail = hdnRecordId.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 1;
                objComment.Subject = "Record ID";

                List<Comment> objComments = new List<Comment>();
                objComments.Add(objComment);

                //Add Comment
                objComment = new Comment();

                objComment.CommentDetail = txtHomeNo.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 2;
                objComment.Subject = "Home Telephone No.";

                objComments.Add(objComment);

                //Add Comment
                objComment = new Comment();

                objComment.CommentDetail = txtMobileNo.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 3;
                objComment.Subject = "Mobile Telephone No.";

                objComments.Add(objComment);

                //Add Comment
                objComment = new Comment();

                objComment.CommentDetail = txtWorkNo.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 4;
                objComment.Subject = "Work Telephone No.";

                objComments.Add(objComment);

                //Add Comment
                objComment = new Comment();

                objComment.CommentDetail = chkContactByMarketing.Checked == true ? "Y" : "N";
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 5;
                objComment.Subject = "Contact By Marketing";

                objComments.Add(objComment);

                objFeedback.Comments = objComments;

                string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                DataAccessLayer dal = new DataAccessLayer(connection);
                if (dal.SaveFeedback(Context.User.Identity.Name, currentItem.DisplayName, objFeedback) > 0)
                {
                    blnDataSaved = true;
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error saving form data to reports db: {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }

            return blnDataSaved;
        }
Пример #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    //check if we have a valid club selected
                    Boolean blnClubSuccessfullySelected =  clubFindSelect.SelectedIndex != 0;

                    if (blnClubSuccessfullySelected == true)
                    {
                        //Guid id = new Guid(
                        currentClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect.SelectedValue);

                        if (currentClub != null)
                        {

                            //Store Feedback Entitiy Details
                            Feedback objFeedback = new Feedback();

                            //Store Customer Entitiy Details
                            Customer objCustomer = new Customer();

                            string FirstName = "";
                            string Surname = "";

                            if (txtName.Value.IndexOf(" ") != -1)
                            {
                                FirstName = txtName.Value.Substring(0, txtName.Value.IndexOf(" ")).Trim();
                                Surname = txtName.Value.Substring(txtName.Value.IndexOf(" ") + 1).Trim();
                            }
                            else
                            {
                                FirstName = txtName.Value.Trim();
                            }

                            objCustomer.EmailAddress = txtEmail.Value;
                            objCustomer.Firstname = FirstName;
                            objCustomer.Surname = Surname;
                            objCustomer.HomeClubID = currentClub.ClubId.Rendered;
                            objCustomer.TelephoneNumber = txtPhone.Value;

                            objFeedback.Customer = objCustomer;
                            objFeedback.FeedbackSubject = currentCampaign.CampaignBase.Campaigntype.Raw;
                            objFeedback.FeedbackSubjectDetail = currentCampaign.CampaignBase.Campaignname.Rendered;
                            objFeedback.FeedbackTypeID = Convert.ToInt32(currentCampaign.CampaignBase.CampaignId.Rendered);
                            objFeedback.PrimaryClubID = currentClub.ClubId.Rendered;
                            objFeedback.SubmissionDate = DateTime.Now;

                            //Add Comment
                            Comment objComment = new Comment();

                            //objComment.CommentDetail = source.Items[source.SelectedIndex].Value;
                            objComment.CommentDetail = drpHowDidYouFindUs.SelectedValue;
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 1;
                            objComment.Subject = Translate.Text("How did you hear about us?");

                            List<Comment> objComments = new List<Comment>();
                            objComments.Add(objComment);

                            objFeedback.Comments = objComments;

                            string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                            DataAccessLayer dal = new DataAccessLayer(connection);
                            int successFlag = dal.SaveFeedback(Context.User.Identity.Name, currentCampaign.DisplayName, objFeedback);

                            if (successFlag > 0)
                            {
                                //Data is sent to client via email
                                SendAdminEmail();

                                if (currentCampaign.CampaignBase.Isweblead.Checked == true)
                                {
                                    //Data is sent to client via service
                                    SendEnquiryDataService();
                                }

                                //get managers info
                                List<ManagerItem> staffMembers = null;
                                if (currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
                                {
                                    staffMembers = currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));

                                    manager = staffMembers.First();
                                }

                                if (currentCampaign.CampaignBase.Sendconfirmationemail.Checked == true)
                                {
                                    //Data is sent to customer via email
                                    SendConfirmationEmail();
                                }

                                //imageStatic.Attributes.Add("style", "display:none;");
                                formToComplete.Attributes.Add("style", "display:none;");
                                pnlEnquiryPanel.Visible = false;
                                formCompleted.Visible = true;
                                formCompleted.Attributes.Add("style", "display:block;");
                                //ClearFormFields();
                                pnlForm.Update();
                            }
                            else
                            {
                                //imageStatic.Attributes.Add("style", "display:none;");
                                formToComplete.Attributes.Add("style", "display:block;");
                                formCompleted.Attributes.Add("style", "display:none;");
                                pnlForm.Update();

                                Log.Error(String.Format("Error storing campaign details"), this);
                            }
                        }
                        else
                        {
                            //imageStatic.Attributes.Add("style", "display:none;");
                            formToComplete.Attributes.Add("style", "display:block;");
                            formCompleted.Attributes.Add("style", "display:none;");
                            pnlForm.Update();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error processing club enquiry form {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
Пример #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                bool blnIsValid = clubFindSelect.SelectedIndex != 0;

                if (blnIsValid == true)
                {
                    currentClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect.SelectedValue);

                    if (currentClub != null)
                    {

                    //Store Feedback Entitiy Details
                    Feedback objFeedback = new Feedback();

                    //Store Customer Entitiy Details
                    Customer objCustomer = new Customer();

                    string FirstName = "";
                    string Surname = "";

                    if (yourname.Value.IndexOf(" ") != -1)
                    {
                        FirstName = yourname.Value.Substring(0, yourname.Value.IndexOf(" ")).Trim();
                        Surname = yourname.Value.Substring(yourname.Value.IndexOf(" ") + 1).Trim();
                    }
                    else
                    {
                        FirstName = yourname.Value.Trim();
                    }

                    objCustomer.EmailAddress = email.Value;
                    objCustomer.Firstname = FirstName;
                    objCustomer.Surname = Surname;
                    //objCustomer.HomeClubID = txtClubCode.Value;
                    objCustomer.HomeClubID = currentClub.ClubId.Rendered;
                    objCustomer.SubscribeToNewsletter = false;
                    objCustomer.TelephoneNumber = contact.Value;

                    objFeedback.Customer = objCustomer;
                    objFeedback.FeedbackSubject = campaign.CampaignBase.Campaigntype.Raw;
                    objFeedback.FeedbackSubjectDetail = campaign.CampaignBase.Campaignname.Rendered;
                    objFeedback.FeedbackTypeID = Convert.ToInt32(campaign.CampaignBase.CampaignId.Rendered);
                    objFeedback.PrimaryClubID = currentClub.ClubId.Rendered;
                    objFeedback.SubmissionDate = DateTime.Now;

                    string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                    DataAccessLayer dal = new DataAccessLayer(connection);
                    int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                    if (successFlag > 0)
                    {
                        //Data is sent to client via email
                        SendAdminEmail();

                        if (campaign.CampaignBase.Isweblead.Checked == true)
                        {
                            //Data is sent to client via service
                            SendEnquiryDataService();
                        }

                        //get managers info
                        List<ManagerItem> staffMembers = null;
                        if (currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
                        {
                            staffMembers = currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));

                            manager = staffMembers.First();
                        }

                        if (campaign.CampaignBase.Sendconfirmationemail.Checked == true)
                        {
                            //Data is sent to customer via email
                            SendConfirmationEmail();
                        }

                        imageStatic.Attributes.Add("style", "display:none;");
                        innerForm.Attributes.Add("style", "display:none;");
                        formCompleted.Attributes.Add("style", "display:block;");

                        string classNames = article.Attributes["class"];
                        article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");
                        ClearFormFields();
                    }
                    else
                    {
                        imageStatic.Attributes.Add("style", "display:none;");
                        innerForm.Attributes.Add("style", "display:block;");
                        formCompleted.Attributes.Add("style", "display:none;");

                        string classNames = article.Attributes["class"];
                        article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");

                        Log.Error(String.Format("Error storing campaign details"), this);
                    }
                }
                else
                {
                    imageStatic.Attributes.Add("style", "display:none;");
                    innerForm.Attributes.Add("style", "display:block;");
                    formCompleted.Attributes.Add("style", "display:none;");

                    string classNames = article.Attributes["class"];
                    article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");
                }
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error storing campaign details: {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
Пример #8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //check if we have a valid club selected
                Boolean blnClubSuccessfullySelected = clubFindSelect.SelectedIndex != 0;

                if (blnClubSuccessfullySelected == true)
                {
                    if (clubFindSelect.SelectedValue != "Head Office")
                    {
                        currentClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect.SelectedValue);

                        if (currentClub != null)
                        {

                            //Store Feedback Entitiy Details
                            Feedback objFeedback = new Feedback();

                            //Store Customer Entitiy Details
                            Customer objCustomer = new Customer();

                            objCustomer.EmailAddress = email.Value;
                            objCustomer.Firstname = firstName.Value;
                            objCustomer.Surname = surname.Value;
                            objCustomer.HomeClubID = currentClub.ClubId.Rendered;
                            objCustomer.SubscribeToNewsletter = subscribe.Checked;
                            objCustomer.TelephoneNumber = number.Value.Trim();
                            objCustomer.MembershipNumber = memberNo.Value.Trim();
                            objCustomer.Gender = male.Checked == true ? "M" : "F";
                            objCustomer.AddressLine1 = address1.Value.Trim();
                            objCustomer.AddressLine2 = address2.Value.Trim();
                            objCustomer.AddressLine3 = "";
                            objCustomer.AddressLine4 = address3.Value.Trim();
                            objCustomer.Postcode = postcode.Value.Trim();

                            if (dob.Value.Trim() != "")
                            {
                                objCustomer.DateOfBirth = Convert.ToDateTime(dob.Value.Trim(), System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));
                            }

                            objFeedback.Customer = objCustomer;
                            objFeedback.FeedbackSubject = campaign.CampaignBase.Campaigntype.Raw;
                            objFeedback.FeedbackSubjectDetail = campaign.CampaignBase.Campaignname.Rendered;
                            objFeedback.FeedbackTypeID = Convert.ToInt32(campaign.CampaignBase.CampaignId.Rendered);
                            objFeedback.PrimaryClubID = currentClub.ClubId.Rendered;
                            objFeedback.SubmissionDate = DateTime.Now;

                            List<Comment> objComments = new List<Comment>();
                            //Add Comment
                            Comment objComment = new Comment();
                            objComment.CommentDetail = member.Checked == true ? "Member" : "Staff";
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 1;
                            objComment.Subject = "Entrant Type";

                            objComments.Add(objComment);

                            objComment = new Comment();
                            //objComment.CommentDetail = drpEvent.Items[drpEvent.SelectedIndex].Value;
                            objComment.CommentDetail = drpEvent.SelectedValue;
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 2;
                            objComment.Subject = "Event";

                            objComments.Add(objComment);

                            objComment = new Comment();
                            objComment.CommentDetail = drpTopsize.SelectedValue;
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 3;
                            objComment.Subject = "Top Size";

                            objComments.Add(objComment);

                            objComment = new Comment();
                            objComment.CommentDetail = teamname.Value.Trim();
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 4;
                            objComment.Subject = "Team Name";

                            objComments.Add(objComment);

                            objComment = new Comment();
                            objComment.CommentDetail = nextofkin.Value.Trim();
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 5;
                            objComment.Subject = "Next Of Kin";

                            objComments.Add(objComment);

                            objComment = new Comment();
                            objComment.CommentDetail = nextofkinnumber.Value.Trim();
                            objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                            objComment.SortOrder = 6;
                            objComment.Subject = "Next Of Kin Contact No.";

                            objComments.Add(objComment);

                            objFeedback.Comments = objComments;

                            string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                            DataAccessLayer dal = new DataAccessLayer(connection);
                            int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                            if (successFlag > 0)
                            {

                                //get managers info
                                List<ManagerItem> staffMembers = null;
                                if (currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
                                {
                                    staffMembers = currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));

                                    manager = staffMembers.First();
                                }

                                if (campaign.CampaignBase.Sendconfirmationemail.Checked == true)
                                {
                                    //Data is sent to customer via email
                                    SendConfirmationEmail();
                                }

                                pnlForm.Attributes.Add("style", "display:none;");
                                pnlThanks.Attributes.Add("style", "display:block;");

                                string classNames = wrapper.Attributes["class"];
                                wrapper.Attributes.Add("class", "wrapper-thanks");
                                //ClearFormFields();
                            }
                            else
                            {
                                pnlForm.Attributes.Add("style", "display:block;");
                                pnlThanks.Attributes.Add("style", "display:none;");

                                //string classNames = article.Attributes["class"];
                                //article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");

                                Log.Error(String.Format("Error storing campaign details"), this);
                            }
                        }
                        else
                        {
                            pnlForm.Attributes.Add("style", "display:block;");
                            pnlThanks.Attributes.Add("style", "display:none;");

                            //string classNames = article.Attributes["class"];
                            //article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");
                        }
                    }
                else
                {
                    //Store Feedback Entitiy Details
                    Feedback objFeedback = new Feedback();

                    //Store Customer Entitiy Details
                    Customer objCustomer = new Customer();

                    objCustomer.EmailAddress = email.Value;
                    objCustomer.Firstname = firstName.Value;
                    objCustomer.Surname = surname.Value;
                    objCustomer.HomeClubID = "N/A";
                    objCustomer.SubscribeToNewsletter = subscribe.Checked;
                    objCustomer.TelephoneNumber = number.Value.Trim();
                    objCustomer.MembershipNumber = memberNo.Value.Trim();
                    objCustomer.Gender = male.Checked == true ? "M" : "F";
                    objCustomer.AddressLine1 = address1.Value.Trim();
                    objCustomer.AddressLine2 = address2.Value.Trim();
                    objCustomer.AddressLine3 = "";
                    objCustomer.AddressLine4 = address3.Value.Trim();
                    objCustomer.Postcode = postcode.Value.Trim();

                    if (dob.Value.Trim() != "")
                    {
                        objCustomer.DateOfBirth = Convert.ToDateTime(dob.Value.Trim(), System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));
                    }

                    objFeedback.Customer = objCustomer;
                    objFeedback.FeedbackSubject = campaign.CampaignBase.Campaigntype.Raw;
                    objFeedback.FeedbackSubjectDetail = campaign.CampaignBase.Campaignname.Rendered;
                    objFeedback.FeedbackTypeID = Convert.ToInt32(campaign.CampaignBase.CampaignId.Rendered);
                    objFeedback.PrimaryClubID = "N/A";
                    objFeedback.SubmissionDate = DateTime.Now;

                    List<Comment> objComments = new List<Comment>();
                    //Add Comment
                    Comment objComment = new Comment();
                    objComment.CommentDetail = member.Checked == true ? "Member" : "Staff";
                    objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                    objComment.SortOrder = 1;
                    objComment.Subject = "Entrant Type";

                    objComments.Add(objComment);

                    objComment = new Comment();
                    //objComment.CommentDetail = drpEvent.Items[drpEvent.SelectedIndex].Value;
                    objComment.CommentDetail = drpEvent.SelectedValue;
                    objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                    objComment.SortOrder = 2;
                    objComment.Subject = "Event";

                    objComments.Add(objComment);

                    objComment = new Comment();
                    objComment.CommentDetail = drpTopsize.SelectedValue;
                    objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                    objComment.SortOrder = 3;
                    objComment.Subject = "Top Size";

                    objComments.Add(objComment);

                    objComment = new Comment();
                    objComment.CommentDetail = teamname.Value.Trim();
                    objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                    objComment.SortOrder = 4;
                    objComment.Subject = "Team Name";

                    objComments.Add(objComment);

                    objComment = new Comment();
                    objComment.CommentDetail = nextofkin.Value.Trim();
                    objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                    objComment.SortOrder = 5;
                    objComment.Subject = "Next Of Kin";

                    objComments.Add(objComment);

                    objComment = new Comment();
                    objComment.CommentDetail = nextofkinnumber.Value.Trim();
                    objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                    objComment.SortOrder = 6;
                    objComment.Subject = "Next Of Kin Contact No.";

                    objComments.Add(objComment);

                    objFeedback.Comments = objComments;

                    string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                    DataAccessLayer dal = new DataAccessLayer(connection);
                    int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                    if (successFlag > 0)
                    {
                        if (campaign.CampaignBase.Sendconfirmationemail.Checked == true)
                        {
                            //Data is sent to customer via email
                            SendConfirmationEmail();
                        }

                        pnlForm.Attributes.Add("style", "display:none;");
                        pnlThanks.Attributes.Add("style", "display:block;");

                        string classNames = wrapper.Attributes["class"];
                        wrapper.Attributes.Add("class", "wrapper-thanks");
                        //ClearFormFields();
                    }
                    else
                    {
                        pnlForm.Attributes.Add("style", "display:block;");
                        pnlThanks.Attributes.Add("style", "display:none;");

                        //string classNames = article.Attributes["class"];
                        //article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");

                        Log.Error(String.Format("Error storing campaign details"), this);
                    }
                }
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error storing campaign details: {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
Пример #9
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                bool blnIsValid = true;
                mm.virginactive.screportdal.Models.Image objImage = null;

                string strMIME = filename.PostedFile.ContentType;
                //validate image
                if ((filename.HasFile) && (strMIME.ToUpper() == "IMAGE/JPEG" || strMIME.ToUpper() == "IMAGE/PJPEG" || strMIME.ToUpper() == "IMAGE/JPG" || strMIME.ToUpper() == "IMAGE/GIF"))
                {
                    byte[] imageBytes = new byte[filename.PostedFile.InputStream.Length + 1];
                    filename.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length);

                    if (imageBytes.Length <= 5000000) //Check if number of bytes greater than 5mb
                    {
                        objImage = new mm.virginactive.screportdal.Models.Image();
                        //Add Image
                        objImage.CommentImageTypeID = Constants.CommentImageType.CompetitionImage;
                        objImage.SortOrder = 1;
                        objImage.Subject = "Your Story";
                        objImage.ImageFile = imageBytes;
                        objImage.ImageMIMEType = strMIME;

                        ImageFileProvided = true;
                    }
                    else
                    {
                        blnIsValid = false;
                    }
                }

                //check if we have a valid club selected
                blnIsValid = clubFindSelect.SelectedIndex != 0;

                if (blnIsValid == true)
                {
                    currentClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect.SelectedValue);

                    if (currentClub != null)
                    {
                        ClubID = currentClub.ClubId.Rendered;
                    }

                    //Store Feedback Entitiy Details
                    Feedback objFeedback = new Feedback();

                    //Store Customer Entitiy Details
                    Customer objCustomer = new Customer();
                    objCustomer.EmailAddress = email.Value;

                    string FirstName = "";
                    string Surname = "";

                    if (yourname.Value.IndexOf(" ") != -1)
                    {
                        FirstName = yourname.Value.Substring(0, yourname.Value.IndexOf(" ")).Trim();
                        Surname = yourname.Value.Substring(yourname.Value.IndexOf(" ") + 1).Trim();
                    }
                    else
                    {
                        FirstName = yourname.Value.Trim();
                    }

                    objCustomer.Firstname = FirstName;
                    objCustomer.Surname = Surname;
                    //objCustomer.HomeClubID = txtClubCode.Value;
                    objCustomer.HomeClubID = clubID;
                    objCustomer.SubscribeToNewsletter = subscribe.Checked;
                    objCustomer.TelephoneNumber = contact.Value;

                    objFeedback.Customer = objCustomer;
                    objFeedback.FeedbackSubject = "Your Story";
                    objFeedback.FeedbackSubjectDetail = "Share Your Success";
                    objFeedback.FeedbackTypeID = Constants.FeedbackType.ShareYourSuccessCompetition;
                    //objFeedback.PrimaryClubID = txtClubCode.Value;
                    objFeedback.PrimaryClubID = ClubID;
                    objFeedback.SubmissionDate = DateTime.Now;

                    //Add Comment
                    Comment objComment = new Comment();

                    objComment.CommentDetail = story.Value;
                    objComment.CommentImageTypeID = Constants.CommentImageType.CompetitionAnswer;
                    objComment.SortOrder = 1;
                    objComment.Subject = "Your Story";

                    List<Comment> objComments = new List<Comment>();
                    objComments.Add(objComment);
                    objFeedback.Comments = objComments;

                    ////Add Image
                    if (objImage != null)
                    {
                        List<mm.virginactive.screportdal.Models.Image> objImages = new List<mm.virginactive.screportdal.Models.Image>();
                        objImages.Add(objImage);
                        objFeedback.Images = objImages;
                    }

                    string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                    DataAccessLayer dal = new DataAccessLayer(connection);
                    int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                    // Successfully deleted
                    if (successFlag > 0)
                    {

                        //Data is sent to client via email
                        SendAdminEmail();

                        imageCarousel.Attributes.Add("style", "display:none;");
                        innerstory.Attributes.Add("style", "display:none;");
                        innerform.Attributes.Add("style", "display:none;");
                        formSummary.Attributes.Add("style", "display:none;");
                        formCompleted.Attributes.Add("style", "display:block;");

                        string classNames = article.Attributes["class"];
                        article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");
                        ClearFormFields();
                    }
                    else
                    {
                        imageCarousel.Attributes.Add("style", "display:none;");
                        innerstory.Attributes.Add("style", "display:none;");
                        innerform.Attributes.Add("style", "display:none;");
                        formSummary.Attributes.Add("style", "display:block;");
                        formCompleted.Attributes.Add("style", "display:none;");

                        string classNames = article.Attributes["class"];
                        article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");

                        cvFormSubmission.IsValid = false;
                        cvFormSubmission.ErrorMessage = Translate.Text("Error uploading details");
                        Log.Error(String.Format("Error storing campaign details"), this);
                    }
                }
                else
                {
                    imageCarousel.Attributes.Add("style", "display:none;");
                    innerstory.Attributes.Add("style", "display:none;");
                    innerform.Attributes.Add("style", "display:block;");
                    formSummary.Attributes.Add("style", "display:none;");
                    formCompleted.Attributes.Add("style", "display:none;");

                    string classNames = article.Attributes["class"];
                    article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");

                    cvImageSubmission.IsValid = false;
                    cvImageSubmission.ErrorMessage = Translate.Text("File size limit 5Mb");
                    cvImageSubmission.Attributes.Add("style", "display:none;");

                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error storing campaign details: {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
Пример #10
0
        private Boolean SaveDataToReportDB()
        {
            bool blnDataSaved = false;

            try
            {

                //Store Feedback Entitiy Details
                Feedback objFeedback = new Feedback();

                //Store Customer Entitiy Details
                Customer objCustomer = new Customer();
                objCustomer.EmailAddress = txtEmail.Value.Trim();
                objCustomer.Firstname = txtFirstName.Value.Trim();
                objCustomer.Surname = txtSurname.Value.Trim();
                //objCustomer.JobTitle = txtJobTitle.Value.Trim();
                //objCustomer.CompanyName = txtCompanyName.Value.Trim();
                //objCustomer.CompanyWebsite = txtCompanyWebsite.Value.Trim();
                //objCustomer.CompanyLocation = txtLocation.Value.Trim();
                //objCustomer.HomeClubID = currentClub.ClubId.Rendered;
                //objCustomer.SubscribeToNewsletter = chkSubscribe.Checked;
                objCustomer.TelephoneNumber = txtPhoneNumber.Value.Trim();
                objCustomer.AddressLine1 = txtAddressLine1.Value.Trim();
                objCustomer.AddressLine2 = txtAddressLine2.Value.Trim() != "Address Line 2" ? txtAddressLine2.Value.Trim() : "";
                objCustomer.AddressLine3 = txtAddressLine3.Value.Trim();
                objCustomer.Postcode = txtPostcode.Value.Trim();
                objCustomer.DateOfBirth = Convert.ToDateTime(txtDOBDay.Value.Trim() + "/" + txtDOBMonth.Value.Trim() + "/" + txtDOBYear.Value.Trim(), System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"));
                objCustomer.Gender = radMale.Checked ? "M" : "F";
                objFeedback.Customer = objCustomer;
                objFeedback.FeedbackSubject = "Indoor Triathlon Registration";
                objFeedback.FeedbackSubjectDetail = "Virgin Active Website";
                objFeedback.FeedbackTypeID = Constants.FeedbackType.IndoorTriathlonRegistration;
                //objFeedback.PrimaryClubID = currentClub.ClubId.Rendered;
                objFeedback.SubmissionDate = DateTime.Now;

                //Add Comment
                Comment objComment = new Comment();

                objComment.CommentDetail = clubFindSelect.SelectedItem.Text;
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 1;
                objComment.Subject = "Club";

                List<Comment> objComments = new List<Comment>();
                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = raceType;
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 2;
                objComment.Subject = "Race";

                objComments.Add(objComment);

                objComment = new Comment();
                //objComment.CommentDetail = drpExistingMembers.SelectedValue.ToString() != Translate.Text("Select") ? drpExistingMembers.SelectedValue.ToString() : "";
                objComment.CommentDetail = drpRaceDate.SelectedValue;
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 3;
                objComment.Subject = "Race Day";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = drpTimeSlot.SelectedValue;
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 4;
                objComment.Subject = "Time Slot";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = radIndividual.Checked ? "Individual" : "Team";
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 5;
                objComment.Subject = "Individual or Team";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = vaStatus;
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 6;
                objComment.Subject = "Virgin Active Status";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtTeamName.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 7;
                objComment.Subject = "Team Name";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtFirstName2.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 8;
                objComment.Subject = "Team Member 2 First Name";

                objComment = new Comment();
                objComment.CommentDetail = txtSurname2.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 9;
                objComment.Subject = "Team Member 2 Surname";

                objComments.Add(objComment);

                objComment = new Comment();
                if(txtDOBDay2.Value != "DD")
                {
                    objComment.CommentDetail = txtDOBDay2.Value.Trim() != "" ? txtDOBDay2.Value.Trim() + "/" + txtDOBMonth2.Value.Trim() + "/" + txtDOBYear2.Value.Trim() : "";
                }
                else
                {
                    objComment.CommentDetail = "";
                }
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 10;
                objComment.Subject = "Team Member 2 Date of Birth";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = radMale2.Checked ? "M" : radFemale2.Checked ? "F" : "";
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 11;
                objComment.Subject = "Team Member 2 Gender";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtFirstName3.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 12;
                objComment.Subject = "Team Member 3 First Name";

                objComment = new Comment();
                objComment.CommentDetail = txtSurname3.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 13;
                objComment.Subject = "Team Member 3 Surname";

                objComments.Add(objComment);

                objComment = new Comment();
                if (txtDOBDay3.Value != "DD")
                {
                    objComment.CommentDetail = txtDOBDay3.Value.Trim() != "" ? txtDOBDay3.Value.Trim() + "/" + txtDOBMonth3.Value.Trim() + "/" + txtDOBYear3.Value.Trim() : "";
                }
                else
                {
                    objComment.CommentDetail = "";
                }
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 14;
                objComment.Subject = "Team Member 3 Date of Birth";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = radMale3.Checked ? "M" : radFemale3.Checked ? "F" : "";
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 15;
                objComment.Subject = "Team Member 3 Gender";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtNOKFirstName.Value.Trim() + " " + txtNOKSurname.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 16;
                objComment.Subject = "Next of Kin Name";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtNOKRelationship.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 17;
                objComment.Subject = "Next of Kin Relationship";

                objComments.Add(objComment);

                objComment = new Comment();
                objComment.CommentDetail = txtNOKPhoneNumber.Value.Trim();
                objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                objComment.SortOrder = 18;
                objComment.Subject = "Next of Kin Phone Number";

                objComments.Add(objComment);

                objFeedback.Comments = objComments;

                string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                DataAccessLayer dal = new DataAccessLayer(connection);
                if (dal.SaveFeedback(Context.User.Identity.Name, currentItem.DisplayName, objFeedback) > 0)
                {
                    blnDataSaved = true;
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error saving form data to reports db: {0}", ex.Message), this);
            }

            return blnDataSaved;
        }
Пример #11
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (clubFindSelect1.SelectedIndex != 0 && clubFindSelect2.SelectedIndex != 0)
                {
                    primaryClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect1.SelectedValue);
                    secondaryClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect2.SelectedValue);

                    if (primaryClub != null && secondaryClub != null)
                    {
                        //Store Feedback Entitiy Details
                        Feedback objFeedback = new Feedback();

                        //Store Customer (Referer's) Entitiy Details
                        Customer objCustomer = new Customer();

                        objCustomer.EmailAddress = email1.Value;
                        objCustomer.Firstname = firstName1.Value;
                        objCustomer.Surname = surname1.Value;
                        objCustomer.HomeClubID = primaryClub.ClubId.Rendered;
                        objCustomer.SubscribeToNewsletter = subscribe.Checked;
                        objCustomer.TelephoneNumber = number1.Value.Trim();
                        objCustomer.MembershipNumber = memberNo.Value.Trim();

                        objFeedback.Customer = objCustomer;
                        objFeedback.FeedbackSubject = campaign.CampaignBase.Campaigntype.Raw;
                        objFeedback.FeedbackSubjectDetail = campaign.CampaignBase.Campaignname.Rendered;
                        objFeedback.FeedbackTypeID = Convert.ToInt32(campaign.CampaignBase.CampaignId.Rendered);
                        objFeedback.PrimaryClubID = primaryClub.ClubId.Rendered;
                        objFeedback.SubmissionDate = DateTime.Now;

                        //Store Referee's Details
                        List<Comment> objComments = new List<Comment>();
                        //Add Comment
                        Comment objComment = new Comment();
                        objComment.CommentDetail = secondaryClub.ClubId.Rendered;
                        objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                        objComment.SortOrder = 1;
                        objComment.Subject = "Friend's Preferred Club";

                        objComments.Add(objComment);

                        objComment = new Comment();
                        objComment.CommentDetail = firstName2.Value.Trim();
                        objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                        objComment.SortOrder = 2;
                        objComment.Subject = "Friend's First Name";

                        objComments.Add(objComment);

                        objComment = new Comment();
                        objComment.CommentDetail = surname2.Value.Trim();
                        objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                        objComment.SortOrder = 3;
                        objComment.Subject = "Friend's Surname";

                        objComments.Add(objComment);

                        objComment = new Comment();
                        objComment.CommentDetail = email2.Value.Trim();
                        objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                        objComment.SortOrder = 4;
                        objComment.Subject = "Friend's Email";

                        objComments.Add(objComment);

                        objComment = new Comment();
                        objComment.CommentDetail = number2.Value.Trim();
                        objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                        objComment.SortOrder = 5;
                        objComment.Subject = "Friend's Number";

                        objComments.Add(objComment);

                        objComment = new Comment();
                        objComment.CommentDetail = permission.Checked == true? "Y" : "N" ;
                        objComment.CommentImageTypeID = Constants.CommentImageType.QuestionnaireAnswer;
                        objComment.SortOrder = 6;
                        objComment.Subject = "Permission to be contacted";

                        objComments.Add(objComment);

                        objFeedback.Comments = objComments;

                        string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                        DataAccessLayer dal = new DataAccessLayer(connection);
                        int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                        if (successFlag > 0)
                        {

                            //Data is sent to client via email
                            SendAdminEmail();

                            if (campaign.CampaignBase.Isweblead.Checked == true)
                            {
                                //Data is sent to client via service
                                SendEnquiryDataService();
                            }

                            //get managers info
                            List<ManagerItem> staffMembers = null;
                            if (primaryClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
                            {
                                staffMembers = primaryClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));
                                primaryManager = staffMembers.First();
                            }
                            staffMembers = null;
                            if (secondaryClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
                            {
                                staffMembers = secondaryClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));
                                secondaryManager = staffMembers.First();
                            }

                            if (campaign.CampaignBase.Sendconfirmationemail.Checked == true)
                            {
                                //Data is sent to referer via email
                                SendPrimaryConfirmationEmail();

                                if (campaign.CampaignBase.Secondaryemailtemplate.Item != null)
                                {
                                    //Data is sent to referee via email
                                    SendSecondaryConfirmationEmail();
                                }
                            }

                            pnlForm.Attributes.Add("style", "display:none;");
                            pnlThanks.Attributes.Add("style", "display:block;");

                            string classNames = wrapper.Attributes["class"];
                            wrapper.Attributes.Add("class", "wrapper-thanks");
                        }
                        else
                        {

                            pnlForm.Attributes.Add("style", "display:block;");
                            pnlThanks.Attributes.Add("style", "display:none;");

                            Log.Error(String.Format("Error storing campaign details"), this);
                        }
                    }
                    else
                    {

                        pnlForm.Attributes.Add("style", "display:block;");
                        pnlThanks.Attributes.Add("style", "display:none;");

                        //string classNames = article.Attributes["class"];
                        //article.Attributes.Add("class", classNames.Length > 0 ? classNames + " ImageOverlay" : "ImageOverlay");
                    }

                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error storing campaign details: {0}", ex.Message), this);
                mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    //check if we have a valid club selected
                    Boolean blnClubSuccessfullySelected = clubFindSelect.SelectedIndex != 0;

                    currentClub = (ClubItem)Sitecore.Context.Database.GetItem(clubFindSelect.SelectedValue);

                    if (currentClub != null)
                    {
                        //Store Feedback Entitiy Details
                        Feedback objFeedback = new Feedback();

                        //Store Customer Entitiy Details
                        Customer objCustomer = new Customer();

                        string FirstName = "";
                        string Surname = "";

                        if (txtName.Value.IndexOf(" ") != -1)
                        {
                            FirstName = txtName.Value.Substring(0, txtName.Value.IndexOf(" ")).Trim();
                            Surname = txtName.Value.Substring(txtName.Value.IndexOf(" ") + 1).Trim();
                        }
                        else
                        {
                            FirstName = txtName.Value.Trim();
                        }

                        objCustomer.EmailAddress = txtEmail.Value;
                        objCustomer.Firstname = FirstName;
                        objCustomer.Surname = Surname;
                        //objCustomer.HomeClubID = txtClubCode.Value;
                        objCustomer.HomeClubID = currentClub.ClubId.Rendered;
                        objCustomer.SubscribeToNewsletter = chkSubscribe.Checked;
                        objCustomer.TelephoneNumber = txtPhone.Value;

                        objFeedback.Customer = objCustomer;
                        //objFeedback.FeedbackSubject = campaign.CampaignBase.Campaigntype.Raw;
                        objFeedback.FeedbackSubject = !String.IsNullOrEmpty(campaign.CampaignBase.Campaigntype.Raw) ? campaign.CampaignBase.Campaigntype.Raw : "";
                        objFeedback.FeedbackSubjectDetail = campaign.CampaignBase.Campaignname.Rendered;
                        objFeedback.FeedbackTypeID = Convert.ToInt32(campaign.CampaignBase.CampaignId.Rendered);
                        objFeedback.PrimaryClubID = currentClub.ClubId.Rendered;
                        objFeedback.SubmissionDate = DateTime.Now;

                        //Save to session (required for confirmation page)
                        Session["sess_FormSubmission"] = objFeedback;

                        string connection = Sitecore.Configuration.Settings.GetSetting("ConnectionString_VirginActiveReports");
                        DataAccessLayer dal = new DataAccessLayer(connection);
                        int successFlag = dal.SaveFeedback(Context.User.Identity.Name, campaign.DisplayName, objFeedback);

                        if (successFlag > 0)
                        {
                            //Data is sent to client via email
                            SendAdminEmail();

                            if (campaign.CampaignBase.Isweblead.Checked == true)
                            {
                                //Data is sent to client via service
                                SendEnquiryDataService();
                            }

                            //get managers info
                            List<ManagerItem> staffMembers = null;
                            if (currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
                            {
                                staffMembers = currentClub.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));

                                manager = staffMembers.First();
                            }

                            if (campaign.CampaignBase.Sendconfirmationemail.Checked == true)
                            {
                                //Data is sent to customer via email
                                SendConfirmationEmail();
                            }

                            //Get enquiries link
                            string ClubEnquiriesUrl = "";
                            PageSummaryItem enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm));
                            if (enqForm != null)
                            {
                                ClubEnquiriesUrl = enqForm.Url;
                            }

                            Response.Redirect(ClubEnquiriesUrl + "?action=confirm");
                        }
                        else
                        {
                            Log.Error(String.Format("Error submitting campaign form (mobile) -save to db"), this);
                        }
                    }
                    else
                    {
                        Log.Error(String.Format("Error submitting campaign form (mobile) -setting current club"), this);
                    }
                }

            }
            catch (Exception ex)
            {
                Log.Error(String.Format("Error submitting campaign form (mobile): {0}", ex.Message), this);
            }
        }