//Pioche dans ABO07 public static DataTable ListeDesClientPourEnvoieMailRegroupement(int IdClient, List <string> lstPeriode, List <string> lstRegroupement, bool sms, bool email) { try { using (ABO07Entities context = new ABO07Entities()) { var _LeCENTFAC = context.CENTFAC; var query = ( from x in _LeCENTFAC where (lstPeriode == null || lstPeriode.Contains(x.PERIODE)) && (IdClient == 0 || x.FK_IDCLIENT == IdClient) && (lstRegroupement != null && lstRegroupement.Contains(x.REGROUPEMENT)) && (x.ISFACTUREEMAIL != null || x.ISFACTURESMS != null) && (x.EMAIL != null || x.TELEPHONE != null) select new { x.CENTRE, x.CLIENT, x.ORDRE, NomClient = x.NOMABON, x.PERIODE, montant = x.TOTFTTC, numfact = x.FACTURE, ISFACTURE = x.ISFACTUREEMAIL.Value, ISSMS = x.ISFACTURESMS.Value, x.EMAIL, x.TELEPHONE }); if (!sms && !email && query != null) { query = (from x in query where x.ISFACTURE || x.ISSMS select x); } else if (sms && query != null) { query = (from x in query where x.ISSMS select x); } else if (email && query != null) { query = (from x in query where x.ISFACTURE select x); } return(Galatee.Tools.Utility.ListToDataTable(query.ToList())); } } catch (Exception ex) { throw ex; } }
public static bool InsertEntityAbo07 <T>(T entity, ABO07Entities pContext) where T : class { try { if (pContext.Entry(entity).State == EntityState.Detached) { pContext.Set <T>().Add(entity); } return(true); } catch (Exception ex) { throw ex; } }
public static bool UpdateEntity <T>(T pEntity, ABO07Entities pContext) where T : class { try { if (pContext.Entry(pEntity).State == EntityState.Detached) { pContext.Set <T>().Attach(pEntity); } pContext.Entry(pEntity).State = EntityState.Modified; return(true); } catch (Exception ex) { throw ex; } }
//Pioche dans ABO07 public static DataTable ListeDesFactures(string centre, string client, string ordre, string periode, string numFacture) { try { using (ABO07Entities context = new ABO07Entities()) { List <object> query = null; using (galadbEntities context1 = new galadbEntities()) { CENTFAC MyCENFAC = new CENTFAC(); var _LeCENTFAC = context.CENTFAC; var _LCPROFAC = context.CPROFAC; var _leCREDFAC = context.CREDFAC; var _laREDVANCE = context1.REDEVANCE; var _lEVENEMENT = context1.EVENEMENT; //var _ = context1.ENTFAC; var _REDFACT = context1.REDFAC; var _ENTFAC = context1.ENTFAC; var _PROFAC = context1.PROFAC; var _AG = context1.AG; #region if (_leCREDFAC.FirstOrDefault(d => d.CENTRE == centre && d.CLIENT == client && d.FACTURE == numFacture && d.PERIODE == periode) != null) { query.Add(ListeFactureABO07(centre, client, ordre, periode, numFacture)); } #endregion #region else { //query = ListeFacturegaladb(centre, client, ordre, periode, numFacture, query, _LeCENTFAC); } #endregion } return(Galatee.Tools.Utility.ListToDataTable(query)); } } catch (Exception ex) { throw ex; } }
public List <CsCredfac> GetCRedFacByRedevance(string centre, string periode) { try { using (ABO07Entities context = new ABO07Entities()) { List <CsCredfac> Credfac = Entities.ConvertObject <CsCredfac, CREDFAC>(context.CREDFAC.Where(r => r.REDEVANCE == Enumere.Redevance).ToList()); if (!string.IsNullOrWhiteSpace(centre)) { Credfac = Credfac.Where(r => r.CENTRE == centre).ToList(); } if (!string.IsNullOrWhiteSpace(periode)) { Credfac = Credfac.Where(r => r.PERIODE == periode).ToList(); } return(Credfac); } } catch (Exception ex) { throw ex; } }
public static DataTable ListeDesClientPourEnvoieMail(List <int> CentreClient, List <string> lstPeriode, bool sms, bool email) { try { using (ABO07Entities context = new ABO07Entities()) { var _LeCENTFAC = context.CENTFAC; IEnumerable <object> query = from x in _LeCENTFAC where CentreClient.Contains(x.FK_IDCENTRE) && lstPeriode.Contains(x.PERIODE) && ((x.ISFACTUREEMAIL != null && x.ISFACTUREEMAIL != false) || (x.ISFACTURESMS != null && x.ISFACTURESMS != false)) select new { x.CENTRE, x.CLIENT, x.ORDRE, x.FACTURE, x.PERIODE, x.REGROUPEMENT, x.CODCONSO, x.CATEGORIECLIENT, x.DFAC, x.TOTFTAX, x.TOTFHT, x.TOURNEE, //x.MOISCOMPTA, x.COMMUNE, //x.DATEENC, //x.TYPEENC, x.LOTRI, x.COPER, //x.MODEP, x.ANCIENREPORT, x.TOTFTTC, x.LIENFAC, x.SECTEUR, x.QUARTIER, x.ORDTOUR, x.NOMABON, x.RUE, x.NOMRUE, x.DRESABON, //x.DATEFLAG, x.USERCREATION, x.DATECREATION, x.USERMODIFICATION, x.DATEMODIFICATION, x.PK_ID, x.FK_IDCENTRE, x.FK_IDREGROUPEMENT, x.FK_IDCODECONSOMMATEUR, x.FK_IDCATEGORIECLIENT, x.FK_IDMODEPAIEMENT, x.FK_IDTOURNEE, x.FK_IDCOMMUNE, x.FK_IDCOPER, x.FK_IDSECTEUR, x.FK_IDQUARTIER, x.FK_IDRUE, x.ISFACTUREEMAIL, x.EMAIL, x.ISFACTURESMS, x.TELEPHONE, x.FK_IDCLIENT }; return(Galatee.Tools.Utility.ListToDataTable(query)); //var _LeCENTFAC = context.CENTFAC; // IEnumerable<object> query =( // from x in _LeCENTFAC // where // (lstPeriode == null || lstPeriode.Contains(x.PERIODE)) && // (CentreClient == null || CentreClient.Contains(x.FK_IDCENTRE )) && // (x.ISFACTUREEMAIL != null || x.ISFACTURESMS != null) && // ( x.EMAIL != null || x.TELEPHONE!=null) // select new // { // x.CENTRE, // x.CLIENT, // x.ORDRE, // NomClient = x.NOMABON, // x.PERIODE, // montant = x.TOTFTTC, // numfact = x.FACTURE, // ISFACTURE=x.ISFACTUREEMAIL , // ISSMS= x.ISFACTURESMS // ,x.EMAIL // ,x.TELEPHONE // }); ////if (!sms && !email && query!=null) ////{ //// query = (from x in query //// where x.ISFACTURE || x.ISSMS //// select x); ////} ////else if (sms && query != null) ////{ //// query = (from x in query //// where x.ISSMS //// select x); ////} ////else if (email && query != null) ////{ //// query = (from x in query //// where x.ISFACTURE //// select x); ////} //return Galatee.Tools.Utility.ListToDataTable(query); } } catch (Exception ex) { throw ex; } }
public static List <CENTFAC> ListeFactureDuplicata(string centre, string client, string ordre, string periode, string numFacture) { //using (ABO07Entities c = new ABO07Entities()) //{ //RECUPE DE L'ENTETE DE FACTURE #region RECUPE DE L'ENTETE DE FACTURE string Pperiode = string.IsNullOrEmpty(periode) ? "" : periode; string PnumFacture = string.IsNullOrEmpty(numFacture) ? "" : numFacture; string vide = ""; ABO07Entities c = new ABO07Entities(); var query_ = (from d in c.CENTFAC where (d.CENTRE == centre && d.CLIENT == client && d.ORDRE == ordre && (d.FACTURE == numFacture || PnumFacture == vide) && (d.PERIODE == periode || Pperiode == vide)) select d).ToList(); return((List <CENTFAC>)query_); #endregion ////UPDATE DE LA STRUCTURE CsLafactureClient //#region UPDATE DE LA STRUCTURE CsLafactureClient // CsLafactureClient _tt = new CsLafactureClient(); // //_tt = Galatee.Entity.Model.EserviceProcedure.ListeFactureABO07(centre, client, ordre, periode, numFacture); // //Galatee.Entity.Model.ENTFAC dt_ = Galatee.Entity.Model.EserviceProcedure.ListeFacturegaladb(centre, client, ordre, periode, numFacture); // _tt._LeEntatfac = Entities.ConvertObject<CsEnteteFacture, Galatee.Entity.Model.CENTFAC>(dt); // _tt._LstRedFact = Entities.ConvertObject<List<CsRedevanceFacture>, IEnumerable<Galatee.Entity.Model.CREDFAC>>(dt.CREDFAC.ToList()); // _tt._LstProfact = Entities.ConvertObject<List< CsProduitFacture>,IEnumerable<Galatee.Entity.Model.CPROFAC>>(dt.CPROFAC.ToList()); // List<CsRedevance> lestranche =ListeDesREdevance(); // if (_tt._Ls // foreach (CsRedevanceFacture item in _tt._LstRedFact) // { // CsRedevance laTranchRech = lestranche.FirstOrDefault(p => p.NUMREDEVANCE == item.Redevance && item.Produit == p.FK_PRODUIT && item.Tranche == p.TRANCHE); // if (laTranchRech != null) // { // item.Produit = laTranchRech.FK_PRODUIT; // item.LibelleRedevance = laTranchRech.LIBELLE; // } // } // List<CsProduitFacture> lesProduitFacture = ListeDesProduit(); // foreach (var item in _tt._LstProfact) // { // CsProduitFacture leProduit = lesProduitFacture.FirstOrDefault(p => p.Pk_Id == item.Pk_Id && item.Compteur == p.Compteur && item.Centre == p.Centre); // if tRedFact != null && _tt._LstRedFact.Count > 0) // {(leProduit != null) // { // item.Produit = leProduit.Produit; // } // } // List<CsCategorieClient> lescategorieclient = ListeDesCategorieClient(); // CsCategorieClient lacategorieclient = lescategorieclient.FirstOrDefault(p => p.PK_CATEGORIECLIENT == _tt._LeEntatfac.Catcli); // if (lacategorieclient != null) // { // _tt._LeEntatfac.Catcli = lacategorieclient.LIBELLE; // } // } // #endregion // return _tt; //}; }