/// <summary>
 /// Create a new TAA_Microsite object.
 /// </summary>
 /// <param name="micrositeID">Initial value of the MicrositeID property.</param>
 /// <param name="teamName">Initial value of the TeamName property.</param>
 /// <param name="primaryColour">Initial value of the PrimaryColour property.</param>
 /// <param name="secondaryColour">Initial value of the SecondaryColour property.</param>
 /// <param name="accent">Initial value of the Accent property.</param>
 /// <param name="enabled">Initial value of the Enabled property.</param>
 /// <param name="locked">Initial value of the Locked property.</param>
 /// <param name="createdOnDate">Initial value of the CreatedOnDate property.</param>
 /// <param name="deleted">Initial value of the Deleted property.</param>
 public static TAA_Microsite CreateTAA_Microsite(global::System.Int32 micrositeID, global::System.String teamName, global::System.String primaryColour, global::System.String secondaryColour, global::System.String accent, global::System.Boolean enabled, global::System.Boolean locked, global::System.DateTime createdOnDate, global::System.Boolean deleted)
 {
     TAA_Microsite tAA_Microsite = new TAA_Microsite();
     tAA_Microsite.MicrositeID = micrositeID;
     tAA_Microsite.TeamName = teamName;
     tAA_Microsite.PrimaryColour = primaryColour;
     tAA_Microsite.SecondaryColour = secondaryColour;
     tAA_Microsite.Accent = accent;
     tAA_Microsite.Enabled = enabled;
     tAA_Microsite.Locked = locked;
     tAA_Microsite.CreatedOnDate = createdOnDate;
     tAA_Microsite.Deleted = deleted;
     return tAA_Microsite;
 }
Example #2
0
        private static void SaveLogo(string sceneServerImage, TAA_Microsite taamicrosite, string logRootPath)
        {
            try
            {
                var newguid = Guid.NewGuid(); // Microsite is not created so make sure Image filenames are unique
                var fileName = Path.GetFileName(sceneServerImage);

                var newPath = Path.Combine(logRootPath, taamicrosite.MicrositeID.ToString());
                if (!Directory.Exists(newPath))
                    Directory.CreateDirectory(newPath);
                var webClient = new WebClient();
                var filepath = string.Format("{0}/{1}~!~{2}", newPath, newguid.ToString(), fileName);
                webClient.DownloadFile(sceneServerImage, filepath);
                var image = Image.FromFile(filepath);
                var header = ImageManipulation.ResizeImage(image, new Size(310, 60)); // site header
                var thumb = ImageManipulation.ResizeImage(image, new Size(82, 64));
                // thumb for microsite search results

                // using ~!~ as delimiter so later we can extract the original filename
                header.Save(newPath + "/header.jpg"); // Microsite Header
                thumb.Save(newPath + "/thumb.jpg"); // Thumbnail used in Search results

                image.Dispose();
                header.Dispose();
                thumb.Dispose();
                if (entity.TAA_MicrositeLogos.Any(p => p.MicrositeID == taamicrosite.MicrositeID))
                    return;
                TAA_MicrositeLogos logo = new TAA_MicrositeLogos();
                logo.CreatedByUserID = -1;
                logo.CreatedOnDate = taamicrosite.CreatedOnDate;
                logo.Logo = fileName;
                logo.LogoName = Path.GetFileNameWithoutExtension(fileName);
                logo.MicrositeID = taamicrosite.MicrositeID;
                logo.Deleted = false;
                entity.TAA_MicrositeLogos.AddObject(logo);

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the TAA_Microsite EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTAA_Microsite(TAA_Microsite tAA_Microsite)
 {
     base.AddObject("TAA_Microsite", tAA_Microsite);
 }