Beispiel #1
0
        public static DataSet1 GetDataSet()
        {
            DataSet1 dataset           = new DataSet1();
            var      headertransaction = dataset.HeaderTransaction;
            var      detailtransaction = dataset.DetailTransaction;

            List <HeaderTransaction> header = ReportingHandler.fetchheader();

            foreach (HeaderTransaction h in header)
            {
                var row = headertransaction.NewRow();
                row["TransactionID"]   = h.TransactionID;
                row["TransactionDate"] = h.TransactionDate;
                row["UserID"]          = h.UserID;
                row["PaymentTypeID"]   = h.PaymentTypeID;
                headertransaction.Rows.Add(row);

                List <DetailTransaction> detail = ReportingHandler.fetchdetail(h.TransactionID);
                foreach (DetailTransaction d in detail)
                {
                    var rowdet = detailtransaction.NewRow();
                    rowdet["TransactionID"] = d.TransactionID;
                    rowdet["ProductID"]     = d.ProductID;
                    rowdet["ProductName"]   = d.MsProduct.ProductName;
                    rowdet["ProductPrice"]  = d.MsProduct.ProductPrice;
                    rowdet["Quantity"]      = d.Quantity;
                    detailtransaction.Rows.Add(rowdet);
                }
            }
            return(dataset);
        }
Beispiel #2
0
        public void StartListening()
        {
            try
            {
                // TcpListener server = new TcpListener(port);
                server = new TcpListener(address, port);

                // Start listening for client requests.
                server.Start();
                while (true)
                {
                    TcpClient client = server.AcceptTcpClient();

                    //start new handler depending on the incoming port connection (on new thread)
                    IHandler handler;
                    switch (port)
                    {
                    case 7010:
                        handler = new ModeratorHandler(client, model);
                        break;

                    case 7020:
                        handler = new AccountHandler(client, model);
                        break;

                    case 7030:
                        handler = new ReportingHandler(client, model);
                        break;

                    default:
                        handler = new ClientHandler(client, model);
                        break;
                    }
                    Thread thread = new Thread(h => handler.Start());
                    thread.Start();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
        }