Esempio n. 1
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.txt_LoginName.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("请输入登录名称!");
             return;
         }
         if (this.txt_Answer.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("请输入提示问题的答案!");
             return;
         }
         int            QuestionID  = ((UComboItem)this.dll_QuestionID.SelectedItem).ValueIndex;
         UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();
         UM_UserInfo    UserInfo    = UserInfoBLL.SeekForPassword(this.txt_LoginName.Text, this.txt_Answer.Text, QuestionID);
         if (UserInfo == null)
         {
             ShowMessageBox.ShowInformation("验证失败,请重新输入!");
             return;
         }
         ShowMessageBox.ShowInformation(string.Format("你的登录密码为:{0}", UtilityClass.DesDecrypt(UserInfo.Password.ToString(), string.Empty)));
     }
     catch (Exception)
     {
         return;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 页面加载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ManagerEdit_Load(object sender, EventArgs e)
 {
     try
     {
         if (m_EditType == 1)
         {
             m_userInfo = new UM_UserInfo();
         }
         BinData();
         SetControl();
         if (m_EditType == 2)
         {
             if (ispersonedit)
             {
                 this.Text = "个人信息";
                 this.Icon = Icon.FromHandle(new Bitmap(imageList1.Images[0]).GetHicon());
                 if ((int)UserInfo.RoleID != (int)Types.RoleTypeEnum.Admin)
                 {
                     GetRightGroupByUserID(UserInfo.UserID);
                 }
             }
             InitManagerInfo();
         }
     }
     catch (Exception ex)
     {
         //写日志
         ShowMessageBox.ShowInformation("页面加载失败!");
         string      errCode   = "GL-1021";
         string      errMsg    = "页面加载失败!";
         VTException exception = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(exception.ToString(), exception.InnerException);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 修改管理员
        /// </summary>
        /// <param name="handle">当前行</param>
        private void ManagerUpdate(int handle)
        {
            try
            {
                if (handle < 0)
                {
                    return;
                }
                ManagerEdit managerEdit = new ManagerEdit();
                managerEdit.EditType = 2;
                DataRow dw     = ViewManage.GetDataRow(handle);
                int     UserID = int.Parse(dw["UserID"].ToString());

                UM_UserInfo UserInfo = UserInfoBLL.GetModel(UserID);
                managerEdit.UserInfo = UserInfo;

                UM_ManagerBeloneToGroupBLL ManagerBeloneToGroupBLL = new UM_ManagerBeloneToGroupBLL();
                UM_ManagerBeloneToGroup    ManagerBeloneToGroup    = ManagerBeloneToGroupBLL.GetModel(UserID);
                managerEdit.RightGroupID = (int)ManagerBeloneToGroup.ManagerGroupID;
                if (managerEdit.ShowDialog(this) == DialogResult.OK)
                {
                    LoadManagerList();
                    this.ViewManage.FocusedRowHandle = handle;
                }
            }
            catch (Exception ex)
            {
                ShowMessageBox.ShowInformation("修改管理员失败!");
                string      errCode   = "GL-1005";
                string      errMsg    = "修改管理员异常!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 修改交易员
        /// </summary>
        /// <param name="handle">当前行</param>
        private void UserUpdate(int handle)
        {
            try
            {
                if (handle < 0)
                {
                    return;
                }
                UserInfoForm userInfoForm = new UserInfoForm();
                userInfoForm.EditType = 2;
                DataRow dw     = ViewUser.GetDataRow(handle);
                int     UserID = int.Parse(dw["UserID"].ToString());

                UM_UserInfo UserInfo = UserInfoBLL.GetModel(UserID);
                userInfoForm.CurrentUser = UserInfo;

                if (userInfoForm.ShowDialog(this) == DialogResult.OK)
                {
                    LoadUser();
                    this.ViewUser.FocusedRowHandle = handle;
                }
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-0324";
                string      errMsg    = "修改交易员失败";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), ex);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 页面加载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UserInfoForm_Load(object sender, EventArgs e)
 {
     try
     {
         if (m_EditType == 1)
         {
             m_InitFund    = new InitFund();
             m_currentUser = new UM_UserInfo();
         }
         SetControlsIsEnabled();
         BinData();
         InitTreeView();
         if (m_EditType == 2)
         {
             InitUserInfo();
             InitOriginationFund();
         }
         if (this.dll_CouterID.Properties.Items.Count < 1)
         {
             ShowMessageBox.ShowInformation("请先添加柜台信息!");
         }
     }
     catch (Exception ex)
     {
         string      errCode = "GL-0300";
         string      errMsg  = "交易员信息页面加载失败。";
         VTException vte     = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(vte.ToString(), vte.InnerException);
         ShowMessageBox.ShowInformation(vte.ToString());
     }
 }
 /// <summary>
 /// 确定按钮事件 btn_OK_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_OK_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.txt_LoginName.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("登陆名称不能为空!");
             return;
         }
         if (this.txt_PassWord.Text == string.Empty)
         {
             ShowMessageBox.ShowInformation("密码不能为空!");
             return;
         }
         UM_UserInfoBLL UserInfoBLL = new UM_UserInfoBLL();
         UM_UserInfo    UserInfo    = UserInfoBLL.ManagerLoginConfirm(this.txt_LoginName.Text, UtilityClass.DesEncrypt(this.txt_PassWord.Text, string.Empty),
                                                                      (int)Types.AddTpyeEnum.BackManager);
         if (UserInfo != null)
         {
             ParameterSetting.Mananger = UserInfo;
             DialogResult = DialogResult.OK;
             this.Close();
         }
         else
         {
             ShowMessageBox.ShowInformation("用户名或密码错误,请重新输入!");
         }
     }
     catch (Exception ex)
     {
         ShowMessageBox.ShowInformation(ex.Message.ToString());
         return;
     }
     this.txt_LoginName.Focus();
 }
Esempio n. 7
0
        //================================  私有  方法 ================================

        #region 设置查询实体对象

        /// <summary>
        /// 设置查询实体对象
        /// </summary>
        private bool SetQueryUserInfo()
        {
            if (QueryUserInfo == null)
            {
                QueryUserInfo = new UM_UserInfo();
            }
            if (this.txt_UserID.Text.Trim() == string.Empty)
            {
                QueryUserInfo.UserID = int.MaxValue;
            }
            else
            {
                if (InputTest.intTest(this.txt_UserID.Text.Trim()))
                {
                    QueryUserInfo.UserID = int.Parse(this.txt_UserID.Text.Trim());
                }
                else
                {
                    ShowMessageBox.ShowInformation("请输入正确的交易员编号!");
                    return(false);
                }
            }

            QueryUserInfo.LoginName = string.Empty;
            QueryUserInfo.RoleID    = (int)Types.RoleTypeEnum.Transaction;
            return(true);
        }
        /// <summary>
        /// 设置查询实体对象
        /// </summary>
        private bool SetQueryUserInfo()
        {
            if (QueryUserInfo == null)
            {
                QueryUserInfo = new UM_UserInfo();
            }
            if (this.txt_UserID.Text.Trim() == string.Empty)
            {
                QueryUserInfo.UserID = int.MaxValue;
            }
            else
            {
                if (InputTest.intTest(this.txt_UserID.Text.Trim()))
                {
                    QueryUserInfo.UserID = int.Parse(this.txt_UserID.Text.Trim());
                }
                else
                {
                    ShowMessageBox.ShowInformation("请输入正确的交易员编号!");
                    return(false);
                }
            }

            QueryUserInfo.UserName = this.txt_Name.Text.Trim() != string.Empty
                                         ? this.txt_Name.Text.Trim()
                                         : string.Empty;

            //if (this.txt_CounterID.Text.Trim() == string.Empty)
            //{
            //    QueryUserInfo.CouterID = int.MaxValue;
            //}
            //else
            //{
            //    if (InputTest.intTest(this.txt_CounterID.Text.Trim()))
            //    {
            //        QueryUserInfo.CouterID = int.Parse(this.txt_CounterID.Text.Trim());
            //    }
            //    else
            //    {
            //        ShowMessageBox.ShowInformation("请输入正确的柜台编号!");
            //        return false;
            //    }
            //}
            //柜台名称
            QueryUserInfo.Name = this.txt_CounterName.Text.Trim() != string.Empty
                                         ? this.txt_CounterName.Text.Trim()
                                         : string.Empty;
            QueryUserInfo.LoginName = string.Empty;
            QueryUserInfo.RoleID    = (int)Types.RoleTypeEnum.Transaction;
            return(true);
        }
 /// <summary>
 /// 管理员验证
 /// </summary>
 /// <param name="LoginName">登陆名</param>
 /// <param name="Password">密码</param>
 /// <param name="AddType">管理员的添加类型</param>
 /// <returns></returns>
 public UM_UserInfo ManagerLoginConfirm(string LoginName, string Password, int AddType)
 {
     try
     {
         UM_UserInfo UserInfo = dal.ManagerLoginConfirm(LoginName, Password, AddType);
         return(UserInfo);
     }
     catch (Exception ex)
     {
         string      errCode = "GL-1105";
         string      errMsg  = "管理员验证失败!";
         VTException vte     = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(vte.ToString(), vte.InnerException);
         return(null);
     }
 }
 /// <summary>
 /// 根据用户ID得到柜台实体
 /// </summary>
 /// <param name="UserID">用户ID</param>
 /// <returns></returns>
 private CT_Counter GetCounterByUserID(int UserID)
 {
     try
     {
         UM_UserInfo USER = StaticDalClass.UserInfoDAL.GetModel(UserID);
         CT_Counter  CT   = StaticDalClass.CounterDAL.GetModel((int)USER.CouterID);
         return(CT);
     }
     catch (Exception ex)
     {
         string      errCode = "GL-0217";
         string      errMsg  = "根据用户ID得到柜台实体GetCounterByUserID()方法异常!";
         VTException vte     = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(vte.ToString(), vte.InnerException);
         return(null);
     }
 }
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="CT">柜台表</param>
 /// <param name="UserID">用户ID</param>
 /// <param name="PassWord">密码</param>
 /// <param name="mess">输出信息</param>
 /// <returns></returns>
 public bool UpdateUserPassword(CT_Counter CT, int UserID, string PassWord, out string mess)
 {
     try
     {
         using (AccountAndCapitalManagementClient client = GetClient(CT))
         {
             // string mess;
             UM_UserInfo user        = StaticDalClass.UserInfoDAL.GetModel(UserID);
             string      oldPassword = user.Password;
             return(client.UpdateUserPassword(out mess, UserID.ToString(), oldPassword, PassWord));
         }
     }
     catch (Exception ex)
     {
         string      errCode = "GL-8107";
         string      errMsg  = "调用清算柜台提供的UpdateUserPassword()方法异常," + ex.Message;
         VTException vte     = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(vte.ToString(), vte.InnerException);
         throw vte;
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 测试开户方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            TransactionManageClient transactionManageClient = new TransactionManageClient();
            string mess = string.Empty;
            List <AccountEntity> accountEntities;
            UM_UserInfo          umUserInfo = new UM_UserInfo();
            InitFund             initFund   = new InitFund();

            initFund.HK         = 1;
            initFund.RMB        = 1;
            initFund.US         = 1;
            umUserInfo.UserName = "******";
            umUserInfo.Password = "******";
            UM_UserInfo userInfo = transactionManageClient.AddTransactionFP(out accountEntities, out mess, "admin", "pwhWQFzLWcw=", umUserInfo,
                                                                            initFund);

            UM_UserInfo          uu = userInfo;
            List <AccountEntity> accountEntitiesList = accountEntities;

            MessageBox.Show("A");
        }
Esempio n. 13
0
        //===============================================提供给金融工程平台的方法=====================================
        #region 提供给金融工程平台的方法

        #region 金融工程平台调用的添加交易员

        /// <summary>
        /// 金融工程平台调用的添加交易员
        /// </summary>
        /// <param name="MLoginName">登陆名称(管理员角色)</param>
        /// <param name="ManagerPWd">登陆密码(管理员密码)</param>
        /// <param name="UserInfo">用户基本信息</param>
        /// <param name="initfund">初始化资金</param>
        /// <param name="l_AccountEntity">账户列表实体</param>
        /// <param name="message">输出信息</param>
        /// <returns></returns>
        public UM_UserInfo AddTransactionFP(string MLoginName, string ManagerPWd, UM_UserInfo UserInfo, InitFund initfund, out List <AccountEntity> l_AccountEntity, out string message)
        {
            UserManage.Out_TransactionManage tm = new Out_TransactionManage();
            return(tm.AddTransactionFP(MLoginName, ManagerPWd, UserInfo, initfund, out l_AccountEntity, out message));
        }
        /// <summary>
        /// 管理员查询根据交易员查询交易员各银行资金账户相关信息
        /// </summary>
        /// <param name="adminId">管理员ID(可传空值:因柜台没验证)</param>
        /// <param name="adminPassword">管理员密码(可传空值:因柜台没验证)</param>
        /// <param name="traderID">交易员ID</param>
        /// <param name="strErrorMessage">输出信息</param>
        /// <returns>返回交易员的资金明细</returns>
        public UM_FundAddInfo AdminFindTraderBankCapitalAccountInfoByID(string adminId, string adminPassword, string traderID, out string strErrorMessage)
        {
            //调用柜台管理员查询根据交易员查询交易员各资金账户相关信息方法
            List <TradersAccountCapitalInfo> tradersAccountCList = new List <TradersAccountCapitalInfo>();
            UM_FundAddInfo uM_FundAddInfo = new UM_FundAddInfo();//追加资金明细实体

            try
            {
                int         couterID;
                UM_UserInfo uM_UserInfo = new UM_UserInfo();
                uM_UserInfo = GetUMUserInfoModel(Convert.ToInt32(traderID));
                if (uM_UserInfo == null)
                {
                    strErrorMessage = "用户ID不存在!";
                    LogHelper.WriteDebug(strErrorMessage);
                    return(null);
                }
                couterID = Convert.ToInt32(uM_UserInfo.CouterID);
                if (string.IsNullOrEmpty(couterID.ToString()))
                {
                    strErrorMessage = "交易员ID(用户ID)的柜台不存在!";
                    LogHelper.WriteDebug(strErrorMessage);
                    return(null);
                }
                CT_Counter T = StaticDalClass.CounterDAL.GetModel(couterID);
                tradersAccountCList =
                    ServiceIn.AccountManageServiceProxy.GetInstance().AdminFindTraderCapitalAccountInfoByID(T, adminId,
                                                                                                            adminPassword,
                                                                                                            traderID,
                                                                                                            out
                                                                                                            strErrorMessage);

                if (tradersAccountCList.Count == 0)
                {
                    strErrorMessage = "GL-0052:调用柜台开户方法AdminFindTraderCapitalAccountInfoByID失败!";// +s; //写调试信息
                    LogHelper.WriteDebug(strErrorMessage);
                    return(null);
                }
                //返回银行账户里的可用资金
                foreach (TradersAccountCapitalInfo traderACInfo in tradersAccountCList)
                {
                    if (traderACInfo.AccountType == (int)GTA.VTS.Common.CommonObject.Types.AccountType.BankAccount)
                    {
                        switch (traderACInfo.CurrencyType)
                        {
                        case (int)GTA.VTS.Common.CommonObject.Types.CurrencyType.RMB:
                            uM_FundAddInfo.RMBNumber = traderACInfo.AvailableCapital;
                            break;

                        case (int)GTA.VTS.Common.CommonObject.Types.CurrencyType.HK:
                            uM_FundAddInfo.HKNumber = traderACInfo.AvailableCapital;
                            break;

                        case (int)GTA.VTS.Common.CommonObject.Types.CurrencyType.US:
                            uM_FundAddInfo.USNumber = traderACInfo.AvailableCapital;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (VTException ex)
            {
                strErrorMessage = ex.ToString();
                LogHelper.WriteError(ex.ToString(), ex.InnerException);
                return(null);
            }
            return(uM_FundAddInfo);
        }
        /// <summary>
        /// 追加资金
        /// </summary>
        /// <param name="model">追加资金实体</param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public bool AddFund(ManagementCenter.Model.UM_FundAddInfo model, out string mess)
        {
            mess = string.Empty;
            UM_UserInfo user = StaticDalClass.UserInfoDAL.GetModel((int)model.UserID);

            if (user == null || user.RoleID != (int)ManagementCenter.Model.CommonClass.Types.RoleTypeEnum.Transaction)
            {
                mess = "GL-0219:交易员编号不存在!"; //写调试信息
                LogHelper.WriteDebug(mess);
                return(false);
            }

            CT_Counter T = GetCounterByUserID((int)model.UserID);

            if (T == null)
            {
                mess = "GL-0220:交易员对应的柜台不存在!"; //写调试信息
                LogHelper.WriteDebug(mess);
                return(false);
            }
            UM_DealerAccount DealerAccount = StaticDalClass.DealerAccountDAL.GetModelByUserIDAndType((int)model.UserID,
                                                                                                     (int)
                                                                                                     GTA.VTS.Common.CommonObject.Types.
                                                                                                     AccountAttributionType
                                                                                                     .
                                                                                                     BankAccount);

            if (DealerAccount == null)
            {
                mess = "GL-0221:交易员对应的银行帐号不存在!"; //写调试信息
                LogHelper.WriteDebug(mess);
                return(false);
            }
            try
            {
                AddCapitalEntity AddCapitalEntity = new AddCapitalEntity();
                AddCapitalEntity.AddHKAmount        = (decimal)model.HKNumber;
                AddCapitalEntity.AddRMBAmount       = (decimal)model.RMBNumber;
                AddCapitalEntity.AddUSAmount        = (decimal)model.USNumber;
                AddCapitalEntity.TraderID           = model.UserID.ToString();
                AddCapitalEntity.BankCapitalAccount = DealerAccount.DealerAccoutID;
                if (!ServiceIn.AccountManageServiceProxy.GetInstance().AddCapital(T, AddCapitalEntity, out mess))
                {
                    mess = "GL-0222:调用柜台追加资金方法AddCapital()失败!" + mess; //写调试信
                    LogHelper.WriteDebug(mess);
                    return(false);
                }
            }
            catch (VTException Ex)
            {
                mess = Ex.ToString();
                //写错误日志
                return(false);
            }
            try
            {
                if (model.HKNumber == decimal.MaxValue)
                {
                    model.HKNumber = null;
                }
                if (model.RMBNumber == decimal.MaxValue)
                {
                    model.RMBNumber = null;
                }
                if (model.USNumber == decimal.MaxValue)
                {
                    model.USNumber = null;
                }
                StaticDalClass.FundAddInfoDAL.Add(model);
            }
            catch (Exception ex)
            {
                string      errCode = "GL-0223";
                string      errMsg  = "追加资金失败!";
                VTException vte     = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                mess = vte.ToString();
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 添加交易员
        /// </summary>
        /// <param name="dt">权限列表</param>
        /// <param name="UserInfo">交易员实体</param>
        /// <param name="initfund">初始资金实体</param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public bool AddTransaction(DataTable dt, UM_UserInfo UserInfo, InitFund initfund, out string mess)
        {
            try
            {
                List <AccountEntity> l_AccountEntity = new List <AccountEntity>();

                string BackAccount = string.Empty;
                int    UserID;

                Database     db   = DatabaseFactory.CreateDatabase();
                DbConnection Conn = db.CreateConnection();
                if (Conn.State != ConnectionState.Open)
                {
                    Conn.Open();
                }
                DbTransaction Tran = Conn.BeginTransaction();

                try
                {
                    //添加用户基本信息表
                    UserID = StaticDalClass.UserInfoDAL.Add(UserInfo, Tran, db);
                    if (UserID < 1)
                    {
                        mess = "GL-0200:添加用户基本信息失败"; //写调试信息
                        LogHelper.WriteDebug(mess);
                        return(false);
                    }
                    //添加用户交易品种权限表
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        UM_DealerTradeBreedClass DealerTradeBreedClass = new UM_DealerTradeBreedClass();
                        DealerTradeBreedClass.UserID       = UserID;
                        DealerTradeBreedClass.BreedClassID = int.Parse(dt.Rows[i]["BreedClassID"].ToString());
                        StaticDalClass.DealerTradeBreedClassDAL.Add(DealerTradeBreedClass, Tran, db);
                    }
                    //分配帐号列表
                    List <UM_AccountType> AccountType = StaticDalClass.AccountTypeDAL.GetListArray(string.Empty);
                    if (AccountType == null || AccountType.Count == 0)
                    {
                        mess = "GL-0201:获取帐号类型列表失败"; //写调试信息
                        LogHelper.WriteDebug(mess);
                        return(false);
                    }
                    //传加密后的密码给柜台开户
                    string DesPassWord = UtilityClass.DesEncrypt(UserInfo.Password, string.Empty);

                    foreach (UM_AccountType type in AccountType)
                    {
                        UM_DealerAccount DealerAccount = new UM_DealerAccount();
                        DealerAccount.AccountTypeID  = type.AccountTypeID;
                        DealerAccount.DealerAccoutID = ProductionAccount.FormationAccount((int)UserInfo.CouterID,
                                                                                          UserID,
                                                                                          (int)
                                                                                          DealerAccount.AccountTypeID);
                        DealerAccount.IsDo = true;
                        DealerAccount.AccountAttributionType = type.AccountAttributionType;
                        DealerAccount.UserID = UserID;
                        StaticDalClass.DealerAccountDAL.Add(DealerAccount, Tran, db);

                        //添加到调用柜台接口的参数类表
                        {
                            AccountEntity Element = new AccountEntity();
                            Element.Account             = DealerAccount.DealerAccoutID;
                            Element.AccountAAttribution = (int)DealerAccount.AccountAttributionType;
                            Element.AccountType         = (int)DealerAccount.AccountTypeID;
                            Element.CurrencyHK          = initfund.HK;
                            Element.CurrencyRMB         = initfund.RMB;
                            Element.CurrencyUS          = initfund.US;
                            Element.RoleNumber          = (int)GTA.VTS.Common.CommonObject.Types.UserId.Trader;
                            Element.TraderID            = UserID.ToString();
                            Element.TraderPassWord      = DesPassWord;
                            l_AccountEntity.Add(Element);
                        }
                        if (type.AccountAttributionType ==
                            (int)GTA.VTS.Common.CommonObject.Types.AccountAttributionType.BankAccount)
                        {
                            BackAccount = DealerAccount.DealerAccoutID;
                        }
                    }
                    //保存初始资金
                    if (!SaveFund(initfund, Tran, db, BackAccount))
                    {
                        mess = "GL-0202:初始化资金失败!"; //写调试信息
                        LogHelper.WriteDebug(mess);
                        return(false);
                    }
                    Tran.Commit();
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    string      errCode = "GL-0203";
                    string      errMsg  = "添加交易员失败!";
                    VTException vte     = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(vte.ToString(), vte.InnerException);
                    mess = vte.ToString();
                    return(false);
                }
                finally
                {
                    if (Conn.State == ConnectionState.Open)
                    {
                        Conn.Close();
                    }
                }

                //调用柜台开户方法
                string s;
                try
                {
                    CT_Counter T = StaticDalClass.CounterDAL.GetModel((int)UserInfo.CouterID);

                    if (
                        !ServiceIn.AccountManageServiceProxy.GetInstance().SingleTraderOpenAccount(T, l_AccountEntity, out s))
                    {
                        mess = "GL-0204:调用柜台开户方法SingleTraderOpenAccount失败!" + s; //写调试信息
                        LogHelper.WriteDebug(mess);

                        DelTransaction(UserID, out s);
                        return(false);
                    }
                }
                catch (VTException ex)
                {
                    mess = ex.ToString();
                    LogHelper.WriteError(ex.ToString(), ex.InnerException);
                    DelTransaction(UserID, out s);
                    //写错误信息
                    return(false);
                }
                mess = "GL-0232:开户成功!";
                return(true);
            }
            catch (Exception Ex)
            {
                string      errCode = "GL-0205";
                string      errMsg  = "数据库连接失败!";
                VTException vte     = new VTException(errCode, errMsg, Ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                mess = vte.ToString();
                return(false);
            }
        }
        /// <summary>
        /// 修改交易员
        /// </summary>
        /// <param name="dtAdd">新增加的权限表</param>
        /// <param name="dtDel">要删除的权限表</param>
        /// <param name="UserInfo">用户信息</param>
        /// <param name="UpdatePwd">需要更新的密码</param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public bool UpdateTransaction(DataTable dtAdd, DataTable dtDel, UM_UserInfo UserInfo, bool UpdatePwd,
                                      out string mess)
        {
            //调用柜台服务
            if (UpdatePwd)
            {
                try
                {
                    CT_Counter T = StaticDalClass.CounterDAL.GetModel((int)UserInfo.CouterID);
                    if (T == null)
                    {
                        mess = "GL-0207:交易员获取相应柜台失败"; //写调试信息
                        LogHelper.WriteDebug(mess);

                        return(false);
                    }
                    if (!ServiceIn.AccountManageServiceProxy.GetInstance().UpdateUserPassword(T, UserInfo.UserID,
                                                                                              UserInfo.Password, out mess))
                    {
                        mess = "GL-0208:调用柜台修改交易员方法UpdateUserPassword()失败!" + mess; //写调试信息
                        LogHelper.WriteDebug(mess);

                        return(false);
                    }
                }
                catch (VTException Ex)
                {
                    LogHelper.WriteError(Ex.ToString(), Ex.InnerException);
                    mess = Ex.ToString();
                    //写错误日志
                    return(false);
                }
            }

            Database     db   = DatabaseFactory.CreateDatabase();
            DbConnection Conn = db.CreateConnection();

            if (Conn.State != ConnectionState.Open)
            {
                Conn.Open();
            }
            DbTransaction Tran = Conn.BeginTransaction();

            try
            {
                StaticDalClass.UserInfoDAL.Update(UserInfo, Tran, db);

                for (int i = 0; i < dtAdd.Rows.Count; i++)
                {
                    UM_DealerTradeBreedClass DealerTradeBreedClass = new UM_DealerTradeBreedClass();
                    DealerTradeBreedClass.UserID       = UserInfo.UserID;
                    DealerTradeBreedClass.BreedClassID = int.Parse(dtAdd.Rows[i]["BreedClassID"].ToString());
                    StaticDalClass.DealerTradeBreedClassDAL.Add(DealerTradeBreedClass, Tran, db);
                }
                for (int i = 0; i < dtDel.Rows.Count; i++)
                {
                    StaticDalClass.DealerTradeBreedClassDAL.Delete(
                        int.Parse(dtDel.Rows[i]["DealerTradeBreedClassID"].ToString()), Tran, db);
                }
                Tran.Commit();
                mess = "GL-0209:修改成功!";
                return(true);
            }
            catch (Exception Ex)
            {
                Tran.Rollback();
                string      errCode = "GL-0210";
                string      errMsg  = "修改交易员失败!";
                VTException vte     = new VTException(errCode, errMsg, Ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                mess = vte.ToString();
                return(false);
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
            }
        }
Esempio n. 18
0
        //================================  私有  方法 ================================
        #region 菜单按纽事件 barButton_ItemClick
        /// <summary>
        /// 菜单按纽事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                this.pictureEdit1.SendToBack();//图片置于底层
                switch (e.Item.Name)
                {
                case "AccountM_TransactionM":
                    if (transactionManageForm == null || transactionManageForm.IsDisposed)
                    {
                        transactionManageForm =
                            new ManagementCenterConsole.UI.TransactionManage.TransactionManageForm();
                        transactionManageForm.MdiParent   = this;
                        transactionManageForm.Dock        = DockStyle.Fill;
                        transactionManageForm.WindowState = FormWindowState.Maximized;
                        transactionManageForm.Show();
                        transactionManageForm.Closed += new EventHandler(ChildForm_Closed);
                    }
                    transactionManageForm.BringToFront();
                    break;

                case "AccountM_ManagerM":
                    if (managerManageForm == null || managerManageForm.IsDisposed)
                    {
                        managerManageForm             = new ManagerManage.ManagerManage();
                        managerManageForm.MdiParent   = this;
                        managerManageForm.Dock        = DockStyle.Fill;
                        managerManageForm.WindowState = FormWindowState.Maximized;
                        managerManageForm.Show();
                        managerManageForm.Closed += new EventHandler(ChildForm_Closed);
                    }
                    managerManageForm.BringToFront();
                    break;

                case "AccountM_RightM":
                    if (rightManageForm == null || rightManageForm.IsDisposed)
                    {
                        rightManageForm             = new RightManage();
                        rightManageForm.MdiParent   = this;
                        rightManageForm.Dock        = DockStyle.Fill;
                        rightManageForm.WindowState = FormWindowState.Maximized;
                        rightManageForm.Show();
                        rightManageForm.Closed += new EventHandler(ChildForm_Closed);
                    }
                    rightManageForm.BringToFront();
                    break;

                case "CounterM_ConfigM":
                    // new CounterManage.CounterManger().ShowDialog();
                    if (counterManger == null || counterManger.IsDisposed)
                    {
                        counterManger             = new CounterManger();
                        counterManger.MdiParent   = this;
                        counterManger.Dock        = DockStyle.Fill;
                        counterManger.WindowState = FormWindowState.Maximized;
                        counterManger.Show();
                        counterManger.Closed += new EventHandler(ChildForm_Closed);
                    }
                    counterManger.BringToFront();
                    break;

                case "MatchM_CenterM":
                    if (matchCenterManageFrom == null || matchCenterManageFrom.IsDisposed)
                    {
                        matchCenterManageFrom             = new MatchCenterManage.MatchCenterManage();
                        matchCenterManageFrom.MdiParent   = this;
                        matchCenterManageFrom.Dock        = DockStyle.Fill;
                        matchCenterManageFrom.WindowState = FormWindowState.Maximized;
                        matchCenterManageFrom.Show();
                        matchCenterManageFrom.Closed += new EventHandler(ChildForm_Closed);
                    }
                    matchCenterManageFrom.BringToFront();
                    break;

                case "MatchM_GuideM":
                    //new MatchCenterManage.DispositionGuide().ShowDialog();
                    this.pictureEdit1.BringToFront();     //弹出窗体时图片显示
                    m_DispositionGuide = new DispositionGuide();
                    m_DispositionGuide.ShowDialog();
                    break;

                case "PersonalM":
                    ManagerManage.ManagerEdit managerEdit = new ManagerEdit();
                    UM_UserInfo UserInfo = new UM_UserInfo();
                    ManagementCenter.Model.CommonClass.UtilityClass.CopyEntityToEntity(CommonClass.ParameterSetting.Mananger, UserInfo);
                    managerEdit.UserInfo     = UserInfo;
                    managerEdit.EditType     = 2;
                    managerEdit.ispersonedit = true;
                    this.pictureEdit1.BringToFront();     //弹出窗体时图片显示
                    managerEdit.ShowDialog();
                    break;

                case "MenuHelpM_About":
                    this.pictureEdit1.BringToFront();     //弹出窗体时图片显示
                    FrmAbout frmAbout = new FrmAbout();
                    frmAbout.ShowDialog();
                    break;

                //工具栏项
                case "Menutool_TransactionM":
                    if (transactionManageForm == null || transactionManageForm.IsDisposed)
                    {
                        transactionManageForm =
                            new ManagementCenterConsole.UI.TransactionManage.TransactionManageForm();
                        transactionManageForm.MdiParent   = this;
                        transactionManageForm.Dock        = DockStyle.Fill;
                        transactionManageForm.WindowState = FormWindowState.Maximized;
                        transactionManageForm.Show();
                        transactionManageForm.Closed += new EventHandler(ChildForm_Closed);
                    }
                    transactionManageForm.BringToFront();
                    break;

                case "Menutool_ManagerM":
                    if (managerManageForm == null || managerManageForm.IsDisposed)
                    {
                        managerManageForm             = new ManagerManage.ManagerManage();
                        managerManageForm.MdiParent   = this;
                        managerManageForm.Dock        = DockStyle.Fill;
                        managerManageForm.WindowState = FormWindowState.Maximized;
                        managerManageForm.Show();
                        managerManageForm.Closed += new EventHandler(ChildForm_Closed);
                    }
                    managerManageForm.BringToFront();
                    break;

                case "Menutool_RightM":
                    if (rightManageForm == null || rightManageForm.IsDisposed)
                    {
                        rightManageForm             = new RightManage();
                        rightManageForm.MdiParent   = this;
                        rightManageForm.Dock        = DockStyle.Fill;
                        rightManageForm.WindowState = FormWindowState.Maximized;
                        rightManageForm.Show();
                        rightManageForm.Closed += new EventHandler(ChildForm_Closed);
                    }
                    rightManageForm.BringToFront();
                    break;

                case "Menutool_MatchM":
                    if (matchCenterManageFrom == null || matchCenterManageFrom.IsDisposed)
                    {
                        matchCenterManageFrom             = new MatchCenterManage.MatchCenterManage();
                        matchCenterManageFrom.MdiParent   = this;
                        matchCenterManageFrom.Dock        = DockStyle.Fill;
                        matchCenterManageFrom.WindowState = FormWindowState.Maximized;
                        matchCenterManageFrom.Show();
                        matchCenterManageFrom.Closed += new EventHandler(ChildForm_Closed);
                    }
                    matchCenterManageFrom.BringToFront();
                    break;

                case "Menutool_CounterM":
                    // new CounterManage.CounterManger().ShowDialog();
                    if (counterManger == null || counterManger.IsDisposed)
                    {
                        counterManger             = new CounterManger();
                        counterManger.MdiParent   = this;
                        counterManger.Dock        = DockStyle.Fill;
                        counterManger.WindowState = FormWindowState.Maximized;
                        counterManger.Show();
                        counterManger.Closed += new EventHandler(ChildForm_Closed);
                    }
                    counterManger.BringToFront();
                    break;

                case "Menutool_BreedClassM":     //商品品种管理
                    if (m_BreedClassManagerUI == null || m_BreedClassManagerUI.MdiParent == null)
                    {
                        m_BreedClassManagerUI           = new BreedClassManagerUI();
                        m_BreedClassManagerUI.MdiParent = this;
                        m_BreedClassManagerUI.Show();
                        m_BreedClassManagerUI.Closed += new EventHandler(ChildForm_Closed);
                    }
                    m_BreedClassManagerUI.Activate();
                    break;

                case "Menutool_CommodityM":     //商品代码管理
                    if (m_CommodityManagerUI == null || m_CommodityManagerUI.MdiParent == null)
                    {
                        m_CommodityManagerUI           = new CommodityManagerUI();
                        m_CommodityManagerUI.MdiParent = this;
                        m_CommodityManagerUI.Show();
                        m_CommodityManagerUI.Closed += new EventHandler(ChildForm_Closed);
                    }
                    m_CommodityManagerUI.Activate();
                    break;

                case "Menutool_BourseM":     //交易所类型管理
                    if (m_BourseManagerUI == null || m_BourseManagerUI.MdiParent == null)
                    {
                        m_BourseManagerUI           = new BourseManagerUI();
                        m_BourseManagerUI.MdiParent = this;
                        m_BourseManagerUI.Show();
                        m_BourseManagerUI.Closed += new EventHandler(ChildForm_Closed);
                    }
                    m_BourseManagerUI.Activate();
                    break;
                }
            }
            catch
            {
            }
        }