Ejemplo n.º 1
0
 public ItJakubServiceManager()
 {
     m_bookManager       = m_container.Resolve <BookManager>();
     m_authorManager     = m_container.Resolve <AuthorManager>();
     m_resourceManager   = m_container.Resolve <ResourceManager>();
     m_searchManager     = m_container.Resolve <SearchManager>();
     m_feedbackManager   = m_container.Resolve <FeedbackManager>();
     m_cardFileManager   = m_container.Resolve <CardFileManager>();
     m_permissionManager = m_container.Resolve <PermissionManager>();
     m_userManager       = m_container.Resolve <UserManager>();
     m_newsManager       = m_container.Resolve <NewsManager>();
     m_favoriteManager   = m_container.Resolve <FavoriteManager>();
 }
        public ActionResult AddFavorite(int Id)
        {
            var userManager = new UserManager();
            var favoriteManager = new FavoriteManager();

            var favorite = new Favorite();
            var login = System.Web.HttpContext.Current.User.Identity.Name;

            favorite.Restaurant = _rstManager.Get(Id);
            favorite.User = userManager.Get().FirstOrDefault(u => u.Login == login);
            favoriteManager.Add(favorite);
            return Json(new {result = "success"}, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 3
0
        public void GoHome()
        {
            var display = this.CurrentDisplay;

            if (display != null)
            {
                Trace.WriteLine($"Before {nameof(ISplitView)}.{nameof(GoHome)}\t{display.Info}");
                VisualsDisplayHistory.Store(display, SceneManager);

                FavoriteManager.GoHome(display, false);
                OnViewChanged();
                Trace.WriteLine($"After {nameof (ISplitView)}.{nameof (GoHome)}\t{display.Info}");
            }
        }
Ejemplo n.º 4
0
        private static void UpgradeFromRegistry()
        {
            var n        = 0;
            var blowFish = new BlowFish(BlowFish.CipherKey);

            while (n < 99)
            {
                var siteName = AppHost.Settings.Get(StorageKey, "site" + n, null) as string;
                if (string.IsNullOrEmpty(siteName))
                {
                    break;
                }

                var server          = AppHost.Settings.Get(StorageKey, "server" + n, string.Empty) as string ?? string.Empty;
                var folder          = AppHost.Settings.Get(StorageKey, "folder" + n, string.Empty) as string ?? string.Empty;
                var userName        = AppHost.Settings.Get(StorageKey, "userName" + n, string.Empty) as string ?? string.Empty;
                var useWindowsAuth  = AppHost.Settings.GetBool(StorageKey, "useWindowsAuth" + n, false);
                var password        = AppHost.Settings.Get(StorageKey, "encryptedpassword" + n, string.Empty) as string ?? string.Empty;
                var dataServiceName = AppHost.Settings.Get(StorageKey, "dataservicename" + n, string.Empty) as string ?? string.Empty;

                if (!string.IsNullOrEmpty(password))
                {
                    password = blowFish.Decrypt_ECB(password);
                }
                else
                {
                    password = AppHost.Settings.Get(StorageKey, "password" + n, string.Empty) as string ?? string.Empty;
                }

                var connection = new Connection
                {
                    UserName        = userName,
                    Password        = password,
                    HostName        = server,
                    DataServiceName = dataServiceName,
                    WebRootPath     = folder,
                    Description     = siteName,
                    UseWindowsAuth  = useWindowsAuth
                };

                ConnectionManager.Add(connection);
                n++;
            }

            ConnectionManager.Save();
            ConnectionManager.Clear();

            FavoriteManager.Clear();
            Storage.Delete(StorageKey);
        }
Ejemplo n.º 5
0
        public static async Task addToGroupByNum(int number, SampleDataGroup group)
        {
            string url = "http://xkcd.com/" + number + "/info.0.json";

            JsonObject json = await GetAsync(url);

            string month      = json.GetNamedString("month");
            int    num        = (int)json.GetNamedNumber("num");
            string link       = json.GetNamedString("link");
            string year       = json.GetNamedString("year");
            string news       = json.GetNamedString("news");
            string safe_title = json.GetNamedString("safe_title");
            string transcript = json.GetNamedString("transcript");
            string alt        = json.GetNamedString("alt");
            string img        = json.GetNamedString("img");
            string title      = json.GetNamedString("title");
            string day        = json.GetNamedString("day");

            //localize?
            string fulldate = month + "/" + day + "/" + year;


            var localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            var oldimg      = img;

            if (!await Download(img, num))
            {
                img = "ms-appdata:///local/" + num + ".png";
            }
            string         ns = num.ToString();
            SampleDataItem newcomic;

            if (group.Title == "Favorites")
            {
                ns             = ns + " ";
                newcomic       = new SampleDataItem(ns, title, fulldate, img, transcript, alt, group, oldimg);
                newcomic.isFav = true;
            }
            else
            {
                newcomic = new SampleDataItem(ns, title, fulldate, img, transcript, alt, group, oldimg);
            }
            if (FavoriteManager.isFavorite(num))
            {
                newcomic.isFav = true;
            }

            group.Items.Add(newcomic);
        }
Ejemplo n.º 6
0
        private void DropItems([NotNull] IEnumerable <IItem> items)
        {
            Debug.ArgumentNotNull(items, nameof(items));

            var favorites = FavoriteManager.GetFavorites();

            var index = favorites.IndexOf(Favorite);

            if (adorner.LastPosition == ControlDragAdornerPosition.Bottom)
            {
                index++;
            }

            ((FavoriteRootTreeViewItem)Parent).AddFavorites(items, index);
        }
Ejemplo n.º 7
0
        private void DropFavorites([NotNull] List <BaseTreeViewItem> items)
        {
            Debug.ArgumentNotNull(items, nameof(items));

            var favorites = FavoriteManager.GetFavorites();

            var inserts = new List <Favorite>();

            foreach (var item in items)
            {
                var favoriteItem = (FavoriteTreeViewItem)item;

                inserts.Add(favoriteItem.Favorite);

                favorites.Remove(favoriteItem.Favorite);
            }

            inserts.Reverse();

            var index = favorites.IndexOf(Favorite);

            if (adorner.LastPosition == ControlDragAdornerPosition.Bottom)
            {
                index++;
            }

            if (index < 0)
            {
                index = 0;
            }

            foreach (var favorite in inserts)
            {
                favorites.Insert(index, favorite);
            }

            FavoriteManager.Save();

            var parent = (ItemsControl)Parent;

            for (var i = 0; i < items.Count; i++)
            {
                var item = (FavoriteTreeViewItem)items[i];

                parent.Items.Remove(item);
                parent.Items.Insert(index, item);
            }
        }
        public ActionResult Favorites()
        {
            var fvrManager = new FavoriteManager();
            var user = GetUserByLogin();

            var lstFavorites = fvrManager.GetByUser(user.Id);
            string strJSON = JsonConvert.SerializeObject(
                lstFavorites,
                Formatting.Indented,
            new JsonSerializerSettings
            {
                PreserveReferencesHandling = PreserveReferencesHandling.Objects
            });

            return Json(strJSON, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 9
0
        public void AddFavorites([NotNull] IEnumerable <IItem> baseItems, int index)
        {
            Assert.ArgumentNotNull(baseItems, nameof(baseItems));

            if (Items.Count == 1 && Items[0] == DummyTreeViewItem.Instance)
            {
                Expand(false);
            }

            var favorites = FavoriteManager.GetFavorites();

            if (index < 0 || index > favorites.Count())
            {
                index = favorites.Count();
            }

            foreach (var item in baseItems)
            {
                var fullPath         = item.Name;
                var itemTreeViewItem = item as ItemTreeViewItem;
                if (itemTreeViewItem != null)
                {
                    fullPath = itemTreeViewItem.GetPath();
                }

                var favorite = new Favorite
                {
                    Name           = item.Name,
                    ItemVersionUri = new ItemVersionUri(item.ItemUri, LanguageManager.CurrentLanguage, Version.Latest),
                    FullPath       = fullPath,
                    Icon           = item.Icon
                };

                favorites.Insert(index, favorite);

                var favoriteTreeViewItem = new FavoriteTreeViewItem
                {
                    Text = favorite.Name
                };

                favoriteTreeViewItem.Initialize(favorite);

                Items.Insert(index, favoriteTreeViewItem);
            }

            FavoriteManager.Save();
        }
Ejemplo n.º 10
0
        public IEnumerable <IItem> GetItems(DatabaseUri databaseUri)
        {
            Assert.ArgumentNotNull(databaseUri, nameof(databaseUri));

            foreach (var favorite in FavoriteManager.GetFavorites())
            {
                if (favorite.ItemVersionUri.DatabaseUri != databaseUri)
                {
                    continue;
                }

                var item = new FavoriteTreeViewItem();
                item.Initialize(favorite);

                yield return(item);
            }
        }
Ejemplo n.º 11
0
        public virtual void MoveFavorites(HttpContext context)
        {
            YZRequest      request  = new YZRequest(context);
            string         uid      = YZAuthHelper.LoginUserAccount;
            YZResourceType resType  = request.GetEnum <YZResourceType>("resType");
            string         target   = request.GetString("target");
            MovePosition   position = request.GetEnum <MovePosition>("position");
            JArray         post     = request.GetPostData <JArray>();
            List <string>  ids      = post.ToObject <List <string> >();

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    FavoriteManager.MoveFavorites(provider, cn, uid, resType, ids.ToArray(), target, position);
                }
            }
        }
Ejemplo n.º 12
0
 public IHttpActionResult PostFavorite(int id, [FromBody] Favorite favorite)
 {
     try
     {
         FavoriteManager manager = new FavoriteManager();
         favorite.customer.id = id;
         Favorite result = manager.Insertar(favorite);
         if (result != null)
         {
             return(Created(new Uri(Url.Link(ViewRouteName, new { id = result.customer.id })), result));
         }
         else
         {
             return(BadRequest());
         }
     }catch (Exception e) {
         return(NotFound());
     }
 }
Ejemplo n.º 13
0
        public void ChangeData()
        {
            IList <IGraphSceneDisplay <IVisual, IVisualEdge> > displays = new IGraphSceneDisplay <IVisual, IVisualEdge>[] { Display2 };

            Clear();

            CurrentDisplay = null;

            displays
            .Where(d => d != Display1)
            .ForEach(d => {
                Mesh.CopyDisplayProperties(Display1, d);
            });

            FavoriteManager.GoHome(Display1, true);
            GraphGraphView();
            GraphContentView();

            CurrentDisplay = Display1;
        }
Ejemplo n.º 14
0
        public virtual object CancelFavorite(HttpContext context)
        {
            YZRequest      request  = new YZRequest(context);
            YZResourceType resType  = request.GetEnum <YZResourceType>("resType");
            string         resId    = request.GetString("resId");
            string         comments = request.GetString("comments", null);
            string         uid      = YZAuthHelper.LoginUserAccount;

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    if (FavoriteManager.HasFavorited(provider, cn, uid, resType, resId))
                    {
                        FavoriteManager.DeleteFavorite(provider, cn, uid, resType, resId);
                    }

                    return(false);
                }
            }
        }
Ejemplo n.º 15
0
        public override bool GetChildren(GetChildrenDelegate callback, bool async)
        {
            Assert.ArgumentNotNull(callback, nameof(callback));

            var result = new List <BaseTreeViewItem>();

            var favorites = FavoriteManager.GetFavorites();

            foreach (var favorite in favorites)
            {
                var favoriteTreeViewItem = new FavoriteTreeViewItem
                {
                    Text = favorite.Name
                };

                favoriteTreeViewItem.Initialize(favorite);

                result.Add(favoriteTreeViewItem);
            }

            callback(result);

            return(true);
        }
        public ActionResult RemoveFavorite(Favorite item)
        {
            var fvrManager = new FavoriteManager();
            var user = GetUserByLogin();

            fvrManager.Delete(item.Id, user.Id);

            return View();
        }
Ejemplo n.º 17
0
        public virtual JObject GetFavoriteProcesses(HttpContext context)
        {
            //System.Threading.Thread.Sleep(3000);
            YZRequest    request = new YZRequest(context);
            string       path    = request.GetString("path", null);
            BPMPermision perm    = request.GetEnum <BPMPermision>("perm", BPMPermision.Execute);
            string       uid     = YZAuthHelper.LoginUserAccount;

            FavoriteCollection favirites;

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    favirites = FavoriteManager.GetFavorites(provider, cn, uid, YZResourceType.Process);
                }
            }

            BPMProcessCollection processes;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                processes = cn.GetProcessList(path, favirites.ResIDs, perm);
            }

            //将数据转化为Json集合
            JObject rv = new JObject();

            rv[YZJsonProperty.total] = processes.Count;

            JArray children = new JArray();

            rv[YZJsonProperty.children] = children;

            foreach (BPMProcess process in processes)
            {
                if (!process.Property.MobileInitiation)
                {
                    continue;
                }

                JObject item = new JObject();
                children.Add(item);

                item["ProcessName"]    = process.Name;
                item["Active"]         = process.Active;
                item["ProcessVersion"] = process.Version.ToString(2);
                item["Description"]    = process.Property.Description;
                item["RelatedFile"]    = process.Property.RelatedFile;

                item["ShortName"] = process.Property.ShortName;
                item["Color"]     = process.Property.Color;

                if (String.IsNullOrEmpty(process.Property.ShortName))
                {
                    item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(process.Name);
                }
            }

            return(rv);
        }
Ejemplo n.º 18
0
        private void CollectCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            HelpDocFrame page = _pageTabControl.SelectedItem as HelpDocFrame;

            FavoriteManager.CollectPage(page);
        }
Ejemplo n.º 19
0
        private void CollectCommand_Executed1(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            HelpDocFrame page = GetFrameByPageIndex((_helpDocTreeView.HelpDocTree.SelectedItem as HelpDocTreeItem).PageIndex);

            FavoriteManager.CollectPage(page);
        }
Ejemplo n.º 20
0
 private void DeleteCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
 {
     FavoriteManager.DeletePage(_helpDocFavorite.CollectList.SelectedItem as HelpDocFrame);
 }
Ejemplo n.º 21
0
 private void DeleteAllCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
 {
     FavoriteManager.DeleteAllPages();
 }
Ejemplo n.º 22
0
        private void CollectCommand_Executed2(object sender, ExecutedRoutedEventArgs e)
        {
            HelpDocFrame page = GetFrameByPageIndex((_helpDocSearch.CollectList.SelectedItem as HelpDocFrame).PageIndex);

            FavoriteManager.CollectPage(page);
        }
Ejemplo n.º 23
0
 public FavoriteController(FavoriteManager favoriteManager)
 {
     m_favoriteManager = favoriteManager;
 }