Esempio n. 1
0
        private void loadReportNameCombo()
        {
            cmbReportName.Items.Clear();
            ReportMappingCollection collection = getReportMappingCollection();
            IList <report_mapping>  tempList   = new List <report_mapping>();

            foreach (ReportSetting reportSetting in this.reportSettingList)
            {
                foreach (report_mapping mapping in collection)
                {
                    if (mapping.ExternalName == reportSetting.ReportName)
                    {
                        tempList.Add(mapping);
                    }
                }
            }

            foreach (report_mapping mapping in tempList)
            {
                collection.Remove(mapping);
            }

            foreach (report_mapping mapping in collection)
            {
                cmbReportName.Items.Add(mapping.ExternalName);
            }
        }
Esempio n. 2
0
        private IList <ReportSetting> getReportSettingList(string[] fileList)
        {
            List <ReportSetting> tempList = new List <ReportSetting>();
            XmlDocument          doc      = new XmlDocument();

            for (int i = 0; i < fileList.Length; ++i)
            {
                string reportName = string.Empty;
                Stream stream     = null;
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(ReportSetting));
                    stream = File.Open(fileList[i], FileMode.Open, FileAccess.Read);
                    ReportSetting reportSetting = serializer.Deserialize(stream) as ReportSetting;
                    reportSetting.SettingFilePath = fileList[i];
                    tempList.Add(reportSetting);
                }
                catch
                {
                    //ignore exception
                }
            }

            ReportMappingCollection collection        = getReportMappingCollection();
            IList <ReportSetting>   reportSettingList = new List <ReportSetting>();

            foreach (report_mapping mapping in collection)
            {
                foreach (ReportSetting reportSetting in tempList)
                {
                    if (reportSetting.ReportName == mapping.ExternalName)
                    {
                        reportSettingList.Add(reportSetting);
                    }
                }
            }

            //foreach (ReportSetting reportSetting in reportSettingList)
            //{
            //    tempList.Remove(reportSetting);
            //}

            //foreach (ReportSetting reportSetting in tempList)
            //{
            //    File.Delete(reportSetting.SettingFilePath);
            //}

            return(reportSettingList);
        }
Esempio n. 3
0
        private static ReportMappingCollection getReportMappingCollection()
        {
            Stream stream = null;

            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(ReportMappingCollection));
                stream = File.Open(Application.StartupPath + @"/report_mapping_list.xml", FileMode.Open, FileAccess.Read);
                ReportMappingCollection collection = serializer.Deserialize(stream) as ReportMappingCollection;
                return(collection);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }