public static List <Order> Get() { string rs = CallAPI.MethodGET(URL + "get"); List <Order> orders = JsonConvert.DeserializeObject <List <Order> >(rs); return(orders); }
public static Order GetByID(int id) { string rs = CallAPI.MethodGET(URL + "get/" + id); Order orders = JsonConvert.DeserializeObject <Order>(rs); return(orders); }
public async Task <IActionResult> Create([Bind("IdTournament,Name,Date,Description,IdGame,MaxNumberPlayer,DeckListNumber,Ppwin,Ppdraw,Pplose,Over,Deleted,Dotation")] Tournoi tournoi) { if (ModelState.IsValid) { if ((tournoi.Organisateurs == null || !tournoi.Organisateurs.Any()) && int.TryParse(HttpContext.Session.GetString("UserId"), out int IdUser)) { tournoi.Organisateurs = new List <ViewOrga> { new ViewOrga { Level = 0, IdUser = IdUser, IdTournament = -1, Name = "", Pseudo = "" } }; } if (tournoi.Organisateurs != null && tournoi.Organisateurs.Count() != 0) { var retourApi = await CallAPI.InsertTournoi(tournoi); if (retourApi.Succes) { return(RedirectToAction("Details", new { id = retourApi.CreateID })); } } } IEnumerable <ViewJeu> Jeus = await CallAPI.GetAllJeus(); ViewData["AllGame"] = new SelectList(Jeus, "IdGame", "Name", tournoi.jeu.IdGame); ViewData["Title"] = "Création d'un tournoi"; return(View("~/Views/Tournoi/CreateTournoi.cshtml", tournoi)); }
private void btnAdd_Click(object sender, EventArgs e) { try { if (txtTitle.CheckNull()) { return; } if (features.Any(x => x.Title == txtTitle.Text)) { MessageBox.Show("A pre-existing feature", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Feature feature = new Feature { Title = txtTitle.Text }; feature = CallAPI.PostObjectAndGetObject <Feature, Feature>(feature, "AddFeature"); if (feature.Id != 0) { MessageBox.Show("Added successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); txtTitle.Text = ""; features.Add(feature); FillGrid(); } } catch (Exception) { MessageBox.Show("There Are An Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static Services Modify(Services sv) { string rs = CallAPI.MethodPUT(URL + "modify", sv); Services services = JsonConvert.DeserializeObject <Services>(rs); return(services); }
public async Task <IActionResult> EditDeck([Bind("Deck, IdTournament")] Joueur joueur) { if (joueur.IdTournament < 1 || !int.TryParse(HttpContext.Session.GetString("UserId"), out int IdUser)) { return(NotFound()); } string error = null; if (ModelState.IsValid) { joueur.User.IdUser = IdUser; var retourApis = new List <RetourAPI>(); foreach (var d in joueur.Decks) { retourApis.Add(await CallAPI.EditDeck(d)); } if (retourApis.Count > 0 && retourApis.All(r => r.Succes)) { return(RedirectToAction("Details", "Tournois", new { id = joueur.IdTournament })); } error = string.Join("<br/>", retourApis.Where(r => !(r.Succes)).Select(r => r.Message)); } return(RedirectToAction("EditDeck", new { IdTournoi = joueur.IdTournament, error = error })); }
// GET: Tournois public async Task <IActionResult> Index() { List <ViewTournament> listTournois = (await CallAPI.GetAllTournaments()).ToList(); ViewData["Title"] = "Liste des tournois"; return(View("~/Views/Tournoi/Index.cshtml", listTournois)); }
public static Services GetByID(int id) { string rs = CallAPI.MethodGET(URL + "get/" + id); Services services = JsonConvert.DeserializeObject <Services>(rs); return(services); }
public static int Create(List <OrderDetail> list) { string rs = CallAPI.MethodPOST_Body(URL + "create", list); int resutl = JsonConvert.DeserializeObject <int>(rs); return(resutl); }
private void btnAdd_Click(object sender, EventArgs e) { if (txtPath.CheckNull()) { return; } if (txtTitle.CheckNull()) { return; } File file = new File { Title = txtTitle.Text, Path = txtPath.Text, NoteBookId = noteBook.Id, IsVideo = RadioVideo.Checked, IsActive = true }; var checkFile = CallAPI.PostObjectAndGetObject <File, File>(file, "AddFile"); if (checkFile == null) { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Done", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } Close(); }
public static List <OrderDetail> Get(int id) { string rs = CallAPI.MethodGET(URL + "get/" + id); List <OrderDetail> orderDetails = JsonConvert.DeserializeObject <List <OrderDetail> >(rs); return(orderDetails); }
private void About_Load(object sender, EventArgs e) { about = CallAPI.GetObjectContent <Models.About, Models.About>("GetAbout"); txtEmail.Text = about.Email; txtAddress.Text = about.Address; txtMobile.Text = about.MobileNumber; }
public async Task <IActionResult> Pairing(int id, int round) { var temp = await CallAPI.GetTournoi(id); if (temp.Item1) { return(NotFound()); } Tournoi tournoi = temp.Item2; if (tournoi.Over) { return(NotFound()); } RetourAPI retour = await CallAPI.PairingRound(new Round { IdTournament = id, RoundNumber = round }); if (!retour.Succes) { // } return(RedirectToAction("Tournoi", new { id = id })); }
public async Task <IActionResult> EndRound(int id, int round) { var temp = await CallAPI.GetTournoi(id); if (temp.Item1) { return(NotFound()); } Tournoi tournoi = temp.Item2; if (tournoi.Over) { return(NotFound()); } RetourAPI retour = await CallAPI.EndRound(id, round); if (!retour.Succes) { // } return(RedirectToAction("Tournoi", new { id = id })); }
public async Task <IActionResult> Register([Bind("Deck, IdTournament")] Joueur joueur) { if (joueur.IdTournament < 1 || !int.TryParse(HttpContext.Session.GetString("UserId"), out int IdUser)) { return(NotFound()); } if (ModelState.IsValid) { joueur.User.IdUser = IdUser; RetourAPI retourApi = await CallAPI.RegisterTournoi(joueur); if (retourApi.Succes) { return(RedirectToAction("Details", "Tournois", new{ id = joueur.IdTournament })); } ViewBag.error = retourApi.Message; } var temp = await CallAPI.GetTournoi(joueur.IdTournament); if (temp.Item1) { return(NotFound()); } Tournoi tournoi = temp.Item2; ViewBag.NbDeck = tournoi.DeckListNumber; ViewData["Title"] = "S'inscire pour " + tournoi.Name; return(View("~/Views/Tournoi/Register.cshtml", joueur)); }
public static List <Services> Get() { string rs = CallAPI.MethodGET(URL + "get"); List <Services> services = JsonConvert.DeserializeObject <List <Services> >(rs); return(services); }
public async Task <IActionResult> UpdateMatch([Bind("IdTournament, RoundNumber, IdPlayer1, IdPlayer2, Parties")] Match match) { if (match.IdTournament == 0 || !int.TryParse(HttpContext.Session.GetString("UserId"), out int IdUser) || (match.IdPlayer1 != IdUser && match.IdPlayer2 != IdUser)) { return(NotFound()); } var Parties = match.Parties; var retourApis = new List <RetourAPI>(); foreach (var p in Parties) { p.IdTournament = match.IdTournament; p.RoundNumber = match.RoundNumber; p.IdPlayer1 = match.IdPlayer1; p.IdPlayer2 = match.IdPlayer2; if (p.ResultPart != null) { retourApis.Add(await CallAPI.CreatePartie(p)); } } string error = null; if (retourApis.Count > 0 && retourApis.All(r => r.Succes)) { error = "Vérifier que les resulta entré sont correcte!"; } return(RedirectToAction("UpdateMatch", new{ idT = match.IdTournament, rn = match.RoundNumber, idP1 = match.IdPlayer1, error })); }
public static Services Create(Services sv) { string rs = CallAPI.MethodPOST_Body(URL + "create", sv); Services services = JsonConvert.DeserializeObject <Services>(rs); return(services); }
public static Order Create(Order o) { string rs = CallAPI.MethodPOST_Body(URL + "create", o); Order order = JsonConvert.DeserializeObject <Order>(rs); return(order); }
// GET: Utilisateurs public async Task <IActionResult> AllUser() { IEnumerable <ViewUser> users = await CallAPI.GetAllUtilisateurs(); ViewData["Title"] = "Liste des utilisateurs"; return(View(users)); }
public async Task <IActionResult> AddGamePseudo(int id) { if (!int.TryParse(HttpContext.Session.GetString("UserId"), out int SessionId) || SessionId != id) { return(NotFound()); } var utilisateur = await CallAPI.GetUser(id); var Jeus = await CallAPI.GetAllJeus(); if (Jeus != null) { foreach (ViewJeu jeu in Jeus) { if (utilisateur.PseudoIgs.All(j => j.IdGame != jeu.IdGame)) { utilisateur.PseudoIgs.Add(new ViewPseudo { Game = jeu.Name, IdGame = jeu.IdGame, IdUser = utilisateur.IdUser, IgPseudo = "" }); } } } ViewData["Title"] = "Ajouter ou éditer un pseudo"; ViewData["Message"] = (utilisateur == null) ? "" : utilisateur.Pseudo ?? ""; return(View("~/Views/User/AddGamePseudo.cshtml", utilisateur)); }
public async Task <IActionResult> EndTournoi(Tournoi tournoi) { if (tournoi == null || tournoi.IdTournament < 1 || tournoi.Deleted != null) { return(NotFound()); } if (tournoi.Deleted != null) { return(NotFound()); } if (tournoi.Over) { return(NotFound()); } RetourAPI retour = await CallAPI.EndTournoi(tournoi); if (retour.Succes) { return(RedirectToAction("Details", "Tournois", new { id = tournoi.IdTournament })); } return(RedirectToAction("EndTournoi", new { id = tournoi.IdTournament })); }
private void ManageNoteBooks_Load(object sender, EventArgs e) { try { noteBooks = CallAPI.GetListContent <Models.NoteBook, Models.NoteBook>("GetNoteBooks"); if (!noteBooks.Any()) { foreach (Control item in this.Controls) { item.Enabled = false; } return; } noteBooksTitles = new List <NoteBooksTitle>(); foreach (var item in noteBooks) { noteBooksTitles.Add(new NoteBooksTitle { Id = item.Id, Title = item.Subject.SubjectName + " " + item.Subject.Dept.ToString() + " " + item.Subject.Chapter + " " + item.ReleaseDate.Year }); } comboDeptSubjectYear.DataSource = noteBooksTitles; comboDeptSubjectYear.DisplayMember = "Title"; comboDeptSubjectYear.ValueMember = "Id"; } catch { CheckData.ErrorMessage(); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (txtName.CheckNull()) { return; } List <Subject> subjects = CallAPI.GetListContent <Subject, Subject>("GetSubjects"); if (subjects.Any(x => x.SubjectName == txtName.Text && x.Chapter == (Chapter)comboChapter.SelectedValue && x.Dept == (Dept)comboDept.SelectedValue)) { MessageBox.Show("The information was already entered", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Subject subject = new Subject { SubjectName = txtName.Text, Chapter = (Chapter)comboChapter.SelectedValue, Dept = (Dept)comboDept.SelectedValue }; subject = CallAPI.PostObjectAndGetObject <Subject, Subject>(subject, "AddNewSubject"); MessageBox.Show("The information has been entered successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); ManageSubjects_Load(sender, e); } catch (Exception ex) { MessageBox.Show("An error occurred, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async void btnSend_Clicked(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtPhoneNumber.Text) || txtPhoneNumber.Text.Length != 10) { await DisplayAlert("Error", "Enter A valid Phone Number", "Cancel"); return; } var GetMac = Tools.GetMacAddr(); var checkCode = CallAPI.GetObjectContent <CheckCode, CheckCode>("CreateCode", txtPhoneNumber.Text, GetMac); if (checkCode != null) { Toast.MakeText(Android.App.Application.Context, "Send Message To " + txtPhoneNumber.Text, ToastLength.Long).Show(); txtCode.IsVisible = btnVerify.IsVisible = btnReset.IsVisible = true; txtPhoneNumber.IsEnabled = btnSend.IsEnabled = false; } else { await DisplayAlert("Error", "re-Send Code Letter", "Ok"); } } catch (Exception ex) { await DisplayAlert("Error", ex.Message, "Cancel"); } }
private void btnDeAvtiveNoteBook_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(txtUsed.Text) > 0) { int notebookId = (int)comboDeptSubjectYear.SelectedValue; Models.NoteBook noteBook = CallAPI.GetObjectContent <Models.NoteBook, Models.NoteBook>("DeActiveNoteBook", notebookId.ToString()); if (noteBook == null) { MessageBox.Show("Error in connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Done", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("this notebooks was deactivated", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { CheckData.ErrorMessage(); } }
public static Account Modify(Account acc) { string rs = CallAPI.MethodPUT(URL + "modify", acc); Account account = JsonConvert.DeserializeObject <Account>(rs); return(account); }
public static Account Create(Account account) { string rs = CallAPI.MethodPOST_Body(URL + "create", account); Account acc = JsonConvert.DeserializeObject <Account>(rs); return(acc); }
public static Account GetByID(int id) { string rs = CallAPI.MethodGET(URL + "get/" + id); Account account = JsonConvert.DeserializeObject <Account>(rs); return(account); }
public static List <Account> Get() { string rs = CallAPI.MethodGET(URL + "get"); List <Account> account = JsonConvert.DeserializeObject <List <Account> >(rs); return(account); }
protected void btnSend_Click(object sender, EventArgs e) { try { CallAPI _ObjCall = new CallAPI(); int z = 0; string[] _SrNoGUID; if (ddlTownship.SelectedIndex != 0) { if (ddlSector.SelectedIndex != 0) { if (ddlBuilding.SelectedIndex != 0) { if (txtTitle.Text != "") { if (txtMessage.Text != "") { for (int j = 0; j < chkFlats.Items.Count; j++) { if (chkFlats.Items[j].Selected == false) { z++; } } if (z == chkFlats.Items.Count) { lblmsg.Text = "Please Select Flat No"; return; } else { for (int j = 0; j < chkFlats.Items.Count; j++) { if (chkFlats.Items[j].Selected == true) { _SrNoGUID[j] = chkFlats.DataValueField; } } if (_SrNoGUID.Length > 0) { var _result = _ObjCall.call(txtTitle.Text, txtMessage.Text, _SrNoGUID, ddlBuilding.DataValueField, ddlSector.DataValueField, ddlTownship.DataValueField); } } } else { lblmsg.Text = "Please enter Title"; SetFocus(txtTitle); return; } } else { lblmsg.Text = "Please enter Message"; SetFocus(txtMessage); return; } } else { lblmsg.Text = "Please select Building"; chkAllFLats.Checked = false; chkAllFLats.Visible = false; chkFlats.Items.Clear(); return; } } else { lblmsg.Text = "Please select Sector"; ddlBuilding.Items.Clear(); chkAllFLats.Checked = false; chkAllFLats.Visible = false; chkFlats.Items.Clear(); SetFocus(ddlSector); } } else { lblmsg.Text = "Please select Township"; ddlSector.Items.Clear(); ddlBuilding.Items.Clear(); chkAllFLats.Checked = false; chkAllFLats.Visible = false; chkFlats.Items.Clear(); SetFocus(ddlTownship); return; } } catch (Exception ex) { lblmsg.Text = ex.Message; return; } }