private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { using (var orion2019Entities = new Orion2019Entities()) { var names = from pList in orion2019Entities.pList from pDivision in orion2019Entities.PDivision from pCompany in orion2019Entities.PCompany where pList.Company == pCompany.ID && pList.Section == pDivision.ID && pCompany.Name == comboBox1.Text && pDivision.Name == orgComboBox.Text && pList.Name + " " + pList.FirstName + " " + pList.MidName == comboBox2.Text orderby pList.Name select new { pList.Name, pList.MidName, pList.FirstName, pList.Picture }; foreach (var iName in names) { try { var ms1 = new MemoryStream(iName.Picture); pictureBox1.Image = Image.FromStream(ms1); } catch (Exception) { pictureBox1.Image = null; } } } }
private void photoForm_Load(object sender, EventArgs e) { comboBox1.Items.Clear(); using (var orion2019Entities = new Orion2019Entities()) { var names = ( from u in orion2019Entities.PCompany select u.Name).Distinct(); foreach (var name in names) { comboBox1.Items.Add(name); } } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { orgComboBox.Items.Clear(); using (var orion2019Entities = new Orion2019Entities()) { var names = (from r in orion2019Entities.pList from pDivision in orion2019Entities.PDivision from pCompany in orion2019Entities.PCompany where r.Company == pCompany.ID && r.Section == pDivision.ID && pCompany.Name == comboBox1.Text select pDivision.Name).Distinct(); foreach (var name in names) { orgComboBox.Items.Add(name); } } }
private void orgComboBox_SelectedIndexChanged(object sender, EventArgs e) { comboBox2.Items.Clear(); using (var orion2019Entities = new Orion2019Entities()) { var names = from pList in orion2019Entities.pList from pDivision in orion2019Entities.PDivision from pCompany in orion2019Entities.PCompany where pList.Company == pCompany.ID && pList.Section == pDivision.ID && pCompany.Name == comboBox1.Text && pDivision.Name == orgComboBox.Text orderby pList.Name select new { pList.Name, pList.MidName, pList.FirstName }; foreach (var name in names) { comboBox2.Items.Add(name.Name + " " + name.FirstName + " " + name.MidName); } } }
private void frmMain_Load(object sender, EventArgs e) { toolStripStatusLabel1.Text = ""; toolStripProgressBar1.Visible = false; dateTimePicker1.Value = DateTime.Today.AddDays(-1); comboBox1.Items.Clear(); using (var orion2019Entities = new Orion2019Entities()) { var names = ( from u in orion2019Entities.PCompany select u.Name).Distinct(); foreach (var name in names) { comboBox1.Items.Add(name); } } Text = Text + " версия " + Application.ProductVersion; }
private void button1_Click(object sender, EventArgs e) { toolStripProgressBar1.Visible = true; dataGridView1.DoubleBuffered(true); SendMessage(dataGridView1.Handle, WM_SETREDRAW, false, 0); dataGridView1.Rows.Clear(); using (var orion2019Entities = new Orion2019Entities()) { foreach (var item in employeesCheckedListBox.CheckedItems) { var names = from pList in orion2019Entities.pList from pDivision in orion2019Entities.PDivision from pLogData in orion2019Entities.pLogData from AcessPoint in orion2019Entities.AcessPoint let point = AcessPoint.Name where pDivision.ID == pList.Section && pDivision.Name == orgComboBox.Text && pLogData.HozOrgan == pList.ID && pLogData.DeviceTime > dateTimePicker1.Value && pLogData.DeviceTime <= dateTimePicker2.Value && pList.Name + " " + pList.FirstName + " " + pList.MidName == item.ToString() && (pLogData.ZoneIndex == 0 || pLogData.ZoneIndex == 1) && pLogData.Event == 32 && pLogData.DoorIndex == AcessPoint.ID orderby pLogData.DeviceTime select new { pList.Name, pList.MidName, pList.FirstName, pList.ID, pLogData.DeviceTime, pLogData.ZoneIndex, pLogData.Remark, point }; dataGridView1.ColumnCount = 7; //dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; var rows = new List <DataGridViewRow>(); foreach (var name in names) { var a = name.ZoneIndex == 0 ? "Выход" : "Вход"; var row = new DataGridViewRow(); row.CreateCells(dataGridView1); row.Cells[0].Value = name.Name; row.Cells[1].Value = name.FirstName; row.Cells[2].Value = name.MidName; row.Cells[3].Value = Convert.ToDateTime(name.DeviceTime).ToString("dd.MM.yyyy"); row.Cells[4].Value = Convert.ToDateTime(name.DeviceTime).ToString("HH:mm:ss"); row.Cells[5].Value = a; row.Cells[6].Value = name.point; rows.Add(row); toolStripStatusLabel1.Text = "Получаем данные по сотруднику: " + name.Name + " " + name.FirstName + " " + name.MidName; SendMessage(statusStrip1.Handle, WM_SETREDRAW, true, 0); statusStrip1.Refresh(); Application.DoEvents(); } dataGridView1.Rows.AddRange(rows.ToArray()); SendMessage(dataGridView1.Handle, WM_SETREDRAW, true, 0); dataGridView1.Refresh(); } } SendMessage(dataGridView1.Handle, WM_SETREDRAW, true, 0); dataGridView1.Refresh(); toolStripStatusLabel1.Text = "Готово!"; toolStripProgressBar1.Visible = false; }