Exemple #1
0
        public TableMonitor(string tableName)
        {
            this.tableName = tableName;
            d         = new CapaData();
            currentId = d.GetLastRecordOn(Strings.ChangesOnProductTableName).IdLog;


            Start();
        }
Exemple #2
0
        private async Task StartAsync()
        {
            if (!Program.lockedTM)
            {
                newId = d.GetLastRecordOn(Strings.ChangesOnProductTableName).IdLog;
                if (currentId != newId)
                {
                    List <OnProducts> newRows = d.ReturnChangesOnTable(tableName, currentId + 1);
                    foreach (OnProducts row in newRows)
                    {
                        switch (row.ActionMade)
                        {
                        case 1:
                            InsertWasMAde(row.IdProduct);
                            Console.WriteLine("Se insertó");
                            break;

                        case 2:
                            DeleteWasMade(row.IdProduct);
                            Console.WriteLine("Se borró");
                            break;

                        case 3:
                            UpdateWasMade(row.IdProduct);
                            Console.WriteLine("Se actualizó");
                            break;

                        default:
                            Console.WriteLine("Error");
                            break;
                        }
                    }
                }
                else
                {
                    Console.WriteLine("No hay cambios");
                }
            }
        }