/// <summary>
 /// 删除指定的管理员账户
 /// </summary>
 /// <param name="mgrAcc">要删除的管理员账户</param>
 public void DeleteManagerAccount(ClientAccount mgrAcc)
 {
     MessageBoxResult mbResult = MessageBox.Show("确定要删除该管理员账户吗?", "删除确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
     if (mbResult == MessageBoxResult.Yes)
     {
         ErrType err = _businessService.DeleteClientAccount(mgrAcc.AccInfo.AccountName, _loginID);
         if (err == GeneralErr.Success)
             RemoveClientAccount(ManagerAccountList, mgrAcc);
         else
             MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
        /// <summary>
        /// 激活金生金账户
        /// </summary>
        public void ActivateJgj(ClientAccount client)
        {
            //验证是否已激活金生金账户
            int exist = _bzjService.JgjIsUserExist(1, client.AccInfo.CertificateNumber);
            if (exist == 0)
            {
                string tip;//提示信息
                //随机生成的密码
                string pwd = new Random().Next(100000, 999999).ToString();
                string returnResult = _bzjService.JgjUserRegister((int)client.AccInfo.CeritificateEnum, client.AccInfo.CertificateNumber, pwd,
                    client.AccInfo.Dealer, (int)client.AccInfo.ClientType, client.AccInfo.UserName, client.AccInfo.CellPhoneNumber);

                if (returnResult == "1000")
                {
                    tip = "用户已经存在";
                }
                else if (returnResult == "2000")
                {
                    tip = "系统错误";
                }
                else
                {
                    tip = "金生金账户激活成功";
                    BzjUserBindEntity bzjentity = new BzjUserBindEntity();
                    bzjentity.UserId = client.AccInfo.UserID;
                    bzjentity.JUserId = returnResult;
                    ErrType errJgs = _bzjService.CreateAdminGssUser(bzjentity, _loginID, client.AccInfo.UserID, (int)_accType);
                    if (errJgs.Err != ERR.SUCCESS)
                    {
                        MessageBox.Show(errJgs.ErrMsg, errJgs.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                }
                MessageBox.Show(tip, "提示信息", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        /// <summary>
        /// 显示客户的资金信息
        /// </summary>
        /// <param name="clientAccount">选中的客户账户</param>
        public void ShowClientFundsInfo(ClientAccount clientAccount)
        {
            string clientAccName = clientAccount.AccInfo.AccountName;
            FundsInformation clone = (FundsInformation)clientAccount.FundsInfo.Clone();
            ClientFundsInfoWindow fundsInfoWnd = new ClientFundsInfoWindow(AccountAuthority.IsCanAlterDJ)
            {
                Owner = Application.Current.MainWindow,
                DataContext = clone,
            };

            if (fundsInfoWnd.ShowDialog() == true)
            {
                ErrType err = _businessService.ModifyClientFundsInfo(_loginID, _accType, clientAccName, clone);
                if (err == GeneralErr.Success)
                {
                    clientAccount.FundsInfo.Sync(clone);
                }
                else
                {
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
        }
 /// <summary>
 /// 将一个客户账户从客户列表中移除
 /// </summary>
 /// <param name="clientAcc">要删除的客户账户</param>
 private void RemoveClientAccount(ObservableCollection<ClientAccount> list, ClientAccount clientAcc)
 {
     if (_dpObj.CheckAccess())
         list.Remove(clientAcc);
     else
     {
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new ClientAccountDelegate(item => list.Remove(item)),
             clientAcc);
     }
 }
 /// <summary>
 /// 同步客户资料数据
 /// </summary>
 /// <param name="clone">同步数据源</param>
 public void Sync( ClientAccount clone ) {
     AccInfo.Sync( clone.AccInfo );
     TransactionSettings.Sync( clone.TransactionSettings );
 }
 /// <summary>
 /// 验证市价单定单信息的有效性
 /// </summary>
 /// <param name="newInfo">新定单的详细信息</param>
 /// <param name="selectedProduct">选中下单的商品</param>
 /// <param name="operateClient">该市价单定单对应的某个用户</param>
 /// <returns>验证结果</returns>
 private ValidationResult MarketOrderInfoValidation(NewMarketOrderInfo newInfo, ProductInformation selectedProduct, ClientAccount operateClient)
 {
     return OrderInfoBaseValidation(newInfo, selectedProduct, operateClient);
 }
        /// <summary>
        /// 验证定单基本信息的有效性
        /// </summary>
        /// <param name="newInfo">定单基本信息</param>
        /// <param name="selectedProduct">选中下单的商品</param>
        /// <param name="operateClient">该市价单定单对应的某个用户</param>
        /// <returns>ValidationResult</returns>
        private ValidationResult OrderInfoBaseValidation(NewOrderInfoBase newInfo, ProductInformation selectedProduct, ClientAccount operateClient)
        {
            //定单价验证
            if (newInfo.RealTimePrice > selectedProduct.AllowMaxPrice)
                return new ValidationResult(false, "允许的最大交易价格为:" + selectedProduct.AllowMaxPrice);
            if (newInfo.RealTimePrice < selectedProduct.AllowMinPrice)
                return new ValidationResult(false, "允许的最小交易价格为:" + selectedProduct.AllowMinPrice);

            //定单数量的验证
            if (newInfo.Count > operateClient.TransactionSettings.MaxTrade)
                return new ValidationResult(false, "允许的最大交易手数为:" + operateClient.TransactionSettings.MaxTrade);
            if (newInfo.Count < operateClient.TransactionSettings.MinTrade)
                return new ValidationResult(false, "允许的最小交易手数为:" + operateClient.TransactionSettings.MinTrade);
            ValidationResult result = ValidationHelper.OrderCountValidation(newInfo.Count, operateClient.TransactionSettings.OrderUnit);
            if (!result.IsValid)
                return result;

            //止损和止盈价验证
            if (newInfo.StopLossPrice != 0)
            {
                if (newInfo.StopLossPrice < 0)
                    return new ValidationResult(false, "止损价不能小于0");

                //进行止损价的验证
                result = ValidationHelper.StopLossPriceValidation(newInfo.StopLossPrice, selectedProduct.RealTimePrice, (int)newInfo.OrderType, selectedProduct.SpreadBaseValue, selectedProduct.LossProfitSpread);
                if (!result.IsValid)
                    return result;
            }
            if (newInfo.StopProfitPrice != 0)
            {
                if (newInfo.StopProfitPrice < 0)
                    return new ValidationResult(false, "止盈价不能小于0");

                //进行止盈价的验证
                result = ValidationHelper.StopProfitPriceValidation(newInfo.StopProfitPrice, selectedProduct.RealTimePrice, (int)newInfo.OrderType, selectedProduct.SpreadBaseValue, selectedProduct.LossProfitSpread);
                if (!result.IsValid)
                    return result;
            }

            return new ValidationResult(true, null);
        }
        public void BindingOrgExecute(ClientAccount selCaaount)
        {
            if (OrgList == null || OrgList.Count == 0)
                GetOrgsListExecute();
            BindingOrgWindow window = new BindingOrgWindow()
                                          {
                                              DataContext = this,
                                              Owner = Application.Current.MainWindow
                                          };
            if (window.ShowDialog() == true)
            {

            }
        }
 /// <summary>
 /// 给账户配置角色及权限
 /// </summary>
 /// <param name="selectAccount"></param>
 public void ConfigRolePrivilege(ClientAccount selectAccount)
 {
     GetAllRoles();
     GetPrivileges();
     string roleID = "";
     ErrType err = _businessService.ReadUserRole(_loginID, selectAccount.AccInfo.UserID, ref roleID);
     if (err.Err == ERR.SUCCESS && !string.IsNullOrEmpty(roleID))
     {
         CurentRoleInfo = RoleList.Where(p => p.RoleID == roleID).FirstOrDefault();
     }
     RolePrivilegesConfigWindow window = new RolePrivilegesConfigWindow()
     {
         Owner = Application.Current.MainWindow,
         DataContext = this,
     };
     window.DataGridSelectionChangedEvent += (e, v) =>
     {
         GetRolePrivileges();
     };
     if (window.ShowDialog() == true)
     {
         if (string.IsNullOrEmpty(roleID))
         {
             err = _businessService.AddUserRole(_loginID, CurentRoleInfo.RoleID, selectAccount.AccInfo.UserID);
         }
         else
         {
             err = _businessService.UpdateUserRole(_loginID, CurentRoleInfo.RoleID, selectAccount.AccInfo.UserID);
         }
         if (err.Err != ERR.SUCCESS)
             MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 /// <summary>
 /// 修改客户资料
 /// </summary>
 /// <param name="clientAcc">客户资料</param>
 /// <param name="loginID">登陆标识</param>
 /// <returns>ErrType</returns>
 public ErrType ModifyClientAccountInfo(ClientAccount clientAcc, string loginID)
 {
     try
     {
         TradeUser userInfo = MyConverter.ToTradeUser(clientAcc);
         ResultDesc result = ManagerService.ModifyTradeUser(userInfo, loginID);
         return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);
     }
     catch (TimeoutException te)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
       new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
     }
 }
 /// <summary>
 /// 新增客户账号
 /// </summary>
 /// <param name="clientAcc">新增的客户资料信息</param>
 /// <param name="Fdinfo">资金信息</param>
 /// <param name="type">账户类型</param>
 /// <param name="loginID">登录标识</param>
 /// <returns></returns>
 public ErrType AddClientAccount(ClientAccount clientAcc, FundsInformation Fdinfo, UserTypeInfo type, string loginID)
 {
     try
     {
         UserType uType = EnumConverter.ConverterUserType(type);
         TradeUser userInfo = MyConverter.ToTradeUser(clientAcc);
         Fundinfo finfo = new Fundinfo();
         finfo.OpenBank = Fdinfo.OpenBank;
         finfo.BankCard = Fdinfo.BankCardNumber;
         finfo.ConBankType = Fdinfo.banktype;
         ResultDesc result = ManagerService.AddTradeUserEx(userInfo, finfo, uType, loginID);
         return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);
     }
     catch (TimeoutException te)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
      new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
     }
 }
        /// <summary>
        /// 添加客户到客户组
        /// </summary>
        /// <param name="account">客户id</param>
        /// <param name="LoginId">登陆标示</param>
        /// <returns></returns>
        public ErrType AddUserToUserGroups(string account, string Groupid, String LoginId, ref ClientAccount CAccount)
        {
            try
            {
                TradeUser user = new TradeUser();
                ResultDesc result = ManagerService.AddUserToUserGroups(account, Groupid, LoginId, ref user);
                CAccount = MyConverter.ToClientAccount(user);

                if (!result.Result)
                    return new ErrType(ERR.SERVICE, result.Desc);
                return GeneralErr.Success;
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
                return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
              new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
            }
        }
        /// <summary>
        /// 实物入库
        /// </summary>
        /// <param name="client"></param>
        public void EntityAccept(ClientAccount client)
        {
            EntityAcceptWindow window = new EntityAcceptWindow()
            {
                Owner = Application.Current.MainWindow,
                DataContext = this,
            };
            if (window.ShowDialog() == true)
            {
                string product = "";
                double price = 0;
                switch (window.ProductName)
                {
                    case "黄金":
                        product = "XAU";
                        price = ProductInfoes.Where(p => p.StockCode.Contains("XAU")).FirstOrDefault().RealTimePrice;
                        break;
                    case "白银":
                        product = "XAG";
                        price = ProductInfoes.Where(p => p.StockCode.Contains("XAG")).FirstOrDefault().RealTimePrice;
                        break;
                    case "钯金":
                        product = "XPD";
                        price = ProductInfoes.Where(p => p.StockCode.Contains("XPD")).FirstOrDefault().RealTimePrice;
                        break;
                    case "铂金":
                        product = "XPT";
                        price = ProductInfoes.Where(p => p.StockCode.Contains("XPT")).FirstOrDefault().RealTimePrice;
                        break;
                }
                string deliverNo = DateTime.Now.ToString("yyMMddhhmmsssffff");

                ErrType err = _bzjService.CreateDeliverAdmin(client.AccInfo.UserID, _accName, client.AccInfo.AccountName, "1",
                    product, _loginID, deliverNo, (decimal)window.Total, price, 9, (int)_accType);
                if (err.Err == ERR.SUCCESS)
                {
                    MessageBox.Show("实物入库成功", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }

        }
        /// <summary>
        /// 库存管理
        /// </summary>
        public void InventoryManager(ClientAccount client)
        {
            ErrType err = _bzjService.GetAdminUserStockInfo(_loginID, client.AccInfo.UserID, ref _BzjInfoInformation, (int)_accType);
            if (err.Err == ERR.SUCCESS)
            {
                BzjInfoInformation = _BzjInfoInformation;
                InventoryManagerWindow window = new InventoryManagerWindow()
                  {
                      Owner = Application.Current.MainWindow,
                      DataContext = this,

                  };
                if (window.ShowDialog() == true)
                {
                    double au = 0;
                    double ag = 0;
                    double pt = 0;
                    double pd = 0;
                    bool hasError = false;
                    if (BzjInfoInformation.AuUpdate <= 0)
                    {
                        au = BzjInfoInformation.AuUpdate;
                    }
                    else
                    {
                        string deliverNo = DateTime.Now.ToString("yyMMddhhmmsssffff");
                        ErrType error = _bzjService.CreateDeliverAdmin(client.AccInfo.UserID, _accName, client.AccInfo.AccountName, "1",
                            "XAU", _loginID, deliverNo, (decimal)BzjInfoInformation.AuUpdate, (double)BzjInfoInformation.AuPrice, 13, (int)_accType);
                        if (error.Err != ERR.SUCCESS)
                        {
                            MessageBox.Show(error.ErrMsg, error.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }

                    if (BzjInfoInformation.AgUpdate <= 0)
                    {
                        ag = BzjInfoInformation.AgUpdate;
                    }
                    else
                    {
                        string deliverNo = DateTime.Now.ToString("yyMMddhhmmsssffff");
                        ErrType error = _bzjService.CreateDeliverAdmin(client.AccInfo.UserID, _accName, client.AccInfo.AccountName, "1",
                            "XAG", _loginID, deliverNo, (decimal)BzjInfoInformation.AgUpdate, (double)BzjInfoInformation.AgPrice, 13, (int)_accType);
                        if (error.Err != ERR.SUCCESS)
                        {
                            MessageBox.Show(error.ErrMsg, error.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }

                    if (BzjInfoInformation.PtUpdate <= 0)
                    {
                        pt = BzjInfoInformation.PtUpdate;
                    }
                    else
                    {
                        string deliverNo = DateTime.Now.ToString("yyMMddhhmmsssffff");
                        ErrType error = _bzjService.CreateDeliverAdmin(client.AccInfo.UserID, _accName, client.AccInfo.AccountName, "1",
                            "XPT", _loginID, deliverNo, (decimal)BzjInfoInformation.PtUpdate, (double)BzjInfoInformation.PtPrice, 13, (int)_accType);
                        if (error.Err != ERR.SUCCESS)
                        {
                            MessageBox.Show(error.ErrMsg, error.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }

                    if (BzjInfoInformation.PdUpdate <= 0)
                    {
                        pd = BzjInfoInformation.PdUpdate;
                    }
                    else
                    {
                        string deliverNo = DateTime.Now.ToString("yyMMddhhmmsssffff");
                        ErrType error = _bzjService.CreateDeliverAdmin(client.AccInfo.UserID, _accName, client.AccInfo.AccountName, "1",
                            "XPD", _loginID, deliverNo, (decimal)BzjInfoInformation.PdUpdate, (double)BzjInfoInformation.PdPrice, 13, (int)_accType);
                        if (error.Err != ERR.SUCCESS)
                        {
                            MessageBox.Show(error.ErrMsg, error.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }
                    if (au < 0 || ag < 0 || pt < 0 || pd < 0)
                    {
                        ErrType errDeliver = _bzjService.CreateStockDeliverAdmin(_accName, _loginID, client.AccInfo.UserID,
                                                                            client.AccInfo.AccountName, au, ag, pt, pd, (int)_accType);
                        if (errDeliver.Err != ERR.SUCCESS)
                        {
                            MessageBox.Show(errDeliver.ErrMsg, errDeliver.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }

                    if (BzjInfoInformation.AuUpdate != 0 || BzjInfoInformation.AgUpdate != 0 || BzjInfoInformation.PtUpdate != 0 || BzjInfoInformation.PdUpdate != 0)
                    {
                        MessageBox.Show("库存更改成功", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            else
            {
                MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        /// <summary>
        /// 调整客户资金
        /// </summary>
        /// <param name="clientAccount"></param>
        public void AdjustMoneyOfClient(ClientAccount clientAccount)
        {
            AdjustMoneyWindow wnd = new AdjustMoneyWindow
            {
                Owner = Application.Current.MainWindow,
                DataContext = clientAccount,
                Title = "调节",
            };

            if (wnd.ShowDialog() == true)
            {
                if (wnd.CashIOMode == CASH_IO_MODE.Out)
                {//出金则资金为负数
                    wnd.Deposit = -wnd.Deposit;
                }

                ErrType err = _businessService.AdjustMoney(_loginID, _accType, clientAccount.AccInfo.AccountName, wnd.Deposit);
                if (err == GeneralErr.Success)
                    MessageBox.Show("资金调整成功,金额:" + wnd.Deposit, "调节操作", MessageBoxButton.OK, MessageBoxImage.Information);
                else
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        /// <summary>
        /// 添加客户账户
        /// </summary>
        private void CreatClientAccountEx2()
        {
             newClient = CreateClientAcc();
             clientView = new ClientAccountInfoWindow
            {
                POrgList=this.POrgList,
                Owner = Application.Current.MainWindow,
                DataContext = newClient,
                CreateMode = true,
                Banks=this.Banks
            };
            clientView.ComitEvent = AddClient;
            clientView.ShowDialog();

        }
        /// <summary>
        /// 为指定的客户限价挂单
        /// </summary>
        /// <param name="clientAccount">指定的某个客户账户</param>
        public void PendingOrder(ClientAccount clientAccount)
        {
            PendingOrderWindow wnd = new PendingOrderWindow
            {
                Owner = Application.Current.MainWindow,
                DataContext = clientAccount,
                ProductList = ProductInfoes,
            };
            wnd.PendingOrder += (sender, args) =>
            {
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, e) =>
                {
                    ValidationResult result = PendingOrderInfoValidation(args.NewOrderInfo, args.SelectedProduct, clientAccount);
                    if (!result.IsValid)
                    {
                        e.Result = new ErrType(ERR.VALIDATE_FAIL, result.ErrorContent.ToString());
                        return;
                    }

                    int userType = ToUserType(_accType);
                    e.Result = _tradeService.PendingOrder(_loginID, clientAccount.AccInfo.AccountName, userType, args.NewOrderInfo);
                };
                worker.RunWorkerCompleted += (s, e) =>
                {
                    ErrType err = e.Result as ErrType;
                    if (err != GeneralErr.Success)
                    {
                        MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                        wnd.RevertWindowState();
                    }
                    else
                    {
                        wnd.Close();
                        MessageBox.Show("限价挂单操作成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                };
                worker.RunWorkerAsync();
            };
            wnd.ShowDialog();
        }
 private void CreateDealerAccountExecute()
 {
     newClient = CreateClientAcc();
     dealerView = new DealerAccountInfoWindow
     {
         POrgList=this.POrgList,
         //CurOrgInfo=this.POrgList.FirstOrDefault(),
         Owner = Application.Current.MainWindow,
         DataContext = newClient,
         CurOrgInfo=POrgList.FirstOrDefault(),
         CreateMode = true,
     };
     dealerView.ComitEvent += new Action(dealerView_ComitEvent);
    dealerView.ShowDialog();
 }
        /// <summary>
        /// 验证限价单定单信息的有效性
        /// </summary>
        /// <param name="newInfo">新挂单的详细信息</param>
        /// <param name="selectedProduct">选中下单的商品</param>
        /// <param name="operateClient">该市价单定单对应的某个用户</param>
        /// <returns>验证结果</returns>
        private ValidationResult PendingOrderInfoValidation(NewPendingOrderInfo newInfo, ProductInformation selectedProduct, ClientAccount operateClient)
        {
            double priceDeviation = selectedProduct.PendingOrderSpread * selectedProduct.SpreadBaseValue;
            double minPriceCaps = newInfo.RealTimePrice - priceDeviation;//最小价格上限
            double maxPriceLows = newInfo.RealTimePrice + priceDeviation;//最大价格下限

            if (newInfo.PendingOrdersPrice > minPriceCaps && newInfo.PendingOrdersPrice < maxPriceLows)
            {
                string msg = string.Format("无效的订单价!\r\n订单价必须大于等于:{0}\t或\t小于等于:{1}", maxPriceLows, minPriceCaps);
                return new ValidationResult(false, msg);
            }

            return OrderInfoBaseValidation(newInfo, selectedProduct, operateClient);
        }
 /// <summary>
 /// 显示客户账户信息
 /// </summary>
 /// <param name="clientAccount">选中的某个客户账户</param>
 public void ShowAccountInfo2(ClientAccount clientAccount)
 {
     clone = (ClientAccount)clientAccount.Clone();
     this.clientAccount = clientAccount;
     clientView = new ClientAccountInfoWindow
     {
         Owner = Application.Current.MainWindow,
         POrgList=this.POrgList,
         DataContext = clone,
         Banks = this.Banks,
     };
     clientView.ComitEvent = ShowAccInfo;
     clientView.ShowDialog();
     
 }
 /// <summary>
 /// 平仓信息的验证
 /// </summary>
 /// <param name="ordersInfo">平仓的详细信息</param>
 /// <param name="operateClient">要平仓的某个用户的定单</param>
 /// <returns>ValidationResult</returns>
 private ValidationResult ChargebackOrderValidation(OrderChangedInformation ordersInfo, ClientAccount operateClient)
 {
     return ValidationHelper.OrderCountValidation(ordersInfo.Count, operateClient.TransactionSettings.OrderUnit);
 }
 /// <summary>
 /// 显示金商账户信息
 /// </summary>
 /// <param name="dealerAccount">选中的某个金商账户</param>
 public void ShowDealerAccountInfo(ClientAccount clientAccount)
 {
     clone = (ClientAccount)clientAccount.Clone();
     OrgInfo org = POrgList.FirstOrDefault(p=>p.OrgName==clone.AccInfo.OrgName);
     this.clientAccount = clientAccount;
     dealerView = new DealerAccountInfoWindow
     {
         POrgList = this.POrgList,
         Owner = Application.Current.MainWindow,
         CurOrgInfo=org,
         DataContext = clone,
     };
     dealerView.ComitEvent += new Action(ShowDealerAccountInfo);
     dealerView.ShowDialog();
 }
        void win_SubmitEvent(AddGroupAccount obj)
        {
            try
            {
                ClientAccount c = new ClientAccount();
                ErrType rst = _businessService.AddUserToUserGroups(obj.Account, CurUserGroup.UserGroupId, _loginID, ref c);

                if (rst.Err != ERR.SUCCESS)
                {
                    MessageBox.Show(rst.ErrMsg);
                }
                else
                {
                    MessageBox.Show("用户添加到组成功");
                    GroupAccounts.Add(c);
                    obj.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
        /// <summary>
        /// 显示管理员账户信息
        /// </summary>
        /// <param name="adminAccount">选中的某个管理员账户</param>
        public void ShowManagerAccountInfo(ClientAccount clientAccount)
        {
            ClientAccount clone = (ClientAccount)clientAccount.Clone();
            ManagerAccountInfoWindow managerView = new ManagerAccountInfoWindow
            {
                Owner = Application.Current.MainWindow,
                DataContext = clone,
            };

            if (managerView.ShowDialog() == true)
            {
                ErrType err = _businessService.ModifyClientAccountInfo(clone, _loginID);
                if (err == GeneralErr.Success)
                {
                    clientAccount.Sync(clone);
                }
                else
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemple #25
0
 /// <summary>
 /// 同步客户资料数据
 /// </summary>
 /// <param name="clone">同步数据源</param>
 public void Sync(ClientAccount clone)
 {
     AccInfo.Sync(clone.AccInfo);
     TransactionSettings.Sync(clone.TransactionSettings);
 }
        internal static TradeUser ToTradeUser(ClientAccount client)
        {
            return new TradeUser
            {
                UserName = client.AccInfo.UserName,
                Status = client.AccInfo.IsAccountEnabled ? "1" : "0",//0禁用,1启用
                AccountType = ((int)client.AccInfo.ClientType).ToString(),
                Account = client.AccInfo.AccountName,
                LoginPwd = client.AccInfo.AccountPassword,
                CashPwd = client.AccInfo.FundsPassword,
                CardType = ((int)client.AccInfo.CeritificateEnum).ToString(),
                CardNum = client.AccInfo.CertificateNumber,
                Sex = ToSexString(client.AccInfo.Sex),
                PhoneNum = client.AccInfo.CellPhoneNumber,
                TelNum = client.AccInfo.TelephoneNumber,
                Email = client.AccInfo.Email,
                LinkMan = client.AccInfo.Contact,
                LinkAdress = client.AccInfo.Address,
                OpenMan = client.AccInfo.OpeningMan,
                OpenTime = client.AccInfo.OpenAccountTime,
                LastUpdateTime = client.AccInfo.LastUpdateTime,
                LastUpdateID = client.AccInfo.LastUpdateManager,
                LastLoginTime = client.AccInfo.LastLoginTime,
                Ip = client.AccInfo.LoginIP,
                Mac = client.AccInfo.LoginMAC,
                Online = client.AccInfo.IsOnline,
                OrderPhone = client.AccInfo.OrderPhoneNumber,

                MinTrade = client.TransactionSettings.MinTrade,
                OrderUnit = client.TransactionSettings.OrderUnit,
                MaxTrade = client.TransactionSettings.MaxTrade,
                PermitRcash = client.TransactionSettings.AllowRecharge,
                PermitCcash = client.TransactionSettings.AllowEncashment,
                PermitDelOrder = client.TransactionSettings.AllowChargeback,
                PermitDhuo = client.TransactionSettings.AllowOrder,
                PermitHshou = client.TransactionSettings.AllowRecovery,
                PermitRstore = client.TransactionSettings.AllowWarehousing,
                CorporationName = client.AccInfo.Legal,

                OrgId = client.AccInfo.OrgId,
                OrgName = client.AccInfo.OrgName,
                BindAccount = client.AccInfo.BindAccount,
                UserID = client.AccInfo.UserID,
                OpenBank = client.FundsInfo.OpenBank,
                BankCard = client.FundsInfo.BankCardNumber
            };
        }