async Task Login() { IsBusy = true; APIService._username = Username; APIService._password = Password; var request = new AutentifikacijaRequest() { password = Password, username = Username }; if (!string.IsNullOrEmpty(Password) && !string.IsNullOrEmpty(Username)) { var osoba = await _apiService.Get <Wellness.Model.Osoba>(request); if (osoba == null) { await PopupNavigation.Instance.PushAsync(new PopupView("Error", "Pogresan Username ili Password")); } else { if (osoba.Uloga.Naziv == "Clan") { var ClanSearchRequest = new ClanSearchRequest() { OsobaId = osoba.Id, }; var ClanList = await _apiService_Clan.Get <List <Model.Requests.ClanViewRequest> >(ClanSearchRequest); var clan = ClanList[0]; Application.Current.MainPage = new MainPage(clan); } else { await PopupNavigation.Instance.PushAsync(new PopupView("Error", "Niste autorizovani")); } } } else { if (string.IsNullOrEmpty(Password)) { await PopupNavigation.Instance.PushAsync(new PopupView("Error", "Password obavezan")); } else if (string.IsNullOrEmpty(Username)) { await PopupNavigation.Instance.PushAsync(new PopupView("Error", "Username obavezan")); } } }
private async void btnTrazi_Click(object sender, EventArgs e) { var clanSearchRequest = new ClanSearchRequest() { Ime = txtIme.Text, Prezime = txtPrezime.Text, KorisnickoIme = txtKorisnickoIme.Text }; await setDgvClanovi(clanSearchRequest); }
private async Task Loadfrm() { var search = new ClanSearchRequest() { Ime = txtPretrazi.Text }; var clanovi = await _clanService.Get <List <Model.Clanovi> >(search); dgvClanovi.AutoGenerateColumns = false; dgvClanovi.DataSource = clanovi; }
public async Task Init() { ClanSearchRequest search = new ClanSearchRequest(); search.Username = Global.Username; var list = await _clanovi.Get <List <Clan> >(search); var clan = list[0]; ClanoviList.Clear(); Global.LogiraniClanId = clan.ClanId; Global.LogiraniClan = clan; ClanoviList.Add(clan); //vidi da li da premjestis negdje ovaj global !! -probacu u itemsPage da premjestim }
private async Task setDgvClanovi(ClanSearchRequest request = null) { dgvClanovi.Rows.Clear(); dgvClanovi.Refresh(); var clanovi = await apiService_clanovi.Get <List <ClanViewRequest> >(request); foreach (var x in clanovi) { //DataGridViewRow row = (DataGridViewRow)dgvClanovi.Rows[0].Clone(); //row.Cells[0].Value = x.Id; //row.Cells[1].Value = x.Ime; //row.Cells[2].Value = x.Prezime; //row.Cells[3].Value = x.Osoba.KorisnickoIme; dgvClanovi.Rows.Add(x.Id, x.Ime, x.Prezime, x.Osoba.KorisnickoIme, x.OsobaId); } }
public ActionResult <List <Model.Requests.ClanViewRequest> > Get([FromQuery] ClanSearchRequest request) { var list = from clan in _context.Clan join osoba in _context.Osoba on clan.OsobaId equals osoba.Id select new Model.Requests.ClanViewRequest { Id = clan.Id, Ime = osoba.Ime, Prezime = osoba.Prezime, OsobaId = osoba.Id }; if (request.OsobaId != null) { list = list.Where(c => c.OsobaId == request.OsobaId); } return(list.ToList()); }
public ActionResult <List <Model.Requests.ClanViewRequest> > Get([FromQuery] ClanSearchRequest request) { var list = from clan in _context.Clan join osoba in _context.Osoba on clan.OsobaId equals osoba.Id select new Model.Requests.ClanViewRequest { Id = clan.Id, Ime = osoba.Ime, Prezime = osoba.Prezime, OsobaId = osoba.Id, Osoba = _mapper.Map <Model.Osoba>(osoba), QrCodeText = clan.QrCodeText, Qrcode = clan.Qrcode }; #region filter if (request.OsobaId != null) { list = list.Where(c => c.OsobaId == request.OsobaId); } if (request.ClanId != null) { list = list.Where(c => c.Id == request.ClanId); } if (!string.IsNullOrEmpty(request.QrCodeText)) { list = list.Where(c => c.QrCodeText == request.QrCodeText); } if (!string.IsNullOrEmpty(request.Ime)) { list = list.Where(c => c.Ime == request.Ime); } if (!string.IsNullOrEmpty(request.Prezime)) { list = list.Where(c => c.Prezime == request.Prezime); } if (!string.IsNullOrEmpty(request.KorisnickoIme)) { list = list.Where(c => c.Osoba.KorisnickoIme == request.KorisnickoIme); } #endregion filter return(list.ToList()); }
public async Task Init() { ClanSearchRequest search = new ClanSearchRequest(); search.Username = Global.Username; var list = await _clanovi.Get <List <Clan> >(search); var clan = list[0]; ClanoviList.Clear(); Global.LogiraniClanId = clan.ClanId; Global.LogiraniClan = clan; ClanoviList.Add(clan); Clan clanQuery = Global.LogiraniClan; var ProizvodiList = await _preporuceniProizvodi.Get <List <Proizvod> >(clanQuery); PreporuceniProizvodiList.Clear(); foreach (var proizvod in ProizvodiList) { PreporuceniProizvodiList.Add(proizvod); } int gradId = 0; if (Global.LogiraniClan != null) { gradId = Global.LogiraniClan.GradId; } var TeretaneList = await _preporuceneTeretane.Get <List <Teretana> >(gradId); PreporuceneTeretaneList.Clear(); if (TeretaneList != null) { foreach (var teretana in TeretaneList) { PreporuceneTeretaneList.Add(teretana); } } }
private async void btnPrikazi_Click(object sender, EventArgs e) { var search = new ClanSearchRequest() { Ime = txtPretragaIme.Text }; var list = await _clanovi.Get <List <OnlineGym_Model.Clan> >(search); var dgvResult = new List <OnlineGym_Model.ClanRezultat>(); foreach (var cl in list) { ClanRezultat temp = new ClanRezultat(cl); dgvResult.Add(temp); temp = null; } dgvClanovi.AutoGenerateColumns = false; dgvClanovi.DataSource = dgvResult; }
public List <OnlineGym_Model.Clan> Get(ClanSearchRequest request) { var query = _context.Set <Database.Clan>().Include(c => c.Grad).AsQueryable(); if (!string.IsNullOrWhiteSpace(request?.Ime)) { query = query.Where(x => x.Ime.StartsWith(request.Ime) || x.Prezime.StartsWith(request.Ime)); } if (!string.IsNullOrWhiteSpace(request?.Prezime)) { query = query.Where(x => x.Prezime.StartsWith(request.Prezime)); } if (!string.IsNullOrWhiteSpace(request?.Username)) { query = query.Where(x => (String.Equals(x.KorisnickoIme, request.Username))); } query = query.OrderBy(x => x.KorisnickoIme); var list = query.ToList(); return(_mapper.Map <List <OnlineGym_Model.Clan> >(list)); }
public List <Clanovi> Get(ClanSearchRequest request) { var querry = _context.Clan.AsQueryable(); if (!string.IsNullOrWhiteSpace(request?.Ime)) { querry = querry.Where(x => x.Ime.StartsWith(request.Ime)); } if (!string.IsNullOrWhiteSpace(request?.Prezime)) { querry = querry.Where(x => x.Prezime.StartsWith(request.Prezime)); } if (!string.IsNullOrWhiteSpace(request?.Username)) { querry = querry.Where(x => x.KorisnickiNalog.Username.StartsWith(request.Prezime)); } var list = querry.Include(c => c.KorisnickiNalog).ToList(); return(_mapper.Map <List <Model.Clanovi> >(list)); }
public List <OnlineGym_Model.Clan> Get([FromQuery] ClanSearchRequest request) { return(_service.Get(request)); }
public ActionResult <List <Model.Clanovi> > Get([FromQuery] ClanSearchRequest request) { return(_service.Get(request)); }
private async void btnUrediProfil_Clicked(object sender, EventArgs e) { if (ValidateInput()) { ClanUpsertRequest request = new ClanUpsertRequest(); request.KorisnickoIme = inputKorisnickoIme.Text; request.StariPassword = inputStaraLozinka.Text; request.Password = inputLozinka.Text; request.PasswordPotvrda = inputLozinkaPotvrda.Text; request.GradId = Global.LogiraniClan.GradId; request.Ime = Global.LogiraniClan.Ime; request.Prezime = Global.LogiraniClan.Prezime; request.Email = Global.LogiraniClan.Email; request.DatumRegistracije = Global.LogiraniClan.DatumRegistracije; int logiraniID = Global.LogiraniClanId; var stringBuilder = new StringBuilder(); ClanSearchRequest query = new ClanSearchRequest(); query.Username = inputKorisnickoIme.Text; var lista = await _clanovi.Get <IEnumerable <Clan> >(query); if (lista.Count() > 0) { Clan proba = Global.LogiraniClan; foreach (var korisnickoIme in lista) { if (korisnickoIme.KorisnickoIme != Global.Username) { await Application.Current.MainPage.DisplayAlert("Korisničko ime je već zauzeto! Molimo Vas da odaberete neko drugo", stringBuilder.ToString(), "OK"); return; } } Clan entity = null; try { entity = await _clanovi.Update <Clan>(logiraniID, request); } catch (Exception exception) { await Application.Current.MainPage.DisplayAlert("Unesite ispravnu staru lozinku!", stringBuilder.ToString(), "OK"); return; } APIService.Context = "Clan"; Global.Username = inputKorisnickoIme.Text; await Application.Current.MainPage.DisplayAlert("Uspješno ste uredili profil", stringBuilder.ToString(), "OK"); await Navigation.PushAsync(new LoginPage()); } else { Clan entity = null; try { entity = await _clanovi.Update <Clan>(logiraniID, request); } catch (Exception exception) { await Application.Current.MainPage.DisplayAlert("Unesite ispravnu staru lozinku!", stringBuilder.ToString(), "OK"); return; } APIService.Context = "Clan"; Global.Username = inputKorisnickoIme.Text; await Application.Current.MainPage.DisplayAlert("Uspješno ste uredili profil", stringBuilder.ToString(), "OK"); await Navigation.PushAsync(new LoginPage()); } } else { var stringBuilder = new StringBuilder(); await Application.Current.MainPage.DisplayAlert("Unesite ispravne podatke!", stringBuilder.ToString(), "OK"); } }
private async void BtnRegister_Click(object sender, EventArgs e) { btnRegister.Enabled = false; if (this.ValidateChildren()) { var osobaRequest = new Wellness.Model.Requests.OsobaInsertRequest(); osobaRequest.Ime = txtIme.Text; osobaRequest.Prezime = txtPrezime.Text; osobaRequest.DatumRodenja = dtpDatumRodenja.Value; osobaRequest.Spol = (cbSpol.SelectedValue.ToString().Substring(0, 1).ToUpper()); osobaRequest.GradId = (int)cbMjestoBoravka.SelectedValue; osobaRequest.Jmbg = txtJMBG.Text; osobaRequest.Email = txtEmail.Text; osobaRequest.BrojTelefona = txtBrojTelefona.Text; osobaRequest.KorisnickoIme = txtUserName.Text; osobaRequest.UlogaId = (int)cbUloga.SelectedValue; Wellness.Model.Osoba osoba = null; Wellness.Model.Radnik radnik = null; if (_id == null) { osobaRequest.Password = txtPassword.Text; osobaRequest.PasswordPotvrda = txtPasswordPotvrda.Text; osoba = await _apiService.Insert <Wellness.Model.Osoba>(osobaRequest); if (osoba.Uloga.Naziv != "Clan") { var radnikRequest = new Wellness.Model.Requests.RadnikInsertRequest() { Satnica = decimal.Parse(txtSatnica.Text), OsobaId = osoba.Id }; radnik = await _apiService_Radnik.Insert <Wellness.Model.Radnik>(radnikRequest); if (osoba.Uloga.Naziv == "Trener") { var trenerRequest = new TrenerInsertRequest() { Specializacija = txtSpecijalizacija.Text, RadnikId = radnik.Id }; var trener = await _apiService_Trener.Insert <Model.Trener>(trenerRequest); } } else { var clanInsertRequest = new ClanInsertRequest() { Aktivan = true, DatumRegistracije = DateTime.Now, OsobaId = osoba.Id, }; //-----------------------------------------------------------------QR Kod var randomStringPostoji = true; while (randomStringPostoji == true) { var randomString = _qrCodeHelper.GenerateRandomString(15); var clanSearchRequest = new ClanSearchRequest() { QrCodeText = randomString }; var clanList = await _apiService_Clan.Get <List <Model.Requests.ClanViewRequest> >(clanSearchRequest); if (clanList.Count == 0) { randomStringPostoji = false; } clanInsertRequest.QrCodeText = randomString; clanInsertRequest.Qrcode = _qrCodeHelper.GenerateQRCode(randomString); } //-----------------------------------------------------------------QR Kod var clan = await _apiService_Clan.Insert <Wellness.Model.Clan>(clanInsertRequest); } MessageBox.Show("Uspjesno ste dodali novog korisnika", "success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { osoba = await _apiService.Update <Wellness.Model.Osoba>(_id, osobaRequest); if (osoba.Uloga.Naziv != "Clan") { var radnikRequest = new Wellness.Model.Requests.RadnikInsertRequest() { Satnica = decimal.Parse(txtSatnica.Text), OsobaId = osoba.Id }; var radnikSearchRequest = new RadnikSearchRequest() { OsobaId = radnikRequest.OsobaId }; var radnikList = await _apiService_Radnik.Get <List <Wellness.Model.Radnik> >(radnikSearchRequest); radnik = await _apiService_Radnik.Update <Wellness.Model.Radnik>(radnikList[0].Id, radnikRequest); if (osoba.Uloga.Naziv == "Trener") { var trenerRequest = new TrenerInsertRequest() { RadnikId = radnik.Id, Specializacija = txtSpecijalizacija.Text }; var trenerList = await _apiService_Trener.Get <List <Model.Trener> >(new TrenerSearchRequest() { OsobaId = osoba.Id }); var trener = _apiService_Trener.Update <Model.Trener>(trenerList[0].Id, trenerRequest); } } MessageBox.Show("Uspjesno ste ažurirali korisnika", "success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } btnRegister.Enabled = true; }