public void CleanNewOrder()
 {
     OrderList.Clear();
     CalcSubTotalNet();
     ClientId     = 0;
     SelectedItem = null;
 }
        } // SendToBack

        #endregion

        #region Update

        /// <summary>
        /// Update.
        /// </summary>
        public static void Update()
        {
            if (!Visible || !InputEnabled)
                return;
            //try
            {
                // Init new controls.
                Control.InitializeNewControls();

                InputSystem.Update();

                // In the control's update the Root Control list could be modified so we need to create an auxiliary list.
                ControlsList controlList = new ControlsList(RootControls);
                foreach (Control control in controlList)
                {
                    control.Update();
                }
                OrderList.Clear();
                SortLevel(RootControls);
            }
            /*catch (Exception exception)
            {
                throw new InvalidOperationException("User Interface Manager: Update failed.", exception);
            }*/
        } // Update
Exemple #3
0
        //whenever there is a request, create an event(bypass)
        protected override void ControlOrder(OrderList orderListIn)
        {
            Dictionary <Storage, BinList> eventsToCreate = new Dictionary <Storage, BinList>();
            Transporter transporter = this.Manager.LayoutManager.Layout.Transporter;

            foreach (Order order in orderListIn)
            {
                Bin bin = new Bin(order.ComponentType + "-Bin", this.Manager.LayoutManager.Layout, order.ComponentType);
                this.Manager.LayoutManager.Layout.Bins.Add(bin);
                bin.Destination = order.Owner;
                transporter.Receive(this.Manager.Time, bin);
                if (eventsToCreate.Keys.Contains(order.Owner))
                {
                    eventsToCreate[order.Owner].Add(bin);
                }
                else
                {
                    eventsToCreate.Add(order.Owner, new BinList());
                    eventsToCreate[order.Owner].Add(bin);
                }
            }

            foreach (Storage storage in eventsToCreate.Keys)
            {
                double time = this.Manager.Time;
                time += transporter.TravelTime.GenerateValue();
                for (int i = 0; i < eventsToCreate[storage].Count; i++)
                {
                    time += transporter.TransferTime.GenerateValue();
                }
                this.Manager.EventCalendar.ScheduleEndLoadUnloadEvent(time, eventsToCreate[storage], transporter, (BinMagazine)storage);
            }

            orderListIn.Clear();
        }
        async Task SearchItemsCommand()
        {
            OrderList.Clear();
            List <CompactOrderModel> tmplist = await App.OrderTable.GetOrdersAsync(OrderSearch.ToLower());

            OrderList = new ObservableCollection <CompactOrderModel>(tmplist);
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsRefreshing)
            {
                return;
            }

            IsRefreshing = true;

            try
            {
                OrderList.Clear();
                var items = await App.OrderTable.GetAllOrdersAsync();

                OrderList = new ObservableCollection <CompactOrderModel>(items);
            }
            catch (Exception ex)
            {
                //Debug.WriteLine(ex);
            }
            finally
            {
                await Task.Delay(500);

                IsRefreshing = false;
            }
        }
        public void GetOrConfirmList(OrConfirm orfirm)
        {
            OrderList.Clear();
            OrConfirm[] orfirms = qryservice.getCiOrdConfirmedQry(orfirm);
            if (orfirms == null || orfirms.Count() == 0)
            {
                return;
            }
            var notshowList = new List <OrConfirm>();

            nowtime = LogicEx.GetInstance().GetSystemDateTime();
            foreach (OrConfirm confirm in orfirms)
            {
                if (SetSorNameValue(confirm))
                {
                    notshowList.Add(confirm);
                }
            }
            IOrderedEnumerable <OrConfirm> gg = orfirms.OrderBy(item => item.Name_su_or);
            IOrderedEnumerable <OrConfirm> ff = gg.OrderBy(item => item.Name_bed);

            OrderList = ff.ToArray();
            foreach (OrConfirm confirm in notshowList)
            {
                OrderList.Remove(confirm);
            }
        }
 /// <summary>
 /// Updates order's grid view.
 /// </summary>
 private void UpdateOrderGridView()
 {
     OrderList.Clear();
     foreach (var item in _orderService.GetAll().Result)
     {
         OrderList.Add(item);
     }
 }
 public async Task RefresOrdersAsync()
 {
   var data = await OrderService.GetOrdersAsync();
   OrderList.Clear();
   foreach (var item in data)
   {
     OrderList.Add(item);
   }
 }
        public async void Load()
        {
            var orders = await PersistencyService.LoadKundeListeFromJsonAsync();

            OrderList.Clear();
            foreach (var order in orders)
            {
                orders.Add(order);
            }
        }
        public async Task FirstExecuteLoadItemsCommand(string menuPage)
        {
            OrderList.Clear();
            await ExecuteLoadItemsCommand(menuPage);

            if (OrderList.Count == 0)
            {
                ListFooterText = "Order list is empty";
            }
        }
