/// <summary> /// 打开某页 /// </summary> /// <param name="pageNo"></param> private void OpenPageTo(int pageNo, bool Manual = true) { //先判断是否能去这个页 if (pageNo < 1 || pageNo > AllPage) { return; } if (CurrentPage == pageNo && Manual) { return; } //为未保存数据而忽略当前操作 if (Manual && !IgnoreOperateForSave()) { return; } //设定按钮 krptCurrentPage.Enabled = AllPage > 1; krpbBeginPage.Enabled = pageNo > 1; krpbEngPage.Enabled = pageNo < AllPage; krpbNextPage.Enabled = pageNo < AllPage; krpbPrewPage.Enabled = pageNo > 1; krpbClickToPage.Enabled = AllPage > 1; CurrentPage = pageNo; krptCurrentPage.Text = CurrentPage.ToString(); Log log = logList[pageNo - 1]; CurrentOrder = null; CurrentOrderDetails = null; if (log.OperateName.StartsWith("Order#Add")) { ToServerServiceNewOrder newOrder = log.Model.DeserializeObject <ToServerServiceNewOrder>(); CurrentOrder = newOrder.Order.DeserializeObject <Order>(); CurrentOrderDetails = newOrder.OrderDetails.DeserializeObject <List <OrderDetail> >(); CurrentOrderPays = newOrder.OrderPays.DeserializeObject <List <OrderPay> >(); } else if (log.OperateName.StartsWith("Order#Edit")) { ToServerServiceEditOrder editOrder = log.Model.DeserializeObject <ToServerServiceEditOrder>(); CurrentOrder = editOrder.Order.DeserializeObject <Order>(); CurrentOrderPays = editOrder.OrderPays.DeserializeObject <List <OrderPay> >(); if (null != CurrentOrder.tb_orderdetail) { CurrentOrderDetails = CurrentOrder.tb_orderdetail.ToList(); } else { CurrentOrderDetails = new List <OrderDetail>(); } } else if (log.OperateName.StartsWith("Order#Replace")) { ToServerServiceReplaceOrder replaceOrder = log.Model.DeserializeObject <ToServerServiceReplaceOrder>(); // 因为记录时只记录老的订单编号, 也就是newOrder.OrderId, 考虑到OperateId是老的订单,(毕竟有两个有客户的客座修改可能性也比较小------以前这么认为的, 但是两个客座都在用时替换就出问题, 所以增加了) Order oldOrder = replaceOrder.OldOrder.DeserializeObject <Order>(); Order newOrder = replaceOrder.NewOrder.DeserializeObject <Order>(); if (log.OperateId == oldOrder.OrderId) { CurrentOrder = oldOrder; } else if (log.OperateId == newOrder.OrderId) { CurrentOrder = newOrder; } else { CurrentOrder = new Order(); } if (null != CurrentOrder.tb_orderdetail) { CurrentOrderDetails = CurrentOrder.tb_orderdetail.ToList(); } else { CurrentOrderDetails = new List <OrderDetail>(); } if (null != CurrentOrder.tb_orderpay) { CurrentOrderPays = CurrentOrder.tb_orderpay.ToList(); } else { CurrentOrderPays = new List <OrderPay>(); } } else if (log.OperateName.StartsWith("OrderDetail#Save")) { ToServerServiceSaveOrderDetail saveOrderDetail = log.Model.DeserializeObject <ToServerServiceSaveOrderDetail>(); CurrentOrder = saveOrderDetail.Order.DeserializeObject <Order>(); CurrentOrderDetails = saveOrderDetail.OrderDetailsAdd.DeserializeObject <List <OrderDetail> >(); CurrentOrderPays = saveOrderDetail.OrderPaysAdd.DeserializeObject <List <OrderPay> >(); } else if (log.OperateName.StartsWith("OrderDetail#Delete")) { ToServerServiceDelOrderDetail delOrderDetail = log.Model.DeserializeObject <ToServerServiceDelOrderDetail>(); CurrentOrder = delOrderDetail.Order.DeserializeObject <Order>(); CurrentOrderDetails = delOrderDetail.OrderDetails.DeserializeObject <List <OrderDetail> >(); CurrentOrderPays = new List <OrderPay>(); } else { CurrentOrder = new Order(); CurrentOrderDetails = new List <OrderDetail>(); CurrentOrderPays = new List <OrderPay>(); } if (CurrentOrder != null) { OpenOrderIndex(log, CurrentOrder, CurrentOrderDetails, CurrentOrderPays); } }
/// <summary> /// 新建订单 /// </summary> /// <param name="toServer"></param> /// <returns></returns> public ToClientServiceNewOrder ServiceAddOrder(ToServerServiceNewOrder toServer) { return(ServiceOperate.GetServiceOperate().ServiceAddOrder(toServer)); }