Example #1
0
        private void PrepareContractor()
        {
            ViewRepository repo = new ViewRepository();

            try
            {
                var total = repo.ContractorTotalHours()
                            .Where(s => s.Id == Convert.ToInt16(comboBox1.SelectedValue))
                            .FirstOrDefault().Total;
                txtTotalHoursWorked.Text = total.ToString();
            }
            catch
            {
                txtTotalHoursWorked.Text = "0";
            }

            var items = repo.ContractTimeSheetMonths()
                        .Where(s => s.ContractorId == Convert.ToInt16(comboBox1.SelectedValue)).ToList();

            dataGridView1.DataSource           = items;
            dataGridView1.Columns[0].Visible   = false;
            dataGridView1.Columns[1].Visible   = false;
            dataGridView1.RowHeadersVisible    = false;
            dataGridView1.ColumnHeadersVisible = false;
            dataGridView1.SelectionMode        = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.MultiSelect          = false;
            GetMonth();

            queryResult = repo.HDMQuery1().Where(x => x.ContractorId == Convert.ToInt16(comboBox1.SelectedValue)).ToList();

            currentContractor = new LookupRepository().GetContractors().FirstOrDefault(e => e.ID == Convert.ToInt16(comboBox1.SelectedValue));
            Populate();
        }