Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
             SageFrameConfig pb = new SageFrameConfig();
             hypGotoLogin.NavigateUrl = "~/" + pb.GetSettingsByKey(SageFrameSettingKeys.PlortalLoginpage) + ".aspx";
             hypGotoLogin.Text = GetSageMessage("UserRegistration", "GoToLogin");
             string ActivationCode = string.Empty;
             if (Request.QueryString["ActivationCode"] != null)
             {
                 ActivationCode = Request.QueryString["ActivationCode"].ToString();
                 try
                 {
                     ActivationCode = EncryptionMD5.Decrypt(ActivationCode);
                 }
                 catch
                 {
                     ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "InvalidActivationCode"), "", SageMessageType.Alert);
                 }
                 string UserName = _member.ActivateUser(ActivationCode, GetPortalID, GetStoreID);
                 if (!String.IsNullOrEmpty(UserName))
                 {
                     UserInfo user = _member.GetUserDetails(GetPortalID, UserName);
                     var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID);
                     foreach (var messageTemplate in messageTemplates)
                     {
                         var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID);
                         CommonFunction comm = new CommonFunction();
                         DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues);
                         string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues);
                         string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues);
                         MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                     }
                     var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                     if (template != null)
                     {
                         ACTIVATION_INFORMATION.Text = template.Body;
                     };
                     LogInPublicModeRegistration(user);
                 }
                 else
                 {
                     var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_FAIL_INFORMATION, GetPortalID).SingleOrDefault();
                     if (template != null)
                     {
                         ACTIVATION_INFORMATION.Text = template.Body;
                     };
                 }
             }
         }
         catch (Exception ex)
         {
             ProcessException(ex);
         }
     }
 }
        public void HandlePostRegistration(int UserRegistrationType, MessageTemplateDataContext dbMessageTemplate, int customerId)
        {
            switch (UserRegistrationType)
            {
            case 0:
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_NONE, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                }
                break;

            case 1:
                template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PRIVATE, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                }
                CheckDivVisibility(false, true);

                break;

            case 3:
                template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_VERIFIED, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                }

                foreach (var messageTemplate in dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACCOUNT_ACTIVATION_EMAIL, GetPortalID))
                {
                    CommonFunction comm = new CommonFunction();
                    DataTable      dtActivationTokenValues = comm.LINQToDataTable(messageTokenDB.sp_GetActivationTokenValue(UserName.Text, GetPortalID));
                    string         replaceMessageSubject   = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationTokenValues);
                    string         replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationTokenValues);
                    MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, Email.Text, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                }
                //ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "UserRegistrationSuccessPublic"), "", SageMessageType.Success);
                CheckDivVisibility(false, true);


                break;

            case 2:
                template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PUBLIC, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                }
                LogInPublicModeRegistration();
                //update Cart for that User in AspxCommerce
                UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, customerId, sessionCode);
                break;
            }
        }
Exemplo n.º 3
0
        private void SendActivateMail(UserInfo user)
        {
            var dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);

            var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID);

            foreach (var messageTemplate in messageTemplates)
            {
                var            linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID);
                CommonFunction comm = new CommonFunction();
                DataTable      dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues);
                string         replaceMessageSubject             = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues);
                string         replacedMessageTemplate           = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues);
                try
                {
                    MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                }
                catch (Exception)
                {
                    ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert);
                    return;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (HttpContext.Current.Session.SessionID != null)
                {
                    sessionCode = HttpContext.Current.Session.SessionID.ToString();
                }

                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_REGISTRATION_HELP, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    headerTemplate = "<div>" + template.Body + "</div>";
                }
                if (!IsPostBack)
                {
                    if (_member.EnableCaptcha)
                    {
                        InitializeCaptcha();
                    }
                    else { HideCaptcha(); }
                    SetValidatorErrorMessage();
                    CheckDivVisibility(true, false);

                }
                LoginPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PlortalLoginpage) + ".aspx");

            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemplo n.º 5
