public static void ShowSelectGroupDialog(this IDialogService dialogService, GroupItemModel groupItem, Action <IDialogResult> callback = default)
        {
            var parameters = new DialogParameters();

            parameters.Add("GroupItem", groupItem);
            dialogService.ShowDialog(nameof(SelectGroupView), parameters, callback);
        }
        public GroupItemViewModel(GroupItemModel group)
        {
            if (group == null)
            {
                throw new ArgumentNullException("group");
            }

            _group = group;
        }
Beispiel #3
0
 public void AddItem(GroupModel groupModel, GroupItemModel groupItems)
 {
     //_groupModels.Add();
     _groupModels.Add(groupModel);
     _groupItems.Add(groupItems);
     //panelEx1.Controls.Add(groupItem);
     //groupItem.AddDay();
     Redraw();
 }
Beispiel #4
0
 protected async Task openAddMarksPage(GroupItemModel groupId, int subjectId)
 {
     if (_pageIndex == 1 || _pageIndex == 2 || _pageIndex == 3)
     {
         await _service.Navigation.OpenAddMarks(getTitle((StatsPageEnum)_pageIndex), groupId, subjectId);
     }
     else
     {
         await _service.Navigation.OpenAddMarksPracticeAndLabs(getTitle((StatsPageEnum)_pageIndex), groupId, subjectId);
     }
 }
Beispiel #5
0
        bool setChosenGroup(GroupItemModel group)
        {
            if (group != null)
            {
                CurrentGroup = group;
                ChosenGroup  = group.GroupName;
                PlatformServices.Preferences.ChosenGroupId = group.GroupId;
                return(true);
            }

            return(false);
        }
