예제 #1
0
        public static int Insert(ObjtableInfo item)
        {
            string sql = string.Format("INSERT INTO MDS_IMP_OBJTABLE_INFO(FID,OBJECT_TABLE_CODE,OBJECT_TABLE_NAME,STATUS,CREATED_BY,CREATION_DATE,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_IP,VERSION) ");

            sql += string.Format("VALUES('{0}','{1}','{2}','{3}','{4}',to_date('{5}','yyyy/mm/dd hh24:mi:ss'),'{6}',to_date('{7}','yyyy/mm/dd hh24:mi:ss'),'{8}',{9})",
                                 item.FID, item.ObjectTableCode, item.ObjectTableName, item.Status, item.CreatedBy,
                                 item.CreationDate, item.LastUpdatedBy, item.LastUpdateDate, item.LastUpdateIp, item.Version);

            return(OracleHelper.Excuse(sql));
        }
예제 #2
0
        public static List <ObjtableInfo> getList()
        {
            List <ObjtableInfo> result = new List <ObjtableInfo>();

            string sql = "SELECT * FROM MDS_IMP_OBJTABLE_INFO";

            DataSet ds = OracleHelper.Query(sql);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ObjtableInfo item = ObjtableInfo.Parse(dr);
                result.Add(item);
            }

            return(result);
        }
예제 #3
0
        private void insertTableStructure(string tableName)
        {
            DataTable dt = GetDataTable(txtTemplageFile.Text);

            if (scripts.Count(it => it.TableName == tableName) == 0)
            {
                // 创建表
                TableDAL.CreateTable(tableName, dt);
                // 添加主键
                //TableDAL.SetPrimary(txtTableName.Text, "ID");
                // 添加扩展列
                TableDAL.AddAttribute(tableName, 20);

                int count = ObjtableInfoDAL.Count(tableName.ToUpper());
                if (count == 0)
                {
                    ObjtableInfo oinfo = new ObjtableInfo();
                    oinfo.FID             = Guid.NewGuid().ToString().Replace("-", "");
                    oinfo.CreatedBy       = MainWindow.UserID;
                    oinfo.LastUpdatedBy   = MainWindow.UserID;
                    oinfo.ObjectTableCode = tableName.ToUpper();
                    oinfo.ObjectTableName = tableName.ToUpper();
                    oinfo.Status          = "02";
                    oinfo.Version         = 1;
                    oinfo.LastUpdateIp    = "127.0.0.1";
                    oinfo.LastUpdateDate  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    oinfo.CreationDate    = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    ObjtableInfoDAL.Insert(oinfo);
                }
            }
            else
            {
                // 追加表结构
                TableDAL.CreateTable(tableName, dt);
            }

            DataScriptMapDAL.AutoScriptMap(FID, dt, tableName, MainWindow.UserID);
        }
예제 #4
0
        private void nextButton_Click(object sender, RoutedEventArgs e)
        {
            string erromsg = "";

            if (string.IsNullOrEmpty(txtTemplageFile.Text.Trim()))
            {
                erromsg += "请选择样例文件!\r\n";
            }

            if (Des_Table.SelectedIndex == -1)
            {
                erromsg += "请选择目标数据表!\r\n";
            }

            if (Des_Table.SelectedIndex == 0 && string.IsNullOrEmpty(txtTableName.Text))
            {
                erromsg += "请输入数据表名称!\r\n";
            }

            if (Des_Table.SelectedIndex == 0 && string.IsNullOrEmpty(txtTableCode.Text))
            {
                erromsg += "请输入数据表代码!\r\n";
            }


            if (cbSave.IsChecked.Value)
            {
                if (string.IsNullOrEmpty(MidsScriptCode.Text.Trim()))
                {
                    erromsg += "请输入解析器编码!\r\n";
                }
                else
                {
                    if (!checkCode())
                    {
                        erromsg += "解析器编码重复!\r\n";
                    }
                }
                if (string.IsNullOrEmpty(MidsScriptName.Text.Trim()))
                {
                    erromsg += "请输入解析器名称!\r\n";
                }
            }

            if (!string.IsNullOrEmpty(erromsg))
            {
                MessageBox.Show(erromsg);
                return;
            }

            builderScript();


            if (cbSave.IsChecked.Value)
            {
                insert();
            }
            DataTable dt = new DataTable();

            if (FileType.SelectedValue.ToString() == "xls/xlsx")
            {
                dt = ExcelImportHelper.GetDataTable(txtTemplageFile.Text.Trim());
            }
            else
            {
                dt = TextImportHelper.GetDataTable(txtTemplageFile.Text.Trim(), DataScriptRule.getColSeperatorChar(GetColSperator()));
            }

            TableDAL.CreateTable(txtTableCode.Text.ToUpper(), dt);

            int count = ObjtableInfoDAL.Count(txtTableCode.Text.ToUpper());

            if (count == 0)
            {
                ObjtableInfo oinfo = new ObjtableInfo();
                oinfo.FID             = Guid.NewGuid().ToString().Replace("-", "");
                oinfo.CreatedBy       = MainWindow.UserID;
                oinfo.LastUpdatedBy   = MainWindow.UserID;
                oinfo.ObjectTableCode = txtTableCode.Text.ToUpper();
                oinfo.ObjectTableName = txtTableName.Text;
                oinfo.Status          = "02";
                oinfo.Version         = 1;
                oinfo.LastUpdateIp    = "127.0.0.1";
                oinfo.LastUpdateDate  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                oinfo.CreationDate    = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                ObjtableInfoDAL.Insert(oinfo);
            }

            ImportMapModify mapModify = new ImportMapModify();

            mapModify.FID            = FID;
            mapModify.DataScriptRule = dRule;
            mapModify.DataScript     = dScript;
            mapModify.sourceFile     = txtTemplageFile.Text.Trim();
            mapModify.isAutoDrawLine = true;

            ImportStack.Push(this);
            MainWindow window = App.Current.MainWindow as MainWindow;

            window.StartPage(mapModify);
        }