Esempio n. 1
0
        private void Edit()
        {
            try
            {
                int selectedColumn = GridViewCallRecords.CurrentCell.ColumnIndex;
                DataGridViewColumn selectcolumn = GridViewCallRecords.Columns[selectedColumn];
                if (selectcolumn.HeaderText == "Edit")
                {
                    int             selectedrow = GridViewCallRecords.SelectedCells[0].RowIndex;
                    DataGridViewRow selectRow   = GridViewCallRecords.Rows[selectedrow];


                    DataTable dt = new DataTable();
                    //dt = new Bll.MainWindow().GetGrideData(" and con.ContactID=" + selectRow.Cells["ContactID"].Value.ToString() + "");
                    dt = new Bll.CallRecords().GetGrideData(" and car.CallID =" + selectRow.Cells["CallID"].Value.ToString() + "");

                    if (dt.Rows.Count > 0)
                    {
                        this.btnSave.Text = "Update";
                        AssigntoControls(dt);
                        EnableSearch(false);
                        btNew.Enabled = false;
                    }
                    else
                    {
                        throw (new Exception("Unable To Load Info!"));
                    }
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Esempio n. 2
0
        private void GridViewCallRecords_SelectionChanged(object sender, EventArgs e)
        {
            if (ActiveControl == null)
            {
                return;
            }
            else if (ActiveControl.Name != this.GridViewCallRecords.Name)
            {
                return;
            }
            try
            {
                if (GridViewCallRecords.Rows.Count > 0)
                {
                    int selectedrow = GridViewCallRecords.CurrentCell.RowIndex;

                    DataGridViewRow selectRow = GridViewCallRecords.Rows[GridViewCallRecords.CurrentCell.RowIndex];

                    ctrlClear();

                    DataTable dt = new DataTable();

                    dt = null;
                    dt = new Bll.CallRecords().GetGrideData(" and car.CallID =" + selectRow.Cells["CallID"].Value.ToString() + "");

                    if (dt.Rows.Count > 0)
                    {
                        AssigntoControls(dt);
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception Exception)
            {
                MessageBox.Show("GridViewSearch_SelectionChanged Error\n" + Exception + "", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }