Exemplo n.º 1
0
        public string GetMarkAsProcessedCommand(AnDatabaseTypes.DriverType driverType)
        {
            var result = "";

            try
            {
                if (ProcessedDateTime <= AnTypes.MinDateTimeValue)
                {
                    ProcessedDateTime = DateTime.UtcNow;
                }

                result = AnDatabaseTypes.GenerateUpdateStatement(DbTableName, GeneratePrimaryKeyWhereClause(driverType),
                                                                 new List <AnDatabaseCommandData>
                {
                    new AnDatabaseCommandData(nameof(ProcessedDateTime), ProcessedDateTime, AnTypes.DataType.DateTime, AnSerialization.DateTimeSize),
                    new AnDatabaseCommandData(nameof(ErrorMessage), ErrorMessage, AnTypes.DataType.VarChar, ErrorMessageSize),
                    new AnDatabaseCommandData(nameof(Result), Result, AnTypes.DataType.Boolean, AnSerialization.BooleanSize),
                    new AnDatabaseCommandData(nameof(Processed), true, AnTypes.DataType.Boolean, AnSerialization.BooleanSize)
                },
                                                                 new List <AnDatabaseCommandData>(), driverType, false);
            }

            catch (Exception ex)
            {
                AnLog.Error(ex);
            }

            return(result);
        }
Exemplo n.º 2
0
        public string GenerateUpdateStatement <T>(AnDatabaseTypes.DriverType driverType, T modelObject)
        {
            var result = "";

            try
            {
                var whereClause = GeneratePrimaryKeyWhereClause(driverType);

                if (!string.IsNullOrEmpty(whereClause))
                {
                    result = AnDatabaseTypes.GenerateUpdateStatement(GetDbTableName(), whereClause, GenerateDatabaseCommandDataList(false), (modelObject as AnModelBase)?.GenerateDatabaseCommandDataList(false) ?? new AnList <AnDatabaseCommandData>(), driverType, false);
                }
            }

            catch (Exception ex)
            {
                AnLog.Error(ex);
            }

            return(result);
        }