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 toolStripButton1_Click(object sender, EventArgs e) { Visible = false; form2inst = new frmDealerLookup(); form2inst.ShowDialog(this); form2inst.Dispose(); Visible = true; if (Program.gsKey != null) { DEALERcomboBox.SelectedIndex = DEALERcomboBox.FindStringExact(Program.gsKey); ActiveControl = dEALER_NAMETextBox; dEALER_NAMETextBox.Select(); } Program.gsKey = null; }
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(); } } }
private void DEALERcomboBox_Validated(object sender, EventArgs e) { if (lbFormClosing || DEALERcomboBox.Text.TrimEnd() == "") { return; } int lnContingentPos = 0, lnSeq = 0; Object loContingentSeq = null; String lsDealerNo = ""; if (DEALERcomboBox.Text.ToString().Trim().Length < 3 && DEALERcomboBox.Text.ToString().Trim().Length > 0) { lbFromDealerNameChange = true; DEALERcomboBox.Text = DEALERcomboBox.Text.PadLeft(3, '0'); } lsDealerNo = DEALERcomboBox.Text; if (!lbEdit) { setRelatedData(); } if (CONTINGiacDataSet.CONTING.Rows.Count != 0) { if (CONTINGbindingSource.Position == -1) { lnContingentPos = CONTINGbindingSource.Find("CONTING_DEALER", lsDealerNo); } else { lnContingentPos = CONTINGbindingSource.Position; } if (lnContingentPos > -1) { if (lbAdd) { return; } else { CONTINGbindingSource.Position = lnContingentPos; } } else { if (!lbAdd) { lsDealerNo = CONTINGiacDataSet.CONTING.Rows[0].Field <String>("CONTINGENT_DEALER"); CONTINGbindingSource.MoveFirst(); } } } else { if (!lbAdd) { return; } } if (CONTINGiacDataSet.DEALER.Rows.Count == 0 && DEALERcomboBox.Text.TrimEnd().Length != 0) { MessageBox.Show("Sorry no dealer found that matches your selected dealer number!"); DEALERcomboBox.Text = ""; DealerNamecomboBox.Text = ""; ActiveControl = DealerNamecomboBox; DealerNamecomboBox.SelectAll(); } else { if (lbEdit) { if (CONTINGiacDataSet.CONTING.Rows.Count == 0) { MessageBox.Show("Sorry no contingent records found that match your selected dealer number!"); ActiveControl = DEALERcomboBox; DEALERcomboBox.Select(); } } if (lbAdd && DEALERcomboBox.Text.ToString().TrimEnd() != "") { CONTINGbindingSource.AddNew(); CONTINGbindingSource.EndEdit(); CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].SetField <String>("CONTING_DEALER", DEALERcomboBox.Text.ToString()); CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].SetField <DateTime>("CONTING_POST_DATE", DateTime.Now.Date); loContingentSeq = cONTINGTableAdapter.MaxSeqQuery(DEALERcomboBox.Text.ToString(), DateTime.Now.Date); if (loContingentSeq != null) { lnSeq = (int)loContingentSeq + 1; } else { lnSeq = 0; //Closed and Open contingents start with 0 for first sequence number } CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].SetField <Int32>("CONTING_ENTRY_SEQ", lnSeq); CONTINGiacDataSet.CONTING.Rows[CONTINGbindingSource.Position].SetField <Char>("CONTING_POST_IND", (Char)(255)); if (CONTINGiacDataSet.CONTING.Rows.Count != 0) { toolStripButtonSave.Enabled = true; } } if (CONTINGiacDataSet.DEALER.Rows.Count > 0 && !lbAdd) { //DealerNamecomboBox.Text = CONTINGiacDataSet.DEALER.Rows[0].Field<String>("DEALER_NAME"); if (lbAdd || lbEdit) { dateTimePickerPostDate.Enabled = true; ActiveControl = dateTimePickerPostDate; dateTimePickerPostDate.Select(); } } } }