Esempio n. 1
0
 public List<LoginFunction_Result> LoginUser(string nume, string passward)
 {
     using (dbEntities e = new dbEntities())
     {
         return e.LoginFunction(nume, passward).ToList<LoginFunction_Result>();
     }
 }
Esempio n. 2
0
 public List<ProceduraRealJudet_Result> GetProceduraReal(int i)
 {
     using (dbEntities e = new dbEntities())
     {
         return e.ProceduraRealJudet(i).ToList<ProceduraRealJudet_Result>();
     }
 }
Esempio n. 3
0
 public List<StiriProcedure_Result> GetStiri()
 {
     using (dbEntities e = new dbEntities())
     {
         return e.StiriProcedure().ToList<StiriProcedure_Result>();
     }
 }
Esempio n. 4
0
 // Update Challenge where ID == challengeID
 public void updateChallenge(int challengeID)
 {
     using (dbEntities update = new dbEntities())
     {
         update.updateChallenge(challengeID);
     }
 }
Esempio n. 5
0
 public List<HistoryPadure_Result> GetHistoryPadure()
 {
     using (dbEntities e = new dbEntities())
     {
         return e.HistoryPadure().ToList<HistoryPadure_Result>();
     }
 }
Esempio n. 6
0
 public List<ProcedureUpgrades_Result> GetProceduraUpgrades(int i)
 {
     using (dbEntities e = new dbEntities())
     {
         return e.ProcedureUpgrades(i).ToList<ProcedureUpgrades_Result>();
     }
 }
Esempio n. 7
0
 // Get Achievements from database using the user's ID
 public List<getAchievement_Result> getAchievementsFromDB(int userID)
 {
     using (dbEntities select = new dbEntities())
     {
         return select.getAchievement(userID).ToList<getAchievement_Result>();
     }
 }
Esempio n. 8
0
 // Retrieve animal history from Database
 public List<getAnimalStats_Result> getAnimalHistoryFromDB(int user_id, string imagine1)
 {
     using (dbEntities select = new dbEntities())
     {
         return select.getAnimalStats(user_id, imagine1).ToList<getAnimalStats_Result>();
     }
 }
Esempio n. 9
0
 // Retrieve a list of challenges using the user's ID as parameter
 public List<getChallenges_Result> getChallengesFromDB(int userID)
 {
     using (dbEntities select = new dbEntities())
     {
         return select.getChallenges(userID).ToList<getChallenges_Result>();
     }
 }
Esempio n. 10
0
 // Retrieve all plants images from the database
 public List<getPlants_Result> getPlantsFromDB(int isFromPadure)
 {
     using (dbEntities select = new dbEntities())
     {
         return select.getPlants(isFromPadure).ToList<getPlants_Result>();
     }
 }
Esempio n. 11
0
 // Retrieve plant history from database
 public List<getPlantHistory_Result> getPlantHistoryFromDB(int userID, string imagine1)
 {
     using (dbEntities select = new dbEntities())
     {
         return select.getPlantHistory(userID, imagine1).ToList<getPlantHistory_Result>();
     }
 }
Esempio n. 12
0
 public List<HartaCampanii_Result> HartaCuCampanii()
 {
     using (dbEntities e = new dbEntities())
     {
         return e.HartaCampanii().ToList<HartaCampanii_Result>();
     }
 }
Esempio n. 13
0
 public void Test(int i)
 {
     using (dbEntities e = new dbEntities())
     {
         
         e.TryScor();
     }
 }
Esempio n. 14
0
 public List<StatisticaAimal_Result> StatisticaAnimal(int id, int idRegiune)
 {
     using (dbEntities e = new dbEntities())
     {
         List<StatisticaAimal_Result> lista= e.StatisticaAimal(id, idRegiune).ToList<StatisticaAimal_Result>();
         return lista;
     }
 }
Esempio n. 15
0
 // Retrieve all animal images
 public List<SelectAnimal_Result> GetAnimalFromDB(int isFromPadure)
 {
     using (dbEntities select = new dbEntities())
     {
         select.Connection.Open();
         return select.SelectAnimal(isFromPadure).ToList<SelectAnimal_Result>();
     }
 }
