Exemple #1
0
        /// <summary>
        /// btnUpdate_Click - for updating client record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                ClientModel clientModel = new ClientModel();
                clientModel.Name = txtClientName.Text.Trim();
                clientModel.PrimaryContactName  = txtClientPrimaryContactName.Text.Trim();
                clientModel.PrimaryContactCell  = txtClientPrimaryContactCell.Text.Trim();
                clientModel.PrimaryContactEmail = txtClientPrimaryContactEmail.Text.Trim();
                clientModel.IsDeleted           = rdoIsDeleted_Disabled.Checked ? true : false;

                try
                {
                    ClientDataAccess.UpdateClient(clientModel, int.Parse(txtClientId.Text));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Runtime Error\n" + ex.Message, "Unexpected Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Close();
                }
            }
        }