public ViewEditdb(string currentDb, int index, object item, SqlDbViewer sqldb) { CurrentDb = currentDb; SqlDbviewer = sqldb; Item = item; Index = index; // open a new instance of our EditDb Window Editdb = new EditDb(currentDb, 0, item, sqldb); Editdb.Show( ); }
public static void ClearWindowHandles(EditDb edb, SqlDbViewer sdb) { if (edb != null) { edDb = edb; EditDbSelChange -= new EditDbGridSelectionChanged(edDb.resetEditDbindex); } if (sdb != null) { sqlDb = sdb; SQLVSelChange -= new SQLViewerGridSelectionChanged(sqlDb.resetSQLDBindex); } ShowSubscribersCount(); }
public static bool LoadMultiSqlData(string CmdString, DataTable dt, string CallerType, EditDb edb) { //THIS IS THE SQL COMMAND TO GET FULL LINES OF DUPLICATED CUSTOMER ACCOUNT #'S DATA CmdString = $"SELECT * FROM {CallerType} WHERE CUSTNO IN " + $"(SELECT CUSTNO FROM {CallerType} " + $" GROUP BY CUSTNO" + $" HAVING COUNT(*) > 1) ORDER BY "; CmdString = Utils.GetDataSortOrder(CmdString); try { SqlConnection con; string ConString = ( string )Properties.Settings.Default ["BankSysConnectionString"]; // @"Data Source = (localdb)\MSSQLLocalDB; Initial Catalog = 'C:\USERS\IANCH\APPDATA\LOCAL\MICROSOFT\MICROSOFT SQL SERVER LOCAL DB\INSTANCES\MSSQLLOCALDB\IAN1.MDF'; Integrated Security = True; Connect Timeout = 30; Encrypt = False; TrustServerCertificate = False; ApplicationIntent = ReadWrite; MultiSubnetFailover = False"; using (con = new SqlConnection(ConString)) { SqlCommand cmd = new SqlCommand(CmdString, con); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(dt); } { // //load the SQL data into our OC named bankaccounts // if (CallerType == "BANKACCOUNT") // { //// SqlDbViewer sqldbv = new SqlDbViewer (0); // if (LoadBankCollection(dt)) // MessageBox.Show($"Bank Account loaded successfully ({dt.Rows.Count}) records"); // else // { // return false; // } // } // else if (CallerType == "CUSTOMER") // { // SqlDbViewer sqldbv = new SqlDbViewer (1); // if (sqldbv.LoadCustomerCollection (dt)) // MessageBox.Show ($"Customer Account loaded successfully ({dt.Rows.Count}) records"); // else // { // return false; // } // } // else if (CallerType == "DETAILS") // { // SqlDbViewer sqldbv = new SqlDbViewer (2); // if (sqldbv.LoadDetailsCollection (dt)) // MessageBox.Show ($"Details Account loaded successfully ({dt.Rows.Count}) records"); // else // { // return false; // } // } // //reset filter flag // return true; // } } catch (Exception ex) { Console.WriteLine($"Failed to load Bank Details - {ex . Message}"); return(false); } return(true); }
public static void ShowSubscribersCount( ) { int count = -1; int count2 = -1; int count3 = -1; int count4 = -1; int count5 = -1; int count6 = -1; int count7 = -1; int count8 = -1; int count9 = -1; int count10 = -1; int count11 = -1; if (!BankAccountViewModel.ShowSubscribeData) { return; } //ViewerDataHasBeenChanged Delegate [] dg = EventControl.GetEventCount( ); if (dg != null) { count = dg.Length; } // NotifyOfDataChange dg = EventControl.GetEventCount2( ); if (dg != null) { count2 = dg.Length; } // NotifyOfDataLoaded dg = EventControl.GetEventCount3( ); if (dg != null) { count3 = dg.Length; } // DetCollection. BankDataLoaded dg = EventControl.GetEventCount6( ); if (dg != null) { count6 = dg.Length; } // CustCollection. CustDataLoaded dg = EventControl.GetEventCount7( ); if (dg != null) { count7 = dg.Length; } // CustCollection. DetDataLoaded dg = EventControl.GetEventCount8( ); if (dg != null) { count8 = dg.Length; } //SQLHandlers. DataUpdated dg = EditDb.GetEventCount9( ); if (dg != null) { count9 = dg.Length; } //AllViewersUpdate dg = EditDb.GetEventCount9( ); if (dg != null) { count10 = dg.Length; } //RecordDeleted dg = EventControl.GetEventCount11( ); if (dg != null) { count11 = dg.Length; } Console.WriteLine($"\n *** Currently Subscribed Events ***"); if (count < 0) { Console.WriteLine($"ViewerDataHasBeenChanged= "); } else { Console.WriteLine($"ViewerDataHasBeenChanged = {count} "); } if (count2 < 0) { Console.WriteLine($"NotifyOfDataChange = "); } else { Console.WriteLine($"NotifyOfDataChange = {count2}"); } if (count3 < 0) { Console.WriteLine($"NotifyOfDataLoaded = "); } else { Console.WriteLine($"NotifyOfDataLoaded = {count3}"); } if (count6 < 0) { Console.WriteLine($"BankCollection. BankDataLoaded = "); } else { Console.WriteLine($"BankCollection. BankDataLoaded = {count6}"); } if (count7 < 0) { Console.WriteLine($"CustCollection. CustDataLoaded = "); } else { Console.WriteLine($"CustCollection. CustDataLoaded = {count7}"); } if (count8 < 0) { Console.WriteLine($"DetCollection. DetDataLoaded = "); } else { Console.WriteLine($"DetCollection. DetDataLoaded = {count8}"); } if (count9 < 0) { Console.WriteLine($"SQLHandler.DataUpdated = "); } else { Console.WriteLine($"SQLHandler.DataUpdated = {count9}"); } if (count10 < 0) { Console.WriteLine($"DbEdit.AllViewersUpdate = "); } else { Console.WriteLine($"DbEdit.AllViewersUpdate = {count10}"); } if (count11 < 0) { Console.WriteLine($"RecordDeleted = "); } else { Console.WriteLine($"RecordDeleted = {count11}"); } bool first = true; Delegate [] dglist2 = EventControl.GetEventCount( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } //item . CurrentDb; Console.WriteLine($"Delegate : VIEWERDATAHASBEENCHANGED :\n >>> {item . Target}\nMethod = {item . Method . Name . ToString ( )}"); cnt++; } } dglist2 = EventControl.GetEventCount2( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } first = true; Console.WriteLine($"====================================================================================="); foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } Console.WriteLine($"Delegate : NOTIFYOFDATACHANGE : \n >>> {item . Target . ToString ( )}\nMethod = {item . Method . ToString ( )}"); cnt++; } } dglist2 = EventControl.GetEventCount3( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } first = true; Console.WriteLine($"====================================================================================="); foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } Console.WriteLine($"Delegate : NOTIFYOFDATALOADED: \n >>> {item . Target . ToString ( )}\nMethod = {item . Method . ToString ( )}"); cnt++; } } dglist2 = EventControl.GetEventCount6( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } if (item.Target != null) { Console.WriteLine($"Delegate : BankCollection. BANKDATALOADED:\n >>> {item . Target?.ToString ( )}\nMethod = {item . Method . ToString ( )}"); } else { Console.WriteLine($"Delegate : BankCollection. BANKDATALOADED:\n >>> \nMethod = {item . Method . ToString ( )}"); } cnt++; } } dglist2 = EventControl.GetEventCount7( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } if (item.Target != null) { Console.WriteLine($"Delegate : CustCollection. CUSTDATALOADED:\n >>> {item . Target?.ToString ( )}\nMethod = {item . Method . ToString ( )}"); } else { Console.WriteLine($"Delegate : CustCollection. CUSTDATALOADED:\n >>> \nMethod = {item . Method . ToString ( )}"); } cnt++; } } dglist2 = EventControl.GetEventCount8( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } if (item.Target != null) { Console.WriteLine($"Delegate : DetCollection. DETDATALOADED:\n >>> {item . Target?.ToString ( )}\nMethod = {item . Method . ToString ( )}"); } else { Console.WriteLine($"Delegate : DetCollection. DETDATALOADED:\n >>> \nMethod = {item . Method . ToString ( )}"); } cnt++; } } dglist2 = EditDb.GetEventCount9( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } if (item.Target != null) { Console.WriteLine($"Delegate : SQLHandlers.DATAUPDATED:\n >>> {item . Target?.ToString ( )}\nMethod = {item . Method . ToString ( )}"); } else { Console.WriteLine($"Delegate : SQLHandlers.DATAUPDATED::\n >>> \nMethod = {item . Method . ToString ( )}"); } cnt++; } } dglist2 = EditDb.GetEventCount10( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } if (item.Target != null) { Console.WriteLine($"Delegate : DbEdit.ALLVIEWERSUPDATE :\n >>> {item . Target?.ToString ( )}\nMethod = {item . Method . ToString ( )}"); } else { Console.WriteLine($"Delegate : DbEdit.ALLVIEWERSUPDATE :\n >>> \nMethod = {item . Method . ToString ( )}"); } cnt++; } } dglist2 = EventControl.GetEventCount11( ); if (dglist2 != null) { int cnt = 0; if (!first) { Console.WriteLine($"====================================================================================="); first = false; } Console.WriteLine($"====================================================================================="); first = true; foreach (var item in dglist2) { if (cnt > 0) { Console.WriteLine( ); } if (item.Target != null) { Console.WriteLine($"Delegate : RECORDDELETED:\n >>> {item . Target?.ToString ( )}\nMethod = {item . Method . ToString ( )}"); } else { Console.WriteLine($"Delegate : RECORDDELETED:\n >>> \nMethod = {item . Method . ToString ( )}"); } cnt++; } } Console.WriteLine($"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); }