示例#1
0
 private static OrderView GetOrderView(OrderSource orderSource, ReservedPnr pnrContent, PNRPair associatePNR, IEnumerable <FlightView> flightViews,
                                       PassengerType passengerType)
 {
     return(new OrderView
     {
         FdSuccess = true,
         Source = orderSource,
         PNR = pnrContent.PnrPair,
         Passengers = pnrContent.Passengers.OrderBy(p => p.Name).Select(p => new PassengerView
         {
             Name = p.Name,
             Credentials = p.CertificateNumber,
             CredentialsType = CredentialsType.身份证,
             PassengerType = passengerType,
             Phone = p.Mobilephone
         }),
         Flights = flightViews.Select(ReserveViewConstuctor.GetOrderFlightView).ToList(),
         Contact = new Contact
         {
             Name = BasePage.LogonCompany.Contact,
             Mobile = BasePage.LogonCompany.ContactPhone,
             Email = BasePage.LogonCompany.ContactEmail
         },
         AssociatePNR = associatePNR,
         IsTeam = pnrContent.IsTeam,
         TripType = pnrContent.Voyage.Type
     });
 }
示例#2
0
        static void Main(string[] args)
        {
            var prefilterPump = new OrderSource();
            var prefilterSink = new OrderSink();

            var prefilter = new Pipeline<Order>(prefilterPump, prefilterSink, "prefiltering")
                .Register(new CalculateSubtotal() { Name = "Subtotal calculator" })
                .Register(new CalculateTax() { Name = "Tax calculator" })
                .Register(new CalculateTotal() { Name = "Total calculator" })
                ;

            prefilter.Execute();

            Console.WriteLine("".PadRight(50, '='));
            foreach (var input in prefilterSink.Orders)
            {
                var result = string.Format("{0}  {1:C}  {2}  {3:C}  {4:C}  {5:C}",
                    input.Name.PadRight(10),
                    input.Price,
                    input.Quantity,
                    input.Subtotal,
                    input.Tax,
                    input.Total
                );
                Console.WriteLine(result);
            }
            Console.WriteLine("".PadRight(50, '='));

            Console.ReadKey();
        }
示例#3
0
        public IActionResult Edit(int id, OrderSource orderSource)
        {
            if (id != orderSource.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _orderSourceRepository.Update(orderSource);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_orderSourceRepository.Exists(orderSource.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.SourceTypes = _orderSourceTypeRepository.OrderSourceTypes.ToList();
            return(View(orderSource));
        }
示例#4
0
        void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectedRow(true))
            {
                return;
            }
            for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
            {
                OrderEntity order  = this.ADtGrid.SelectedItems[i] as OrderEntity;
                object      states = order.GetObjValue(EntityFieldName.CheckStates);
                if (states.ToString() != ((int)SMT.SaaS.FrameworkUI.CheckStates.UnSubmit).ToString())
                {
                    CommonFunction.NotifySelection(Utility.GetResourceStr("Msg_NoDeleteOrder"));
                    return;
                }
            }

            Action action = () =>
            {
                List <OrderEntity> list = new List <OrderEntity>();
                for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
                {
                    OrderEntity order = this.ADtGrid.SelectedItems[i] as OrderEntity;

                    order.FBEntityState = FBEntityState.Detached;

                    list.Add(order);
                }
                OrderSource.SaveList(list);
            };

            CommonFunction.AskDelete(string.Empty, action);
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FacilityOrder" /> class.
 /// </summary>
 /// <param name="directive">The order directive.</param>
 /// <param name="source">The source of this order.</param>
 /// <param name="toNotifyCmd">if set to <c>true</c> the facility will notify its Cmd of the outcome.</param>
 /// <param name="target">The target of this order. Default is null.</param>
 public FacilityOrder(FacilityDirective directive, OrderSource source, bool toNotifyCmd = false, IUnitAttackable target = null) {
     if (directive.EqualsAnyOf(DirectivesWithNullTarget)) {
         D.AssertNull(target, ToString());
     }
     Directive = directive;
     Source = source;
     ToNotifyCmd = toNotifyCmd;
     Target = target;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipMoveOrder" /> class.
 /// </summary>
 /// <param name="source">The source of the order.</param>
 /// <param name="target">The move target.</param>
 /// <param name="speed">The move speed.</param>
 /// <param name="isFleetwide">if set to <c>true</c> the move should be coordinated as a fleet.</param>
 /// <param name="targetStandoffDistance">When the ship arrives at the target, this is the distance
 /// from the target it should strive to achieve.</param>
 public ShipMoveOrder(OrderSource source, IShipNavigable target, Speed speed, bool isFleetwide, float targetStandoffDistance)
     : base(ShipDirective.Move, source, false, target) {
     Utility.ValidateNotNull(target);
     D.AssertNotDefault((int)speed);
     Utility.ValidateNotNegative(targetStandoffDistance);
     Speed = speed;
     IsFleetwide = isFleetwide;
     TargetStandoffDistance = targetStandoffDistance;
 }
示例#7
0
 private async Task OrdererThread(OrderSource source)
 {
     for (int i = 0; i < 10; ++i)
     {
         // submit random order
         m_orders.TryAdd(GenerateRandomOrder(source));
         // sleep for a random period
         await Task.Delay(m_rand.Next(1000, 4001));
     }
 }
示例#8
0
 private void OrdererThread(OrderSource source)
 {
     for (int i = 0; i < 10; ++i)
     {
         // submit random order
         m_orders.TryAdd(GenerateRandomOrder(source));
         // sleep for a random period
         Thread.Sleep(m_rand.Next(1000, 4001));
     }
 }
示例#9
0
        public static string GetOrderSource(OrderSource value, string entreeCollectorType)
        {
            switch (value)
            {
            case OrderSource.Entree:
                return(entreeCollectorType);

            default:
                throw new ArgumentException("Unkown OrderingSystem", "OrderingSystem");
            }
        }
示例#10
0
        public IActionResult Create(OrderSource orderSource)
        {
            if (ModelState.IsValid)
            {
                _orderSourceRepository.Add(orderSource);
                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.SourceTypes = _orderSourceTypeRepository.OrderSourceTypes.ToList();
            return(View(orderSource));
        }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipOrder" /> class.
 /// </summary>
 /// <param name="directive">The order directive.</param>
 /// <param name="source">The source of this order.</param>
 /// <param name="toNotifyCmd">if set to <c>true</c> the ship will notify its Command of the outcome.</param>
 /// <param name="target">The target of this order. No need for FormationStation. Default is null.</param>
 public ShipOrder(ShipDirective directive, OrderSource source, bool toNotifyCmd = false, IShipNavigable target = null) {
     if (directive == ShipDirective.Move) {
         D.AssertEqual(typeof(ShipMoveOrder), GetType());
         D.Assert(!toNotifyCmd);
     }
     if (directive.EqualsAnyOf(DirectivesWithNullTarget)) {
         D.AssertNull(target, ToString());
     }
     Directive = directive;
     Source = source;
     ToNotifyCmd = toNotifyCmd;
     Target = target;
 }
示例#12
0
        private OrderSource GetOrderSource()
        {
            OrderSource orderSource = OrderSource.WeiXin;

            if (SourceClient == RequestSourceClient.Other)
            {
                throw new MyException("获取客户端来源失败");
            }
            if (SourceClient == RequestSourceClient.AliPay)
            {
                orderSource = OrderSource.AliPay;
            }
            return(orderSource);
        }
示例#13
0
        void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectedRow(true))
            {
                return;
            }
            for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
            {
                OrderEntity order  = this.ADtGrid.SelectedItems[i] as OrderEntity;
                object      states = order.GetObjValue(EntityFieldName.CheckStates);
                if (states.ToString() != ((int)SMT.SaaS.FrameworkUI.CheckStates.UnSubmit).ToString())
                {
                    CommonFunction.NotifySelection(Utility.GetResourceStr("Msg_NoDeleteOrder"));
                    return;
                }
            }

            Action action = () =>
            {
                List <OrderEntity> list = new List <OrderEntity>();
                for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
                {
                    OrderEntity order = this.ADtGrid.SelectedItems[i] as OrderEntity;

                    order.FBEntityState = FBEntityState.Detached;

                    list.Add(order);
                }
                OrderSource.SaveList(list);
            };

            if (this.DefaultEntity.OrderType == typeof(T_FB_SUMSETTINGSMASTER))
            {
                for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
                {
                    OrderEntity order          = this.ADtGrid.SelectedItems[i] as OrderEntity;
                    string      ownerCompanyid = order.GetOwnerInfo().Company.Value.ToString();
                    var         q = from ent in SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts
                                    where ent.CompanyID == ownerCompanyid
                                    select ent;
                    if (q.FirstOrDefault() == null)
                    {
                        MessageBox.Show("你没有权限删除此单据!");
                        return;
                    }
                }
            }

            CommonFunction.AskDelete(string.Empty, action);
        }
示例#14
0
 public IEnumerable <OrderSource> GetOrderSources()
 {
     using (DataSet dsOrderSource = GetConfig(@"WHERE ConfigType='订单来源'"))
     {
         try
         {
             return(from DataRow row in dsOrderSource.Tables[0].Rows select OrderSource.FromDataRow(row));
         }
         catch
         {
             MessageBoxEx.Error(string.Format(@"在数据库中查询订单来源时遇到了问题导致失败!{0}方法名称:'ConfigManagement.GetOrderSources'", Environment.NewLine));
         }
         return(new OrderSource[] {});
     }
 }
        internal unsafe NativeOrderBase(DxOrder *o, string symbol) : base(symbol)
        {
            DxOrder order = *o;

            EventFlags   = order.event_flags;
            Index        = order.index;
            Time         = TimeConverter.ToUtcDateTime(order.time);
            TimeNanoPart = order.time_nanos;
            Sequence     = order.sequence;
            Price        = order.price;
            Size         = order.size;
            Count        = order.count;
            Scope        = order.scope;
            Side         = order.side;
            ExchangeCode = order.exchange_code;
            Source       = OrderSource.ValueOf(new string(order.source));
        }
示例#16
0
        public string GetReturnLink(OrderSource ordersource)
        {
            string result = "/wapshop/MemberOrderDetails.aspx?OrderId=" + this.OrderId;

            if (ordersource == OrderSource.WeiXin)
            {
                result = "/vshop/MemberOrderDetails.aspx?OrderId=" + this.OrderId;
            }
            if (ordersource == OrderSource.App)
            {
                result = "/AppShop/MemberOrderDetails.aspx?OrderId=" + this.OrderId;
            }
            if (ordersource == OrderSource.Alioh)
            {
                result = "/AliOH/MemberOrderDetails.aspx?OrderId=" + this.OrderId;
            }
            return(result);
        }
示例#17
0
        /// <inheritdoc />
        public void SetSource(params string[] sources)
        {
            if (connection == null)
            {
                throw new InvalidOperationException("Object is disposed");
            }

            if (subscription != null)
            {
                throw new InvalidOperationException("Sources is already configured for this subscription.");
            }

            subscription = connection.CreateSubscription(EventType.Order, this);
            subscription.SetSource(sources);
            foreach (var source in sources)
            {
                this.sources.Add(OrderSource.ValueOf(source));
            }
        }
示例#18
0
    private void LoadOrderSourceDetail()
    {
        txtOrderSourceName.Focus();
        if (IsEditMode())
        {
            lblPopupTitle.Text = "Edit Order Source";
            var objOrderSource = new OrderSource()
            {
                OrderSourceId = lblOrderSourceId.zToInt()
            }.SelectList <OrderSource>()[0];

            txtOrderSourceName.Text = objOrderSource.OrderSourceName;
            txtDescription.Text     = objOrderSource.Description;
        }
        else
        {
            lblPopupTitle.Text      = "New Order Source";
            txtOrderSourceName.Text = txtDescription.Text = string.Empty;
        }
    }
示例#19
0
        public static OrderSource Parse(this OrderSource value, string input)
        {
            switch (input)
            {
            case "B":
                return(OrderSource.Entree);

            case "C":
                return(OrderSource.CustomerService);

            case "K":
                return(OrderSource.DSR);

            case "T":
                return(OrderSource.KeithNet);

            default:
                return(OrderSource.Other);
            }
        }
示例#20
0
        private async void InitOrderSource()
        {
            UserContext.RfidReadProvider.OnDataReceived -= RfidReadProvider_OnDataReceived;
            lock (lockObj)
            {
                OrderEPC.Clear();
                CheckedEPC.Clear();
                OrderSource.Clear();
                exceptionEPC.Clear();
            }
            var orders = await Task.Run(() => UserContext.ApiHelper.GetCustomInOrders());

            int index = 1;

            foreach (var order in orders)
            {
                var orderVm = InOrderToOrderVM(order, index++);
                OrderEPC = OrderEPC.Concat(orderVm.OrderDetailRfids).ToList();
                OrderSource.Add(orderVm);
            }
            UserContext.RfidReadProvider.OnDataReceived += RfidReadProvider_OnDataReceived;
        }
示例#21
0
        private void GetOrders()
        {
            ShowProcess();
            QueryData       dataQueryList = cbbQueryList.SelectedItem as QueryData;
            QueryExpression qeTop         = new QueryExpression();

            qeTop.QueryType = this.OrderType;
            QueryExpression qe = qeTop;

            qe.RelatedType = QueryExpression.RelationType.And;

            if (dataQueryList != null)
            {
                qe.RelatedExpression = dataQueryList.QueryExpression;
                qe = qe.RelatedExpression;
            }
            if (qeTop.RelatedExpression != null)
            {
                qeTop = qeTop.RelatedExpression;
            }
            OrderSource.QueryFBEntities(qeTop);
        }
示例#22
0
        private void SnapshotEndFlagReceived <TB, TE>(TB buf)
            where TB : IDxEventBuf <TE>
            where TE : IDxOrder
        {
            var bufferEnumerator = buf.GetEnumerator();

            bufferEnumerator.MoveNext();
            var source = OrderSource.ValueOf(bufferEnumerator.Current.Source.Name.ToUpper());
            var symbol = buf.Symbol.ToUpper();

            // to set right flags before sending
            snapshots[CreateCompoundKey(buf.EventParams.SnapshotKey, symbol, source)].EventParams = buf.EventParams;

            receivedSnapshots[symbol].Add(source);

            if (!receivedSnapshots[symbol].IsSupersetOf(sources))
            {
                return;
            }

            var resultBuffer = new OrderEventBuffer(buf.EventType, buf.Symbol, buf.EventParams);

            foreach (var receivedSource in receivedSnapshots[symbol])
            {
                var symbolSource = symbol + receivedSource;
                foreach (var snapshotKey in symbolSourceToKey[symbolSource])
                {
                    foreach (var order in snapshots[snapshotKey])
                    {
                        resultBuffer.Add(order);
                    }

                    snapshots[snapshotKey].Clear();
                }
            }

            listener.OnSnapshot <IDxEventBuf <IDxOrder>, IDxOrder>(resultBuffer);
            orderViewStates[symbol] = OrderViewState.Ready;
        }
示例#23
0
        public static string ToShortString(this OrderSource value)
        {
            switch (value)
            {
            case OrderSource.Entree:
                return("B");

            case OrderSource.DSR:
                return("K");

            case OrderSource.CustomerService:
                return("C");

            case OrderSource.KeithNet:
                return("T");

            case OrderSource.Other:
                return(string.Empty);

            default:
                return(string.Empty);
            }
        }
示例#24
0
        private static PizzaOrder GenerateRandomOrder(OrderSource source)
        {
            // source
            var order = new PizzaOrder {
                Source = source
            };

            // delivery
            order.IsDelivery = m_rand.Next(0, 2) == 0 ? true : false;
            // phone number
            var areaCode         = m_rand.Next(0, 2) == 0 ? 425 : 206;
            var firstThreeDigits = m_rand.Next(100, 1000);
            var lastFourDigits   = m_rand.Next(0, 10000);

            order.PhoneNumber = String.Format("({0}) {1}-{2}", areaCode, firstThreeDigits, lastFourDigits.ToString("D4"));
            // size
            switch (m_rand.Next(0, 3))
            {
            case 0: order.Size = 11; break;

            case 1: order.Size = 13; break;

            case 2: order.Size = 17; break;
            }
            // toppings
            var availToppings = new List <PizzaToppings>(Enum.GetValues(typeof(PizzaToppings)).Cast <PizzaToppings>());

            order.Toppings = new PizzaToppings[m_rand.Next(1, 5)];
            for (int j = 0; j < order.Toppings.Length; ++j)
            {
                var toppingIndex = m_rand.Next(0, availToppings.Count);
                order.Toppings[j] = availToppings[toppingIndex];
                availToppings.RemoveAt(toppingIndex);
            }
            return(order);
        }
示例#25
0
        internal unsafe NativeOrderBase(DxOrder *o, string symbol) : base(symbol)
        {
            DxOrder order = *o;

            Source       = OrderSource.ValueOf(new string(order.source));
            EventFlags   = order.event_flags;
            Index        = order.index;
            Time         = TimeConverter.ToUtcDateTime(order.time);
            Sequence     = order.sequence;
            TimeNanoPart = order.time_nanos;
            Action       = order.action;
            ActionTime   = TimeConverter.ToUtcDateTime(order.action_time);
            OrderId      = order.order_id;
            AuxOrderId   = order.aux_order_id;
            Price        = order.price;
            Size         = order.size;
            Count        = order.count;
            TradeId      = order.trade_id;
            TradePrice   = order.trade_price;
            TradeSize    = order.trade_size;
            ExchangeCode = order.exchange_code;
            Side         = order.side;
            Scope        = order.scope;
        }
示例#26
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            OrderSource[] ordersoure = new OrderSource[1];
            ordersoure[0] = OrderSource.线路散拼订单;
            EyouSoft.Model.SystemStructure.MSysSettingInfo SettingInfoModel = new EyouSoft.Model.SystemStructure.MSysSettingInfo();
            SettingInfoModel = EyouSoft.BLL.SystemStructure.SystemInfo.CreateInstance().GetSysSetting();
            SettingInfoModel.OrderSmsChannelIndex = Convert.ToByte(Utils.GetFormValue(ddlSendChannel.UniqueID));
            SettingInfoModel.OrderSmsCompanyId    = Utils.GetFormValue(txt_CompanyId.UniqueID);
            SettingInfoModel.OrderSmsCompanyTypes = getArry();
            SettingInfoModel.OrderSmsIsEnable     = string.IsNullOrEmpty(Utils.GetFormValue(txt_CompanyId.UniqueID));
            SettingInfoModel.OrderSmsOrderTypes   = ordersoure;
            SettingInfoModel.OrderSmsTemplate     = Utils.GetFormValue("SendContent");
            SettingInfoModel.OrderSmsUserId       = Utils.GetFormValue(CompanyContact.UniqueID);
            int flag = EyouSoft.BLL.SystemStructure.SystemInfo.CreateInstance().SetSysSettings(SettingInfoModel);

            if (flag == 1)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('提交成功!');window.location.href='/LineManage/OrderMsgManage.aspx' </script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('提交失败!'); </script>");
            }
        }
示例#27
0
    private bool SaveData()
    {
        if (!IsValidate())
        {
            popupOrderSource.Show();
            return(false);
        }

        string Message = string.Empty;

        var objOrderSource = new OrderSource()
        {
            FirmId          = CU.GetFirmId(),
            OrderSourceName = txtOrderSourceName.Text.Trim().zFirstCharToUpper(),
            Description     = txtDescription.Text.Trim().zFirstCharToUpper()
        };

        if (IsEditMode())
        {
            objOrderSource.OrderSourceId = lblOrderSourceId.zToInt();
            objOrderSource.Update();

            Message = "Order Source Detail Change Sucessfully.";
        }
        else
        {
            objOrderSource.eStatus       = (int)eStatus.Active;
            objOrderSource.OrderSourceId = objOrderSource.Insert();

            Message = "New Order Source Added Sucessfully.";
        }

        CU.ZMessage(eMsgType.Success, string.Empty, Message);

        return(true);
    }
示例#28
0
        /// <summary>
        /// Plots the course to the target and notifies the requester of the outcome via the onCoursePlotSuccess or Failure events.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="speed">The speed.</param>
        /// <param name="orderSource">The source of this move order.</param>
        public void PlotCourse(INavigableTarget target, Speed speed, OrderSource orderSource) {
            D.Assert(speed != default(Speed) && speed != Speed.Stop, "{0} speed of {1} is illegal.".Inject(_ship.FullName, speed.GetValueName()));

            // NOTE: I know of no way to check whether a target is unreachable at this stage since many targets move, 
            // and most have a closeEnoughDistance that makes them reachable even when enclosed in a keepoutZone

            if (target is IFormationStation) {
                D.Assert(orderSource == OrderSource.ElementCaptain);
                DestinationInfo = new ShipDestinationInfo(target as IFormationStation);
            }
            else if (target is SectorModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as SectorModel, destinationOffset);
            }
            else if (target is StationaryLocation) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                var autoPilotSpeedReference = new Reference<float>(() => _autoPilotSpeedInUnitsPerHour);
                DestinationInfo = new ShipDestinationInfo((StationaryLocation)target, destinationOffset, autoPilotSpeedReference);
            }
            else if (target is FleetCmdModel) {
                D.Assert(orderSource == OrderSource.UnitCommand);
                var fleetTarget = target as FleetCmdModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(fleetTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(fleetTarget, _ship.Data.FormationStation.StationOffset, isEnemy);
            }
            else if (target is AUnitBaseCmdModel) {
                D.Assert(orderSource == OrderSource.UnitCommand);
                var baseTarget = target as AUnitBaseCmdModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(baseTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(baseTarget, _ship.Data.FormationStation.StationOffset, isEnemy);
            }
            else if (target is FacilityModel) {
                D.Assert(orderSource == OrderSource.ElementCaptain);
                var facilityTarget = target as FacilityModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(facilityTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(facilityTarget, isEnemy);
            }
            else if (target is ShipModel) {
                D.Assert(orderSource == OrderSource.ElementCaptain);
                var shipTarget = target as ShipModel;
                bool isEnemy = _ship.Owner.IsEnemyOf(shipTarget.Owner);
                DestinationInfo = new ShipDestinationInfo(shipTarget, isEnemy);
            }
            else if (target is APlanetoidModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as APlanetoidModel, destinationOffset);
            }
            else if (target is SystemModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as SystemModel, destinationOffset);
            }
            else if (target is StarModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as StarModel, destinationOffset);
            }
            else if (target is UniverseCenterModel) {
                Vector3 destinationOffset = orderSource == OrderSource.UnitCommand ? _ship.Data.FormationStation.StationOffset : Vector3.zero;
                DestinationInfo = new ShipDestinationInfo(target as UniverseCenterModel, destinationOffset);
            }
            else {
                D.Error("{0} of Type {1} not anticipated.", target.FullName, target.GetType().Name);
                return;
            }

            OrderSource = orderSource;
            AutoPilotSpeed = speed;
            RefreshNavigationalValues();
            OnCoursePlotSuccess();
        }
