Beispiel #1
0
        private void ResetColors()
        {
            var clientManager = new ApplicationUtilities.Classes.ClientManager();

            // Get the Clients XML file
            //string clientFileName = ConfigurationManager.AppSettings["ClientDetailsRootPath"];
            clientManager.FileName = Path.Combine(Request.PhysicalApplicationPath, "App_Data", "Clients.xml");

            //Initializing the Client Details
            var clientDetails = clientManager.GetSingle(Global.Core.ClientName);

            string color1, color2;

            if (ConfigurationManager.AppSettings["DefaultColor1"] != null)
            {
                color1 = ConfigurationManager.AppSettings["DefaultColor1"].Trim();
            }
            else
            {
                color1 = "#6CAEE0";
            }
            if (ConfigurationManager.AppSettings["DefaultColor2"] != null)
            {
                color2 = ConfigurationManager.AppSettings["DefaultColor2"].Trim();
            }
            else
            {
                color2 = "#FCB040";
            }
            //Assign the values to the Client
            clientDetails.Color1 = color1;
            clientDetails.Color2 = color2;
            clientDetails.Save();
            string existFile = Path.Combine(
                Request.PhysicalApplicationPath,
                "Images",
                "ClientLogos"
                // HttpContext.Current.Session["ClientName"] + ".png"
                );

            string[] files = Directory.GetFiles(existFile);
            existFile = Array.Find(files, n => n.Contains(HttpContext.Current.Session["ClientName"].ToString()));
            if (File.Exists(existFile))
            {
                File.Delete(existFile);
                File.Copy(Path.Combine(
                              Request.PhysicalApplicationPath,
                              "Images",
                              "ClientLogos",
                              "default.png"
                              ), existFile);
            }
        }
Beispiel #2
0
        private void GetClientDetails()
        {
            var clientManager = new ApplicationUtilities.Classes.ClientManager
            {
                //FileName = ConfigurationManager.AppSettings["ClientDetailsRootPath"]
                FileName = Path.Combine(Request.PhysicalApplicationPath, "App_Data", "Clients.xml")
            };

            //Initializing the Client Details
            var clientDetails = clientManager.GetSingle(Global.Core.ClientName);

            HttpContext.Current.Session["ClientName"] = clientDetails.Name;
            colorpickerField1.Value = clientDetails.Color1;
            colorpickerField2.Value = clientDetails.Color2;
            divMainColor.Style.Add("background-color", clientDetails.Color1);
            div2ndColor.Style.Add("background-color", clientDetails.Color2);
            // Getting the Client Logo
            imgbtnChangeLogo.ImageUrl = "/Images/ClientLogos/" + clientDetails.Name + ".png?" + DateTime.Now.ToString("ddyyhhmmss");
            var imageFilepath = Path.Combine(Request.PhysicalApplicationPath, "Images", "ClientLogos", clientDetails.Name + ".png");

            if (File.Exists(imageFilepath))
            {
                using (var img = System.Drawing.Image.FromFile(imageFilepath))
                {
                    if (img.Height > 150)
                    {
                        imgbtnChangeLogo.Height = 150;
                    }
                    if (img.Width > 150)
                    {
                        imgbtnChangeLogo.Width = 150;
                    }
                }
            }
            else
            {
                imgbtnChangeLogo.ImageUrl = "/Images/ClientLogos/default.png?" + DateTime.Now.ToString("ddyyhhmmss");
                var noimage = Path.Combine(Request.PhysicalApplicationPath, "Images", "ClientLogos", "default.png");
                using (var img = System.Drawing.Image.FromFile(noimage))
                {
                    if (img.Height > 150)
                    {
                        imgbtnChangeLogo.Height = 100;
                    }
                    if (img.Width > 150)
                    {
                        imgbtnChangeLogo.Width = 100;
                    }
                }
            }
        }
Beispiel #3
0
        private void SaveToXml()
        {
            var clientManager = new ApplicationUtilities.Classes.ClientManager();

            // Get the Clients XML file
            //string clientFileName = ConfigurationManager.AppSettings["ClientDetailsRootPath"];
            clientManager.FileName = Path.Combine(Request.PhysicalApplicationPath, "App_Data", "Clients.xml");

            //Initializing the Client Details
            var clientDetails = clientManager.GetSingle(Global.Core.ClientName);

            //Assign the values to the Client
            clientDetails.Color1 = "#" + colorpickerField1.Value.Trim().Replace("#", "");
            clientDetails.Color2 = "#" + colorpickerField2.Value.Trim().Replace("#", "");
            clientDetails.Save();
        }