Example #1
0
        public int CreateReport(OrderReport orderReport)
        {
            _context.OrderReports.Add(orderReport);
            _context.SaveChanges();

            return(orderReport.Id);
        }
Example #2
0
        public OrderReport GetReport(int id)
        {
            OrderReport      Report   = new OrderReport();
            List <ZakazInfo> InfoList = new List <ZakazInfo>();

            using (LD_kursEntities db = new LD_kursEntities())
            {
                var zakaz = db.zakaz.SingleOrDefault(c => c.id == id);

                Report.OrderId    = zakaz.id.ToString();
                Report.start_time = zakaz.start_time;
                Report.end_time   = zakaz.end_time;
                Report.price      = zakaz.price;

                Report.DesignerName    = zakaz.designer.name;
                Report.DesignerSurname = zakaz.designer.surname;

                Report.LandName    = zakaz.land.name;
                Report.LandAddress = zakaz.land.addres;
                Report.LandSize    = zakaz.land.size.ToString();

                Report.CustomerName    = zakaz.land.customer.name;
                Report.CustomerSurname = zakaz.land.customer.surname;

                Report.WorkList         = Mapper.Map <List <Work> >(zakaz.work);
                Report.DifficultiesList = Mapper.Map <List <Difficulties> >(zakaz.difficulties);
            }
            return(Report);
        }
        public async Task <OrderReport> AddOrderReport(OrderReport report)
        {
            _reportContext.OrderReport.Add(report);
            await _reportContext.SaveChangesAsync();

            return(report);;
        }
Example #4
0
        public void GenerateOrderReport(OrderReport orderReport)
        {
            var path     = Path.Combine(ReportFolderPath, $"uzsakymu_numeriu_report_{DateTime.Now.ToString(DateFormat)}.txt");
            var fileInfo = new FileInfo(path);

            fileInfo.Directory.Create();

            var reportBuilder = new StringBuilder();

            reportBuilder.AppendLine("Užsakymai žemiau apatinio intervalo rėžio:");

            foreach (var order in orderReport.BelowLowerBound)
            {
                reportBuilder.AppendLine(order.ToString());
            }

            reportBuilder.AppendLine("Užsakymai nepatenkantys į intervalą:");

            foreach (var order in orderReport.MissingInInterval)
            {
                reportBuilder.AppendLine(order.ToString());
            }

            reportBuilder.AppendLine("Užsakymai aukščiau viršutinio intervalo rėžio:");

            foreach (var order in orderReport.AboveUpperBound)
            {
                reportBuilder.AppendLine(order.ToString());
            }

            File.WriteAllText(path, reportBuilder.ToString());
        }
        public ActionResult PrintOrder(int id, string userId)
        {
            List <OrderDetails> orderDetails = _db.OrderDetails.Include(n => n.OrderHeader).Include(n => n.MenuItem).Where(m => m.OrderId == id).Where(m => m.OrderHeader.UserId == userId).ToList();
            OrderReport         rpt          = new OrderReport(_webHostEnvironment);

            return(File(rpt.Report(orderDetails), "application/pdf"));
        }
Example #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            OrderReport orderReport = db.OrderReports.Find(id);

            db.OrderReports.Remove(orderReport);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #7
0
 private async Task GenerateOrderDiffAsync(OrderReport orderDiffReport)
 {
     await Task.Run(() =>
     {
         _logService.Information("Start generating order diff report");
         _lifetimeService.ExecuteInLifetime <IReportGenerator>(generator => generator.GenerateOrderReport(orderDiffReport));
     });
 }
Example #8
0
        /// <summary>
        /// 通过委托报单缓冲区更新委托报单数组
        /// </summary>
        private void UpdateOrederReport()
        {
            lock (orderReportBufferLock)
            {
                for (int i = 0; i < orderReportBuffer.Count; i++)
                {
                    OrderReport orderReport = orderReportBuffer[i];

                    switch (orderReport.CurOrderState.Status)
                    {
                    case "Submitted":    //交易进行中,增加或更新活动委托单信息
                        for (int k = 0; k < m_OrderReportList.Count; k++)
                        {
                            if (m_OrderReportList[k].OrderId == orderReport.OrderId)
                            {
                                orderReport.CurOrderStatus = m_OrderReportList[k].CurOrderStatus;
                                m_OrderReportList[k]       = orderReport;
                                break;
                            }
                        }

                        for (int k = m_NotBackOrderIdList.Count - 1; k >= 0; k--)
                        {
                            if (m_NotBackOrderIdList[k] == orderReport.OrderId)
                            {
                                m_NotBackOrderIdList.RemoveAt(k);
                            }
                        }
                        break;

                    case "Filled":    //交易进行中,增加或更新活动委托单信息
                        for (int k = 0; k < m_OrderReportList.Count; k++)
                        {
                            if (m_OrderReportList[k].OrderId == orderReport.OrderId)
                            {
                                orderReport.CurOrderStatus = m_OrderReportList[k].CurOrderStatus;
                                m_OrderReportList[k]       = orderReport;
                                break;
                            }
                        }

                        for (int k = m_NotBackOrderIdList.Count - 1; k >= 0; k--)
                        {
                            if (m_NotBackOrderIdList[k] == orderReport.OrderId)
                            {
                                m_NotBackOrderIdList.RemoveAt(k);
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
                orderReportBuffer.Clear();
            }
        }
Example #9
0
        public override void OtherReport(OrderReport oReport)
        {
            StringBuilder sb = new StringBuilder();

            oReport.Dump(sb);
            sb.AppendFormat("\n");

            System.Console.Out.Write(sb);
        }
Example #10
0
        public override void OtherReport(OrderReport oReport)
        {
            StringBuilder sb = new StringBuilder();

            oReport.Dump(sb);
            sb.AppendFormat("\n");

            debug(sb.ToString());
        }
Example #11
0
 public ActionResult Edit([Bind(Include = "OrderReportID,CustomerID,CreatedDay,Interest")] OrderReport orderReport)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orderReport).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(orderReport));
 }
Example #12
0
        public ActionResult Create([Bind(Include = "OrderReportID,CustomerID,CreatedDay,Interest")] OrderReport orderReport)
        {
            if (ModelState.IsValid)
            {
                db.OrderReports.Add(orderReport);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(orderReport));
        }
Example #13
0
        internal OrderReportDto ConvertOrderReportForView(OrderReport orderReport)
        {
            var orderReportDto = new OrderReportDto()
            {
                CreationTime = orderReport.CreationTime,
                Id           = orderReport.Id,
                OrderBlocks  = orderReport.OrderBlocks.Select(b => ConvertOrderBlockForView(b)).ToList()
            };

            return(orderReportDto);
        }
Example #14
0
        public async Task <ActionResult <OrderReport> > AddDeliveryReport([FromBody] OrderReport report)
        {
            if (!ModelState.IsValid)
            {
                Console.WriteLine("Invalid state...");
                return(BadRequest(ModelState));
            }
            var newReport = await _orderRepository.AddOrderReport(report);

            return(CreatedAtAction(nameof(GetAllOrderReports), new { id = newReport.Id }, newReport));
        }
Example #15
0
        private void AssertOrder(OrderReport report, Order expectedOrder, IEmployer expectedEmployer)
        {
            Assert.AreEqual(expectedEmployer.FullName, report.ClientName);
            Assert.AreEqual(expectedEmployer.Organisation.Name, report.OrganisationName);
            Assert.AreEqual(expectedOrder.AdjustedPrice, report.Price);
            Assert.AreEqual(expectedOrder.Items.Count, report.Products.Length);

            foreach (var item in expectedOrder.Items)
            {
                Assert.IsTrue(report.Products.Contains(_productsQuery.GetProduct(item.ProductId).Name));
            }
        }
Example #16
0
        public IActionResult Create([FromBody] OrderReportCreate model)
        {
            try
            {
                OrderReport result = _orderReportService.Create(model);

                return(Ok(true));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e));
            }
        }
        private void ProcessOrderReport(OrderReport report)
        {
            var message = ProcessOrderReport(report, new ExecutionMessage
            {
                ExecutionType = ExecutionTypes.Transaction
            });

            if (message == null)
            {
                return;
            }

            SendOutMessage(message);
        }
Example #18
0
        // GET: OrderReports/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OrderReport orderReport = db.OrderReports.Find(id);

            if (orderReport == null)
            {
                return(HttpNotFound());
            }
            return(View(orderReport));
        }
Example #19
0
        internal OrderReport GenerateReport(Order order)
        {
            var report = new OrderReport
            {
                OrderId = order.Id
            };

            var orderBlocks = GenerateOrderBlocks(order);

            report.OrderBlocks  = orderBlocks;
            report.CreationTime = DateTime.Now;

            return(report);
        }
Example #20
0
        /// <summary>
        /// 限价委托下单
        /// </summary>
        protected void ReqOrderInsert(int orderId, Contract contract, Order order)
        {
            Log.WriteLineStrategyOrder(m_StrategyName, DateTime.Now.ToLongTimeString() + ":" + DateTime.Now.Millisecond + "  " + contract.Symbol + ", " + contract.SecType + ", " + contract.Strike + " @ " + contract.Exchange + ": " + order.Action + ", " + order.OrderType + " " + order.LmtPrice + " " + order.TotalQuantity);
            m_StrategyPool.ReqOrderInsert(orderId, contract, order);
            m_OrderIdList.Add(orderId);
            m_NotBackOrderIdList.Add(orderId);

            OrderReport orderReport = new OrderReport();

            orderReport.OrderId       = orderId;
            orderReport.OrderContract = contract;
            orderReport.CurOrder      = order;
            m_OrderReportList.Add(orderReport);
        }
        public static string GetWorkList(OrderReport report)
        {
            String Html = String.Concat(
                "Work List :", "</br>"
                );

            foreach (var item in report.WorkList)
            {
                Html += String.Concat(
                    "Type:  ", item.typee, "  Count:", item.countt, "  Price:", item.price, "</br>"
                    );
            }

            return(Html);
        }
        public static string GetDifficulties(OrderReport report)
        {
            String Html = String.Concat(
                "Difficulties List :", "</br>"
                );

            foreach (var item in report.DifficultiesList)
            {
                Html += String.Concat(
                    "Subject:  ", item.subj, "  Price:", item.price, "</br>"
                    );
            }

            return(Html);
        }
        public OrderReport Create(OrderReportCreate model)
        {
            long userId = _principalService.GetUserId();
            //ApplicationUser user = _userManager.Users.Where(x => x.Id == userId).FirstOrDefault();
            long  driverId = _db.Drivers.FirstOrDefault(x => x.UserId == userId).Id;
            Order order    = _db.Orders.Where(x => x.Id == model.OrderId)
                             .Include(x => x.Client).ThenInclude(x => x.User).FirstOrDefault();
            //Order number not order guid
            OrderReport orderReport = new OrderReport
            {
                IsActive        = true,
                CreatedById     = driverId,
                CreatedAt       = DateTime.Now,
                DriverComments  = model.DriverComments,
                Latitude        = model.Latitude,
                Longitude       = model.Longitude,
                OrderId         = model.OrderId,
                OrderReportGuid = Guid.NewGuid()
            };

            _db.OrderReports.Add(orderReport);
            _db.SaveChanges();
            if (order != null)
            {
                PushNotificationInput pushNotificationInput = new PushNotificationInput
                {
                    UserId = order.Client.User.Id,
                    title  = "بلاغ جديد",
                    body   = "تم تقديم بلاغ على طلبك",
                    data   = new
                    {
                        orderId = orderReport.OrderId,
                    }
                };
                _pushNotificationService.PushNotification(pushNotificationInput);
                DataBase.Entities.Notification notification = new DataBase.Entities.Notification
                {
                    Title            = "بلاغ جديد",
                    Body             = "تم تقديم بلاغ على طلب رقم " + order.Id + " رقم الهاتف : " + order.DeliveryPhoneNumber + "نص البلاغ : " + orderReport.DriverComments,
                    Target           = NotificationTarget.Tracker,
                    NotificationGuid = Guid.NewGuid()
                };
                _db.Notifications.Add(notification);
                _db.SaveChanges();
            }

            return(orderReport);
        }
