Ejemplo n.º 1
0
 public static List<Permission_Object> SelectAll()
 {
     string SelectQuery = @"Select * from [Permission]";
     List<Permission_Object> result = new List<Permission_Object>();
     DataTable tb = commonDatabase.GetSQLDataTable(clsConnectionString.GetConnectionString(), SelectQuery);
     foreach (DataRow row in tb.Rows)
     {
         Permission_Object newObject = new Permission_Object();
         newObject.Id = int.Parse(row["Id"].ToString());
         newObject.Name = (string)row["Name"];
         newObject.Role = row["Role"].ToString();
         result.Add(newObject);
     }
     return result;
 }
Ejemplo n.º 2
0
 public static Permission_Object Find(int Id)
 {
     string SelectQuery = @"Select * from [Permission] where Id=@Id";
     List<SqlParameter> sps = new List<SqlParameter>();
     sps.Add(new SqlParameter("Id",Id));
     Permission_Object result = new Permission_Object();
     DataTable tb = commonDatabase.GetSQLDataTable(clsConnectionString.GetConnectionString(), SelectQuery,sps);
     if (tb.Rows.Count>0)
     {
         result.Id = int.Parse(tb.Rows[0]["Id"].ToString());
         result.Name = tb.Rows[0]["Name"].ToString();
         result.Role = tb.Rows[0]["Role"].ToString();
     }
     return result;
 }