コード例 #1
0
        public static void WriteFile(string fName)
        {
            SedimentAccretionDET det = new SedimentAccretionDET();

            det.Id    = Guid.NewGuid();
            det.Owner = "Dr. Frank N. Furter, ESQ";
            ExcelSedimentAccretionDET excel = new ExcelSedimentAccretionDET(det);

            CreateListOfPhonySurveys(det, 4);
            CreateListOfPhonyElevations(det, 4);
            CreateListOfPhonySites(det, 4);
            excel.Save(fName);
        }
コード例 #2
0
        public static void ReadFile(string fName)
        {
            Console.WriteLine("reading workbook named [{0}]", fName);
            SedimentAccretionDET      det   = new SedimentAccretionDET();
            ExcelSedimentAccretionDET excel = new ExcelSedimentAccretionDET(det);

            excel.Load(fName);
            ValidationIssues issues = det.ValidationIssues;

            if (issues.Count > 0)
            {
                foreach (ValidationIssue issue in issues)
                {
                    Console.WriteLine(issue.IssueMessage);
                }
                return;
            }
            Console.WriteLine("Custom property Name: {0}, Value: {1}", "oncorID", det.Id);
            Console.WriteLine("Custom property Name: {0}, Value: {1}", "oncorOwner", det.Owner);
            int count = 1;

            foreach (var dto in det.Surveys.Values)
            {
                Console.WriteLine("Survey Row: {0}, Value: {1}", count++, dto);
            }
            count = 1;
            foreach (var dto in det.Elevations.Values)
            {
                Console.WriteLine("Elevation Row: {0}, Value: {1}", count++, dto);
            }
            count = 1;
            foreach (var dto in det.Sites.Values)
            {
                Console.WriteLine("Site Row: {0}, Value: {1}", count++, dto);
            }
            Console.WriteLine("Closing workbook named [{0}]", fName);
        }