示例#1
0
        private void RegisterEmployeeForm_Load(object sender, EventArgs e)
        {
            Employee employee = new Employee();
            var      q        = employee.RetrieveEmployees().Select(x => new
            {
                Display = x.fullName + " - " + x.NIK,
                Value   = x
            }).ToList();

            comboBox1.DisplayMember = "Display";
            comboBox1.ValueMember   = "Value";
            comboBox1.DataSource    = q;

            ContractType ct = new ContractType();
            var          q2 = ct.RetrieveContractTypes();

            comboBox2.DisplayMember = "ContractTypeName";
            comboBox2.DataSource    = q2;

            Branch b  = new Branch();
            var    q3 = b.RetrieveBranches();

            comboBox3.DisplayMember = "BranchName";
            comboBox3.DataSource    = q3;

            Department d  = new Department();
            var        q4 = d.RetrieveDepartments();

            comboBox4.DisplayMember = "DepartmentName";
            comboBox4.DataSource    = q4;

            Pos p  = new Pos();
            var q5 = p.RetrievePos();

            comboBox5.DisplayMember = "PosName";
            comboBox5.DataSource    = q5;

            Level l  = new Level();
            var   q6 = l.RetrieveLevels();

            comboBox6.DisplayMember = "LevelName";
            comboBox6.DataSource    = q6;
        }