public static UserTypeData getType(int user_id)
        {
            //p_get_type_user_by_id
            UserTypeData type = null;

            try
            {
                using (MySqlConnection conn = new MySqlConnection(App.setting.connectString))
                {
                    conn.Open();
                    string query = "fc_get_type_user_by_id";
                    using (MySqlCommand cmd = new MySqlCommand(query, conn))
                    {
                        cmd.Parameters.Add(new MySqlParameter("@_user_id", MySqlDbType.Int32)
                        {
                            Direction = System.Data.ParameterDirection.Input, Value = user_id
                        });
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.ExecuteScalar();

                        using (MySqlDataReader reader = cmd.ExecuteReader())
                        {
                            type = reader.toTypeUser();
                        }
                    };
                    conn.Close();
                };
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.GetBaseException().ToString());
            }
            return(type);
        }
 public static List<UserTypeData> toTypeUsers(this MySqlDataReader reader)
 {
     if (reader.HasRows)
     {
         List<UserTypeData> results = new List<UserTypeData>();
         while (reader.Read())
         {
             if (!reader.IsDBNull(0))
             {
                 UserTypeData type = new UserTypeData();
                 type.Id = reader.GetInt32(Define.type_id);
                 type.Name = reader.GetString(Define.type_name);
                 type.Status = reader.GetBoolean(Define.type_status);
                 type.DefaultPermision = Permision.Read(reader.GetString(Define.default_permision));
                 type.Icon = reader.GetString(Define.type_icon);
                 results.Add(type);
             }
         }
         return results;
     }
     return null;
 }