private void next_btn_Click(object sender, EventArgs e) { InterpolContext context = new InterpolContext(); ClearObjects(); GlobalTab gl = new GlobalTab(); GlobalTab.pages_count = gl.PageCount(context.Persons.Count()); if (Convert.ToUInt32(page_label.Text) == GlobalTab.pages_count) { next_btn.Enabled = false; back_btn.Enabled = true; } else { next_btn.Enabled = true; page_label.Text = (int.Parse(page_label.Text) + 1).ToString(); } }
private void Main_Form_Shown(object sender, EventArgs e) { if (GlobalTab.exit == true) { Close(); } ClearObjects(); InterpolContext context = new InterpolContext(); GlobalTab gl = new GlobalTab(); GlobalTab.pages_count = gl.PageCount(context.Persons.Count()); var personList = context.Persons.OrderBy(c => c.person_id).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(1, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(100, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } FWelcome wform = new FWelcome(); wform.ShowDialog(); GlobalTab.pages_count = gl.PageCount(context.Persons.Count()); GlobalTab.count_datarows = context.Persons.Count(); Count_row_lbl.Text = GlobalTab.count_datarows.ToString(); }
private void button2_Click_2(object sender, EventArgs e) { GlobalTab.filter = true; if (radioButton1.Checked == true) { ClearObjects(); InterpolContext context = new InterpolContext(); var banditsList = context.Parameters.Where(c => c.person_rise >= numericUpDown1.Value && c.person_rise <= numericUpDown2.Value && c.person_weight >= numericUpDown3.Value && c.person_weight <= numericUpDown4.Value).ToList(); foreach (var r in banditsList) { GlobalTab.list_dataid.Add(r.person_id); } GlobalTab gl = new GlobalTab(); GlobalTab.pages_count = gl.PageCount(banditsList.Count()); Count_row_lbl.Text = banditsList.Count().ToString(); ClearObjects(); if (int.Parse(page_label.Text) == 1) { var personList = context.Persons.Where(c => GlobalTab.list_dataid.Contains(c.person_id)).OrderBy(c => c.person_id).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(1, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } } else { var personList = context.Persons.Where(c => GlobalTab.list_dataid.Contains(c.person_id)).OrderBy(c => c.person_id).Skip(12 * int.Parse(page_label.Text) - 12).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(10, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } Count_row_lbl.Text = GlobalTab.count_datarows.ToString(); } GlobalTab.list_dataid.Clear(); } else { if (radioButton2.Checked == true) { ClearObjects(); InterpolContext context = new InterpolContext(); var banditsList = context.Persons.Where(c => c.person_name == filtername_box.Text).ToList(); foreach (var r in banditsList) { GlobalTab.list_dataid.Add(r.person_id); } GlobalTab gl = new GlobalTab(); GlobalTab.pages_count = gl.PageCount(banditsList.Count()); Count_row_lbl.Text = banditsList.Count().ToString(); ClearObjects(); if (int.Parse(page_label.Text) == 1) { var personList = context.Persons.Where(c => GlobalTab.list_dataid.Contains(c.person_id)).OrderBy(c => c.person_id).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(1, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } } else { var personList = context.Persons.Where(c => GlobalTab.list_dataid.Contains(c.person_id)).OrderBy(c => c.person_id).Skip(12 * int.Parse(page_label.Text) - 12).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(10, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } Count_row_lbl.Text = GlobalTab.count_datarows.ToString(); } GlobalTab.list_dataid.Clear(); } else { if (radioButton3.Checked == true) { ClearObjects(); InterpolContext context = new InterpolContext(); int syndicate_id = context.Syndicates.Where(c => c.syn_name == syndicate_name_box.Text).Select(c => c.syn_id).FirstOrDefault(); var banditsList = context.PSRelations.Where(c => c.sys_id == syndicate_id).ToList(); foreach (var r in banditsList) { GlobalTab.list_dataid.Add(r.person_id); } GlobalTab gl = new GlobalTab(); GlobalTab.pages_count = gl.PageCount(banditsList.Count()); page_label.Text = "1"; back_btn.Enabled = false; Count_row_lbl.Text = banditsList.Count().ToString(); ClearObjects(); if (int.Parse(page_label.Text) == 1) { var personList = context.Persons.Where(c => GlobalTab.list_dataid.Contains(c.person_id)).OrderBy(c => c.person_id).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(1, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } } else { var personList = context.Persons.Where(c => GlobalTab.list_dataid.Contains(c.person_id)).OrderBy(c => c.person_id).Skip(12 * int.Parse(page_label.Text) - 12).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(10, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } Count_row_lbl.Text = GlobalTab.count_datarows.ToString(); } GlobalTab.list_dataid.Clear(); } } } }
private void timer1_Tick(object sender, EventArgs e) { GlobalTab gl = new GlobalTab(); InterpolContext context = new InterpolContext(); GlobalTab.pages_count = gl.PageCount(context.Persons.Count()); if (Convert.ToUInt32(page_label.Text) == GlobalTab.pages_count) { next_btn.Enabled = false; if (GlobalTab.pages_count == 1) { back_btn.Enabled = false; } else { back_btn.Enabled = true; } } else { next_btn.Enabled = true; } if (GlobalTab.filter == false) { if (int.Parse(Count_row_lbl.Text) != GlobalTab.count_datarows) { GlobalTab.pages_count = gl.PageCount(context.Persons.Count()); GlobalTab.count_datarows = context.Persons.Count(); Count_row_lbl.Text = GlobalTab.count_datarows.ToString(); ClearObjects(); if (int.Parse(page_label.Text) == 1) { var personList = context.Persons.OrderBy(c => c.person_id).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(1, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } } else { var personList = context.Persons.OrderBy(c => c.person_id).Skip(12 * int.Parse(page_label.Text) - 12).Take(12).ToList(); for (int i = 0; i < personList.Count(); i++) { GlobalTab.dic1.Add(i, new Panel()); GlobalTab.dic1[i].Name = "panelC" + i; Controls.Add(GlobalTab.dic1[i]); panel1.Controls.Add(GlobalTab.dic1[i]); GlobalTab.dic1[i].Size = new Size(200, 100); GlobalTab.dic1[i].BorderStyle = BorderStyle.Fixed3D; GlobalTab.dic1[i].Location = new Point(10 + GlobalTab.width, 10 + GlobalTab.heaight); GlobalTab.dic1[i].Click += new EventHandler(panel_click); GlobalTab.dic1[i].Cursor = Cursors.Hand; GlobalTab.dic1[i].MouseDown += new MouseEventHandler(panel_mouseDown); GlobalTab.dic1[i].MouseUp += new MouseEventHandler(panel_mouseUp); GlobalTab.dic1[i].ContextMenuStrip = data_menu; GlobalTab.dic1[i].Tag = personList.ElementAt(i).person_id.ToString(); // Создание Label с словаря dic2 внутри созданного рание Panel(dic1) GlobalTab.dic2.Add(i, new Label()); GlobalTab.dic2[i].Name = "labeldicOne" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic2[i]); GlobalTab.dic2[i].Location = new Point(10, 10); GlobalTab.dic2[i].AutoSize = false; GlobalTab.dic2[i].Size = new Size(180, 14); GlobalTab.dic2[i].Text = personList.ElementAt(i).person_name.ToString(); // Создание Label с словаря dic3 внутри созданного рание Panel(dic1) GlobalTab.dic3.Add(i, new Label()); GlobalTab.dic3[i].Name = "labeldicTwo" + i; GlobalTab.dic1[i].Controls.Add(GlobalTab.dic3[i]); GlobalTab.dic3[i].Location = new Point(160, 50); GlobalTab.dic3[i].Text = personList.ElementAt(i).person_id.ToString(); if (GlobalTab.width >= 660) { GlobalTab.width = 0; GlobalTab.heaight += 130; } else { GlobalTab.width += 220; } } } Count_row_lbl.Text = GlobalTab.count_datarows.ToString(); } } }