public bool CheckUser(string account, string pwd, out bool firstRun, out bool approve)
        {
            firstRun = false;
            approve  = false;

            Alading.Web.Entity.User user = Alading.Web.Bussiness.UserService.GetUserByAccount(account);
            if (user != null && user.Password == pwd)
            {
                if (account == "sa")
                {
                    firstRun = true;
                    approve  = true;
                }
                else if (user.FirstRun && user.Approve)
                {
                    firstRun = true;
                    //user.FirstRun = false;
                    approve = user.Approve;
                    //Alading.Web.Bussiness.UserService.UpdateUser(user);
                }
                else
                {
                    firstRun = user.FirstRun;
                    approve  = user.Approve;
                }
                return(true);
            }
            return(false);
        }
 public List <Shop> GetShop(string account, string psw)
 {
     if (!account.Contains(":"))
     {
         Alading.Web.Entity.User u = Alading.Web.Bussiness.UserService.GetUser(account, psw);
         if (u != null)
         {
             return(Alading.Web.Bussiness.ShopService.GetShopList(u.UserCode));
         }
     }
     return(null);
 }
Beispiel #3
0
 public static void AddUser(Alading.Web.Entity.User user)
 {
     using (AladingWebEntities context = ContextProvider.DataContext(ConnectionHelper.ConnectionString))
     {
         if (user.Account.Contains(":"))
         {
             string mainAccount = user.Account.Substring(0, user.Account.IndexOf(":"));
             var    x           = context.User.Where(p => p.Account == mainAccount).FirstOrDefault();
             x.HasUser++;
         }
         context.AddToUser(user);
         context.SaveChanges();
     }
 }
Beispiel #4
0
        void UserRegisterControl1_OnSubmitButtonClick(object sender, EventArgs e)
        {
            string account = UserRegisterControl1.Account;

            if (account.Contains(":"))
            {
                string msg = "<script type='text/javascript'>alert('用户帐号不能包含(:)冒号')</script>";
                Response.Write(msg);
                return;
            }

            Alading.Web.Entity.User x = Alading.Web.Bussiness.UserService.GetUserByAccount(mainUser.Account + ":" + account);
            if (x != null)
            {
                string msg = "<script type='text/javascript'>alert('用户帐号重复')</script>";
                Response.Write(msg);
            }
            else
            {
                if (mainUser != null && mainUser.MaxUser > mainUser.HasUser)
                {
                    Alading.Web.Entity.User user = new Alading.Web.Entity.User();
                    user.UserName = UserRegisterControl1.UserName;
                    user.Account  = mainUser.Account + ":" + UserRegisterControl1.Account;
                    user.Address  = UserRegisterControl1.Address;
                    user.Company  = UserRegisterControl1.Company;
                    user.Mobile   = UserRegisterControl1.Mobile;
                    user.Password = HashProvider.GetHash(UserRegisterControl1.Password);
                    user.Tel      = UserRegisterControl1.Tel;
                    user.UserCode = System.Guid.NewGuid().ToString();
                    user.MaxShop  = 0;
                    user.MaxUser  = 0;
                    user.FirstRun = true;
                    user.Approve  = true;
                    Alading.Web.Bussiness.UserService.AddUser(user);

                    Response.Redirect("~/UserInfo.aspx");
                }
            }
        }