0
        public static void SendEmailForReferFriend(int storeId, int portalId, string cultureName, string senderName, string senderEmail, string receiverEmailID, string subject, string message, string messageBodyDetail)
        {
            StoreSettingConfig         ssc               = new StoreSettingConfig();
            string                     logosrc           = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeId, portalId, cultureName);
            MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            MessageTokenDataContext    messageTokenDB    = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
            var    template        = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.REFER_A_FRIEND_EMAIL, portalId).SingleOrDefault();
            string messageTemplate = template.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, senderName);
                        break;

                    //case "%senderEmail%":
                    //    messageTemplate = messageTemplate.Replace(token, senderEmail);
                    //    break;
                    case "%MessageDetails%":
                        messageTemplate = messageTemplate.Replace(token, message);
                        break;

                    case "%ItemDetailsTable%":
                        messageTemplate = messageTemplate.Replace(token, messageBodyDetail);
                        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;
                    }
                }
            }

            string          emailSuperAdmin;
            string          emailSiteAdmin;
            SageFrameConfig pagebase = new SageFrameConfig();

            emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);
            emailSiteAdmin  = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);
            MailHelper.SendMailNoAttachment(senderEmail, receiverEmailID, subject, messageTemplate, emailSiteAdmin, emailSuperAdmin);
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
     var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_HELP, GetPortalID).SingleOrDefault();
     if (template != null)
     {
         helpTemplate = template.Body;
     }
     if (!IsPostBack)
     {
         string RecoveringCode = string.Empty;
         if (Request.QueryString["RecoveringCode"] != null)
         {
             RecoveringCode = Request.QueryString["RecoveringCode"].ToString();
             try
             {
                 RecoveringCode = EncryptionMD5.Decrypt(RecoveringCode);
                 hdnRecoveryCode.Value = RecoveringCode;
                 AddImageUrls();
             }
             catch
             {
                 ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "InvalidRecoveringCode"), "", SageMessageType.Alert);
             }
         }
         else
         {
             ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "RecoveringCodeIsNotAvailable"), "", SageMessageType.Error);
         }
         SetValidatorErrorMessage();
     }
 }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            storeID = GetStoreID;
            portalID = GetPortalID;
            userName = GetUsername;
            cultureName = GetCurrentCultureName;
            if (!IsPostBack)
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_REGISTRATION_HELP, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    headerTemplate = "<div>" + template.Body + "</div>";
                }

                if (_member.EnableCaptcha)
                {
                    InitializeCaptcha();
                }
                else { HideCaptcha(); }
                SetValidatorErrorMessage();
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtUsername.Focus();
            var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_FORGET_HELP, GetPortalID).SingleOrDefault();

            if (template != null)
            {
                helpTemplate = "<b>" + template.Body + "</b>";
            }

            IsUseFriendlyUrls = pb.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
            if (!IsPostBack)
            {
                SetValidatorErrorMessage();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_HELP, GetPortalID).SingleOrDefault();
            if (template != null)
            {
                helpTemplate = template.Body;
            }
            if (!IsPostBack)
            {
                string RecoveringCode = string.Empty;
                if (Request.QueryString["RecoveringCode"] != null)
                {
                    RecoveringCode = Request.QueryString["RecoveringCode"].ToString();
                    try
                    {
                        RecoveringCode = EncryptionMD5.Decrypt(RecoveringCode);
                        hdnRecoveryCode.Value = RecoveringCode;
                        AddImageUrls();
                        UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString);
                        var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(hdnRecoveryCode.Value, GetPortalID).SingleOrDefault();
                        if (sageframeuser.CodeForUsername != null)
                        {
                            if ((bool)(sageframeuser.IsAlreadyUsed))
                            {
                                ShowMessage("", GetSageMessage("PasswordRecovery", "RecoveryCodeAlreadyActivated"), "", SageMessageType.Alert);
                                divRecoverpwd.Visible = false;

                            }
                            else
                            {
                                divRecoverpwd.Visible = true;
                            }
                        }
                        else
                        {

                            divRecoverpwd.Visible = false;
                            ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert);
                        }
                    }
                    catch
                    {
                        ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "InvalidRecoveringCode"), "", SageMessageType.Alert);
                        divRecoverpwd.Visible = false;
                    }
                }
            
                else
                {
                    ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "RecoveringCodeIsNotAvailable"), "", SageMessageType.Error);
                    divRecoverpwd.Visible = false;
                }
                SetValidatorErrorMessage();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (HttpContext.Current.Session.SessionID != null)
         {
             sessionCode = HttpContext.Current.Session.SessionID.ToString();
         }
         FirstName.Focus();
         IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
         if (IsUseFriendlyUrls)
         {
             if (GetPortalID > 1)
             {
                 LoginPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
             }
             else
             {
                 LoginPath = ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
             }
         }
         else
         {
             LoginPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage));
         }
         CheckUserRegistrationType();
         if (GetUsername != "anonymoususer")
         {
             Response.Redirect(LoginPath, false);
         }
         MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
         var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_REGISTRATION_HELP, GetPortalID).SingleOrDefault();
         if (template != null)
         {
             headerTemplate = "<div>" + template.Body + "</div>";
         }
         if (!IsPostBack)
         {
             if (_member.EnableCaptcha)
             {
                 InitializeCaptcha();
             }
             else
             {
                 HideCaptcha();
             }
             SetValidatorErrorMessage();
             CheckDivVisibility(true, false);
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_HELP, GetPortalID).SingleOrDefault();

            if (template != null)
            {
                helpTemplate = template.Body;
            }
            if (!IsPostBack)
            {
                string RecoveringCode = string.Empty;
                if (Request.QueryString["RecoveringCode"] != null)
                {
                    RecoveringCode = Request.QueryString["RecoveringCode"].ToString();
                    try
                    {
                        RecoveringCode        = EncryptionMD5.Decrypt(RecoveringCode);
                        hdnRecoveryCode.Value = RecoveringCode;
                        AddImageUrls();
                        UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString);
                        var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(hdnRecoveryCode.Value, GetPortalID).SingleOrDefault();
                        if (sageframeuser.CodeForUsername != null)
                        {
                            if ((bool)(sageframeuser.IsAlreadyUsed))
                            {
                                ShowMessage("", GetSageMessage("PasswordRecovery", "RecoveryCodeAlreadyActivated"), "", SageMessageType.Alert);
                                divRecoverpwd.Visible = false;
                            }
                            else
                            {
                                divRecoverpwd.Visible = true;
                            }
                        }
                        else
                        {
                            divRecoverpwd.Visible = false;
                            ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert);
                        }
                    }
                    catch
                    {
                        ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "InvalidRecoveringCode"), "", SageMessageType.Alert);
                        divRecoverpwd.Visible = false;
                    }
                }

                else
                {
                    ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "RecoveringCodeIsNotAvailable"), "", SageMessageType.Error);
                    divRecoverpwd.Visible = false;
                }
                SetValidatorErrorMessage();
            }
        }
    // public bool refresh = false;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            StoreID     = GetStoreID;
            PortalID    = GetPortalID;
            userName    = GetUsername;
            CultureName = GetCurrentCultureName;
            if (!IsPostBack)
            {
                Session["customerRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());            // Assign the Session["update"] with unique value

                IncludeCss("CustomersManagement", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css");
                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");

                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_REGISTRATION_HELP, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    headerTemplate = "<div>" + template.Body + "</div>";
                }

                //if (_member.EnableCaptcha)
                //{
                //    InitializeCaptcha();
                //}
                //else { HideCaptcha(); }
                SetValidatorErrorMessage();
            }
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
   // public bool refresh = false;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            StoreID = GetStoreID;
            PortalID = GetPortalID;
            userName = GetUsername;
            CultureName = GetCurrentCultureName;
            if (!IsPostBack)
            {
			 Session["customerRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());   // Assign the Session["update"] with unique value

                IncludeCss("CustomersManagement", "/Templates/" + TemplateName + "/css/GridView/tablesort.css", "/Templates/" + TemplateName + "/css/MessageBox/style.css");
                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");

                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_REGISTRATION_HELP, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    headerTemplate = "<div>" + template.Body + "</div>";
                }

                //if (_member.EnableCaptcha)
                //{
                //    InitializeCaptcha();
                //}
                //else { HideCaptcha(); }
                SetValidatorErrorMessage();                
            }           
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Exemplo n.º 14
0
        public static void SendEmailForOrder(int portalID, OrderDetailsCollection orderdata, string addressPath, string templateName, string transID)
        {
            StoreSettingConfig ssc = new StoreSettingConfig();
            // sendEmailFrom = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
            string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string logosrc         = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string inquiry         = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string storeName       = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);

            if (bool.Parse(sendOrderNotice))
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                MessageTokenDataContext    messageTokenDB    = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                SageFrameConfig            pagebase          = new SageFrameConfig();
                var    template        = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_PLACED, portalID).SingleOrDefault();
                string messageTemplate = template.Body;
                if (template != null)
                {
                    string[] tokens = GetAllToken(messageTemplate);
                    foreach (string token in tokens)
                    {
                        switch (token)
                        {
                        case "%OrderRemarks%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.Remarks);
                            break;

                        case "%InvoiceNo%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.InvoiceNumber);
                            break;

                        case "%OrderID%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.OrderID.ToString());
                            break;

                        case "%BillingAddress%":
                            string billing = orderdata.ObjBillingAddressInfo.FirstName.ToString() + " " +
                                             orderdata.ObjBillingAddressInfo.LastName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";

                            if (orderdata.ObjBillingAddressInfo.CompanyName != null)
                            {
                                billing += orderdata.ObjBillingAddressInfo.CompanyName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                            }

                            billing += orderdata.ObjBillingAddressInfo.City.ToString() + ", " + orderdata.ObjBillingAddressInfo.Address.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                       orderdata.ObjBillingAddressInfo.Country.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                       orderdata.ObjBillingAddressInfo.EmailAddress.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                       orderdata.ObjBillingAddressInfo.Phone.ToString();
                            messageTemplate = messageTemplate.Replace(token, billing);
                            break;

                        case "%ShippingAddress%":
                            string shipping = "";
                            if (!orderdata.ObjOrderDetails.IsDownloadable)
                            {
                                if (orderdata.ObjOrderDetails.IsMultipleCheckOut == false)
                                {
                                    shipping = orderdata.ObjShippingAddressInfo.FirstName.ToString() + " " +
                                               orderdata.ObjShippingAddressInfo.LastName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    if (orderdata.ObjShippingAddressInfo.CompanyName != null)
                                    {
                                        shipping += orderdata.ObjShippingAddressInfo.CompanyName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    }

                                    shipping += orderdata.ObjShippingAddressInfo.City.ToString() + ", " + orderdata.ObjShippingAddressInfo.Address.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                orderdata.ObjShippingAddressInfo.Country.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                orderdata.ObjShippingAddressInfo.EmailAddress.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                                orderdata.ObjShippingAddressInfo.Phone.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }
                                else
                                {
                                    shipping = "Multiple addresses<br />Plese log in to view." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }
                            }
                            else
                            {
                                shipping = "Your Ordered Item is Downloadable Item." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                            }

                            messageTemplate = messageTemplate.Replace(token, shipping);
                            break;

                        case "%UserFirstName%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.FirstName);
                            break;

                        case "%UserLastName%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.LastName);
                            break;

                        case "%TransactionID%":
                            messageTemplate = messageTemplate.Replace(token, transID);
                            break;

                        case "%PaymentMethodName%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjPaymentInfo.PaymentMethodName);
                            break;

                        case "%DateTimeDay%":
                            messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("dddd, dd MMMM yyyy"));
                            break;

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

                        case "%CustomerID%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.CustomerID.ToString());
                            break;

                        case "%PhoneNo%":
                            messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.Phone);
                            break;

                        case "%AccountLogin%":
                            string account = "";
                            if (orderdata.ObjCommonInfo.AddedBy.ToString().ToLower() == "anonymoususer" && orderdata.ObjOrderDetails.CustomerID == 0)
                            {       // future login process for annoymoususr
                                account += "Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                account += "<a  style=\"color: rgb(39, 142, 230);\"  href=" + addressPath + "User-Registration.aspx" + ">account</a>";
                            }
                            else
                            {
                                account += "  Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                account += " <a style=\"color: rgb(39, 142, 230);\"  href=" + addressPath + "Login.aspx" + ">account</a>";
                            }
                            messageTemplate = messageTemplate.Replace(token, account);
                            break;

                        case "%LogoSource%":
                            // string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Templates/" + templateName + "/images/aspxcommerce.png";
                            string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                            messageTemplate = messageTemplate.Replace(token, src);
                            break;

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

                            break;

                        case "%InquiryEmail%":
                            string x =
                                "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                inquiry + "\" >" + inquiry + "</a>";
                            messageTemplate = messageTemplate.Replace(token, x);
                            break;

                        case "%StoreName%":
                            messageTemplate = messageTemplate.Replace(token, storeName);
                            break;
                        }
                    }
                    // return messageTemplate;
                    MailHelper.SendMailNoAttachment(template.MailFrom, orderdata.ObjBillingAddressInfo.EmailAddress, template.Subject, messageTemplate, string.Empty, string.Empty);
                }
            }
        }
