/// <summary>
        /// 增加会员信息
        /// create by 肖军文
        /// create date 2010-09-29
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int AddAgentUser(User user)
        {
            try
            {
                //计算各级代理占成
                user.SubCompanyPercent   = user.SubCompanyPercent - user.PartnerPercent;
                user.PartnerPercent      = user.PartnerPercent - user.GeneralAgentPercent;
                user.GeneralAgentPercent = user.GeneralAgentPercent - user.AgentPercent;
                user.AgentPercent        = user.AgentPercent - user.Percent;
                //会员等级、跟投、吃货比例
                GradeManager  gm = new GradeManager();
                ConfigManager cm = new ConfigManager();
                user.UserLevel   = gm.GetDefaultGrade().ID.ToString();
                user.Coefficient = Convert.ToDecimal(cm.GetConfigByOtype("跟投系数").Oval);
                user.Proportion  = Convert.ToDecimal(cm.GetConfigByOtype("吃货比例").Oval);

                int Id = userService.AddAgentUser(user);
                if (Id != 0)
                {
                    if (userService.UpdateAgentNumber(user.UpUserID))
                    {
                        AgentService agentService = new AgentService();
                        agentService.UpdateUserCredit(user.Credit, user.UpUserName);
                        return(Id);
                    }
                    else
                    {
                        return(0);
                    }
                }
                return(0);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }