Пример #1
0
        public static Compte Maj(Compte cA)
        {
            Log.Logger.Debug("Debut Compte.Maj(" + cA.Id + ")");
            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);

                Compte c = ob.Comptes.Find((ctemp) => ctemp.Id == cA.Id);
                c.Libelle            = cA.Libelle;
                c.SoldeInitial       = cA.SoldeInitial;
                c.Banque             = cA.Banque;
                c.Guichet            = cA.Guichet;
                c.NoCompte           = cA.NoCompte;
                c.Clef               = cA.Clef;
                c.MinGraphSold       = cA.MinGraphSold;
                c.MaxGraphSold       = cA.MaxGraphSold;
                c.SeuilAlerte        = cA.SeuilAlerte;
                c.SeuilAlerteFinal   = cA.SeuilAlerteFinal;
                c.TypEvol            = cA.TypEvol;
                c.Utilisateur        = cA.Utilisateur;
                c.EstDansTotalCompte = cA.EstDansTotalCompte;

                CallContext.SetData(KEY.OB, ob);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(cA);
        }
Пример #2
0
        public static int ChercheChequeSuivant(Compte cA)
        {
            Log.Logger.Debug("Debut Echeancier.ChercheChequeSuivant(" + cA.Id + ")");
            int retour = 0;

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                List <Operation> lo = ob.Operations.Where(ot => ot.Compte.Id == cA.Id && ot.ModePaiement.Id == 8).OrderByDescending(ot => ot.Date).ToList();
                if (lo.Count > 0)
                {
                    string[] tab = lo[0].Libelle.Split('°');
                    if (tab.Length > 1)
                    {
                        bool b = int.TryParse(tab[1], out retour);
                        retour++;
                        if (!b)
                        {
                            retour = 0;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(retour);
        }
Пример #3
0
 /// <summary>
 /// Permet de mettre a jour un parametre
 /// </summary>
 /// <param name="p">Parametre a mettre a jour</param>
 public static Param Maj(Param pA)
 {
     Log.Logger.Debug("Debut Param.Maj(" + pA.Id + ")");
     try
     {
         OB    ob = (OB)CallContext.GetData(KEY.OB);
         Param p  = ob.Params.Find((ptemp) => ptemp.Id == pA.Id);
         p.Ident = pA.Ident;
         p.Val1  = pA.Val1;
         p.Val2  = pA.Val2;
         p.Val3  = pA.Val3;
         p.Int1  = pA.Int1;
         p.Int2  = pA.Int2;
         p.Int3  = pA.Int3;
         p.Dec1  = pA.Dec1;
         p.Dec2  = pA.Dec2;
         p.Dec3  = pA.Dec3;
         p.Dat1  = pA.Dat1;
         p.Dat2  = pA.Dat2;
         p.Dat3  = pA.Dat3;
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
     return(pA);
 }
Пример #4
0
        public static DataSet DataSet()
        {
            DataSet   ds = new DataSet();
            DataTable t  = new DataTable("Fichiers");

            ds.Tables.Add(t);

            t.Columns.Add("Id", typeof(int));
            t.Columns.Add("Date Import", typeof(DateTime));
            t.Columns.Add("Nom", typeof(string));
            t.Columns.Add("Type", typeof(string));
            t.Columns.Add("Chemin", typeof(string));
            t.Columns.Add("Tiers Op.", typeof(string));
            t.Columns.Add("Libelle Op.", typeof(string));
            t.Columns.Add("Montant Op.", typeof(double));

            OB ob = (OB)CallContext.GetData(KEY.OB);

            foreach (Fichier item in ob.Fichiers)
            {
                DataRow row = t.NewRow();

                row["Id"]          = item.Id;
                row["Date Import"] = item.Date;
                row["Type"]        = item.Type;
                row["Nom"]         = item.InitialName;
                row["Chemin"]      = item.Chemin;
                row["Tiers Op."]   = item.Operation.Tiers;
                row["Libelle Op."] = item.Operation.Libelle;
                row["Montant Op."] = item.Operation.Montant;

                t.Rows.Add(row);
            }
            return(ds);
        }
Пример #5
0
 public static void Delete(ModePaiement mpA)
 {
     Log.Logger.Debug("Debut ModePaiement.Delete(" + mpA.Id + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         ob.ModePaiements.RemoveAll((mp) => mp.Id == mpA.Id);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
 }
Пример #6
0
 public static void Delete(Utilisateur uA)
 {
     Log.Logger.Debug("Debut Utilisateur.Delete(" + uA.Id + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         ob.Utilisateurs.RemoveAll((u) => u.Id == uA.Id);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
 }
Пример #7
0
 public static void Delete(Fichier f)
 {
     Log.Logger.Debug("Debut Fichier.Delete(" + f.Id + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         ob.Fichiers.RemoveAll(ft => ft.Id == f.Id);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
 }
Пример #8
0
 public static void Delete(TotalCompte tcA)
 {
     Log.Logger.Debug("Debut TotalCompte.Delete(" + tcA.Id + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         ob.ListeTotalCompte.RemoveAll((tc) => tc.Id == tcA.Id);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
 }
Пример #9
0
 /// <summary>
 /// Pouvoir supprimer un ou plusieurs parametre celon l'identifiant
 /// </summary>
 /// <param name="ident">Identifiant du ou des parametre a supprimer</param>
 public static void Delete(string ident)
 {
     Log.Logger.Debug("Debut Param.Delete(" + ident + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         ob.Params.RemoveAll((p) => p.Ident == ident);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
 }
Пример #10
0
 public static void Delete(Operation oP)
 {
     Log.Logger.Debug("Debut Operation.Delete(" + oP.Id + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         ob.Operations.RemoveAll((o) => o.Id == oP.Id);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
 }
Пример #11
0
 /// <summary>
 /// Permet de creer un parametre
 /// </summary>
 /// <param name="p">Parametre a creer</param>
 public static Param Sauve(Param p)
 {
     Log.Logger.Debug("Debut Param.Sauve(" + p.Ident + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         p.Id = ob.Params.Count != 0 ? ob.Params.Max(u => u.Id) + 1 : 1;
         ob.Params.Add(p);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
     return(p);
 }
Пример #12
0
        public static List <Compte> ChargeTout(Utilisateur u)
        {
            Log.Logger.Debug("Debut Compte.ChargeTout()");
            List <Compte> lc = new List <Compte>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lc = ob.Comptes.Where(c => c.Utilisateur.Id == u.Id).OrderBy(c => c.Libelle).ToList();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lc);
        }
Пример #13
0
        /// <summary>
        /// Chargement d'une liste de parametre
        /// </summary>
        /// <param name="ident">Identifiant de la liste de parametre a charger</param>
        /// <returns>Liste de Parametre</returns>
        public static List <Param> Charge(string ident)
        {
            Log.Logger.Debug("Debut Categorie.Charge(" + ident + ")");
            List <Param> lp = new List <Param>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lp = ob.Params.Where(pt => pt.Ident == ident).ToList();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lp);
        }
Пример #14
0
        /// <summary>
        /// Chargement d'un parametre
        /// </summary>
        /// <param name="id">Id du parametre</param>
        /// <returns>Parametre charge</returns>
        public static Param Charge(int id)
        {
            Log.Logger.Debug("Debut Categorie.Charge(" + id + ")");
            Param p = new Param();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                p = ob.Params.Find(pt => pt.Id == id);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(p);
        }
Пример #15
0
        public static ModePaiement Charge(int id)
        {
            Log.Logger.Debug("Debut ModePaiement.Charge(" + id + ")");
            ModePaiement mp = new ModePaiement();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                mp = ob.ModePaiements.Where(mpt => mpt.Id == id).First();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(mp);
        }
Пример #16
0
        public static Compte Charge(int id)
        {
            Log.Logger.Debug("Debut Compte.Charge(" + id + ")");
            Compte c = new Compte();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                c = ob.Comptes.Where(ct => ct.Id == id).First();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(c);
        }
Пример #17
0
        /// <summary>
        /// Chargement de tous les parametres
        /// </summary>
        /// <returns>Lsite de Param</returns>
        public static List <Param> ChargeTout()
        {
            Log.Logger.Debug("Debut Param.ChargeTout()");
            List <Param> lp = new List <Param>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lp = ob.Params;
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lp);
        }
Пример #18
0
 public static Compte Sauve(Compte cA)
 {
     Log.Logger.Debug("Debut Copmpte.Sauve(" + cA.Libelle + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         cA.Id = ob.Comptes.Count != 0 ? ob.Comptes.Max(u => u.Id) + 1 : 1;
         ob.Comptes.Add(cA);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
     return(cA);
 }
Пример #19
0
        public static List <Operation> ChargeToutUtilisateur(Utilisateur u)
        {
            Log.Logger.Debug("Debut Operation.ChargeToutUtilisateur(" + u.Login + ")");
            List <Operation> lo = new List <Operation>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lo = ob.Operations.Where(ot => ot.Compte.Utilisateur.Id == u.Id).ToList();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lo);
        }
Пример #20
0
 public static Operation Sauve(Operation o)
 {
     Log.Logger.Debug("Debut Operation.Sauve(" + o.Libelle + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         o.Id = ob.Operations.Count != 0 ? ob.Operations.Max(u => u.Id) + 1 : 1;
         ob.Operations.Add(o);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
     return(o);
 }
Пример #21
0
        public static Operation Charge(int id)
        {
            Log.Logger.Debug("Debut Operation.Charge(" + id + ")");
            Operation o = new Operation();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                o = ob.Operations.Find(ot => ot.Id == id);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(o);
        }
Пример #22
0
        public static DateTime GetMinDate(Compte cP)
        {
            Log.Logger.Debug("Debut Operation.SoldeCompteAt(" + cP.Id + ")");
            DateTime retour = DateTime.Now;

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                retour = ob.Operations.Where(ot => ot.Compte.Id == cP.Id).Min(ot => ot.Date);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(retour);
        }
Пример #23
0
        public static TotalCompte Charge(int id)
        {
            Log.Logger.Debug("Debut TotalCompte.Charge(" + id + ")");
            TotalCompte tc = new TotalCompte();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                tc = ob.ListeTotalCompte.Where(ttc => ttc.Id == id).First();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(tc);
        }
Пример #24
0
        public static Utilisateur Charge(string login)
        {
            Log.Logger.Debug("Debut Utilisateur.Charge(" + login + ")");
            Utilisateur retour = new Utilisateur();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                retour = ob.Utilisateurs.Find((u) => u.Login == login);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(retour ?? new Utilisateur());
        }
Пример #25
0
        public static List <Utilisateur> ChargeTout()
        {
            Log.Logger.Debug("Debut Utilisateur.ChargeTous()");
            List <Utilisateur> lu = new List <Utilisateur>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lu = ob.Utilisateurs;
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lu);
        }
Пример #26
0
        public List <Operation> Operations()
        {
            Log.Logger.Debug("Debut Operations()");
            List <Operation> lo = new List <Operation>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lo = ob.Operations.Where(ot => ot.Compte.Id == Id).OrderByDescending(x => x.Date).ToList();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lo);
        }
Пример #27
0
        public static Utilisateur Charge(int id)
        {
            Log.Logger.Debug("Debut Utilisateur.Charge(" + id + ")");
            Utilisateur retour = new Utilisateur();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                retour = ob.Utilisateurs.Find((u) => u.Id == id);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(retour);
        }
Пример #28
0
 public static ModePaiement Sauve(ModePaiement mpA)
 {
     Log.Logger.Debug("Debut ModePaiement.Sauve(" + mpA.Libelle + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         mpA.Id = ob.ModePaiements.Count != 0 ? ob.ModePaiements.Max(u => u.Id) + 1 : 1;
         ob.ModePaiements.Add(mpA);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
     return(mpA);
 }
Пример #29
0
 public static Utilisateur Sauve(Utilisateur uA)
 {
     Log.Logger.Debug("Debut Utilisateur.Sauve(" + uA.Login + ")");
     try
     {
         OB ob = (OB)CallContext.GetData(KEY.OB);
         uA.Id = ob.Utilisateurs.Count != 0 ? ob.Utilisateurs.Max(u => u.Id) + 1 : 1;
         ob.Utilisateurs.Add(uA);
         CallContext.SetData(KEY.OB, ob);
     }
     catch (Exception ex)
     {
         Log.Logger.Error(ex.Message);
         throw;
     }
     return(uA);
 }
Пример #30
0
        public static List <ModePaiement> ChargeTout()
        {
            Log.Logger.Debug("Debut ModePaiement.ChargeTout()");
            List <ModePaiement> lmp = new List <ModePaiement>();

            try
            {
                OB ob = (OB)CallContext.GetData(KEY.OB);
                lmp = ob.ModePaiements.OrderBy(mp => mp.Libelle).ToList();
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
                throw;
            }
            return(lmp);
        }