Пример #1
0
        public Defeitos_Links(Projeto projeto, TypeUpdate typeUpdate, alm.Database database)
        {
            this.projeto    = projeto;
            this.typeUpdate = typeUpdate;
            this.database   = database;

            sqlMaker2Param        = new SqlMaker2Param();
            sqlMaker2Param.fields = new List <Field>();

            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Subprojeto", source = "'{Subprojeto}'", key = true
            });
            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Entrega", source = "'{Entrega}'", key = true
            });
            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Id", source = "LN_LINK_ID", type = "N", key = true
            });
            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Defeito", source = "LN_BUG_ID", type = "N"
            });
            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Tabela", source = "LN_ENTITY_TYPE"
            });
            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Tabela_Id", source = "LN_ENTITY_ID"
            });
            this.sqlMaker2Param.fields.Add(new Field()
            {
                target = "Atualizador", source = "upper(LN_CREATED_BY)"
            });

            if (database.name == "ALM11")
            {
                this.sqlMaker2Param.fields.Add(new Field()
                {
                    target = "Dt_Alteracao", source = "to_char(ln_creation_date,'dd-mm-yy')"
                });
            }
            else
            {
                this.sqlMaker2Param.fields.Add(new Field()
                {
                    target = "Dt_Alteracao", source = "substr(ln_vts,9,2) || '-' || substr(ln_vts,6,2) || '-' || substr(ln_vts,3,2) || ' ' || substr(ln_vts,12,8)"
                });
            }

            this.sqlMaker2Param.dataSource = @"{Esquema}.link";
            this.sqlMaker2Param.dataSourceFilterCondition = "";
            this.sqlMaker2Param.targetTable = "alm_defeitos_links";

            this.sqlMaker2Param.targetSqlLastIdInserted = $"select max(id) from alm_defeitos_links where subprojeto='{projeto.Subprojeto}' and entrega='{projeto.Entrega}'";
            this.sqlMaker2Param.targetSqlLastDateUpdate = $"select Defeitos_Links_Incremental_Inicio from alm_projetos where subprojeto='{projeto.Subprojeto}' and entrega='{projeto.Entrega}'";

            this.sqlMaker2Param.dataSourceFilterConditionInsert = $" ln_bug_id > {this.sqlMaker2Param.targetLastIdInserted}";
            this.sqlMaker2Param.dataSourceFilterConditionUpdate = $" to_char(ln_creation_date,'yy-mm-dd') > '{this.sqlMaker2Param.targetLastDateUpdate}'";

            this.sqlMaker2Param.typeDB = "ORACLE";
        }