示例#29
0
    IEnumerator ExecuteRepairOrder_EnterState() {
        D.Log("{0}.ExecuteRepairOrder_EnterState called.", FullName);

        TryBreakOrbit();

        _moveSpeed = Speed.Full;
        _moveTarget = CurrentOrder.Target;
        _orderSource = OrderSource.ElementCaptain;  // UNCLEAR what if the fleet issued the fleet-wide repair order?
        Call(ShipState.Moving);
        yield return null;  // required immediately after Call() to avoid FSM bug
        // Return()s here
        if (_isDestinationUnreachable) {
            //TODO how to handle move errors?
            CurrentState = ShipState.Idling;
            yield break;
        }

        if (AssessWhetherToAssumeOrbit()) {
            Call(ShipState.AssumingOrbit);
            yield return null;  // required immediately after Call() to avoid FSM bug
            // Return()s here
        }

        Call(ShipState.Repairing);
        yield return null;  // required immediately after Call() to avoid FSM bug
        CurrentState = ShipState.Idling;
    }
示例#30
0
        public ParkOrder GetIORecordOrderChareFeeCount(string userID, OrderType orderType, DateTime dt, int releaseType, OrderSource orderSource, out string ErrorMessage)
        {
            ErrorMessage = "";
            try
            {
                string tableName = "ParkIORecord";
                string tarID     = "RecordID";
                if (orderType == OrderType.AreaTempCardPayment ||
                    orderType == OrderType.AreaValueCardPayment)
                {
                    tableName = "ParkTimeseries";
                    tarID     = "TimeseriesID";
                }
                string strSql = string.Format(@"SELECT ISNULL(sum(O.Amount),0) as Amount, ISNULL(sum(O.PayAmount),0) as PayAmount, ISNULL(sum(O.DiscountAmount),0) as DiscountAmount  FROM  ParkOrder  O
                                        left  outer JOIN {0} I on O.TagID = I.{1}
                                        WHERE O.OrderTime >@OrderTime and O.UserID =@UserID and O.OrderType=@OrderType
                and O.DataStatus != @DataStatus and I.ReleaseType =@ReleaseType
                and O.OrderSource =@OrderSource
                and Status= 1 ", tableName, tarID);

                using (DbOperator dbOperator = ConnectionManager.CreateReadConnection())
                {
                    dbOperator.ClearParameters();
                    dbOperator.AddParameter("UserID", userID);
                    dbOperator.AddParameter("OrderType", (int)orderType);
                    dbOperator.AddParameter("DataStatus", (int)DataStatus.Delete);
                    dbOperator.AddParameter("OrderTime", dt);
                    dbOperator.AddParameter("ReleaseType", releaseType);
                    dbOperator.AddParameter("OrderSource", orderSource);
                    using (DbDataReader reader = dbOperator.ExecuteReader(strSql.ToString()))
                    {
                        if (reader.Read())
                        {
                            return(DataReaderToModel <ParkOrder> .ToModel(reader));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
            }
            return(null);
        }
示例#31
0
        private async void DealRfid()
        {
            while (true)
            {
                _mainEvent.WaitOne();
                while (UnDealRfid.Count > 0)
                {
                    var rfid   = UnDealRfid.Dequeue();
                    var exists = false;
                    lock (lockObj)
                    {
                        exists = OrderEPC.Exists(_ => _.Equals(rfid));
                        if (exists)
                        {
                            OrderEPC.Remove(rfid);
                        }
                    }
                    //
                    if (exists)
                    {
                        //查找对应订单
                        await Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate()
                        {
                            var order = OrderSource.FirstOrDefault(_ => _.OrderDetailRfids.Exists(r => r.Equals(rfid)));
                            order.CheckCount++;
                            order.CheckInfo = "匹配中...";
                            order.CheckDetailRfids.Add(rfid);
                            CheckedEPC.Add(rfid);
                        }));
                    }
                    else
                    {
                        //获取接口 添加订单信息
                        var customId = await Task.Run(() => UserContext.ApiHelper.GetCustomIdBySN(rfid));

                        if (customId > 0)
                        {
                            await Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate()
                            {
                                var order = OrderSource.FirstOrDefault(_ => _.CustomId == customId);
                                if (order != null)
                                {
                                    order.CheckCount++;
                                    order.CheckInfo = "匹配中...";
                                    order.CheckDetailRfids.Add(rfid);
                                    CheckedEPC.Add(rfid);
                                }
                                else
                                {
                                    if (!exceptionEPC.Contains(rfid))
                                    {
                                        exceptionEPC.Add(rfid);
                                    }
                                }
                            }));
                        }
                        else
                        {
                            if (!exceptionEPC.Contains(rfid))
                            {
                                exceptionEPC.Add(rfid);
                            }
                        }
                    }
                }
                _mainEvent.Reset();
            }
        }
