public bool?ComptabilisationFacturation(string pMoisCompta, string pImprimante, int pGestionMoisCompta, string fileName, string fileHeader, int pTypeEnc, int pTypeMenu) { try { MoisComptable = pMoisCompta; LCentres.AddRange(RetourneTousDirecteur()); LJournal.AddRange(RetourneJournals()); LActiviteProduit.AddRange(RetourneActiviteProduits()); LCorrespondance.AddRange(RetourneCorrespondanceCompta()); LComptabilisation.AddRange(RetourneComptabilisation(pMoisCompta, pTypeMenu.ToString())); LNature.AddRange(new CommonDAL().RetourneAllNature()); LSchema.AddRange(new DBCompta().RetourneDonneesTableSchema()); Parametres = RetourneParametresCompta(); CsParametre paramGlobal = RetourneParametresCompta(); typeExport = Convert.ToInt16(paramGlobal.TypeExportFichier); MoisComptaAuto = Convert.ToInt16(paramGlobal.GestionAutoMoisCompt); return(true); } catch (Exception ex) { string error = ex.Message; return(null); } }
public List <CsParametre> RetourneParametresCompta() { CsParametre _ta; List <CsParametre> ListeTA = new List <CsParametre>(); cn = new SqlConnection(ConnectionString); cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "SPX_INTERFACE_RETOURNE_PARAMETRES"; try { if (this.cn.State == ConnectionState.Closed) { this.cn.Open(); } SqlDataReader reader = cmd.ExecuteReader(); if (!reader.HasRows) { reader.Close(); // throw new Exception("Erreur survenue."); } while (reader.Read()) { _ta = new CsParametre(); _ta.GestionAutoMoisCompt = string.IsNullOrEmpty(reader.GetValue(0).ToString()) ? string.Empty: reader.GetValue(0).ToString().Trim(); _ta.TypeExportFichier = string.IsNullOrEmpty(reader.GetValue(1).ToString()) ? string.Empty : reader.GetValue(1).ToString().Trim(); _ta.ModeTraitement = string.IsNullOrEmpty(reader.GetValue(2).ToString()) ? string.Empty : reader.GetValue(2).ToString().Trim(); _ta.CheminFichier = string.IsNullOrEmpty(reader.GetValue(3).ToString()) ? string.Empty : reader.GetValue(3).ToString().Trim(); _ta.CompteAnalytique = string.IsNullOrEmpty(reader.GetValue(4).ToString()) ? string.Empty : reader.GetValue(4).ToString().Trim(); ListeTA.Add(_ta); } //Fermeture reader reader.Close(); return(ListeTA); } catch (Exception ex) { throw new Exception("SPX_INTERFACE_RETOURNE_PARAMETRES" + ":" + ex.Message); } finally { if (this.cn.State == ConnectionState.Open) { this.cn.Close(); // Fermeture de la connection } cmd.Dispose(); } }