Ejemplo n.º 1
0
 private void JournalMeasureForm_Load(object sender, EventArgs e)
 {
     start       = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
     end         = DateTime.Now;
     users       = User.getList().Where((x) => x.IsPerson == 1).ToList();
     departments = Department.getList();
     events      = AnEvent.getList();
     UpdateItems();
     foreach (var user in users)
     {
         comboBox1.Items.Add(user.Name);
     }
     foreach (var department in departments)
     {
         comboBox2.Items.Add(department.Name);
     }
     foreach (var anEvent in events)
     {
         comboBox3.Items.Add(anEvent.Id);
     }
     if (EventId != null && EventId != 0)
     {
         AnEvent anEvent = events.First(x => x.Id == this.EventId);
         foreach (int _id in comboBox3.Items)
         {
             if (_id == anEvent.Id)
             {
                 comboBox3.SelectedIndex = comboBox3.Items.IndexOf(_id);
             }
         }
     }
 }
        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            ProgressAddEventForm addEventForm = new ProgressAddEventForm();

            addEventForm.Ev      = AnEvent.getList()[int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString())];
            addEventForm.Closed += addEventForm_Closed;
            addEventForm.ShowDialog();
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            ProgressAddEventForm addEventForm = new ProgressAddEventForm();
            DataGridViewRow      row          = dataGridView1.Rows[e.RowIndex];
            List <AnEvent>       events       = AnEvent.getList();
            var obj = events.Where((x) => x.Id == int.Parse(row.Cells["Номер"].Value.ToString())).First();

            addEventForm.Ev      = obj;
            addEventForm.Closed += addEventForm_Closed;
            addEventForm.ShowDialog();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            var id     = int.Parse(textBox1.Text);
            var list   = from _event in AnEvent.getList() where _event.Id == id select _event;
            var _Event = list.First();

            ProgressAddEventForm addEventForm = new ProgressAddEventForm();

            addEventForm.Ev      = _Event;
            addEventForm.Closed += addEventForm_Closed;
            addEventForm.ShowDialog();
        }