示例#32
0
 protected virtual void OnDisengaged() {
     KillPilotJobs();
     RefreshCourse(CourseRefreshMode.ClearCourse);
     _orderSource = OrderSource.None;
     TravelSpeed = Speed.None;
 }
示例#33
0
    private IMortalTarget _primaryTarget; // IMPROVE  take this previous target into account when PickPrimaryTarget()

    IEnumerator ExecuteAttackOrder_EnterState() {
        D.Log("{0}.ExecuteAttackOrder_EnterState() called.", FullName);

        TryBreakOrbit();

        _ordersTarget = CurrentOrder.Target as IMortalTarget;
        while (_ordersTarget.IsAlive) {
            // once picked, _primaryTarget cannot be null when _ordersTarget is alive
            bool inRange = PickPrimaryTarget(out _primaryTarget);
            if (inRange) {
                D.Assert(_primaryTarget != null);
                // while this inRange state exists, we wait for OnWeaponReady() to be called
            }
            else {
                _moveTarget = _primaryTarget;
                _moveSpeed = Speed.Full;
                _orderSource = OrderSource.ElementCaptain;
                Call(ShipState.Moving);
                yield return null;  // required immediately after Call() to avoid FSM bug
                if (_isDestinationUnreachable) {
                    __HandleDestinationUnreachable();
                    yield break;
                }
                _helm.AllStop();  // stop and shoot after completing move
            }
            yield return null;
        }
        CurrentState = ShipState.Idling;
    }
