Exemple #1
0
 public User getUser(string code)
 {
     try
     {
         OpenConnection();
         MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(User.GetByExactCodeSQL(code));
         cmd.Connection = m_connection;
         MySql.Data.MySqlClient.MySqlDataReader r = cmd.ExecuteReader();
         User u = User.TransformReader(r);
         r.Close();
         if (u == null)
         {
             return(null);
         }
         FormAccess p = new FormAccess();
         MySql.Data.MySqlClient.MySqlCommand    aCommand = new MySql.Data.MySqlClient.MySqlCommand(FormAccess.GetAllByUserSQL(u.ID), m_connection);
         MySql.Data.MySqlClient.MySqlDataReader aReader  = aCommand.ExecuteReader();
         IList a = p.GetAll(aReader);
         aReader.Close();
         foreach (FormAccess fa in a)
         {
             u.FORM_ACCESS_LIST.Add(fa.CODE, fa);
         }
         return(u);
     }
     catch (Exception x)
     {
         throw new Exception(getErrorMessage(x));
     }
     finally
     {
         m_connection.Close();
     }
 }
Exemple #2
0
 public User GetFormAccessByUserID(User userID)
 {
     try
     {
         OpenConnection();
         FormAccess p = new FormAccess();
         MySql.Data.MySqlClient.MySqlCommand    aCommand = new MySql.Data.MySqlClient.MySqlCommand(FormAccess.GetAllByUserSQL(userID.ID), m_connection);
         MySql.Data.MySqlClient.MySqlDataReader aReader  = aCommand.ExecuteReader();
         IList a = p.GetAll(aReader);
         foreach (FormAccess fa in a)
         {
             userID.FORM_ACCESS_LIST.Add(fa.CODE, fa);
         }
         return(userID);
     }
     catch (Exception x)
     {
         throw new Exception(getErrorMessage(x));
     }
     finally
     {
         m_connection.Close();
     }
 }