Exemplo n.º 1
0
        private void EditOffice()
        {
            if (adgvOffices.Rows.Count == 0)
            {
                return;
            }

            FrmOffice form = new FrmOffice();

            form.officeID   = adgvOffices.CurrentRow.Cells["OFFICE_ID"].Value.ToString();
            form.officeText = adgvOffices.CurrentRow.Cells["OFFICE_TEXT"].Value.ToString();
            form.recordID   = Convert.ToInt32(adgvOffices.CurrentRow.Cells["ID"].Value);

            var rslt = form.ShowDialog();

            if (rslt == DialogResult.OK && form.needUpdate)
            {
                int col = adgvOffices.CurrentCell.ColumnIndex;
                int row = adgvOffices.CurrentCell.RowIndex;

                if (DS.Tables.Contains("OFFICES"))
                {
                    DS.Tables["OFFICES"].Clear();
                }

                officesAdapter.Fill(DS, "OFFICES");

                adgvOffices.CurrentCell = adgvOffices[col, row];

                dataChanged = true;
            }
        }
Exemplo n.º 2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            FrmOffice form = new FrmOffice();

            form.officeID   = "";
            form.officeText = "";

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (DS.Tables.Contains("OFFICES"))
                {
                    DS.Tables["OFFICES"].Clear();
                }

                officesAdapter.Fill(DS, "OFFICES");

                string id = form.officeID;

                MainForm.LocateAdvGridRecord(id, "OFFICE_ID", 1, adgvOffices);

                dataChanged = true;
            }
        }