public List<LoginFunction_Result> LoginUser(string nume, string passward) { using (dbEntities e = new dbEntities()) { return e.LoginFunction(nume, passward).ToList<LoginFunction_Result>(); } }
public List<ProceduraRealJudet_Result> GetProceduraReal(int i) { using (dbEntities e = new dbEntities()) { return e.ProceduraRealJudet(i).ToList<ProceduraRealJudet_Result>(); } }
public List<StiriProcedure_Result> GetStiri() { using (dbEntities e = new dbEntities()) { return e.StiriProcedure().ToList<StiriProcedure_Result>(); } }
// Update Challenge where ID == challengeID public void updateChallenge(int challengeID) { using (dbEntities update = new dbEntities()) { update.updateChallenge(challengeID); } }
public List<HistoryPadure_Result> GetHistoryPadure() { using (dbEntities e = new dbEntities()) { return e.HistoryPadure().ToList<HistoryPadure_Result>(); } }
public List<ProcedureUpgrades_Result> GetProceduraUpgrades(int i) { using (dbEntities e = new dbEntities()) { return e.ProcedureUpgrades(i).ToList<ProcedureUpgrades_Result>(); } }
// 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>(); } }
// 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>(); } }
// 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>(); } }
// 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>(); } }
// 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>(); } }
public List<HartaCampanii_Result> HartaCuCampanii() { using (dbEntities e = new dbEntities()) { return e.HartaCampanii().ToList<HartaCampanii_Result>(); } }
public void Test(int i) { using (dbEntities e = new dbEntities()) { e.TryScor(); } }
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; } }
// 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>(); } }
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; }
public List<ProceduraDeces_Result1> PreiaDeces(int IDanimal,int IDuser) { using (dbEntities e = new dbEntities()) { return e.ProceduraDeces2(IDanimal, IDuser).ToList<ProceduraDeces_Result1>(); } }
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; }
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; }
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; }
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(); }
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(); }
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; }
// 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 ); } }
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; ; }
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); }
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); }
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; }
public List<TranzactiiCumparare> GetTranzactieCumparare() { List<TranzactiiCumparare> lista= new dbEntities().TranzactiiCumparares.Take<TranzactiiCumparare>(30).ToList<TranzactiiCumparare>(); return lista; }
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; }