Example #24
0
        public IActionResult Create(OrderReportReplaysCreate model)
        {
            long        userId   = _principalService.GetUserId();
            long        clientId = _db.Clients.FirstOrDefault(x => x.UserId == userId).Id;
            OrderReport report   = _db.OrderReports.Where(x => x.Id == model.OrderReportId)
                                   .Include(x => x.CreatedBy)
                                   .ThenInclude(y => y.User)
                                   .Include(x => x.Order)
                                   .ThenInclude(x => x.Record)
                                   .FirstOrDefault();
            Driver driver = _db.Drivers.FirstOrDefault(x => x.Id == report.Order.Record.DriverId);

            OrderReportReplaye orderReportReplay = new OrderReportReplaye
            {
                IsActive        = true,
                CreatedById     = clientId,
                CreatedAt       = DateTime.Now,
                ClientComment   = model.ClientComments,
                DriverLatitude  = (double)report.CreatedBy.User.Latitude,
                DriverLongitude = (double)report.CreatedBy.User.Longitude,
                OrderReportId   = model.OrderReportId
            };

            _db.OrderReportReplayes.Add(orderReportReplay);
            _db.SaveChanges();
            PushNotificationInput pushNotificationInput = new PushNotificationInput
            {
                UserId = driver.UserId,
                title  = "رد على البلاغ ",
                body   = "تم الرد على البلاغ",
                data   = new
                {
                    orderId = report.OrderId,
                }
            };

            _pushNotificationService.PushNotification(pushNotificationInput);
            DataBase.Entities.Notification notification = new DataBase.Entities.Notification
            {
                Title            = "رد على بلاغ",
                Body             = "تم تقديم رد على بلاغ على طلب رقم " + report.OrderId + " رقم الهاتف : " + report.Order.DeliveryPhoneNumber + "نص الرد : " + model.ClientComments,
                Target           = NotificationTarget.Tracker,
                NotificationGuid = Guid.NewGuid()
            };
            _db.Notifications.Add(notification);
            _db.SaveChanges();
            return(new OkObjectResult(true));
        }
        public async Task <ActionResult <Order> > UpdateItem(OrderReport report)
        {
            Order existingOrder = this._logicContext.ConvertReportToModel(report);

            if (this._logicContext.Validate(existingOrder))
            {
                ((DbContext)this._context).Update(existingOrder);
                await((DbContext)this._context).SaveChangesAsync();

                return(CreatedAtAction("GetItems", new { id = existingOrder.OrderId }, existingOrder));
            }
            else
            {
                return(BadRequest());
            }
        }
Example #26
0
 /// <summary>
 /// 接收委托报单数据,并将当前策略的报单写入缓冲区中
 /// </summary>
 public void ReceiveOpenOrder(int orderId, Contract contract, Order order, OrderState orderState)
 {
     //判断此委托报单是否属于此策略
     if (m_OrderIdList.Contains(orderId))
     {
         lock (orderReportBufferLock)
         {
             OrderReport orderReport = new OrderReport();
             orderReport.OrderId       = orderId;
             orderReport.OrderContract = contract;
             orderReport.CurOrder      = order;
             orderReport.CurOrderState = orderState;
             orderReportBuffer.Add(orderReport);
         }
     }
 }