Exemplo n.º 15
0
        protected void wzdPasswordRecover_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            try
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                if (txtPassword.Text != null && txtRetypePassword.Text != "" && txtRetypePassword.Text == txtPassword.Text)
                {
                    if (txtPassword.Text.Length < 4)
                    {
                        ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PasswordLength"), "", SageMessageType.Alert);
                        e.Cancel = true;
                    }
                    else
                    {
                        if (hdnRecoveryCode.Value != "")
                        {
                            UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString);
                            var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(hdnRecoveryCode.Value, GetPortalID).SingleOrDefault();
                            if (sageframeuser != null)
                            {
                                MembershipController m = new MembershipController();
                                UserInfo sageUser = m.GetUserDetails(GetPortalID, sageframeuser.CodeForUsername);
                                //MembershipUser user = Membership.GetUser(sageframeuser.CodeForUsername);
                                string Password, PasswordSalt;
                                PasswordHelper.EnforcePasswordSecurity(m.PasswordFormat, txtPassword.Text, out Password, out PasswordSalt);
                                UserInfo user1 = new UserInfo(sageUser.UserID, Password, PasswordSalt, m.PasswordFormat);
                                m.ChangePassword(user1);
                                //string oldPassword = user.ResetPassword();

                                //user.ChangePassword(oldPassword, txtPassword.Text);

                                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                                if (template != null)
                                {
                                    ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                                }
                                var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCCESSFUL_EMAIL, GetPortalID);
                                foreach (var messageTemplate in messageTemplates)
                                {
                                    MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                                    var messageTokenValues = messageTokenDB.sp_GetPasswordRecoverySuccessfulTokenValue(sageUser.UserName, GetPortalID);
                                    CommonFunction comm = new CommonFunction();
                                    DataTable dtTokenValues = comm.LINQToDataTable(messageTokenValues);
                                    string replacedMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtTokenValues);
                                    string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtTokenValues);
                                    MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, sageUser.Email, replacedMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                                }
                            }
                            else
                            {
                                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                                if (template != null)
                                {
                                    ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                                }
                                e.Cancel = true;
                                ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UnknownErrorPleaseTryAgaing"), "", SageMessageType.Alert);
                            }
                        }
                        else
                        {
                            var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                            if (template != null)
                            {
                                ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                            }
                            e.Cancel = true;
                            ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UnknownError"), "", SageMessageType.Alert);
                        }
                    }
                }
                else
                {
                    ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PleaseEnterAllRequiredFields"), "", SageMessageType.Alert);
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemplo n.º 16
0
        protected void wzdPasswordRecover_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            try
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                if (txtPassword.Text != null && txtRetypePassword.Text != "" && txtRetypePassword.Text == txtPassword.Text)
                {
                    if (txtPassword.Text.Length < 4)
                    {
                        ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PasswordLength"), "", SageMessageType.Alert);
                        e.Cancel = true;
                    }
                    else
                    {
                        if (hdnRecoveryCode.Value != "")
                        {
                            UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString);
                            var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(hdnRecoveryCode.Value, GetPortalID).SingleOrDefault();
                            if (sageframeuser.CodeForUsername != null)
                            {
                                MembershipController m        = new MembershipController();
                                UserInfo             sageUser = m.GetUserDetails(GetPortalID, sageframeuser.CodeForUsername);
                                //MembershipUser user = Membership.GetUser(sageframeuser.CodeForUsername);
                                string Password, PasswordSalt;
                                PasswordHelper.EnforcePasswordSecurity(m.PasswordFormat, txtPassword.Text, out Password, out PasswordSalt);
                                UserInfo user1 = new UserInfo(sageUser.UserID, Password, PasswordSalt, m.PasswordFormat);
                                m.ChangePassword(user1);
                                //string oldPassword = user.ResetPassword();

                                //user.ChangePassword(oldPassword, txtPassword.Text);


                                var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCCESSFUL_EMAIL, GetPortalID);
                                foreach (var messageTemplate in messageTemplates)
                                {
                                    MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                                    var            messageTokenValues      = messageTokenDB.sp_GetPasswordRecoverySuccessfulTokenValue(sageUser.UserName, GetPortalID);
                                    CommonFunction comm                    = new CommonFunction();
                                    DataTable      dtTokenValues           = comm.LINQToDataTable(messageTokenValues);
                                    string         replacedMessageSubject  = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtTokenValues);
                                    string         replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtTokenValues);
                                    try
                                    {
                                        MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, sageUser.Email, replacedMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                                    }
                                    catch (Exception)
                                    {
                                        ShowMessage("", GetSageMessage("PasswordRecovery", "SecureConnectionFPRError"), "", SageMessageType.Alert);
                                        e.Cancel = true;
                                        divRecoverpwd.Visible = false;
                                    }
                                }
                                UserManagementController.DeactivateRecoveryCode(sageUser.UserName, GetPortalID);
                                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                                if (template != null)
                                {
                                    ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                                }
                            }
                            else
                            {
                                //var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                                //if (template != null)
                                //{
                                //    ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                                //}
                                e.Cancel = true;
                                ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UnknownErrorPleaseTryAgaing"), "", SageMessageType.Alert);
                            }
                        }
                        else
                        {
                            //var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault();
                            //if (template != null)
                            //{
                            //    ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                            //}
                            e.Cancel = true;
                            ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UnknownError"), "", SageMessageType.Alert);
                        }
                    }
                }
                else
                {
                    ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PleaseEnterAllRequiredFields"), "", SageMessageType.Alert);
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemplo n.º 17
0
        public static void SendEmailForReferFriend(int storeId, int portalId, string cultureName, string senderName, string senderEmail, string receiverEmailID, string subject, string message, string messageBodyDetail)
        {
            StoreSettingConfig ssc = new StoreSettingConfig();
            string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeId, portalId, cultureName);
            MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
            var template =dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.REFER_A_FRIEND_EMAIL, portalId).SingleOrDefault();
            string messageTemplate = template.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, senderName);
                            break;
                            //case "%senderEmail%":
                            //    messageTemplate = messageTemplate.Replace(token, senderEmail);
                            //    break;
                        case "%MessageDetails%":
                            messageTemplate = messageTemplate.Replace(token, message);
                            break;
                        case "%ItemDetailsTable%":
                            messageTemplate = messageTemplate.Replace(token, messageBodyDetail);
                            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;
                    }
                }
            }

            string emailSuperAdmin;
            string emailSiteAdmin;
            SageFrameConfig pagebase = new SageFrameConfig();
            emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail);
            emailSiteAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress);
            MailHelper.SendMailNoAttachment(senderEmail, receiverEmailID, subject, messageTemplate, emailSiteAdmin, emailSuperAdmin);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SageFrameConfig pagebase = new SageFrameConfig();
            IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
            hypGotoLogin.Text = GetSageMessage("UserRegistration", "GoToLogin");
            if (IsUseFriendlyUrls)
            {
                if (GetPortalID > 1)
                {
                    hypGotoLogin.NavigateUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                }
                else
                {
                    hypGotoLogin.NavigateUrl = ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                }
            }
            else
            {
                hypGotoLogin.NavigateUrl = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage));
            }
            if (!IsPostBack)
            {
                try
                {
                    MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                    
                    string ActivationCode = string.Empty;
                    if (Request.QueryString["ActivationCode"] != null)
                    {
                        ActivationCode = Request.QueryString["ActivationCode"].ToString();
                        try
                        {
                            ActivationCode = EncryptionMD5.Decrypt(ActivationCode);
                        }
                        catch
                        {
                            ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "InvalidActivationCode"), "", SageMessageType.Alert);
                            return;
                        }

                        UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString);
                        var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(ActivationCode, GetPortalID).SingleOrDefault();
                        if (sageframeuser.CodeForUsername != null)
                        {

                            if (!(bool)(sageframeuser.IsAlreadyUsed))
                            {
                                string UserName = _member.ActivateUser(ActivationCode, GetPortalID, GetStoreID);
                                if (!String.IsNullOrEmpty(UserName))
                                {
                                    UserInfo user = _member.GetUserDetails(GetPortalID, UserName);
                                    if (user.UserExists)
                                    {
                                        var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID);
                                        foreach (var messageTemplate in messageTemplates)
                                        {
                                            var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID);
                                            CommonFunction comm = new CommonFunction();
                                            DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues);
                                            string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues);
                                            string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues);
                                            try
                                            {
                                                MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                                            }
                                            catch (Exception)
                                            {

                                                ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert);
                                                return;
                                            }
                                        }
                                        ACTIVATION_INFORMATION.Text = GetSageMessage("UserRegistration", "ActivationSuccessfulInfo");
                                        //ShowMessage("", GetSageMessage("UserRegistration", "ActivationSuccessfulInfo"), "", SageMessageType.Alert);
                                    }
                                    else
                                    {
                                        ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert);
                                    }
                                }
                                else
                                {
                                    var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_FAIL_INFORMATION, GetPortalID).SingleOrDefault();
                                    if (template != null)
                                    {
                                        ACTIVATION_INFORMATION.Text = template.Body;
                                    };
                                }
                            }
                            else
                            {
                                ShowMessage("", GetSageMessage("UserRegistration", "ActivationCodeAlreadyUsed"), "", SageMessageType.Alert);
                            }
                        }
                        else
                        {

                            ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
        }
Exemplo n.º 19
0
        public static void SendEmailForOrder(int portalID, OrderDetailsCollection orderdata, string addressPath, string templateName,string transID)
        {
            StoreSettingConfig ssc = new StoreSettingConfig();
           // sendEmailFrom = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
            string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, orderdata.ObjCommonInfo.StoreID, portalID,orderdata.ObjCommonInfo.CultureName);
            string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string inquiry = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
            string storeName = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, orderdata.ObjCommonInfo.StoreID, portalID, orderdata.ObjCommonInfo.CultureName);
         
            if (bool.Parse(sendOrderNotice))
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                SageFrameConfig pagebase = new SageFrameConfig();
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_PLACED, portalID).SingleOrDefault();
                string messageTemplate = template.Body;
                if (template != null)
                {
                    string[] tokens = GetAllToken(messageTemplate);
                    foreach (string token in tokens)
                    {
                        switch (token)
                        {  
							case "%OrderRemarks%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.Remarks);
                                break;
                            case "%InvoiceNo%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.InvoiceNumber);
                                break;
                            case "%OrderID%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.OrderID.ToString());
                                break;
                            case "%BillingAddress%":
                                string billing = orderdata.ObjBillingAddressInfo.FirstName.ToString() + " " +
                                    orderdata.ObjBillingAddressInfo.LastName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";

                                if (orderdata.ObjBillingAddressInfo.CompanyName != null)
                                {
                                    billing += orderdata.ObjBillingAddressInfo.CompanyName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }

                                billing += orderdata.ObjBillingAddressInfo.City.ToString() + ", " + orderdata.ObjBillingAddressInfo.Address.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                orderdata.ObjBillingAddressInfo.Country.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                orderdata.ObjBillingAddressInfo.EmailAddress.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                orderdata.ObjBillingAddressInfo.Phone.ToString() ;
                                messageTemplate = messageTemplate.Replace(token, billing);
                                break;
                            case "%ShippingAddress%":
                                string shipping = "";
                                if (!orderdata.ObjOrderDetails.IsDownloadable)
                                {
                                    if (orderdata.ObjOrderDetails.IsMultipleCheckOut == false)
                                    {
                                        shipping = orderdata.ObjShippingAddressInfo.FirstName.ToString() + " " +
                                           orderdata.ObjShippingAddressInfo.LastName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                        if (orderdata.ObjShippingAddressInfo.CompanyName != null)
                                        {
                                            shipping += orderdata.ObjShippingAddressInfo.CompanyName.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                        }

                                        shipping += orderdata.ObjShippingAddressInfo.City.ToString() + ", " + orderdata.ObjShippingAddressInfo.Address.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                              orderdata.ObjShippingAddressInfo.Country.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                              orderdata.ObjShippingAddressInfo.EmailAddress.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">" +
                                              orderdata.ObjShippingAddressInfo.Phone.ToString() + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";

                                    }
                                    else
                                    {
                                        shipping = "Multiple addresses<br />Plese log in to view." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    }

                                }
                                else
                                {
                                    shipping = "Your Ordered Item is Downloadable Item." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }

                                messageTemplate = messageTemplate.Replace(token, shipping);
                                break;
                            case "%UserFirstName%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.FirstName);
                                break;
                            case "%UserLastName%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.LastName);
                                break;
                            case "%TransactionID%":
                                messageTemplate = messageTemplate.Replace(token, transID);
                                break;
                            case "%PaymentMethodName%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjPaymentInfo.PaymentMethodName);
                                break;
                            case "%DateTimeDay%":
                                messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("dddd, dd MMMM yyyy"));
                                break;
                            case "%DateYear%":
                                messageTemplate = messageTemplate.Replace(token, DateTime.Now.Year.ToString());
                                break;
                            case "%CustomerID%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjOrderDetails.CustomerID.ToString());
                                break;
                            case "%PhoneNo%":
                                messageTemplate = messageTemplate.Replace(token, orderdata.ObjBillingAddressInfo.Phone);
                                break;
                            case "%AccountLogin%":
                                string account = "";
                                if (orderdata.ObjCommonInfo.AddedBy.ToString().ToLower() == "anonymoususer" && orderdata.ObjOrderDetails.CustomerID == 0)
                                {   // future login process for annoymoususr 
                                    account += "Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                    account += "<a  style=\"color: rgb(39, 142, 230);\"  href=" + addressPath + "User-Registration.aspx" + ">account</a>";
                                }
                                else
                                {
                                    account += "  Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                    account += " <a style=\"color: rgb(39, 142, 230);\"  href=" + addressPath + "Login.aspx" + ">account</a>";
                                }
                                messageTemplate = messageTemplate.Replace(token, account);
                                break;
                            case "%LogoSource%":
                                // string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Templates/" + templateName + "/images/aspxcommerce.png";
                                string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                                messageTemplate = messageTemplate.Replace(token, src);
                                break;
                            case "%DateTime%":
                                messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("dd MMMM yyyy "));

                                break;
                            case "%InquiryEmail%":
                                string x =
                                    "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                    inquiry + "\" >" + inquiry + "</a>";
                                messageTemplate = messageTemplate.Replace(token, x);
                                break;
                            case "%StoreName%":
                                messageTemplate = messageTemplate.Replace(token, storeName);
                                break;
                        }
                    }
                    // return messageTemplate;
                    MailHelper.SendMailNoAttachment(template.MailFrom, orderdata.ObjBillingAddressInfo.EmailAddress, template.Subject, messageTemplate, string.Empty, string.Empty);

                }
            }
            
            
           
        }
Exemplo n.º 20
0
        public static void SendEmailForOrderStatus(int storeID, int portalID, string recieverEmail, string billingshipping, string tablebody, string additionalFields, string templateName)
        {
            StoreSettingConfig         ssc               = new StoreSettingConfig();
            string                     logosrc           = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeID, portalID, "en-US");
            string                     inquiry           = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, storeID, portalID, "en-US");
            MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            MessageTokenDataContext    messageTokenDB    = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
            SageFrameConfig            pagebase          = new SageFrameConfig();
            var    template        = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_STATUS_CHANGED, portalID).SingleOrDefault();
            string messageTemplate = template.Body.ToString();

            if (template != null)
            {
                string[] tokens = GetAllToken(messageTemplate);
                string[] fields = additionalFields.Split('#');

                string orderstatus      = fields[0];
                string storeName        = fields[1];
                string storeDescription = fields[2];
                string customerName     = fields[3];
                string orderID          = fields[4];
                string paymentMethod    = fields[5];
                string shipingMethod    = fields[6];
                string invoice          = fields[7];
                string fullname         = GetFullName(portalID, int.Parse(orderID));
                foreach (string token in tokens)
                {
                    switch (token)
                    {
                    case "%OrderStatus%":
                        messageTemplate = messageTemplate.Replace(token, orderstatus);
                        break;

                    case "%StoreName%":
                        messageTemplate = messageTemplate.Replace(token, storeName);
                        break;

                    case "%StoreDescription%":
                        messageTemplate = messageTemplate.Replace(token, storeDescription);
                        break;

                    case "%ShippingMethod%":
                        messageTemplate = messageTemplate.Replace(token, shipingMethod);
                        break;

                    case "%InvoiceNo%":
                        messageTemplate = messageTemplate.Replace(token, invoice);
                        break;

                    case "%OrderID%":
                        messageTemplate = messageTemplate.Replace(token, orderID);
                        break;

                    case "%BillingShipping%":
                        messageTemplate = messageTemplate.Replace(token, billingshipping);
                        break;

                    case "%PaymentMethodName%":
                        messageTemplate = messageTemplate.Replace(token, paymentMethod);
                        break;

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

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

                    case "%CustomerName%":
                        messageTemplate = messageTemplate.Replace(token, fullname);
                        break;

                    case "%LogoSource%":
                        string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                        messageTemplate = messageTemplate.Replace(token, src);
                        break;

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

                    case "%UserFirstName%":
                        messageTemplate = messageTemplate.Replace(token, fullname);
                        break;

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

                    case "%InquiryEmail%":
                        string x =
                            "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                            inquiry + "\" >" + inquiry + "</a>"; messageTemplate = messageTemplate.Replace(token, x);
                        break;
                    }
                }
                // return messageTemplate;

                //  string replacedMessageTemplate = EmailTemplate.GetTemplateForOrderStatus(template.Body, billingShipping, itemTable, additionalFields);
                MailHelper.SendMailNoAttachment(template.MailFrom, recieverEmail, template.Subject, messageTemplate, string.Empty, string.Empty);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SageFrameConfig pagebase = new SageFrameConfig();

            IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
            hypGotoLogin.Text = GetSageMessage("UserRegistration", "GoToLogin");
            if (IsUseFriendlyUrls)
            {
                if (GetPortalID > 1)
                {
                    hypGotoLogin.NavigateUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                }
                else
                {
                    hypGotoLogin.NavigateUrl = ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                }
            }
            else
            {
                hypGotoLogin.NavigateUrl = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage));
            }
            if (!IsPostBack)
            {
                try
                {
                    MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);

                    string ActivationCode = string.Empty;
                    if (Request.QueryString["ActivationCode"] != null)
                    {
                        ActivationCode = Request.QueryString["ActivationCode"].ToString();
                        try
                        {
                            ActivationCode = EncryptionMD5.Decrypt(ActivationCode);
                        }
                        catch
                        {
                            ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "InvalidActivationCode"), "", SageMessageType.Alert);
                            return;
                        }

                        UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString);
                        var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(ActivationCode, GetPortalID).SingleOrDefault();
                        if (sageframeuser.CodeForUsername != null)
                        {
                            if (!(bool)(sageframeuser.IsAlreadyUsed))
                            {
                                string UserName = _member.ActivateUser(ActivationCode, GetPortalID, GetStoreID);
                                if (!String.IsNullOrEmpty(UserName))
                                {
                                    UserInfo user = _member.GetUserDetails(GetPortalID, UserName);
                                    if (user.UserExists)
                                    {
                                        var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID);
                                        foreach (var messageTemplate in messageTemplates)
                                        {
                                            var            linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID);
                                            CommonFunction comm = new CommonFunction();
                                            DataTable      dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues);
                                            string         replaceMessageSubject             = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues);
                                            string         replacedMessageTemplate           = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues);
                                            try
                                            {
                                                MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                                            }
                                            catch (Exception)
                                            {
                                                ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert);
                                                return;
                                            }
                                        }
                                        ACTIVATION_INFORMATION.Text = GetSageMessage("UserRegistration", "ActivationSuccessfulInfo");
                                        //ShowMessage("", GetSageMessage("UserRegistration", "ActivationSuccessfulInfo"), "", SageMessageType.Alert);
                                    }
                                    else
                                    {
                                        ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert);
                                    }
                                }
                                else
                                {
                                    var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_FAIL_INFORMATION, GetPortalID).SingleOrDefault();
                                    if (template != null)
                                    {
                                        ACTIVATION_INFORMATION.Text = template.Body;
                                    }
                                    ;
                                }
                            }
                            else
                            {
                                ShowMessage("", GetSageMessage("UserRegistration", "ActivationCodeAlreadyUsed"), "", SageMessageType.Alert);
                            }
                        }
                        else
                        {
                            ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
        }
        public void HandlePostRegistration(int UserRegistrationType, MessageTemplateDataContext dbMessageTemplate, int customerId)
        {
            switch (UserRegistrationType)
            {
                case 0:
                    var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_NONE, GetPortalID).SingleOrDefault();
                    if (template != null)
                    {
                        USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                    }
                    break;
                case 1:
                    template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PRIVATE, GetPortalID).SingleOrDefault();
                    if (template != null)
                    {
                        USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                    }
                    CheckDivVisibility(false, true);

                    break;
                case 3:
                    template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_VERIFIED, GetPortalID).SingleOrDefault();
                    if (template != null)
                    {
                        USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                    }
                    
                    foreach (var messageTemplate in dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACCOUNT_ACTIVATION_EMAIL, GetPortalID))
                    {
                        CommonFunction comm = new CommonFunction();
                        DataTable dtActivationTokenValues = comm.LINQToDataTable( messageTokenDB.sp_GetActivationTokenValue(UserName.Text, GetPortalID));
                        string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationTokenValues);
                        string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationTokenValues);
                        MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, Email.Text, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                    }
                    //ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "UserRegistrationSuccessPublic"), "", SageMessageType.Success);
                    CheckDivVisibility(false, true);


                    break;
                case 2:
                    template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PUBLIC, GetPortalID).SingleOrDefault();
                    if (template != null)
                    {
                        USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body;
                    }
                    LogInPublicModeRegistration();
                    //update Cart for that User in AspxCommerce
                    UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, customerId, sessionCode);
                    break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (HttpContext.Current.Session.SessionID != null)
                {
                    sessionCode = HttpContext.Current.Session.SessionID.ToString();
                }
                FirstName.Focus();
                IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        LoginPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                    }
                    else
                    {
                        LoginPath = ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                    }
                }
                else
                {
                    LoginPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage));
                }
                CheckUserRegistrationType();
                if (GetUsername != "anonymoususer")
                {
                    Response.Redirect(LoginPath, false);

                }
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_REGISTRATION_HELP, GetPortalID).SingleOrDefault();
                if (template != null)
                {
                    headerTemplate = "<div>" + template.Body + "</div>";
                }
                if (!IsPostBack)
                {
                    if (_member.EnableCaptcha)
                    {
                        InitializeCaptcha();
                    }
                    else { HideCaptcha(); }
                    SetValidatorErrorMessage();
                    CheckDivVisibility(true, false);

                }
             
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemplo n.º 24
0
        private void SendActivateMail(UserInfo user)
        {
            var dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
             
            var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID);
            foreach (var messageTemplate in messageTemplates)
            {
                var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID);
                CommonFunction comm = new CommonFunction();
                DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues);
                string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues);
                string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues);
                try
                {
                    MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                }
                catch (Exception)
                {

                    ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert);
                    return;
                }
            }                      
        }
