public static Session Create(string name, string password,string mandant, DataAccessLayer.NetworkState state)
		{
			if (state == DataAccessLayer.NetworkState.Disconnected)
			{
				var session = new Session();
				session.ID = null;
				session.UserID = null;
				return session;
			}
			else
			{
				DataAccessLayer.DAL_Session dal_Session = new DataAccessLayer.DAL_Session ();
				var session = new Session();
				dal_Session.GetSession (ref session,name,password,mandant,state);
				return session;
			}
		} 
Пример #2
0
        public static User Create( string name, string password, string mandant, DataAccessLayer.NetworkState state)
        {

            DataAccessLayer.DAL_Session dal_Session = new DataAccessLayer.DAL_Session ();
            var session = BusinessLayer.Session.Create ();

            // First the Name and Password have to be authiticated
            if (dal_Session.GetSession (ref session,name,password,mandant,state) == DataAccessLayer.SOAResult.Disconnected)
            {
                // Then there is a connection failure
                return null;
            }

            var user = new User ();

            if (session.Success == DataAccessLayer.SOAResult.FALSE)
            {
                // Username and Password were wrong, return an empty object
                return user;    
            }


            DataAccessLayer.DAL_User dal_User = new DataAccessLayer.DAL_User ();

            user.IdSession = session.ID;
            user.ID = session.UserID;
            user._Abteilung = session.Abteilung;
            user.Name = name;
            user.Password = password;
            user.Mandant = mandant;
            user.NetworkStatus = state;


            if (state != DataAccessLayer.NetworkState.Disconnected)
                dal_User.SetUserPermissions (ref user);

            return user;


        }