/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_BP FROM M4RBP_DEF WHERE SECURITY_TYPE <> 2", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { bResultat = ResultatErreur; foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { Process.AjouteRapport("Tâche " + drRow[0].ToString() + " non sécurisée."); } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
public bool makeControl() { string sTest; bool bResultat = true; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(sPathMdb); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_OBJECT FROM M4RDC_LOGIC_OBJECT WHERE HAVE_SECURITY <> 1"); if (dsDataSet.Tables[0].Rows.Count > 0) { bResultat = false; foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { // TODO Loguer les tables non sécurisées sTest = drRow[0].ToString(); } } } catch (Exception ex) { // TODO, loguer l'exception bResultat = false; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_PACKAGE FROM M4RDL_PACK_CMDS WHERE UCase(CMD_CODE) LIKE '%TRANSFER%PRESENTATION%SCO_DP_PAYROLL_CHANNEL%' AND CMD_ACTIVE=-1", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { bResultat = ResultatErreur; foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { Process.AjouteRapport("La présentation SCO_DP_PAYROLL_CHANNEL est livrée dans le pack " + drRow[0].ToString() + "."); } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sCommandPack = string.Empty; int iCpt = 0; bool bTrouve; string sPathMdb = Process.MDBCourant; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_PACKAGE,CMD_SEQUENCE,CMD_CODE FROM M4RDL_PACK_CMDS WHERE CMD_ACTIVE =-1", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { sCommandPack = drRow[2].ToString().ToUpper().Trim(); // Je remplace les espaces et tabulation par un seul espace. sCommandPack = System.Text.RegularExpressions.Regex.Replace(sCommandPack, "\\s+", " "); iCpt = 0; bTrouve = false; while ((iCpt < lL_INTERDIT.Count()) && (bTrouve == false)) { if (sCommandPack.IndexOf(lL_INTERDIT[iCpt++]) >= 0) { bTrouve = true; bResultat = ResultatErreur; double dConv; try { dConv = Convert.ToDouble(drRow[1].ToString()); } catch { dConv = 0; } bTrouve = true; Process.AjouteRapport("La commande " + dConv.ToString("###0") + " du pack " + drRow[0].ToString() + " est interdite."); } } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle pour un type de pack. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// <param name="TypePack">Contient une chaîne de caractère permettant de filtrer le type de pack à contrôler.</param> /// <param name="CMD">Contient la liste des commandes autorisées pour le type de pack à contrôler.</param> /// <param name="dmaManagerAccess">Objet permettant de faire des requêtes dans le MDB à contrôler.</param> /// </summary> private bool ControleUnTypack(string TypePack, List <string> CMD, DataManagerAccess dmaManagerAccess) { bool bResultat = true; bool bTrouve; int iCpt; string sCommandPack; string sPathMdb = Process.MDBCourant; try { DataSet dsDataSet = dmaManagerAccess.GetData("select ID_PACKAGE,CMD_SEQUENCE,CMD_CODE FROM M4RDL_PACK_CMDS WHERE ID_PACKAGE LIKE '%" + TypePack + "' AND CMD_ACTIVE =-1", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { iCpt = 0; bTrouve = false; sCommandPack = drRow[2].ToString().ToUpper().Trim(); // Je remplace les espaces et tabulation par un seul espace. sCommandPack = System.Text.RegularExpressions.Regex.Replace(sCommandPack, "\\s+", " "); while ((iCpt < CMD.Count()) && (bTrouve == false)) { if (sCommandPack.IndexOf(CMD[iCpt++]) >= 0) { bTrouve = true; } } if (bTrouve == false) { double dConv; try { dConv = Convert.ToDouble(drRow[1].ToString()); } catch { dConv = 0; } bResultat = false; Process.AjouteRapport("La commande " + dConv.ToString("###0") + " du pack " + drRow[0].ToString() + " est interdite."); } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = false; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sCommandPack = string.Empty; string sPathMdb = Process.MDBCourant; DataManagerAccess dmaManagerAccess = null; try { if (sCLE != string.Empty) { sCommandPack = "ID_KEY IN (" + sCLE + ")"; } if (sSECTION != string.Empty) { if (sCommandPack != string.Empty) { sCommandPack += " OR "; } sCommandPack += "ID_SECTION IN(" + sSECTION + ")"; } if (sCommandPack != string.Empty) { sCommandPack = "SELECT DISTINCT ID_SECTION + '\\' + ID_KEY AS CLE FROM M4RAV_APP_VAL_LG1 WHERE " + sCommandPack; dmaManagerAccess = new DataManagerAccess(); DataSet dsDataSet = dmaManagerAccess.GetData(sCommandPack, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { // TODO Loguer les paramètres applicatyif livrés à tort bResultat = ResultatErreur; Process.AjouteRapport("Livraison du paramètre applicatif " + drRow[0].ToString() + " interdite."); } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; int iID_SYNONYM; string sPathMdb = Process.MDBCourant; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_ITEM, ID_SYNONYM FROM M4RCH_ITEMS WHERE ID_TI LIKE '%HR%CALC' AND ID_TI NOT LIKE '%DIF%' AND ID_SYNONYM <> 0", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { bool bPlageOK = true; iID_SYNONYM = Int32.Parse(drRow[1].ToString()); for (int j = 0; j < lLIM_INF.Count && bPlageOK == true; j++) { if (iID_SYNONYM >= lLIM_INF[j] && iID_SYNONYM <= lLIM_SUP[j]) { bPlageOK = false; } } if (bPlageOK == false) { bResultat = ResultatErreur; Process.AjouteRapport("L'ID_SYNONYM de l'item " + drRow[0].ToString() + "(" + drRow[1].ToString() + ") est dans les plages réservées client."); } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
public bool makeControl() { bool bResultat = true; int iID_SYNONYM; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(sPathMdb); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_ITEM, ID_SYNONYM FROM M4RCH_ITEMS WHERE ID_TI LIKE '%HR%CALC' AND ID_TI NOT LIKE '%DIF%' AND ID_SYNONYM <> 0"); if (dsDataSet.Tables[0].Rows.Count > 0) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { bool bPlageOK = true; iID_SYNONYM = Int32.Parse(drRow[1].ToString()); for (int j = 0; j < lLIM_INF.Count && bPlageOK == true; j++) { if (iID_SYNONYM >= lLIM_INF[j] && iID_SYNONYM <= lLIM_SUP[j]) bPlageOK = false; } if (bPlageOK == false) { bResultat = false; // TODO logger l'item et l'ID_SYNONYM } } } } catch (Exception ex) { // TODO, loguer l'exception bResultat = false; } return bResultat; }
/// <summary> /// Méthode effectuant le contrôle. Elle va appeler la méthode ControleUnTypack pour chaque type de pack (L, B, D et F). /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); if (ControleUnTypack("_L", lCMD_L, dmaManagerAccess) == false) { bResultat = ResultatErreur; } if (ControleUnTypack("_D", lCMD_D, dmaManagerAccess) == false) { bResultat = ResultatErreur; } if (ControleUnTypack("_F", lCMD_F, dmaManagerAccess) == false) { bResultat = ResultatErreur; } if (ControleUnTypack("_B", lCMD_B, dmaManagerAccess) == false) { bResultat = ResultatErreur; } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Fonction cherchant des dépendances entre différents packs d'un MDB. /// </summary> /// <param name="bPremierElement">Booleen passé en référence. Utilisé pour savoir s'il faut écrire la ligne d'entête.</param> /// <param name="bGereInversion">Booléen indiquant s'il faut indiquer la dépendance également dans l'autre sens.</param> /// <param name="sRequete">Requête à lancer dans le mdb.</param> /// <param name="sPathMdb">Chemin complet du mdb.</param> /// <param name="dmaManagerAccess">Objet gérant les accès à la base Acces</param> private void ChercheDependanceUnMDB(ref bool bPremierElement, bool bGereInversion, string sRequete, string sPathMdb, DataManagerAccess dmaManagerAccess) { string sNomMdb = Path.GetFileName(sPathMdb); DataSet dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { if (bGereInversion == true) { AjouteDependance(ref bPremierElement, bGereInversion, sNomMdb, drRow[0].ToString(), sNomMdb, drRow[3].ToString(), drRow[1].ToString(), drRow[5].ToString(), drRow[2].ToString(), drRow[4].ToString()); } else { AjouteDependance(ref bPremierElement, bGereInversion, sNomMdb, drRow[0].ToString(), sNomMdb, drRow[3].ToString(), drRow[1].ToString(), drRow[1].ToString(), drRow[2].ToString(), drRow[2].ToString()); } } } }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sRequete = string.Empty; DataSet dsDataSet = null; List <string[]> lListeITEMS = new List <string[]>(); string sRequeteControle = string.Empty; bool bPremierElement; bool bItemTrouve; DataManagerAccess dmaManagerAccess = null; DataManagerSQLServer dmsManagerSQL = null; try { if (ConnectionStringBaseRef != string.Empty) { dmaManagerAccess = new DataManagerAccess(); sRequeteControle = "SELECT ID_DMD_COMPONENT, ID_DMD_GROUP FROM M4RCH_DMD_GRP_CMP WHERE ID_DMD_GROUP<> 'DMD_INC_VAL_MSS' AND ID_DMD_COMPONENT IN ("; bPremierElement = true; // Recherche des items de paie livrés sRequete = "SELECT A.ID_PACKAGE AS ID_PACKAGE, A.ID_OBJECT AS ID_OBJECT, B.ID_DMD_COMPONENT AS ID_DMD_COMPONENT FROM M4RDL_PACK_CMDS A, M4RCH_ITEMS B WHERE A.ID_PACKAGE LIKE '%_L' AND A.ID_CLASS='ITEM' AND (A.ID_OBJECT LIKE '%HRPERIOD_CALC.%' OR A.ID_OBJECT LIKE '%HRROLE_CALC.%') AND A.CMD_ACTIVE = -1 AND B.ID_TI + '.' + B.ID_ITEM = A.ID_OBJECT "; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { if (bPremierElement == true) { bPremierElement = false; } else { sRequeteControle += ","; } if (drRow[2].ToString() != string.Empty) { sRequeteControle += "'" + drRow[2].ToString() + "'"; } else { sRequeteControle += "'" + drRow[1].ToString().Substring(drRow[1].ToString().LastIndexOf(".") + 1) + "'"; } bItemTrouve = false; for (int elt = 0; elt < lListeITEMS.Count && bItemTrouve == false; elt++) { if (lListeITEMS[elt][0] == drRow[1].ToString()) { lListeITEMS[elt][1] += " / " + drRow[0].ToString(); bItemTrouve = true; } } if (bItemTrouve == false) { string sDMD_COMPONENT = string.Empty; if (drRow[2].ToString() != string.Empty) { sDMD_COMPONENT = drRow[2].ToString(); } else { sDMD_COMPONENT = drRow[1].ToString().Substring(drRow[1].ToString().LastIndexOf(".") + 1); } lListeITEMS.Add(new string[] { drRow[1].ToString(), drRow[0].ToString(), sDMD_COMPONENT, string.Empty, string.Empty }); } } dsDataSet.Clear(); } // Recherche des payroll items livrés sRequete = "SELECT A.ID_PACKAGE AS ID_PACKAGE, B.ID_TI + '.' + B.ID_ITEM AS ID_OBJECT, B.ID_DMD_COMPONENT AS ID_DMD_COMPONENT FROM M4RDL_PACK_CMDS A, M4RCH_ITEMS B, M4RCH_PICOMPONENTS C WHERE A.ID_PACKAGE LIKE '%_L' AND A.ID_CLASS='PAYROLL ITEM' AND A.CMD_ACTIVE = -1 AND C.ID_T3 + '.' + C.ID_PAYROLL_ITEM = A.ID_OBJECT AND B.ID_TI =C.ID_TI AND B.ID_ITEM=C.ID_ITEM"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { if (bPremierElement == true) { bPremierElement = false; } else { sRequeteControle += ","; } if (drRow[2].ToString() != string.Empty) { sRequeteControle += "'" + drRow[2].ToString() + "'"; } else { sRequeteControle += "'" + drRow[1].ToString().Substring(drRow[1].ToString().LastIndexOf(".") + 1) + "'"; } bItemTrouve = false; for (int elt = 0; elt < lListeITEMS.Count && bItemTrouve == false; elt++) { if (lListeITEMS[elt][0] == drRow[1].ToString()) { lListeITEMS[elt][1] += " / " + drRow[0].ToString(); bItemTrouve = true; } } if (bItemTrouve == false) { string sDMD_COMPONENT = string.Empty; if (drRow[2].ToString() != string.Empty) { sDMD_COMPONENT = drRow[2].ToString(); } else { sDMD_COMPONENT = drRow[1].ToString().Substring(drRow[1].ToString().LastIndexOf(".") + 1); } lListeITEMS.Add(new string[] { drRow[1].ToString(), drRow[0].ToString(), sDMD_COMPONENT, string.Empty, string.Empty }); } } dsDataSet.Clear(); } // Recherche des niveaux de saisie dans le mdb if (bPremierElement == false) { sRequeteControle += ") ORDER BY ID_DMD_COMPONENT, ID_DMD_GROUP"; dsDataSet = dmaManagerAccess.GetData(sRequeteControle, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { bItemTrouve = false; for (int elt = 0; elt < lListeITEMS.Count && bItemTrouve == false; elt++) { if (lListeITEMS[elt][2] == drRow[0].ToString()) { if (lListeITEMS[elt][3] == string.Empty) { lListeITEMS[elt][3] = "*"; } lListeITEMS[elt][3] += drRow[1].ToString() + "*"; bItemTrouve = true; } } } } // Recherche des niveaux de saisie dans la base de référence ou la base client dmsManagerSQL = new DataManagerSQLServer(); if (Process.PROCESS_ID == ParamAppli.ProcessControlePacks) { dsDataSet = dmsManagerSQL.GetData(sRequeteControle, ConnectionStringBaseRef); } else { dsDataSet = dmsManagerSQL.GetData(sRequeteControle, ParamAppli.ListeInfoClient[Process.CLIENT_ID].ConnectionStringQA1); } if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { bItemTrouve = false; for (int elt = 0; elt < lListeITEMS.Count && bItemTrouve == false; elt++) { if (lListeITEMS[elt][2] == drRow[0].ToString()) { if (lListeITEMS[elt][4] == string.Empty) { lListeITEMS[elt][4] = "*"; } lListeITEMS[elt][4] += drRow[1].ToString() + "*"; bItemTrouve = true; } } } } for (int elt = 0; elt < lListeITEMS.Count; elt++) { if ((lListeITEMS[elt][3] != lListeITEMS[elt][4]) && (lListeITEMS[elt][4] != string.Empty)) { string sListeElement = VerifieListe(lListeITEMS[elt][4], lListeITEMS[elt][3]); if (sListeElement != string.Empty) { if (sListeElement.IndexOf(",") > -1) { Process.AjouteRapport("Perte des niveaux de saisie " + sListeElement + " pour l'item " + lListeITEMS[elt][0] + " (DMD_COMPONENT " + lListeITEMS[elt][2] + ") livré dans le(s) pack(s) " + lListeITEMS[elt][1]); } else { Process.AjouteRapport("Perte du niveau de saisie " + sListeElement + " pour l'item " + lListeITEMS[elt][0] + " (DMD_COMPONENT " + lListeITEMS[elt][2] + ") livré dans le(s) pack(s) " + lListeITEMS[elt][1]); } bResultat = ResultatErreur; } } } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sID_SYNONYM; Dictionary <string, string> dicListItems = new Dictionary <string, string>(); bool bItemAControler = false; string sRequeteSqlServer = string.Empty; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); DataSet dsDataSet = dmaManagerAccess.GetData("select ID_ITEM, ID_SYNONYM FROM M4RCH_ITEMS WHERE (ID_TI LIKE '%HRPERIOD%CALC' OR ID_TI LIKE '%HRROLE%CALC') AND ID_TI NOT LIKE '%DIF%' AND ID_SYNONYM <> 0", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { sRequeteSqlServer = "select ID_ITEM, ID_SYNONYM FROM M4RCH_ITEMS WHERE (ID_TI LIKE '%HRPERIOD%CALC' OR ID_TI LIKE '%HRROLE%CALC') "; // Ne faire que si pack standard sRequeteSqlServer += "AND(ID_TI LIKE 'SCO%' OR ID_TI LIKE 'SFR%' OR ID_TI LIKE 'CFR%') "; sRequeteSqlServer += "AND ID_TI NOT LIKE '%DIF%' AND ("; foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { sID_SYNONYM = drRow[1].ToString(); if (dicListItems.ContainsKey(sID_SYNONYM) == false) { dicListItems.Add(sID_SYNONYM, drRow[0].ToString()); if (bItemAControler == false) { bItemAControler = true; } else { sRequeteSqlServer += "OR "; } sRequeteSqlServer += " (ID_SYNONYM = " + drRow[1].ToString() + " AND ID_ITEM <> '" + drRow[0].ToString() + "') "; } } if (bItemAControler == true) { sRequeteSqlServer += ")"; DataManagerSQLServer dmasqlManagerSQL = new DataManagerSQLServer(); // Contrôle sur la base de référence si pack standard, sinon sur base client if (Process.STANDARD == true) { dsDataSet = dmasqlManagerSQL.GetData(sRequeteSqlServer, ParamAppli.ConnectionStringBaseRef[Process.TYPOLOGY]); } else { dsDataSet = dmasqlManagerSQL.GetData(sRequeteSqlServer, ParamAppli.ListeInfoClient[Process.CLIENT_ID].ConnectionStringQA1); } if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { bResultat = ResultatErreur; foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { Process.AjouteRapport("L'ID_SYNONYM de l'item " + dicListItems[drRow[1].ToString()] + "(" + drRow[1].ToString() + ") est déja utilisé pour l'item " + drRow[0].ToString() + "."); } } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sRequete; string sIDPackageCourant; string sTempo; List <string> lListeM4O = new List <string>(); List <string> lListeNODESTRUCTURE = new List <string>(); DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); // La modification d'un M4O peut provenir de la livraison d'un M4O, d'une NODE, NODE STRUCTURE ou d'un item. On recherche tous ces éléments. sRequete = "select A.ID_PACKAGE, A.ID_CLASS,A.ID_OBJECT FROM M4RDL_PACK_CMDS A "; sRequete += "WHERE (A.ID_PACKAGE LIKE '%_L' OR A.ID_PACKAGE LIKE '%_B') AND A.ID_CLASS IN ('META4OBJECT & NODE STRUCTURES','META4OBJECT','NODE STRUCTURE','NODE','ITEM') AND A.CMD_ACTIVE = -1 "; sRequete += "ORDER BY ID_PACKAGE "; sIDPackageCourant = String.Empty; DataSet dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { if (drRow[0].ToString() != sIDPackageCourant) { if ((sIDPackageCourant != String.Empty) && (lListeM4O.Count + lListeNODESTRUCTURE.Count > 0)) { if (ControleM4OModifiesPack(lListeM4O, lListeNODESTRUCTURE, sIDPackageCourant) == false) { bResultat = ResultatErreur; } lListeM4O.Clear(); lListeNODESTRUCTURE.Clear(); } sIDPackageCourant = drRow[0].ToString(); } switch (drRow[1].ToString()) { case "META4OBJECT & NODE STRUCTURES": case "META4OBJECT": if (lListeM4O.Contains(drRow[2].ToString()) == false) { lListeM4O.Add(drRow[2].ToString()); } break; case "NODE": sTempo = drRow[2].ToString(); sTempo = sTempo.Substring(0, sTempo.IndexOf('.')); if (lListeM4O.Contains(sTempo) == false) { lListeM4O.Add(sTempo); } break; case "NODE STRUCTURE": if (lListeNODESTRUCTURE.Contains(drRow[2].ToString()) == false) { lListeNODESTRUCTURE.Add(drRow[2].ToString()); } break; case "ITEM": sTempo = drRow[2].ToString(); sTempo = sTempo.Substring(0, sTempo.IndexOf('.')); if (lListeNODESTRUCTURE.Contains(sTempo) == false) { lListeNODESTRUCTURE.Add(sTempo); } break; } } if (lListeM4O.Count + lListeNODESTRUCTURE.Count > 0) { if (ControleM4OModifiesPack(lListeM4O, lListeNODESTRUCTURE, sIDPackageCourant) == false) { bResultat = ResultatErreur; } lListeM4O.Clear(); lListeNODESTRUCTURE.Clear(); } //Process.AjouteRapport("Livraison de la table " + sCle + " dans le pack " + dListeAControler[sCle] + " sans mise à jour du catalogue des tables."); } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode vérifiant que les M4O modifiés par un pack ne sont pas des objets technos. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// <param name="lListeM4O">Contient la liste des M4O livrés et des M4O des NODES livrés.</param> /// <param name="lListeNODESTRUCTURE">Contient la liste des NODE STRUCTURES livrées et des NODES STRUCTURES des ITEM livrés.</param> /// <param name="sIDPackageCourant">Contient le nom du pack courant.</param> /// </summary> private bool ControleM4OModifiesPack(List <string> lListeM4O, List <string> lListeNODESTRUCTURE, string sIDPackageCourant) { DataManagerAccess dmaManagerAccess = null; DataManagerSQLServer dmsManagerSQL = null; bool bPremier = true; string sRequete = string.Empty; string sPathMdb = Process.MDBCourant; DataSet dsDataSet = null; bool bResultat = true; try { dmsManagerSQL = new DataManagerSQLServer(); dmaManagerAccess = new DataManagerAccess(); // Si la liste n'est pas vide on va rechercher les M4O à partir des NODE STRUCTURES modifiées. if (lListeNODESTRUCTURE.Count > 0) { sRequete = "select ID_T3,ID_TI from M4RCH_NODES where ID_TI IN ("; bPremier = true; foreach (string s in lListeNODESTRUCTURE) { if (bPremier == true) { bPremier = false; } else { sRequete += ","; } sRequete += "'" + s + "'"; } sRequete += ") UNION select ID_NODE_T3 AS ID_T3,ID_TI from M4RCH_OVERWRITE_NO where ID_TI IN ("; bPremier = true; foreach (string s in lListeNODESTRUCTURE) { if (bPremier == true) { bPremier = false; } else { sRequete += ","; } sRequete += "'" + s + "'"; } sRequete += ")"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { lListeNODESTRUCTURE.Remove(drRow[1].ToString()); // Je supprime les NS dont on trouve le M4O dans le MDB if (lListeM4O.Contains(drRow[0].ToString()) == false) { lListeM4O.Add(drRow[0].ToString()); } } dsDataSet.Clear(); } // S'il reste des NODE STRUCTURES pour lesquelles nous n'avons pas trouvé le M4O dans le MDB on recherche dans la base de ref. if (lListeNODESTRUCTURE.Count > 0) { sRequete = "select ID_T3,ID_TI from M4RCH_NODES where ID_TI IN ("; bPremier = true; foreach (string s in lListeNODESTRUCTURE) { if (bPremier == true) { bPremier = false; } else { sRequete += ","; } sRequete += "'" + s + "'"; } sRequete += ") UNION select ID_NODE_T3 AS ID_T3,ID_TI from M4RCH_OVERWRITE_NO where ID_TI IN ("; bPremier = true; foreach (string s in lListeNODESTRUCTURE) { if (bPremier == true) { bPremier = false; } else { sRequete += ","; } sRequete += "'" + s + "'"; } sRequete += ")"; if (ConnectionStringBaseRef != string.Empty) { dsDataSet = dmsManagerSQL.GetData(sRequete, ConnectionStringBaseRef); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { lListeNODESTRUCTURE.Remove(drRow[1].ToString()); // Je supprime les NS dont on trouve le M4O dans le MDB if (lListeM4O.Contains(drRow[0].ToString()) == false) { lListeM4O.Add(drRow[0].ToString()); } } dsDataSet.Clear(); } } } } // On va rechercher les M4O de la liste pour vérifier si ce sont des objets technos. // On cherche déja dans le MDB if (lListeM4O.Count > 0) { sRequete = "select ID_T3, N_T3FRA, OWNER_FLAG from M4RCH_T3S where ID_T3 IN ("; bPremier = true; foreach (string s in lListeM4O) { if (bPremier == true) { bPremier = false; } else { sRequete += ","; } sRequete += "'" + s + "'"; } sRequete += ")"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { lListeM4O.Remove(drRow[0].ToString()); // Je supprime les M4O trouvés dans le MDB // Controle si c'est un objet techno if ((drRow[2].ToString() == "1") || (drRow[0].ToString().Substring(0, 4) == "SRTC")) { Process.AjouteRapport("Modification de l'objet techno " + drRow[0].ToString() + " dans le pack " + sIDPackageCourant + "."); bResultat = false; } } } // S'il reste des M4O non trouvés dans le MDB on va chercher dans la base de ref. if (lListeM4O.Count > 0) { sRequete = "select ID_T3, N_T3FRA, OWNER_FLAG from M4RCH_T3S where ID_T3 IN ("; bPremier = true; foreach (string s in lListeM4O) { if (bPremier == true) { bPremier = false; } else { sRequete += ","; } sRequete += "'" + s + "'"; } sRequete += ")"; if (ConnectionStringBaseRef != string.Empty) { dsDataSet = dmsManagerSQL.GetData(sRequete, ConnectionStringBaseRef); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { lListeM4O.Remove(drRow[0].ToString()); // Je supprime les M4O trouvés dans le MDB // Controle si c'est un objet techno if ((drRow[2].ToString() == "1") || (drRow[0].ToString().Substring(0, 4) == "SRTC")) { Process.AjouteRapport("Modification de l'objet techno " + drRow[0].ToString() + " dans le pack " + sIDPackageCourant + "."); bResultat = false; } } } } } } } catch (Exception ex) { // TODO, loguer l'exception bResultat = true; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sRequete; List <string[]> lListeAControler = new List <string[]>(); bool bPremierElement = true; string sItem; DataSet dsDataSet; string sListeItemsLivres = string.Empty; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); // Recherche des items de paie livrés dans les packs du mdb sRequete = "SELECT ID_OBJECT FROM M4RDL_PACK_CMDS WHERE ID_CLASS = 'ITEM' AND CMD_ACTIVE=-1 AND ID_OBJECT LIKE '%HR%CALC%' AND ID_OBJECT NOT LIKE '%DIF%'"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { if (sListeItemsLivres != string.Empty) { sListeItemsLivres += ","; } sListeItemsLivres += "'" + drRow[0].ToString() + "'"; } } sRequete = "select ID_TI, ID_ITEM, ID_ITEM_USED_TI, ID_ITEM_USED FROM M4RCH_TOTAL_REF A"; // On livre le total sRequete += " WHERE (A.ID_TI+'.'+A.ID_ITEM IN (" + sListeItemsLivres + ")) "; sRequete += " AND (A.ID_ITEM_USED_TI+'.'+ID_ITEM_USED NOT IN (" + sListeItemsLivres + ")) "; // Et il existe des items du total qu'on ne livre pas sRequete += " AND (EXISTS (SELECT * FROM M4RCH_TOTAL_REF C WHERE A.ID_TI=C.ID_TI AND A.ID_ITEM=C.ID_ITEM AND C.ID_ITEM_USED_TI+'.'+C.ID_ITEM_USED NOT IN (" + sListeItemsLivres + ")))"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { sRequete = "SELECT ID_TI + '.' + ID_ITEM FROM M4RCH_ITEMS WHERE ID_TI + '.' + ID_ITEM IN ("; // Recherche les items utilisés dans les totaux foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { sItem = drRow[2].ToString() + "." + drRow[3].ToString(); lListeAControler.Add(new string[] { sItem, drRow[0].ToString() + "." + drRow[1].ToString() }); if (bPremierElement == true) { bPremierElement = false; } else { sRequete += ","; } sRequete += "'" + sItem + "'"; } sRequete += ")"; } // Recherche des items sur la base de ref if (lListeAControler.Count > 0) { DataManagerSQLServer dmsManagerSQL = new DataManagerSQLServer(); dsDataSet = dmsManagerSQL.GetData(sRequete, ConnectionStringBaseRef); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { for (int iCpt = 0; iCpt < lListeAControler.Count; iCpt++) { if (lListeAControler[iCpt][0] == drRow[0].ToString()) { lListeAControler.RemoveAt(iCpt); iCpt--; } } } } if (lListeAControler.Count > 0) { bResultat = ResultatErreur; foreach (string[] sElements in lListeAControler) { Process.AjouteRapport("Le total " + sElements[1] + " utilise un item inexistant (" + sElements[0] + ")."); } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sRequete; Dictionary <string, string> dListeAControler = new Dictionary <string, string>(); string sRequeteControle = string.Empty; bool bPremierElement = true; DataSet dsDataSet = null; string sNomMdb1; string sNomMdb2; DataManagerAccess dmaManagerAccess1 = null; DataManagerAccess dmaManagerAccess2 = null; try { dmaManagerAccess1 = new DataManagerAccess(); dmaManagerAccess2 = new DataManagerAccess(); foreach (string sPathMdb1 in Process.listMDB) { sNomMdb1 = Path.GetFileName(sPathMdb1); // Recherche des mêmes éléments livrés dans 2 packs d'un mdb sRequete = "select A.ID_PACKAGE, A.ID_CLASS, A.ID_OBJECT, B.ID_PACKAGE FROM M4RDL_PACK_CMDS A, M4RDL_PACK_CMDS B WHERE (A.ID_PACKAGE LIKE '%_L' OR A.ID_PACKAGE LIKE '%_B') AND A.ID_CLASS = B.ID_CLASS AND A.ID_OBJECT = B.ID_OBJECT AND A.ID_PACKAGE <> B.ID_PACKAGE AND A.CMD_ACTIVE = -1 AND B.CMD_ACTIVE = -1"; ChercheDependanceUnMDB(ref bPremierElement, false, sRequete, sPathMdb1, dmaManagerAccess1); // Recherche dépendance Payroll Item et item dans le même mdb sRequete = "SELECT A.ID_PACKAGE, B.ID_CLASS, B.ID_OBJECT, B.ID_PACKAGE, A.ID_OBJECT AS ID_OBJECT1, A.ID_CLASS AS ID_CLASS1 FROM M4RDL_PACK_CMDS A, M4RDL_PACK_CMDS B, M4RCH_PICOMPONENTS P WHERE A.ID_CLASS='PAYROLL ITEM' AND P.ID_T3 + '.' + P.ID_PAYROLL_ITEM= A.ID_OBJECT AND B.ID_CLASS='ITEM' AND B.ID_OBJECT=P.ID_TI + '.' + P.ID_ITEM AND A.ID_PACKAGE <> B.ID_PACKAGE AND A.CMD_ACTIVE = -1 AND B.CMD_ACTIVE= -1"; ChercheDependanceUnMDB(ref bPremierElement, true, sRequete, sPathMdb1, dmaManagerAccess1); // Recherche dépendance Node Structure et item dans le même mdb sRequete = "SELECT A.ID_PACKAGE, B.ID_CLASS, B.ID_OBJECT, B.ID_PACKAGE, A.ID_OBJECT AS ID_OBJECT1, A.ID_CLASS AS ID_CLASS1 FROM M4RDL_PACK_CMDS A, M4RDL_PACK_CMDS B WHERE A.ID_CLASS='ITEM' AND B.ID_CLASS='NODE STRUCTURE' AND B.ID_OBJECT = LEFT(A.ID_OBJECT,INSTR(A.ID_OBJECT,'.')-1) AND A.ID_PACKAGE <> B.ID_PACKAGE AND A.CMD_ACTIVE = -1 AND B.CMD_ACTIVE = -1"; ChercheDependanceUnMDB(ref bPremierElement, true, sRequete, sPathMdb1, dmaManagerAccess1); // Recherche dépendance Field et Logical Table dans le même mdb sRequete = "SELECT A.ID_PACKAGE, B.ID_CLASS, B.ID_OBJECT, B.ID_PACKAGE, A.ID_OBJECT AS ID_OBJECT1, A.ID_CLASS AS ID_CLASS1 FROM M4RDL_PACK_CMDS A, M4RDL_PACK_CMDS B WHERE A.ID_CLASS='FIELD' AND B.ID_CLASS='LOGICAL TABLE' AND B.ID_OBJECT = LEFT(A.ID_OBJECT,INSTR(A.ID_OBJECT,'.')-1) AND A.ID_PACKAGE <> B.ID_PACKAGE AND A.CMD_ACTIVE = -1 AND B.CMD_ACTIVE = -1"; ChercheDependanceUnMDB(ref bPremierElement, true, sRequete, sPathMdb1, dmaManagerAccess1); // Recherche dépendance Node et Meta4Objet dans le même mdb sRequete = "SELECT A.ID_PACKAGE, B.ID_CLASS, B.ID_OBJECT, B.ID_PACKAGE, A.ID_OBJECT AS ID_OBJECT1, A.ID_CLASS AS ID_CLASS1 FROM M4RDL_PACK_CMDS A, M4RDL_PACK_CMDS B WHERE A.ID_CLASS='NODE' AND B.ID_CLASS='META4OBJECT' AND B.ID_OBJECT = LEFT(A.ID_OBJECT,INSTR(A.ID_OBJECT,'.')-1) AND A.ID_PACKAGE <> B.ID_PACKAGE AND A.CMD_ACTIVE = -1 AND B.CMD_ACTIVE = -1"; ChercheDependanceUnMDB(ref bPremierElement, true, sRequete, sPathMdb1, dmaManagerAccess1); } // recherche des dépendances avec les autre mdb. for (int iIndex = 0; iIndex < Process.listMDB.Count - 1; iIndex++) { sRequete = "select ID_PACKAGE, ID_CLASS, ID_OBJECT FROM M4RDL_PACK_CMDS WHERE ID_PACKAGE LIKE '%_L' OR ID_PACKAGE LIKE '%_B' AND CMD_ACTIVE = -1"; dsDataSet = dmaManagerAccess1.GetData(sRequete, Process.listMDB[iIndex]); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { for (int iIndex2 = iIndex + 1; iIndex2 < Process.listMDB.Count; iIndex2++) { // Recherche des mêmes éléments livrés dans 2 packs de 2 mdb sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE (A.ID_PACKAGE LIKE '%_L' OR A.ID_PACKAGE LIKE '%_B') AND A.ID_CLASS = '" + drRow[1].ToString() + "' AND A.ID_OBJECT = '" + drRow[2].ToString() + "' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); switch (drRow[1].ToString()) { case "ITEM": // Recherche des dépendances entre Item et Node structure livrés dans 2 packs de 2 mdb string sNodeStructure = drRow[2].ToString().Substring(0, drRow[2].ToString().IndexOf(".")); sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'NODE STRUCTURE' AND A.ID_OBJECT = '" + sNodeStructure + "' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); // Recherche des dépendances entre Item et payroll item livrés dans 2 packs de 2 mdb sRequete = "select A.ID_PACKAGE, A.ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A, M4RCH_PICOMPONENTS P WHERE A.ID_CLASS = 'PAYROLL ITEM' AND P.ID_T3 + '.' + P.ID_PAYROLL_ITEM= A.ID_OBJECT AND P.ID_TI + '.' + P.ID_ITEM = '" + drRow[2].ToString() + "' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); break; case "NODE STRUCTURE": // Recherche des dépendances entre Node structure et Item livrés dans 2 packs de 2 mdb sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'ITEM' AND A.ID_OBJECT LIKE '" + drRow[2].ToString() + ".%' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); break; case "FIELD": // Recherche des dépendances entre Field et Logical Table livrés dans 2 packs de 2 mdb string sTable = drRow[2].ToString().Substring(0, drRow[2].ToString().IndexOf(".")); sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'LOGICAL TABLE' AND A.ID_OBJECT = '" + sTable + "' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); break; case "LOGICAL TABLE": // Recherche des dépendances entre Logical Table et Field livrés dans 2 packs de 2 mdb sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'FIELD' AND A.ID_OBJECT LIKE '" + drRow[2].ToString() + ".%' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); break; case "NODE": // Recherche des dépendances entre Node et M4O livrés dans 2 packs de 2 mdb string sNode = drRow[2].ToString().Substring(0, drRow[2].ToString().IndexOf(".")); sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'META4OBJECT' AND A.ID_OBJECT = '" + sNode + "' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); break; case "META4OBJECT": // Recherche des dépendances entre M4O et Node livrés dans 2 packs de 2 mdb sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'NODE' AND A.ID_OBJECT LIKE '" + drRow[2].ToString() + ".%' AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); break; case "PAYROLL ITEM": // Recherche des dépendances entre Payroll Item et Item livrés dans 2 packs de 2 mdb string sListeComposant = string.Empty; DataSet dsDataSet2; dsDataSet2 = dmaManagerAccess2.GetData("select ID_TI +'.' + ID_ITEM FROM M4RCH_PICOMPONENTS WHERE ID_T3 + '.' + ID_PAYROLL_ITEM = '" + drRow[2].ToString() + "'", Process.listMDB[iIndex]); if ((dsDataSet2 != null) && (dsDataSet2.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow2 in dsDataSet2.Tables[0].Rows) { if (sListeComposant == string.Empty) { sListeComposant = "('" + drRow2[0].ToString() + "'"; } else { sListeComposant += ",'" + drRow2[0].ToString() + "'"; } } } if (sListeComposant != string.Empty) { sListeComposant += ")"; sRequete = "select ID_PACKAGE, ID_CLASS, A.ID_OBJECT FROM M4RDL_PACK_CMDS A WHERE A.ID_CLASS = 'ITEM' AND A.ID_OBJECT IN " + sListeComposant + " AND A.ID_PACKAGE <> '" + drRow[0].ToString() + "' AND A.CMD_ACTIVE = -1"; ChercheDependanceEntreMDB(ref bPremierElement, sRequete, Process.listMDB[iIndex2], dmaManagerAccess2, Process.listMDB[iIndex], drRow[0].ToString(), drRow[1].ToString(), drRow[2].ToString()); } break; } } } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Fonction cherchant des dépendances entre différents packs de différents MDB. /// </summary> /// <param name="bPremierElement">Booleen passé en référence. Utilisé pour savoir s'il faut écrire la ligne d'entête.</param> /// <param name="sRequete">Requête à lancer dans le mdb.</param> /// <param name="sPathMdb">Chemin complet du mdb.</param> /// <param name="dmaManagerAccess">Objet gérant les accès à la base Acces</param> private void ChercheDependanceEntreMDB(ref bool bPremierElement, string sRequete, string sPathMdb, DataManagerAccess dmaManagerAccess, string sPathMdb1, string sPack1, string sClasse1, string sElt1) { string sNomMdb1 = Path.GetFileName(sPathMdb1); string sNomMdb2 = Path.GetFileName(sPathMdb); DataSet dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { AjouteDependance(ref bPremierElement, true, sNomMdb1, sPack1, sNomMdb2, drRow[0].ToString(), sClasse1, drRow[1].ToString(), sElt1, drRow[2].ToString()); } } }
/// <summary> /// Le but de cette fonction est de déterminer les dépendances de de niveau 1 pour les packs livrés dans le HF. /// On détecte les tâches CCT dépendantes car au niveau 1 on va récupérer tout le contenu des tâches dépendantes qui manquent sur l'environnement client. /// </summary> /// <param name="lTacheDepN2">Ce paramètre contient au retour de l'appel toutes les tâches</param> /// <returns></returns> private bool RechercheDepN1(ref List <string> lTacheDepN2) { bool bResultat = true; DataManagerAccess dmaManagerAccess = null; DataManagerSQLServer dmsManagerSQL = null; List <string> lTacheCCTHF; List <string> lTacheDepN1; string sRequete; bool bPremierElement = true; DataSet dsDataSet = null; string sNomMdb; string sTacheCCT; string sListeTacheCCT = string.Empty; try { lTacheDepN2.Clear(); dmaManagerAccess = new DataManagerAccess(); dmsManagerSQL = new DataManagerSQLServer(); lTacheCCTHF = new List <string>(); lTacheDepN1 = new List <string>(); // Récupération de toutes les tâches CCT livrées dans le HF sRequete = "SELECT DISTINCT(CCT_TASK_ID) FROM M4RDL_PACKAGES"; foreach (string sPathMdb in Process.listMDB) { sNomMdb = Path.GetFileName(sPathMdb); dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { sTacheCCT = drRow[0].ToString(); if (lTacheCCTHF.Contains(sTacheCCT) == false) { lTacheCCTHF.Add(sTacheCCT); if (bPremierElement == true) { bPremierElement = false; } else { sListeTacheCCT += ","; } sListeTacheCCT += "'" + sTacheCCT + "'"; } } } } if (lTacheCCTHF.Count > 0) { sRequete = "SELECT CCT_TASK_ID, DEP_CCT_TASK_ID from M4CFR_VW_CCT_DEPENDANCES where "; sRequete += "CCT_TASK_ID IN (" + sListeTacheCCT + ") "; sRequete += "AND DEP_CCT_TASK_ID NOT IN (" + sListeTacheCCT + ") "; sRequete += "AND DEP_CCT_TASK_ID not like '%DEF%' "; sRequete += "AND CCT_OBJECT_TYPE+CCT_OBJECT_ID NOT IN ('PRESENTATIONSFR_DP_PAYROLL_CHANNEL','PRESENTATIONSCO_DP_PAYROLL_CHANNEL')"; dsDataSet = dmsManagerSQL.GetData(sRequete, ConnectionStringBaseRef); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { using (var conn = new System.Data.SqlClient.SqlConnection(ParamAppli.ConnectionStringBaseAppli)) { conn.Open(); using (var cmd = new System.Data.SqlClient.SqlCommand("INSERT INTO PNPU_DEPN1_REF (ID_H_WORKFLOW, CCT_TASK_ID, DEP_CCT_TASK_ID) VALUES( @WORKFLOW_ID, @CCT_TASK_ID,@DEP_CCT_TASK_ID)", conn)) { cmd.Parameters.Add("@WORKFLOW_ID", SqlDbType.Int); cmd.Parameters.Add("@CCT_TASK_ID", SqlDbType.VarChar, 30); cmd.Parameters.Add("@DEP_CCT_TASK_ID", SqlDbType.VarChar, 30); foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { sTacheCCT = drRow[0].ToString() + "*" + drRow[1].ToString(); if (lTacheDepN1.Contains(sTacheCCT) == false) { lTacheDepN1.Add(sTacheCCT); if (lTacheDepN2.Contains(drRow[1].ToString()) == false) { lTacheDepN2.Add(drRow[1].ToString()); } cmd.Parameters[0].Value = Process.WORKFLOW_ID; cmd.Parameters[1].Value = drRow[0].ToString(); cmd.Parameters[2].Value = drRow[1].ToString(); int rowsAffected = cmd.ExecuteNonQuery(); } } } } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = false; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sRequete = string.Empty; DataManagerAccess dmaManagerAccess = null; DataManagerAccess dmaManagerAccess2 = null; DataSet dsDataSet = null; DataSet dsDataSet2 = null; try { dmaManagerAccess = new DataManagerAccess(); dmaManagerAccess2 = new DataManagerAccess(); dsDataSet = dmaManagerAccess.GetData("select ID_PACKAGE, CMD_CODE FROM M4RDL_PACK_CMDS WHERE UCase(CMD_CODE) LIKE '%REPLACE%' AND CMD_ACTIVE=-1 ", sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { string stempo = drRow[1].ToString(); string sTable = string.Empty; string sWhere = string.Empty; int iIndex = 0; int iIndex2 = 0; int iIndex3 = 0; dmaManagerAccess = new DataManagerAccess(); iIndex = stempo.ToUpper().IndexOf("REPLACE ", iIndex); while (iIndex >= 0) { iIndex += "REPLACE".Length + 1; iIndex2 = stempo.ToUpper().IndexOf("FROM", iIndex); if (iIndex2 >= 0) { // Récupréation du nom de la table sTable = stempo.ToUpper().Substring(iIndex, iIndex2 - iIndex).Trim(); sWhere = string.Empty; // Recherche s'il y a une clause where iIndex = stempo.IndexOf('\"', iIndex2); if (iIndex >= 0) { // Vérifie qu'il ne s'agit pas du WHERE d'une commande replace suivante iIndex3 = stempo.ToUpper().IndexOf("REPLACE ", iIndex2); if ((iIndex3 < 0) || (iIndex3 > iIndex)) { iIndex2 = stempo.IndexOf('\"', iIndex + 1); if (iIndex2 < 0) { iIndex2 = stempo.Length - 1; } else { sWhere = stempo.Substring(iIndex + 1, iIndex2 - iIndex - 1); } } else { if ((iIndex3 >= 0) && (iIndex3 < iIndex)) { iIndex = iIndex3; } } } sRequete = "SELECT COUNT(*) FROM " + sTable; if (sWhere != string.Empty) { sRequete += " WHERE " + sWhere; } dsDataSet2 = dmaManagerAccess2.GetData(sRequete, sPathMdb); if ((dsDataSet2 != null) && (dsDataSet2.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow2 in dsDataSet2.Tables[0].Rows) { if (drRow2[0].ToString() == "0") { Process.AjouteRapport("Replace sur la table " + sTable + " dans le pack " + drRow[0].ToString() + " sans donnée dans le mdb(filtre: " + sWhere + ")"); bResultat = ResultatErreur; } } } else { Process.AjouteRapport("Replace sur la table " + sTable + " dans le pack " + drRow[0].ToString() + " sans donnée dans le mdb(filtre: " + sWhere + ")"); bResultat = ResultatErreur; } } if (iIndex >= 0) { iIndex = stempo.ToUpper().IndexOf("REPLACE ", iIndex); } } } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sRequete; Dictionary <string, string> dListeAControler = new Dictionary <string, string>(); string sRequeteControle = string.Empty; bool bPremierElement = true; DataManagerAccess dmaManagerAccess = null; try { dmaManagerAccess = new DataManagerAccess(); sRequete = "select A.ID_PACKAGE, A.ID_OBJECT,B.REAL_NAME FROM M4RDL_PACK_CMDS A INNER JOIN M4RDC_LOGIC_OBJECT B ON (A.ID_OBJECT = B.ID_OBJECT) "; sRequete += "WHERE A.ID_PACKAGE LIKE '%_L' AND A.ID_CLASS = 'LOGICAL TABLE' AND A.CMD_ACTIVE = -1 AND (B.ID_OBJECT_TYPE = 1 OR B.ID_OBJECT_TYPE = 3) AND ID_ORG_TYPE <> 1"; DataSet dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { sRequeteControle = "SELECT ID_OBJECT FROM M4RDC_LOGIC_OBJECT WHERE ID_OBJECT IN ("; foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { // Pour chaque table livrée, vérifie si elle est dans le catalogue. sRequete = "select * from M4RDL_PACK_CMDS WHERE CMD_CODE LIKE '%M4CFR_X_DATA_TABLES%' + CHR(39) + '" + drRow[2].ToString() + "' + CHR(39) + '%' OR CMD_CODE LIKE '%M4CFR_X_DATA_TABLES%' + CHR(39) + '" + drRow[1].ToString() + "' + CHR(39) + '%'"; DataSet dsDataSet2 = dmaManagerAccess.GetData(sRequete, sPathMdb); // Si la table n'est pas dans le catalogue on prévoit de vérifier si elle est déja présente sur la base de ref if ((dsDataSet2 == null) || (dsDataSet2.Tables[0].Rows.Count == 0)) { dListeAControler.Add(drRow[1].ToString(), drRow[0].ToString()); if (bPremierElement == true) { bPremierElement = false; } else { sRequeteControle += ","; } sRequeteControle += "'" + drRow[1].ToString() + "'"; } } // Vérification dans la base de référence si les tables sont présentes. if ((bPremierElement == false) && (ConnectionStringBaseRef != string.Empty)) { DataManagerSQLServer dmsManagerSQL = new DataManagerSQLServer(); sRequeteControle += ")"; dsDataSet = dmsManagerSQL.GetData(sRequeteControle, ConnectionStringBaseRef); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { // On supprime de la liste des tables à contrôler celles existantes sur la base de ref if (dListeAControler.ContainsKey(drRow[0].ToString()) == true) { dListeAControler.Remove(drRow[0].ToString()); } } } } //Le tables restant dans la liste sont en erreur foreach (string sCle in dListeAControler.Keys) { Process.AjouteRapport("Livraison de la table " + sCle + " dans le pack " + dListeAControler[sCle] + " sans mise à jour du catalogue des tables."); bResultat = ResultatErreur; } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { bool bResultat; string sResultat = ParamAppli.StatutOk; string sRequete; string sNomMdb; DataManagerAccess dmaManagerAccess = null; DataSet dsDataSet; string sTacheCCT; List <string> lTacheCCTHF; bool bPremierElement = true; string sFiltreNiveauPrec = string.Empty; string sFiltreNiveauN = string.Empty; string sFiltreNiveauN1 = string.Empty; try { dmaManagerAccess = new DataManagerAccess(); lTacheCCTHF = new List <string>(); // Récupération de toutes les tâches CCT livrées dans le HF sRequete = "SELECT DISTINCT(CCT_TASK_ID) FROM M4RDL_PACKAGES"; foreach (string sPathMdb in Process.listMDB) { sNomMdb = Path.GetFileName(sPathMdb); dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { sTacheCCT = drRow[0].ToString(); if ((sTacheCCT != string.Empty) && (lTacheCCTHF.Contains(sTacheCCT) == false)) { lTacheCCTHF.Add(sTacheCCT); if (bPremierElement == true) { bPremierElement = false; } else { sFiltreNiveauN += ","; } sFiltreNiveauN += "'" + sTacheCCT + "'"; } } } } // Recherche des dépendances de Niveau 1 bResultat = RechercheDependances(1, sFiltreNiveauPrec, sFiltreNiveauN, ref sFiltreNiveauN1); // Recherche des dépendances de Niveau 2 if (bResultat == true) { sFiltreNiveauPrec = sFiltreNiveauN; sFiltreNiveauN = sFiltreNiveauN1; sFiltreNiveauN1 = string.Empty; bResultat = RechercheDependances(2, sFiltreNiveauPrec, sFiltreNiveauN, ref sFiltreNiveauN1); } // Recherche des dépendances de Niveau 3 if (bResultat == true) { if (sFiltreNiveauPrec != string.Empty) { sFiltreNiveauPrec += ","; } sFiltreNiveauPrec += sFiltreNiveauN; sFiltreNiveauN = sFiltreNiveauN1; sFiltreNiveauN1 = string.Empty; bResultat = RechercheDependances(3, sFiltreNiveauPrec, sFiltreNiveauN, ref sFiltreNiveauN1); } if (bResultat == false) { sResultat = ParamAppli.StatutError; } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); sResultat = ParamAppli.StatutError; } return(sResultat); }
/// <summary> /// Méthode effectuant le contrôle. /// <returns>Retourne un booléen, vrai si le contrôle est concluant et sinon faux.</returns> /// </summary> public string MakeControl() { string bResultat = ParamAppli.StatutOk; string sPathMdb = Process.MDBCourant; string sRequete = string.Empty; DataSet dsDataSet = null; DataManagerAccess dmaManagerAccess = null; try { if (ConnectionStringBaseRef != string.Empty) { dmaManagerAccess = new DataManagerAccess(); // Contrôle des M4O hérités. sRequete = "select OC.ID_T3, PMP.ID_PROJECT,PMP.ID_INSTANCE FROM SPR_DIN_OBJECTS OC inner join M4RDM_OS_PROJ_MEMS PMP on (OC.ID = PMP.ID_INSTANCE and PMP.ID_CLASS = 'DIN_OBJECT' AND PMP.ID_PROJECT NOT IN ('STANDARD','_M4ROOT','PLATFORM')) "; sRequete += "WHERE OC.ID_T3 IN (" + sListeID_T3 + ")"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { int j = 0; bResultat = ResultatErreur; while (j < (lObjetsHeritesSTD.Count - 1) && (lObjetsHeritesSTD[j][0] != drRow[0].ToString())) { j++; } if (lObjetsHeritesSTD[j][0] != drRow[0].ToString()) { Process.AjouteRapport("Héritage de l'objet " + drRow[0].ToString() + " au niveau " + drRow[1].ToString() + " (" + drRow[2].ToString() + ") alors qu'il est hérité au niveau standard."); } else { Process.AjouteRapport("Héritage de l'objet " + drRow[0].ToString() + " au niveau " + drRow[1].ToString() + " (" + drRow[2].ToString() + ") alors qu'il est hérité au niveau " + lObjetsHeritesSTD[j][1] + " (" + lObjetsHeritesSTD[j][2] + ")."); } } dsDataSet.Clear(); } // Contrôle des présentations héritées. sRequete = "select PC.ID_PRESENTATION,PMP.ID_PROJECT,PMP.ID_INSTANCE from SPR_DIN_PRESENTS PC inner join M4RDM_OS_PROJ_MEMS PMP on (PC.ID = PMP.ID_INSTANCE and PMP.ID_CLASS = 'DIN_PRESENT' AND PMP.ID_PROJECT NOT IN ('STANDARD','_M4ROOT','PLATFORM')) "; sRequete += "WHERE PC.ID_PRESENTATION IN (" + sListeID_PRES + ")"; dsDataSet = dmaManagerAccess.GetData(sRequete, sPathMdb); if ((dsDataSet != null) && (dsDataSet.Tables[0].Rows.Count > 0)) { foreach (DataRow drRow in dsDataSet.Tables[0].Rows) { int j = 0; bResultat = ResultatErreur; while (j < (lPresentsHeritesSTD.Count - 1) && (lPresentsHeritesSTD[j][0] != drRow[0].ToString())) { j++; } if (lPresentsHeritesSTD[j][0] != drRow[0].ToString()) { Process.AjouteRapport("Héritage de la présentation " + drRow[0].ToString() + " au niveau " + drRow[1].ToString() + " (" + drRow[2].ToString() + ") alors qu'elle est héritée au niveau standard."); } else { Process.AjouteRapport("Héritage de la présentation " + drRow[0].ToString() + " au niveau " + drRow[1].ToString() + " (" + drRow[2].ToString() + ") alors qu'elle est héritée au niveau " + lPresentsHeritesSTD[j][1] + " (" + lPresentsHeritesSTD[j][2] + ")."); } } dsDataSet.Clear(); } } } catch (Exception ex) { Logger.Log(Process, this, ParamAppli.StatutError, ex.Message); bResultat = ParamAppli.StatutError; } return(bResultat); }