Exemplo 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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get Logo location for a client.
        /// </summary>
        /// <param name="clientUID"></param>
        /// <param name="curEnvironment"> </param>
        /// <returns></returns>
        public static string GetClientLogoLocation(int clientUID, HeaderInfo headerInfo, string curEnvironment = MackkadoITFramework.Helper.Utils.EnvironmentList.LOCAL)
        {
            string logoPath     = "";
            string logoName     = "";
            string logoPathName = "";

            Utils.FCMenvironment = curEnvironment;

            // Get Company Logo
            //
            //ReportMetadata rmd = new ReportMetadata();
            //rmd.ClientUID = clientUID;
            //rmd.RecordType = Utils.MetadataRecordType.CLIENT;
            //rmd.FieldCode = "COMPANYLOGO";

            //rmd.Read(clientUID: clientUID, fieldCode: "COMPANYLOGO");

            //Client client = new Client(headerInfo);
            //client.UID = clientUID;
            //client.Read();

            var    resp   = RepClient.Read(clientUID);
            Client client = new Client();

            client = resp.client;

            // Set no icon image if necessary
            //
            logoPath = FCMConstant.SYSFOLDER.LOGOFOLDER;
            logoName = "imgNoImage.jpg";

            if (client.Logo1Location != null)
            {
                logoName = client.Logo1Location.Replace(FCMConstant.SYSFOLDER.LOGOFOLDER, string.Empty);
            }

            logoPathName = Utils.getFilePathName(logoPath, logoName);

            return(logoPathName);
        }