예제 #1
0
        //update data for dtgv
        private void load_data()
        {
            var dt = docgia_ctrl.select_all_docgia();

            switch (dt.errcode)
            {
            case Models.ErrorCode.NaN:
                dtgv.DataSource = dt.data;
                break;

            case Models.ErrorCode.sucess:
                dtgv.DataSource = dt.data;
                Utils.chang_title_datagridViewCell(dtgv, new List <string> {
                    "Mã ĐG", "Tên ĐG", "Ngày sinh", "Giới tính", "Lớp", "Địa chỉ", "Email"
                });
                break;

            case Models.ErrorCode.fail:
                if (Utils.switch_false())
                {
                    MessageBox.Show(dt.errInfor);
                }
                break;

            default:
                break;
            }
        }
예제 #2
0
        private void frm_capnhat_docgia_Load(object sender, EventArgs e)
        {
            load_data();
            List <how_to_search> dt_source = new List <how_to_search>();

            dt_source.Add(new how_to_search("Số phiếu mượn", "sophieumuon"));
            dt_source.Add(new how_to_search("Độc giả", "docgia"));

            cbx_option_search.DataSource    = dt_source;
            cbx_option_search.DisplayMember = "value";
            cbx_option_search.ValueMember   = "key";

            docgia_ctrl   docgia   = new docgia_ctrl();
            nhanvien_ctrl nhanvien = new nhanvien_ctrl();

            var data_docgia = docgia.select_all_docgia();

            switch (data_docgia.errcode)
            {
            case ErrorCode.NaN:
                break;

            case ErrorCode.sucess:
                cbx_docgia.DisplayMember = "tendocgia";
                cbx_docgia.ValueMember   = "madocgia";
                cbx_docgia.DataSource    = data_docgia.data;
                cbx_docgia.SelectedIndex = -1;
                break;

            case ErrorCode.fail:
                break;

            default:
                break;
            }
            var data_nhanvien = nhanvien.select_all_nhanvien();

            switch (data_nhanvien.errcode)
            {
            case ErrorCode.NaN:
                break;

            case ErrorCode.sucess:
                cbx_nhanvien.DisplayMember = "tennhanvien";
                cbx_nhanvien.ValueMember   = "manhanvien";
                cbx_nhanvien.DataSource    = data_nhanvien.data;
                cbx_nhanvien.SelectedIndex = -1;
                break;

            case ErrorCode.fail:
                break;

            default:
                break;
            }

            dtgv_sachmuon.Rows[0].Cells[0].Selected = true;
        }