Esempio n. 1
0
        private void dgvBranchOffice_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                // Thiết lập chọn từng dòng
                dgvBranchOffice.Rows[e.RowIndex].Selected = true;

                // Load data from grid to control
                DataGridViewRow row = dgvBranchOffice.Rows[e.RowIndex];
                txtID.Text    = row.Cells[0].Value.ToString();
                txtName.Text  = row.Cells[1].Value.ToString();
                txtPhone.Text = row.Cells[2].Value.ToString().Trim();
                txtFax.Text   = row.Cells[3].Value.ToString().Trim();
                object       objLocationID = row.Cells[4].Value;
                clsComboItem item          = clsComboItem.GetItemCombo(objLocationID, cboLocation);
                cboLocation.SelectedItem = item;
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
        }
Esempio n. 2
0
        private void LoadDataToCombobox()
        {
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable();

            try
            {
                ds = LocationDAO.LoadDataCombobox();
                if (ds != null && ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0].Copy();
                    cboLocation.Items.Add(new clsComboItem(-1, ""));
                    foreach (DataRow item in dt.Rows)
                    {
                        clsComboItem itemCbo = new clsComboItem();
                        itemCbo.Value   = item["Value"];
                        itemCbo.Display = item["Display"].ToString();
                        cboLocation.Items.Add(itemCbo);
                    }
                    cboLocation.SelectedIndex = dt.Rows.Count > 0 ? 0 : -1;
                    dt.Clear();
                }
                ds.Clear();
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            finally
            {
                ds.Dispose();
                dt.Dispose();
            }
        }
Esempio n. 3
0
        private void dgvEmployee_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                // Thiết lập chọn từng dòng
                dgvEmployee.Rows[e.RowIndex].Selected = true;

                // Load data from grid to control
                DataGridViewRow row = dgvEmployee.Rows[e.RowIndex];
                txtID.Text      = row.Cells[0].Value.ToString();
                txtName.Text    = row.Cells[1].Value.ToString();
                txtAddress.Text = row.Cells[2].Value.ToString();
                txtPhone.Text   = row.Cells[3].Value.ToString();
                string sGender = row.Cells[4].Value.ToString();
                chkFemale.Checked = sGender == "True" ? true : false;
                string sBirthday = row.Cells[5].Value.ToString();
                dtpBirthday.Text = sBirthday;
                txtSalary.Text   = row.Cells[6].Value.ToString();
                object       objIDBranchOffice = row.Cells[7].Value;
                clsComboItem item = clsComboItem.GetItemCombo(objIDBranchOffice, cboBranchOffice);
                cboBranchOffice.SelectedItem = item;
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
        }
Esempio n. 4
0
        private void dgvCustomer_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                // Thiết lập chọn từng dòng
                dgvCustomer.Rows[e.RowIndex].Selected = true;

                // Load data from grid to control
                DataGridViewRow row = dgvCustomer.Rows[e.RowIndex];
                txtID.Text          = row.Cells[0].Value.ToString();
                txtName.Text        = row.Cells[1].Value.ToString();
                txtPhone.Text       = row.Cells[2].Value.ToString();
                txtAddress.Text     = row.Cells[3].Value.ToString();
                txtDescription.Text = row.Cells[4].Value.ToString();
                string sAbilityRent = row.Cells[5].Value.ToString();
                chkAbilityRent.Checked = sAbilityRent == "True" ? true : false;
                object       objIDBranchOffice = row.Cells[6].Value;
                clsComboItem item = clsComboItem.GetItemCombo(objIDBranchOffice, cboBranchOffice);
                cboBranchOffice.SelectedItem = item;
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
        }
Esempio n. 5
0
        private void dgvPreview_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                // Thiết lập chọn từng dòng
                dgvPreview.Rows[e.RowIndex].Selected = true;

                // Load data from grid to control
                DataGridViewRow row        = dgvPreview.Rows[e.RowIndex];
                object          objIDHouse = row.Cells[0].Value;
                clsComboItem    itemHouse  = clsComboItem.GetItemCombo(objIDHouse, cboHouse);
                cboHouse.SelectedItem = itemHouse;
                object       objIDCustomer = row.Cells[4].Value;
                clsComboItem itemCustomer  = clsComboItem.GetItemCombo(objIDCustomer, cboCustomer);
                cboCustomer.SelectedItem = itemCustomer;
                dtpPreviewDate.Text      = row.Cells[6].Value.ToString();
                txtComment.Text          = row.Cells[7].Value.ToString();
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
        }
Esempio n. 6
0
        private void dgvHouse_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                // Thiết lập chọn từng dòng
                dgvHouse.Rows[e.RowIndex].Selected = true;

                // Load data from grid to control
                DataGridViewRow row = dgvHouse.Rows[e.RowIndex];
                txtID.Text         = row.Cells[0].Value.ToString();
                txtRoomNumber.Text = row.Cells[1].Value.ToString();
                txtFeeMonth.Text   = row.Cells[2].Value.ToString();

                object       objIDHouseholder = row.Cells[3].Value;
                clsComboItem itemHouseholder  = clsComboItem.GetItemCombo(objIDHouseholder, cboHouseholder);
                cboHouseholder.SelectedItem = itemHouseholder;

                object       objIDEmployee = row.Cells[5].Value;
                clsComboItem itemEmployee  = clsComboItem.GetItemCombo(objIDEmployee, cboEmployee);
                cboEmployee.SelectedItem = itemEmployee;

                object       objHouseType  = row.Cells[7].Value;
                clsComboItem itemHouseType = clsComboItem.GetItemCombo(objHouseType, cboHouseType);
                cboHouseType.SelectedItem = itemHouseType;

                object       objIDLocation  = row.Cells[9].Value;
                clsComboItem itemIDLocation = clsComboItem.GetItemCombo(objIDLocation, cboLocation);
                cboLocation.SelectedItem = itemIDLocation;
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
        }