//------------------------------------------------------------------------------------ /// <summary> /// Assure l'exostance d'un Host partir des données fournies. /// Créé l'équipemtn logique du bon type si le Host n'existe pas /// </summary> /// <param name="strHostId"></param> /// <param name="strType"></param> /// <param name="strName"></param> /// <returns></returns> private static CResultAErreur AssureHostExiste(string strHostId, string strType, string strName, CContexteDonnee contexte) { CResultAErreur result = CResultAErreur.True; // Vérifie si le host existe ans Timos CTypeEquipement typeEquipement = new CTypeEquipement(contexte); result = CCamusatQowisioData.GetEquipementLogiqueFromQowisioId(strHostId, contexte); if (!result) { return(result); } CEquipementLogique qowisioBox = result.Data as CEquipementLogique; if (strType == "SITE" && typeEquipement.ReadIfExists(CCamusatQowisioData.c_nIdTypeEquipementQowisioVirtualSite)) { // C'est trouvé, rien à faire de plus } else if (strType == "PICKUP" && typeEquipement.ReadIfExists(CCamusatQowisioData.c_nIdTypeEquipementQowisioBoxVehicule)) { // Trouvé } else { result.EmpileErreur("No Equipment Type found for Host Id : " + strHostId); return(result); } if (qowisioBox == null) { // Créer un nouvel equipement logique Timos CSite siteAwaitingElements = new CSite(contexte); if (siteAwaitingElements.ReadIfExists(CCamusatQowisioData.c_nIdSiteQowisionAwaitingElements)) { qowisioBox = new CEquipementLogique(contexte); qowisioBox.CreateNewInCurrentContexte(); qowisioBox.TypeEquipement = typeEquipement; qowisioBox.Site = siteAwaitingElements; qowisioBox.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosQowisioId, strHostId); qowisioBox.Libelle = strName; } else { result.EmpileErreur("No Site found for awaiting elements. Host Id : " + strHostId); return(result); } } else { qowisioBox.TypeEquipement = typeEquipement; } result.Data = qowisioBox; return(result); }
public override CResultAErreur VerifieDonnees(CObjetDonnee objet) { CResultAErreur resutl = CResultAErreur.True; CCamusatQowisioData data = objet as CCamusatQowisioData; if (data != null) { } return(resutl); }
//------------------------------------------------------------------------------------------- private static CResultAErreur TraiteCsvDataRow(string strCsvRow, CContexteDonnee contexte) { CResultAErreur result = CResultAErreur.True; try { CCamusatQowisioData data = CCamusatQowisioData.StaticTraiteDataRowFromCsv(contexte, strCsvRow).DataType; } catch (Exception ex) { result.EmpileErreur(ex.Message); } return(result); }
public static CResultAErreur TraitementAvantSauvegardeExterne(CContexteDonnee contexte, Hashtable tableData) { CResultAErreur result = CResultAErreur.True; bool bVidesLesCaches = false; DataTable tableEquipements = contexte.Tables[CEquipementLogique.c_nomTable]; if (tableEquipements != null) { string strFiltre = CTypeEquipement.c_champId + " = " + CCamusatQowisioData.c_nIdTypeEquipementQowisioBoxVehicule + " OR " + CTypeEquipement.c_champId + " = " + CCamusatQowisioData.c_nIdTypeEquipementQowisioVirtualSite + " OR " + CTypeEquipement.c_champId + " = " + CCamusatQowisioData.c_nIdTypeEquipementQowisioFuelProbe; DataRow[] rows = tableEquipements.Select(strFiltre); foreach (DataRow row in rows) { if (row.RowState != DataRowState.Unchanged) { bVidesLesCaches = true; break; } } } DataTable tableRelationsChamps = contexte.Tables[CRelationEquipementLogique_ChampCustom.c_nomTable]; if (tableRelationsChamps != null) { string strFiltre = CChampCustom.c_champId + " = " + CCamusatQowisioData.c_nIdChampTimosFuelProbeAssociatedTank; DataRow[] rows = tableRelationsChamps.Select(strFiltre); foreach (DataRow row in rows) { if (row.RowState != DataRowState.Unchanged) { bVidesLesCaches = true; break; } } } if (bVidesLesCaches) { CCamusatQowisioData.ClearAllCacheDatas(); } return(result); }
//----------------------------------------------------------------------------------------- /// <summary> /// Assure l'existance d'une Fuel Probe partir des données fournies. /// Créé l'équipemtn logique du bon type si le Host n'existe pas /// </summary> /// <param name="strHostId"></param> /// <param name="strType"></param> /// <param name="strName"></param> /// <returns></returns> private static CResultAErreur AssureProbeExiste(CEquipementLogique parentQowisioBox, string strProbeId, string strTankShape, string strTankDimensions, string strTankCapacity, string strType, CContexteDonnee contexte) { CResultAErreur result = CResultAErreur.True; if (parentQowisioBox == null) { result.EmpileErreur("Can not create Qowisio Fuel Probe Id = " + strProbeId + " because parent Qowisio Box is nul"); return(result); } result = CCamusatQowisioData.GetEquipementLogiqueFromQowisioId(strProbeId, contexte); if (!result) { return(result); } CEquipementLogique qowisioFuelProbe = result.Data as CEquipementLogique; if (qowisioFuelProbe == null) { // Créer un nouvel equipement logique Timos CSite siteAwaitingElements = new CSite(contexte); if (siteAwaitingElements.ReadIfExists(CCamusatQowisioData.c_nIdSiteQowisionAwaitingElements)) { CTypeEquipement typeEquipement = new CTypeEquipement(contexte); if (typeEquipement.ReadIfExists(CCamusatQowisioData.c_nIdTypeEquipementQowisioFuelProbe)) { qowisioFuelProbe = new CEquipementLogique(contexte); qowisioFuelProbe.CreateNewInCurrentContexte(); qowisioFuelProbe.TypeEquipement = typeEquipement; qowisioFuelProbe.EquipementLogiqueContenant = parentQowisioBox; qowisioFuelProbe.Site = siteAwaitingElements; // Site des equipements logiques en attente d'affectation qowisioFuelProbe.Libelle = "Fuel Probe " + strProbeId; result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosQowisioId, strProbeId); if (result) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelProbeAssociatedTank, null); // Relation vers Tank } else { return(result); } } else { result.EmpileErreur("No Equipment Type found for Fuel Probe Id : " + strProbeId); return(result); } } else { result.EmpileErreur("No Site found for awaiting elements. Host Id : " + strProbeId); return(result); } } else { if (qowisioFuelProbe.EquipementLogiqueContenant != parentQowisioBox) { qowisioFuelProbe.EquipementLogiqueContenant = parentQowisioBox; result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelProbeAssociatedTank, null); // Relation vers Tank if (!result) { return(result); } } } if (qowisioFuelProbe != null) { // Maj champs de fuel probe (equipement logique) result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelTankShape, strTankShape); if (result) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelTankDimensions, strTankDimensions); } if (result) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelTankCapacity, strTankCapacity); } if (result) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelProbeType, strType); } if (!result) { return(result); } // Maj champs de Tank (equipement physique) CEquipement tank = qowisioFuelProbe.GetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelProbeAssociatedTank) as CEquipement; if (tank != null) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelTankShape, strTankShape); if (result) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelTankDimensions, strTankDimensions); } if (result) { result = qowisioFuelProbe.SetValeurChamp(CCamusatQowisioData.c_nIdChampTimosFuelTankCapacity, strTankCapacity); } } } result.Data = qowisioFuelProbe; return(result); }