//Transforme un groupe sous la forme Element, dElement public override Element Déconstruire() { Element e = new Element(); dElement d; string CodeAttribut = ""; TypeElement type = Acces.type_BUDGET_OPERATION; e.ID = ID; e.Element_Type = type.ID; e.Code = Code; e.Libelle = Libelle; e.Type_Element = (int)Type_Flux; e.Actif = Actif; //Type Enveloppe { CodeAttribut = "ENVELOPPE"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Enveloppe.ToString()); e.Liste.Add(d); } //Période { CodeAttribut = "PERIODE"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Periode.ToString()); e.Liste.Add(d); } //Date opération { CodeAttribut = "DATE_OPERATION"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, DateOperation); e.Liste.Add(d); } //Type opération { CodeAttribut = "TYPE_OPERATION"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Type_Operation.ToString()); e.Liste.Add(d); } //Budget ORG { CodeAttribut = "BUDGET_ORG"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Budget_ORG.ToString()); e.Liste.Add(d); } //Budget GEO { CodeAttribut = "BUDGET_GEO"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Budget_GEO.ToString()); e.Liste.Add(d); } //Compte ID { CodeAttribut = "COMPTE_ID"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Compte_ID.ToString()); e.Liste.Add(d); } //Montant { CodeAttribut = "MONTANT"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Montant.ToString()); e.Liste.Add(d); } //Type Flux { CodeAttribut = "TYPE_FLUX"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, ((int)Type_Flux).ToString()); e.Liste.Add(d); } //Type monatnt { CodeAttribut = "TYPE_MONTANT"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, ((int)Type_Montant).ToString()); e.Liste.Add(d); } //Commentaire { CodeAttribut = "COMMENTAIRE"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Commentaire); e.Liste.Add(d); } //Virement ID { CodeAttribut = "VIREMENT_ID"; d = new dElement(ID, Acces.Trouver_Attribut(type, CodeAttribut).ID, CodeAttribut, Virement_ID.ToString()); e.Liste.Add(d); } return(e); }
public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction) { bool b = false; _fileZip = _CheckVarName(_fileZip, variableDispenser); _folderSource = _CheckVarName(_folderSource, variableDispenser); _folderDest = _CheckVarName(_folderDest, variableDispenser); _fileFilter = _CheckVarName(_fileFilter, variableDispenser); if (_typeOperation == Type_Operation.Please_Select) { componentEvents.FireError(1, "UnZip SSIS", "Please select type operation (De/Compress).", null, 0); throw new Exception("Please select type operation (De/Compress)."); } if (!_folderSource.EndsWith("\\")) { _folderSource = _folderSource + "\\"; } if (!_folderDest.EndsWith("\\")) { _folderDest = _folderDest + "\\"; } try { if (!System.IO.Directory.Exists(_folderDest)) { componentEvents.FireInformation(1, "UnZip SSIS", "Create Folder: '" + _folderDest + "'.", null, 0, ref b); System.IO.Directory.CreateDirectory(_folderDest); } if (_typeOperation == Type_Operation.Compress) { //COMPRESS ---------------> componentEvents.FireInformation(1, "UnZip SSIS", "Start -- " + _typeOperation.ToString() + " -- process file: '" + _folderDest + _fileZip + "'.", null, 0, ref b); // (Updated on 2015-12-30 by Nico_FR75) if (System.IO.File.Exists(_folderDest + _fileZip) && !this.OverwriteZipFile) { throw new Exception("File zip: '" + _folderDest + _fileZip + "' exists. Delete file or set 'OverwriteZipFile=true'"); } if (_typeCompression == Type_Compression.ZIP) { _CompressZIP(_folderDest + _fileZip, componentEvents); } else if (_typeCompression == Type_Compression.TAR) { _CompressTAR(_folderDest + _fileZip, componentEvents, null); } else if (_typeCompression == Type_Compression.TAR_GZ) { _CompressGZ(_folderDest + _fileZip, componentEvents); } else { throw new Exception("Type compression not supported."); } } else { //DE-COMPRESS ---------------> componentEvents.FireInformation(1, "UnZip SSIS", "Start -- " + _typeOperation.ToString() + " -- process file: '" + _folderSource + _fileZip + "'.", null, 0, ref b); // (Updated on 2015-12-30 by Nico_FR75) if (_typeCompression == Type_Compression.ZIP) { _DeCompressZIP(_folderSource + _fileZip, componentEvents); } else if (_typeCompression == Type_Compression.TAR) { _DeCompressTAR(_folderSource + _fileZip, componentEvents, null); } else if (_typeCompression == Type_Compression.TAR_GZ) { _DeCompressGZ(_folderSource + _fileZip, componentEvents); } else { throw new Exception("Type compression not supported."); } } } catch (Exception ex) { componentEvents.FireError(1000, "UnZip SSIS", ex.Message, null, 0); return(DTSExecResult.Failure); } componentEvents.FireInformation(1, "UnZip SSIS", "End -- " + _typeOperation.ToString() + " -- process file: '" + _folderDest + _fileZip + "'.", null, 0, ref b); return(DTSExecResult.Success); }