示例#1
0
        public Result UpdateTableRecord(UpdateSqlRecordModel updateRecord)
        {
            using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + dbPath))
            {
                connection.Open();

                var sql = updateRecord.CreateSqlUpdateCmd();

                using (SQLiteCommand cmd = new SQLiteCommand(sql, connection))
                {
                    try
                    {
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        return(new Result {
                            success = false, msg = "Ошибка обновления данных: " + ex.Message
                        });
                    }
                }
            }

            return(new Result {
                success = true
            });
        }
示例#2
0
        public Result SetUploadStatus(int app_id)
        {
            var updateRecord = new UpdateSqlRecordModel();

            updateRecord.tableName  = APPLICATIONS_TABLE.table_name;
            updateRecord.expression = APPLICATIONS_TABLE.id + " = " + app_id;
            updateRecord.Fields     = new SqlFieldModel[] {
                new SqlFieldModel
                {
                    fieldName  = APPLICATIONS_TABLE.uploaded,
                    fieldValue = "1"
                }
            };

            return(UpdateTableRecord(updateRecord));
        }