Example #1
0
 public static void UpdateStoreEntity(this WebStores entity, BaseWebStoreDTO dto)
 {
     entity.StoreName         = dto.Name;
     entity.TrackingID        = dto.TrackingID;
     entity.DefaultCurrencyId = dto.DefaultCurrencyId ?? Constants.DEFAULT_CURRENCY_ID;
     entity.UpdateOn          = DateTime.Now;
     entity.UpdatedBy         = DtoExtensions.CurrentUserId;
 }
Example #2
0
 public static WebStores EditDto2StoreEntity(this BaseWebStoreDTO dto, int ownerId)
 {
     return(new WebStores
     {
         OwnerUserID = ownerId
         , TrackingID = dto.TrackingID
         , uid = Guid.NewGuid()
         , StoreName = dto.Name
         , StatusId = (short)WebStoreEnums.StoreStatus.Published
         , DefaultCurrencyId = dto.DefaultCurrencyId
         , AddOn = DateTime.Now
         , CreatedBy = DtoExtensions.CurrentUserId
         , RegistrationSourceId = (byte)dto.RegistrationSource
     });
 }
Example #3
0
        public ActionResult SaveNewStore(BaseWebStoreDTO token, string uid, int?srcId, string callback)
        {
            string error;

            token.StoreId = -1;

            //check source
            var plugin = WidgetEndpointServices.GetPluginInstallationDto(uid, out error);

            if (plugin != null)
            {
                token.RegistrationSource = plugin.Type.PluginType2RegistrationSource();
            }

            var saved = _pluginStoreServices.SaveStore(ref token, CurrentUserId, srcId, out error);

            ViewBag.result = JsSerializer.Serialize(new JsonResponseToken {
                success = saved, error = error
            });
            ViewBag.callback     = callback;
            Response.ContentType = "text/javascript";
            return(View());
        }
Example #4
0
        public ActionResult UserScript(string callback, string uid)
        {
            ViewBag.linkMessage = "null";
            ViewBag.linkUrl     = "null";
            var     currencies     = JsSerializer.Serialize(_geoServices.ActiveCurrenciesList);
            dynamic stores         = new BaseWebStoreDTO[0];
            var     userAuthorized = false;
            string  error;
            var     installToken = WidgetEndpointServices.GetPluginInstallationDto(uid, out error);

            //Logger.Debug("Call plugin user script for " + uid);

            if (installToken == null)
            {
                ViewBag.linkMessage = "'Installation not registered with " + error + ". Please contact support team.'";
                ViewBag.linkUrl     = "'#'";
            }
            else
            {
                if (CurrentUserId < 0)
                {
                    ViewBag.linkMessage = installToken.UserId == null ? "'Oooooppss… No LFE account is connected to this plugin. Click here to connect an LFE account with this plugin'" : "'Oooooppss… You are not logged in. Click here to login with the LFE account associated with this plugin'";
                    ViewBag.linkUrl     = "'#login'";
                }
                else
                {
                    if (installToken.UserId != null)
                    {
                        if (installToken.UserId == CurrentUserId)
                        {
                            stores         = WidgetEndpointServices.GetOwnerStores(CurrentUserId).OrderBy(x => x.Name).ToArray();
                            userAuthorized = true;
                            //show panel
                        }
                        else
                        {
                            ViewBag.linkMessage = "'Oooooppss… You are attempting to login with an LFE account that is not connected to this application. Click here to connect with the LFE account associated with this plugin'";
                            ViewBag.linkUrl     = "'#'";
                        }
                    }
                    else
                    {
                        // Show message"Connect account"
                        ViewBag.linkMessage = "'Oooooppss… No LFE account is connected to this application. Click here to connect your LFE account'";
                        ViewBag.linkUrl     = "'#'";
                    }
                }
            }

            var newStore = new BaseWebStoreDTO
            {
                StoreId             = -1
                , TrackingID        = Guid.NewGuid().ToString()
                , DefaultCurrencyId = Constants.DEFAULT_CURRENCY_ID
            };



            ViewBag.currencies   = string.IsNullOrEmpty(currencies) ? "[]" : currencies;
            ViewBag.stores       = JsSerializer.Serialize(stores);
            ViewBag.user         = CurrentUserId;
            ViewBag.newStore     = JsSerializer.Serialize(newStore);
            ViewBag.callback     = callback;
            ViewBag.uid          = uid;
            ViewBag.status       = userAuthorized ? string.Empty : HttpStatusCode.Forbidden.ToString();
            Response.ContentType = "text/javascript";
            return(View());
        }