Exemple #11
0
 /// <summary>
 /// Method for filtering view.
 /// </summary>
 public void FilterViewAcordingToRoles()
 {
     OrderList.Clear();
     foreach (Order o in OrdersFromWebAPI)
     {
         var newOrder = CopyOrderExceptEvents(o);
         foreach (Event e in o.DCRGraph.Events)
         {
             if (!e.Groups.Exists(ev => ev.Name == "Edit events") && e.Groups.Exists(ev => ev.Name == "only pending")) //Filter out "Edit events" and be sure the event shows for "only pending"
             {
                 foreach (Role r in e.Roles)
                 {
                     if (Manager) //If manager is checked off, we just add all events.
                     {
                         if (!newOrder.DCRGraph.Events.Contains(e))
                         {
                             newOrder.DCRGraph.Events.Add(e);
                             continue;
                         }
                     }
                     if (r.Name == "Waiter" && Waiter)
                     {
                         if (!newOrder.DCRGraph.Events.Contains(e))
                         {
                             newOrder.DCRGraph.Events.Add(e);
                             continue;
                         }
                     }
                     if (r.Name == "Chef" && Chef)
                     {
                         if (!newOrder.DCRGraph.Events.Contains(e))
                         {
                             newOrder.DCRGraph.Events.Add(e);
                             continue;
                         }
                     }
                     if (r.Name == "Delivery" && Delivery)
                     {
                         if (!newOrder.DCRGraph.Events.Contains(e))
                         {
                             newOrder.DCRGraph.Events.Add(e);
                             continue;
                         }
                     }
                 }
             }
         }
         if (_ShowOnlyPendingOrders && newOrder.DCRGraph.Events.Count == 0) //If no event are to be shown in order, don't add it. It is not relevant.
         {
             continue;
         }
         OrderList.Add(newOrder);
     }
 }
Exemple #12
0
        private void addStatusProcess(int idProcess, int idWorker)
        {
            using (var db = new workshopEntities())
            {
                process oneProcess = db.process.Find(idProcess);
                string  message    = "";
                if (oneProcess.dateTimeStartFact == null)
                {
                    oneProcess.dateTimeStartFact    = DateTime.Now;
                    oneProcess.Worker_idWorker_Fact = idWorker;
                    message = "Старт зафіксовано!";
                    if (oneProcess.dateTimeStartFact.Value < oneProcess.dateTimeStart.Value)
                    {
                        message += "\nВи працюєте по плану";
                    }
                    else
                    {
                        message += "\nВи не встигаєте";
                    }
                    message += "\nПриступайте до роботи!!!";
                }
                else if (oneProcess.dateTimeFinishFact == null)
                {
                    oneProcess.dateTimeFinishFact = DateTime.Now;
                    message = "Завершення работи зафіксовано!";
                    if (oneProcess.dateTimeFinishFact.Value < oneProcess.dateTimeFinish.Value)
                    {
                        message += "\nВи встигли";
                    }
                    else
                    {
                        message += "\nВи не встигли";
                    }
                    message += "\nДякуємо за виконану роботу!!!";
                }
                else
                {
                    message = "Це завдання вже завершено!!!";
                }

                db.SaveChanges();
                var noComplatedProcesses = db.process.Where(p => (p.Order_idOrder == oneProcess.Order_idOrder && (p.dateTimeFinishFact == null || p.dateTimeStartFact == null))).ToList();
                if (noComplatedProcesses.Count == 0)
                {
                    var order = db.order.Find(oneProcess.Order_idOrder);
                    order.status = true;
                    db.SaveChanges();
                }
                _messageService.ShowAsync(message, "", MessageButton.OK, MessageImage.Information);
            }

            OrderList.Clear();
            OrderList = getOrderList();
        }
        public async Task GetOrders()
        {
            ProgressBarVal = "0";
            List <OrdersResponseModel> Orders = await dashboardRepo.GetOrders();

            OrderList.Clear();
            foreach (var o in Orders)
            {
                OrderList.Add(o);
            }
            ProgressBarVal = "100";
        }
        /// <summary>
        /// 获取单号集合
        /// </summary>
        public List <RequestOrder> GetOrderList()
        {
            ResponseModel respons;

            if (OrderList.Count > 2 && QuestOrder != "")
            {
                return(OrderList.Where(t => t.DDNO.Contains(QuestOrder)).ToList());;
            }
            else
            {
                respons = orderServices.GetResponse(BeingDatePickers, EndDatePickers, QuestOrder);
            }

            // respons = orderServices.GetResponse(BeingDatePickers, EndDatePickers, QuestOrder);
            if (respons.code == 200)
            {
                if (OrderList.Count > 0)
                {
                    OrderList.Clear();
                }
                List <T_BDX_ORDER> OrderL = respons.data as List <T_BDX_ORDER>;
                var listorder             = OrderL.GroupBy(o => new { o.DDNO, o.DDRQ, o.KH, o.DW }).Select(t => (new RequestOrder
                {
                    DDNO = t.Key.DDNO,
                    DDRQ = t.Key.DDRQ,
                    KH = t.Key.KH,
                    //GGXH = t.Key.GGXH,
                    DW = t.Key.DW,
                    SL = t.Sum(it => Convert.ToInt32(it.SL)).ToString(),
                })).ToList();

                var ordersfinish = WtdlSqlService.GetOrdersFinish(BeingDatePickers);
                if (ordersfinish.code == 200)
                {
                    var listfinish = ordersfinish.data as List <W_OrderTable>;
                    for (int k = 0; k < listfinish.Count; k++)
                    {
                        var          temp    = listfinish[k].OrderId.Trim();
                        RequestOrder request = listorder.FindLast(f => f.DDNO.Trim().Contains(temp));
                        if (request != null)
                        {
                            listorder.Remove(request);
                        }
                    }
                }
                QueStatus = "状态码:" + respons.code.ToString() + "||查询信息:" + respons.result + "||总数量:" + listorder.Count.ToString();
                return(FilterOrder(listorder));
            }
            return(null);
        }
Exemple #15
0
        public void ClearList(ref double balanceleft)
        {
            if (OrderList.Count() != 0)
            {
                foreach (LoanItem p in OrderList)
                {
                    balanceleft = balanceleft + ((double)(p.Quantity)) * p.Price;
                }

                OrderList.Clear();
            }

            CalculateTotal();
        }
Exemple #16
0
 /// <summary>
 /// 清空订单
 /// </summary>
 public void Clear(bool isNewOrderSn = false)
 {
     EditTotal         = -1;
     TotalPreferential = 0m;
     OrderList.Clear();
     ActivityId            = 0;
     EnableRangeMarketings = true;
     if (isNewOrderSn)
     {
         NewAndResetOrderSN();
     }
     SaleMan    = string.Empty;//清空导购员
     MemberId   = string.Empty;
     MemberInfo = null;
 }
Exemple #17
0
        private async void Confirm()
        {
            foreach (var item in OrderList)
            {
                await SessionService.Session.InsertTransaction(SessionService.Session.CustomerId, item.Id);
            }

            OrderList.Clear();
            Sum = 0;

            IsPopupOpen   = false;
            SelectedIndex = 0;

            GetTransactions();
        }
            } // FormClosing

        #endif

        #endregion

        #region Dispose Controls

        /// <summary>
        /// Dispose all controls added to the manager and its child controls.
        /// </summary>
        public static void DisposeControls()
        {
            try
            {
                for (int i = 0; i < RootControls.Count; i++)
                {
                    RootControls[i].Dispose();
                }
                RootControls.Clear();
                OrderList.Clear();
                FocusedControl = null;
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("User Interface Manager: Unable to dispose controls. Was the User Interface Manager started?", e);
            }
        } // DisposeControls
