Пример #1
0
        public Users Auth(Users u)
        {
            ConnectDB con = new ConnectDB();
            CrudDB    db  = new CrudDB();

            try
            {
                con.Connexion.Open();

                List <Users> listeUsers = db.Find <Users>("Users", u, "", con.Connexion);

                Console.WriteLine("Tafa!!!");

                return(listeUsers[0]);
            }
            catch (Exception e)
            {
                Console.WriteLine("Authentication :: Auth :: {0}", e.StackTrace);
            }
            finally
            {
                con.Connexion.Close();
            }
            return(null);
        }
Пример #2
0
        private Group GetGroupRef(Users user)
        {
            ConnectDB con = new ConnectDB();
            CrudDB    db  = new CrudDB();

            try
            {
                con.Connexion.Open();
                List <Group> liste_grp = db.Find <Group>("group", new Group(), "", con.Connexion);

                return(liste_grp[0]);
            }
            catch (Exception e)
            {
            }
            finally
            {
                con.Connexion.Close();
            }
            return(0);
        }
Пример #3
0
        public JsonResult Delete_Data(CrudDB cr)
        {
            string msg = string.Empty;

            try
            {
                SqlCommand com = new SqlCommand("Delete_Func", con);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@Nome", cr.Nome);
                con.Open();
                com.ExecuteNonQuery();
                con.Close();
                msg = "Funcionario Deletado.";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                msg = "Erro...!";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
        }
Пример #4
0
        public bool Subscribe(Users newUser)
        {
            ConnectDB con = new ConnectDB();
            CrudDB    db  = new CrudDB();

            try
            {
                con.Connexion.Open();
                db.Insert("Users", newUser, con.Connexion);
                Console.WriteLine("Utilisateur créé avec succes!");
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
            finally
            {
                con.Connexion.Close();
            }
            return(false);
        }
Пример #5
0
        private string getRefMatiere(string matiere)
        {
            ConnectDB con = new ConnectDB();
            CrudDB    db  = new CrudDB();

            try
            {
                con.Connexion.Open();
                List <Matiere> listeMatiere = db.Find <Matiere>("Matiere", new Matiere(), "", con.Connexion);

                return(listeMatiere[0].REF_MATIERE);
            }
            catch (Exception e)
            {
                Console.WriteLine("Users :: GetMatiere :: {0}", e.StackTrace);
            }
            finally
            {
                con.Connexion.Close();
            }
            return(null);
        }
Пример #6
0
        private string getVille(string val)
        {
            ConnectDB con = new ConnectDB();
            CrudDB    db  = new CrudDB();

            try
            {
                con.Connexion.Open();

                List <Ville> listVilles = db.Find <Ville>("ville", new Ville(val), "", con.Connexion);

                return(listVilles[0].CP);
            }
            catch (Exception e)
            {
                Console.WriteLine("getVille :: Probleme :: {0}", e.StackTrace);
            }
            finally
            {
                con.Connexion.Close();
            }
            return(null);
        }