Пример #1
0
        // GET: Account
        public ActionResult Login()
        {
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Browse_item", "Rent"));
            }
            LoginTag loginModel = new LoginTag();

            return(View());
        }
Пример #2
0
        public bool VerifyUserByLoginAndPassword(LoginTag loginModel)
        {
            using (var db = new RentContext())
            {
                var user = db.Users.FirstOrDefault(m => m.Login == loginModel.Login && m.Password == loginModel.Password);
                if (user != null)
                {
                    return(true);
                }

                return(false);
            }
        }
Пример #3
0
 public ActionResult Login(LoginTag loginModel)
 {
     if (ModelState.IsValid)
     {
         if (_accountService.VerifyUserByLoginAndPassword(loginModel))
         {
             FormsAuthentication.SignOut();
             FormsAuthentication.SetAuthCookie(loginModel.Login, true);
             return(RedirectToAction("Index", "Home"));
         }
     }
     return(View());
 }
Пример #4
0
        public static bool ging(LoginTag s)//注销是的标记清除
        {
            string     sql = "UPDATE    LoginTag    SET  state=0,sign = ' '   WHERE     (userid = " + s.userid + ")";
            SqlCommand com = new SqlCommand();

            q.OpenConnect();
            com.CommandText = sql;
            com.Connection  = q.Connect;
            int sd = com.ExecuteNonQuery();

            q.CloseConnect();
            if (sd > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        public static bool sing(LoginTag s)//登录时的标记
        {
            string     sql = " update LoginTag set sign='" + s.singe + "' where userid= " + s.userid + "";
            SqlCommand com = new SqlCommand();

            q.OpenConnect();
            com.CommandText = sql;
            com.Connection  = q.Connect;
            int sd = com.ExecuteNonQuery();

            q.CloseConnect();
            if (sd > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        }//同意好友申请

        public LoginTag login(string id, string pwd)//登陆
        {
            if (!db.Enter(id, pwd))
            {
                return(null);
            }
            myEventHandler = new ChatEventHandler(MyEventHandler);//将MyEventHandler方法作为参数传递给委托
            if (!chatters.ContainsKey(id) && id != "" && id != null)
            {
                this.id = id;
                chatters.Add(id, MyEventHandler);
            }
            LoginTag lt = new LoginTag();

            lt.singe  = Guid.NewGuid().ToString();
            lt.userid = id;
            db.sing(lt);
            cb = OperationContext.Current.GetCallbackChannel <IClientcallback>(); //获取当前操作客户端实例的通道给IChatCallback接口的实例callback,此通道是一个定义为IChatCallback类型的泛类型,通道的类型是事先服务契约协定好的双工机制。
            ChatEventArgs e = new ChatEventArgs();                                //实例化事件消息类ChatEventArgs

            e.msgType = MessageType.UserEnter;
            e.name    = id;
            return(lt);
        }
Пример #7
0
 public bool logout(LoginTag l)
 {
     Leave();
     return(db.ging(l));
 }//下线
Пример #8
0
        public ActionResult Login()
        {
            LoginTag loginModel = new LoginTag();

            return(View(loginModel));
        }