Пример #1
0
        /// <summary>
        /// dgvClient_CellClick - client datagridview cell click event for updating client record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvClient_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                ClientModel clientModel = new ClientModel();

                clientModel.ClientID            = int.Parse(dgvClient.Rows[e.RowIndex].Cells["ClientID"].Value.ToString());
                clientModel.Name                = dgvClient.Rows[e.RowIndex].Cells["Name"].Value.ToString();
                clientModel.PrimaryContactName  = dgvClient.Rows[e.RowIndex].Cells["PrimaryContactName"].Value.ToString();
                clientModel.PrimaryContactCell  = dgvClient.Rows[e.RowIndex].Cells["PrimaryContactCell"].Value.ToString();
                clientModel.PrimaryContactEmail = dgvClient.Rows[e.RowIndex].Cells["PrimaryContactEmail"].Value.ToString();

                if (dgvClient.Rows[e.RowIndex].Cells["IsDeleted"].Value.ToString() == "True")
                {
                    clientModel.IsDeleted = true;
                }
                else
                {
                    clientModel.IsDeleted = false;
                }
                ClientForm clientForm = new ClientForm(this, clientModel);
                clientForm.ShowDialog();
            }
        }
Пример #2
0
        /// <summary>
        /// btnClientAddNew_Click - add new client record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnClientAddNew_Click(object sender, EventArgs e)
        {
            ClientForm clientForm = new ClientForm(this);

            clientForm.ShowDialog();
        }