private void CreateDataSheet(ExcelHelp xls, DataTableInfo tableInfo, bool isTarget)
        {
            DatabaseAcsesser dba = new DatabaseAcsesser();

            DatabaseAcsesser.DbConnections connType = isTarget ? DatabaseAcsesser.DbConnections.TargetDbConnection
                                                               : DatabaseAcsesser.DbConnections.SourceDbConnection;
            TableLayoutInfo info = dba.GetTableLayout(connType, tableInfo.TableName);

            Excel.Worksheet templateSheet = xls.WorkBook.Sheets["Template"];
            Excel.Worksheet sheet         = xls.CreateSheet(tableInfo.SheetName, templateSheet);
            int             colIndex      = 0;

            xls.WriteValue(sheet, 1, 2, info.TableName);
            foreach (ColumnInfo column in info.Columns)
            {
                colIndex++;
                xls.WriteValue(sheet, STRAT_ROW, colIndex, column.ColumnName);
                if (!string.IsNullOrEmpty(column.DisplayName))
                {
                    string comment = column.DisplayName + "\n" + column.GetSqlType();
                    sheet.Range[xls.GetColumnName(colIndex, STRAT_ROW)].AddComment(comment);
                }
                if (column.IsPrimaryKey)
                {
                    Excel.Range cell = sheet.Range[xls.GetColumnName(colIndex, STRAT_ROW)];
                    cell.Font.Color = Excel.XlRgbColor.rgbRed;
                }
            }
            xls.AddListObject(sheet, STRAT_ROW, STRAT_ROW + 1, colIndex, tableInfo.TableName);
            SetColumnFormat(info, sheet);
            sheet.Columns.AutoFit();
            sheet.Tab.Color = isTarget ? Excel.XlRgbColor.rgbBlue : Excel.XlRgbColor.rgbRed;
        }
Example #2
0
        /// <summary>
        /// データベースから、採番された新生産計画NOを取得する
        /// </summary>
        /// <param name="oldNo"></param>
        /// <returns></returns>
        private string GetNewProductionNoFromDb(string oldNo)
        {
            DatabaseAcsesser dba    = new DatabaseAcsesser();
            string           planNo = dba.GetProductionPlanNo(oldNo);

            //コレクションに追加
            this._productionPlanNos.Add(oldNo, planNo);
            return(planNo);
        }
        private TableLayoutInfo GetTableLayoutInfo(string tableName, bool isTarget)
        {
            DatabaseAcsesser dba = new DatabaseAcsesser();

            DatabaseAcsesser.DbConnections connType = isTarget ? DatabaseAcsesser.DbConnections.TargetDbConnection
                                                               : DatabaseAcsesser.DbConnections.SourceDbConnection;
            TableLayoutInfo info = dba.GetTableLayout(connType, tableName);

            return(info);
        }
Example #4
0
        /// <summary>
        /// データベースから、採番された新稼動計画NOを取得する
        /// </summary>
        /// <param name="oldNo">旧稼動計画キー(設備コード + '|' + 稼動日)</param>
        /// <returns></returns>
        private string GetNewOperationNoFromDb(string oldNo)
        {
            string           facilityCode  = oldNo.Split('|')[0];
            string           operationDate = oldNo.Split('|')[1];
            DatabaseAcsesser dba           = new DatabaseAcsesser();
            string           planNo        = dba.GetOperationPlanNo(facilityCode, operationDate);

            //コレクションに追加
            this._operationPlanNos.Add(oldNo, planNo);
            return(planNo);
        }
Example #5
0
        private void CheckExpectData(ExcelAccessor xlsAdo, DataTableInfo info)
        {
            try
            {
                DatabaseAcsesser dbAdo     = new DatabaseAcsesser();
                DataTable        dttResult = dbAdo.GetResultData(info.TableName);
                DataTable        dttSchema = dttResult.Clone();

                DataTable dttExpect = xlsAdo.GetTableData(info.SheetName, info.TableName, dttSchema, 2, Config.MaxDataCount + 2);
                //データ比較する
                DiffDataSouce(info, dttExpect, dttResult);
            }
            catch (Exception ex)
            {
                Logging.Exception("", ex);
                throw ex;
            }
        }