Exemplo n.º 1
0
        public static List <Order> Get()
        {
            string       rs     = CallAPI.MethodGET(URL + "get");
            List <Order> orders = JsonConvert.DeserializeObject <List <Order> >(rs);

            return(orders);
        }
Exemplo n.º 2
0
        public static Order GetByID(int id)
        {
            string rs     = CallAPI.MethodGET(URL + "get/" + id);
            Order  orders = JsonConvert.DeserializeObject <Order>(rs);

            return(orders);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
        public static Services Modify(Services sv)
        {
            string   rs       = CallAPI.MethodPUT(URL + "modify", sv);
            Services services = JsonConvert.DeserializeObject <Services>(rs);

            return(services);
        }
Exemplo n.º 6
0
        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 }));
        }
Exemplo n.º 7
0
        // 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));
        }
Exemplo n.º 8
0
        public static Services GetByID(int id)
        {
            string   rs       = CallAPI.MethodGET(URL + "get/" + id);
            Services services = JsonConvert.DeserializeObject <Services>(rs);

            return(services);
        }
Exemplo n.º 9
0
        public static int Create(List <OrderDetail> list)
        {
            string rs     = CallAPI.MethodPOST_Body(URL + "create", list);
            int    resutl = JsonConvert.DeserializeObject <int>(rs);

            return(resutl);
        }
Exemplo n.º 10
0
        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();
        }
Exemplo n.º 11
0
        public static List <OrderDetail> Get(int id)
        {
            string             rs           = CallAPI.MethodGET(URL + "get/" + id);
            List <OrderDetail> orderDetails = JsonConvert.DeserializeObject <List <OrderDetail> >(rs);

            return(orderDetails);
        }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
        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 }));
        }
Exemplo n.º 14
0
        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 }));
        }
Exemplo n.º 15
0
        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));
        }
Exemplo n.º 16
0
        public static List <Services> Get()
        {
            string          rs       = CallAPI.MethodGET(URL + "get");
            List <Services> services = JsonConvert.DeserializeObject <List <Services> >(rs);

            return(services);
        }
Exemplo n.º 17
0
        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 }));
        }
Exemplo n.º 18
0
        public static Services Create(Services sv)
        {
            string   rs       = CallAPI.MethodPOST_Body(URL + "create", sv);
            Services services = JsonConvert.DeserializeObject <Services>(rs);

            return(services);
        }
Exemplo n.º 19
0
        public static Order Create(Order o)
        {
            string rs    = CallAPI.MethodPOST_Body(URL + "create", o);
            Order  order = JsonConvert.DeserializeObject <Order>(rs);

            return(order);
        }
Exemplo n.º 20
0
        // GET: Utilisateurs
        public async Task <IActionResult> AllUser()
        {
            IEnumerable <ViewUser> users = await CallAPI.GetAllUtilisateurs();

            ViewData["Title"] = "Liste des utilisateurs";
            return(View(users));
        }
Exemplo n.º 21
0
        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));
        }
Exemplo n.º 22
0
        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 }));
        }
Exemplo n.º 23
0
 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();
     }
 }
Exemplo n.º 24
0
 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);
     }
 }
Exemplo n.º 25
0
        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");
            }
        }
Exemplo n.º 26
0
 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();
     }
 }
Exemplo n.º 27
0
        public static Account Modify(Account acc)
        {
            string  rs      = CallAPI.MethodPUT(URL + "modify", acc);
            Account account = JsonConvert.DeserializeObject <Account>(rs);

            return(account);
        }
Exemplo n.º 28
0
        public static Account Create(Account account)
        {
            string  rs  = CallAPI.MethodPOST_Body(URL + "create", account);
            Account acc = JsonConvert.DeserializeObject <Account>(rs);

            return(acc);
        }
Exemplo n.º 29
0
        public static Account GetByID(int id)
        {
            string  rs      = CallAPI.MethodGET(URL + "get/" + id);
            Account account = JsonConvert.DeserializeObject <Account>(rs);

            return(account);
        }
Exemplo n.º 30
0
        public static List <Account> Get()
        {
            string         rs      = CallAPI.MethodGET(URL + "get");
            List <Account> account = JsonConvert.DeserializeObject <List <Account> >(rs);

            return(account);
        }
Exemplo n.º 31
0
    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;
        }
    }