示例#34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FleetOrder" /> class.
 /// </summary>
 /// <param name="directive">The order directive.</param>
 /// <param name="source">The source of this order.</param>
 /// <param name="target">The target of this order. Default is null.</param>
 public FleetOrder(FleetDirective directive, OrderSource source, IFleetNavigable target = null) {
     D.AssertNotEqual(OrderSource.Captain, source);
     Directive = directive;
     Source = source;
     Target = target;
 }
示例#35
0
 /// <summary>
 /// Plots the course to the target and notifies the requester of the outcome via the onCoursePlotSuccess or Failure events.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="travelSpeed">The speed to travel at.</param>
 public virtual void PlotCourse(INavigableTarget target, Speed travelSpeed, OrderSource orderSource) {
     D.Assert(travelSpeed != default(Speed) && travelSpeed != Speed.Stop && travelSpeed != Speed.EmergencyStop, "{0} speed of {1} is illegal.".Inject(Name, travelSpeed.GetValueName()));
     Target = target;
     TravelSpeed = travelSpeed;
     _orderSource = orderSource;
 }
示例#36
0
        /// <summary>
        /// 构建商家充值充值订单
        /// </summary>
        /// <param name="seller">商家信息</param>
        /// <param name="chargeBalance">充值金额</param>
        /// <param name="systemId">系统编号</param>
        /// <param name="loginUserRecordId">登录用户编号</param>
        /// <returns></returns>
        private static ParkOrder GetSellerChargeOrder(ParkSeller seller, decimal chargeBalance, string operatorId, OrderSource orderSource, OrderPayWay payWay)
        {
            ParkOrder order = new ParkOrder();

            order.OrderNo     = IdGenerator.Instance.GetId().ToString();
            order.Status      = 1;
            order.OrderSource = orderSource;
            order.Amount      = chargeBalance;
            order.PayAmount   = chargeBalance;
            order.Remark      = "商家充值";
            order.OrderTime   = DateTime.Now;
            order.OrderType   = OrderType.BusinessRecharge;
            order.TagID       = seller.SellerID;
            order.PayWay      = payWay;
            order.UserID      = operatorId;
            order.OldMoney    = seller.Balance;
            order.NewMoney    = chargeBalance + seller.Balance;
            order.PayTime     = DateTime.Now;
            return(order);
        }
