Ejemplo n.º 1
0
        // -----------------------------------------------------
        //    List clients
        // -----------------------------------------------------
        public static List <Client> List(HeaderInfo _headerInfo)
        {
            var clientList = new List <Client>();

            using (var connection = new MySqlConnection(ConnString.ConnectionString))
            {
                var commandString = string.Format(
                    " SELECT " +
                    ClientFieldString() +
                    "   FROM Client " +
                    "  WHERE IsVoid = 'N' " +
                    "  ORDER BY UID ASC "
                    );

                using (var command = new MySqlCommand(
                           commandString, connection))
                {
                    connection.Open();

                    try
                    {
                        using (MySqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var client = new Client(_headerInfo);
                                RepClient.LoadClientObject(reader, client);

                                // Retrieve status of the logo. Enabled or disabled
                                //
                                // 26.01.2013
                                // The attribute is now stored on the Client Table
                                //
                                //var rmd = new ReportMetadata();
                                //rmd.Read(client.UID, ReportMetadata.MetadataFieldCode.COMPANYLOGO);

                                //client.DisplayLogo = rmd.Enabled;

                                clientList.Add(client);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string error = ex.ToString();
                        LogFile.WriteToTodaysLogFile(ex.ToString(), _headerInfo.UserID, "", "Client.cs");
                    }
                }
            }

            return(clientList);
        }