示例#1
0
        public static string GetUserEmail(string username, Int32 PortalID)
        {
            MessageManagementController objController = new MessageManagementController();
            MessageManagementInfo       objInfo       = objController.GetUserEmail(username, PortalID);

            return(objInfo.Email);
        }
示例#2
0
        public static string GetUserActivationCode(string username, Int32 PortalID)
        {
            MessageManagementController objController = new MessageManagementController();
            MessageManagementInfo       objInfo       = objController.GetUserActivationCode(username, PortalID);

            return(objInfo.UserId.ToString());
        }
 private void BindMessageToken()
 {
     try
     {
         lstMessageToken.Items.Clear();
         if (ddlMessageTemplateType.SelectedIndex != -1)
         {
             if (Int32.Parse(ddlMessageTemplateType.SelectedValue) > 0)
             {
                 MessageManagementController  objMsgController = new MessageManagementController();
                 List <MessageManagementInfo> messageTokens    = objMsgController.GetMessageTemplateTypeTokenListByMessageTemplateType(Int32.Parse(ddlMessageTemplateType.SelectedValue), GetPortalID);
                 foreach (MessageManagementInfo messageToken in messageTokens)
                 {
                     ListItem li = new ListItem(messageToken.MessageTokenKey, messageToken.MessageTokenKey);
                     lstMessageToken.Items.Add(li);
                 }
             }
         }
         if (lstMessageToken.Items.Count > 0)
         {
             lstMessageToken.SelectedIndex = 0;
             ScriptManager.RegisterStartupScript(this, this.GetType(), "InitializedMessageToken", "setMessageToken('" + lstMessageToken.SelectedValue + "');", true);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 private void EditMessageTemplate(Int32 MessageTemplateID)
 {
     try
     {
         MessageManagementController objMsgController = new MessageManagementController();
         var LINQ = objMsgController.GetMessageTemplate(MessageTemplateID, GetPortalID);
         if (LINQ.MessageTemplateTypeID > 0)
         {
             hdnMessageTemplateID.Value = MessageTemplateID.ToString();
             txtSubject.Text            = LINQ.Subject;
             txtBody.Value       = LINQ.Body;
             txtMailFrom.Text    = LINQ.MailFrom;
             chkIsActive.Checked = (LINQ.IsActive == true ? true : false);
             ddlMessageTemplateType.SelectedValue = LINQ.MessageTemplateTypeID == 0 ? MessageTemplateID.ToString():LINQ.MessageTemplateTypeID.ToString();
             Session["MessageTemplateID"]         = MessageTemplateID;
             HideAll();
             pnlMessageTemplate.Style.Add("display", "block");
             //hypAddMessageTemplateType.Style.Add("display", "none");
             //hypAddMessageTemplateToken.Style.Add("display", "none");
         }
         else
         {
             ClearNewForm();
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
示例#5
0
        /// <summary>
        /// Replaces all the messagetoken in a messagetemple with  their respective values.
        /// </summary>
        /// <param name="messageTemplate">Message template.</param>
        /// <param name="username">User's name.</param>
        /// <param name="PortalID">portalID.</param>
        /// <returns>Replaced message template.</returns>
        public static string ReplaceAllMessageToken(string messageTemplate, string username, Int32 PortalID)
        {
            MessageManagementController objController = new MessageManagementController();
            MessageManagementInfo       objInfo       = objController.GetUserDetailsByUserName(username, PortalID);

            messageTemplate = messageTemplate.Replace("##Username##", username);
            messageTemplate = messageTemplate.Replace("##UserEmail##", objInfo.Email);
            messageTemplate = messageTemplate.Replace("##UserFirstName##", objInfo.FirstName);
            messageTemplate = messageTemplate.Replace("##UserLastName##", objInfo.LastName);
            messageTemplate = messageTemplate.Replace("##HostUrl##", GetCurrnetHostURL);
            messageTemplate = messageTemplate.Replace("##UserActivationCode##", EncryptionMD5.Encrypt(objInfo.UserID.ToString()));
            return(messageTemplate);
        }
 private void DeleteMessageTemplate(Int32 MessageTemplateID)
 {
     try
     {
         MessageManagementController objMsgController = new MessageManagementController();
         objMsgController.DeleteMessageTemplate(MessageTemplateID, GetPortalID, DateTime.Now, GetUsername);
         ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "MessageTemplateIsDeletedSuccessfully"), "", SageMessageType.Success);
         BindData();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 private void BindData()
 {
     try
     {
         MessageManagementController objMsgController = new MessageManagementController();
         var LINQ = objMsgController.GetMessageTemplateList(true, false, GetPortalID, GetUsername, GetCurrentCultureName);
         grdList.DataSource = LINQ;
         grdList.DataBind();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
示例#8
0
 private void Save()
 {
     try
     {
         StringBuilder strMessage = new StringBuilder();
         if (Validate(strMessage))
         {
             MessageManagementController objMsgController = new MessageManagementController();
             string saveMsgBody = txtBody.Text.Replace(GetHostURL(), "##HostUrl##");
             if (Int32.Parse(hdnMessageTemplateID.Value) > 0)
             {
                 try
                 {
                     Int32 MessageTemplateID = Int32.Parse(Session["MessageTemplateID"].ToString());
                     objMsgController.UpdateMessageTemplate(MessageTemplateID, Int32.Parse(ddlMessageTemplateType.SelectedValue), txtSubject.Text,
                                                            saveMsgBody, txtMailFrom.Text, chkIsActive.Checked, DateTimeHelper.GetUtcTime(DateTime.Now), GetPortalID, GetUsername, GetCurrentCultureName);
                     ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "MessageTemplateIsUpdatedSuccessfully"), "", SageMessageType.Success);
                     BindData();
                     ClearForm();
                 }
                 catch
                 {
                     ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("MessageManagement", "MessageTemplateCouldnotBeUpdated"), "", SageMessageType.Error);
                 }
             }
             else
             {
                 int newMessageTemplateID = objMsgController.AddMessageTemplate(int.Parse(ddlMessageTemplateType.SelectedValue), txtSubject.Text, saveMsgBody, txtMailFrom.Text, chkIsActive.Checked, DateTimeHelper.GetUtcTime(DateTime.Now), GetPortalID, GetUsername, GetCurrentCultureName);
                 if (newMessageTemplateID > 0)
                 {
                     BindData();
                     ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "MessageTemplateIsAddedSuccessfully"), "", SageMessageType.Success);
                     ClearForm();
                 }
                 else
                 {
                     ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("MessageManagement", "MessageTemplateCouldnotBeAdded"), "", SageMessageType.Error);
                 }
             }
         }
         else
         {
             ShowMessage(SageMessageTitle.Information.ToString(), strMessage.ToString(), "", SageMessageType.Success);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            StoreID      = GetStoreID;
            PortalID     = GetPortalID;
            userName     = GetUsername;
            UserModuleId = SageUserModuleID;
            CultureName  = GetCurrentCultureName;
            IncludeCss("CustomersManagement", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css");

            if (!IsPostBack)
            {
                Session["customerRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());
                IncludeJs("CustomersManagement", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js", "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js",
                          "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/Modules/AspxCommerce/AspxCustomerManagement/js/CustomerManage.js");

                MessageManagementController  msgController = new MessageManagementController();
                List <MessageManagementInfo> template      = msgController.GetMessageTemplateTypeTokenListByMessageTemplateType(SystemSetting.USER_REGISTRATION_HELP, GetPortalID);
                foreach (MessageManagementInfo messageToken in template)
                {
                    if (template != null)
                    {
                        headerTemplate = "<div>" + messageToken.Body + "</div>";
                    }

                    //if (_member.EnableCaptcha)
                    //{
                    //    InitializeCaptcha();
                    //}
                    //else { HideCaptcha(); }
                }

                SetValidatorErrorMessage();

                var ssc = new StoreSettingConfig();
                NewCustomerRss = ssc.GetStoreSettingsByKey(StoreSetting.NewCustomerRss, StoreID, PortalID, CultureName);
                if (NewCustomerRss.ToLower() == "true")
                {
                    RssFeedUrl = ssc.GetStoreSettingsByKey(StoreSetting.RssFeedURL, StoreID, PortalID, CultureName);
                }
            }
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
 protected void btnOkMessageTemplateToken_Click(object sender, EventArgs e)
 {
     try
     {
         MessageManagementController objMsgController = new MessageManagementController();
         if (objMsgController.CheckMessgeTokenUnique(txtMessageTemplateToken.Text.TrimStart(','), Int32.Parse(ddlMessageTemplateType.SelectedValue), GetPortalID))
         {
             if (ddlMessageTemplateType.SelectedIndex != -1)
             {
                 if (Int32.Parse(ddlMessageTemplateType.SelectedValue) > 0)
                 {
                     if (txtMessageTemplateToken.Text.Trim() != "")
                     {
                         string messageTemplateTokenName = txtMessageTemplateToken.Text.TrimStart(',');
                         int    MessageTokenID           = 0;
                         MessageTokenID = objMsgController.MessageTemplateTokenAdd(MessageTokenID, Int32.Parse(ddlMessageTemplateType.SelectedValue), messageTemplateTokenName, true, DateTime.Now, GetPortalID, GetUsername);
                         if (MessageTokenID > 0)
                         {
                             ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "MessageTemplateTokenIsAddedSuccessfully"), "", SageMessageType.Success);
                             BindMessageToken();
                             //BindMessageTemplateType();
                             txtMessageTemplateToken.Text = "";
                         }
                         else
                         {
                             ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "PleaseSaveMessageTemplateTokenAgain"), "", SageMessageType.Error);
                         }
                     }
                     else
                     {
                         ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("MessageManagement", "MessageTemplateTokenIsRequiredField"), "", SageMessageType.Alert);
                     }
                 }
             }
         }
         else
         {
             mpeMessageTemplateToken.Show();
             lblErrorMessageTemplateToken.Text = GetSageMessage("MessageManagement",
                                                                "UniqueMessageTemplateTokenIsRequired");
             lblErrorMessageTemplateToken.Visible = true;
             //ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("MessageManagement", "UniqueMessageTemplateTokenIsRequired"), "", SageMessageType.Alert);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 private void BindMessageTemplateType()
 {
     try
     {
         CommonFunction comm = new CommonFunction();
         MessageManagementController objMsgController = new MessageManagementController();
         var       LINQ           = objMsgController.GetMessageTemplateTypeList(true, false, GetPortalID, GetUsername, GetCurrentCultureName);
         DataTable dtTemplateType = comm.LINQToDataTable(LINQ);
         ddlMessageTemplateType.DataSource     = dtTemplateType;
         ddlMessageTemplateType.DataTextField  = "CultureName";
         ddlMessageTemplateType.DataValueField = "MessageTemplateTypeID";
         ddlMessageTemplateType.DataBind();
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
示例#12
0
 protected void btnOkMessageTemplateType_Click(object sender, EventArgs e)
 {
     try
     {
         MessageManagementController objMsgController = new MessageManagementController();
         if (objMsgController.CheckMessgeTemplateUnique(txtMessageTemplateType.Text.TrimStart(','), GetPortalID))
         {
             if (txtMessageTemplateType.Text.Trim() != "")
             {
                 string messageTemplateTypeName = txtMessageTemplateType.Text.TrimStart(',');
                 int    MessageTemplateTypeID   = 0;
                 MessageTemplateTypeID = objMsgController.AddMessageTemplateType(messageTemplateTypeName, true, DateTimeHelper.GetUtcTime(DateTime.Now), GetPortalID, GetUsername);
                 if (MessageTemplateTypeID > 0)
                 {
                     ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "MessageTemplateIsAddedSuccessfully"), "", SageMessageType.Success);
                     BindMessageTemplateType();
                     txtMessageTemplateType.Text = "";
                     ClearNewForm();
                 }
                 else
                 {
                     ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("MessageManagement", "PleaseSaveMessageTemplateTypeAgain"), "", SageMessageType.Error);
                 }
             }
             else
             {
                 ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("MessageManagement", "MessageTemplateTypeIsRequiredField"), "", SageMessageType.Alert);
             }
         }
         else
         {
             mpeMessageTemplateType.Show();
             lblErrorMessageTemplateType.Text = GetSageMessage("MessageManagement",
                                                               "UniqueMessageTemplateTypeIsRequired");
             lblErrorMessageTemplateType.Visible = true;
             // ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("MessageManagement", "UniqueMessageTemplateTypeIsRequired"), "", SageMessageType.Alert);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
示例#13
0
        private void SendEmailForSharedWishList(AspxCommonInfo aspxCommonObj, WishItemsEmailInfo wishlistObj)
        {
            string serverHostLoc = "http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";
            string tdContent     = string.Empty;
            var    dataObj       = JSONHelper.Deserialise <List <WishItemEmailInfo> >(wishlistObj.MessageBody);
            int    length        = dataObj.Count();

            string[] tdContentArray    = new string[length];
            string   shareWishMailHtml = "";

            shareWishMailHtml += "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td>";
            shareWishMailHtml += "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>";
            for (int i = 0; i <= length - 1; i++)
            {
                tdContent +=
                    "<td width='33%'><div style='border:1px solid #cfcfcf; background:#f1f1f1; padding:10px; text-align:center;'> <img src='" +
                    serverHostLoc + dataObj[i].src + "' alt='" + dataObj[i].alt + "' width='80' height='50' />";
                tdContent +=
                    "<p style='margin:0; padding:5px 0 0 0; font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; line-height:18px;'>";
                tdContent +=
                    "<span style='font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif; text-shadow:1px 1px 0 #fff;'>" +
                    dataObj[i].title + "</span><br />"; //item name
                tdContent +=
                    "<span style='font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif; text-shadow:1px 1px 0 #fff;'> <a href='" +
                    serverHostLoc + dataObj[i].href + "'>" + dataObj[i].hrefHtml + "</a></span><br />"; //item name
                tdContent +=
                    "<span style='font-weight:bold; font-size:11px; font-family:Arial, Helvetica, sans-serif; text-shadow:1px 1px 0 #fff;'>Price:</span>" +
                    dataObj[i].price + "<br />"; //price
                tdContent +=
                    "<span style='font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif; text-shadow:1px 1px 0 #fff;'>Comments:</span> " +
                    dataObj[i].htmlComment + "</p></div></td>"; //comment
                tdContentArray[i] = tdContent;
                tdContent         = "";
            }
            for (int j = 0; j <= length - 1; j++)
            {
                if (j % 3 == 0)
                {
                    shareWishMailHtml += "</tr><tr>" + tdContentArray[j];
                }
                else
                {
                    shareWishMailHtml += tdContentArray[j];
                }
            }
            shareWishMailHtml += "</tr></table></td></tr></table>";
            StoreSettingConfig ssc     = new StoreSettingConfig();
            string             logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, aspxCommonObj.StoreID,
                                                                   aspxCommonObj.PortalID, aspxCommonObj.CultureName);
            List <MessageManagementInfo> template =
                MessageManagementController.GetMessageTemplateByMessageTemplateTypeID(
                    SystemSetting.SHARED_WISHED_LIST, aspxCommonObj.PortalID);

            foreach (MessageManagementInfo messageToken in template)
            {
                string messageTemplate = messageToken.Body.ToString();
                string src             = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";
                if (template != null)
                {
                    string[] tokens = GetAllToken(messageTemplate);
                    foreach (string token in tokens)
                    {
                        switch (token)
                        {
                        case "%DateTime%":
                            messageTemplate = messageTemplate.Replace(token,
                                                                      System.DateTime.Now.ToString("MM/dd/yyyy"));
                            break;

                        case "%Username%":
                            messageTemplate = messageTemplate.Replace(token, wishlistObj.SenderName);
                            break;

                        case "%UserEmail%":
                            messageTemplate = messageTemplate.Replace(token, wishlistObj.SenderEmail);
                            break;

                        case "%MessageDetails%":
                            messageTemplate = messageTemplate.Replace(token, wishlistObj.Message);
                            break;

                        case "%ItemDetailsTable%":
                            messageTemplate = messageTemplate.Replace(token, shareWishMailHtml);
                            break;

                        case "%LogoSource%":
                            string imgSrc = "http://" + src + logosrc;
                            messageTemplate = messageTemplate.Replace(token, imgSrc);
                            break;

                        case "%ServerPath%":
                            messageTemplate = messageTemplate.Replace(token, "http://" + src);
                            break;

                        case "%DateYear%":
                            messageTemplate = messageTemplate.Replace(token, System.DateTime.Now.Year.ToString());
                            break;
                        }
                    }
                }

                char[]   spliter     = { ',' };
                string[] receiverIDs = wishlistObj.ReceiverEmail.Split(spliter);

                for (int i = 0; i < receiverIDs.Length; i++)
                {
                    string          receiverEmailID = receiverIDs[i];
                    string          emailSuperAdmin;
                    string          emailSiteAdmin;
                    SageFrameConfig pagebase = new SageFrameConfig();
                    emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);
                    emailSiteAdmin  = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);
                    MailHelper.SendMailNoAttachment(wishlistObj.SenderEmail, receiverEmailID, wishlistObj.Subject,
                                                    messageTemplate,
                                                    emailSiteAdmin, emailSuperAdmin);
                }
            }
        }
        public void SendMailNotificatiion(int storeId, int portalId, string cultureName, BookAppointmentInfo objInfo)
        {
            StoreSettingConfig ssc     = new StoreSettingConfig();
            string             logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeId, portalId, cultureName);
            string             name    = "Appointment Approval - Email";
            List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();

            parameter.Add(new KeyValuePair <string, object>("@PortalID", portalId));
            parameter.Add(new KeyValuePair <string, object>("@CultureName", cultureName));
            parameter.Add(new KeyValuePair <string, object>("@MessageTemplateTypeName", name));
            SQLHandler sql = new SQLHandler();

            int messageTemplateTypeId = sql.ExecuteNonQuery("[dbo].[usp_Aspx_GetMessageTemplateTypeID]", parameter, "@MessageTemplateID");
            MessageManagementController msgController = new MessageManagementController();
            var template = msgController.GetMessageTemplate(messageTemplateTypeId, portalId);

            string messageTemplate = template.Body;
            string src             = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";

            string receiverEmailID = objInfo.Email;
            string subject         = template.Subject;
            string senderEmail     = template.MailFrom;
            var    headerMsg       = string.Empty;
            var    customMessage   = "";

            if (objInfo.AppointmentID > 0)
            {
                headerMsg = "status has been modified as follow.";
            }
            else if (objInfo.AppointmentID == 0)
            {
                headerMsg = "has been scheduled as following date and time.";
            }
            if (template != null)
            {
                string[] tokens = GetAllToken(messageTemplate);
                foreach (var token in tokens)
                {
                    switch (token)
                    {
                    case "%LogoSource%":
                        string imgSrc = src + logosrc;
                        messageTemplate = messageTemplate.Replace(token, imgSrc);
                        break;

                    case "%DateTime%":
                        messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("MM/dd/yyyy"));
                        break;

                    case "%PreferredDate%":
                        messageTemplate = messageTemplate.Replace(token, objInfo.PreferredDate.ToString("MM/dd/yyyy"));
                        break;

                    case "%PreferredTime%":
                        messageTemplate = messageTemplate.Replace(token, objInfo.PreferredTime);
                        break;

                    case "%PreferredTimeInterval%":
                        messageTemplate = messageTemplate.Replace(token, objInfo.PreferredTimeInterval);
                        break;

                    case "%AppointmentStatus%":
                        messageTemplate = messageTemplate.Replace(token, objInfo.AppointmentStatusName);
                        break;

                    case "%ServerPath%":
                        messageTemplate = messageTemplate.Replace(token, src);
                        break;

                    case "%DateYear%":
                        messageTemplate = messageTemplate.Replace(token, System.DateTime.Now.Year.ToString());
                        break;

                    case "%AppointmentHeadingMessage%":
                        messageTemplate = messageTemplate.Replace(token, headerMsg);
                        break;

                    case "%AppointmentCustomMessage%":
                        messageTemplate = messageTemplate.Replace(token, customMessage);
                        break;

                    case "%ServiceProductName%":
                        messageTemplate = messageTemplate.Replace(token, objInfo.ServiceProductName);
                        break;
                    }
                }
            }

            SageFrameConfig pagebase        = new SageFrameConfig();
            string          emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);
            string          emailSiteAdmin  = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);

            MailHelper.SendMailNoAttachment(senderEmail, receiverEmailID, subject, messageTemplate, emailSiteAdmin, emailSuperAdmin);
        }