示例#1
0
文件: Login.aspx.cs 项目: gaea/BMS
        public string Authenticate(string login, string password)
        {
            Users user = UsersDao.findBy("Login", login);
            ActionResponse actionResponse = new ActionResponse();

            actionResponse.Success = true;

            if (user != null)
            {
                if (user.Password == password)
                {
                    actionResponse.Data.Url = "Desktop.aspx";
                }
                else
                {
                    actionResponse.Data.Message = "Password invalido";
                }
            }
            else
            {
                actionResponse.Data.Message = "El usuario no existe";
            }

            return actionResponse.ToJsonString();
        }
        public string Acept(int Id_Authorization)
        {
            ActionResponse msg = new ActionResponse();

            try
            {
                TMA.MODEL.Entity.Authorization authorization = AuthorizationsDao.find(Id_Authorization);
                authorization.Authorized = true;
                AuthorizationsDao.update(authorization);
                msg.Success = true;

                msg.Data.Message = ConfigManager.SaveSuccessMessage;
            }
            catch (Exception ex)
            {
                msg.Success = false;
                msg.Data.Message = ConfigManager.SaveErrorMessage;
                msg.Data.Error = ex.ToString();
            }

            return serialize.Serialize(msg);
        }