public void UpdateUserInfo(Framework.User thisUser)
 {
     Login.Utilities.DataIO oDataIO = new Login.Utilities.DataIO();
     oDataIO.UpdateUserDetails(thisUser);
 }
 public void UpdateProxy(Proxie ThisProxie)
 {
     Login.Utilities.DataIO oDataIO = new Login.Utilities.DataIO();
     oDataIO.UpdateProxieDetails(ThisProxie);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool LogIn(string username, string password)
        {
            bool rtn = false;
            try
            {
                Framework.Utilities.SessionManagement sessionmanagement = new Framework.Utilities.SessionManagement();
                User user = new User();

                Framework.Utilities.Session session = sessionmanagement.Session();
                user.UserName = username;

                //ZAP - need to do an MD5 Hash on the password
                user.Password = password;

                Login.Utilities.DataIO dataio = new Login.Utilities.DataIO();
                dataio.UserLogin(ref user, ref session);

                if (user.Roles != null)
                {
                    rtn = true;
                }

                this.SaveUser(user);

            }
            catch (Exception ex)
            {
                //ZAP- need an error log.
                ex = ex;
                rtn = false;
            }

            //ZAP-  need to cross this bridge soon
            //Find out if they have a profile
            //If they have a profile Get the users proxies

            return rtn;
        }
 public void GetUserProxies(Int32 UserID)
 {
     Login.Utilities.DataIO oDataIO = new Login.Utilities.DataIO();
     System.Data.DataTable dt = new System.Data.DataTable();
     oDataIO.GetUserProxies(dt, UserID, 0, "N", "Y", "Y", "Y");
     User thisUser = new User();
     foreach (System.Data.DataRow dr in dt.Rows) {
         Proxie newProxy = new Proxie("");
         newProxy.Proxy = Convert.ToInt32(dr[0]);
         thisUser.Proxies.Add(newProxy);
     }
 }
        public User GetUserDetails(string UserID)
        {
            Login.Utilities.DataIO oDataIO = new Login.Utilities.DataIO();
            User thisUser = new User();
            SqlDataReader dbreader = oDataIO.GetUserDetails(UserID);
            dbreader.Read();
            thisUser.PersonID = dbreader["PersonID"].ToString();
            thisUser.UserID = (Int32)dbreader["UserID"];
            thisUser.IsActive = dbreader["IsActive"].ToString();
            thisUser.CanBeProxy = dbreader["CanBeProxy"].ToString();
            thisUser.FirstName = dbreader["FirstName"].ToString();
            thisUser.LastName = dbreader["LastName"].ToString();
            thisUser.DisplayName = dbreader["DisplayName"].ToString();
            thisUser.OfficePhone = dbreader["OfficePhone"].ToString();
            thisUser.EmailAddr = dbreader["EmailAddr"].ToString();
            thisUser.InstitutionFullName = dbreader["InstitutionFullName"].ToString();
            thisUser.DepartmentFullName = dbreader["DepartmentFullName"].ToString();
            thisUser.DivisionFullName = dbreader["DivisionFullName"].ToString();
            thisUser.UserName = dbreader["UserName"].ToString();
            thisUser.Password = dbreader["Password"].ToString();
            thisUser.PasswordFormat = dbreader["PasswordFormat"].ToString();
            thisUser.PasswordQuestion = dbreader["PasswordQuestion"].ToString();
            thisUser.PasswordAnswer = dbreader["PasswordAnswer"].ToString();
            thisUser.InternalUserName = dbreader["InternalUserName"].ToString();
            thisUser.InternalLDAPUserName = dbreader["InternalLDAPUserName"].ToString();

            if (!dbreader.IsClosed)
                dbreader.Close();

            return thisUser;
        }
 public Proxie GetProxieDetails(Int32 UserID, string ProxyDefaultID, Int32 Proxy)
 {
     Proxie thisProxy = new Proxie(ProxyDefaultID);
     Login.Utilities.DataIO oDataIO = new Login.Utilities.DataIO();
     System.Data.DataTable dt = new System.Data.DataTable();
     oDataIO.GetUserProxies(dt, UserID, Proxy, "N", "Y", "Y", "Y");
     if (dt.Rows.Count > 0){
         thisProxy.ProxyDefaultID = ProxyDefaultID;
         thisProxy.IsHidden = 'N';
         thisProxy.EditName = (Int16)dt.Rows[0]["EditName"];
         thisProxy.EditPhoto = (Int16)dt.Rows[0]["EditPhoto"];
         thisProxy.EditTitles = (Int16)dt.Rows[0]["EditTitles"];
         thisProxy.EditEmail  = (Int16)dt.Rows[0]["EditEmail"];
         thisProxy.EditAddress = (Int16)dt.Rows[0]["EditAddress"];
         thisProxy.EditEducation = (Int16)dt.Rows[0]["EditEducation"];
         thisProxy.EditAwards = (Int16)dt.Rows[0]["EditAwards"];
         thisProxy.EditNarrative = (Int16)dt.Rows[0]["EditNarrative"];
         thisProxy.EditPublications = (Int16)dt.Rows[0]["EditPublications"];
         thisProxy.EditWebsites = (Int16)dt.Rows[0]["EditWebsites"];
     }
     return thisProxy;
 }