Beispiel #1
0
        public ActionResult SettingsUpdate(FacebookSettingsJsonToken settings)
        {
            if (this.CurrentUser() == null)
            {
                return(Json(new { success = "false", storeID = "-1", error = "Please Login" }));
            }

            string error;
            var    updated = _webStoreFacebookServices.UpdateFacebookSettings(ref settings, this.CurrentUser(), out error);

            return(Json(new
            {
                success = updated.ToString().ToLower()
                , storeID = settings.StoreId
                , storeName = settings.txtStoreName
                , settings.UniqueId
                , error
            }));
        }
Beispiel #2
0
        private SettingsViewToken GetSettingsViewToken(string trackingId)
        {
            var error = "";
            var user  = this.CurrentUser();

            if (user == null)
            {
                Response.Write("User wasn't found, please contact " + Constants.APP_OFFICIAL_NAME + " support team. " + error);
                return(null);
            }

            var webStore = _widgetServices.GetWidgetStoreDto(trackingId);

            var settingToken = new SettingsViewToken
            {
                Instance        = null,
                UserId          = user.UserId,
                UserCoursesList = _authorAdminCourseServices.GetAuthorCoursesList(Constants.DEFAULT_CURRENCY_ID, user.UserId),
                TrackingID      = trackingId
            };

            if (webStore == null)
            {
                //settingToken.storeId = -1;
                //create a new web store
                var jsonToken = new FacebookSettingsJsonToken
                {
                    cbIsShowBorder    = false,
                    cbIsShowTitleBar  = true,
                    cbIsTransparent   = false,
                    cpBackgroundColor = "#FFFFFF",
                    cpFontColor       = "#000000",
                    cpTabsFontColor   = "#006699",
                    StoreId           = null,
                    txtStoreName      = "",
                    UniqueId          = "",
                    TrackingId        = trackingId
                };


                _webStoreFacebookServices.UpdateFacebookSettings(ref jsonToken, this.CurrentUser(), out error);

                settingToken.StoreName       = jsonToken.txtStoreName;
                settingToken.FontColor       = jsonToken.cpFontColor;
                settingToken.TabsFontColor   = jsonToken.cpTabsFontColor;
                settingToken.BackgroundColor = jsonToken.cpBackgroundColor;
                settingToken.IsTransparent   = jsonToken.cbIsTransparent;
                settingToken.IsShowBorder    = jsonToken.cbIsShowBorder;
                settingToken.IsShowTitleBar  = jsonToken.cbIsShowBorder;
                settingToken.StoreId         = jsonToken.StoreId;
                settingToken.UniqueId        = jsonToken.UniqueId;
            }
            else
            {
                settingToken.StoreName       = webStore.WebStoreName;
                settingToken.FontColor       = webStore.FontColor;
                settingToken.TabsFontColor   = webStore.TabsFontColor;
                settingToken.BackgroundColor = webStore.BackgroundColor;
                settingToken.IsTransparent   = webStore.IsTransParent;
                settingToken.IsShowBorder    = webStore.IsShowBorder;
                settingToken.IsShowTitleBar  = webStore.IsShowTitleBar;
                settingToken.StoreId         = webStore.WebStoreID;
                settingToken.UniqueId        = webStore.UniqueId;
                // settingToken.StoreCoursesIds = WidgetServices.GetAllStoreCourseIds(webStore.WebStoreID);
            }

            return(settingToken);
        }
Beispiel #3
0
        public ActionResult AppSettings(string trackingID)
        {
            var error = "";
            var user  = this.CurrentUser();

            if (user == null)
            {
                Response.Write("User wasn't found, please contact " + Constants.APP_OFFICIAL_NAME + " support team. " + error);
                return(null);
            }

            var webStore = _widgetServices.GetWidgetStoreDto(trackingID);

            var settingToken = trackingID.ToDefaultSettingsToken();

            settingToken.Instance        = null;
            settingToken.UserId          = user.UserId;
            settingToken.UserCoursesList = _authorAdminCourseServices.GetAuthorCoursesList(Constants.DEFAULT_CURRENCY_ID, user.UserId);

            if (!String.IsNullOrEmpty(trackingID)) // for FB app , tracking ID equal to pageId
            {
                //update plugin user
                _widgetEndpointServices.VerifyPluginOwner(trackingID, out error);
            }

            if (webStore == null)
            {
                //settingToken.storeId = -1;
                //create a new web store
                var jsonToken = new FacebookSettingsJsonToken
                {
                    cbIsShowBorder    = false,
                    cbIsShowTitleBar  = true,
                    cbIsTransparent   = false,
                    cpBackgroundColor = "#FFFFFF",
                    cpFontColor       = "#000000",
                    cpTabsFontColor   = "#006699",
                    StoreId           = null,
                    txtStoreName      = "",
                    UniqueId          = "",
                    TrackingId        = trackingID
                };

                _webStoreFacebookServices.UpdateFacebookSettings(ref jsonToken, this.CurrentUser(), out error);
            }
            else
            {
                settingToken.StoreName       = webStore.WebStoreName;
                settingToken.FontColor       = webStore.FontColor;
                settingToken.TabsFontColor   = webStore.TabsFontColor;
                settingToken.BackgroundColor = webStore.BackgroundColor;
                settingToken.IsTransparent   = webStore.IsTransParent;
                settingToken.IsShowBorder    = webStore.IsShowBorder;
                settingToken.IsShowTitleBar  = webStore.IsShowTitleBar;
                settingToken.StoreId         = webStore.WebStoreID;
                settingToken.UniqueId        = webStore.UniqueId;
                // settingToken.StoreCoursesIds = WidgetServices.GetAllStoreCourseIds(webStore.WebStoreID);
            }

            // return View("~/Areas/Widget/Views/facebook/FacebookSettings.cshtml", settingToken);
            return(View("FacebookSettings", settingToken));
        }