public override MembershipUser GetUser(string username, bool userIsOnline)
    {
        zdkUserModel loggedUser = new zdkUserModel();
        UserModelDAL umd        = new UserModelDAL();

        UserModel currentUser = umd.GetByUserName(username);

        if (null != currentUser)
        {
            loggedUser.DistrictID   = currentUser.DistrictID;
            loggedUser.DistrictName = currentUser.DistrictName;
            loggedUser.Email        = currentUser.Email;
            loggedUser.FriendlyName = currentUser.FirstName;
            loggedUser.FacilitiesID = currentUser.FacilitiesID;
            loggedUser.Password     = currentUser.Password;
            loggedUser.User         = currentUser;

            if (currentUser.ServerAdmin == true)
            {
                //for ServerAdmin impersonation reasons

                if (null != currentUser.ImpersonatedID)
                {
                    loggedUser.ImpersonatedName = umd.GetById((Guid)currentUser.ImpersonatedID).UserName;
                }
                else
                {
                    loggedUser.ImpersonatedName = currentUser.UserName;
                }
            }
        }
        return(loggedUser);
    }
        private void addNewUser()
        {
            string newPassword = "";

            string s = "1";

            if (!String.IsNullOrEmpty(s))
            {
                // Key exists
                if ("1" == s)
                {
                    UserModel usm;
                    usm = umDal.GetByUserName("drone");

                    if (null == usm)
                    {
                        //create admin
                        newPassword  = "******";
                        usm          = new UserModel();
                        usm.UserName = "******";
                        usm.Password = newPassword;
                        usm.Email    = "*****@*****.**";
                        usm.Password = mp.EncryptPassword(usm.Password);

                        umDal.Insert(usm);
                    }
                }
            }
        }
    public override bool ValidateUser(string username, string password)
    {
        UserModel currentUser = default(UserModel);

        zdkMembershipProvider zdkmp = new zdkMembershipProvider();
        string encPassword          = zdkmp.EncryptPassword(password);

        UserModelDAL umd = new UserModelDAL();

        //to set password for testing
        ////UserModel eraseMe = new UserModel();
        ////eraseMe.Password = encPassword;
        //umd.Update(eraseMe);

        currentUser = umd.GetByUserName(username);// userRep.GetByUserName(username);

        if (currentUser != null)
        {
            if ((currentUser.Password == encPassword) && (true == currentUser.IsActive)) //password)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }