Exemplo n.º 1
0
 private void LoadData()
 {
     try
     {
         var list = logic.Read(null);
         if (list != null)
         {
             dataGridViewDeals.DataSource              = list;
             dataGridViewDeals.Columns[0].Visible      = false;
             dataGridViewDeals.Columns[1].Visible      = false;
             dataGridViewDeals.Columns[2].Visible      = false;
             dataGridViewDeals.Columns[3].Visible      = false;
             dataGridViewDeals.Columns[4].AutoSizeMode =
                 DataGridViewAutoSizeColumnMode.Fill;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        private void DealForm_Load(object sender, EventArgs e)
        {
            try
            {
                List <EmployeeVM> Elist = Elogic.Read(null);
                if (Elist != null)
                {
                    comboBoxEmployee.DisplayMember = "Surname";
                    comboBoxEmployee.ValueMember   = "Id";
                    comboBoxEmployee.DataSource    = Elist;
                    comboBoxEmployee.SelectedItem  = null;
                }
                List <ApplicantVM> Alist = Alogic.Read(null);
                if (Alist != null)
                {
                    comboBoxApplicant.DisplayMember = "Surname";
                    comboBoxApplicant.ValueMember   = "Id";
                    comboBoxApplicant.DataSource    = Alist;
                    comboBoxApplicant.SelectedItem  = null;
                }
                List <VacancyVM> Vlist = Vlogic.Read(new VacancyBM {
                    Employment = false
                });
                if (Vlist != null)
                {
                    comboBoxVacancy.DisplayMember = "Position";
                    comboBoxVacancy.ValueMember   = "Id";
                    comboBoxVacancy.DataSource    = Vlist;
                    comboBoxVacancy.SelectedItem  = null;
                }
                if (id.HasValue)
                {
                    var view = Dlogic.Read(new DealBM {
                        Id = id
                    })?[0];
                    if (view != null)
                    {
                        dateTimePickerDate.Value = view.Date;

                        EmployeeVM employee = Elogic.Read(new EmployeeBM {
                            Id = view.EmployeeId
                        })?[0];
                        foreach (var currentEmployee in Elist)
                        {
                            if (currentEmployee.Id == employee.Id)
                            {
                                comboBoxEmployee.SelectedItem = currentEmployee;
                            }
                        }

                        ApplicantVM applicant = Alogic.Read(new ApplicantBM {
                            Id = view.ApplicantId
                        })?[0];
                        foreach (var currentApplicant in Alist)
                        {
                            if (currentApplicant.Id == applicant.Id)
                            {
                                comboBoxApplicant.SelectedItem = currentApplicant;
                            }
                        }
                        Vlist = Vlogic.Read(new VacancyBM {
                            Employment = true
                        });

                        VacancyVM vacancy = Vlogic.Read(new VacancyBM {
                            Id = view.VacancyId
                        })?[0];
                        foreach (var currentVacancy in Vlist)
                        {
                            if (currentVacancy.Id == vacancy.Id)
                            {
                                comboBoxVacancy.SelectedItem = currentVacancy;
                            }
                        }
                        Vlist = Vlogic.Read(new VacancyBM {
                            Employment = false
                        });
                        if (Elist != null)
                        {
                            comboBoxVacancy.DisplayMember = "Position";
                            comboBoxVacancy.ValueMember   = "Id";
                            comboBoxVacancy.DataSource    = Vlist;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
 public Tuple <List <Deal>, int, Dictionary <string, string>, List <string> > Read(int page, int size, string order, List <string> select, string keyword, string filter)
 {
     return(DealLogic.Read(page, size, order, select, keyword, filter));
 }