Esempio n. 16
0
 public List<ComentariiDonatiiType> SelectDonatiiComentariiByDonatie(int id)
 {
     dbEntities context = new dbEntities();
     List<ComentariiDonatiiType> L = new List<ComentariiDonatiiType>();
     foreach (ComentariiDonatiiType comment in context.SelectComentariiDonatiiFct(id))
         L.Add(comment);
     return L;
 }
Esempio n. 17
0
        public List<ProceduraDeces_Result1> PreiaDeces(int IDanimal,int IDuser)
        {
            using (dbEntities e = new dbEntities())
            {

                return e.ProceduraDeces2(IDanimal, IDuser).ToList<ProceduraDeces_Result1>();
            }
            
        }
Esempio n. 18
0
 public Real SelectCampanieById(int id)//nu o folosesc inca
 {
     dbEntities context = new dbEntities();
     var campanie = (from r in context.Reals
                where r.ID==id
                select r).First();
     Real Campaign = campanie;
     return Campaign;
 }
Esempio n. 19
0
 public List<DonatiiDetalii> SelectDonationsByUserId(int id)
 {
     dbEntities context = new dbEntities();
     List<DonatiiDetalii> L=new List<DonatiiDetalii>();
     foreach (DonatiiDetalii D in context.SelectDonatiiFct(id))
     {
         L.Add(D);
     }
     return L;
 }
Esempio n. 20
0
 public List<ComentariiDetaliat> SelectComentarii(int campanie_id)
 {
     dbEntities context = new dbEntities();
     List<ComentariiDetaliat> L = new List<ComentariiDetaliat>();
     foreach (ComentariiDetaliat comment in context.SelectComentariiFct(campanie_id))
     {
         L.Add(comment);   
     }
     return L;
 }
Esempio n. 21
0
 public void InsertCommentDonations( string text, int FK_donatie, int FK_user)
 {
     dbEntities context = new dbEntities();
     ComentariiDonatii Comment = new ComentariiDonatii();
     Comment.TextComentariu = text;
     Comment.FK_Donatie = FK_donatie;
     Comment.FK_Usr = FK_user;
     Comment.Data = DateTime.Now;
     context.ComentariiDonatiis.AddObject(Comment);
     // ComentariiReal.CreateComentariiReal(id, text, FK_real, FK_user, DateTime.Now);
     context.SaveChanges();
 }
Esempio n. 22
0
 public void InsertComment(string text,int FK_real,int FK_user)
 {
     dbEntities context = new dbEntities();
     ComentariiReal Comment = new ComentariiReal();
     Comment.TextCampanie = text;
     Comment.FK_Real = FK_real;
     Comment.FK_User = FK_user;
     Comment.Data = DateTime.Now;
     context.ComentariiReals.AddObject(Comment);
    // ComentariiReal.CreateComentariiReal(id, text, FK_real, FK_user, DateTime.Now);
     context.SaveChanges();
 }
Esempio n. 23
0
 public List<Real> SelectCampaigns()
 {
     List<Real> c = new List<Real>();
     dbEntities context = new dbEntities();
     var camp = from r in context.Reals
             select r;
     foreach (Real campanie in camp)
     {
         c.Add(campanie);
     }
     return c;
 }
Esempio n. 24
0
 // Update Achievements where ID == userID
 public void updateAchievements(
     int userID, int hunger, int education, int equality, int mortality,
     int maternalHealth, int disease, int environment, int partnership
     )
 {
     using (dbEntities update = new dbEntities())
     {
         update.updateAchievements(
             userID, hunger, education, equality, mortality,
             maternalHealth, disease, environment, partnership
             );
     }
 }
Esempio n. 25
0
 public Usr GetUserByUsernameAndPassword(string username, string Password)
 {
     var aux = new dbEntities().Usrs.Where<Usr>(x => x.Usr1 == username && x.Pass == Password).ToArray<Usr>();
     if (aux.Length == 1) return aux[0];
     return null; ;
 }
