/// <summary>
        /// This method will add the URL in the xml directly from a bulk add using the Enterprise Mode Site List Manager.
        /// </summary>
        /// <param name="tickets">Array of Tickets model objects</param>
        /// <returns>bool</returns>
        public bool AddToV2XMLBulk(Tickets[] tickets)
        {
            Configuration config = null;

            if (LoginController.config == null)
            {
                using (ConfigurationController configController = new ConfigurationController())
                {
                    config = configController.GetConfiguration();
                }
            }
            else
            {
                config = LoginController.config;
            }

            bool saved = false;

            foreach (Tickets ticket in tickets)
            {
                xmlHelper.AddToV2XMLBulk(ticket, config, !saved);

                if (!saved)
                {
                    saved = true;
                }
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// get values from config setting files by key
        /// </summary>
        /// <param name="Key"></param>
        /// <returns></returns>
        private static string GetValueLFromConfigSettings(string Key)
        {
            ConfigurationController config     = new ConfigurationController();
            Configuration           configdata = null;

            if (LoginController.config == null)
            {
                configdata = config.GetConfiguration();
            }
            else
            {
                configdata = LoginController.config;
            }
            if (configdata != null)
            {
                var configkey = configdata.ConfigSettings.Find(x => x.key.Equals(Key));
                if (configkey != null)
                {
                    string loginURL = configdata.ConfigSettings.Find(x => x.key.Equals(Key)).value.ToString();
                    return(loginURL);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Get configuration settings at the start and store it to global variable
 /// </summary>
 public JsonResult GetConfigurationAtStart()
 {
     using (ConfigurationController configController = new ConfigurationController())
     {
         config = configController.GetConfiguration();
         if (config.ConfigSettings.Count > 2)
         {
             return(Json(false, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(true, JsonRequestBehavior.AllowGet));
         }
     }
 }
        /// <summary>
        /// This method check URL entered in the XML list, the method will check if the loaded XML file is
        /// v1 or v2 version, and will check if the particular file contains the URL, and accordingly gives the result
        /// </summary>
        /// <param name="findString"></param>
        /// <returns>bool</returns>
        public bool CheckUrl(Uri findString)
        {
            Configuration config = null;

            if (LoginController.config == null)
            {
                using (ConfigurationController configController = new ConfigurationController())
                {
                    config = configController.GetConfiguration();
                }
            }
            else
            {
                config = LoginController.config;
            }
            return(xmlHelper.CheckUrl(findString, config));
        }
        /// <summary>
        /// This method will decide which method to call based on the version of XML
        /// </summary>
        /// <param name="ticket">ticket object has to be passed as first parameter</param>
        /// <param name="operation">Operation enumeration parameter</param>
        /// <example>OperationOnXML(ticketObject, Operation.ProductionRollBack)</example>
        public void OperationOnXML(Tickets ticket, Operation operation)
        {
            Configuration config = null;

            if (LoginController.config == null)
            {
                using (ConfigurationController configController = new ConfigurationController())
                {
                    config = configController.GetConfiguration();
                }
            }
            else
            {
                config = LoginController.config;
            }
            xmlHelper.OperationOnXML(ticket, operation, config);
        }
        /// <summary>
        /// this method will get all the websites from the production and sent to the tool to be diaplyed
        /// and it also reads all the comments to extract the application information
        /// </summary>
        /// <returns>this function returns the application info and the xml string</returns>
        public JsonResult getSitesFromProduction()
        {
            Configuration config = null;

            if (LoginController.config == null)
            {
                using (ConfigurationController configController = new ConfigurationController())
                {
                    config = configController.GetConfiguration();
                }
            }
            else
            {
                config = LoginController.config;
            }
            string xmlData = xmlHelper.getProductionSites(config);

            //XDocument prodXml = XDocument.Parse(xmlData);
            //var comments = (from node in prodXml.Elements().DescendantNodesAndSelf()
            //                where node.NodeType == XmlNodeType.Comment
            //                select node.ToString()).ToList();
            //List<Dictionary<string,string>> sitesInformation = new List<Dictionary<string,string>>();
            //foreach (var comment in comments)
            //{
            //    Dictionary<string,string> name = new Dictionary<string,string>();
            //    string[] check = { Constants.spacing.ToString(), System.Environment.NewLine };
            //    var info = comment.Split(check, StringSplitOptions.None);
            //    foreach (var site in info)
            //    {
            //        if (site.IndexOf(Constants.Owner) != -1)
            //            name["Owner"] = site.Substring(site.IndexOf(Constants.Owner) + Constants.Owner.Length);
            //        if (site.IndexOf(Constants.Name) != -1)
            //            name["Name"] = site.Substring(site.IndexOf(Constants.Name) + Constants.Name.Length);
            //        if (site.IndexOf(Constants.TicketId) != -1)
            //            name["TicketId"] = site.Substring(site.IndexOf(Constants.TicketId) + Constants.TicketId.Length);
            //    }
            //    sitesInformation.Add(name);
            //}
            //var data = new { comments = sitesInformation,xmlData };
            return(Json(xmlData, JsonRequestBehavior.AllowGet));
        }