public override Task <TransactionsResponse> GetTransactions(AccountRequest request, ServerCallContext context) { TransactionsResponse response = new TransactionsResponse(); var transactions = Transaction.GetTransactions(request.Address); foreach (Transaction trx in transactions) { TrxModel mdl = ConvertTrxModel(trx); response.Transactions.Add(mdl); } return(Task.FromResult(response)); }
public TrxModel ReadTrx(string path) { var serializer = new System.Xml.Serialization.XmlSerializer(typeof(TrxModel)); TrxModel trxModel = null; using (var xmlReader = XmlReader.Create(path)) { trxModel = (TrxModel)serializer.Deserialize(xmlReader); } return(trxModel); }
public ActionResult FetchTransferTrxList(TrxModel tModel) { string errMessage = string.Empty; if (ModelState.IsValid) { var validation = SecurityController.ValidateToken(tModel.TokenCode); try { if (validation.Validated == true) { var AccListResult = _db.Query <TrfTrxListModel>(";Exec Supreme_GetTransferTrxList @OurBranchID,@Offset", new { OurBranchID = tModel.OurBranchID, Offset = tModel.Offset }).ToList(); logger.LogWrite(JsonConvert.SerializeObject(tModel).ToString()); return(Json(AccListResult, JsonRequestBehavior.AllowGet)); } else { GenericResultModel AccListResult2 = new GenericResultModel(); AccListResult2.Status = "Fail"; AccListResult2.Remarks = validation.Errors[0].ToString(); logger.LogWrite(JsonConvert.SerializeObject(validation).ToString()); return(Json(AccListResult2, JsonRequestBehavior.AllowGet)); } } catch (Exception ee) { GenericResultModel AccListResult2 = new GenericResultModel(); AccListResult2.Status = "Fail"; AccListResult2.Remarks = ee.Message; GeneralService.WriteErrorLog(ref ee); return(Json(AccListResult2, JsonRequestBehavior.AllowGet)); } } else { var message = string.Join(" | ", ModelState.Values .SelectMany(v => v.Errors) .Select(e => e.ErrorMessage)); GenericResultModel AccListResult2 = new GenericResultModel(); AccListResult2.Status = "Fail"; AccListResult2.Remarks = message; return(Json(AccListResult2, JsonRequestBehavior.AllowGet)); } }
private static TrxModel ConvertTrxModel(Transaction trx) { TrxModel mdl = new TrxModel { Hash = trx.Hash, Recipient = trx.Recipient, Sender = trx.Sender, Fee = trx.Fee, Amount = trx.Amount, TimeStamp = trx.TimeStamp, }; return(mdl); }
private void LoadPlayList(TrxModel model) { var failedTests = Results.Where(r => r.Outcome == Outcome.Failed).ToArray(); var tests = new List <PlayListTest>(); foreach (var failedTest in failedTests) { tests.Add(new PlayListTest { TestName = failedTest.FullName }); } PlayList = new PlayListModel { TestNames = tests.ToArray() }; }
private void LoadResults(TrxModel model) { TrxModel = model; var testResults = new List <TestResult>(); foreach (var testResult in model.Results) { var result = new TestResult(); result.TestName = testResult.TestName; result.Outcome = testResult.Outcome == TestOutcome.Passed ? Outcome.Passed : Outcome.Failed; var testDefinition = model.TestDefinitions.FirstOrDefault(def => def.Id == testResult.TestId); if (testDefinition == null) { continue; } result.ClassName = testDefinition.TestMethodInformation.ClassName; testResults.Add(result); } Results = testResults.ToArray(); }
private void Initialize(TrxModel model) { LoadResults(model); LoadPlayList(model); }
public TestsResultModel(TrxModel model) { Initialize(model); }