示例#1
0
        private void LoadDate()
        {
            //로드 때 갖고오지 못하게 하기
            cmbMachines.SelectedIndexChanged  -= CmbMachines_SelectedIndexChanged;
            cmbEmployees.SelectedIndexChanged -= CmbEmployees_SelectedIndexChanged;

            // 직원 콤보 로드
            EmployeesService          eService  = new EmployeesService();
            BindingList <EmployeeDTO> ebindlist = new BindingList <EmployeeDTO>(eService.SelectAll().Where((elem) => (elem.Authority | 0b0001) == 0b0001).ToList());

            eService.Dispose();
            cmbEmployees.DataSource = ebindlist;

            // 기계 콤보 로드
            MachineService           mService  = new MachineService();
            BindingList <MachineDTO> mbindlist = new BindingList <MachineDTO>(mService.SelectAll());

            mService.Dispose();
            cmbMachines.DataSource = mbindlist;

            // 이벤트 재활성화
            cmbMachines.SelectedIndexChanged  += CmbMachines_SelectedIndexChanged;
            cmbEmployees.SelectedIndexChanged += CmbEmployees_SelectedIndexChanged;

            // 데이터그리드뷰 로드
            LoadDgvs();
        }
        private void LoadData()
        {
            EmployeesService          eService  = new EmployeesService();
            BindingList <EmployeeDTO> ebindlist = new BindingList <EmployeeDTO>(eService.SelectAll());

            eService.Dispose();
            dgvETM.DataSource = ebindlist;
            dgvETM.ClearSelection();
        }
        private void DgvETM_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if ((e.ColumnIndex == 5 || e.ColumnIndex == 6) && e.RowIndex > 0)
            {
                try
                {
                    DataGridViewRow  gvr     = dgvETM.Rows[e.RowIndex];
                    EmployeesService service = new EmployeesService();
                    service.UpdateAuthority(gvr.Cells["EmployeeID"].Value.ToString(), 7 - e.ColumnIndex);
                    service.Dispose();

                    LoadData();
                }
                catch (Exception ee) { MessageBox.Show(ee.Message); }
            }
        }
示例#4
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            EmployeeDTO myinfo = GlobalUsage.MyInfo;

            myinfo.Password = txtPassword.Text.Trim();
            myinfo.Phone    = txtPhone.Text.Trim(' ', '-');
            myinfo.Name     = txtName.Text;
            myinfo.ZipCode  = addressControl.Zip.Trim();
            myinfo.Addr1    = addressControl.Addr1.Trim();
            myinfo.Addr2    = addressControl.Addr2.Trim();

            try
            {
                CheckEmployeeDTO(myinfo);
                EmployeesService service = new EmployeesService();
                service.Update(myinfo);
                service.Dispose();
            }
            catch (Exception ee) {
                MessageBox.Show(ee.Message);
            }
        }