public MainViewModel() { _mainModel = new MainModel(); _tokenInfo = new TokenInfo(); GroupFriendList = new GroupList<Friend, int>(); MessageList = new ObservableCollectionWithDict<Dialog, int>(); ContactsList = new GroupList<Contact, string>(); }
public bool Check(string uri,string authorization,ref string authName) { //�F���X�g var authList = new AuthList((Dat)_conf.Get("authList")); //�F���X�g�Ƀq�b�g���Ă��邩�ǂ����̊m�F var oneAuth = authList.Search(uri); if (oneAuth == null) return true;//�F���X�g�Ƀq�b�g�Ȃ� //���M����Ă����F�؏��i���[�U�{�p�X���[�h�j�̎擾 var user = ""; var pass = ""; if (!CheckHeader(authorization, ref user, ref pass)) goto err; //�F���X�g�iAuthList�j�ɓ��Y���[�U�̒�`�����݂��邩�ǂ��� if (!oneAuth.Seartch(user)) { var find = false;//�O���[�v���X�g���烆�[�U�������ł��邩�ǂ��� //�F���X�g�Œ��ڃ��[�U����������Ȃ������ꍇ�A�O���[�v���X�g��������� //�O���[�v���X�g var groupList = new GroupList((Dat)_conf.Get("groupList")); foreach (OneGroup o in groupList){ if (!oneAuth.Seartch(o.Group)) continue; if (!o.Seartch(user)) continue; find = true;//�ꉞ���[�U�Ƃ��ĔF�߂��Ă��� break; } if (!find) { _logger.Set(LogKind.Secure,null,6, string.Format("user:{0} pass:{1}", user, pass));//�F�G���[�i�F���X�g�ɒ�`����Ă��Ȃ����[�U����̃A�N�Z�X�ł��j"; goto err; } } //�p�X���[�h�̊m�F var userList = new UserList((Dat)_conf.Get("userList")); var oneUser = userList.Search(user); if (oneUser == null) { //���[�U���X�g�ɏ���݂��Ȃ� _logger.Set(LogKind.Secure,null,7,string.Format("user:{0} pass:{1}", user, pass));//�F�G���[�i���[�U���X�g�ɓ��Y���[�U�̏����܂���j"; } else { if (oneUser.Pass == pass) {//�p�X���[�h��v _logger.Set(LogKind.Detail,null, 8,string.Format("Authrization success user:{0} pass:{1}", user, pass));//�F�ؐ��� return true; } //�p�X���[�h�s��v _logger.Set(LogKind.Secure,null,9,string.Format("user:{0} pass:{1}", user, pass));//�F�G���[�i�p�X���[�h���Ⴂ�܂��j"; } err: authName = oneAuth.AuthName; return false;//�F�G���[���� }
public void Init(List <FriendsReq> list) { if (list.Count == 0) { tip.Visible = true; return; } int[] array = new int[list.Count]; for (int i = 0; i < list.Count; i++) { if (list[i].destid == GlobalClass.CurrentUser.Id) { array[i] = list[i].userid; } else { array[i] = list[i].destid; } } string str = string.Join(",", array); string usersStr = HTTPUtil.SendGetRequest(Util.GetHttpUrl() + "/getUsersByUserid/" + str); JArray usersArray = JArray.Parse(usersStr); for (int k = 0; k < list.Count; k++) { for (int i = 0; i < usersArray.Count; i++) { int id = int.Parse((string)usersArray[i]["id"]); if (array[k] == id) { User destUser = new User() { Id = id, Name = (string)usersArray[i]["name"], Account = (string)usersArray[i]["account"], Sex = char.Parse((string)usersArray[i]["sex"]), Birthday = DateTime.Parse((string)usersArray[i]["birthday"]), Headimage = (string)usersArray[i]["headimage"] }; FriendsReq fr = list[k]; fr.DestUser = destUser; GroupList g = new GroupList(); g.fr = fr; g.Init(); g.Dock = DockStyle.Top; this.Controls.Add(g); break; } } } }
public GroupList SelectRows(DbTransaction pTran, System.Int32?Id, System.String name) { GroupList GroupList = new GroupList(); Exception exception = null; DbParameter[] Parameters = new DbParameter[2]; Parameters[0] = _getIdParameter(Id, ParameterDirection.Input); Parameters[1] = _getnameParameter(name, ParameterDirection.Input); DbDataReader Dr = ExecuteReader(pTran, "[Lookups].[SelectGroup]", Parameters); try { if (Dr != null) { while (Dr.Read()) { Group Group = new Group(); if (Dr["Id"] != DBNull.Value) { Group.Id = (System.Int32)Dr["Id"]; } if (Dr["name"] != DBNull.Value) { Group.name = (System.String)Dr["name"]; } if (Dr["status"] != DBNull.Value) { Group.status = (System.Boolean?)Dr["status"]; } GroupList.FillRow(Group); Group = null; } } } catch (Exception Ex) { exception = Ex; } finally { if (Dr != null) { if (Dr.IsClosed == false) { Dr.Close(); } Dr = null; } } return(GroupList); }
public async Task <GroupList> GetListOfGroups(string SearchKey) { string[] SearchArray = SearchKey.Split(';'); var returnV = new GroupList { List = new List <Group>() }; string liveUserID = WebOperationContext.Current.IncomingRequest.Headers["LiveUserID"]; //TODO: Cache Get the user id from cache once its implemented instead of going to storage bool isValidLiveId = await _MemberRepository.ValidateUser(liveUserID); if (!isValidLiveId) { utility.ResultsManager.AddResultInfo(returnV, ResultTypeEnum.AuthError, "You are not authorized to access this method"); return(returnV); } if (_GroupStorageAccess == null) { _GroupStorageAccess = new GroupStorageAccess(); } List <entities.Group> entityGrps = null; if (SearchKey.ToLower() != "all") { foreach (string s in SearchArray) { entityGrps = _GroupStorageAccess.GetGroupsForNameMatch(s.Replace("Name#", "")); if (entityGrps != null && entityGrps.Count > 0) { foreach (entities.Group grp in entityGrps) { returnV.List.Add(Caster.MakeContractGroupLite(grp)); } } } } else { entityGrps = _GroupStorageAccess.GetAllGroups(); if (entityGrps != null && entityGrps.Count > 0) { foreach (entities.Group grp in entityGrps) { returnV.List.Add(Caster.MakeContractGroupLite(grp)); } } } return(returnV); }
public void CountOnFiltered() { using (new SoodaTransaction()) { GroupList gl = Group.GetList(GroupField.Members.Count == 4); Assert.AreEqual(1, gl.Count); Assert.AreEqual(10, gl[0].Id); gl = Group.GetList(GroupField.Managers.Count == 1); Assert.AreEqual(2, gl.Count); gl = Group.GetList(GroupField.Managers.Count != 1); Assert.AreEqual(0, gl.Count); } }
public List <string> GetAllParameterName() { List <string> l = new List <string>(); AddParameterName(ActorList.Cast <IStoryEntityObject>().ToList(), l); AddParameterName(EventList.Cast <IStoryEntityObject>().ToList(), l); AddParameterName(GroupList.Cast <IStoryEntityObject>().ToList(), l); AddParameterName(TaskList.Cast <IStoryEntityObject>().ToList(), l); AddParameterName(StuffList.Cast <IStoryEntityObject>().ToList(), l); AddParameterName(RelationList.Cast <IStoryEntityObject>().ToList(), l); return(l); }
public DefaultGroup() { Name = "Default"; //IsDefaultGroup = true; CanBuild = true; Prefix = ""; Suffix = ""; GroupColor = Color.Gray; this.PermissionList.Add("*"); GroupList.Add(this); Group.DefaultGroup = this; }
public void UpdateTest() { Group group = new Group(); GroupList groups = new GroupList(); groups.Load(); group = groups.FirstOrDefault(c => c.Name == "BL Test"); group.Description = "BL Test Update"; int results = group.Update(); Assert.IsTrue(results == 1); }
public async Task <IActionResult> GetGroupsAsync([FromQuery] GroupGetModel model) { model.Validate(); var list = await _groupRepository.GetGroupsAsync(model.Keyword, model.Page, model.PageSize); if (list.Items.Count == 0) { throw new NotFound404Exception("page"); } return(Ok(GroupList.GetFrom(list))); }
protected void Page_Load(object sender, EventArgs e) { PostBackStr_MakeGroup = Page.ClientScript.GetPostBackEventReference(this, "MakeGroup"); string s = Request.Params.Get("Ajaxcall"); if (s == "1") { GroupList gl1 = new GroupList(); Utility u = new Utility(); //string staff_code = u.GetStaffCodefromContext(Context); string staff_code = u.GetsStaffCodefromRequest(Request); gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName); foreach (Group g in gl1._groups) { string s2 = g._GroupCode; s2 += g._GroupName; Response.Write("<option value=\"" + g._GroupID.ToString() + "\">" + g._GroupName + "</option>"); } Response.End(); return; } if (s == "3") { s = Request.Params.Get("GroupId"); Guid g1 = new Guid(s); Group gp1 = new Group(); gp1.Load(g1); gp1.Delete(); GroupList gl1 = new GroupList(); Utility u = new Utility(); //string staff_code = u.GetStaffCodefromContext(this.Context); string staff_code = u.GetsStaffCodefromRequest(Request); gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName); foreach (Group g in gl1._groups) { string s2 = g._GroupCode; s2 += g._GroupName; Response.Write("<option value=\"" + g._GroupID.ToString() + "\">" + g._GroupName + "</option>"); } Response.End(); return; } if (IsPostBack) { s = Request.Params.Get("__EVENTARGUMENT"); if (s == "MakeGroup") { ProcessMakeGroup(Request.Params.Get("__EVENTDATA")); } } }
/// <summary>Schedule a grid scan. It will happen over the course of several next ticks, depending on how large the grid is.</summary> public void ScanGrid() { if (GroupFeed != null || BlockFeed != null) { return; //grid scan already in progress, ignore } GroupList.Clear(); PB.GridTerminalSystem.GetBlockGroups(GroupList); GroupFeed = FeedList(GroupList, GroupScanTick).GetEnumerator(); Blocks.Clear(); PB.GridTerminalSystem.GetBlocks(Blocks); BlockFeed = FeedList(Blocks, BlockFound).GetEnumerator(); Tick1 += RescanTick; }
protected override void DiscardChanges() { if (IsAdding) { GroupList.Remove(CurrentGroup); IsAdding = false; } else if (IsEditing) { CurrentGroup.GroupName = oldGroup.GroupName; IsEditing = false; } ErrorMessage = string.Empty; }
public GroupDTO GetGroupByIDfromDB(int id) { ICollection <GroupDTO> outputList = default(ICollection <GroupDTO>); GroupDTO output = new GroupDTO(); try { GroupBusiness _GroupBusiness = new GroupBusiness(); GroupList _GroupList = _GroupBusiness.SelectRows(id, null); if (_GroupList != null && _GroupList.Count > 0) //outputList = Mapper.MapUserAsOutput(); { // 2- Prepare Mapping Obects (Fill Values from DB) Mapper._GroupList = fillGroupList(); //default(List<Group>); Mapper._FunctionList = fillFunctionList(); //default(List<Function>); //Mapper._UserList = _UserList; //Mapper._UserGroupList = new List<UserGroup>(); //default(List<UserGroup>); Mapper._GroupFunctionList = fillGroupFunctionList(); //default(List<GroupFunction>); //UserGroupBusiness _UserGroupBusiness = new UserGroupBusiness(); //UserGroupList _UserGroupList = default(UserGroupList); //foreach (User _User in _UserList) //{ // _UserGroupList = _UserGroupBusiness.SelectRows(null, _User.Id, null); // if (_UserGroupList != null && _UserGroupList.Count > 0) // foreach (UserGroup _UserGroup in _UserGroupList) // Mapper._UserGroupList.Add(Copier.copyUserGroup(_UserGroup)); //} // 3- Perform Mapping to Output outputList = Mapper.MapGroupAsOutput(); if (outputList != null && outputList.Count > 0) { output = outputList.First(); } } } catch (Exception ex) { // Log Exception Here throw; //new Exception(ex.Message); } return(output); }
protected void UpdateMessageList(string t) { Cerval_Globals cg1 = new Cerval_Globals(); ListBox_staff.Items.Clear(); string s1 = DropDownList_Year.SelectedValue; DateTime date1 = new DateTime(); date1 = DateTime.Now.AddMonths(0); if (t == "Group") { GroupList gl1; gl1 = new GroupList("", date1); //put the form groups first foreach (Group g in gl1._groups) { if (g._GroupCode.StartsWith(s1)) { if (g._CourseID == Cerval_Globals.RegistrationCse)//registration../ { //only for year groups... ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } } foreach (Group g in gl1._groups) { if (g._GroupCode.StartsWith(s1)) { if ((g._CourseID != Cerval_Globals.RegistrationCse) && (!Cerval_Globals.NewStructureCourses.Contains(g._CourseID))) { ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } } } if (t == "Student") { //StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", "{ fn NOW() }"); StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", DateTime.Now); ListBox_staff.SelectionMode = ListSelectionMode.Multiple; TextBox_textTo.Visible = true; } }
private async Task UpdateGroupList(ListView listView) { var json = await GetJsonByApi("groups"); if (json != null) { _groups = JsonConvert.DeserializeObject <List <GetGroupModel> >(json); if (_groups != null) { _groupListViewAdabter = new GroupList(this, _groups); listView.Adapter = _groupListViewAdabter; listView.ItemClick += GroupListItemClicked; } } }
public ManagePerformancePiece(Guid performanceId, string performanceName) { InitializeComponent(); pieces = new PieceList(); groups = new GroupList(); directors = new DirectorList(); PerformanceId = performanceId; PerformanceName = performanceName; Load(); Rebind(); lblPerformance.Content = PerformanceName; }
/// <summary> /// Handle the organization changing by repopulating the list of available groups. /// </summary> /// <param name="sender">This.</param> /// <param name="eventArgs">The event arguments.</param> private static void OnTenantChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs) { SelectSingleGroup group = sender as SelectSingleGroup; GroupList groupList = new GroupList((Guid)eventArgs.NewValue); groupList.Initialized += (s, e) => group.Populate(groupList); if (group.otherGroups.ItemsSource != null) { (group.otherGroups.ItemsSource as GroupList).Dispose(); } group.otherGroups.ItemsSource = groupList; }
public async Task InitAsync() { Configuration = new Configuration(); await Configuration.InitAsync(); // The WebAPI needs a token provider, which is the UserPreferences object we now have. WebAPI.Initialize(Configuration.CurrentUser); // Build the ListView data source from the database. This always uses the existing // database as sync with then backend happens later and the data source is updated then. GroupedItems = new GroupList(); await PopulateGroupedItemsFromDB(); // Synchronization calls are made by users of the data model. }
public User(Users user) { Id = user.Id; Username = user.Username; Displayname = user.Displayname; Firstname = user.Firstname; Lastname = user.Lastname; Ou = user.Ou; Program = user.Program; Office = user.Office; Email = user.Email; Extension = user.Extension; Title = user.Title; GroupList = user.GroupList; Passwordlastset = user.Passwordlastset; Lastlogin = user.Lastlogin; Deleted = user.Deleted; Deletiondate = user.Deletiondate; Notes = user.Notes; Expirable = user.Expirable; Lastupdate = user.Lastupdate; Active = user.Active; Groups = new List <string>(); try { if (GroupList != null) { foreach (string group in GroupList.Split(',').ToList().Where(g => g.Contains("CN=")).ToList()) { Groups.Add(group.Replace("CN=", "").Trim()); } } } catch { } try { if (Firstname != null) { SortName = Lastname + ", " + Firstname; } else { SortName = Lastname; } } catch { } }
public void LoadById() { Group group = new Group(); GroupList groups = new GroupList(); groups.Load(); group = groups.FirstOrDefault(c => c.Name == "BL Test"); Group newGroup = new Group { Id = group.Id }; newGroup.LoadById(); Assert.AreEqual(group.Name, newGroup.Name); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { GroupList.SetSortingOrder( new BocListSortingOrderEntry((IBocSortableColumnDefinition)GroupList.FixedColumns[0], SortingDirection.Ascending)); } GroupList.LoadUnboundValue(GetValues(), IsPostBack); SecurityClient securityClient = SecurityClient.CreateSecurityClientFromConfiguration(); Type groupType = SecurityManagerConfiguration.Current.OrganizationalStructureFactory.GetGroupType(); NewGroupButton.Visible = securityClient.HasConstructorAccess(groupType); }
/// <summary> /// /// </summary> /// <param name="isChange">更新到库中是全部数据还是改变的数据</param> /// <param name="changeKey"></param> protected void UpdateQueue(bool isChange = true, string changeKey = null) { var changeList = DataContainer.GetChangeQueue(changeKey, isChange); var groupList = new GroupList <string, T>(); foreach (var pair in changeList) { groupList.TryAdd(pair.Value.PersonalId, pair.Value); } TransSendParam sendParam = new TransSendParam() { IsChange = isChange }; DoSend(groupList, sendParam); }
public bool Equals(InboxRuleRequest other) { var listsAreEqual = false; switch (UserSelection) { case SystemUserSelection.Contacts: listsAreEqual = !ContactList.Except(other.ContactList).Union(other.ContactList.Except(ContactList)).Any(); break; case SystemUserSelection.Groups: listsAreEqual = !GroupList.Except(other.GroupList).Union(other.GroupList.Except(GroupList)).Any(); break; } return(UserSelection == other.UserSelection && RuleTypeUser == other.RuleTypeUser && RuleTypeSubject == other.RuleTypeSubject && Subject == other.Subject && listsAreEqual); }
/// <summary> /// 设置全校有效的组、有课的班级和有课的教师(GroupList、SquadList、TeacherList) /// </summary> private void SetDataList() { GroupList.Clear(); SquadList.Clear(); TeacherList.Clear(); foreach (EnClsLesson clsLsn in DataRule.Lsn.eachClsLesson()) { if (clsLsn.SharedTime > 0) { if (!SquadList.Contains(clsLsn.Squad)) { SquadList.Add(clsLsn.Squad); } if (clsLsn.Teacher != null && !TeacherList.Contains(clsLsn.Teacher)) { TeacherList.Add(clsLsn.Teacher); } } } GroupList.Add(AllMember); GroupList.Add(AllSquad); GroupList.Add(AllTeacher); foreach (EnSquad sqd in SquadList) { foreach (EnSquadGroup grp in DataRule.Sqd.GetGroups(sqd)) { if (!GroupList.Contains(grp)) { GroupList.Add(grp); } } } foreach (EnTeacher tch in TeacherList) { foreach (EnTeacherGroup grp in DataRule.Tch.GetGroups(tch)) { if (!GroupList.Contains(grp)) { GroupList.Add(grp); } } } }
public async Task FillFriendListAsync(string token, GroupList<Friend, int> friendList) { //Кеша foreach (Friend friend in await TaskEx.Run(() => VkStorage.FriendCashe.Cashe.GetAllAsObject<Friend>())) { friendList.AddItem(friend); } foreach (Group<Friend, int> group in friendList) foreach (Friend friend in group) friend.Photo = await UpdatePhoto(friend.PhotoUri); //Сервис const int count = 25; const int topCount = 5; int offset = 0; //Топ List<Friend> topFriend = await VkService.GetFriendListAsync(token, topCount, 0, FriendOrderType.Rate); for (int i = 0; i < topFriend.Count; i++) { Friend serviceValue = topFriend[i]; serviceValue.TopOrder = i + 1; Friend casheValue = friendList.FindEqualByKey(serviceValue); if (casheValue == null) friendList.AddItem(serviceValue); VkStorage.FriendCashe.SyncCasheWithServiceValue<Friend, int>(serviceValue, casheValue); } //Остальные while (true) { List<Friend> friends = await VkService.GetFriendListAsync(token, count, offset, FriendOrderType.FirstName); foreach (Friend serviceValue in friends.Where(friend => topFriend.All(f => f.UserId != friend.UserId))) { Friend casheValue = friendList.FindEqualByKey(serviceValue); if (casheValue == null) friendList.AddItem(serviceValue); VkStorage.FriendCashe.SyncCasheWithServiceValue<Friend, int>(serviceValue, casheValue); } offset += count; if (friends.Count != count) break; } //Фото foreach (Group<Friend, int> group in friendList) foreach (Friend friend in group) friend.Photo = await UpdatePhoto(friend.PhotoUri); //Очистка кеша от старых значений ClearFriendCashe(friendList); }
private void BindGroups() { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); GroupList g1 = prmManager.GetGroupsByOwner(Context.User.Identity.Name); GroupList g2 = prmManager.GetGroupsByAdministrator(Context.User.Identity.Name); foreach (UserGroup g in g2) { g1.Add(g); } CurrentUserGroups.DataSource = g1; CurrentUserGroups.DataBind(); UsersPerGroup.DataSource = new List <String>(); UsersPerGroup.DataBind(); prmManager.Dispose(); }
protected void BindGroups() { GroupListPanel.Visible = (UseGroupRestriction.SelectedIndex > 0); if (GroupListPanel.Visible) { GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); foreach (CommerceBuilder.Users.Group item in _ShipMethod.Groups) { ListItem listItem = GroupList.Items.FindByValue(item.Id.ToString()); if (listItem != null) { listItem.Selected = true; } } } }
private void bindGroupList() { OracleQuery2 cc2 = new OracleQuery2(); DataTable dtgroup = cc2.LoadAllGroups(); dtgroup.Columns.Add("text"); foreach (DataRow r in dtgroup.Rows) { r["text"] = r["DEPARTMENT"] + " - " + r["GROUP_NAME"]; } GroupList.DataSource = dtgroup; GroupList.DataTextField = "text"; GroupList.DataValueField = "GROUP_ID"; GroupList.DataBind(); GroupList.Items.Insert(0, new ListItem("--ทั้งหมด--", "-1")); GroupList.SelectedIndex = 0; }
protected void BindGroups() { GroupListPanel.Visible = (UseGroupRestriction.SelectedIndex > 0); if (GroupListPanel.Visible) { GroupList.DataSource = GroupDataSource.LoadAll("Name"); GroupList.DataBind(); foreach (Group group in _VolumeDiscount.Groups) { ListItem listItem = GroupList.Items.FindByValue(group.Id.ToString()); if (listItem != null) { listItem.Selected = true; } } } }
public ActionResult Groups(String status) { GroupList gl = new GroupList(); gl.Groups = _gbs.GetGroups(); if (status == null || status.Equals(GroupState.All)) { status = GroupState.All; } else { gl.Groups = gl.Groups.FindAll(s => s.Status == status); } gl.SelectedStatus = status; ViewBag.Status = status + " Groups"; return(View(gl)); }
/// <summary> /// 删除数据并移出缓存 /// </summary> /// <param name="value"></param> /// <returns></returns> public bool Delete(T value) { string key = value.GetKeyCode(); return(TryRemove(key, item => { value.OnDelete(); var groupList = new GroupList <string, T>(); groupList.TryAdd(key, value); TransSendParam sendParam = new TransSendParam() { IsChange = true }; DoSend(groupList, sendParam); return true; })); }
private void FileToDatas(string filename) { for (int dayHour = 0; dayHour < 24; dayHour++) { string monday = null; string tuesday = null; string wednesday = null; string thursday = null; string friday = null; string saturday = null; string sunday = null; Week week = new Week((dayHour + " - " + (dayHour + 1)), monday, tuesday, wednesday, thursday, friday, saturday, sunday); this.WeekGrid.RemoveAt(dayHour); this.WeekGrid.Insert(dayHour, week); } StudentList.Clear(); GroupStudentList.Clear(); GroupList.Clear(); using (var readFromFile = new StreamReader(filename)) { var deserializer = new XmlSerializer(typeof(ObservableCollection <Student>)); ObservableCollection <Student> tmpStudentList = (ObservableCollection <Student>)deserializer.Deserialize(readFromFile); foreach (var item in tmpStudentList) { StudentList.Add(item); } deserializer = new XmlSerializer(typeof(ObservableCollection <Student>)); foreach (var item in tmpStudentList) { GroupStudentList.Add(item); } deserializer = new XmlSerializer(typeof(ObservableCollection <Group>)); ObservableCollection <Group> tmpGroupList = (ObservableCollection <Group>)deserializer.Deserialize(readFromFile); foreach (var item in tmpGroupList) { GroupList.Add(item); } deserializer = new XmlSerializer(typeof(ObservableCollection <Week>)); ObservableCollection <Week> tmpWeekGrid = (ObservableCollection <Week>)deserializer.Deserialize(readFromFile); foreach (var item in tmpWeekGrid) { WeekGrid.Add(item); } } }
private async void LinkContacts(string token, GroupList<Contact, string> contactsList) { string numbers = string.Join(@",", (from @group in contactsList from contact in @group from phone in contact.PhoneNumbers select phone).ToList()); List<User> users = await VkService.GetUsersByPhoneAsync(token, numbers); foreach (Group<Contact, string> group in contactsList) foreach (Contact contact in group) foreach (User user in users.Where(user => contact.PhoneNumbers.Contains(@"+" + user.Phone))) { contact.LinkedUser = user; break; } }
public void GetContactsList(string token, GroupList<Contact, string> contactsList) { Contacts contacts = new Contacts(); Contact tmpContact; contacts.SearchCompleted += (s, e) => { foreach (Microsoft.Phone.UserData.Contact contact in e.Results) { using (var contactPhotoStream = contact.GetPicture()) { tmpContact = new Contact { DisplayName = contact.DisplayName, ContactPic = contactPhotoStream == null ? PictureDecoder.DecodeJpeg(Application.GetResourceStream(new Uri(@"/VkMessenger;component/Image/No_photo.png", UriKind.Relative)).Stream) : PictureDecoder.DecodeJpeg(contactPhotoStream) }; tmpContact.FillPhoneNumbers(contact.PhoneNumbers.Select(cpn => Regex.Replace(cpn.PhoneNumber.StartsWith("8") ? "+7" + cpn.PhoneNumber.Substring(1) : cpn.PhoneNumber, @"[^+\d]", string.Empty)).ToList()); contactsList.AddItem(tmpContact); } } LinkContacts(token, contactsList); }; contacts.SearchAsync(string.Empty, FilterKind.None, null); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Publish the service, allowing everything to use the spriteBatch Services.AddService(typeof(SpriteBatch), spriteBatch); // Player classes. player1 = new Player(this, Pallet.PlayerNumber.PlayerOne); player1.Name = "Player 1"; player2 = new Player(this, Pallet.PlayerNumber.PlayerTwo); player2.Name = "Player 2"; // Ball classes. ball = new Ball(this); // Collision groups collisionGroup = new Group("Collisions"); playerGroup = new Group("Players"); playerGroup.Add(player1.Pallet); playerGroup.Add(player2.Pallet); // Groups GroupList GameGroups = new GroupList(); GameGroups.Add(collisionGroup); GameGroups.Add(playerGroup); //Add the list of groups into the services so objects can retrieve info about items in specific groups Services.AddService(typeof(GroupList), GameGroups); // Blocks BlockList = new BlockManager(this); // Will initialize the basic graphical objects. base.Initialize(); // Goes to LoadContent() // Placed after general initialisation so the texture is already loaded and its size initialized player1.Pallet.placeInDefaultPosition(); player2.Pallet.placeInDefaultPosition(); /* Define the block safe zone, it's meant to restrict where the blocks can appear so they don't get on top of the pallet * or behind it. */ BlockList.BlocksSafeZone = new Rectangle((int)player1.Pallet.Position.X + 1, 0, (int)player2.Pallet.Position.X + (int)player2.Pallet.ObjectRectangle.Width - (int)player1.Pallet.ObjectRectangle.X - BlockList.MaxBlockSize, Window.ClientBounds.Height - BlockList.MaxBlockSize); // Places the ball in the center position and give it a random angle. ball.placeInDefaultPosition(); }
private List<UserGroup> GetExistingNonDefaultGroups(GroupList userGroups) { return userGroups.Except(GetDefaultGroups(userGroups)) .ToList<UserGroup>(); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { // 그룹 추가 MenuItem menuItem = (MenuItem)e.Source; ContextMenu contextMenu = (ContextMenu)menuItem.Parent; TreeView view = (TreeView)contextMenu.PlacementTarget; var item = view.Items[0] as GroupList; item.IsSelected = false; GroupList list = new GroupList() { Idx = -1, Name = string.Empty, Children = new ObservableCollection<GroupList>(), IsSelected = true }; glist.add(list); }
private List<UserGroup> GetAddNewGroups(GroupList userGroups) { return userGroups.Except(GetExistingNonDefaultGroups(userGroups)).Except(GetDefaultGroups(userGroups)) .Where(group => group.PolicyLevel >= GroupPolicyLevel.UsersAdd) .ToList<UserGroup>(); }
private void GroupsCallback() { var web = (HttpWebRequest)WebRequest.Create(string.Format("https://api.vkontakte.ru/method/groups.get?uid={0}&extended=1&access_token={1}", _uid, Client.Instance.Access_token.token)); web.Method = "POST"; web.ContentType = "application/x-www-form-urlencoded"; web.BeginGetResponse(delegate(IAsyncResult e) { var request = (HttpWebRequest)e.AsyncState; var response = (HttpWebResponse)request.EndGetResponse(e); var responseReader = new StreamReader(response.GetResponseStream()); _gl = new GroupList(); try { var responseString = responseReader.ReadToEnd(); var o = JObject.Parse(responseString); try { var responseArray = (JArray)o["response"]; for (int i = 1; i < responseArray.Count; i++) { _gl.Add(new GroupItem( (int)responseArray[i]["gid"], (string)responseArray[i]["name"], (string)responseArray[i]["screen_name"], (int)responseArray[i]["is_closed"], (string)responseArray[i]["type"], (string)responseArray[i]["photo"], (string)responseArray[i]["photo_medium"], (string)responseArray[i]["photo_big"] )); } Dispatcher.BeginInvoke(() => { GroupsPanel.DataContext = _gl; if (!progressBar1.IsIndeterminate) return; progressBar1.IsIndeterminate = false; }); } catch { if ((int)o["error"]["error_code"] == 260) { Dispatcher.BeginInvoke(() => { NoGroups.Text = "пользователь закрыл доступ к списку групп"; progressBar1.IsIndeterminate = false; }); } } } catch (Exception ex) { Dispatcher.BeginInvoke(() => { MessageBox.Show(ex.Message); progressBar1.IsIndeterminate = false; }); } }, web); if (progressBar1.IsIndeterminate == false) { progressBar1.IsIndeterminate = true; } }
public GetGroupsSpectraS3Response(GroupList responsePayload, int? pagingTruncated, int? pagingTotalResultCount) { this.ResponsePayload = responsePayload; this.PagingTruncated = pagingTruncated; this.PagingTotalResultCount = pagingTotalResultCount; }
private void tvGroup_LostFocusItemEvent(object sender, RoutedEventArgs e) { var source = sender as WpfTreeViewInPlaceEditControl; var lists = source.ItemsSource as GroupLists; var selitem = source.SelectedItem as GroupList; if (string.IsNullOrEmpty(selitem.Name)) { try { if (selitem.Idx == -1) { selitem.IsSelected = false; lists[0].Children.Remove(selitem); } } catch (FbException ex) { e.Handled = true; } } else { var newValue = e.Source as TextBox; GroupList olditem = new GroupList() { Idx = selitem.Idx, Name = selitem.Name, IsSelected = selitem.IsSelected, Children = new ObservableCollection<GroupList>(selitem.Children.ToList()) }; selitem.Name = newValue.Text; try { lists.update(selitem); selitem.IsSelected = false; var item = groupitems.FirstOrDefault(x => x.Idx == selitem.Idx); if (item == null) { groupitems.Add(selitem); } else { int idx = groupitems.IndexOf(item); groupitems = new ObservableCollection<GroupList>(glist.getlist()); groupitems.Insert(0, new GroupList() { Idx = 0, Name = Application.Current.FindResource("CMB_TXT_HEAD").ToString() }); cmbGroup.ItemsSource = null; cmbGroup.ItemsSource = groupitems; if (flyCustomer.IsOpen) { cmbGroup.SelectedIndex = idx; } } } catch (FbException ex) { e.Handled = true; MessageBox.Show(Application.Current.FindResource("MSG_ERR_GROUP_UPDATE").ToString(), Application.Current.FindResource("MSGBOX_TXT_TITLE").ToString()); } } }
private List<UserGroup> GetExistingNonDefaultGroups(GroupList userGroups) { return userGroups.Except(GetDefaultGroups(userGroups)).Where(group => group.PolicyLevel >= GroupPolicyLevel.UsersAdd || group.Owner == Context.User.Identity.Name) .ToList<UserGroup>(); }
private List<UserGroup> GetDefaultGroups(GroupList userGroups) { var ug = userGroups.Where(group => group.GroupName == DefaultGroups.AllUsers) .ToList<UserGroup>(); ug.Add(_permissionsManager.GetUserGroup(DefaultGroups.AnonymousUsers)); return ug; }
internal EGT(BinaryReader Reader) { EGTReader EGT = new EGTReader(Reader); EGTRecord RecType = default(EGTRecord); try { while (!EGT.EndOfFile()) { EGT.GetNextRecord(); RecType = (EGTRecord)EGT.RetrieveByte(); switch (RecType) { case EGTRecord.Property: { //Index, Name, Value int Index = 0; string Name = null; Index = EGT.RetrieveInt16(); Name = EGT.RetrieveString(); //Just discard m_Grammar.SetValue(Index, EGT.RetrieveString()); } break; case EGTRecord.TableCounts: //Symbol, CharacterSet, Rule, DFA, LALR m_SymbolTable = new SymbolList(EGT.RetrieveInt16()); m_CharSetTable = new CharacterSetList(EGT.RetrieveInt16()); m_ProductionTable = new ProductionList(EGT.RetrieveInt16()); m_DFA = new FAStateList(EGT.RetrieveInt16()); m_LRStates = new LRStateList(EGT.RetrieveInt16()); m_GroupTable = new GroupList(EGT.RetrieveInt16()); break; case EGTRecord.InitialStates: //DFA, LALR m_DFA.InitialState = EGT.RetrieveInt16(); m_LRStates.InitialState = EGT.RetrieveInt16(); break; case EGTRecord.Symbol: { //#, Name, Kind short Index = 0; string Name = null; SymbolType Type = default(SymbolType); Index = EGT.RetrieveInt16(); Name = EGT.RetrieveString(); Type = (SymbolType)EGT.RetrieveInt16(); m_SymbolTable[Index] = new Symbol(Name, Type, Index); } break; case EGTRecord.Group: //#, Name, Container#, Start#, End#, Tokenized, Open Ended, Reserved, Count, (Nested Group #...) { Group G = new Group(); G.TableIndex = EGT.RetrieveInt16(); //# G.Name = EGT.RetrieveString(); G.Container = m_SymbolTable[EGT.RetrieveInt16()]; G.Start = m_SymbolTable[EGT.RetrieveInt16()]; G.End = m_SymbolTable[EGT.RetrieveInt16()]; G.Advance = (Group.AdvanceMode)EGT.RetrieveInt16(); G.Ending = (Group.EndingMode)EGT.RetrieveInt16(); EGT.RetrieveEntry(); //Reserved int Count = EGT.RetrieveInt16(); for (int n = 1; n <= Count; n++) { G.Nesting.Add(EGT.RetrieveInt16()); } //=== Link back m_GroupStart.Add(G.Start, G); m_GroupTable[G.TableIndex] = G; } break; case EGTRecord.CharRanges: //#, Total Sets, RESERVED, (Start#, End# ...) { int Index = 0; int Total = 0; Index = EGT.RetrieveInt16(); EGT.RetrieveInt16(); //Codepage Total = EGT.RetrieveInt16(); EGT.RetrieveEntry(); //Reserved m_CharSetTable[Index] = new CharacterSet(); while (!(EGT.RecordComplete())) { m_CharSetTable[Index].Add(new CharacterRange(EGT.RetrieveUInt16(), EGT.RetrieveUInt16())); } } break; case EGTRecord.Production: //#, ID#, Reserved, (Symbol#, ...) { short Index = 0; int HeadIndex = 0; int SymIndex = 0; Index = EGT.RetrieveInt16(); HeadIndex = EGT.RetrieveInt16(); EGT.RetrieveEntry(); //Reserved List<Symbol> symbols = new List<Symbol>(); while (!(EGT.RecordComplete())) { SymIndex = EGT.RetrieveInt16(); //m_ProductionTable[Index].Handle().Add(m_SymbolTable[SymIndex]); symbols.Add(m_SymbolTable[SymIndex]); } SymbolList symbolList = new SymbolList(symbols); m_ProductionTable[Index] = new Production(m_SymbolTable[HeadIndex], Index, symbolList); } break; case EGTRecord.DFAState: //#, Accept?, Accept#, Reserved (CharSet#, Target#, Reserved)... { int Index = 0; bool Accept = false; int AcceptIndex = 0; int SetIndex = 0; short Target = 0; Index = EGT.RetrieveInt16(); Accept = EGT.RetrieveBoolean(); AcceptIndex = EGT.RetrieveInt16(); EGT.RetrieveEntry(); //Reserved if (Accept) { m_DFA[Index] = new FAState(m_SymbolTable[AcceptIndex]); } else { m_DFA[Index] = new FAState(); } //(Edge chars, Target#, Reserved)... while (!(EGT.RecordComplete())) { SetIndex = EGT.RetrieveInt16(); //Char table index Target = EGT.RetrieveInt16(); //Target EGT.RetrieveEntry(); //Reserved m_DFA[Index].Edges.Add(new FAEdge(m_CharSetTable[SetIndex], Target)); } } break; case EGTRecord.LRState: //#, Reserved (Symbol#, Action, Target#, Reserved)... { int Index = 0; int SymIndex = 0; LRActionType Action = 0; short Target = 0; Index = EGT.RetrieveInt16(); EGT.RetrieveEntry(); //Reserved m_LRStates[Index] = new LRState(); //(Symbol#, Action, Target#, Reserved)... while (!EGT.RecordComplete()) { SymIndex = EGT.RetrieveInt16(); Action = (LRActionType)EGT.RetrieveInt16(); Target = EGT.RetrieveInt16(); EGT.RetrieveEntry(); //Reserved m_LRStates[Index].Add(new LRAction(m_SymbolTable[SymIndex], Action, Target)); } } break; default: //RecordIDComment throw new ParserException("File Error. A record of type '" + (char)RecType + "' was read. This is not a valid code."); } } } catch (Exception ex) { throw new ParserException(ex.Message, ex, "LoadTables"); } }