Exemple #19
0
        /// <summary>
        /// Method for getting all orders which holds status 2, indicating that an order is ready to be served
        /// </summary>
        public async void GetAllOrders()
        {
            DataBaseList = await rep.GetOrderByStatus(2);

            OrderList.Clear();

            foreach (Order item in DataBaseList)
            {
                OrderViewModel model = new OrderViewModel();

                model.OrderID = item.OrderID;
                model.Price   = item.Price;
                model.Status  = item.Status;

                OrderList.Add(model);
            }
        }
        protected override void OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e)
        {
            if (OrderList != null)
            {
                OrderList.Clear();
            }
            else
            {
                OrderList = new List <OrderEntity>();
            }

            sortAsc = !sortAsc;

            OrderList.Add(new OrderEntity(Columns[e.ColumnIndex].Name, sortAsc));

            RefreshList();
        }
Exemple #21
0
        public void ClearBoard()
        {
            DeckRegularDict <T> tempList = new DeckRegularDict <T>();
            int x = 0;

            foreach (var thisCard in CardList)
            {
                T tempCard = new T();
                x++;
                tempCard.Populate(x);
                tempCard.Deck     += 1000; //try this way.  hopefully won't cause any other issues.
                tempCard.IsUnknown = true;
                tempCard.Visible   = true;
                tempList.Add(tempCard);
            }
            OrderList.Clear();
            CardList.ReplaceRange(tempList); // hopefully its that simple.
            Visible = true;                  // now it is visible.
        }
 private async void UpdateOrderList()
 {
     try
     {
         MainPage.Current.ActiveProgressRing();
         OrderList.Clear();
         (await GetSearchedData()).ForEach(item =>
         {
             OrderList.Add(item);
         });
     }
     catch (Exception ex)
     {
         await MainPage.ShowErrorMessage(ex.Message);
     }
     finally
     {
         MainPage.Current.InActiveProgressRing();
     }
 }
Exemple #23
0
        protected virtual void Dispose(bool isdisposable)
        {
            if (OrderDetails != null)
            {
                foreach (var orderDetail in OrderDetails)
                {
                    (orderDetail as OrderInfo).Dispose();
                }

                OrderDetails.Clear();
            }

            if (OrderList != null)
            {
                foreach (var order in OrderList)
                {
                    (order as OrderInfo).Dispose();
                }

                OrderList.Clear();
            }
        }
Exemple #24
0
        public void CreateOrderList()
        {
            OrderList.Clear();

            SqlConnection  con      = Methods.AccessDatabase();
            SqlDataAdapter autoNode = new SqlDataAdapter("SELECT * From [ORDER]", con);
            DataTable      dt       = new DataTable();

            autoNode.Fill(dt);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ORDER newOrder = new ORDER();

                newOrder.OrderID         = Convert.ToInt16(dt.Rows[i]["Order_ID"]);
                newOrder.SupplierID      = Convert.ToInt16(dt.Rows[i]["Supplier_ID"]);
                newOrder.ProductID       = Convert.ToInt16(dt.Rows[i]["Product_ID"]);
                newOrder.DateOrdered     = Convert.ToDateTime(dt.Rows[i]["Date"]);
                newOrder.QuantityOrdered = Convert.ToInt16(dt.Rows[i]["Quantity_Ordered"]);

                OrderList.Add(newOrder);
            }
        }
