Exemple #1
0
        public void Register(LoginLocal loginEntity, string userId)
        {
            if (loginEntity.Password == null)
            {
                loginEntity.Password = C_DefaultPassword;
            }
            loginEntity.Password = Encipherment.MD5(string.Format("{0}{1}", loginEntity.Password, _gbKey)).ToUpper();

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var loginManager = new LoginLocalManager())
                {
                    var tmp = loginManager.GetLoginByName(loginEntity.LoginName);
                    if (tmp != null)
                    {
                        throw new AuthException("登录名已经存在 - " + loginEntity.LoginName);
                    }
                    loginEntity.User     = loginManager.LoadUser(userId);
                    loginEntity.Register = loginManager.LoadRegister(userId);
                    loginManager.Register(loginEntity);
                }
                biz.CommitTran();
            }
        }
        public void Register(LoginLocal loginEntity, string userId)
        {
            if (loginEntity.Password == null)
            {
                loginEntity.Password = C_DefaultPassword;
            }
            loginEntity.Password = Encipherment.MD5(string.Format("{0}{1}", loginEntity.Password, _gbKey)).ToUpper();


            DB.Begin();

            var tmp = DB.CreateQuery <E_Login_Local>().Where(p => (p.LoginName == loginEntity.LoginName || p.mobile == loginEntity.LoginName)).FirstOrDefault();

            if (tmp != null)
            {
                throw new AuthException("登录名已经存在 - " + loginEntity.LoginName);
            }
            //loginEntity.User = loginManager.LoadUser(userId);
            var Register = GetRegisterById(userId);
            var register = new E_Login_Local
            {
                LoginName  = loginEntity.LoginName,
                UserId     = userId,
                CreateTime = DateTime.Now,
                mobile     = loginEntity.mobile,
                Password   = loginEntity.Password,
                RegisterId = Register.UserId,
            };

            DB.GetDal <E_Login_Local>().Add(register);
            DB.Commit();
        }
        public LoginLocal Login(string loginName, string password)
        {
            password = MD5Helper.MD5(string.Format("{0}{1}", password, _gbKey)).ToUpper();
            LoginLocal loginInfo = UserLogin(loginName, password);

            return(loginInfo);
        }
Exemple #4
0
 protected void Btn_agregar(object sender, EventArgs e)
 {
     using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
     {
         IEnumerable <LoginLocal> resultado = ValidarUsuario(conn, Usuario.Text);
         if (resultado.Count() > 0)
         {
             DisplayAlert("Tareo HAUG", "Usuario ya existente.", "Ok");
         }
         else
         {
             if (string.Equals(Conf_Contrasenia.Text.ToString().Trim(), Contrasenia.Text.ToString().Trim()))
             {
                 conn.CreateTable <LoginLocal>();
                 var DatosRegistro = new LoginLocal {
                     NOMBRE = Nombre.Text, USUARIO = Usuario.Text, CONTRASENIA = Contrasenia.Text, TAREADOR = Tareador.Text, CELULAR = Celular.Text
                 };
                 conn.Insert(DatosRegistro);
                 LimpiarFormulario();
             }
             else
             {
                 DisplayAlert("Tareo HAUG", "Ingresar la misma contraseña.", "Ok");
             }
         }
     }
 }
        public LoginLocal LoginAPP(string loginName, string password)
        {
            //password = Encipherment.MD5(password);

            LoginLocal loginInfo = null;

            loginInfo = UserLogin(loginName, password);
            if (loginInfo != null && loginInfo.User != null)
            {
                //NHibernate.NHibernateUtil.Initialize(loginInfo.User.RoleList);
                //NHibernate.NHibernateUtil.Initialize(loginInfo.Register);
            }

            return(loginInfo);
        }
Exemple #6
0
        public LoginLocal LoginByUserId(string userId)
        {
            LoginLocal loginInfo = null;

            using (var loginManager = new LoginLocalManager())
            {
                loginInfo = loginManager.GetLoginByUserId(userId);
                if (loginInfo != null && loginInfo.User != null)
                {
                    NHibernate.NHibernateUtil.Initialize(loginInfo.User.RoleList);
                    NHibernate.NHibernateUtil.Initialize(loginInfo.Register);
                }
            }
            return(loginInfo);
        }
Exemple #7
0
        public LoginLocal LoginAPP(string loginName, string password)
        {
            //password = Encipherment.MD5(password);

            LoginLocal loginInfo = null;

            using (var loginManager = new LoginLocalManager())
            {
                loginInfo = loginManager.Login(loginName, password);
                if (loginInfo != null && loginInfo.User != null)
                {
                    NHibernate.NHibernateUtil.Initialize(loginInfo.User.RoleList);
                    NHibernate.NHibernateUtil.Initialize(loginInfo.Register);
                }
            }
            return(loginInfo);
        }
Exemple #8
0
        public LoginLocal Login(string loginName, string password)
        {
            password = Encipherment.MD5(string.Format("{0}{1}", password, _gbKey)).ToUpper();

            LoginLocal loginInfo = null;

            using (var loginManager = new LoginLocalManager())
            {
                loginInfo = loginManager.Login(loginName, password);
                if (loginInfo != null && loginInfo.User != null)
                {
                    NHibernate.NHibernateUtil.Initialize(loginInfo.User.RoleList);
                    NHibernate.NHibernateUtil.Initialize(loginInfo.Register);
                }
            }
            return(loginInfo);
        }