Exemplo n.º 25
0
        public static void SendEmailForOrderSIM(int orderId,int storeID,int portalID,string custom,string billing, string billingadd,string billingcity, string shipping,string shippingadd, string shippingcity,string  payment, string info,string templateName,string transID,string remarks)
        {
              string[] infos = info.Split('#');            
                string[] payments = payment.Split('#');
                string[] ids = custom.Split('#');
                StoreSettingConfig ssc = new StoreSettingConfig();
                // sendEmailFrom = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
                string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, storeID, portalID,"en-US" );
                string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeID, portalID, "en-US");
                string storeName = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, storeID, portalID, "en-US");
                string inquiry = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, storeID, portalID, "en-US");
         
                if (bool.Parse(sendOrderNotice))
                {
                    MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                    MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                    SageFrameConfig pagebase = new SageFrameConfig();
                    var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_PLACED, portalID).SingleOrDefault();
                    string messageTemplate = template.Body;
                    if (template != null)
                    {
                        string[] tokens = GetAllToken(messageTemplate);
                        foreach (string token in tokens)
                        {
                            switch (token)
                            {
                                case "%OrderRemarks%":
                                    messageTemplate = messageTemplate.Replace(token, remarks);
                                    break;
                                case "%InvoiceNo%":
                                    messageTemplate = messageTemplate.Replace(token, infos[3].ToString());
                                    break;
                                case "%OrderID%":
                                    messageTemplate = messageTemplate.Replace(token, orderId.ToString());
                                    break;
                                case "%BillingAddress%":
                                    string billingfull = billing + billingadd + billingcity;
                                    messageTemplate = messageTemplate.Replace(token, billingfull);
                                    break;
                                case "%ShippingAddress%":
                                    string shippingFull = "";
                                    if (!bool.Parse(infos[5].ToString()))
                                    {
                                        if (bool.Parse(infos[6].ToString()) == false)
                                        {
                                            shippingFull = shipping + shippingcity + shippingadd;
                                        }
                                        else
                                        {
                                            shippingFull = "Multiple addresses<br />Plese log in to view." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                        }
                                    }
                                    else
                                    {
                                        shippingFull = "Your Ordered Item is Downloadable Item." + "</td></tr><tr><td  height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                    }

                                    messageTemplate = messageTemplate.Replace(token, shippingFull);
                                    break;
                                case "%UserFirstName%":
                                    messageTemplate = messageTemplate.Replace(token, infos[0].ToString());
                                    break;
                                case "%UserLastName%":
                                    messageTemplate = messageTemplate.Replace(token, "");
                                    break;
                                case "%TransactionID%":
                                    messageTemplate = messageTemplate.Replace(token, transID);
                                    break;
                                case "%PaymentMethodName%":
                                    messageTemplate = messageTemplate.Replace(token, payments[0].ToString());
                                    break;
                                case "%DateTimeDay%":
                                    messageTemplate = messageTemplate.Replace(token, payments[1].ToString());
                                    break;
                                case "%DateYear%":
                                    messageTemplate = messageTemplate.Replace(token, DateTime.Now.Year.ToString());
                                    break;
                                case "%CustomerID%":
                                    messageTemplate = messageTemplate.Replace(token, infos[2].ToString());
                                    break;
                                case "%PhoneNo%":
                                    messageTemplate = messageTemplate.Replace(token, infos[4].ToString());
                                    break;
                                case "%AccountLogin%":
                                    string account = "";
                                    if (infos[1].ToString().ToLower() == "anonymoususer" && int.Parse(infos[2].ToString()) == 0)
                                    {   // future login process for annoymoususr 
                                        account = "Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                        account += "<a  style=\"color: rgb(39, 142, 230);\" href=" + ids[6].Replace("Home", "User - Registration") + ">account</a>";
                                    }
                                    else
                                    {
                                        account = "Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                        account += "<a style=\"color: rgb(39, 142, 230);\" href=" + ids[6].Replace("Home", "Login") + ">account</a>";
                                    }
                                    messageTemplate = messageTemplate.Replace(token, account);
                                    break;
                                case "%LogoSource%":
                                    //    string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Templates/" + templateName + "/images/aspxcommerce.png";
                                    string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                                    messageTemplate = messageTemplate.Replace(token, src);
                                    break;
                                case "%DateTime%":
                                    messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("dd MMMM yyyy "));
                                    break;
                                case "%StoreName%":
                                    messageTemplate = messageTemplate.Replace(token, storeName);
                                    break;
                                case "%InquiryEmail%":
                                    string x =
                                     "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                     inquiry + "\" >" + inquiry + "</a>"; 
                                     messageTemplate = messageTemplate.Replace(token, x);
                                    break;

                            }
                        }
                        // return messageTemplate;
                        MailHelper.SendMailNoAttachment(template.MailFrom, infos[7].ToString(), template.Subject, messageTemplate, string.Empty, string.Empty);

                    }
                }


        }
Exemplo n.º 26
0
        public static void SendEmailForOrderStatus(int storeID,int portalID, string recieverEmail, string billingshipping, string tablebody, string additionalFields, string templateName)
        {
            StoreSettingConfig ssc = new StoreSettingConfig();
            string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeID, portalID, "en-US");
            string inquiry = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, storeID, portalID, "en-US");
            MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
            MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
            SageFrameConfig pagebase = new SageFrameConfig();
            var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_STATUS_CHANGED, portalID).SingleOrDefault();
            string messageTemplate = template.Body.ToString();
            if (template != null)
            {
                string[] tokens = GetAllToken(messageTemplate);
                string[] fields = additionalFields.Split('#');

                string orderstatus = fields[0];
                string storeName = fields[1];
                string storeDescription = fields[2];
                string customerName = fields[3];
                string orderID = fields[4];
                string paymentMethod = fields[5];
                string shipingMethod = fields[6];
                string invoice = fields[7];
              string fullname=  GetFullName(portalID,int.Parse(orderID));
                foreach (string token in tokens)
                {
                    switch (token)
                    {
                    case "%OrderStatus%":
                            messageTemplate = messageTemplate.Replace(token, orderstatus);
                            break;
                        case "%StoreName%":
                            messageTemplate = messageTemplate.Replace(token, storeName);
                            break;
                        case "%StoreDescription%":
                            messageTemplate = messageTemplate.Replace(token, storeDescription);
                            break;
                        case "%ShippingMethod%":
                            messageTemplate = messageTemplate.Replace(token, shipingMethod);
                            break;
                        case "%InvoiceNo%":
                            messageTemplate = messageTemplate.Replace(token, invoice);
                            break;
                        case "%OrderID%":
                            messageTemplate = messageTemplate.Replace(token, orderID);
                            break;
                        case "%BillingShipping%":
                            messageTemplate = messageTemplate.Replace(token, billingshipping);
                            break;
                        case "%PaymentMethodName%":
                            messageTemplate = messageTemplate.Replace(token, paymentMethod);
                            break;
                        case "%DateTimeWithTime%":
                            messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("MM/dd/yyyy HH:mm"));
                            break;
                        case "%DateTime%":
                            messageTemplate = messageTemplate.Replace(token, DateTime.Now.ToString("MM/dd/yyyy"));
                            break;
                        case "%CustomerName%":
                            messageTemplate = messageTemplate.Replace(token, fullname);
                            break;
                        case "%LogoSource%":
                            string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                            messageTemplate = messageTemplate.Replace(token, src);
                            break;
                        case "%ItemDetailsTable%":
                            messageTemplate = messageTemplate.Replace(token, tablebody);
                            break;
                        case "%UserFirstName%":
                            messageTemplate = messageTemplate.Replace(token, fullname);
                            break;
                        case "%UserLastName%":
                            messageTemplate = messageTemplate.Replace(token, "");
                            break;
                        case "%InquiryEmail%":
                            string x =
                                     "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                     inquiry + "\" >" + inquiry + "</a>"; messageTemplate = messageTemplate.Replace(token, x);
                            break;

                    }
                }
                // return messageTemplate;

                //  string replacedMessageTemplate = EmailTemplate.GetTemplateForOrderStatus(template.Body, billingShipping, itemTable, additionalFields);
                MailHelper.SendMailNoAttachment(template.MailFrom, recieverEmail, template.Subject, messageTemplate, string.Empty, string.Empty);

            }
        }