Esempio n. 26
0
 public void AddTranzactie(string Nume,string animal,int numar,string numefirma,int pret,string vinde,string cumpara)
 {
     dbEntities db = new dbEntities();
     db.StoredProcedure1(Nume, animal, numefirma, DateTime.Now, numar, DateTime.Now, pret, vinde, cumpara);
    
 }
Esempio n. 27
0
        public void AddCumparare(string numev,string numec, string numea, string numefirma, int pret,short numar,int id )
        {

            dbEntities db = new dbEntities();
            db.BagaLaMyTrades(numev, numec, numea, numefirma, "lala", DateTime.Now, pret, numar, id);
        }
Esempio n. 28
0
        public List<TranzactiiCumparare> Cauta(string regiune, string keyward, int cv, bool pretquantity, bool ascdsc, bool enull)
        {
            #region cumparare
            List<TranzactiiCumparare> t=new List<TranzactiiCumparare>();
            using (dbEntities db = new dbEntities())
            {
                
                if (enull == true)
                {
                    var b = from a in db.TranzactiiCumparares
                            where a.Regiune == regiune && a.Nume.Contains(keyward) && a.Vanzare=="1"
                            select a;
                    foreach (var c in b)
                        t.Add(c);
                    return t;
                }
                else
                {

                    if (pretquantity == true && ascdsc == true)
                    {
                        var b = from a in db.TranzactiiCumparares
                                where a.Regiune == regiune && a.Nume.Contains(keyward) && a.Vanzare == "1"
                                orderby a.Pret ascending
                                select a;
                        foreach (var c in b)
                            t.Add(c);
                        return t;
                    }
                    else if (pretquantity == false && ascdsc == true)
                    {
                        var b = from a in db.TranzactiiCumparares
                                where a.Regiune == regiune && a.Nume.Contains(keyward) && a.Vanzare == "1"
                                orderby a.Numar ascending
                                select a;
                        foreach (var c in b)
                            t.Add(c);
                        return t;
                    }
                    else if (pretquantity == false && ascdsc == false)
                    {
                        var b = from a in db.TranzactiiCumparares
                                where a.Regiune == regiune && a.Nume.Contains(keyward) && a.Vanzare == "1"
                                orderby a.Numar descending
                                select a;
                        foreach (var c in b)
                            t.Add(c);
                        return t;
                    }
                    else if (pretquantity == true && ascdsc == false)
                    {
                        var b = from a in db.TranzactiiCumparares
                                where a.Regiune == regiune && a.Nume.Contains(keyward) && a.Vanzare == "1"
                                orderby a.Pret descending
                                select a;
                        foreach (var c in b)
                            t.Add(c);
                        return t;
                    }
                }
            }
            #endregion
            return t; 
        
        }
Esempio n. 29
0
 public List<TranzactiiCumparare> GetTranzactieCumparare()
 {
  List<TranzactiiCumparare> lista= new dbEntities().TranzactiiCumparares.Take<TranzactiiCumparare>(30).ToList<TranzactiiCumparare>();
  return lista;
 }
Esempio n. 30
0
 public bool RegisterUser(string firstname, string lastname, string username, string password, string email, string region)
 {
     dbEntities db = new dbEntities();
     try
     {
         Usr u = new Usr() { Nume = lastname, Prenume = firstname, Usr1 = username, Pass = password, Mail = email, Data_Inreg = DateTime.Now, Data_LastLogIn = DateTime.Now, BaniDonati = 0, NrDonatii = 0, Scor = 10, Rank = "Rank1", IsForDelete = false };
         db.AddToUsrs(u);
         db.SaveChanges();
         //---
         int usrid = db.Usrs.Where<Usr>(x => x.Usr1 == username).ToArray<Usr>()[0].ID;
         Regiune r = new Regiune() { Nume = region, FK_User = usrid };
         db.AddToRegiunes(r);
         db.SaveChanges();
     }
     catch(Exception ex)
     { return false; }
     finally { db.Dispose(); }
     return true;
 }