Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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()
            };
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
 private void Initialize(TrxModel model)
 {
     LoadResults(model);
     LoadPlayList(model);
 }
Ejemplo n.º 8
0
 public TestsResultModel(TrxModel model)
 {
     Initialize(model);
 }