public Models.StudentAdmin GetById(int id) { Database.Student t = db.Student.Find(id); Models.StudentAdmin temp = new StudentAdmin { Adresa = t.Adresa, DatumRodjenja = t.DatumRodjenja, DatumUpisa = t.DatumUpisa, Ime = t.Ime, Indeks = t.Indeks, KorisnickoIme = t.KorisnickoIme, LozinkaHash = t.LozinkaHash, LozinkaSalt = t.LozinkaSalt, Mail = t.Mail, NacinStudiranja = t.NacinStudiranja, ObnavljaGodinu = t.ObnavljaGodinu, OvjerenSemestar = t.OvjerenSemestar, Prezime = t.Prezime, ProsjecnaOcjena = t.ProsjecnaOcjena, Slika = t.Slika, Spol = t.Spol, Status = t.Status, StudentID = t.StudentId, Telefon = t.Telefon, UpisanSemestar = t.UpisanSemestar }; return(temp); }
public AdminDetaljiStudentVM(int _user, int _role, StudentAdmin t) { Ime = t.Ime; Prezime = t.Prezime; Indeks = t.Indeks; Mail = t.Mail; Slika = ImageSource.FromStream(() => new MemoryStream(t.Slika)); KorisnickoIme = t.KorisnickoIme; DatumRodjenja = t.DatumRodjenja.Value; DatumUpisa = t.DatumUpisa.Value; Adresa = t.Adresa; Spol = t.Spol; Telefon = t.Telefon; Status = t.Status; NacinStudiranja = t.NacinStudiranja; UpisanSemastar = t.UpisanSemestar; OvjerenSemastar = t.OvjerenSemestar; ObnavljaGodinu = t.ObnavljaGodinu; Ocjena = t.ProsjecnaOcjena; NazadCommand = new Command(async() => { List <StudentAdmin> lista = await _servis.Get <List <StudentAdmin> >(null); Application.Current.MainPage = new AdminPrikazStudenataPage(_user, _role, lista); }); }
public Models.StudentAdmin Update(int id, StudentAdmin o) { Database.Student temp = db.Student.Find(id); temp.Adresa = o.Adresa; temp.DatumRodjenja = o.DatumRodjenja; temp.DatumUpisa = o.DatumUpisa; temp.Ime = o.Ime; temp.Indeks = o.Indeks; temp.KorisnickoIme = o.KorisnickoIme; temp.LozinkaHash = o.LozinkaHash; temp.LozinkaSalt = o.LozinkaSalt; temp.Mail = o.Mail; temp.NacinStudiranja = o.NacinStudiranja; temp.ObnavljaGodinu = o.ObnavljaGodinu; temp.OvjerenSemestar = o.OvjerenSemestar; temp.Prezime = o.Prezime; temp.ProsjecnaOcjena = o.ProsjecnaOcjena; temp.Slika = o.Slika; temp.Spol = o.Spol; temp.Status = o.Status; temp.Telefon = o.Telefon; temp.UpisanSemestar = o.UpisanSemestar; db.SaveChanges(); return(o); }
private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { StudentAdmin t = (StudentAdmin)e.SelectedItem; StudentAdmin temp = await _servis.GetById <StudentAdmin>(t.StudentID); Application.Current.MainPage = new AdminDetaljiStudentPage(_user, _role, temp); }
public StudentAdmin Insert(StudentAdmin novi) { var entity = new Database.Student() { Adresa = novi.Adresa, DatumRodjenja = novi.DatumRodjenja, DatumUpisa = novi.DatumUpisa, Ime = novi.Ime, Indeks = novi.Indeks, KorisnickoIme = novi.KorisnickoIme, Mail = novi.Mail, NacinStudiranja = novi.NacinStudiranja, ObnavljaGodinu = novi.ObnavljaGodinu, OvjerenSemestar = novi.OvjerenSemestar, Prezime = novi.Prezime, ProsjecnaOcjena = novi.ProsjecnaOcjena, Slika = novi.Slika, Spol = novi.Spol, Status = novi.Status, Telefon = novi.Telefon, UpisanSemestar = novi.UpisanSemestar }; entity.LozinkaSalt = GenerateSalt(); entity.LozinkaHash = GenerateHash(entity.LozinkaSalt, novi.LozinkaHash); if (entity.Slika == null) { entity.Slika = Properties.Resources.test2; } db.Add(entity); db.SaveChanges(); var list = db.Student.ToList(); foreach (var x in list) { if (x.KorisnickoIme == novi.KorisnickoIme && x.Ime == novi.Ime && x.Prezime == novi.Prezime) { KorisniciUloge n = new KorisniciUloge { StudentId = x.StudentId, DatumIzmjene = DateTime.Now, UlogaId = 2 }; db.KorisniciUloge.Add(n); db.SaveChanges(); } } return(novi); }
public async void Snimi(int userId, int role, StudentAdmin t) { t.Ime = Ime; t.Prezime = Prezime; t.Mail = Mail; t.Telefon = Telefon; t.Adresa = Adresa; await _service.Update <StudentAdmin>(userId, t); Application.Current.MainPage = new StudMojiPodaciPrikazPage(t, userId, role); await Application.Current.MainPage.DisplayAlert("Poruka", "Uspješno ste izmijenili podatke", "OK"); }
private void LoadContent() { rg = new RegGUI(); sa = new StudentAdmin(); ta = new TypeAdmin(); ap = new AppointmentGUI(); pl = new PLRegGUI(); titel = "Aspit Planner"; st = new statistic(this); ug = new UserGUI(); hd = new HolidayGUI(); }
public StudMojiPodaciPrikazVM(int userId, int role, StudentAdmin t) { LoadData(userId, role, t); IzmijeniCommand = new Command(() => { Izmijeni(userId, role, t); }); NazadCommand = new Command(() => { Nazad(role, userId); }); }
public StudMojiPodaciIzmjenaVM(int userId, int role, StudentAdmin t) { Ime = t.Ime; Prezime = t.Prezime; Mail = t.Mail; Adresa = t.Adresa; Telefon = t.Telefon; NazadCommand = new Command(() => { Application.Current.MainPage = new StudMojiPodaciPrikazPage(t, userId, role); }); SnimiCommand = new Command(() => { Snimi(userId, role, t); }); }
public void LoadData(int userId, int role, StudentAdmin t) { //StudentAdmin t = await _service.GetById<StudentAdmin>(userId); _profId = userId; _role = role; Ime = t.Ime; Prezime = t.Prezime; Indeks = t.Indeks; DatumUpisa = t.DatumUpisa.Value; KorisnickoIme = t.KorisnickoIme; Mail = t.Mail; Adresa = t.Adresa; Telefon = t.Telefon; Status = t.Status; Prosjek = t.ProsjecnaOcjena.ToString(); ObnavljaGodinu = t.ObnavljaGodinu; OvjerenSemestar = t.OvjerenSemestar.ToString(); UpisanSemestar = t.UpisanSemestar.ToString(); NacinStudiranja = t.NacinStudiranja; Slika = ImageSource.FromStream(() => new MemoryStream(t.Slika)); }
public void Izmijeni(int userId, int role, StudentAdmin podatak) { Application.Current.MainPage = new StudMojiPodaciIzmjenaPage(userId, role, podatak); }
public AdminDetaljiStudentPage(int _user, int _role, StudentAdmin t) { BindingContext = model = new AdminDetaljiStudentVM(_user, _role, t); InitializeComponent(); }
public AdminDodajStudentaVM(int role, int userId) { listaSpol.Insert(0, "Žensko"); listaSpol.Insert(0, "Muško"); listaNS.Insert(0, "Vanredno"); listaNS.Insert(0, "DL"); listaNS.Insert(0, "IN-CLASS"); listaOG.Insert(0, "Ne"); listaOG.Insert(0, "Da"); NazadCommand = new Command(async() => { List <StudentAdmin> lista = await _service.Get <List <StudentAdmin> >(null); Application.Current.MainPage = new AdminPrikazStudenataPage(userId, role, lista); }); SnimiCommand = new Command(async() => { if (Sifra != SifraPotvrda) { await Application.Current.MainPage.DisplayAlert("Poruka", "Unesene šifre se ne podudaraju", "OK"); } else if (Sifra == SifraPotvrda) { StudentAdmin temp = new StudentAdmin { Adresa = Adresa, DatumRodjenja = DatumRodjenja, DatumUpisa = DatumUpisa, Ime = Ime, Indeks = Indeks, KorisnickoIme = KorisnickoIme, LozinkaHash = Sifra, LozinkaSalt = SifraPotvrda, Mail = Mail, NacinStudiranja = NacinStudiranja, ObnavljaGodinu = ObnavljaGodinu, OvjerenSemestar = OvjerenSemastar, Prezime = Prezime, ProsjecnaOcjena = Ocjena, Slika = null, Spol = Spol, Status = Status, Telefon = Telefon, UpisanSemestar = UpisanSemastar }; try { await _service.Insert(temp); Application.Current.MainPage = new AdminPage(role, userId); await Application.Current.MainPage.DisplayAlert("Poruka", "Uspješno ste unijeli podatke", "OK"); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Poruka", "Uneseni podaci nisu ispravni", "OK"); }; } }); }
public StudMojiPodaciIzmjenaPage(int userId, int role, StudentAdmin t) { BindingContext = model = new StudMojiPodaciIzmjenaVM(userId, role, t); InitializeComponent(); }
public StudMojiPodaciPrikazPage(StudentAdmin podatak, int userId, int role) { BindingContext = model = new StudMojiPodaciPrikazVM(userId, role, podatak); InitializeComponent(); //model.LoadData(userId, role, podatak); }
public StudentAdmin Insert(StudentAdmin novi) { return(_service.Insert(novi)); }
public Models.StudentAdmin Update(int id, StudentAdmin o) { return(_service.Update(id, o)); }