protected void Page_Load(object sender, EventArgs e)
        {
            TransactionReport newTransRep = new TransactionReport();

            CrystalReportViewer1.ReportSource = newTransRep;
            newTransRep.SetDataSource(GenerateData(TransactionReportController.GetTransaction()));
        }
Esempio n. 2
0
        public void TransationTest_boughtAndSoldItems_ReturnSum()
        {
            var bought = new List <Item>
            {
                new Item {
                    Price = 5.00, Quantity = 100
                },
                new Item {
                    Price = 3.00, Quantity = 50
                },
                new Item {
                    Price = 10.00, Quantity = 120
                },
            };
            var sold = new List <Item>
            {
                new Item {
                    Price = 10.00, Quantity = 100
                },
                new Item {
                    Price = 5.00, Quantity = 50
                },
                new Item {
                    Price = 20.00, Quantity = 120
                },
            };
            var result = TransactionReport.TotalTradingReport(bought, sold);

            Assert.AreEqual(result, 5500);
        }
Esempio n. 3
0
        public bool TryGetMonthReports(FileData data, out TransactionReport report)
        {
            report = null;

            try
            {
                string header = data.Lines.FirstOrDefault();
                if (header.IsNull())
                {
                    return(false);
                }

                report = new TransactionReport()
                {
                    Name = data.Name, Transactions = new List <Transaction>()
                };

                char separator           = Convert.ToChar(data.Separator);
                TransactionParser parser = new TransactionParser(header, separator);

                for (int i = 1; i < data.Lines.Count; i++)
                {
                    string      line         = data.Lines[i];
                    Transaction iTransaction = parser.ParseFromLine(line);
                    report.Transactions.Add(iTransaction);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 4
0
        public void TestRequired()
        {
            var report = new TransactionReport(ipAddress: IP, tag: TransactionReportTag.NotFraud);

            Assert.Equal(IP, report.IPAddress);
            Assert.Equal(TransactionReportTag.NotFraud, report.Tag);
        }
Esempio n. 5
0
        public List <Transaction> TransactionsSortedByOldest()
        {
            TransactionReport  reportObject = new TransactionReport();
            List <Transaction> oldest       = reportObject.TransactionsSortedByOldest();

            return(oldest);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            TransactionReport newTR = new TransactionReport();

            CrystalReportViewer1.ReportSource = newTR;
            newTR.SetDataSource(GenerateData(HeaderTransactionController.gettAllHeaderTransaction()));
        }
Esempio n. 7
0
        public List <OverdueReport> GetOverdueReport()
        {
            TransactionReport    reportObject  = new TransactionReport();
            List <OverdueReport> listOfOverdue = reportObject.OverdueStatus();

            return(listOfOverdue);
        }
Esempio n. 8
0
        public bool TryGetMonthReports(FileData data, out TransactionReport report)
        {
            report = new TransactionReport();

            string header   = data.Lines.First();
            bool   canParse = CheckIfCanParse(header);

            if (!canParse)
            {
                return(false);
            }

            int           startIndex       = GetStartIndex(data);
            int           count            = data.Lines.Count - startIndex - 4;
            List <string> transactionLines = data.Lines.Skip(startIndex + 1).Take(count).ToList();

            List <TransactionING> ingTransactions = new List <TransactionING>();

            foreach (string line in transactionLines)
            {
                var transaction = GetFromLine(line);
                ingTransactions.Add(transaction);
            }

            TransactionConverter converter = new TransactionConverter();

            report.Transactions = converter.GetFromIngTransaction(ingTransactions);
            return(true);
        }
Esempio n. 9
0
        public ContentResult SendReportEmail(string email)
        {
            int quarter  = DateTime.Now.Month / 3 + 1;
            int MinMonth = (quarter - 1) * 3;
            int MaxMonth = quarter * 3;

            if (quarter <= 0)
            {
                return new ContentResult {
                           StatusCode = 404
                }
            }
            ;

            var transactions = dbContext.Transactions
                               .Include(a => a._currency)
                               .Where(a => a.TransactionDate.Month <= MaxMonth && a.TransactionDate.Month > MinMonth)
                               .ToArray();

            TransactionReport rep = new TransactionReport();

            rep._transactions = transactions;

            var sringResponce = rep.SendByEmail(ReportFileType.TXT, email);

            return(new ContentResult
            {
                ContentType = "text/html"
            });
        }
    }
Esempio n. 10
0
        public List <InventoryItem> GetLostItemsReport()
        {
            TransactionReport    reportObject = new TransactionReport();
            List <InventoryItem> lostItems    = reportObject.LostItemsReport();

            return(lostItems);
        }
Esempio n. 11
0
        public ContentResult GetQuaterReport(DateTime date_S, DateTime date_f)
        {
            if (date_S == DateTime.MinValue || date_f == DateTime.MinValue)
            {
                return new ContentResult {
                           StatusCode = 404
                }
            }
            ;

            var transactions = dbContext.Transactions
                               .Include(a => a._currency)
                               .Where(a => a.TransactionDate <= date_S && a.TransactionDate >= date_f)
                               .ToArray();

            TransactionReport rep = new TransactionReport();

            rep._transactions = transactions;
            var sringResponce = rep.ShowReportQuaterHtml();

            return(new ContentResult
            {
                ContentType = "text/html",
                Content = sringResponce
            });
        }
Esempio n. 12
0
        public ContentResult GetQuaterReport(int quarter)
        {
            if (quarter == 0 || quarter == 5)
            {
                return(null);
            }
            int MinMonth = (quarter - 1) * 3;
            int MaxMonth = quarter * 3;

            //ToArray??
            var transactions = dbContext.Transactions
                               .Include(a => a._currency)
                               .Where(a => a.TransactionDate.Month <= MaxMonth && a.TransactionDate.Month > MinMonth)
                               .ToArray();

            TransactionReport rep = new TransactionReport();

            rep._transactions = transactions;
            var sringResponce = rep.ShowReportQuaterHtml();

            return(new ContentResult
            {
                ContentType = "text/html",
                Content = sringResponce
            });
        }
        public IActionResult Report()
        {
            TransactionReport transactionReport = new TransactionReport();

            byte[] abytes = transactionReport.PrepareReport();
            return(File(abytes, "application/pdf", $"Transaction.pdf"));
        }
Esempio n. 14
0
        public TransactionReport GetTransactionData(string EventAltId, Guid UserAltId, string VenueId, string EventDetailId, string TicketCategoryId, string ChannelId, string CurrencyTypes, string TicketTypes, string TransactionTypes, string PaymentGatewayes, DateTime FromDate, DateTime ToDate)
        {
            TransactionReport reporting = new TransactionReport();
            var reportData = GetCurrentConnection().QueryMultiple("CR_GetTransactionData_MultiSelection",
                                                                  new
            {
                EventAltId       = EventAltId,
                UserAltId        = UserAltId,
                VenueId          = VenueId,
                EventDetailId    = EventDetailId,
                TicketCategoryId = TicketCategoryId,
                ChannelId        = ChannelId,
                CurrencyTypes    = CurrencyTypes,
                TicketTypes      = TicketTypes,
                TransactionTypes = TransactionTypes,
                PaymentGatewayes = PaymentGatewayes,
                FromDate         = FromDate,
                ToDate           = ToDate
            },
                                                                  commandType: CommandType.StoredProcedure);

            reporting.TransactionData = reportData.Read <TransactionData>();
            reporting.ReportColumns   = reportData.Read <ReportingColumn>();
            return(reporting);
        }
Esempio n. 15
0
        public List <InventoryItem> GetDamagedItemsReport()
        {
            TransactionReport    reportObject = new TransactionReport();
            List <InventoryItem> damagedItems = reportObject.DamagedItemsReport();

            return(damagedItems);
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TransactionReport report = new TransactionReport();

            crystalReport.ReportSource = report;
            report.SetDataSource(GetReportHistory(_transaction.GetTransactions()));
        }
        public List <TransactionReport> GetOutstandingReport(string transactionForStr, string returnTransacationForStr)
        {
            var transactionFor       = db.TransactionFor.FirstOrDefault(x => x.TranscationFor.Equals(transactionForStr));
            var returnTransactionFor = db.TransactionFor.FirstOrDefault(x => x.TranscationFor.Equals(returnTransacationForStr));

            return(db.Transactions
                   .Include(t => t.Person)
                   .Include(x => x.TransactionFor)
                   .Where(x => x.TranscationForGuid == transactionFor.TranscationForGuid ||
                          x.TranscationForGuid == returnTransactionFor.TranscationForGuid)
                   .OrderBy(x => x.PersonGuid)
                   .ToList()
                   .Select(x =>
            {
                var newObj = new TransactionReport()
                {
                    TranscationGuid = x.TranscationGuid,
                    TranscationType = x.TranscationType,
                    TranscationForGuid = x.TranscationForGuid,
                    //Amount = x.Amount,
                    TransactionDate = x.TransactionDate,
                    PersonGuid = x.PersonGuid,
                    Person = x.Person,
                    TransactionFor = x.TransactionFor,
                    Interest = x.Interest,
                    CurrentDate = DateTime.Now,
                    TotalDays = 0,
                    CalculatedInterest = 0
                };
                newObj.Amount = x.TranscationForGuid == transactionFor.TranscationForGuid ? x.Amount : 0;
                newObj.ReturnedAmount = x.TranscationForGuid == returnTransactionFor.TranscationForGuid ? x.Amount : 0;
                return newObj;
            }).ToList().OrderBy(x => x.TransactionDate).OrderBy(x => x.Person.PersonName).ToList());
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TransactionReport report = new TransactionReport();

            CrystalReportViewer.ReportSource = report;

            report.SetDataSource(ReportRepository.GetReportData());
        }
Esempio n. 19
0
        private void UpdateWeeklyReport(Transaction dailytransaction)
        {
            using (EnkuDesignDBContext context = new EnkuDesignDBContext())
            {
                String date = dailytransaction.Date.ToString();
                Console.WriteLine($"The date passed is : {date}");
                try
                {
                    TransactionReport treport = context.TransactionReports.Where(tr => tr.Date.ToString().Equals(date)).Single();

                    Console.WriteLine($"The date extracted is : {treport.Date.ToString()}");
                    if (dailytransaction.Type == "SALE")
                    {
                        Console.WriteLine($"Inside the if");
                        treport.Sale = treport.Sale + dailytransaction.Price;
                        treport.Net  = treport.Net + dailytransaction.Price;
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                    else if (dailytransaction.Type == "EXPENSE")
                    {
                        treport.Expense = treport.Expense + dailytransaction.Price;
                        treport.Net     = treport.Net - dailytransaction.Price;
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                }
                catch (Exception)
                {
                    if (dailytransaction.Type == "SALE")
                    {
                        Console.WriteLine($"Inside the exception if ");
                        context.TransactionReports.Add(new TransactionReport()
                        {
                            Date    = dailytransaction.Date,
                            Sale    = dailytransaction.Price,
                            Expense = 0.0,
                            Net     = dailytransaction.Price
                        });
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                    else if (dailytransaction.Type == "EXPENSE")
                    {
                        context.TransactionReports.Add(new TransactionReport()
                        {
                            Date    = dailytransaction.Date,
                            Sale    = 0.0,
                            Expense = dailytransaction.Price,
                            Net     = -1 * dailytransaction.Price
                        });
                        context.SaveChanges();
                        LoadWeeklyReportsTable();
                    }
                }
            }
        }
        public async Task AddAsync(TransactionReport report)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                await context.TransactionReports.AddAsync(_mapper.Map <TransactionReportEntity>(report));

                await context.SaveChangesAsync();
            }
        }
        private void IssueTransactionReportForm_Load(object sender, EventArgs e)
        {
            DataSetTransReport       ds = new DataSetTransReport();
            TransactionsTableAdapter td = new TransactionsTableAdapter();

            td.Fill(ds.Transactions);

            TransactionReport cr = new TransactionReport();

            cr.SetDataSource(ds);
            crystalReportViewer1.ReportSource = cr;
        }
Esempio n. 22
0
        public async Task Should_export_transactionreport()
        {
            var sourcePath = SourcePath;
            var beginDate  = DateTime.Today.AddDays(-10);
            var endDate    = DateTime.Today.AddDays(-1);
            var task1      = await TransactionReport.ExportFileAsync(_client, sourcePath, beginDate, endDate).ConfigureAwait(false);

            Check.That(task1).IsTrue();
            var task2 = TransactionReport.GetReadXml(_client, sourcePath);

            Check.That(task2).IsNotEmpty();
        }
Esempio n. 23
0
        public bool StageDailyReport()
        {
            var transactions = _context.Transactions
                               .Where(t => t.timestamp.Date >= DateTime.Today.Date && t.timestamp < DateTime.Today.AddDays(1).Date).ToList();

            if (transactions == null || transactions.Count < 1)
            {
                return(false);
            }
            var timestamp = DateTime.Now;

            foreach (var channel in _channels)
            {
                var channelTransactions = transactions.Where(t => t.channel == channel.id).ToList();
                if (channelTransactions == null || channelTransactions.Count < 1)
                {
                    continue;
                }
                var report = new TransactionReport
                {
                    channelId          = channel.id,
                    reportName         = GetReportNameFromChannel(channel),
                    dailyCount         = channelTransactions.Count(),
                    successCount       = channelTransactions.Where(t => t.status == (int)TransactionStatus.Success).Count(),
                    failureCount       = channelTransactions.Where(t => t.status == (int)TransactionStatus.Failed).Count(),
                    pendingCount       = channelTransactions.Where(t => t.status == (int)TransactionStatus.Pending).Count(),
                    systemFailureCount = channelTransactions
                                         .Where(t => t.status == (int)TransactionStatus.Failed && t.description == (int)StatusDescription.SystemError).Count(),
                    userFailureCount = channelTransactions
                                       .Where(t => t.status == (int)TransactionStatus.Failed && t.description == (int)StatusDescription.InsufficientFund).Count(),
                    successVolume       = channelTransactions.Where(t => t.status == (int)TransactionStatus.Success).Sum(t => t.amount),
                    failureVolume       = channelTransactions.Where(t => t.status == (int)TransactionStatus.Failed).Sum(t => t.amount),
                    pendingVolume       = channelTransactions.Where(t => t.status == (int)TransactionStatus.Pending).Sum(t => t.amount),
                    systemFailureVolume = channelTransactions
                                          .Where(t => t.status == (int)TransactionStatus.Failed && t.description == (int)StatusDescription.SystemError).Sum(t => t.amount),
                    userFailureVolume = channelTransactions
                                        .Where(t => t.status == (int)TransactionStatus.Failed && t.description == (int)StatusDescription.InsufficientFund).Sum(t => t.amount),
                    timestamp = timestamp
                };
                report.successRate = Math.Round((decimal)report.successCount / report.dailyCount, 2) * 100;
                report.failureRate = Math.Round((decimal)report.failureCount / report.dailyCount, 2) * 100;

                if (report.failureRate > channel.threshold)
                {
                    var serviceFailureRepo = new ServiceFailureRepository(_context);
                    serviceFailureRepo.AlertServiceOwner(channel, report);
                }

                _context.TransactionReports.Add(report);
            }
            _context.SaveChanges();
            return(true);
        }
Esempio n. 24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserController.getUserByID(Convert.ToInt32(Session["auth_user"])).RoleID == 3)
     {
         TransactionReport reportTransaction = new TransactionReport();
         CrystalReportViewer1.ReportSource = reportTransaction;
         reportTransaction.SetDataSource(ReportHelper.GenerateData(TransactionController.getAllHeaderTransaction()));
     }
     else
     {
         Response.Redirect("Home.aspx");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null || !UserController.isAdmin(Int32.Parse(Session["user"].ToString())))
            {
                Response.Redirect("/View/Home.aspx");
                return;
            }

            TransactionReport report = new TransactionReport();

            CrystalReportViewer1.ReportSource = report;
            report.SetDataSource(TransactionController.GenerateTransactionLogs(TransactionController.GetAllTransactionsList()));
        }
        public void Display(TransactionReport report)
        {
            ViewState.Add("TransactionReport", report);

            if (report != null)
            {
                ConfigureGridColumns();
                ReportGridView.DataSource = report.Records;
                ReportGridView.DataBind();

                FundedTotalLiteral.Text    = report.FundedTotal.ToString("C");
                NonFundedTotalLiteral.Text = report.NonFundedTotal.ToString("C");
            }
        }
        public void AlertServiceOwner(Channel channel, TransactionReport report)
        {
            // notify service owner and log service failure
            try
            {
                var serviceOwner = _context.ServiceOwners.Where(m => m.id == channel.ownerId).FirstOrDefault();
                var isNotified   = false;

                if (serviceOwner != null && !string.IsNullOrEmpty(serviceOwner.email))
                {
                    // notify service owner
                    try
                    {
                        using (var client = new SmtpClient("smtp.gmail.com"))
                        {
                            var mail = new MailMessage();
                            mail.From = new MailAddress("email");
                            mail.To.Add(serviceOwner.email); // serviceOwner.email
                            mail.Subject = "Service Failure on Channel";
                            mail.Body    = "Channel: " + channel.name + Environment.NewLine + "Failure Rate: " + report.failureRate + "%";

                            client.Port        = 587;
                            client.Credentials = new System.Net.NetworkCredential(serviceOwner.email, "");
                            client.EnableSsl   = true;

                            client.Send(mail);
                            isNotified = true;
                        }
                    }
                    catch (Exception) { }
                }

                var serviceFailureLog = new ServiceFailureLog
                {
                    channelId         = channel.id,
                    failureRate       = report.failureRate,
                    notified          = isNotified,
                    serviceOwnerEmail = serviceOwner.email,
                    serviceOwnerId    = serviceOwner.id,
                    timestamp         = DateTime.Now
                };

                _context.ServiceFailureLogs.Add(serviceFailureLog);
                _context.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 28
0
        public void ItShouldParseTransactionReportFile()
        {
            // Cria o client que enviará a transação
            TransactionReportClient transactionReportClient = new TransactionReportClient(MerchantKey, _hostUri);

            // Faz o download para a variável
            HttpResponse httpResponse = transactionReportClient.DownloadReport(new DateTime(2015, 9, 19));

            Assert.AreEqual(HttpStatusCode.OK, httpResponse.HttpStatusCode);

            TransactionReportParser transactionReportParser = new TransactionReportParser();

            TransactionReport response = transactionReportParser.ParseString(httpResponse.RawResponse);

            Assert.AreEqual(response.Header.ReportFileCreateDate, new DateTime(2015, 9, 20));
        }
Esempio n. 29
0
        public async Task Should_Retrieve_TransactionReport()
        {
            RetrieveTransactionReportRequest request = RetrieveTransactionReportRequestBuilder.Create().Build();

            TransactionReport transactionReport = await TransactionReport.RetrieveAsync(request, Options);

            PrintResponse(transactionReport);

            Assert.AreEqual(Status.SUCCESS.ToString(), transactionReport.Status);
            Assert.AreEqual(0, transactionReport.StatusCode);
            Assert.IsNull(transactionReport.ConversationId);
            Assert.IsNull(transactionReport.CurrentPage);
            Assert.IsNull(transactionReport.TotalPageCount);
            Assert.IsNotNull(transactionReport.SystemTime);
            Assert.IsNull(transactionReport.ErrorMessage);
        }
        /// <summary>
        /// Parses the stream into a TransactionReport object.
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public TransactionReport ParseStream(Stream stream)
        {
            TransactionReport report = new TransactionReport();

            int lineCount = 0;

            using (StreamReader reader = new StreamReader(stream)) {
                while (reader.EndOfStream == false)
                {
                    lineCount++;

                    // Reads the line.
                    string line = reader.ReadLine();

                    if (string.IsNullOrWhiteSpace(line))
                    {
                        continue;
                    }

                    // Splits the line contents.
                    string[] lineItems = line.Split(new char[] { ',' }, StringSplitOptions.None);

                    // Obtains a parser for the line.
                    IReportItemParser objectParser = ParserFactory.GetParser(lineItems[0]);

                    if (objectParser == null)
                    {
                        throw new InvalidDataException("The selected file has an invalid format or is currupted. Line " + lineCount.ToString());
                    }

                    IReportItem reportItem = null;

                    try {
                        // Parses the report item.
                        reportItem = objectParser.Parse(lineItems);
                    }
                    catch (Exception ex) {
                        throw new InvalidDataException("The selected file has an invalid format or is currupted. Line " + lineCount.ToString(), ex);
                    }

                    // Adds the parsed item to the report.
                    report.Add(reportItem);
                }
            }

            return(report);
        }