Exemple #1
0
        /// <summary>
        /// Iterate across all files matching pattern in specified path and produce a collection
        /// of billStatus objects.
        /// </summary>
        /// <param name="path">Path to directory caontaining XML files</param>
        /// <param name="searchPattern">Search pattern for file names in the path</param>
        /// <returns></returns>
        public static IEnumerable <billStatus> GetBillStatuses(string path, string searchPattern)
        {
            var rollCalls = new List <billStatus>();

            string[] files = Directory.GetFiles(path, searchPattern);
            foreach (var file in files)
            {
                string content = File.ReadAllText(file);
                if (content.Length == 0)
                {
                    Console.WriteLine($"File: {file} was skipped because it was empty");
                }
                else
                {
                    try
                    {
                        rollCalls.Add(XmlSerialization.DeSerialize <billStatus>(RemoveProblematicXml(content)));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"File: {file} had a formatting exception");
                    }
                }
            }
            return(rollCalls);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string ruleid = Request.Form["ruleid"];

                    //Get Rule
                    eChartProject.Model.eChart.server_contents_rule modelans = new eChartProject.Model.eChart.server_contents_rule();
                    DataSet ds = RuleBll.GetList(" ID=" + int.Parse(ruleid));

                    if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        string   strRule = ds.Tables[0].Rows[0]["Rule1"].ToString();
                        TableEnt te      = new TableEnt();
                        te = XmlSerialization <TableEnt> .DeSerialize(strRule);

                        strRule = te.TableInfo.Name + "&" + te.FieldInfo.Name;
                        Response.Write(strRule);
                        Response.End();
                    }
                }
                catch
                {
                }
            }
        }