private void OLDLogoDoubleClick(object sender, EventArgs e) { // Show file dialog var file = openFileDialog1.ShowDialog(); if (file == DialogResult.OK) { // Only File Name string fileName = openFileDialog1.SafeFileName; // Full Path including file name string fullPathFileName = openFileDialog1.FileName; // Extract File Path string pathOnly = fullPathFileName.Replace(fileName, ""); // Get Company Logo // ReportMetadata rmd = new ReportMetadata(); rmd.ClientUID = Utils.ClientID; rmd.RecordType = FCMConstant.MetadataRecordType.CLIENT; rmd.FieldCode = "COMPANYLOGO"; rmd.Read(clientUID: Utils.ClientID, fieldCode: "COMPANYLOGO"); rmd.InformationType = MackkadoITFramework.Helper.Utils.InformationType.IMAGE; rmd.ClientType = ""; rmd.CompareWith = ""; rmd.Description = "Company"; // rmd.Condition = fullPathFileName; var logoFolder = CodeValue.GetCodeValueExtended(FCMConstant.CodeTypeString.SYSTSET, FCMConstant.SYSFOLDER.LOGOFOLDER); // rmd.Condition = logoFolder + fileName; // The intention is to save the reference path %XXX% // rmd.Condition = FCMConstant.SYSFOLDER.LOGOFOLDER + fileName; txtLogo1Location.Text = rmd.Condition; rmd.Save(); Bitmap MyImage; pbxLogo.SizeMode = PictureBoxSizeMode.StretchImage; if (rmd.Condition != null) { // MyImage = new Bitmap(rmd.Condition); string logoLocation = logoFolder + fileName; MyImage = new Bitmap(logoLocation); pbxLogo.Image = (Image)MyImage; } } }
/// <summary> /// Read logo display flag /// </summary> private static void ReadLogoStatus(Client.Client eventClient) { // Update Logo Display Status // ReportMetadata rmd = new ReportMetadata(); rmd.ClientUID = Utils.ClientID; rmd.RecordType = Utils.MetadataRecordType.CLIENT; rmd.FieldCode = Utils.FieldCode.COMPANYLOGO; if (rmd.Read(clientUID: Utils.ClientID, fieldCode: Utils.FieldCode.COMPANYLOGO)) { eventClient.DisplayLogo = rmd.Enabled; } }
// ----------------------------------------------------- // List clients // ----------------------------------------------------- internal static List <Client> List(HeaderInfo headerInfo) { var clientList = new List <Client>(); using (var connection = new SqlConnection(ConnString.ConnectionString)) { var commandString = string.Format( " SELECT " + ClientFieldString() + " FROM [Client] " + " WHERE IsVoid = 'N' " + " ORDER BY UID ASC " ); using (var command = new SqlCommand( commandString, connection)) { connection.Open(); try { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var client = new Client(); Client.LoadClientObject(reader, client); // Retrieve status of the logo. Enabled or disabled // 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); }
/// <summary> /// Update logo display flag /// </summary> private static void UpdateLogoStatus(Client.Client eventClient) { // Update Logo Display Status // var rmd = new ReportMetadata { ClientUID = Utils.ClientID, RecordType = Utils.MetadataRecordType.CLIENT, FieldCode = Utils.FieldCode.COMPANYLOGO }; if (rmd.Read(clientUID: Utils.ClientID, fieldCode: Utils.FieldCode.COMPANYLOGO)) { rmd.Enabled = eventClient.DisplayLogo; rmd.Save(); } return; }