Exemplo n.º 27
0
        public static void SendEmailForOrderSIM(int orderId, int storeID, int portalID, string custom, string billing, string billingadd, string billingcity, string shipping, string shippingadd, string shippingcity, string payment, string info, string templateName, string transID, string remarks)
        {
            string[]           infos    = info.Split('#');
            string[]           payments = payment.Split('#');
            string[]           ids      = custom.Split('#');
            StoreSettingConfig ssc      = new StoreSettingConfig();
            // sendEmailFrom = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, storeID, portalID, "en-US");
            string sendOrderNotice = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, storeID, portalID, "en-US");
            string logosrc         = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeID, portalID, "en-US");
            string storeName       = ssc.GetStoreSettingsByKey(StoreSetting.StoreName, storeID, portalID, "en-US");
            string inquiry         = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailTo, storeID, portalID, "en-US");

            if (bool.Parse(sendOrderNotice))
            {
                MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString);
                MessageTokenDataContext    messageTokenDB    = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString);
                SageFrameConfig            pagebase          = new SageFrameConfig();
                var    template        = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ORDER_PLACED, portalID).SingleOrDefault();
                string messageTemplate = template.Body;
                if (template != null)
                {
                    string[] tokens = GetAllToken(messageTemplate);
                    foreach (string token in tokens)
                    {
                        switch (token)
                        {
                        case "%OrderRemarks%":
                            messageTemplate = messageTemplate.Replace(token, remarks);
                            break;

                        case "%InvoiceNo%":
                            messageTemplate = messageTemplate.Replace(token, infos[3].ToString());
                            break;

                        case "%OrderID%":
                            messageTemplate = messageTemplate.Replace(token, orderId.ToString());
                            break;

                        case "%BillingAddress%":
                            string billingfull = billing + billingadd + billingcity;
                            messageTemplate = messageTemplate.Replace(token, billingfull);
                            break;

                        case "%ShippingAddress%":
                            string shippingFull = "";
                            if (!bool.Parse(infos[5].ToString()))
                            {
                                if (bool.Parse(infos[6].ToString()) == false)
                                {
                                    shippingFull = shipping + shippingcity + shippingadd;
                                }
                                else
                                {
                                    shippingFull = "Multiple addresses<br />Plese log in to view." + "</td></tr><tr><td height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                                }
                            }
                            else
                            {
                                shippingFull = "Your Ordered Item is Downloadable Item." + "</td></tr><tr><td  height=\"32\" style=\"border-bottom:thin dashed #d1d1d1; padding:10px 0 5px 10px; font:normal 12px Arial, Helvetica, sans-serif\">";
                            }

                            messageTemplate = messageTemplate.Replace(token, shippingFull);
                            break;

                        case "%UserFirstName%":
                            messageTemplate = messageTemplate.Replace(token, infos[0].ToString());
                            break;

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

                        case "%TransactionID%":
                            messageTemplate = messageTemplate.Replace(token, transID);
                            break;

                        case "%PaymentMethodName%":
                            messageTemplate = messageTemplate.Replace(token, payments[0].ToString());
                            break;

                        case "%DateTimeDay%":
                            messageTemplate = messageTemplate.Replace(token, payments[1].ToString());
                            break;

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

                        case "%CustomerID%":
                            messageTemplate = messageTemplate.Replace(token, infos[2].ToString());
                            break;

                        case "%PhoneNo%":
                            messageTemplate = messageTemplate.Replace(token, infos[4].ToString());
                            break;

                        case "%AccountLogin%":
                            string account = "";
                            if (infos[1].ToString().ToLower() == "anonymoususer" && int.Parse(infos[2].ToString()) == 0)
                            {           // future login process for annoymoususr
                                account = "Please Register and log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                account += "<a  style=\"color: rgb(39, 142, 230);\" href=" + ids[6].Replace("Home", "User - Registration") + ">account</a>";
                            }
                            else
                            {
                                account = "Please log in to your <span style=\"font-weight: bold; font-size: 11px;\">AspxCommerce</span>";

                                account += "<a style=\"color: rgb(39, 142, 230);\" href=" + ids[6].Replace("Home", "Login") + ">account</a>";
                            }
                            messageTemplate = messageTemplate.Replace(token, account);
                            break;

                        case "%LogoSource%":
                            //    string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/Templates/" + templateName + "/images/aspxcommerce.png";
                            string src = " http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/" + logosrc;
                            messageTemplate = messageTemplate.Replace(token, src);
                            break;

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

                        case "%StoreName%":
                            messageTemplate = messageTemplate.Replace(token, storeName);
                            break;

                        case "%InquiryEmail%":
                            string x =
                                "<a  target=\"_blank\" style=\"text-decoration: none;color: #226ab7;font-style: italic;\" href=\"mailto:" +
                                inquiry + "\" >" + inquiry + "</a>";
                            messageTemplate = messageTemplate.Replace(token, x);
                            break;
                        }
                    }
                    // return messageTemplate;
                    MailHelper.SendMailNoAttachment(template.MailFrom, infos[7].ToString(), template.Subject, messageTemplate, string.Empty, string.Empty);
                }
            }
        }