示例#37
0
        /// <summary>
        /// 生存商家充值订单
        /// </summary>
        /// <param name="seller">商家信息</param>
        /// <param name="chargeBalance">充值金额</param>
        /// <param name="operatorId">操作者编号</param>
        /// <param name="dbOperator"></param>
        /// <returns></returns>
        public static ParkOrder MarkSellerChargeOrder(ParkSeller seller, decimal chargeBalance, string operatorId, OrderSource orderSource, OrderPayWay payWay, DbOperator dbOperator)
        {
            ParkOrder  order   = GetSellerChargeOrder(seller, chargeBalance, operatorId, orderSource, payWay);
            IParkOrder factory = ParkOrderFactory.GetFactory();

            return(factory.Add(order, dbOperator));
        }
示例#38
0
        public static ParkOrder GetIORecordOrderChareFeeCount(string userID, OrderType OrderType, DateTime dt, int releaseType, OrderSource orderSource, out string ErrorMessage)
        {
            IParkOrder factory = ParkOrderFactory.GetFactory();

            return(factory.GetIORecordOrderChareFeeCount(userID, OrderType, dt, releaseType, orderSource, out ErrorMessage));
        }
示例#39
0
 public Order(OrderSource orderSource, string mallOrderId = null) : this()
 {
     OrderSource = orderSource;
 }
示例#40
0
        public IndexModule() : base(RouteDictionary.OrderBase)
        {
            this.RequiresAuthentication();

            Get[RouteDictionary.Add] = p =>
            {
                UserIdentity user = (UserIdentity)Context.CurrentUser;
                NavManager   mgr  = new NavManager();
                NavInfo      nav  = mgr.CreateNav(Request.Path, user.Menus);
                return(View[ViewDictionary.OrderAdd, nav]);
            };

            Get[RouteDictionary.OrderBizType] = p =>
            {
                ProductTypeSource pt    = new ProductTypeSource();
                List <BizType>    types = pt.CreateBizTypes();
                return(Response.AsJson(types));
            };

            Get[RouteDictionary.OrderProType] = p =>
            {
                string                typeName = SiteFun.cutechar(p.name);
                ProductTypeSource     pt       = new ProductTypeSource();
                List <ProductTypeDTO> types    = pt.CreateProTypes(typeName);
                return(Response.AsJson(types));
            };

            Post[RouteDictionary.Add] = p =>
            {
                string buyer               = Request.Form["buyer"].Value;     //甲方名称
                string proName             = Request.Form["proName"].Value;   //项目名称
                string orderdate           = Request.Form["orderdate"].Value; //下单日期
                string intodate            = Request.Form["intodate"].Value;  //进场日期
                string Province            = Request.Form["Province"].Value;  //省
                string City                = Request.Form["City"].Value;      //市
                string Area                = Request.Form["Area"].Value;      //区
                string address             = Request.Form["address"].Value;   //详细地址
                string selUsers            = Request.Form["selUsers"].Value;  //业务员
                string remarks1            = Request.Form["remarks1"].Value;  //付款方式
                string remarks2            = Request.Form["remarks2"].Value;  //备注
                string json                = Request.Form["data"].Value;
                List <OrderDetailDTO> list = JsonHelper.ParseFromJson(json, typeof(List <OrderDetailDTO>)) as List <OrderDetailDTO>;
                OrderInfoDTO          info = new OrderInfoDTO();
                info.Address = address;
                info.Area    = Area;
                info.Buyer   = buyer;
                info.City    = City;
                if (!String.IsNullOrEmpty(intodate))
                {
                    info.IntoDate = DateTime.Parse(intodate);
                }
                info.OrderDate  = DateTime.Parse(orderdate);
                info.ProName    = proName;
                info.Province   = Province;
                info.remarks1   = remarks1;
                info.remarks2   = remarks2;
                info.Use_UserID = Int32.Parse(selUsers);
                UserIdentity user = (UserIdentity)Context.CurrentUser;
                info.UserID = user.UserID;

                OrderSource   order = new OrderSource();
                ResponseModel model = new ResponseModel();
                try
                {
                    order.AddOrder(info, list);
                    model.StatusCode = HttpStatusCode.OK;
                }
                catch (Exception ex)
                {
                    model.StatusCode = HttpStatusCode.BadGateway;
                    model.Message    = ex.Message;
                }
                return(Response.AsJson(model));
            };

            Get[RouteDictionary.ListGet] = p =>
            {
                string per       = Request.Query["limit"];  //显示数量
                string offset    = Request.Query["offset"]; //当前记录条数
                int    pageSize  = 10;                      //每页显示条数
                int    offsetNum = 0;                       //当前记录偏移量
                if (!Int32.TryParse(offset, out offsetNum))
                {
                    offsetNum = 0;
                }
                if (!Int32.TryParse(per, out pageSize))
                {
                    pageSize = 10;
                }
                int    pageNum  = (offsetNum / pageSize) + 1;//当前页码
                string sqlWhere = "1=1";
                string buyer    = Request.Query["buyer"];
                if (!String.IsNullOrEmpty(buyer))
                {
                    sqlWhere += " and Buyer like '%" + SiteFun.cutechar(buyer) + "%'";
                }
                string pro = Request.Query["p"];
                if (!String.IsNullOrEmpty(pro))
                {
                    sqlWhere += " and ProName like '%" + SiteFun.cutechar(pro) + "%'";
                }
                string user = Request.Query["u"];
                int    uid  = 0;
                if (!String.IsNullOrEmpty(user) && Int32.TryParse(user, out uid) && uid > 0)
                {
                    sqlWhere += " and Use_UserID =" + uid;
                }

                OrderPageModel          model  = new OrderPageModel();
                DataService.BLL.v_Order BOrder = new DataService.BLL.v_Order();
                model.rows  = BOrder.GetModelsByPage(sqlWhere, "OrderID desc", pageSize * (pageNum - 1) + 1, pageSize * pageNum);
                model.total = BOrder.GetRecordCount(sqlWhere);
                return(Response.AsJson(model));
            };

            Get[RouteDictionary.List] = p =>
            {
                UserIdentity user = (UserIdentity)Context.CurrentUser;
                NavManager   mgr  = new NavManager();
                NavInfo      nav  = mgr.CreateNav(Request.Path, user.Menus);
                return(View[ViewDictionary.OrderList, nav]);
            };
        }
示例#41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseOrder" /> class.
 /// </summary>
 /// <param name="directive">The order directive.</param>
 /// <param name="source">The source of this order.</param>
 /// <param name="target">The target of this order. Default is null.</param>
 public BaseOrder(BaseDirective directive, OrderSource source, IUnitAttackable target = null) {
     D.AssertNotEqual(OrderSource.Captain, source);
     Directive = directive;
     Source = source;
     Target = target;
 }
示例#42
0
 void Moving_ExitState() {
     LogEvent();
     var mortalMoveTarget = _moveTarget as IMortalTarget;
     if (mortalMoveTarget != null) {
         mortalMoveTarget.onTargetDeathOneShot -= OnTargetDeath;
     }
     _moveTarget = null;
     _moveSpeed = Speed.None;
     _orderSource = OrderSource.None;
     _helm.DisengageAutoPilot();
     // the ship retains its existing speed and heading upon exit
 }