public static Task <int> GetNewManifestNumber() { using (var db = new OcphDbContext()) { var cmd = db.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "NewManifestNumber"; var data = cmd.ExecuteScalar(); int result = 0; if (data != null) { result = Int32.Parse(data.ToString()); } result++; return(Task.FromResult(result)); } }
public void BackupAction(string file) { try { using (var db = new OcphDbContext()) { var cmd = db.CreateCommand() as MySqlCommand; Backup.Command = cmd; Backup.ExportToFile(file); } } catch (Exception ex) { if (OnError != null) { OnError(ex.Message); } } }