Exemplo n.º 1
0
        public JsonResult CreateFactory(Base_FactoryDTO factory)
        {
            if (ModelState.IsValid)
            {
                if (factory.Id != Guid.Empty)
                {
                    factory.ModifiedBy = this.User.Id;
                    this._IBase_FactoryService.Update(new List <Base_FactoryDTO> {
                        factory
                    });
                }
                else
                {
                    this._IBase_FactoryService.Create(factory);
                }

                //更新订单状态:在处理
                var order = this._IG_OrderService.GetByKey(factory.OrderId);
                order.Status    = Ingenious.Infrastructure.Enum.G_OrderStatusEnum.PreProcess;
                order.IsFactory = true;

                //如果是新创建订单,则进行订单分配。
                if (string.IsNullOrWhiteSpace(order.GoJiajuClerkCode))
                {
                    //绑定金融客服
                    //1、如果未填写推广码,则订单分配默认客服(艾博账号)
                    if (string.IsNullOrWhiteSpace(order.ReferenceCode))
                    {
                        var defaultAccount = System.Configuration.ConfigurationManager.AppSettings["default:account"].ToString();
                        order.GoJiajuClerkCode = defaultAccount;
                    }
                    else
                    {
                        //2、如果填写推广码,则分配到该金融专员所在机构的金融客服账号
                        var referenceUser = this._IG_UserService.GetGojiajuClerkByReferenceCode(order.ReferenceCode);
                        if (referenceUser != null)
                        {
                            order.GoJiajuClerkCode = referenceUser.G_UserDetail.Code;
                        }
                        else
                        {
                            return(Json(new MessageResult {
                                Status = false, Message = "金融专员账号验证失败"
                            }));
                        }
                    }
                }

                this._IG_OrderService.Update(new List <G_OrderDTO> {
                    order
                });
                this.Notify(order);
                return(Json(new MessageResult {
                    Status = true, Message = "保存成功"
                }));
            }
            return(Json(new MessageResult {
                Status = false, Message = ModelState.GetErrorMsg()
            }));
        }
Exemplo n.º 2
0
 public Base_FactoryDTO Create(Base_FactoryDTO dto)
 {
     return(base.F_Create <Base_FactoryDTO, Base_Factory>(dto
                                                          , _IBase_FactoryRepository
                                                          , dtoAction => { }));
 }