Ejemplo n.º 1
0
        private bool checkUser()
        {
            bool retVal = true;

            using (var db = new CroceRossaEntities())
            {
                Usr usr = db.Usr.FirstOrDefault(x => x.UsrNam.Equals(UserTextBox.Text.ToString()));
                if (usr == null)
                {
                    retVal = false;
                }
                else
                {
                    if (KriptoEntity.DecryptString(usr.UsrPsw) != PasswordBox.Password.ToString())
                    {
                        retVal = false;
                    }
                    else
                    {
                        GlobalInfo.LoggedUser = usr.toUserEntity();
                    }
                }
            }

            return(retVal);
        }
Ejemplo n.º 2
0
        public static UserEntity toUserEntity(this Usr usr)
        {
            UserEntity user;

            if (usr == null)
            {
                return(new UserEntity());
            }
            else
            {
                user = new UserEntity(usr.UsrOwnId, usr.UsrNam, KriptoEntity.DecryptString(usr.UsrPsw), usr.UsrTyp[0]);
            }

            return(user);
        }