Beispiel #6
0
        private async void CheckStatus(object state)
        {
            if (_isChecking)
            {
                return;
            }
            _isChecking = true;

            GroupItemModel model = (GroupItemModel)state;


            double _current = 0;
            string filePath = Path.Combine(_settings.DownloadFolder, model.Group.Name, "files", model.Item.Name);

            if (File.Exists(filePath))
            {
                FileInfo info = new FileInfo(filePath);
                _current = info.Length;
            }


            double temp   = 0;
            double loaded = _current - _lastCurrent;

            _lastCurrent = _current;
            _lastReadList.Add(loaded);
            if (_lastReadList.Count > 10)
            {
                _lastReadList.RemoveAt(0);
            }

            foreach (double readed in _lastReadList)
            {
                temp += readed;
            }

            double averageRead = (temp / _lastReadList.Count);

            if (averageRead <= 0.1 || averageRead > 209715200)
            {
                _isChecking = false;
                return;
            }

            double percent = Math.Floor((_current / model.Item.Size) * 100);
            await SocketHandler.Instance.SendIDPercentage(model.Item, averageRead, percent.ToString());


            _isChecking = false;
        }
 public ActionResult Create(GroupItemModel groupItem)
 {
     ViewBag.Parent_Item = _group_itemHandler.GetGroupItemsForParent().Data;
     if (ModelState.IsValid)
     {
         var result = _group_itemHandler.InsertGroupItem(groupItem);
         if (result != null)
         {
             return(RedirectToAction("Index", "Group_Item"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm mới nhóm hàng hóa không thành công!");
         }
     }
     return(View("Index"));
 }
Beispiel #8
0
        public override void Init()
        {
            CurrentGroup = new GroupItemModel()
            {
                GroupId = _service.Preferences.GroupId, GroupName = _service.Preferences.GroupName
            };

            setStudents(_studentsList);

            Task.Run(async() =>
            {
                if (_studentsList == null || _studentsList.Count == 0)
                {
                    await update();
                }
            });

            GroupChanged += async(id, name) => await update();
        }
Beispiel #9
0
 public void CheckCredentials_NoEmptyFields_False(string userName, string password, string confirmPassword,
                                                  string name, string surName, int groupId)
 {
     try
     {
         var group          = new GroupItemModel();
         var mockedServices = Mock.Of <IPlatformServices>();
         var reg            = new RegistrationPageViewModel(mockedServices);
         reg.UserName        = userName;
         reg.Password        = password;
         reg.ConfirmPassword = confirmPassword;
         reg.Name            = name;
         reg.Surname         = surName;
         reg.Group           = group;
         group.Id            = groupId;
         var actual = reg.checkCredentials();
         Assert.IsFalse(actual);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Beispiel #10
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <returns></returns>
        public Task Initialize()
        {
            return(Task.Run(() =>
            {
                var element = !string.IsNullOrEmpty(Id)
                    ? _cache.GetGroup(Id)
                    : _cache.Root;

                // TODO: handle group not found
                var group = new GroupItemModel(element);
                DisplayName = group.Name;

                var groups = group
                             .ListGroups()
                             .Select(x => new GroupItemViewModel(x));

                var entries = group
                              .ListEntries()
                              .Select(x => new EntryItemViewModel(x));

                _items.AddRange(groups
                                .Concat <object>(entries));
            }));
        }
Beispiel #11
0
        //Lấy danh sách list nhóm hang hóa cha
        public Response <List <GroupItemModel> > GetGroupItemsForParentAndChild()
        {
            try
            {
                using (var unitOfWorkStore = new UnitOfWorkStore(dbFactory))
                {
                    var rpGroupItem         = unitOfWorkStore.GetRepository <GroupItem>();
                    var listGroupItemEntity = rpGroupItem.GetAll();
                    var query = (from obGroupItem in listGroupItemEntity
                                 select new GroupItemModel()
                    {
                        GroupItem_ID = obGroupItem.GroupItem_ID,
                        GroupItem_Code = obGroupItem.GroupItem_Code,
                        Name = obGroupItem.Name,
                        TitleKey = obGroupItem.TitleKey,
                        ParentId = obGroupItem.ParentId,
                        ParenName = obGroupItem.ParenName
                    }).ToList();


                    query = query.Where(x => x.ParentId == null).ToList();
                    var con = (from obGroupItem in listGroupItemEntity
                               select new GroupItemModel()
                    {
                        GroupItem_ID = obGroupItem.GroupItem_ID,
                        GroupItem_Code = obGroupItem.GroupItem_Code,
                        Name = obGroupItem.Name,
                        TitleKey = obGroupItem.TitleKey,
                        ParentId = obGroupItem.ParentId,
                        ParenName = obGroupItem.ParenName
                    }).ToList();
                    con = con.Where(x => x.ParentId != null).ToList();
                    List <GroupItemModel> rt    = new List <GroupItemModel>();
                    List <GroupItemModel> rtcon = new List <GroupItemModel>();
                    // order
                    if (query != null && query.Count > 0)
                    {
                        foreach (var item in query)
                        {
                            rtcon = con.Where(x => x.ParentId == item.TitleKey).ToList();
                            GroupItemModel cat = new GroupItemModel();
                            if (rtcon != null && rtcon.Count > 0)
                            {
                                //public int GroupItem_ID { get; set; }
                                //public string GroupItem_Code { get; set; }
                                //public string Name { get; set; }
                                //public string TitleKey { get; set; }
                                //public string ParentId { get; set; }
                                //public string ParenName { get; set; }
                                cat.GroupItem_ID   = item.GroupItem_ID;
                                cat.GroupItem_Code = item.GroupItem_Code;
                                cat.Name           = item.Name;
                                rt.Add(cat);
                                foreach (GroupItemModel it in rtcon)
                                {
                                    it.Name = "---" + it.Name + "---";
                                    rt.Add(it);
                                }
                            }
                            else
                            {
                                cat.GroupItem_ID   = item.GroupItem_ID;
                                cat.GroupItem_Code = item.GroupItem_Code;
                                cat.Name           = item.Name;
                                cat.TitleKey       = item.TitleKey;
                                rt.Add(cat);
                            }
                        }
                    }

                    return(new Response <List <GroupItemModel> >((int)StatusResponses.Success, 0, MessageResConst.Success, rt));
                }
            }
            catch (Exception ex)
            {
                return(new Response <List <GroupItemModel> >((int)StatusResponses.ErrorSystem, 0, ex.Message, null));
            }
        }
Beispiel #12
0
        public GroupItemModelTests()
        {
            _element = XElement.Parse(@"<Group>
    <UUID>GO5heTuMikaOm0x+OtJ0Hg==</UUID>
    <Name>General</Name>
    <Notes>Notes for General group.</Notes>
    <IconID>48</IconID>
    <Times>
        <LastModificationTime>2013-09-30T14:57:10Z</LastModificationTime>
        <CreationTime>2010-12-06T15:19:29Z</CreationTime>
        <LastAccessTime>2013-09-30T14:57:10Z</LastAccessTime>
        <ExpiryTime>2013-09-29T16:00:00Z</ExpiryTime>
        <Expires>False</Expires>
        <UsageCount>15</UsageCount>
        <LocationChanged>2010-12-06T15:19:29Z</LocationChanged>
    </Times>
    <IsExpanded>True</IsExpanded>
    <DefaultAutoTypeSequence>asdasd</DefaultAutoTypeSequence>
    <EnableAutoType>true</EnableAutoType>
    <EnableSearching>false</EnableSearching>
    <LastTopVisibleEntry>mJPnOQNd5kSKLbRj20Fw6g==</LastTopVisibleEntry>
    <Entry>
        <UUID>c2+BwE1hjUWGHo1QnydKGQ==</UUID>
        <IconID>0</IconID>
        <ForegroundColor />
        <BackgroundColor />
        <OverrideURL />
        <Tags />
        <Times>
            <LastModificationTime>2011-07-02T15:03:52Z</LastModificationTime>
            <CreationTime>2010-12-06T15:19:56Z</CreationTime>
            <LastAccessTime>2013-09-30T14:56:49Z</LastAccessTime>
            <ExpiryTime>2011-05-05T15:19:56Z</ExpiryTime>
            <Expires>False</Expires>
            <UsageCount>3</UsageCount>
            <LocationChanged>2010-12-06T15:19:56Z</LocationChanged>
        </Times>
        <String>
            <Key>Address</Key>
            <Value Protected='True'>JrlyF2YLe/YUT7E2oH0rRuPx/C8H64HNXnr3H+VElg==</Value>
        </String>
        <String>
            <Key>CCV</Key>
            <Value Protected='True'>LASl</Value>
        </String>
        <String>
            <Key>Credit Card</Key>
            <Value Protected='True'>HSaLhBSIYWr54WeKv6616YBeDg==</Value>
        </String>
        <String>
            <Key>Notes</Key>
            <Value>This entry has a protected fields which is encrypted.
7Pass supports protected fields and display them correctly.</Value>
        </String>
        <String>
            <Key>Password</Key>
            <Value Protected='True'>99vDEC8eGw5FgteIXYQnfQN4UE4=</Value>
        </String>
        <String>
            <Key>Title</Key>
            <Value>Protected Fields</Value>
        </String>
        <String>
            <Key>URL</Key>
            <Value />
        </String>
        <String>
            <Key>UserName</Key>
            <Value>SomeUser</Value>
        </String>
        <AutoType>
            <Enabled>True</Enabled>
            <DataTransferObfuscation>0</DataTransferObfuscation>
        </AutoType>
        <History />
    </Entry>
    <Entry>
        <UUID>mJPnOQNd5kSKLbRj20Fw6g==</UUID>
        <IconID>0</IconID>
        <CustomIconUUID>wjHliQR9Qk+C62qV/yBAEA==</CustomIconUUID>
        <ForegroundColor>#FF0080</ForegroundColor>
        <BackgroundColor>#0000FF</BackgroundColor>
        <OverrideURL>asdas das dasd asd as das das d</OverrideURL>
        <Tags>asda asd a dads;asdad</Tags>
        <Times>
            <LastModificationTime>2013-09-30T14:47:34Z</LastModificationTime>
            <CreationTime>2010-12-06T15:22:29Z</CreationTime>
            <LastAccessTime>2013-09-30T14:56:59Z</LastAccessTime>
            <ExpiryTime>2011-05-05T15:22:29Z</ExpiryTime>
            <Expires>False</Expires>
            <UsageCount>18</UsageCount>
            <LocationChanged>2010-12-06T15:22:29Z</LocationChanged>
        </Times>
        <String>
            <Key>Notes</Key>
            <Value>This entry has URL with fields in its URL.
7Pass parses it correctly and provide the user with the formatted URL.

Please do not use URLs with your password because the URL may be sent unencrypted over the network.</Value>
        </String>
        <String>
            <Key>Password</Key>
            <Value Protected='True'>22U6J74KFNSkoLsTHFI72JZdGFo=</Value>
        </String>
        <String>
            <Key>Secret</Key>
            <Value Protected='True'>fY1SDAYvpujL</Value>
        </String>
        <String>
            <Key>Title</Key>
            <Value>Fields In Url</Value>
        </String>
        <String>
            <Key>URL</Key>
            <Value>http://www.somesite.com/User/{S:UserID}/{S:Secret}</Value>
        </String>
        <String>
            <Key>UserID</Key>
            <Value>123456</Value>
        </String>
        <String>
            <Key>UserName</Key>
            <Value>Some User</Value>
        </String>
        <Binary>
            <Key>IMG_0010.jpg</Key>
            <Value Ref='0' />
        </Binary>
        <Binary>
            <Key>README</Key>
            <Value Ref='1' />
        </Binary>
        <AutoType>
            <Enabled>True</Enabled>
            <DataTransferObfuscation>0</DataTransferObfuscation>
        </AutoType>
        <History />
    </Entry>
    <Group>
        <UUID>6+o9z+jKD0Ovzw+Me88SoA==</UUID>
        <Name>test</Name>
        <Notes />
        <IconID>0</IconID>
        <Times>
            <LastModificationTime>2011-06-23T14:04:11Z</LastModificationTime>
            <CreationTime>2011-06-23T14:04:11Z</CreationTime>
            <LastAccessTime>2011-06-23T14:04:11Z</LastAccessTime>
            <ExpiryTime>2011-06-23T14:04:11Z</ExpiryTime>
            <Expires>False</Expires>
            <UsageCount>0</UsageCount>
            <LocationChanged>2011-06-23T14:04:11Z</LocationChanged>
        </Times>
        <IsExpanded>True</IsExpanded>
        <DefaultAutoTypeSequence />
        <EnableAutoType>null</EnableAutoType>
        <EnableSearching>null</EnableSearching>
        <LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
    </Group>
    <Group>
        <UUID>StleL7AiDkaCWYVyjSvqUw==</UUID>
        <Name>gfdg</Name>
        <Notes />
        <IconID>0</IconID>
        <Times>
            <LastModificationTime>2011-07-02T15:02:45Z</LastModificationTime>
            <CreationTime>2011-07-02T15:02:45Z</CreationTime>
            <LastAccessTime>2011-07-02T15:02:45Z</LastAccessTime>
            <ExpiryTime>2011-07-02T15:02:45Z</ExpiryTime>
            <Expires>False</Expires>
            <UsageCount>0</UsageCount>
            <LocationChanged>2011-07-02T15:02:45Z</LocationChanged>
        </Times>
        <IsExpanded>True</IsExpanded>
        <DefaultAutoTypeSequence />
        <EnableAutoType>null</EnableAutoType>
        <EnableSearching>null</EnableSearching>
        <LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
    </Group>
</Group>");
            _group   = new GroupItemModel(_element);
        }
Beispiel #13
0
        public async Task LoadFull(GroupItemModel item)
        {
            item.Item = await _dictionaryRepository.GetAsync(item.Type, item.WordId);

            item.IsLoadFull = true;
        }
        public ActionResult Index(int?pageSize, int?pageCurrent, string column, string orderASCorDSC, GroupItemModel groupItemModel)
        {
            if (pageSize == null)
            {
                pageSize = MessageResConst.PageSize;
            }
            if (pageCurrent == null)
            {
                pageCurrent = 1;
            }
            ViewBag.PageSize = ListPageSize.GetListPageSize();

            var listGroup_Item            = _group_itemHandler.GetGroupItems((int)pageSize, (int)pageCurrent, column, orderASCorDSC, groupItemModel);
            Group_ItemViewModel viewModel = new Group_ItemViewModel();

            viewModel.ListGroup_ItemModel = listGroup_Item.Data;
            int size = (double)listGroup_Item.CountData % (int)pageSize == 0 ? listGroup_Item.CountData / (int)pageSize : listGroup_Item.CountData / (int)pageSize + 1;

            viewModel.DisplayPage = pageCurrent.ToString() + "/" + size.ToString();
            viewModel.CountPage   = size;
            if (orderASCorDSC == MessageResConst.Increase)
            {
                ViewBag.Order = MessageResConst.Decrease;
            }
            else
            {
                ViewBag.Order = MessageResConst.Increase;
            }
            return(View(viewModel));
        }