/// <summary> /// 获取条件通道 /// </summary> /// <param name="city"></param> /// <param name="street"></param> /// <param name="site"></param> /// <param name="uid"></param> /// <returns></returns> public static MyGroup GetGroupShows(string city = null, string street = null, string site = null, string uid = null) { string url = Url + "/video/equipments"; if (!string.IsNullOrEmpty(city)) { url += $"?city={city}"; } if (!string.IsNullOrEmpty(street)) { url += $"&street={street}"; } if (!string.IsNullOrEmpty(site)) { url += $"&site={site}"; } if (!string.IsNullOrEmpty(uid)) { url += $"&uid={uid}"; } JObject obj = WebClinetHepler.GetJObject(url); if (obj == null) { return(null); } MyGroup show = JsonConvert.DeserializeObject <MyGroup>(obj["result"].ToString()); return(show); }
private void InitializeComboBox() { showgroups = MyGroup.GetGetGroups(); SetShowTree(); SetShowGroups(); SetCityComboBox(); }
public int Get(string input) { var regex = new Regex("!."); var input2 = regex.Replace(input.Replace("!!", string.Empty), string.Empty); var root = new MyGroup(null, false); var currentNode = root; for (var i = 1; i < input2.Length - 1; i++) { if (!currentNode.IsGarbage) { if (input2[i] == '{') { currentNode = new MyGroup(currentNode, false); } else if (input2[i] == '}') { currentNode = currentNode.Parent; } else if (input2[i] == '<') { currentNode = new MyGroup(currentNode, true); } } else { if (input2[i] == '>') { currentNode = currentNode.Parent; } } } return(root.TotalScore); }
private void DeleteEqipToolStripMenuItem_Click(object sender, EventArgs e) { List <TreeListNode> nodes = GetGroupCheckNode(); if (nodes.Count == 0) { return; } Dictionary <int, List <int> > trees = new Dictionary <int, List <int> >(); foreach (TreeListNode node in nodes) { if (node.Level == 0) { continue; } if (!trees.Keys.Contains(int.Parse(node.ParentNode.Tag.ToString()))) { trees.Add(int.Parse(node.ParentNode.Tag.ToString()), new List <int>()); } trees[int.Parse(node.ParentNode.Tag.ToString())].Add(int.Parse(node.Tag.ToString())); } foreach (var item in trees.Keys) { if (!MyGroup.DeleteEquipmentToGroup(item, trees[item])) { MessageBox.Show($"{item}:分组移除失败"); } } SetShowGroups(); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (EditionNumber != null) { if (EditionNumber.Length > 2) { throw new ValidationException(ValidationRules.MaxLength, "EditionNumber", 2); } } if (MyHash != null) { if (MyHash.Length > 8) { throw new ValidationException(ValidationRules.MaxLength, "MyHash", 8); } } if (Language != null) { if (Language.Length > 6) { throw new ValidationException(ValidationRules.MaxLength, "Language", 6); } } if (MyGroup != null) { MyGroup.Validate(); } if (Alias != null) { if (Alias.Length > 64) { throw new ValidationException(ValidationRules.MaxLength, "Alias", 64); } } }
public virtual void Update(MyGroup entity) { if (entity != null) { this.Context.Entry <MyGroup>(entity).State = EntityState.Modified; } }
private void comboBox_site_SelectedIndexChanged(object sender, EventArgs e) { showgroups = GroupData.GetGroupShows(comboBox_city.Text, comboBox_street.Text, comboBox_site.Text); SetShowTree(); SetUidComboBox(); comboBox_uid.Text = string.Empty; }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="Microsoft.Rest.ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (MyGroup != null) { MyGroup.Validate(); } }
private void InitializeComboBox() { showgroups = MyGroup.GetGetGroups(); equipment = new AddEquipment(); SetShowTree(); SetCityComboBox(); }
public static MyGroup GetAlEquipment() { string url = Url + $"/video/equipments"; JObject obj = WebClinetHepler.GetJObject(url); MyGroup equipments = JsonConvert.DeserializeObject <MyGroup>(obj["result"].ToString()); return(equipments); }
public ItemDetailPage(GroupPage gp, MyGroup mg) { InitializeComponent(); this.gp = gp; //создание таблицы учащихся this.mg = mg; update_page(); }
public static List <MyGroup> MyGroup_List(string Key, int PageIndex, int PageSize) { string userid = IESCookie.GetCookieValue("ies"); MyGroup model = new MyGroup { UserID = int.Parse(userid), Key = Key }; return(new MyGroupBLL().MyGroup_List(model, PageIndex, PageSize)); }
public IdentityResult UpdateGroup(MyGroup group) { _groupStore.Update(group); foreach (var groupUser in group.MyUsers) { this.RefreshUserGroupRoles(groupUser.UserId); } return(IdentityResult.Success); }
private void button1_Click(object sender, EventArgs e) { if (!MyGroup.AddGroup(textBox1.Text.Trim())) { MessageBox.Show("添加失败"); return; } OnSave(); this.Close(); }
public async Task <IdentityResult> UpdateGroupAsync(MyGroup group) { await _groupStore.UpdateAsync(group); foreach (var groupUser in group.MyUsers) { await this.RefreshUserGroupRolesAsync(groupUser.UserId); } return(IdentityResult.Success); }
public virtual void Delete(MyGroup group) { this.ThrowIfDisposed(); if (group == null) { throw new ArgumentNullException("group"); } this._groupStore.Delete(group); this.Context.SaveChanges(); }
public virtual async Task DeleteAsync(MyGroup group) { this.ThrowIfDisposed(); if (group == null) { throw new ArgumentNullException("group"); } this._groupStore.Delete(group); await this.Context.SaveChangesAsync(); }
// This method adds a MyGroup instance to the collection public void SomeMethod() { // Some default values. You can pass parameters to this method // and then use parameters to initialize the MyGroup instance MyGroup grp = new MyGroup(); grp.RowIndex = 0; grp.ColumnIndex = 0; grp.ObjectValue = null; objMyGrp.Add(grp); iGrpCount++; }
private void deletegroupToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show($"是否删除{treeList2.FocusedNode.GetValue(0)}的分组?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } if (!MyGroup.DeleteGroup(int.Parse(treeList2.FocusedNode.Tag.ToString()))) { MessageBox.Show("删除分组失败"); return; } SetShowGroups(); }
private static async Task <IActiveDirectoryGroup?> ProcessGroupAsync(MyGroup item, IActiveDirectoryGroup[] list, Azure.IAuthenticated authenticated) { Log(0, "==========================================="); Log(0, "Processing Group"); Log(1, item); var cur = list.FirstOrDefault(x => x.Inner.MailNickname == item.MailNickname); if (cur == null && !item.Delete) { Log(2, "Creating Group"); cur = await authenticated.ActiveDirectoryGroups .Define(item.Name) .WithEmailAlias(item.MailNickname) .CreateAsync(); } if (cur != null) { Log(2, cur); if (item.Delete) { Log(2, "Deleting Group"); await authenticated.ActiveDirectoryGroups.DeleteByIdAsync(cur.Id); return(null); } // // update // if (!string.Equals(cur.Name, item.Name, StringComparison.OrdinalIgnoreCase)) // { // Log(2, "Recreating Group"); // await authenticated.ActiveDirectoryGroups.DeleteByIdAsync(cur.Id); // // // cur = await authenticated.ActiveDirectoryGroups // .Define(item.Name) // .WithEmailAlias(item.MailNickname) // .CreateAsync(); // } // cur.Manager.Inner.Groups.GetWithHttpMessagesAsync() } return(cur); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(defaultTextBox1.Text.Trim())) { return; } if (!MyGroup.UpdateGroup(int.Parse(Tree.Tag.ToString()), defaultTextBox1.Text.Trim())) { MessageBox.Show("修改失败"); return; } OnSave(); this.Close(); }
private async void name_groups_ItemTapped(object sender, ItemTappedEventArgs e) { ((ListView)sender).SelectedItem = null; ListGroup listGroupev = e.Item as ListGroup; if (listGroupev != null) { foreach (MyGroup mg in Groups.groups) { if (mg.group == listGroupev.Group_name) { MyGroup mg1 = mg; await Navigation.PushModalAsync(new ItemDetailPage(this, mg1)); } } } }
private void addtogroupToolStripMenuItem_Click(object sender, EventArgs e) { List <TreeListNode> nodes = GetEquipmentCheckNode(); if (treeList2.FocusedNode == null || treeList2.FocusedNode.Level != 0) { MessageBox.Show("请选中需要添加的分组"); return; } List <int> ids = nodes.Select(t => int.Parse(t.Tag.ToString())).ToList(); if (!MyGroup.AddEquipmentToGroup(int.Parse(treeList2.FocusedNode.Tag.ToString()), ids)) { MessageBox.Show("添加失败"); return; } InitializeComboBox(); }
static void Main() { Dictionary <string, MyGroup> output = new Dictionary <string, MyGroup>(); // First Pass: Figure out Children and Users foreach (string start in groupMembers.Keys) { MyGroup group = new MyGroup(); group.Identity = start; HashSet <string> Users = new HashSet <string>(); group.Members = GetChildrenAndUsers(start, ref Users); group.Users = Users; output.Add(start, group); } // Second Pass: Figure out the Parents: List <string> outer = output.Keys.ToList(); List <string> inner = output.Keys.ToList(); foreach (string outerKey in outer) { MyGroup group = output[outerKey]; group.MemberOf = new HashSet <string>(); foreach (string innerKey in inner) { MyGroup group2 = output[innerKey]; if (group2.Identity != group.Identity) { if (group2.Members.Contains(group.Identity)) { group.MemberOf.Add(group2.Identity); } } } } // Display the results: foreach (MyGroup group in output.Values) { Console.Write(group.ToString()); Console.WriteLine("--------------------------------------------------"); } Console.Write("Press Enter to Quit"); Console.ReadLine(); }
private void item_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (!_handle) { return; } MyGroup group = sender as MyGroup; CurrentItem = group.SelectedItem; //clear the selection in the other groups: _handle = false; foreach (MyGroup g in Groups) { if (g != group) { g.SelectedItem = null; } } _handle = true; }
public int Get(string input) { var regex = new Regex("!."); var input2 = regex.Replace(input.Replace("!!", string.Empty), string.Empty); MyGroup root = null; var currentNode = root; foreach (var c in input2) { if (currentNode == null || !currentNode.IsGarbage) { if (c == '{') { currentNode = new MyGroup(currentNode, false); } else if (c == '}') { currentNode = currentNode.Parent; } else if (c == '<') { currentNode = new MyGroup(currentNode, true); } } else { if (c == '>') { currentNode = currentNode.Parent; } else { currentNode.GarbageCount++; } } root = root ?? currentNode; } return(root.TotalGarbageCount); }
public async Task <Paged <IGrouping <Tuple <ProductType, string, string>, RequirementItem> > > GetPagedGroupsGroupedByResStandard( Expression <Func <RequirementItem, bool> > filter, int pageIndex = 0, int pageSize = 0, string includeProperties = "") { IQueryable <RequirementItem> query = Context.Set <RequirementItem>(); if (filter != null) { query = query.Where(filter); } foreach (var includeProperty in includeProperties.Split (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { query = query.Include(includeProperty); } var groupQuery = query .GroupBy(i => new { i.ResName, i.StandardName, i.ProductType }); var count = await groupQuery.CountAsync(); if (pageIndex != 0 && pageSize != 0) { groupQuery = groupQuery.OrderBy(g => g.Key).Skip(pageSize * (pageIndex - 1)).Take(pageSize); } var resultGroups = await groupQuery.ToListAsync(); var myGroups = new List <MyGroup <Tuple <ProductType, string, string>, RequirementItem> >(); foreach (var resultGroup in resultGroups) { var myGroup = new MyGroup <Tuple <ProductType, string, string>, RequirementItem>( resultGroup, Tuple.Create(resultGroup.Key.ProductType, resultGroup.Key.ResName, resultGroup.Key.StandardName)); myGroups.Add(myGroup); } return(new Paged <IGrouping <Tuple <ProductType, string, string>, RequirementItem> >(myGroups, count)); }
static void Main(string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); //var url = "http://fenix.imgbabes.com/i/00741/okyqv0u8xeup_t.jpg"; //var client = new Http_Client(); //var stream = client.get(url); //Image img = Image.FromStream(stream); //img.Save("e:/a_a.jpg"); //WebClient wc = new WebClient(); //var item= wc.DownloadData(url); //setOption(); int start = 0, end = 0; start = Config.Start_numb > Config.End_numb ? Config.End_numb : Config.Start_numb; end = Config.Start_numb > Config.End_numb ? Config.Start_numb : Config.End_numb; var grouplist = MyGroup.GetCroup(start, end, Config.Task_count); int currentTaskId = 0; List <Task> taskList = new List <Task>(); foreach (var group in grouplist) { currentTaskId++; var task = Task.Factory.StartNew((taskid) => { HtmlHelp_mongo hh = new HtmlHelp_mongo(); hh.Init(group.Start, group.End, (int)taskid); }, currentTaskId); taskList.Add(task); } Task.WaitAll(taskList.ToArray()); Console.WriteLine(); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine(); Console.WriteLine("----------------------全部已完成!-------------------------------"); Console.WriteLine(); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine(); Console.Read(); }
/// <summary> /// 获取我的联系组列表 /// </summary> /// <param name="model"></param> /// <returns></returns> public void MyGroup_List(HttpContext context) { MyGroup model = new MyGroup { UserID = UserService.CurrentUser.UserID, Key = context.Request["Key"] }; int PageIndex = Convert.ToInt32(context.Request["PageIndex"]); int PageSize = Convert.ToInt32(context.Request["PageSize"]); IES.G2S.CourseLive.BLL.Test.MyGroupBLL bll = new IES.G2S.CourseLive.BLL.Test.MyGroupBLL(); List <MyGroup> list = bll.MyGroup_List(model, PageIndex, PageSize); if (list != null) { context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(list)); } else { context.Response.Write("False"); } }
public Window1ViewModel() { groups.CollectionChanged += (s, e) => { if (e.NewItems != null) { foreach (object item in e.NewItems) { (item as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged); } } if (e.OldItems != null) { foreach (object item in e.OldItems) { (item as INotifyPropertyChanged).PropertyChanged -= new PropertyChangedEventHandler(item_PropertyChanged); } } ; }; var GroupA = new MyGroup("Group A"); GroupA.Item.Add(new MyGroupItem("Item 1", 1.0)); GroupA.Item.Add(new MyGroupItem("Item 2", 1.0)); GroupA.Item.Add(new MyGroupItem("Item 3", 1.0)); Groups.Add(GroupA); var GroupB = new MyGroup("Group B"); GroupB.Item.Add(new MyGroupItem("Item 1", 1.0)); GroupB.Item.Add(new MyGroupItem("Item 2", 1.0)); GroupB.Item.Add(new MyGroupItem("Item 3", 1.0)); Groups.Add(GroupB); currentItem = GroupA.Item[0]; }