Ejemplo n.º 1
0
        public IDataLink CreateLink(string connectionString)
        {
            TextLink tl = new TextLink();

            tl.Initialize(connectionString);
            return(tl);
        }
Ejemplo n.º 2
0
 public void Initialize(IDataLink link)
 {
     _link = link as TextLink;
 }
Ejemplo n.º 3
0
 public void Initialize(IDataLink link)
 {
     _link = link as TextLink;
 }
Ejemplo n.º 4
0
        public ActionResult Mapping()
        {
            string tempfileName = Session["import_file_path"].ToString();
            bool isFirstRowHeader = Request["IsFirstRowHeader"] == "on" ? true : false;
            string rowDelimiter = Request["RowDelimiter"];
            string columnDelimiter= Request["ColumnDelimiter"];
            string tableName = Request["TableName"];

            ImportInfo imfo = new ImportInfo();
            imfo.DestinationTableName = tableName;
            imfo.ImportFileLocation = tempfileName;
            imfo.FirstRowHasColumnNames = isFirstRowHeader;
            imfo.RowDelimiter = TemplateToString(rowDelimiter);
            imfo.ColumnDelimiter = TemplateToString(columnDelimiter);

            StringBuilder sbConn = new StringBuilder();
            sbConn.Append("@File=");
            sbConn.Append(tempfileName);
            sbConn.Append(";@Type=Delimited;");
            sbConn.Append("RowSeperator=");
            sbConn.Append(imfo.RowDelimiter);
            sbConn.Append(";ColumnSeperator=");
            sbConn.Append(imfo.ColumnDelimiter);
            sbConn.Append(";FirstRowHasNames=");
            sbConn.Append(imfo.FirstRowHasColumnNames.ToString());

            SqlDataLink sqlLink = new SqlDataLink();
            sqlLink.Initialize(ConfigurationManager.AppSettings["SqlConnection"]);
            sqlLink.Connect();
            ColumnDefinition[] sqlCds = sqlLink.GetSchema("SELECT * FROM " + imfo.DestinationTableName);
            imfo.DestinationColumns = sqlCds;

            TextLink tl = new TextLink();
            tl.Initialize(sbConn.ToString());
            tl.Connect();

            ColumnDefinition[] cds = tl.GetSchema("");
            List<string> columns = new List<string>();
            foreach (ColumnDefinition cd in cds)
            {
                columns.Add(cd.ColumnName);
            }
            imfo.SourceColumns = columns.ToArray();
            return View(imfo);
        }
Ejemplo n.º 5
0
 public IDataLink CreateLink(string connectionString)
 {
     TextLink tl = new TextLink();
     tl.Initialize(connectionString);
     return tl;
 }