private NBrightInfo PurchaseNotify(NBrightInfo nbrightInfo)
        {
            var objCtrl            = new NBrightBuyController();
            var purhcaseNotifyInfo = objCtrl.GetPluginSinglePageData("OS_PurchaseNotificationDATA", "OS_PurchaseNotificationDATA", Utils.GetCurrentCulture());

            if (purhcaseNotifyInfo.GetXmlPropertyBool("genxml/checkbox/turnoff"))
            {
                return(nbrightInfo);
            }

            var orderData = new OrderData(nbrightInfo.ItemID);

            // remove and products that have reached the client purchase limit
            var cartitemList  = orderData.GetCartItemList();
            var sendEmailFlag = false;

            foreach (var cartItemInfo in cartitemList)
            {
                var productid = cartItemInfo.GetXmlPropertyInt("genxml/productid");
                if (productid > 0)
                {
                    var modelid     = cartItemInfo.GetXmlProperty("genxml/modelid");
                    var productData = new ProductData(productid, Utils.GetCurrentCulture(), true);
                    var model       = productData.GetModel(modelid);
                    if (model != null)
                    {
                        var purchaseNotificationFlag = model.GetXmlPropertyBool("genxml/checkbox/purchasenotificationflag");
                        if (purchaseNotificationFlag)
                        {
                            sendEmailFlag = true;  // Just put a flag, most of work done in Razor Template.
                        }
                    }
                }
            }

            if (sendEmailFlag)
            {
                var passSettings = new Dictionary <string, string>();
                var emailBody    = NBrightBuyUtils.RazorTemplRender("EmailHtmlOutput.cshtml", 0, "", orderData, "/DesktopModules/NBright/OS_PurchaseNotification", "config", orderData.Lang, passSettings);

                var emailList = StoreSettings.Current.ManagerEmail + ",";
                emailList += purhcaseNotifyInfo.GetXmlProperty("genxml/textbox/emailcsv");
                emailList  = emailList.TrimEnd(',');

                var emailSubject = purhcaseNotifyInfo.GetXmlProperty("genxml/textbox/emailsubject");

                NBrightBuyUtils.SendEmail(emailBody, emailList, "", orderData.GetInfo(), emailSubject, "", orderData.Lang);
            }

            return(nbrightInfo);
        }
Exemplo n.º 2
0
 public void AddClientEditorRole()
 {
     if (_userInfo != null)
     {
         if (!_userInfo.IsInRole(StoreSettings.ClientEditorRole))
         {
             var rc = new DotNetNuke.Security.Roles.RoleController();
             var ri = rc.GetRoleByName(PortalId, StoreSettings.ClientEditorRole);
             if (ri != null)
             {
                 rc.AddUserRole(PortalId, _userInfo.UserID, ri.RoleID, Null.NullDate, Null.NullDate);
             }
             if (StoreSettings.Current.Get("sendclientroleemail") == "True")
             {
                 NBrightBuyUtils.SendEmail(_userInfo.Email, "addclientrole.html", _clientInfo, "", "", _userInfo.Profile.PreferredLocale);
             }
         }
     }
 }
Exemplo n.º 3
0
 public void AddClientEditorRole()
 {
     if (_userInfo != null)
     {
         if (!_userInfo.IsInRole(StoreSettings.ClientEditorRole))
         {
             var rc = new DotNetNuke.Security.Roles.RoleController();
             var ri = rc.GetRoleByName(PortalId, StoreSettings.ClientEditorRole);
             if (ri != null)
             {
                 rc.AddUserRole(PortalId, _userInfo.UserID, ri.RoleID, Null.NullDate, Null.NullDate);
             }
             if (StoreSettings.Current.Get("sendclientroleemail") == "True")
             {
                 var emailBody = "";
                 emailBody = NBrightBuyUtils.RazorTemplRender("AddClientRole.cshtml", 0, "", _clientInfo, "/DesktopModules/NBright/NBrightBuy", StoreSettings.Current.Get("themefolder"), _userInfo.Profile.PreferredLocale, StoreSettings.Current.Settings());
                 NBrightBuyUtils.SendEmail(emailBody, _userInfo.Email, "ClientRole", _clientInfo, StoreSettings.Current.SettingsInfo.GetXmlProperty("genxml/textbox/storecompany"), StoreSettings.Current.ManagerEmail, _userInfo.Profile.PreferredLocale);
             }
         }
     }
 }
Exemplo n.º 4
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg          = e.CommandArgument.ToString();
            var param         = new string[3];
            var redirecttabid = "";
            var emailtemplate = "";

            switch (e.CommandName.ToLower())
            {
            case "saveprofile":
                _profileData.UpdateProfile(rpInp, DebugMode);

                emailtemplate = ModSettings.Get("emailtemplate");
                if (emailtemplate != "")
                {
                    NBrightBuyUtils.SendEmailToManager(emailtemplate, _profileData.GetProfile(), "profileupdated_emailsubject.Text");
                }

                param[0] = "msg=" + NotifyRef + "_" + NotifyCode.ok;
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef, NotifyCode.ok);
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "register":

                var notifyCode = NotifyCode.fail;
                var failreason = "";

                var cap = (DotNetNuke.UI.WebControls.CaptchaControl)rpInp.Controls[0].FindControl("captcha");;
                if (cap == null || cap.IsValid)
                {
                    //create a new user and login
                    if (!this.UserInfo.IsInRole("Registered Users"))
                    {
                        // Create and hydrate User
                        var objUser = new UserInfo();
                        objUser.Profile.InitialiseProfile(this.PortalId, true);
                        objUser.PortalID                = PortalId;
                        objUser.DisplayName             = GenXmlFunctions.GetField(rpInp, "DisplayName");
                        objUser.Email                   = GenXmlFunctions.GetField(rpInp, "Email");
                        objUser.FirstName               = GenXmlFunctions.GetField(rpInp, "FirstName");
                        objUser.LastName                = GenXmlFunctions.GetField(rpInp, "LastName");
                        objUser.Username                = GenXmlFunctions.GetField(rpInp, "Username");
                        objUser.Profile.PreferredLocale = Utils.GetCurrentCulture();

                        if (objUser.Username == "")
                        {
                            objUser.Username = GenXmlFunctions.GetField(rpInp, "Email");
                        }
                        objUser.Membership.CreatedDate = System.DateTime.Now;
                        var passwd = GenXmlFunctions.GetField(rpInp, "Password");
                        if (passwd == "")
                        {
                            objUser.Membership.UpdatePassword = true;
                            passwd = UserController.GeneratePassword(9);
                        }
                        objUser.Membership.Password = passwd;
                        objUser.Membership.Approved = PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.PublicRegistration;

                        // Create the user
                        var createStatus = UserController.CreateUser(ref objUser);

                        DataCache.ClearPortalCache(PortalId, true);

                        switch (createStatus)
                        {
                        case UserCreateStatus.Success:
                            //boNotify = true;
                            if (objUser.Membership.Approved)
                            {
                                UserController.UserLogin(this.PortalId, objUser, PortalSettings.PortalName, AuthenticationLoginBase.GetIPAddress(), false);
                            }
                            notifyCode = NotifyCode.ok;
                            break;

                        case UserCreateStatus.DuplicateEmail:
                            failreason = "exists";
                            break;

                        case UserCreateStatus.DuplicateUserName:
                            failreason = "exists";
                            break;

                        case UserCreateStatus.UsernameAlreadyExists:
                            failreason = "exists";
                            break;

                        case UserCreateStatus.UserAlreadyRegistered:
                            failreason = "exists";
                            break;

                        default:
                            // registration error
                            break;
                        }

                        if (notifyCode == NotifyCode.ok)
                        {
                            _profileData  = new ProfileData(objUser.UserID, rpInp, DebugMode);    //create and update a profile for this new logged in user.
                            emailtemplate = ModSettings.Get("emailregisteredtemplate");
                            if (emailtemplate != "")
                            {
                                NBrightBuyUtils.SendEmailToManager(emailtemplate, _profileData.GetProfile(), "profileregistered_emailsubject.Text");
                            }
                            emailtemplate = ModSettings.Get("emailregisteredclienttemplate");
                            if (emailtemplate != "")
                            {
                                NBrightBuyUtils.SendEmail(objUser.Email, emailtemplate, _profileData.GetProfile(), "profileregistered_emailsubject.Text", "", objUser.Profile.PreferredLocale);
                            }
                        }
                    }
                }
                else
                {
                    NBrightBuyUtils.SetFormTempData(ModuleId, GenXmlFunctions.GetGenXml(rpInp));
                    failreason = "captcha";
                }

                param[0] = "msg=" + NotifyRef + "_" + notifyCode;
                if (!UserInfo.IsInRole(StoreSettings.ClientEditorRole) && ModSettings.Get("clientrole") == "True" && notifyCode == NotifyCode.ok)
                {
                    NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + "clientrole", notifyCode);
                }
                else
                {
                    NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + failreason, notifyCode);
                }

                if (notifyCode == NotifyCode.ok)
                {
                    redirecttabid = ModSettings.Get("ddlredirecttabid");
                }
                if (!Utils.IsNumeric(redirecttabid))
                {
                    redirecttabid = TabId.ToString("");
                }
                Response.Redirect(Globals.NavigateURL(Convert.ToInt32(redirecttabid), "", param), true);
                break;
            }
        }