Example #1
0
        public void Dispose()
        {
            WebStoreRepository.Dispose();
            WebStoreItemRepository.Dispose();
            WebStoresChangeLogRepository.Dispose();

            CourseRepository.Dispose();
            CourseChangeLogRepository.Dispose();
        }
Example #2
0
        public DateTime?GetWebStoreLastUpdate(string trackingId, out string error)
        {
            error = string.Empty;
            try
            {
                var storeEntity = WebStoreRepository.Get(x => x.TrackingID == trackingId);

                if (storeEntity == null)
                {
                    error = "store entity not found";
                    return(null);
                }

                var entity = WebStoresChangeLogRepository.Get(x => x.StoreId == storeEntity.StoreID);

                return(entity != null ? entity.LastUpdateOn : null);
            }
            catch (Exception ex)
            {
                Logger.Error("Get WebStore LastUpdate", ex, CommonEnums.LoggerObjectTypes.WebStore);
                return(null);
            }
        }
Example #3
0
        public void UpdateStoreRegistrationSources()
        {
            try
            {
                var _wepServices = new WidgetEndpointServices();
                var _fbServices  = new FacebookServices();

                var stores = WebStoreRepository.GetMany(x => x.RegistrationSourceId == null).ToList().OrderByDescending(x => x.StoreID).ToArray();

                foreach (var store in stores)
                {
                    //check Wix
                    string error;
                    if (store.WixInstanceId != null || store.TrackingID.LastIndexOf("zombie", StringComparison.Ordinal) >= 0)
                    {
                        UpdateStoreRegistrationSource(store, CommonEnums.eRegistrationSources.WIX);

                        if (store.WixInstanceId != null)
                        {
                            Guid instanceId;
                            if (Guid.TryParse(store.WixInstanceId.ToString(), out instanceId))
                            {
                                if (instanceId != Guid.Empty)
                                {
                                    _wepServices.SavePluginInstallaltion(new PluginInstallationDTO
                                    {
                                        Type = PluginEnums.ePluginType.WIX
                                        ,
                                        Uid = instanceId.ToString()
                                        ,
                                        UserId = store.OwnerUserID
                                        ,
                                        AddOn = store.AddOn
                                        ,
                                        IsActive = true
                                    }, out error);
                                }
                            }
                        }
                        else
                        {
                            //check Zombie
                            var uid = store.TrackingID.Substring(store.TrackingID.LastIndexOf("_", StringComparison.Ordinal) + 1);

                            _wepServices.SavePluginInstallaltion(new PluginInstallationDTO
                            {
                                Type = PluginEnums.ePluginType.WIX
                                ,
                                Uid = uid
                                ,
                                UserId = store.OwnerUserID
                                ,
                                AddOn = store.AddOn
                                ,
                                IsActive = false
                            }, out error);
                        }

                        continue;
                    }


                    //check FB
                    long pageId;

                    if (Int64.TryParse(store.TrackingID, out pageId))
                    {
                        if (pageId > 1000000 && _fbServices.ValidatePage(pageId)) //fbPageUrl.IsUrlValid()
                        {
                            UpdateStoreRegistrationSource(store, CommonEnums.eRegistrationSources.FB);

                            var fbPageUrl = Utils.PageId2FacebookPageUrl(pageId);

                            var appUrl = fbPageUrl.FacebookPageUrl2AppUrl(pageId);

                            _wepServices.SavePluginInstallaltion(new PluginInstallationDTO
                            {
                                Type = PluginEnums.ePluginType.FB
                                ,
                                Uid = pageId.ToString()
                                ,
                                UserId = store.OwnerUserID
                                ,
                                AddOn = store.AddOn
                                ,
                                Domain = appUrl
                                ,
                                IsActive = !String.IsNullOrEmpty(appUrl)
                            }, out error);

                            continue;
                        }
                    }

                    //update as LFE store by default
                    UpdateStoreRegistrationSource(store, CommonEnums.eRegistrationSources.LFE);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpdateStoreRegistrationSources", ex, CommonEnums.LoggerObjectTypes.Application);
            }
        }