Subversion Repository Public Repository

ChrisCompleteCodeTrunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PremierMigration
{
    public class DocuwareIdPath
    {
        public int DWDOCID { get; set; }
        public string Path { get; set; }
        public int PageCount { get; set; }
        public string ConversionCommand { get; set; }
        public string ExportPdfFilePath { get; set; }
        public string Cabinet { get; set; }
        public DataSet IndexData { get; set; }

        public DocuwareIdPath(int dwDocId, string path, int pageCount)
        {
            DWDOCID = dwDocId;
            Path = path;
            PageCount = pageCount;
            ConversionCommand = String.Empty;
            ExportPdfFilePath = String.Empty;
        }

        public List<FileInfo> GetCalulatedPages()
        {
            List<FileInfo> result = new List<FileInfo>();
            int DWDOCIDcounter = DWDOCID;
            int PageCountCounter = 1;
            while (DWDOCIDcounter != (DWDOCID + PageCount))
            {
                result.Add(
                    new FileInfo(System.IO.Path.Combine(Path, DWDOCIDcounter.ToString("00000000") + "." + PageCountCounter.ToString("000")))
                );
                PageCountCounter++;
                DWDOCIDcounter++;
            }
            return result;
        }

        public string IndexValuesSql(String cabinet)
        {
            string result = "SELECT ";
            OleDbConnection oleDbConnection = Program.GetNewOleDbConnection();
            OleDbCommand oleDbCommand = new OleDbCommand("usp_GetTableColumns", oleDbConnection);
            oleDbCommand.CommandType = CommandType.StoredProcedure;
            oleDbCommand.CommandText = "usp_GetTableColumns";
            oleDbCommand.Parameters.AddWithValue("@TableName", cabinet);
            oleDbCommand.Connection = oleDbConnection;
            OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(oleDbCommand);
            oleDbDataAdapter.SelectCommand = oleDbCommand;

            DataSet dataSet = new DataSet();
            oleDbDataAdapter.Fill(dataSet);
            oleDbDataAdapter.Dispose();
            oleDbConnection.Close();
            oleDbConnection.Dispose();
            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                result += "[" + row["ColumnName"].ToString() + "], ";
                
            }
            result = result.Substring(0, result.Length - 2);
            result += " FROM [dbo].[" + cabinet + "] WHERE [DWDOCID] = " + DWDOCID.ToString();
            Console.WriteLine(result);
            return result;            
        }

    };
}

Commits for ChrisCompleteCodeTrunk/PremierMigration/PremierMigration/DocuwareIdPath.cs

Diff revisions: vs.
Revision Author Commited Message
1 BBDSCHRIS picture BBDSCHRIS Wed 22 Aug, 2018 20:08:03 +0000