Example #27
0
        private void PrintOrderReport(int OrderID)
        {
            XtraReport report = new OrderReport();

            report.DataSource = service.OrderReportSource(OrderID);
            report.RollPaper  = true;
            //var path = System.IO.Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\ReportsPDf\");
            //report.ExportToPdf(path +  Order.OrderNumberForShift + ".pdf");
            //report.CreateDocument();
            try {
                PrintToolBase tool = new PrintToolBase(report.PrintingSystem);
                tool.Print();
            }
            catch
            {
            }
        }
Example #28
0
        public PartialViewResult GetReport(int OrderID)
        {
            XtraReport report = new OrderReport();

            report.DataSource = service.OrderReportSource(OrderID);
            report.RollPaper  = true;


            report.CreateDocument();
            try
            {
                PrintToolBase tool = new PrintToolBase(report.PrintingSystem);
                tool.Print();
            }
            catch
            {
            }
            return(PartialView(report));
        }
        public async Task <ActionResult <Order> > CreateOrder(OrderReport report)
        {
            // For simplicity, drop the id if supplied on the create action.
            report.OrderId = null;

            Order newOrder = this._logicContext.ConvertReportToModel(report);

            if (this._logicContext.Validate(newOrder))
            {
                ((DbContext)this._context).Add(newOrder);
                await((DbContext)this._context).SaveChangesAsync();

                return(CreatedAtAction("GetItems", new { id = newOrder.OrderId }, newOrder));
            }
            else
            {
                return(BadRequest());
            }
        }
        public static Byte[] GetReport(OrderReport report)
        {
            string workList         = GetWorkList(report);
            string difficultiesList = GetDifficulties(report);

            String Html = String.Concat(
                "<html>",
                "<head>",
                "<style>",
                "body {font-size:16}",
                ".id {text-align:center}",
                "</style>",
                "</head>",
                "<body>",
                "<h1 class=\"id\">Order:", report.OrderId, "<h1/>",
                "<span>Price:", report.price, "<span/><br/>",
                "Start Date: ", report.start_time, "<br/>",
                "End Date: ", report.end_time, "<br/>",
                "<br/>",
                "Customer: ", report.CustomerName, " ", report.CustomerSurname, "<br/>",
                "<br/>",
                "Land: ", "<br/>",
                "Name: ", report.LandAddress, "<br/>",
                "Address:", report.LandAddress, "<br/>",
                "Size:", report.LandSize, "<br/>",
                "<br/>",
                "<br/>",
                "Designer: ", report.DesignerName, " ", report.DesignerSurname, "<br/>",
                workList, "</br>",
                "<br/>",
                difficultiesList, "</br>",
                "<br/>",
                "</body>",
                "</html>"
                );

            return(PdfSharpConvert(Html));
        }
			public override void OtherReport(OrderReport report)
			{
				_client.OrderReport.WithDump(_receiver).WithError(TransactionError).SafeInvoke(report);
			}
		private void ProcessOrderReport(OrderReport report)
		{
			var message = ProcessOrderReport(report, new ExecutionMessage
			{
				ExecutionType = ExecutionTypes.Transaction,
				HasOrderInfo = true,
			});

			if (message == null)
				return;

			SendOutMessage(message);
		}
