/// <summary> /// Funzione per la rimozione di un allegatoItemReportPregressi dalla lista /// Il campo verrà eliminato solo se esiste nella lista /// </summary> /// <param name="fieldSettings"></param> public void DeleteAllegatoItemReportPregressi(Allegati allegatoItemReportPreg) { if (this.Allegati.Contains(allegatoItemReportPreg)) { this.Allegati.Remove(allegatoItemReportPreg); } }
/// <summary> /// Funzione per l'aggiunta di un allegatoItemReportPregressi alla lista /// Il campo verrà aggiunto solo se non ne esiste già uno uguale /// </summary> /// <param name="fieldSettings"></param> public void AddAllegatoItemReportPregressi(Allegati allegatoItemReportPreg) { if (!this.Allegati.Contains(allegatoItemReportPreg)) { this.Allegati.Add(allegatoItemReportPreg); } }
/// <summary> /// Andrea De Marco - Get degli allegati di un item per SystemId /// </summary> /// <param name="getItems"></param> /// <returns></returns> public List <DocsPaVO.Import.Pregressi.Allegati> GetAllegatiByIdItem(string idItem) { List <DocsPaVO.Import.Pregressi.Allegati> result = null; try { DataSet ds_allegati = new DataSet(); using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { //Prendo gli allegati in base al id_item Query query_allegati = InitQuery.getInstance().getQuery("S_GET_ALLEGATI_ITEM_REPORT_PREGRESSI_BY_SYSTEMID"); query_allegati.setParam("id_item", idItem); string commandText = query_allegati.getSQL(); logger.Debug(commandText); dbProvider.ExecuteQuery(ds_allegati, "allegati", commandText); //dbProvider.ExecuteQuery(ds_allegati, query_allegati.ToString()); //Fine Query if (ds_allegati != null && ds_allegati.Tables[0].Rows.Count > 0) { result = new List <DocsPaVO.Import.Pregressi.Allegati>(); for (int i = 0; i < ds_allegati.Tables[0].Rows.Count; i++) { DocsPaVO.Import.Pregressi.Allegati allegato = new DocsPaVO.Import.Pregressi.Allegati(); //Popolamento: allegato.systemId = ds_allegati.Tables[0].Rows[i]["SYSTEM_ID"].ToString(); allegato.idItem = ds_allegati.Tables[0].Rows[i]["ID_ITEM"].ToString(); allegato.idItem = ds_allegati.Tables[0].Rows[i]["ERRORE"].ToString(); allegato.idItem = ds_allegati.Tables[0].Rows[i]["ESITO"].ToString(); //Inserimento: result.Add(allegato); } } } } catch (Exception e) { logger.Debug(e.Message); result = null; } return(result); }
/// <summary> /// Andrea De Marco - Insert del Allegato di un Item Report - Import Pregressi /// </summary> /// <param name="item"></param> /// <param name="idReport"></param> /// <returns></returns> public string InsertAllegatoItemReportPregressi(DocsPaVO.Import.Pregressi.Allegati allegato, string idItem) { string result = string.Empty; try { using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { dbProvider.BeginTransaction(); Query query = InitQuery.getInstance().getQuery("I_DPA_ASS_ALLEGATO"); query.setParam("paramA", DocsPaDbManagement.Functions.Functions.GetSystemIdColName()); query.setParam("paramB", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal("DPA_ASS_ALLEGATO")); query.setParam("id_item", idItem); query.setParam("errore", allegato.errore); query.setParam("esito", allegato.esito); string commandText = query.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - InsertAllegatoItemReportPregressi - DocsPaDB/ImportPregressi.cs - QUERY : " + commandText); logger.Debug("SQL - InsertAllegatoItemReportPregressi - DocsPaDB/ImportPregressi.cs - QUERY : " + commandText); //dbProvider.ExecuteNonQuery(commandText); if (!dbProvider.ExecuteNonQuery(commandText)) { dbProvider.RollbackTransaction(); throw new Exception(); } else { string sql = DocsPaDbManagement.Functions.Functions.GetQueryLastSystemIdInserted("DPA_ASS_ALLEGATO"); System.Diagnostics.Debug.WriteLine("SQL - InsertItemReportPregressi - DocsPaDB/ImportPregressi.cs - QUERY : " + sql); logger.Debug("SQL - InsertItemReportPregressi - DocsPaDB/ImportPregressi.cs - QUERY : " + sql); dbProvider.ExecuteScalar(out result, sql); dbProvider.CommitTransaction(); } } } catch (Exception e) { result = string.Empty; logger.Debug(e.Message); } return(result); }
/// <summary> /// Andrea De Marco - Update dell'allegato Import Pregressi /// </summary> /// <returns></returns> public bool UpdateAllegatoItemReportPregressi(DocsPaVO.Import.Pregressi.Allegati allegato, string sysId) { bool result = true; try { using (DocsPaDB.DBProvider dbProvider = new DBProvider()) { dbProvider.BeginTransaction(); Query query = InitQuery.getInstance().getQuery("U_ALLEGATO_ITEM_REPORT_PREGRESSI"); query.setParam("id_item", allegato.idItem); query.setParam("errore", allegato.errore); query.setParam("esito", allegato.esito); query.setParam("system_id", sysId); string commandText = query.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - UpdateAllegatoItemReportPregressi - DocsPaDB/ImportPregressi.cs - QUERY : " + commandText); logger.Debug("SQL - UpdateAllegatoItemReportPregressi - DocsPaDB/ImportPregressi.cs - QUERY : " + commandText); //dbProvider.ExecuteNonQuery(commandText); if (!dbProvider.ExecuteNonQuery(commandText)) { result = false; dbProvider.RollbackTransaction(); throw new Exception(); } else { dbProvider.CommitTransaction(); } } } catch (Exception e) { result = false; logger.Debug(e.Message); } return(result); }