private static List <Logs> Get_Logs_Defeitos(Projeto projeto, Defeito defeito, alm.Database database) { Connection SGQConn = new Connection(); string Esquema = SGQConn.Get_String($"select Esquema from ALM_Projetos where subprojeto = '{projeto.Subprojeto}' and entrega = '{projeto.Entrega}'"); string Encaminhado_Para = "bg_user_template_09".ToUpper(); SGQConn.Dispose(); if (defeito.Ultima_Data == null) { defeito.Ultima_Data = "1901-01-01 01:01:01"; } string sql_Logs = $@" select to_char(au_time,'yyyy-mm-dd hh24:mi:ss') as Data, ap_field_name as Campo, ap_new_value as Valor, au_user as Operador from {Esquema}.audit_properties inner join {Esquema}.audit_log on ap_action_id = au_action_id inner join {Esquema}.bug on au_entity_id = bg_bug_id where (au_entity_type = 'BUG') and (ap_field_name = 'BG_STATUS' or ap_field_name = '{Encaminhado_Para}') and (au_entity_id = {defeito.Id}) order by au_time"; //.Replace("{Ultima_Data}", defeito.Ultima_Data); ALMConnection ALMConn = new ALMConnection(database); //List<Logs> List_Logs = new List<Logs>(); //List_Logs = ALMConn.Executar<Logs>(sql_Logs); List <Logs> List_Logs = ALMConn.Executar <Logs>(sql_Logs); ALMConn.Dispose(); return(List_Logs); }
//public void LoadData_Tudo(TypeUpdate typeUpdate) { // this.LoadData_Testes(typeUpdate); // this.LoadData_Steps(typeUpdate); // this.LoadData_CTs(typeUpdate); // this.LoadData_Execucoes(typeUpdate); // //this.LoadData_Defeitos(typeUpdate); // this.LoadData_Defeitos_Links(typeUpdate); // this.LoadData_Defeitos_Tempos(typeUpdate); // this.LoadData_Historicos(typeUpdate); //} //select // p.Id, // convert(varchar, cast(substring(p.subprojeto,4,8) as int)) + ' ' + convert(varchar,cast(substring(p.entrega,8,8) as int)) as Nome, // p.Dominio as Dominio, // p.Subprojeto as Subprojeto, // p.Entrega as Entrega, // p.template as Template, // p.Esquema as Esquema, // p.Ativo as Ativo // --right('00'+ convert(varchar,r.release_mes),2) + '/' + convert(varchar,r.release_ano) as release, // --(select count(*) from alm_cts cts where cts.subprojeto = p.subprojeto and cts.entrega = p.entrega) as qtyCts //from // ALM_Projetos p // left join sgq_projects // on sgq_projects.subproject = p.subprojeto and // sgq_projects.delivery = p.entrega //where // p.Ativo = 'Y' and // p.Entrega not in ('ENTREGA_UNIF', 'ENTREGA_UNIF2') and // ( // p.subprojeto like 'TRG%' // or // right('0000' + convert(varchar(4), isnull(currentReleaseYear,0)),4) + right('00' + convert(varchar(2), isnull(currentReleaseMonth,0)),2) >= right('0000' + convert(varchar(4), datepart(yyyy, dateadd(m, -1, getdate()))),4) + right('00' + convert(varchar(2), datepart(m, dateadd(m, -1, getdate()))),2) // or // right('0000' + convert(varchar(4), isnull(clarityReleaseYear,0)),4) + right('00' + convert(varchar(2), isnull(clarityReleaseMonth,0)),2) >= right('0000' + convert(varchar(4), datepart(yyyy, dateadd(m, -1, getdate()))),4) + right('00' + convert(varchar(2), datepart(m, dateadd(m, -1, getdate()))),2) // ) // --Dt_Ultimo_Update_ALM is not null and // --convert(datetime, Dt_Ultimo_Update_ALM, 5) > (getdate() - 7) //order by // (select count(*) from alm_cts cts where cts.subprojeto = p.subprojeto and cts.entrega = p.entrega) public string Get_Dt_Ultimo_Update_ALM() { ALMConnection ALMConn = new ALMConnection(this.Esquema); string sql = $@" select max(Dt_Ultimo_Update) from ( select max(ts_vts) as Dt_Ultimo_Update from {this.Esquema}.test union all select max(ds_vts) as Dt_Ultimo_Update from {this.Esquema}.DesSteps union all select max(tc_vts) as Dt_Ultimo_Update from {this.Esquema}.testcycl union all select max(bg_vts) as Dt_Ultimo_Update from {this.Esquema}.bug union all select max(rn_vts) as Dt_Ultimo_Update from {this.Esquema}.run union all select max(cast(to_char(au_time, 'yyyy-mm-dd hh24:mi:ss') as char(20))) as Dt_Ultimo_Update from {this.Esquema}.audit_log ) "; string Dt_Ultimo_Update = ALMConn.Get_String_(sql); ALMConn.Dispose(); if (Dt_Ultimo_Update != "") { Dt_Ultimo_Update = Dt_Ultimo_Update.Substring(8, 2) + "-" + Dt_Ultimo_Update.Substring(5, 2) + "-" + Dt_Ultimo_Update.Substring(2, 2) + " " + Dt_Ultimo_Update.Substring(11, 8); } return(Dt_Ultimo_Update); }