Ejemplo n.º 1
0
        public PrintWindow(OrderFlow order)
        {
            InitializeComponent();
            this.DataContext = this;

            _order = order;

            if(order.CommitTime.HasValue)
            {
                DateTime dt = order.CommitTime.Value;
                string str;
                if (dt.Hour >= 1 && dt.Hour < 7)
                {
                    str = "凌晨";
                }
                else if (dt.Hour >= 7 && dt.Hour < 13)
                {
                    str = "上午";
                }
                else if (dt.Hour >= 13 && dt.Hour < 19)
                {
                    str = "下午";
                }
                else
                {
                    str = "晚上";
                }
                ExpiredTime = string.Format("{0:yyyy年MM月dd日} {1}{0:hh}时{0:mm}分", dt,str);
            }
            pd = new PrintDocument();
            pd.PrintPage += new EventHandler<PrintPageEventArgs>(pd_PrintPage);
            pd.EndPrint += new EventHandler<EndPrintEventArgs>(pd_EndPrint);
        }
        public void CancelApprovalOrder(OrderFlow order)
        {
            order.OrderStateEnum = OrderState_Enum.AwaitingApproval;

            order.ApprovalTime = null;
            order.ApprovalUser = null;

            OrderFlowLog(order, Operate_Enum.Order_Approval_Cancel);
        }
 public double CalculateArea(OrderFlow order)
 {
     double area = 0;
     if (order.OldHouse == null || order.OldHouse.Count == 0)
     {
         throw new ArgumentNullException("没有旧房信息!");
     }
     foreach (OldHouse house in order.OldHouse)
     {
         if (!house.PropertyArea.HasValue)
         {
             throw new ArgumentNullException("没有旧房面积!");
         }
         area += house.PropertyArea.Value;
     }
     return area;
 }
        public void CommitOrder(OrderFlow order)
        {
            foreach (Apartment apt in order.Apartment)
            {
                if (apt.SellStateEnum != SellState_Enum.Selected)
                {
                    if (apt.SellStateEnum != SellState_Enum.Locked)
                    {
                        throw new ArgumentException("错误的房源状态!");
                    }
                    ApartmentLog(apt, Operate_Enum.Apartment_Free);
                    apt.SellStateEnum = SellState_Enum.Free;
                    apt.OrderFlow = null;
                }
            }

            order.OrderStateEnum = OrderState_Enum.AwaitingApproval;

            order.UpdateCommiter();

            OrderFlowLog(order, Operate_Enum.Order_Commit);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new Error Window given an error message.
 /// Current stack trace will be displayed if app is running under debug or on the local machine.
 /// </summary>
 /// <param name="message">The message to display.</param>
 public static void CreateNew(OrderFlow order, EntitySet<Residential> Residentials)
 {
     PrintWindow PrintDlg = new PrintWindow(order);
     PrintDlg.Show();
     //throw (new Exception("Print dialog initial is rquired"));
 }
 private void LoadCallback(OrderFlow order, Action<IEnumerable<OrderFlow>, object> docallback)
 {
     if (order.Apartment.Count == 0 || order.PreprocessOrder == null)
     {
         _context.LoadOrderFlow(
             _context.GetOrderFlowSetByIdQuery(order.OrderFlowId),
             new Action<IEnumerable<OrderFlow>, object>(docallback),
             order);
     }
     else
     {
         docallback(null, order);
     }
 }
        private void DeleteCmd(OrderFlow order)
        {
            MessageBoxResult result = MessageBox.Show("确定删除订单?", "提示", MessageBoxButton.OKCancel);

            if (result != MessageBoxResult.OK)
            {
                return;
            }
            LoadCallback(order, new Action<IEnumerable<OrderFlow>, object>(DeleteCallback));
        }
 private void PrintCmd(OrderFlow order)
 {
     LoadCallback(order, new Action<IEnumerable<OrderFlow>, object>(PrintCallback));
 }
        public void DeleteOrder(OrderFlow order)
        {
            OrderFlowLog(order, Operate_Enum.Order_Delete);

            foreach (Apartment apt in order.Apartment)
            {
                ApartmentLog(apt, Operate_Enum.Apartment_Free);

                apt.SellStateEnum = SellState_Enum.Free;
                apt.OrderFlow = null;
            }

            foreach (PreprocessOrder pre in order.PreprocessOrder)
            {
                pre.IsProcessed = false;
                pre.OrderFlow = null;
            }

            this.OrderFlows.Remove(order);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the OrderFlowSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrderFlowSet(OrderFlow orderFlow)
 {
     base.AddObject("OrderFlowSet", orderFlow);
 }
        public void StartApprovalOrder(OrderFlow order)
        {
            if (!string.IsNullOrEmpty(order.ApprovalUser))
            {
                throw new ArgumentException("另一个用户已经开始审批!");
            }

            order.OrderStateEnum = OrderState_Enum.Approvaling;

            order.UpdateApprovalor();

            OrderFlowLog(order, Operate_Enum.Order_Approval_Start);
        }
 public void SelectSolution(OrderFlow order,Solution solu)
 {
     foreach (Apartment apt in order.Apartment)
     {
         apt.SellStateEnum = SellState_Enum.Locked;
     }
     order.Solution = solu.Name;
 }
        public void OrderFlowLog(OrderFlow order, Operate_Enum operate)
        {
            //串行化
            NitpickHouse.Serial.OrderFlow sorder = NitpickHouse.Serial.OrderFlow.Create(order);
            string desc = NitpickHouse.Serial.JsonUtil.Serialize<NitpickHouse.Serial.OrderFlow>(sorder);

            CreateLog(OperateType_Enum.OperateOrder, operate, order.OrderFlowId, desc);
        }
 public void LockApartment(OrderFlow order,Apartment apt)
 {
     apt.SellStateEnum = SellState_Enum.Selected;
     apt.OrderFlow = order;
     ApartmentLog(apt, Operate_Enum.Apartment_Lock);
 }
        public void FinishApprovalOrder(OrderFlow order)
        {
            foreach (Apartment apt in order.Apartment)
            {
                apt.SellStateEnum = SellState_Enum.Sold;
            }

            order.OrderStateEnum = OrderState_Enum.Finish;

            order.UpdateApprovalor();

            OrderFlowLog(order, Operate_Enum.Order_Approval_Finish);
        }
 /// <summary>
 /// Create a new OrderFlow object.
 /// </summary>
 /// <param name="orderFlowId">Initial value of the OrderFlowId property.</param>
 /// <param name="createUser">Initial value of the CreateUser property.</param>
 /// <param name="createTime">Initial value of the CreateTime property.</param>
 /// <param name="timeStamp">Initial value of the TimeStamp property.</param>
 /// <param name="errorOrderType">Initial value of the ErrorOrderType property.</param>
 public static OrderFlow CreateOrderFlow(global::System.Int32 orderFlowId, global::System.String createUser, global::System.DateTime createTime, global::System.Byte[] timeStamp, global::System.Int32 errorOrderType)
 {
     OrderFlow orderFlow = new OrderFlow();
     orderFlow.OrderFlowId = orderFlowId;
     orderFlow.CreateUser = createUser;
     orderFlow.CreateTime = createTime;
     orderFlow.TimeStamp = timeStamp;
     orderFlow.ErrorOrderType = errorOrderType;
     return orderFlow;
 }
 public void UnlockApartment(OrderFlow order, Apartment apt)
 {
     ApartmentLog(apt, Operate_Enum.Apartment_Free);
     apt.OrderFlow = null;
     apt.SellStateEnum = SellState_Enum.Free;
 }
        private void DeleteCmd(OrderFlow order)
        {
            MessageBoxResult result = MessageBox.Show("确定删除订单?", "提示", MessageBoxButton.OKCancel);

            if (result != MessageBoxResult.OK)
            {
                return;
            }

            if (order.Apartment.Count == 0 || order.PreprocessOrder == null)
            {
                _context.LoadOrderFlow(
                    _context.GetOrderFlowSetByIdQuery(order.OrderFlowId),
                    new Action<IEnumerable<OrderFlow>, object>(DeleteCallback),
                    order);
            }
            else
            {
                DeleteCallback(null, order);
            }
        }
        private OrderFlow InnerCreateOrder()
        {
            OrderFlow order = new OrderFlow();

            order.OrderStateEnum = OrderState_Enum.Processing;
            order.ErrorOrderType = (int)ErrorOrderType_Enum.None;

            return order;
        }