Exemple #25
0
        protected void btnSearchDates_Click(object sender, EventArgs e)
        {
            try
            {
                OrderList.Clear();

                String[] names     = Session["EmployeeName"].ToString().Split(' ');
                string   firstName = names[0];
                string   lastName  = names[1];

                Employee OrderEmployee = EmployeeFactory.RetrieveByName(firstName, lastName);

                if (Session["AccessLevel"].ToString().Equals("C"))
                {
                    if (dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(DateTime.MinValue, DateTime.MinValue, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "C");
                    }
                    else if (dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && !dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(DateTime.MinValue, dtpEndDate.SelectedDate, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "C");
                    }
                    else if (!dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(dtpStartDate.SelectedDate, DateTime.MinValue, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "C");
                    }
                    else if (!dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && !dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(dtpStartDate.SelectedDate, dtpEndDate.SelectedDate, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "C");
                    }
                }
                else
                {
                    if (dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(DateTime.MinValue, DateTime.MinValue, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "S");
                    }
                    else if (dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && !dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(DateTime.MinValue, dtpEndDate.SelectedDate, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "S");
                    }
                    else if (!dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(dtpStartDate.SelectedDate, DateTime.MinValue, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "S");
                    }
                    else if (!dtpStartDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM") && !dtpEndDate.SelectedDate.ToString().Equals("0001-01-01 12:00:00 AM"))
                    {
                        OrderList = PurchaseOrderFactory.RetrieveOrdersForProcessing(dtpStartDate.SelectedDate, dtpEndDate.SelectedDate, OrderEmployee.Id, txtFilter.Text, txtEmployeeName.Text, "S");
                    }
                }

                if (OrderList.Count == 0)
                {
                    btnCancelSearch_Click(btnCancelSearch, EventArgs.Empty);
                    confirmation.Attributes.Add("style", "display:block");
                    lblMessage.Text = "No purchase orders were found for your search parameters";
                }
                else
                {
                    grdOrders.DataSource = OrderList;
                    grdOrders.DataBind();
                    grdOrders.Visible       = true;
                    btnCancelSearch.Visible = true;
                    searchPanel.Enabled     = false;
                    lblMessage.Text         = "";
                    confirmation.Attributes.Add("style", "display:none");

                    for (int i = 0; i < OrderList.Count; i++)
                    {
                        OrdersForProcessing tmpOrder = OrderList[i];

                        if (!tmpOrder.Status.Equals("Pending"))
                        {
                            grdOrders.Rows[i].BackColor = System.Drawing.Color.Gray;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                confirmation.Attributes.Add("style", "display:block");
                lblMessage.Text = "An error has occurred. " + ex.Message;
            }
        }
Exemple #26
0
 private void dispatcherTimer_Tick(object sender, EventArgs e)
 {
     OrderList.Clear();
     OrderList = getOrderList();
 }
Exemple #27
0
        private void UpdateGUI(StatusClass _ErrorStatus)
        {
            List <string> tempIDs  = new List <string>();
            List <Order>  tempData = new List <Order>();

            bool fonlyOnce = true;

            while (!Manager.fStop)
            {
                if (Manager.Bridge.fFailedConection)
                {
                    Manager.fStop = true;

                    refcontrol.BeginInvoke((MethodInvoker) delegate()
                    {
                        ShowConnectionError();
                    });
                }

                if (!Manager.Bridge.fConnected)
                {
                    System.Threading.Thread.Sleep(500);
                    continue;
                }

                if (fonlyOnce)
                {
                    if (Manager.bkp.ordersToRestore())
                    {
                        refcontrol.BeginInvoke((MethodInvoker) delegate()
                        {
                            AskForBackup();
                        });
                    }
                    else
                    {
                        Manager.startTasks();
                    }
                    fonlyOnce = false;
                }

                tempData = OrderList.Where(el => !(Manager.Bridge.OnHoldOrders.Exists(x => x.OrderUuid == el.ID) || Manager.Bridge.ActiveOrders.Exists(x => x.OrderUuid == el.ID))).ToList();

                if (tempData.Any())
                {
                    foreach (Order it in tempData)
                    {
                        refcontrol.BeginInvoke((MethodInvoker) delegate()
                        {
                            OrderList.Remove(it);
                        });
                    }
                }

                tempData = OrderList.Where(el => Manager.Bridge.OnHoldOrders.Exists(x => x.OrderUuid == el.ID) || Manager.Bridge.ActiveOrders.Exists(x => x.OrderUuid == el.ID)).ToList();

                if (tempData.Any())
                {
                    foreach (Order it in tempData)
                    {
                        int index = OrderList.IndexOf(it);
                        OrderList[index].STATUS   = ErrorStatus.getStatusByOrder(it.ID);
                        OrderList[index].TIMELEFT = (DateTime.UtcNow - it.CREATED).ToString(@"dd\.hh\:mm\:ss");
                    }
                }

                foreach (Order it in OrderList)
                {
                    tempIDs.Add(it.ID);
                }

                foreach (BittrexSharp.Domain.OpenOrder it in Manager.Bridge.OnHoldOrders)
                {
                    if (tempIDs.Contains(it.OrderUuid))
                    {
                        continue;
                    }
                    refcontrol.BeginInvoke((MethodInvoker) delegate()
                    {
                        OrderList.Add(new Order(it.OrderUuid, it.Exchange, it.QuantityRemaining, it.OrderType, ErrorStatus.getStatusByOrder(it.OrderUuid), it.Opened, (DateTime.UtcNow - it.Opened).ToString(@"dd\.hh\:mm\:ss")));
                    });
                }

                foreach (BittrexSharp.Domain.OpenOrder it in Manager.Bridge.ActiveOrders)
                {
                    if (tempIDs.Contains(it.OrderUuid))
                    {
                        continue;
                    }

                    refcontrol.BeginInvoke((MethodInvoker) delegate()
                    {
                        if (!Manager.Bridge.OnHoldOrders.Exists(x => x.OrderUuid == it.OrderUuid))
                        {
                            OrderList.Add(new Order(it.OrderUuid, it.Exchange, it.QuantityRemaining, it.OrderType, ErrorStatus.getStatusByOrder(it.OrderUuid), it.Opened, (DateTime.UtcNow - it.Opened).ToString(@"dd\.hh\:mm\:ss")));
                        }
                    });
                }

                tempIDs.Clear();
                System.Threading.Thread.Sleep(Constants.second);
            }

            refcontrol.BeginInvoke((MethodInvoker) delegate()
            {
                OrderList.Clear();
            });
        }
Exemple #28
0
        public override void PrepareWork()
        {
            TargetPortfolio.PrepareWork();
            MarketDataList.Clear();
            CurrentDataSource.DataList.Clear();
            CurrentValueList.Clear();
            StandardValueList.Clear();
            OrderList.Clear();

            DateTime st = TestStartTime;

            if (TestStartTime > AnalyseStartTime)
            {
                st = AnalyseStartTime;
            }
            CurrentDataSource.CacheStartTime = st;
            CurrentDataSource.CacheEndTime   = TestEndTime;

            TestCurrentTime = TestStartTime;
            analyseTime     = MarketData.GetNextTime(TestCurrentTime, AnalyseGrade);

            _MaxLost = new Money()
            {
                FxCode = Pnl.FxCode, Number = 0
            };
            if (UseFirstMarketDataInit)
            {
                var fdl = new List <IMarketData>();
                InstrumentList.ForEach(v =>
                {
                    var d = CurrentDataSource.GetFirstData(v, TestStartTime, TestEndTime, Grade);
                    if (d != null)
                    {
                        fdl.Add(d);
                    }
                });
                TargetPortfolio.ProcessMarketData(fdl);
                TargetPortfolio.PositionList.ForEach(v =>
                {
                    var d = fdl.FirstOrDefault(m => m.InstrumentTicker == v.InstrumentTicker);
                    if (d != null)
                    {
                        v.Cost = d.Close;
                    }
                });
            }
            if (IsUnlimited)
            {
                TargetPortfolio.IsUnlimited = true;
            }
            standardPortfolio = TargetPortfolio.Clone() as IPortfolio;
            testStartValue    = TargetPortfolio.CurrentValue;
            CurrentDataSource.PrepareWork();
            CurrentTradeGate.PrepareWork();
            foreach (var condition in ConditionList)
            {
                condition.PrepareWork();
                condition.GetInstrumentList = () => { return(InstrumentList); };
                condition.AnalyseDataSource = CurrentDataSource;
            }

            TestStrategy.CurrentPortfolio = TargetPortfolio;
            TestStrategy.PrepareWork();
            RiskPolicy.PrepareWork();
        }
Exemple #29
0
 private void ClearData()
 {
     RMADtoList.Clear();
     OrderList.Clear();
 }