/// <summary>
        /// Generate the forgotten password E-Mail to be sent by the monitor based on the current customer request
        /// </summary>
        private void generateEmail()
        {
            TalentEmail talEmail       = new TalentEmail();
            string      xmlDoc         = string.Empty;
            string      email          = string.Empty;
            string      customerNumber = string.Empty;
            string      loginURL       = string.Empty;
            string      token          = string.Empty;

            //Assign the variables necessary
            if (_doTokenHashing)
            {
                token = _dtCustomerResults.Rows[0]["ResetToken"].ToString().Trim();
            }
            email          = _dtCustomerResults.Rows[0]["EmailAddress"].ToString().Trim();
            customerNumber = _dtCustomerResults.Rows[0]["CustomerNumber"].ToString();
            xmlDoc         = talEmail.CreateForgottenPasswordXmlDocument(Environment.Settings.DefaultValues.ForgottenPasswordFromEmail, email, string.Empty, string.Empty, Environment.Settings.Partner, customerNumber, token);
            //Add the record to tbl_offline_processing
            TDataObjects.AppVariableSettings.TblOfflineProcessing.Insert(Environment.Settings.BusinessUnit, "*ALL", "Pending", 0, "", "EmailMonitor", "ForgottenPassword", xmlDoc, "");
        }
示例#2
0
        /// <summary>
        /// Send Question & Answer reminder email
        /// </summary>
        /// <param name="inputModel">Object of HospitalityBookingEnquiryInputModel</param>
        /// <returns>Object of HospitalityBookingEnquiryViewModel</returns>
        public HospitalityBookingEnquiryViewModel SendQAndAReminder(HospitalityBookingEnquiryInputModel inputModel)
        {
            HospitalityBookingEnquiryViewModel viewModel = RetrieveHospitalityBookings(inputModel);
            ErrorObj   err      = new ErrorObj();
            DESettings settings = Environment.Settings.DESettings;
            List <HospitalityBookingEnquiryDetails> hospitalityBookingList = viewModel.HospitalityBookingEnquiryList;
            int affectedRow = 0;

            for (int i = 0; i < inputModel.CallIdList.Count; i++)
            {
                HospitalityBookingEnquiryDetails hospitalityBookingEnquiry = new HospitalityBookingEnquiryDetails();
                hospitalityBookingEnquiry = hospitalityBookingList.FirstOrDefault(h => h.BookingRef.ToString() == inputModel.CallIdList[i]);
                if (hospitalityBookingEnquiry.Status == GlobalConstants.SOLD_BOOKING_STATUS && hospitalityBookingEnquiry.QAndAStatus == GlobalConstants.QANDA_STATUS_INCOMPLETE)
                {
                    TalentEmail talEmail       = new TalentEmail();
                    string      xmlDoc         = string.Empty;
                    string      email          = string.Empty;
                    string      customerNumber = hospitalityBookingEnquiry.TicketingCustomerMember;
                    string      bookingURL     = string.Empty;
                    string      callId         = inputModel.CallIdList[i];
                    string      templateId     = string.Empty;
                    inputModel.CallID         = Convert.ToDecimal(inputModel.CallIdList[i]);
                    inputModel.CustomerNumber = customerNumber;
                    DataSet dsCustomerDetails = new DataSet();
                    dsCustomerDetails = retrieveCustomerDetails(inputModel);
                    viewModel.Error   = Data.PopulateErrorObject(err, dsCustomerDetails, settings, 2);
                    if (!viewModel.Error.HasError)
                    {
                        DataTable dt     = dsCustomerDetails.Tables["CustomerResults"];
                        DataRow   drUser = dt.Rows[0];
                        email      = drUser["EmailAddress"].ToString().Trim();
                        bookingURL = String.Concat("/PagesPublic/Hospitality/HospitalityBooking.aspx", "?callid=", callId, "&status=", GlobalConstants.SOLD_BOOKING_STATUS);
                        //Get the data from tbl_email_templates
                        DataTable dtemailTemplatesDefinition = TDataObjects.EmailTemplateSettings.TblEmailTemplates.GetAll();
                        if (dtemailTemplatesDefinition != null)
                        {
                            DataRow emailTemplateRow = dtemailTemplatesDefinition.AsEnumerable().FirstOrDefault(r => r.Field <string>("TEMPLATE_TYPE") == GlobalConstants.EMAIL_HOSPITALITY_Q_AND_A_REMINDER);
                            templateId = emailTemplateRow["MASTER"].ToString();
                        }
                        else
                        {
                            templateId = string.Empty;
                        }
                        //Below XML creation will be part of next user story - so comment it temporary
                        xmlDoc = talEmail.CreateHospitalityQAReminderXmlDocument(Environment.Settings.DefaultValues.DefaultTicketingEmailAddress, email, string.Empty, string.Empty, Environment.Settings.Partner, customerNumber, bookingURL, callId, templateId);
                        //Add the record to tbl_offline_processing
                        affectedRow = TDataObjects.AppVariableSettings.TblOfflineProcessing.Insert(Environment.Settings.BusinessUnit, "*ALL", "Pending", 0, "", "EmailMonitor", "HospitalityQ&AReminder", xmlDoc, "");
                        if (affectedRow > 0)
                        {
                            viewModel.SuccessfullySentQAndAReminder = true;
                        }
                        else
                        {
                            viewModel.Error.HasError = true;
                            viewModel.SuccessfullySentQAndAReminder = false;
                        }
                    }
                    else
                    {
                        viewModel.SuccessfullySentQAndAReminder = false;
                    }
                }
            }
            return(viewModel);
        }