public PolaznikUplateDetaljiVM(int _userid, uplate v) { NazadCmd = new Command(async() => { List <uplate> source = await _service.Get <List <uplate> >(null); List <uplate> lista = new List <uplate>(); foreach (var x in source) { if (x.PolaznikId == _userid) { lista.Add(new uplate { AdministracijaId = x.AdministracijaId, DatumUplate = x.DatumUplate, PolaznikId = x.PolaznikId, Evidentirao = x.Evidentirao, Iznos = x.Iznos, Svrha = x.Svrha, UplataId = x.UplataId, Uplatio = x.Uplatio }); } } Application.Current.MainPage = new PolaznikMojeUplatePage(_userid, lista); }); Iznos = v.Iznos; Svrha = v.Svrha; Datum = v.DatumUplate.Value; Evidentirao = v.Evidentirao; }
public AdminDodajUplatuVM(int role, int userId) { LoadUsers(); NazadCommand = new Command(async() => { List <uplate> lista = await _service.Get <List <uplate> >(null); Application.Current.MainPage = new AdminPrikazUplataPage(userId, role, lista); }); SnimiCommand = new Command(async() => { //var ev = await _service_admin.GetById<AdministracijaAll>(userId); //var uplatio = await _service_stud.GetById<StudentAdmin>(20); uplate temp = new uplate { AdministracijaId = IzbaraniADMIN.AdministracijaId, DatumUplate = Datum, Evidentirao = IzbaraniADMIN.Ime, Iznos = Iznos, Slika = null, StudentId = IzbaraniSTUD.StudentId, Svrha = Svrha, Uplatio = IzbaraniSTUD.Ime }; if (Ovjereno == true) { temp.Ovjereno = "Da"; } else if (Ovjereno == false) { temp.Ovjereno = "Ne"; } try { if (!string.IsNullOrWhiteSpace(temp.Evidentirao) && Iznos > 0 && !string.IsNullOrWhiteSpace(temp.Svrha) && !string.IsNullOrWhiteSpace(temp.Uplatio)) { await _service.Insert(temp); Application.Current.MainPage = new AdminPage(role, userId); await Application.Current.MainPage.DisplayAlert("Poruka", "Uspješno ste dodali nove podatke", "OK"); } } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Poruka", "Niste unijeli ispravne podatke", "OK"); }; }); }
public uplate Update(int id, uplate uplata) { Database.Uplata temp = db.Uplata.Find(id); temp.AdministracijaId = uplata.AdministracijaId; temp.DatumUplate = uplata.DatumUplate; temp.Iznos = uplata.Iznos; temp.Ovjereno = uplata.Ovjereno; temp.Slika = uplata.Slika; temp.StudentId = uplata.StudentId; temp.Svrha = uplata.Svrha; db.SaveChanges(); return(uplata); }
public StudMojeUplateDetaljiVM(int _userid, int _role, uplate v) { NazadCmd = new Command(async() => { List <uplate> source = await _service.Get <List <uplate> >(null); List <uplate> lista = new List <uplate>(); foreach (var x in source) { if (x.StudentId == _userid) { lista.Add(new uplate { AdministracijaId = x.AdministracijaId, DatumUplate = x.DatumUplate, StudentId = x.StudentId, Evidentirao = x.Evidentirao, Iznos = x.Iznos, Ovjereno = x.Ovjereno, Slika = x.Slika, Svrha = x.Svrha, UplataId = x.UplataId, Uplatio = x.Uplatio }); } } Application.Current.MainPage = new StudMojeUplatePrikazPage(_userid, _role, lista); }); Iznos = v.Iznos.ToString(); Svrha = v.Svrha; if (v.Ovjereno == "Da") { Ovjereno = true; } Datum = v.DatumUplate.Value; Evidentirao = v.Evidentirao; }
public uplate Insert(uplate nova) { var entity = new Database.Uplata { AdministracijaId = nova.AdministracijaId, DatumUplate = nova.DatumUplate, Iznos = nova.Iznos, Ovjereno = nova.Ovjereno, Slika = nova.Slika, StudentId = nova.StudentId, Svrha = nova.Svrha }; if (entity.Slika == null) { entity.Slika = Properties.Resources.test2; } db.Uplata.Add(entity); db.SaveChanges(); return(nova); }
public AdminDetaljiUplateVM(int userId, int role, uplate t) { Iznos = t.Iznos; Svrha = t.Svrha; if (t.Ovjereno == "Da") { Ovjereno = true; } Slika = ImageSource.FromStream(() => new MemoryStream(t.Slika)); Datum = t.DatumUplate.Value; AdminID = t.AdministracijaId; StudID = t.StudentId; Evidentirao = t.Evidentirao; Uplatio = t.Uplatio; UplataID = t.UplataId; NazadCommand = new Command(async() => { List <uplate> listaSource = await _service.Get <List <uplate> >(null); Application.Current.MainPage = new AdminPrikazUplataPage(userId, role, listaSource); }); UkloniCommand = new Command(async() => { var tmp = await Application.Current.MainPage.DisplayAlert("Poruka", "Da li ste sigurni da želite obrisati odabranu uplatu", "Da", "Ne"); if (tmp == true) { await _service.Delete(UplataID); Application.Current.MainPage = new AdminPage(role, userId); await Application.Current.MainPage.DisplayAlert("Poruka", "Uspješno te uklonuli uplatu", "OK"); } }); }
public PolaznikUplateDetaljiPage(int _userid, uplate v) { InitializeComponent(); BindingContext = model = new PolaznikUplateDetaljiVM(_userid, v); }
public StudMojeUplateDetaljiPage(int _userid, int _role, uplate v) { BindingContext = model = new StudMojeUplateDetaljiVM(_userid, _role, v); InitializeComponent(); }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { uplate v = (uplate)e.SelectedItem; Application.Current.MainPage = new StudMojeUplateDetaljiPage(_userid, _role, v); }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { uplate v = (uplate)e.SelectedItem; Application.Current.MainPage = new PolaznikUplateDetaljiPage(_polaznikId, v); }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { uplate t = (uplate)e.SelectedItem; Application.Current.MainPage = new AdminDetaljiUplatePage(_user, _role, t); }
public AdminDetaljiUplatePage(int userId, int role, uplate lista) { BindingContext = model = new AdminDetaljiUplateVM(userId, role, lista); InitializeComponent(); }