コード例 #1
0
        private void GetAllEmployees()
        {
            dataGridView1.Rows.Clear();
            dataGridView1.ColumnCount          = 4;
            dataGridView1.ColumnHeadersVisible = true;

            // Set the column header style.
            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

            columnHeaderStyle.BackColor = Color.Beige;
            columnHeaderStyle.Font      = new Font("Verdana", 10, FontStyle.Bold);
            dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;
            dataGridView1.Columns[0].Name = "ID";
            dataGridView1.Columns[1].Name = "NAME";
            dataGridView1.Columns[2].Name = "SURNAME";
            dataGridView1.Columns[3].Name = "PHOTO";

            List <Employee> employees;
            Employee        em = new Employee();

            using (HREntities db = new HREntities())
            {
                employees = db.Employees.ToList();
                foreach (Employee st in employees)
                {
                    dataGridView1.Rows.Add(st.ID, st.NAME, st.SURNAME, st.Work_hystory.ElementAt(0).Photo);
                }
            }
        }
コード例 #2
0
        public Grafic(int EmploeeID)
        {
            this.EmploeeID = EmploeeID;
            InitializeComponent();
            Console.WriteLine("Id in chold: " + EmploeeID);
            List <Time_table> timeTable;

            using (HREntities db = new HREntities())
            {
                timeTable = db.Time_table.ToList();
            }

            //var result = from c in timeTable
            //             where c.ID_Employees.Equals(EmploeeID)
            //             orderby c.working_day_start
            //             select c;

            foreach (Time_table tt in timeTable)
            {
                if (tt.ID_Employees == EmploeeID)
                {
                    Console.WriteLine("tt: " + tt.ID_Employees);
                    this.chart1.Series[0].Points.AddXY(tt.working_day_start, tt.working_day_finish.Subtract(tt.working_day_start).Hours);
                }
            }
        }
コード例 #3
0
        public Form1()
        {
            InitializeComponent();

            List <Employee> employees;
            Employee        em = new Employee();

            using (HREntities db = new HREntities())
            {
                employees = db.Employees.ToList();
            }

            comboBox1.DataSource    = employees;
            comboBox1.DisplayMember = "ID";
            comboBox1.ValueMember   = "ID";
        }