public void LoadData() { DateTime Dt_Inicio = DateTime.Now; ALMConnection ALMConn = new ALMConnection(this.database); Connection SGQConn = new Connection(); SqlMaker2 sqlMaker2 = new SqlMaker2() { sqlMaker2Param = this.sqlMaker2Param }; if (typeUpdate == TypeUpdate.Increment || typeUpdate == TypeUpdate.IncrementFullUpdate) { if (typeUpdate == TypeUpdate.IncrementFullUpdate) { SGQConn.Executar($"update SGQ_Parametros set Valor = '0000-00-00 00:00:00' where Nome='ALM_Usuarios_Update'"); } string Sql_Insert = sqlMaker2.Get_Oracle_Insert().Replace("{Esquema}", this.database.scheme); OracleDataReader DataReader_Insert = ALMConn.Get_DataReader(Sql_Insert); if (DataReader_Insert != null && DataReader_Insert.HasRows == true) { SGQConn.Executar(ref DataReader_Insert, 1); } string Sql_Update = sqlMaker2.Get_Oracle_Update().Replace("{Esquema}", this.database.scheme); OracleDataReader DataReader_Update = ALMConn.Get_DataReader(Sql_Update); if (DataReader_Update != null && DataReader_Update.HasRows == true) { SGQConn.Executar(ref DataReader_Update, 1); } } else if (typeUpdate == TypeUpdate.Full) { SGQConn.Executar($"truncate table ALM_Usuarios"); string Sql_Insert = sqlMaker2.Get_Oracle_Insert().Replace("{Esquema}", this.database.scheme); OracleDataReader DataReader_Insert = ALMConn.Get_DataReader(Sql_Insert); if (DataReader_Insert != null && DataReader_Insert.HasRows == true) { SGQConn.Executar(ref DataReader_Insert, 1); } } SGQConn.Executar($"update SGQ_Parametros set Valor = '{Dt_Inicio.ToString("dddd-MM-yy HH:mm:ss")}' where Nome='ALM_Usuarios_Update'"); Gerais.Enviar_Email_Atualizacao_Tabela( Assunto: string.Format($"[SGQLoader]{database.name} - Usuários - {this.typeUpdate}"), Dt_Inicio: Dt_Inicio, Dt_Fim: DateTime.Now ); SGQConn.Dispose(); }
//public void Carregar_Dt_Ultimo_Update_ALM() { // var projetos_ativos = GetProjects_Ativos<Projeto_Template_05>(); // foreach (var projeto in projetos_ativos) { // projeto.Carregar_Dt_Ultimo_Update_ALM(); // } //} public void Update() { //ALMConnection conn = new ALMConnection(database); //OracleDataReader res = conn.Get_DataReader($"select PROJECT_NAME from {database.Scheme}.projects"); //// Console.WriteLine(res.HasRows); //while (res.Read()) //{ // Console.WriteLine(res["PROJECT_NAME"].ToString()); //} //conn.Dispose(); // this.Carregar_Condicoes_Insert(); //this.Carregar_Condicoes_Update(); SqlMaker2 sqlMaker2 = new SqlMaker2 { sqlMaker2Param = this.sqlMaker2Param }; ALMConnection ALMConn = new ALMConnection(this.database); Connection SGQConn = new Connection(); OracleDataReader DataReader_Insert = ALMConn.Get_DataReader(sqlMaker2.Get_Oracle_Insert()); if (DataReader_Insert != null && DataReader_Insert.HasRows == true) { SGQConn.Executar(ref DataReader_Insert, 1); } OracleDataReader DataReader_Update = ALMConn.Get_DataReader(sqlMaker2.Get_Oracle_Update()); if (DataReader_Update != null && DataReader_Update.HasRows == true) { SGQConn.Executar(ref DataReader_Update, 1); } SGQConn.Dispose(); }
public void LoadData() { DateTime Dt_Inicio = DateTime.Now; ALMConnection ALMConn = new ALMConnection(this.database); Connection SGQConn = new Connection(); SqlMaker2 sqlMaker2 = new SqlMaker2() { sqlMaker2Param = this.sqlMaker2Param }; if (typeUpdate == TypeUpdate.Increment || typeUpdate == TypeUpdate.IncrementFullUpdate) { if (typeUpdate == TypeUpdate.IncrementFullUpdate) { SGQConn.Executar($@" update alm_projetos set Defeitos_Incremental_Inicio='00-00-00 00:00:00', Defeitos_Incremental_Fim='00-00-00 00:00:00', Defeitos_Incremental_Tempo=0 where subprojeto='{projeto.Subprojeto}' and entrega='{projeto.Entrega}' "); } string Sql_Insert = sqlMaker2.Get_Oracle_Insert().Replace("{Esquema}", projeto.Esquema).Replace("{Subprojeto}", projeto.Subprojeto).Replace("{Entrega}", projeto.Entrega); OracleDataReader DataReader_Insert = ALMConn.Get_DataReader(Sql_Insert); if (DataReader_Insert != null && DataReader_Insert.HasRows == true) { SGQConn.Executar(ref DataReader_Insert, 1); } string Sql_Update = sqlMaker2.Get_Oracle_Update().Replace("{Esquema}", projeto.Esquema).Replace("{Subprojeto}", projeto.Subprojeto).Replace("{Entrega}", projeto.Entrega); OracleDataReader DataReader_Update = ALMConn.Get_DataReader(Sql_Update); if (DataReader_Update != null && DataReader_Update.HasRows == true) { SGQConn.Executar(ref DataReader_Update, 1); } //this.LoadData_Etapa(); //this.LoadData_Etapa_Final(); //this.LoadData_Improcedente(); DateTime Dt_Fim = DateTime.Now; SGQConn.Executar($@" update alm_projetos set Defeitos_Incremental_Inicio='{Dt_Inicio.ToString("dd-MM-yy HH:mm:ss")}', Defeitos_Incremental_Fim='{Dt_Fim.ToString("dd-MM-yy HH:mm:ss")}', Defeitos_Incremental_Tempo={DataEHora.DateDiff(DataEHora.DateInterval.Second, Dt_Inicio, Dt_Fim)} where subprojeto='{projeto.Subprojeto}' and entrega='{projeto.Entrega}' "); } else if (typeUpdate == TypeUpdate.Full) { SGQConn.Executar($"delete alm_defeitos where subprojeto='{projeto.Subprojeto}' and entrega='{projeto.Entrega}'"); string Sql_Insert = sqlMaker2.Get_Oracle_Insert().Replace("{Esquema}", projeto.Esquema).Replace("{Subprojeto}", projeto.Subprojeto).Replace("{Entrega}", projeto.Entrega); OracleDataReader DataReader_Insert = ALMConn.Get_DataReader(Sql_Insert); if (DataReader_Insert != null && DataReader_Insert.HasRows == true) { SGQConn.Executar(ref DataReader_Insert, 1); } //this.LoadData_Etapa(); //this.LoadData_Etapa_Final(); //this.LoadData_Improcedente(); DateTime Dt_Fim = DateTime.Now; SGQConn.Executar($@" update alm_projetos set Defeitos_Completa_Inicio='{Dt_Inicio.ToString("dd-MM-yy HH:mm:ss")}', Defeitos_Completa_Fim='{Dt_Fim.ToString("dd-MM-yy HH:mm:ss")}', Defeitos_Completa_Tempo={DataEHora.DateDiff(DataEHora.DateInterval.Second, Dt_Inicio, Dt_Fim)} where subprojeto='{projeto.Subprojeto}' and entrega='{projeto.Entrega}' "); } SGQConn.Dispose(); }