private void SetViewMode() { dateTimePickerPostDate.Value = DateTime.Now.Date; Text = "Closed Dealer Contingents (VIEW Mode)"; toolStripButtonAdd.Enabled = true; toolStripButtonEdit.Enabled = true; toolStripButtonDelete.Enabled = true; toolStripButtonSave.Enabled = false; ActiveControl = DEALERcomboBox; DEALERcomboBox.SelectAll(); }
private void SetViewMode() { // Moses Newman 10/3/2014 Disable Dealer Status DEALER_STATTextBox.Enabled = false; dEALER_NAMETextBox.Enabled = false; DEALER_STREETTextBox.Enabled = false; DealerCityTextBox.Enabled = false; DealerStateTextBox.Enabled = false; DealerZipTextBox.Enabled = false; DealerHomePhoneTextBox.Enabled = false; DEALERWorkPhoneTextBox.Enabled = false; maskedTextBoxCellPhone.Enabled = false; nullableDateTimePickerDealerStartDate.Enabled = false; toolStripButtonEdit.Enabled = true; textBoxDealerEmail.Enabled = false; DealerNamecomboBox.Text = dEALER_NAMETextBox.Text; ActiveControl = DEALERcomboBox; DEALERcomboBox.SelectAll(); }
private void SetAddMode() { DEALERcomboBox.Text = ""; DealerNamecomboBox.Text = ""; lbEdit = false; lbAdd = true; toolStripButtonEdit.Enabled = false; toolStripButtonAdd.Enabled = false; toolStripButtonDelete.Enabled = false; bindingNavigator.Enabled = false; bindingNavigator.Visible = false; dateTimePickerPostDate.Enabled = true; Text = "Closed Dealer Contingents (ADD Mode)"; CONTINGiacDataSet.CONTING.Clear(); CONTINGiacDataSet.DEALER.Clear(); DefaultSettings(); ActiveControl = DEALERcomboBox; DEALERcomboBox.SelectAll(); }
private void DefaultSettings() { if (!lbEdit && !lbAdd) { toolStripButtonAdd.Enabled = true; toolStripButtonEdit.Enabled = true; toolStripButtonDelete.Enabled = true; dateTimePickerPostDate.Enabled = true; textBoxDealerLossReserve.Enabled = false; textBoxDealerLossReserveComment.Enabled = false; textBoxContingentReserve.Enabled = false; textBoxContingentReserveComment.Enabled = false; textBoxAdjust.Enabled = false; textBoxAdjustComment.Enabled = false; textBoxRecoveryForBad.Enabled = false; textBoxRecoveryForBadComment.Enabled = false; textBoxReservedForLoss.Enabled = false; textBoxReserveForLossComment.Enabled = false; textBoxOLoans.Enabled = false; textBoxOLoanComment.Enabled = false; textBoxNotesPayable.Enabled = false; textBoxNPComment.Enabled = false; textBoxInterestSimple.Enabled = false; textBoxSIMPLE_SW.Enabled = false; textBoxInterestSimpleComment.Enabled = false; textBoxInterestAmort.Enabled = false; textBoxAMORT_SW.Enabled = false; textBoxInterestAmortComment.Enabled = false; textBoxInterestNonAmort.Enabled = false; textBoxOLD_SW.Enabled = false; textBoxInterestNonAmortComment.Enabled = false; bindingNavigator.Enabled = true; bindingNavigator.Visible = true; toolStripButtonCancel.Visible = false; toolStripButtonCancel.Enabled = false; DealerNamecomboBox.Enabled = true; DEALERcomboBox.Enabled = true; } else { toolStripButtonAdd.Enabled = false; toolStripButtonEdit.Enabled = false; toolStripButtonDelete.Enabled = false; dateTimePickerPostDate.Enabled = true; textBoxDealerLossReserve.Enabled = true; textBoxDealerLossReserveComment.Enabled = true; textBoxContingentReserve.Enabled = true; textBoxContingentReserveComment.Enabled = true; textBoxAdjust.Enabled = true; textBoxAdjustComment.Enabled = true; textBoxRecoveryForBad.Enabled = true; textBoxRecoveryForBadComment.Enabled = true; textBoxReservedForLoss.Enabled = true; textBoxReserveForLossComment.Enabled = true; textBoxOLoans.Enabled = true; textBoxOLoanComment.Enabled = true; textBoxNotesPayable.Enabled = true; textBoxNPComment.Enabled = true; textBoxInterestAmort.Enabled = true; textBoxAMORT_SW.Enabled = true; textBoxInterestSimpleComment.Enabled = true; textBoxInterestSimple.Enabled = true; textBoxSIMPLE_SW.Enabled = true; textBoxInterestAmortComment.Enabled = true; textBoxInterestNonAmort.Enabled = true; textBoxOLD_SW.Enabled = true; textBoxInterestNonAmortComment.Enabled = true; } if (lbEdit) { toolStripButtonAdd.Enabled = false; toolStripButtonEdit.Enabled = false; toolStripButtonDelete.Enabled = false; lbAdd = false; bindingNavigator.Enabled = false; bindingNavigator.Visible = true; setRelatedData(); toolStripButtonCancel.Visible = false; toolStripButtonCancel.Enabled = false; DealerNamecomboBox.Enabled = false; DEALERcomboBox.Enabled = false; ActiveControl = dateTimePickerPostDate; dateTimePickerPostDate.Select(); } if (lbAdd) { toolStripButtonAdd.Enabled = false; toolStripButtonEdit.Enabled = false; toolStripButtonDelete.Enabled = false; lbEdit = false; bindingNavigator.Enabled = false; bindingNavigator.Visible = false; setRelatedData(); toolStripButtonCancel.Visible = true; toolStripButtonCancel.Enabled = true; dateTimePickerPostDate.Enabled = true; ActiveControl = DEALERcomboBox; DEALERcomboBox.SelectAll(); } if (!lbEdit && !lbAdd) { ActiveControl = DEALERcomboBox; DEALERcomboBox.SelectAll(); } }
private void toolStripButtonSave_Click(object sender, EventArgs e) { Validate(); CONTINGbindingSource.EndEdit(); if (CONTINGiacDataSet.DEALER.Rows.Count == 0) { return; } tableAdapConn = new System.Data.SqlClient.SqlConnection(); tableAdapConn.ConnectionString = IAC2018SQL.Properties.Settings.Default.IAC2010SQLConnectionString; tableAdapConn.Open(); cONTINGTableAdapter.Connection = tableAdapConn; tableAdapTran = cONTINGTableAdapter.BeginTransaction(); cONTINGTableAdapter.Transaction = tableAdapTran; try { cONTINGTableAdapter.Update(CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position]); tableAdapTran.Commit(); } catch (System.Data.SqlClient.SqlException ex) { tableAdapTran.Rollback(); MessageBox.Show("This is a Microsoft SQL Server database error: " + ex.Message.ToString()); } catch (System.InvalidOperationException ex) { tableAdapTran.Rollback(); MessageBox.Show("Invalid Operation Error: " + ex.Message.ToString()); } catch (Exception ex) { tableAdapTran.Rollback(); MessageBox.Show("General Exception Error: " + ex.Message.ToString()); } finally { cONTINGTableAdapter.UnlockRecord(Program.gsUserID, CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].Field <String>("CONTING_DEALER"), CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].Field <DateTime>("CONTING_POST_DATE"), CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].Field <Int32>("CONTING_ENTRY_SEQ")); tableAdapConn.Close(); tableAdapConn = null; tableAdapTran = null; toolStripButtonSave.Enabled = false; CONTINGiacDataSet.AcceptChanges(); if (lbEdit) { lbEdit = false; } if (lbAdd) { CONTINGiacDataSet.CONTING.Clear(); } StartUpConfiguration(); // Moses Newman 09/18/2013 Set dealer number as Active Control if in ADD Mode! if (!lbAdd) { ActiveControl = dateTimePickerPostDate; dateTimePickerPostDate.Select(); } else { ActiveControl = DEALERcomboBox; DEALERcomboBox.SelectAll(); } } }