public void SaveOrderStep(Sender sender, OrderStep obj) { try { using (ObjectProxy op = new ObjectProxy(true)) { if (op.LoadOrderStep(obj) == 0) { obj.Created = DateTime.Now; obj.CreatedBy = sender.UserCode + "." + sender.UserName; op.InsertOrderStep(obj); } else { obj.Created = DateTime.Now; obj.CreatedBy = sender.UserCode + "." + sender.UserName; op.UpdateOrderStepByStepID(obj); } op.CommitTransaction(); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private OrderStep EntityGet() { OrderStep entity = new OrderStep(); entity.ID = HTDataID; return(entity); }
/// <summary> /// 修改 /// </summary> public override void EntityUpdate() { OrderStepRule rule = new OrderStepRule(); OrderStep entity = EntityGet(); rule.RUpdate(entity); }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { OrderStep entity = new OrderStep(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); txtCode.Text = entity.Code.ToString(); txtName.Text = entity.Name.ToString(); ColorConverter cc = new ColorConverter(); this.drpSelectColor.EditValue = cc.ConvertFromString(entity.ColorStr); drpNextStepID.EditValue = entity.NextStepID; drpSaleProduceID.EditValue = entity.SaleProcedureID; drpFormListID.EditValue = entity.FormListID; drpSaleProduceID2.EditValue = entity.SaleProcedureID2; drpFormListID2.EditValue = entity.FormListID2; chkDZFlag.Checked = SysConvert.ToBoolean(entity.DZFlag); chkInvoiceFlag.Checked = SysConvert.ToBoolean(entity.InvoiceFlag); chkRecAmountFlag.Checked = SysConvert.ToBoolean(entity.RecAmountFlag); chkFinishFlag.Checked = SysConvert.ToBoolean(entity.FinishFlag); chkCancelFlag.Checked = SysConvert.ToBoolean(entity.CancelFlag); chkCheckItemFlag.Checked = SysConvert.ToBoolean(entity.CheckItemFlag); chkCheckColorFlag.Checked = SysConvert.ToBoolean(entity.CheckColorFlag); txtRemark.Text = entity.Remark.ToString(); if (!findFlag) { } }
private void HandleOnOrderCreated(object sender, OrderEventArgs e) { var step1 = new OrderStep { OrderId = e.OrderId, OrderStepId = Guid.NewGuid(), StepName = EnumStepName.ProcessDeliveryAppointment, Status = EnumStatus.Pending }; var step2 = new OrderStep { OrderId = e.OrderId, OrderStepId = Guid.NewGuid(), StepName = EnumStepName.ContactDetails, Status = EnumStatus.Pending }; var step3 = new OrderStep { OrderId = e.OrderId, OrderStepId = Guid.NewGuid(), StepName = EnumStepName.ProcessPayment, Status = EnumStatus.Pending }; unitOfWork.OrderStepRepository.Insert(step1); unitOfWork.OrderStepRepository.Insert(step2); unitOfWork.OrderStepRepository.Insert(step3); unitOfWork.Save(); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { OrderStep MasterEntity = (OrderStep)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Enum_OrderStep WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private OrderStep EntityGet() { OrderStep entity = new OrderStep(); entity.ID = HTDataID; entity.SelectByID(); entity.Code = txtCode.Text.Trim(); entity.Name = txtName.Text.Trim(); ColorConverter cc = new ColorConverter(); entity.ColorStr = cc.ConvertToString(drpSelectColor.Color);//颜色 entity.NextStepID = SysConvert.ToInt32(drpNextStepID.EditValue); entity.SaleProcedureID = SysConvert.ToInt32(drpSaleProduceID.EditValue); entity.FormListID = SysConvert.ToInt32(drpFormListID.EditValue); entity.SaleProcedureID2 = SysConvert.ToInt32(drpSaleProduceID2.EditValue); entity.FormListID2 = SysConvert.ToInt32(drpFormListID2.EditValue); entity.DZFlag = SysConvert.ToInt32(chkDZFlag.Checked); entity.InvoiceFlag = SysConvert.ToInt32(chkInvoiceFlag.Checked); entity.RecAmountFlag = SysConvert.ToInt32(chkRecAmountFlag.Checked); entity.FinishFlag = SysConvert.ToInt32(chkFinishFlag.Checked); entity.CancelFlag = SysConvert.ToInt32(chkCancelFlag.Checked); entity.CheckItemFlag = SysConvert.ToInt32(chkCheckItemFlag.Checked); entity.CheckColorFlag = SysConvert.ToInt32(chkCheckColorFlag.Checked); entity.Remark = txtRemark.Text.Trim(); return(entity); }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { OrderStepRule rule = new OrderStepRule(); OrderStep entity = EntityGet(); rule.RAdd(entity); return(entity.ID); }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { OrderStep MasterEntity = (OrderStep)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE Enum_OrderStep SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" Code=" + SysString.ToDBString(MasterEntity.Code) + ","); UpdateBuilder.Append(" Name=" + SysString.ToDBString(MasterEntity.Name) + ","); UpdateBuilder.Append(" ColorStr=" + SysString.ToDBString(MasterEntity.ColorStr) + ","); UpdateBuilder.Append(" NextStepID=" + SysString.ToDBString(MasterEntity.NextStepID) + ","); UpdateBuilder.Append(" SaleProcedureID=" + SysString.ToDBString(MasterEntity.SaleProcedureID) + ","); UpdateBuilder.Append(" FormListID=" + SysString.ToDBString(MasterEntity.FormListID) + ","); UpdateBuilder.Append(" DZFlag=" + SysString.ToDBString(MasterEntity.DZFlag) + ","); UpdateBuilder.Append(" InvoiceFlag=" + SysString.ToDBString(MasterEntity.InvoiceFlag) + ","); UpdateBuilder.Append(" RecAmountFlag=" + SysString.ToDBString(MasterEntity.RecAmountFlag) + ","); UpdateBuilder.Append(" FinishFlag=" + SysString.ToDBString(MasterEntity.FinishFlag) + ","); UpdateBuilder.Append(" CancelFlag=" + SysString.ToDBString(MasterEntity.CancelFlag) + ","); UpdateBuilder.Append(" ShowFlag=" + SysString.ToDBString(MasterEntity.ShowFlag) + ","); UpdateBuilder.Append(" CheckItemFlag=" + SysString.ToDBString(MasterEntity.CheckItemFlag) + ","); UpdateBuilder.Append(" CheckColorFlag=" + SysString.ToDBString(MasterEntity.CheckColorFlag) + ","); UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ","); UpdateBuilder.Append(" SaleProcedureID2=" + SysString.ToDBString(MasterEntity.SaleProcedureID2) + ","); UpdateBuilder.Append(" FormListID2=" + SysString.ToDBString(MasterEntity.FormListID2)); UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
public void PreviousStep() { if (Step == OrderStep.ConfirmDelivery) { Step -= 1; } else { throw new InvalidOperationException(); } }
public void NextStep() { if (Step == OrderStep.AwaitingDelivery) { throw new InvalidOperationException(); } if (Step == OrderStep.EnterDeliveryAddress) { Confirmation.Address = AddressBar.Address; } Step += 1; }
public void NextStep() { if (Step == OrderStep.AwaitingDelivery) { throw new InvalidOperationException (); } if (Step == OrderStep.EnterDeliveryAddress) { Confirmation.Address = AddressBar.Address; } Step += 1; }
/// <summary> /// 检验字段值是否已存在 /// </summary> /// <param name="p_TableName">表名</param> /// <param name="p_FieldName">字段名</param> /// <param name="p_FieldValue">字段值</param> /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param> /// <param name="p_KeyValue">主键值</param> /// <param name="p_sqlTrans"></param> /// <returns></returns> private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans) { OrderStep entity = (OrderStep)p_BE; bool ret = false; string sql = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, OrderStep.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID); DataTable dt = p_sqlTrans.Fill(sql); if (dt.Rows.Count != 0) { ret = true; } return(ret); }
public void OrdersPrize() { try { using (ProxyBE p = new ProxyBE()) { Order order = p.Client.GetOrder(SenderUser, parm.OrderID); if (order.Status.ToUpper() == OrderStatus.E.ToString()) { SaveOrderArgs args = new SaveOrderArgs(); OrderStep step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.ordersprice.ToString()); OrderStepLog ot = new OrderStepLog(); ot.StepID = Guid.NewGuid(); ot.OrderID = order.OrderID; ot.StepNo = step.StepNo; ot.StepName = step.StepName; ot.Remark = string.Empty; args.OrderStepLog = ot; order.Status = OrderStatus.F.ToString(); order.StepNo = step.StepNo; args.Order = order; List <OrderProduct> list = new List <OrderProduct>(); string Cabinets = Request["Cabinets"]; JsonData sj = JsonMapper.ToObject(Cabinets); if (sj.Count > 0) { foreach (JsonData item in sj) { OrderProduct model = p.Client.GetOrderProduct(SenderUser, Guid.Parse(item["ProductID"].ToString())); model.SalePrice = Decimal.Parse(item["SalePrice"].ToString()); list.Add(model); } } args.OrderProducts = list; p.Client.SaveOrder(SenderUser, args); p.Client.UpdatePartnerOrder(args.Order); } } WriteSuccess(); } catch (Exception ex) { WriteError(ex.Message, ex); } }
private async void HandleStepChanged(OrderStep oldStep, OrderStep newStep) { if (oldStep == newStep) { return; } var fromController = _currentPresentedStep; var toController = default(UIViewController); if (newStep == OrderStep.EnterDeliveryAddress) { toController = new AddressBarView { ViewModel = this.ViewModel.AddressBar, }; } else if (newStep == OrderStep.ConfirmDelivery) { toController = new ConfirmationView() { ViewModel = this.ViewModel.Confirmation, }; } else if (newStep == OrderStep.AwaitingDelivery) { toController = new StatusView() { ViewModel = this.ViewModel.Status, }; } else { throw new InvalidOperationException(); } fromController.WillMoveToParentViewController(null); toController.View.Frame = new CGRect(0, TopLayoutGuide.Length, View.Bounds.Width, toController.View.Bounds.Height); AddChildViewController(toController); await this.TransitionAsync(fromController, toController, .6, UIViewAnimationOptions.TransitionCrossDissolve, () => { fromController.RemoveFromParentViewController(); fromController.Dispose(); toController.DidMoveToParentViewController(this); }); _currentPresentedStep = toController; }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); OrderStep entity = (OrderStep)p_BE; OrderStepCtl control = new OrderStepCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); OrderStep entity = (OrderStep)p_BE; OrderStepCtl control = new OrderStepCtl(sqlTrans); //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Enum_OrderStep,sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public void OrdersDesign() { try { using (ProxyBE p = new ProxyBE()) { string OrderID = Request["OrderIDs"]; if (string.IsNullOrEmpty(OrderID)) { throw new Exception("OrderID:参数无效"); } Order order = p.Client.GetOrder(SenderUser, Guid.Parse(OrderID)); if (order.Status.ToUpper() == OrderStatus.D.ToString()) { SaveOrderArgs args = new SaveOrderArgs(); OrderStep step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.ordersdesign.ToString()); OrderStepLog ot = new OrderStepLog(); ot.StepID = Guid.NewGuid(); ot.OrderID = order.OrderID; ot.StepNo = step.StepNo; ot.StepName = step.StepName; ot.Remark = string.Empty; args.OrderStepLog = ot; order.Status = OrderStatus.E.ToString(); order.StepNo = step.StepNo; args.Order = order; p.Client.SaveOrder(SenderUser, args); p.Client.UpdatePartnerOrder(args.Order); } WriteSuccess(); } } catch (Exception ex) { WriteError(ex.Message, ex); } }
public OrderStep GetOrderStepByPrivilegeID(Sender sender, Guid PrivilegeID) { try { using (ObjectProxy op = new ObjectProxy()) { OrderStep obj = new OrderStep(); obj.PrivilegeID = PrivilegeID; if (op.LoadOrderStepByPrivilegeID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public OrderStep GetOrderStepByStepCode(Sender sender, string StepCode) { try { using (ObjectProxy op = new ObjectProxy()) { OrderStep obj = new OrderStep(); obj.StepCode = StepCode; if (op.LoadOrderStepByStepCode(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Order SetNewStep(long orderId, int newStepId, int orderStatus, int actionId) { long.TryParse(_httpContextAccessor.HttpContext.User.Identity.Name, out var currentUserId); var updtOrder = _context.Orders.FirstOrDefault(x => x.ID == orderId); var oldStepID = updtOrder.CurrentStepID; /* current stepID si artık eski step olcak */ updtOrder.CurrentUserID = 0; /* yeni adımda sıfırlıyoruz, kullanıcı kendisi havuzdan çekcek */ updtOrder.OrderStatus = orderStatus; updtOrder.PrevStepID = oldStepID; /* şuanki step, artık prev step olacak */ updtOrder.CurrentStepID = newStepId; /* new step */ updtOrder.UpdateUser = currentUserId; updtOrder.UpdateDate = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")); /* Prev step için, o stepe özel kullancı alanını setleme için bu metoda gidioruz. */ SetOrderActionUserId(updtOrder, currentUserId, oldStepID); /* Tamamladığımız adımın bilgilerini yazıyoruz. Bir çeşit history */ OrderStep step = new OrderStep(); step.StepID = oldStepID; step.OrderID = orderId; step.UserID = currentUserId; step.OrderStatus = orderStatus; step.ActionID = actionId; step.ActionUserID = currentUserId; step.InsertUser = currentUserId; step.UpdateUser = currentUserId; step.UpdateDate = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));; step.InsertDate = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));; /* Db context insert/update edioruz */ _context.Orders.Update(updtOrder); _context.OrderSteps.Add(step); _context.SaveChanges(); return(new Order()); }
private async void HandleStepChanged(OrderStep oldStep, OrderStep newStep) { if (oldStep == newStep) { return; } var fromController = _currentPresentedStep; var toController = default(MvxViewController); // Construct the new controller // Set its DataContext // Add the controller as a child view Controller // Setup the controller's view frame // Transition between the two controllers using TransitionAsync // You need to call fromController.WillMoveToParentViewController(null) // toController.DidMoveToParentViewController(this) and fromController.RemoveFromParentViewController() // Update the _currentPresentedStep variable }
public void PreviousStep() { if (Step == OrderStep.ConfirmDelivery) { Step -= 1; } else { throw new InvalidOperationException (); } }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { OrderStep entity = (OrderStep)p_BE; }
public void InitialStep() { Step = OrderStep.EnterDeliveryAddress; }
/// <summary> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { OrderStep MasterEntity = (OrderStep)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO Enum_OrderStep("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("Code" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Code) + ","); MasterField.Append("Name" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Name) + ","); MasterField.Append("ColorStr" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ColorStr) + ","); MasterField.Append("NextStepID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.NextStepID) + ","); MasterField.Append("SaleProcedureID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SaleProcedureID) + ","); MasterField.Append("FormListID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FormListID) + ","); MasterField.Append("DZFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DZFlag) + ","); MasterField.Append("InvoiceFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.InvoiceFlag) + ","); MasterField.Append("RecAmountFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.RecAmountFlag) + ","); MasterField.Append("FinishFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FinishFlag) + ","); MasterField.Append("CancelFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CancelFlag) + ","); MasterField.Append("ShowFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ShowFlag) + ","); MasterField.Append("CheckItemFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CheckItemFlag) + ","); MasterField.Append("CheckColorFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CheckColorFlag) + ","); MasterField.Append("Remark" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ","); MasterField.Append("SaleProcedureID2" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SaleProcedureID2) + ","); MasterField.Append("FormListID2" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.FormListID2) + ")"); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }
/// <summary> /// Perform data sorting. /// </summary> /// <typeparam name="T">Return type.</typeparam> /// <param name="filter">.</param> /// <param name="data">Data for sort.</param> /// <param name="step">Step number.</param> /// <returns>Sorted query.</returns> public static IOrderedQueryable <T> GetOrderedQueryable <T>(this OrderFilter filter, IQueryable <T> data, OrderStep step) { if (filter == null) { throw new ArgumentNullException(nameof(filter)); } Type type = typeof(T); ParameterExpression arg = Expression.Parameter(type, "x" + step); Expression expr = arg; string[] spl = filter.Field.Split('.'); try { for (int i = 0; i < spl.Length; i++) { PropertyInfo pi = GetDeclaringProperty(type, spl[i]); expr = Expression.Property(expr, pi); type = pi.PropertyType; } } catch (Exception) { if (filter.Setting.SupressPropertyNotFoundException) { expr = Expression.Constant(0); type = typeof(int); } else { throw; } } Type delegateType = typeof(Func <,>).MakeGenericType(typeof(T), type); Expression lambda = Expression.Lambda(delegateType, expr, arg); MethodInfo m = step == OrderStep.First ? filter.Order == OrderFilterType.Asc ? QueryableOrderBy : QueryableOrderByDescending : filter.Order == OrderFilterType.Asc ? QueryableThenBy : QueryableThenByDescending; return((IOrderedQueryable <T>)m.MakeGenericMethod(typeof(T), type) .Invoke(null, new object[] { data, lambda })); }
private void Run(OrderStep step, EnumStatus status) { step.Status = status; unitOfWork.Save(); }
public void SavePartnerOrder() { try { using (ProxyBE p = new ProxyBE()) { #region Order var flag = "false"; PartnerOrder order = p.Client.GetPartnerOrder(SenderUser, parm.OrderID); if (parm.OrderType == "") { throw new Exception("请选择订单类型"); } if (order == null) { order = new PartnerOrder(); order.OrderID = parm.OrderID; } //修改订单保存 flag = Request["edit"]; if (flag == "true") { order.OrderNo = parm.OrderNo; } else { order.OrderNo = ""; } order.PartnerID = parm.PartnerID; order.CustomerID = parm.CustomerID; order.OutOrderNo = parm.OutOrderNo; order.Address = parm.Address; order.CustomerName = parm.CustomerName; order.AttachmentFile = HttpUtility.UrlDecode(parm.AttachmentFile, Encoding.UTF8); order.PartnerName = parm.PartnerName; order.SalesMan = parm.SalesMan; order.BookingDate = parm.BookingDate; order.Mobile = parm.Mobile; order.ShipDate = parm.ShipDate; order.OrderType = parm.OrderType; order.Remark = parm.Remark; order.Status = OrderStatus.A.ToString(); order.StepNo = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.partneraddorder.ToString()).StepNo; SavePartnerOrderArgs args = new SavePartnerOrderArgs(); args.Order = order; #endregion #region OrderProduct List <PartnerOrderProduct> list = new List <PartnerOrderProduct>(); string Cabinets = Request["Cabinets"]; JsonData sj = JsonMapper.ToObject(Cabinets); if (sj.Count > 0) { foreach (JsonData item in sj) { PartnerOrderProduct model = new PartnerOrderProduct(); model.OrderID = order.OrderID; model.ProductID = Guid.Parse(item["ProductID"].ToString()); model.ProductName = item["ProductName"].ToString(); model.ProductGroup = item["ProductGroup"].ToString(); model.Qty = Decimal.Parse(item["Qty"].ToString()); model.Price = Decimal.Parse(item["Price"].ToString()); model.Size = item["Size"].ToString(); model.MaterialStyle = item["MaterialStyle"].ToString(); model.Color = item["Color"].ToString(); model.MaterialCategory = item["MaterialCategory"].ToString(); model.Unit = item["Unit"].ToString(); model.Remark = item["Remark"].ToString(); model.SalePrice = 0; model.TotalAreal = 0; model.TotalLength = 0; model.ProductStatus = "N"; //Product.ProductCode = ((char)(64 + cabinet.Sequence)).ToString(); if (flag == "true") { model.Created = DateTime.Now; model.CreatedBy = SenderUser.UserCode + "." + SenderUser.UserName; } list.Add(model); } } args.PartnerOrderProducts = list; #endregion #region OrderLog /OrderTask if (flag != "true") { OrderStep step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.partneraddorder.ToString()); OrderStepLog ot = new OrderStepLog(); ot.StepID = Guid.NewGuid(); ot.OrderID = order.OrderID; ot.StepNo = step.StepNo; ot.StepName = step.StepName; ot.Remark = string.Empty; args.OrderStepLog = ot; } #endregion p.Client.SavePartnerOrder(SenderUser, args); } WriteSuccess(); } catch (Exception ex) { WriteError(ex.Message, ex); } }
public void SearchPartnerOrder() { try { using (ProxyBE p = new ProxyBE()) { SearchPartnerOrderArgs args = new SearchPartnerOrderArgs(); args.OrderBy = "Created desc"; args.RowNumberFrom = pagingParm.RowNumberFrom; args.RowNumberTo = pagingParm.RowNumberTo; if (!string.IsNullOrEmpty(Request["OrderIDs"])) { args.OrderIDs = new List <Guid>(); foreach (string id in Request["OrderIDs"].ToString().Split(',').ToList()) { args.OrderIDs.Add(new Guid(id)); } } if (!string.IsNullOrEmpty(parm.Status) && Request["Status"] != "全部") { args.Status = parm.Status.Split(',').ToList(); } if (!string.IsNullOrEmpty(Request["source"])) { args.Status = OrderStatus.B.ToString().Split(',').ToList(); } if (!string.IsNullOrEmpty(parm.OrderType) && Request["OrderType"] != "全部") { args.OrderTypes = parm.OrderType.Split(',').ToList(); } if (!string.IsNullOrEmpty(parm.OrderNo)) { args.OrderNo = parm.OrderNo; } if (!string.IsNullOrEmpty(parm.OutOrderNo)) { args.OutOrderNo = parm.OutOrderNo; } if (!string.IsNullOrEmpty(parm.Mobile)) { args.Mobile = parm.Mobile; } if (!string.IsNullOrEmpty(parm.Address)) { args.Address = parm.Address; } if (!string.IsNullOrEmpty(parm.CustomerName)) { args.CustomerName = parm.CustomerName; } if (!string.IsNullOrEmpty(Request["BookingDateFrom"])) { args.BookingDateFrom = parm.BookingDateFrom; } if (!string.IsNullOrEmpty(Request["BookingDateTo"])) { args.BookingDateTo = parm.BookingDateTo.AddDays(1); } if (!string.IsNullOrEmpty(Request["ShipDateFrom"])) { args.ShipDateFrom = parm.ShipDateFrom; } if (!string.IsNullOrEmpty(Request["ShipDateTo"])) { args.ShipDateTo = parm.ShipDateTo.AddDays(1); } if (!string.IsNullOrEmpty(Request["StepNo"])) { args.StepNo = parm.StepNo.ToString(); } if (!string.IsNullOrEmpty(Request["Review"]) && !string.IsNullOrEmpty(Request["pid"])) { OrderStep model = p.Client.GetOrderStepByPrivilegeID(SenderUser, new Guid(Request["pid"])); args.StepNo = (model == null?"-1": (model.StepNo - 1).ToString()); } if (CurrentUser.UserType == (int)UserType.D) { args.PartnerID = CurrentUser.PartnerID; } SearchResult sr = p.Client.SearchPartnerOrder(SenderUser, args); Response.Write(JSONHelper.Dataset2Json(sr.DataSet)); } } catch (Exception ex) { PLogger.LogError(ex); Response.Write(ex.Message); } }
public void OrdersConfirm() { try { using (ProxyBE p = new ProxyBE()) { string remark = Request["Remark"]; if (string.IsNullOrEmpty(Request["Remark"])) { throw new Exception("Remark:参数无效"); } string OrderID = Request["OrderID"]; if (string.IsNullOrEmpty(Request["OrderID"])) { throw new Exception("OrderID:参数无效"); } string ConfirmState = Request["ConfirmState"]; PartnerOrder order = p.Client.GetPartnerOrder(SenderUser, Guid.Parse(OrderID)); if (order.Status.ToUpper() == OrderStatus.A.ToString()) { SavePartnerOrderArgs args = new SavePartnerOrderArgs(); if (ConfirmState == "true")//审核通过 { OrderStep step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.partnerordersconfirm.ToString()); OrderStepLog ot = new OrderStepLog(); ot.StepID = Guid.NewGuid(); ot.OrderID = order.OrderID; ot.StepNo = step.StepNo; ot.StepName = step.StepName; ot.Remark = Request["Remark"]; args.OrderStepLog = ot; order.Status = OrderStatus.B.ToString(); order.StepNo = step.StepNo; args.Order = order; } else//审核不通过 { OrderStep step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.partnerordersconfirm.ToString()); OrderStepLog ot = new OrderStepLog(); ot.StepID = Guid.NewGuid(); ot.OrderID = order.OrderID; ot.StepNo = step.StepNo; ot.StepName = step.StepName; ot.Remark = Request["Remark"]; args.OrderStepLog = ot; order.Status = OrderStatus.Z.ToString(); order.StepNo = 0; args.Order = order; } p.Client.SavePartnerOrder(SenderUser, args); } WriteSuccess(); } } catch (Exception ex) { WriteError(ex.Message, ex); } }
public void ImportPartnerOrder() { try { string OrderID = Request["OrderID"]; if (string.IsNullOrEmpty(OrderID)) { throw new Exception("请选择订单类型"); } if (CurrentUser.UserType == (int)UserType.D) { throw new Exception("非法操作"); } using (ProxyBE p = new ProxyBE()) { SaveOrderArgs args = new SaveOrderArgs(); PartnerOrder parm = p.Client.GetPartnerOrder(SenderUser, new Guid(OrderID)); //订单数据 Order order = new Order(); order.OrderID = parm.OrderID; //order.OrderNo = parm.OrderNo; order.PartnerID = parm.PartnerID; order.CustomerID = parm.CustomerID; order.OutOrderNo = parm.OrderNo; order.Address = parm.Address; order.CustomerName = parm.CustomerName; order.AttachmentFile = parm.AttachmentFile; order.PartnerName = parm.PartnerName; order.SalesMan = parm.SalesMan; order.BookingDate = parm.BookingDate; order.Mobile = parm.Mobile; order.ShipDate = parm.ShipDate; order.OrderType = parm.OrderType; order.Remark = parm.Remark; order.Status = OrderStatus.C.ToString(); order.StepNo = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.importorder.ToString()).StepNo; order.Created = DateTime.Now; order.CreatedBy = SenderUser.UserCode + "." + SenderUser.UserName; args.Order = order; //产品数据 List <PartnerOrderProduct> list = p.Client.GetPartnerOrderProductByOrderID(SenderUser, new Guid(OrderID)); List <OrderProduct> Products = new List <OrderProduct>(); foreach (PartnerOrderProduct item in list) { OrderProduct Product = new OrderProduct(); Product.OrderID = order.OrderID; Product.ProductID = item.ProductID; Product.ProductName = item.ProductName; Product.ProductGroup = item.ProductGroup; Product.Qty = item.Qty; Product.Price = item.Price; Product.Size = item.Size; Product.MaterialStyle = item.MaterialStyle; Product.Color = item.Color; Product.MaterialCategory = item.MaterialCategory; Product.Unit = item.Unit; Product.Remark = item.Remark; Product.SalePrice = item.SalePrice; Product.TotalAreal = item.TotalAreal; Product.TotalLength = item.TotalLength; Product.Created = DateTime.Now; Product.CreatedBy = SenderUser.UserCode + "." + SenderUser.UserName; Products.Add(Product); } args.OrderProducts = Products; OrderStep step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.importorder.ToString()); OrderStepLog ot = new OrderStepLog(); ot.StepID = Guid.NewGuid(); ot.OrderID = order.OrderID; ot.StepNo = step.StepNo; ot.StepName = step.StepName; ot.Remark = string.Empty; args.OrderStepLog = ot; p.Client.SaveOrder(SenderUser, args); Order model = new Order() { Status = args.Order.Status, StepNo = args.Order.StepNo, OrderID = args.Order.OrderID, }; p.Client.UpdatePartnerOrder(model); } WriteSuccess(); } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }