当前位置: 首页>>代码示例>>C#>>正文


C# Business.MakeListIAgentGroupManager方法代码示例

本文整理汇总了C#中Business.MakeListIAgentGroupManager方法的典型用法代码示例。如果您正苦于以下问题:C# Business.MakeListIAgentGroupManager方法的具体用法?C# Business.MakeListIAgentGroupManager怎么用?C# Business.MakeListIAgentGroupManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Business的用法示例。


在下文中一共展示了Business.MakeListIAgentGroupManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateAgent

        /// <summary>
        /// 
        /// </summary>
        /// <param name="AgentID"></param>
        /// <param name="AgentGroupID"></param>
        /// <param name="Name"></param>
        internal bool UpdateAgent(Business.Agent agent)
        {
            bool Result = false;
            System.Data.SqlClient.SqlTransaction trans = null;
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection);
            DSTableAdapters.AgentTableAdapter adapAgent = new DSTableAdapters.AgentTableAdapter();
            DSTableAdapters.IAgentGroupTableAdapter adapIAgentGroup = new DSTableAdapters.IAgentGroupTableAdapter();
            try
            {
                conn.Open();
                trans                          = conn.BeginTransaction();
                adapAgent.Connection           = conn;
                adapAgent.Transaction          = trans;

                adapIAgentGroup.Connection     = conn;
                adapIAgentGroup.Transaction    = trans;

                int Record                     = adapAgent.UpdateAgent(agent.AgentGroupID, agent.Name, agent.Comment, agent.IsDisable, agent.IsIpFilter, agent.IpForm, agent.IpTo, agent.GroupCondition, agent.AgentID);
                if (Record > 0)
                {
                    Result                     = true;
                }
                else
                {
                    throw new Exception("Data error");
                }
                adapIAgentGroup.DeleteIAgentGroupByAgentID(agent.AgentID);
                List<int> listInvestorGroupIDs = new List<int>();
                listInvestorGroupIDs           = agent.MakeListIAgentGroupManager(agent.GroupCondition);
                int count                      = listInvestorGroupIDs.Count;
                for (int i = 0; i < count; i++)
                {

                    int idIAgentGroup = int.Parse(adapIAgentGroup.AddIAgentGroup(agent.AgentID, listInvestorGroupIDs[i]).ToString());
                    if (idIAgentGroup < 1)
                    {
                        throw new Exception("Data error");
                    }
                }

                trans.Commit();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                Result = false;
            }
            finally
            {
                adapAgent.Connection.Close();
                adapIAgentGroup.Connection.Close();
                conn.Close();
            }
            return Result;
        }
开发者ID:ngthanhducit,项目名称:TradingServer1502,代码行数:61,代码来源:DBWAgent.cs

示例2: AddNewAgent

        /// <summary>
        /// 
        /// </summary>
        /// <param name="AgentGroupID"></param>
        /// <param name="Name"></param>
        /// <returns></returns>
        internal int AddNewAgent(Business.Agent agent)
        {
            int idAgent = -1;
            System.Data.SqlClient.SqlTransaction trans = null;
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection);
            DSTableAdapters.AgentTableAdapter adapAgent = new DSTableAdapters.AgentTableAdapter();
            DSTableAdapters.IAgentGroupTableAdapter adapIAgentGroup = new DSTableAdapters.IAgentGroupTableAdapter();
            try
            {
                conn.Open();
                trans                                          = conn.BeginTransaction();
                adapAgent.Connection                           = conn;
                adapAgent.Transaction                          = trans;

                adapIAgentGroup.Connection                     = conn;
                adapIAgentGroup.Transaction                    = trans;

                #region Create Investor
                Business.Investor investor                     = new Business.Investor();
                investor.InvestorStatusID                      = -1;
                investor.InvestorGroupInstance                 = new Business.InvestorGroup();
                investor.InvestorGroupInstance.InvestorGroupID = -1;
                investor.AgentID                               = string.Empty;
                investor.Balance                               = 0;
                investor.Credit                                = 0;
                investor.Code                                  = agent.Code;
                investor.PrimaryPwd                            = agent.Pwd;
                investor.ReadOnlyPwd                           = "";
                investor.PhonePwd                              = "";
                investor.IsDisable                             = true;
                investor.TaxRate                               = 0;
                investor.Leverage                              = 0;
                //Investor Profile
                DateTime registerDay                           = new DateTime();
                investor.Address                               = "";
                investor.Phone                                 = "";
                investor.City                                  = "";
                investor.Country                               = "";
                investor.Email                                 = "";
                investor.ZipCode                               = "";
                investor.RegisterDay                           = registerDay;
                investor.Comment                               = "";
                investor.State                                 = "";
                investor.NickName                              = "";
                investor.AllowChangePwd                        = false;
                investor.ReadOnly                              = false;
                investor.SendReport                            = false;
                #endregion

                int idInvestor = TradingServer.Facade.FacadeAddNewInvestor(investor);
                if (idInvestor < 1)
                {
                    throw new Exception("Data error");
                }

                agent.InvestorID = idInvestor;
                if (agent.AgentGroupID == -1)
                {
                    idAgent = int.Parse(adapAgent.AddNewAgent(null, agent.Name, agent.InvestorID, agent.Comment, agent.IsDisable, agent.IsIpFilter, agent.IpForm, agent.IpTo, agent.GroupCondition).ToString());
                }
                else idAgent = int.Parse(adapAgent.AddNewAgent(agent.AgentGroupID, agent.Name, agent.InvestorID, agent.Comment, agent.IsDisable, agent.IsIpFilter, agent.IpForm, agent.IpTo, agent.GroupCondition).ToString());
                if (idAgent < 1)
                {
                    throw new Exception("Data error");
                }

                List<int> listInvestorGroupIDs = new List<int>();
                listInvestorGroupIDs = agent.MakeListIAgentGroupManager(agent.GroupCondition);
                int count = listInvestorGroupIDs.Count;
                for (int i = 0; i < count; i++)
                {
                    int idIAgentGroup = int.Parse(adapIAgentGroup.AddIAgentGroup(idAgent, listInvestorGroupIDs[i]).ToString());
                    if (idIAgentGroup < 1)
                    {
                        throw new Exception("Data error");
                    }
                }

                trans.Commit();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                idAgent = -1;
            }
            finally
            {
                adapAgent.Connection.Close();
                adapIAgentGroup.Connection.Close();
                conn.Close();
            }

            return idAgent;
        }
开发者ID:ngthanhducit,项目名称:TradingServer1502,代码行数:100,代码来源:DBWAgent.cs


注:本文中的Business.MakeListIAgentGroupManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。