Example #33
0
          public override void OtherReport(OrderReport oReport)
               {
               StringBuilder sb = new StringBuilder();

               oReport.Dump(sb);
               sb.AppendFormat("\n");

               System.Console.Out.Write(sb);
               }
		private void SessionHolderOnOrderReport(OrderReport report)
		{
			ProcessOrderReport(report);
		}
		private void ProcessOrderReport(OrderReport report)
		{
			var message = ProcessOrderReport(report, new ExecutionMessage
			{
				ExecutionType = ExecutionTypes.Order
			});

			if (message == null)
				return;

			SendOutMessage(message);
		}
		private ExecutionMessage ProcessOrderReport(OrderReport report, ExecutionMessage message)
		{
			ProcessAccount(report.Account);

			long transactionId;

			if (!long.TryParse(report.Tag, out transactionId))
				return null;

			message.PortfolioName = report.Account.AccountId;
			message.SecurityId = new SecurityId
			{
				SecurityCode = report.Symbol,
				BoardCode = report.Exchange,
			};
			message.OrderStringId = report.OrderNum;
			message.OrderBoardId = report.ExchOrdId;
			message.OriginalTransactionId = transactionId;
			message.Comment = report.UserMsg;
			message.OrderPrice = report.PriceToFill.ToDecimal() ?? 0;
			message.Volume = report.TotalFilled + report.TotalUnfilled;
			message.OrderType = RithmicUtils.ToOrderType(report.OrderType);
			message.Side = RithmicUtils.ToSide(report.BuySellType);
			message.ServerTime = RithmicUtils.ToTime(report.GatewaySsboe, report.GatewayUsecs);
			message.LocalTime = RithmicUtils.ToTime(report.Ssboe, report.Usecs).LocalDateTime;
			message.TimeInForce = RithmicUtils.ToTif(report.OrderDuration);

			if (report.OrderDuration == Constants.ORDER_DURATION_DAY)
				message.ExpiryDate = DateTime.Today.ApplyTimeZone(TimeZoneInfo.Utc);

			if (report.ReportType == Constants.REPORT_TYPE_BUST)
			{
			}
			else if (report.ReportType == Constants.REPORT_TYPE_CANCEL)
			{
				message.OrderState = OrderStates.Done;
			}
			else if (report.ReportType == Constants.REPORT_TYPE_COMMISSION)
			{
				message.OrderState = report.TotalUnfilled > 0 ? OrderStates.Active : OrderStates.Done;
			}
			else if (report.ReportType == Constants.REPORT_TYPE_FAILURE)
			{
				message.OrderState = OrderStates.Failed;
				message.Error = new InvalidOperationException(((OrderFailureReport)report).Status);
			}
			else if (report.ReportType == Constants.REPORT_TYPE_FILL)
			{
				message.OrderState = report.TotalUnfilled > 0 ? OrderStates.Active : OrderStates.Done;
			}
			else if (report.ReportType == Constants.REPORT_TYPE_MODIFY)
			{
				message.OrderState = report.TotalUnfilled > 0 ? OrderStates.Active : OrderStates.Done;
			}
			else if (report.ReportType == Constants.REPORT_TYPE_NOT_CNCLLD)
			{
				message.OrderState = OrderStates.Failed;
				message.Error = new InvalidOperationException(LocalizedStrings.Str3496);
			}
			else if (report.ReportType == Constants.REPORT_TYPE_NOT_MODIFIED)
			{
				message.OrderState = OrderStates.Failed;
				message.Error = new InvalidOperationException(LocalizedStrings.Str3497);
			}
			else if (report.ReportType == Constants.REPORT_TYPE_REJECT)
			{
				message.OrderState = OrderStates.Failed;
				message.Error = new InvalidOperationException(LocalizedStrings.Str3498);
			}
			else if (report.ReportType == Constants.REPORT_TYPE_SOD)
			{
			}
			else if (report.ReportType == Constants.REPORT_TYPE_SOD_MODIFY)
			{
			}
			else if (report.ReportType == Constants.REPORT_TYPE_STATUS)
			{
				message.OrderState = report.TotalUnfilled > 0 ? OrderStates.Active : OrderStates.Done;
			}
			else if (report.ReportType == Constants.REPORT_TYPE_TRADE_CORRECT)
			{
				message.OrderState = report.TotalUnfilled > 0 ? OrderStates.Active : OrderStates.Done;
			}
			else if (report.ReportType == Constants.REPORT_TYPE_TRIGGER)
			{
			}
			else if (report.ReportType == Constants.REPORT_TYPE_TRIGGER_PULLED)
			{
			}

			return message;
		}
Example #37
0
          public override void OtherReport(OrderReport oReport)
               {
               StringBuilder sb = new StringBuilder();

               oReport.Dump(sb);
               sb.AppendFormat("\n");

               debug(sb.ToString());
               }