Esempio n. 1
0
        public bool ZalogujLekarz(LEKARZ entity, HttpContextBase current)
        {
            var db = new SWPappDBEntities4();
            //pobranie z bazy danych rekordu o nazwie uzytkownika takiej jak podanej w entity(czyli danych z formularza)
            var pass = db.LEKARZ.Where(s => s.PESEL == entity.PESEL.Trim()).FirstOrDefault();

            //jesli rekord istnieje
            if (pass != null)
            {
                //porównanie hase³
                if (entity.HASLO.Equals(pass.HASLO.Trim()))
                {
                    current.Session["typ"]   = "lekarz";
                    current.Session["login"] = pass.PESEL;
                    current.Session["id"]    = pass.LEKARZ_ID;
                    return(true);
                }
                return(false);
            }
            else
            {
                return(false);
            }
        }