Exemple #9
0
        public PostFeedbackTestLocal()
        {
            ChromeOptions options = new ChromeOptions();

            options.AddArguments("start-maximized");            // open Browser in maximized mode
            options.AddArguments("disable-infobars");           // disabling infobars
            options.AddArguments("--disable-extensions");       // disabling extensions
            options.AddArguments("--disable-gpu");              // applicable to windows os only
            options.AddArguments("--disable-dev-shm-usage");    // overcome limited resource problems
            options.AddArguments("--no-sandbox");               // Bypass OS security model
            options.AddArguments("--disable-notifications");    // disable notifications

            driver   = new ChromeDriver(options);
            homePage = new HomeLocal(driver);
            homePage.Navigate();

            loginPage = new LoginLocal(driver);
            loginPage.Navigate();

            Assert.Equal(driver.Url, LoginLocal.URI_Local);
            Assert.True(loginPage.UsernameElementDisplayed());
            Assert.True(loginPage.PasswordElementDisplayed());
            Assert.True(loginPage.SubmitButtonElementDisplayed());

            loginPage.InsertUsername("pera");
            loginPage.InsertPassword("pera1978");
            loginPage.SubmitForm();
            loginPage.WaitForHomePage();


            Console.Write(feedbackCount);

            createFeedbackPage = new CreateFeedbackLocal(driver);
            createFeedbackPage.Navigate();

            Assert.True(createFeedbackPage.FeedbackTextboxDisplayed());          // check if form input elements are displayed
            Assert.True(createFeedbackPage.RadioButtonAllowedDisplayed());
            Assert.True(createFeedbackPage.RadioButtonAnonymousDisplayed());
            Assert.True(createFeedbackPage.SubmitButtonDisplayed());
        }
        public LoginLocal LoginAPP(string loginName, string password)
        {
            LoginLocal loginInfo = UserLogin(loginName, password);

            return(loginInfo);
        }
        //private UserAuthentication userAuthentication = new UserAuthentication();
        //public static SystemUser systemUser = new SystemUser();
        //public static SystemRole systemRole = new SystemRole();
        /// <summary>
        /// 用户名(手机)密码登录
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        //        public LoginLocal UserLogin_old(string loginName, string password)
        //        {

        //            var LoginUser = DB.CreateQuery<E_Login_Local>();


        //            String pattern = @"^(0|86|17951)?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8}$";//"^((1[3,5,8][0-9])|(14[5,7])|(17[0,6,7,8])|(19[7]))\\d{8}$";

        //#if LogInfo

        //                    Stopwatch watch = new Stopwatch();
        //              Double opt=0 ,opt1 = 0, opt2 = 0, opt3= 0;
        //            int count=0, count1=0;

        //            watch.Start();
        //#endif
        //            LoginLocal LoginUsers = null;
        //            if (Regex.IsMatch(loginName, pattern))
        //            {
        //                LoginUsers = LoginUser.Where(p => p.mobile == loginName && p.Password == password).Select(p => new LoginLocal
        //                {
        //                    CreateTime = p.CreateTime,
        //                    LoginName = p.LoginName,
        //                    mobile = p.mobile,
        //                    Password = p.Password,
        //                    UserId = p.UserId,

        //                }).FirstOrDefault();
        //            }
        //            else
        //            {
        //                LoginUsers = LoginUser.Where(p => (p.LoginName == loginName) && p.Password == password).Select(p => new LoginLocal
        //                {
        //                    CreateTime = p.CreateTime,
        //                    LoginName = p.LoginName,
        //                    mobile = p.mobile,
        //                    Password = p.Password,
        //                    UserId = p.UserId,

        //                }).FirstOrDefault();
        //            }


        //#if LogInfo
        //            watch.Stop();
        //            opt = watch.Elapsed.TotalMilliseconds;
        //            watch.Reset();
        //            count = DB.CreateQuery<C_Auth_Users>().Count();
        //            count1 = LoginUser.Count();
        //            watch.Stop();
        //#endif
        //            if (LoginUsers != null)
        //            {

        //                LoginUsers.User = (from p in DB.CreateQuery<C_Auth_Users>()
        //                                   where p.UserId == LoginUsers.UserId
        //                                   select new SystemUser()
        //                                   {
        //                                       CreateTime = p.CreateTime,
        //                                       AgentId = p.AgentId,
        //                                       RegFrom = p.RegFrom,
        //                                       UserId = p.UserId,
        //                                   }).FirstOrDefault();


        //                if (LoginUsers.User != null)
        //                {
        //#if LogInfo
        //                    watch.Reset();


        //#endif

        //                    var uQueryRoles = (from p in DB.CreateQuery<C_Auth_Roles>()
        //                                       select p).ToList().Select(p => new SystemRole()
        //                                       {
        //                                           RoleId = p.RoleId,
        //                                           RoleName = p.RoleName,
        //                                           IsInner = p.IsInner,
        //                                           IsAdmin = p.IsAdmin,
        //                                           RoleType = (RoleType)p.RoleType,
        //                                       }).ToList();

        //#if LogInfo


        //                    opt2 = watch.Elapsed.TotalMilliseconds;
        //                    watch.Stop();
        //                    watch.Reset();
        //#endif

        //                    var uQueryUserRole = DB.CreateQuery<C_Auth_UserRole>();
        //                    LoginUsers.User.RoleList = (from b in uQueryRoles
        //                                                join c in uQueryUserRole
        //                                                on b.RoleId equals c.RoleId
        //                                                where c.UserId == LoginUsers.UserId
        //                                                select b).ToList();

        //                    systemUser.RoleList = LoginUsers.User.RoleList;

        //                    var C_Auth_RoleFunction_query = DB.CreateQuery<C_Auth_RoleFunction>();
        //                    // var C_Auth_UserRole_query = DB.CreateQuery<C_Auth_UserRole>();
        //                    var C_Auth_Function_List = DB.CreateQuery<C_Auth_Function_List>();
        //                    //systemRole.FunctionList
        //                    var RoleFunctionList = (from b in C_Auth_RoleFunction_query
        //                                            join d in uQueryUserRole

        //                                            on b.RoleId equals d.RoleId
        //                                            where d.UserId == LoginUsers.UserId
        //                                            select b
        //                                             ).Select(p => new RoleFunction()
        //                                             {
        //                                                 FunctionId = p.FunctionId,
        //                                                 IId = p.IId,
        //                                                 Mode = p.Mode,

        //                                             }).ToList();

        //                    if (RoleFunctionList != null && RoleFunctionList.Count() != 0)
        //                    {

        //                        var Ids = RoleFunctionList.Select(p => p.FunctionId).ToList();
        //                        var Auth_Function_Lists = (from p in DB.CreateQuery<C_Auth_Function_List>()
        //                                                   where Ids.Contains(p.FunctionId)
        //                                                   select new Function()
        //                                                   {
        //                                                       DisplayName = p.DisplayName,
        //                                                       FunctionId = p.FunctionId,
        //                                                       IsBackBasic = p.IsBackBasic,
        //                                                       IsWebBasic = p.IsWebBasic,
        //                                                       ParentId = p.ParentId,
        //                                                       ParentPath = p.ParentPath,
        //                                                   }).ToList();
        //                        systemRole.FunctionList = RoleFunctionList;

        //                    }

        //                    var C_Auth_UserFunction_query = DB.CreateQuery<C_Auth_UserFunction>();
        //                    // var C_Auth_UserRole = DB.CreateQuery<C_Auth_UserRole>();
        //                    var C_Auth_UserFunction_List = DB.CreateQuery<C_Auth_Function_List>();
        //                    //systemRole.FunctionList
        //                    var UserFunctionList = (from b in C_Auth_UserFunction_query
        //                                            join d in uQueryUserRole

        //                                            on b.UserId equals d.UserId
        //                                            where d.UserId == LoginUsers.UserId
        //                                            select b
        //                                             ).ToList().Select(p => new UserFunction()
        //                                             {
        //                                                 FunctionId = p.FunctionId,
        //                                                 IId = p.IId,
        //                                                 Mode = p.Mode,


        //                                             }).ToList();
        //                    systemUser.FunctionList = UserFunctionList;
        //                    if (UserFunctionList != null && UserFunctionList.Count() != 0)
        //                    {

        //                        var Ids = RoleFunctionList.Select(p => p.FunctionId).ToList();
        //                        var Auth_Function_Lists = DB.CreateQuery<C_Auth_Function_List>().Where(p => Ids.Contains(p.FunctionId)).Select(p => new Function()
        //                        {
        //                            DisplayName = p.DisplayName,
        //                            FunctionId = p.FunctionId,
        //                            IsBackBasic = p.IsBackBasic,
        //                            IsWebBasic = p.IsWebBasic,
        //                            ParentId = p.ParentId,
        //                            ParentPath = p.ParentPath,
        //                        }).ToList();
        //                        systemUser.FunctionList = UserFunctionList;

        //                    }

        //                    string userId = LoginUsers.UserId;

        //                    LoginUsers.Register = (from p in DB.CreateQuery<C_User_Register>()
        //                                           where p.UserId == userId
        //                                           select p).ToList().Select(p => new UserRegister()
        //                                           {

        //                                               AgentId = p.AgentId,
        //                                               ComeFrom = p.ComeFrom,
        //                                               CreateTime = p.CreateTime,
        //                                               DisplayName = p.DisplayName,
        //                                               HideDisplayNameCount = p.HideDisplayNameCount,
        //                                               IsAgent = p.IsAgent,
        //                                               IsEnable = p.IsEnable,
        //                                               IsFillMoney = p.IsFillMoney,
        //                                               IsIgnoreReport = p.IsIgnoreReport,
        //                                               ParentPath = p.ParentPath,
        //                                               Referrer = p.Referrer,
        //                                               ReferrerUrl = p.ReferrerUrl,
        //                                               RegisterIp = p.RegisterIp,
        //                                               RegType = p.RegType,
        //                                               UserId = p.UserId,
        //                                               UserType = p.UserType,
        //                                               VipLevel = p.VipLevel
        //                                           }).FirstOrDefault();



        //                    LoginUsers.Register.IsEnable = LoginUsers.Register.IsEnable;

        //#if LogInfo
        //                    watch.Stop();
        //                    opt3 = watch.Elapsed.TotalMilliseconds;
        //                   // watch.Start();
        //#endif

        //                }
        //            }
        //#if LogInfo
        //            Log4Log.LogEX(KLogLevel.SevTimeInfo,  string.Format("查询C_Auth_Users,E_Login_Local 使用时间:{0},COUNT:{1},{2},进入if 开始时间 {3},if 结束时间 {4} \r\n", opt.ToString(),count1.ToString(),
        //                count.ToString(), opt2.ToString(), opt3.ToString()));
        //#endif
        //            return LoginUsers;
        //            //return Session.CreateCriteria<LoginLocal>()
        //            //    .Add(Restrictions.Eq("LoginName", loginName))
        //            //    .Add(Restrictions.Eq("Password", password))
        //            //    .UniqueResult<LoginLocal>();
        //        }

        #endregion

        public LoginLocal UserLogin(string loginName, string password)
        {
            var        LoginUser  = DB.CreateQuery <E_Login_Local>();
            String     pattern    = @"^(0|86|17951)?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8}$";//"^((1[3,5,8][0-9])|(14[5,7])|(17[0,6,7,8])|(19[7]))\\d{8}$";
            LoginLocal LoginUsers = null;

            if (Regex.IsMatch(loginName, pattern))
            {
                LoginUsers = (from p in LoginUser
                              where (p.mobile == loginName && p.Password == password)
                              select new LoginLocal()
                {
                    CreateTime = p.CreateTime,
                    LoginName = p.LoginName,
                    mobile = p.mobile,
                    Password = p.Password,
                    UserId = p.UserId,
                }).FirstOrDefault();
                //LoginUsers = p != null ? new LoginLocal()
                //{
                //    CreateTime = p.CreateTime,
                //    LoginName = p.LoginName,
                //    mobile = p.mobile,
                //    Password = p.Password,
                //    UserId = p.UserId,

                //} : null;
            }
            else
            {
                LoginUsers = (from p in LoginUser
                              where p.LoginName == loginName && p.Password == password
                              select new LoginLocal()
                {
                    CreateTime = p.CreateTime,
                    LoginName = p.LoginName,
                    mobile = p.mobile,
                    Password = p.Password,
                    UserId = p.UserId,
                }).FirstOrDefault();
                //LoginUsers = p != null ? new LoginLocal()
                //{
                //    CreateTime = p.CreateTime,
                //    LoginName = p.LoginName,
                //    mobile = p.mobile,
                //    Password = p.Password,
                //    UserId = p.UserId,

                //} : null;
            }
            if (LoginUsers != null)
            {
                string userId = LoginUsers.UserId;
                LoginUsers.User = (from d in DB.CreateQuery <C_Auth_Users>()
                                   where d.UserId == userId
                                   select new SystemUser()
                {
                    CreateTime = d.CreateTime,
                    AgentId = d.AgentId,
                    RegFrom = d.RegFrom,
                    UserId = d.UserId,
                }).FirstOrDefault();

                //LoginUsers.User = d != null ? new SystemUser()
                //                   {
                //                       CreateTime = d.CreateTime,
                //                       AgentId = d.AgentId,
                //                       RegFrom = d.RegFrom,
                //                       UserId = d.UserId,
                //                   }:null;
                LoginUsers.Register = (from p in DB.CreateQuery <C_User_Register>()
                                       where p.UserId == userId
                                       select new UserRegister()
                {
                    AgentId = p.AgentId,
                    ComeFrom = p.ComeFrom,
                    CreateTime = p.CreateTime,
                    DisplayName = p.DisplayName,
                    HideDisplayNameCount = p.HideDisplayNameCount,
                    IsAgent = p.IsAgent,
                    IsEnable = p.IsEnable,
                    IsFillMoney = p.IsFillMoney,
                    IsIgnoreReport = p.IsIgnoreReport,
                    ParentPath = p.ParentPath,
                    Referrer = p.Referrer,
                    ReferrerUrl = p.ReferrerUrl,
                    RegisterIp = p.RegisterIp,
                    RegType = p.RegType,
                    UserId = p.UserId,
                    UserType = p.UserType,
                    VipLevel = p.VipLevel
                }).FirstOrDefault();
            }
            return(LoginUsers);
        }
        public CommonActionResult UserRegister(RegisterInfo_Local regInfo, string fxid)
        {
            DB.Begin();
            try
            {
                string userId  = null;
                var    roleIds = ConfigHelper.AllConfigInfo["PageRegisterDefaultRole"].ToString().Split(',');
                #region 注册权限控制帐号

                var authBiz    = new GameBizAuthBusiness();
                var regBiz     = new RegisterBusiness();
                var userEntity = new SystemUser
                {
                    RegFrom = string.IsNullOrEmpty(regInfo.ComeFrom) ? "LOCAL" : regInfo.ComeFrom,
                    AgentId = regInfo.AgentId,
                };
                regBiz.RegisterUser(userEntity, roleIds);
                userId = userEntity.UserId;

                #endregion

                #region 注册核心系统显示帐号

                var userRegInfo = new UserRegInfo
                {
                    DisplayName = regInfo.LoginName,
                    ComeFrom    = string.IsNullOrEmpty(regInfo.ComeFrom) ? "LOCAL" : regInfo.ComeFrom,
                    Referrer    = regInfo.Referrer,
                    ReferrerUrl = regInfo.ReferrerUrl,
                    RegisterIp  = regInfo.RegisterIp,
                    RegType     = regInfo.RegType,
                    AgentId     = regInfo.AgentId,
                };

                regBiz.RegisterUser(userEntity, userRegInfo);

                #endregion

                #region 注册本地登录帐号

                var loginBiz    = new LocalLoginBusiness();
                var loginEntity = new LoginLocal
                {
                    LoginName = regInfo.LoginName,
                    Password  = regInfo.Password,
                    mobile    = regInfo.Mobile
                };
                loginBiz.Register(loginEntity, userEntity.UserId);

                #endregion

                #region 如果是通过代理链接注册,则设置用户返点 屏蔽:范
                if (!string.IsNullOrEmpty(regInfo.AgentId))
                {
                    SetUserRebate(userId, regInfo.AgentId);
                }

                #endregion

                #region 初始化用户战绩数据和中奖概率数据

                InitUserBeedingAndBounsPercent(userId);

                #endregion

                #region 初始化其它数据

                InitBlog_ProfileBonusLevel(userId);
                InitUserAttentionSummary(userId);

                #endregion

                #region fxid分享推广数据
                if (!string.IsNullOrEmpty(fxid))
                {
                    var manager = new BlogManager();
                    manager.AddBlog_UserShareSpread(new E_Blog_UserShareSpread
                    {
                        UserId               = userId,
                        AgentId              = fxid,
                        CreateTime           = DateTime.Now,
                        isGiveLotteryRedBag  = false,
                        isGiveRegisterRedBag = false,
                        UpdateTime           = DateTime.Now,
                        giveRedBagMoney      = 0,
                        isGiveRechargeRedBag = false
                    });
                }
                #endregion

                DB.Commit();

                return(new CommonActionResult
                {
                    IsSuccess = true,
                    Message = "注册成功",
                    ReturnValue = userId,
                });
            }
            catch (Exception ex) {
                DB.Rollback();
                throw ex;
            }
        }