コード例 #1
0
    // Aggiunge le domande e le risposte date da ogni Clients alla Game Session corrente
    public void SetupGameSession(string _nameSender, int _answerIndex)
    {
        string _answerStringTextToPass;

        //estrapolo il testo della risposta in base all'indice passato
        if (_answerIndex != -1)
        {
            _answerStringTextToPass = answerStringList[_answerIndex].answerText;


            // Se si, controllo nella lista finalGraphPlasyerList e controllo che non ci siano altri giocatori con lo stesso nome
            // in quel caso creo un nuovo FinalGraphClass e gli setto il nome ed il valore del contatore di risposte giuste
            for (int i = 0; i < finalGraphPlayerList.Count; i++)
            {
                if (finalGraphPlayerList[i].namePlayer.Contains("Player"))
                {
                    //Debug.LogError("DENTRO L'IF DEL NULL");

                    //Faccio il controllo se la risposta passata abbia il booleano a true
                    if (answerStringList[_answerIndex].isRightAnswer)
                    {
                        //Debug.LogError("DENTRO L'IF DEL BOOL TRUE");
                        FinalGraphClass newPlayer = new FinalGraphClass(_nameSender, 1);
                        finalGraphPlayerList.Remove(finalGraphPlayerList[i]);
                        finalGraphPlayerList.Insert(i, newPlayer);
                        break;
                    }
                    else
                    {
                        //Debug.LogError("DENTRO L'IF DEL BOOL FALSE");
                        FinalGraphClass newPlayer = new FinalGraphClass(_nameSender, 0);
                        finalGraphPlayerList.Remove(finalGraphPlayerList[i]);
                        finalGraphPlayerList.Insert(i, newPlayer);
                        break;
                    }
                }
                else if (finalGraphPlayerList[i].namePlayer == _nameSender)
                {
                    if (answerStringList[_answerIndex].isRightAnswer)
                    {
                        finalGraphPlayerList[i].counterRightAnswer++;
                    }
                }
            }
        }
        else
        {
            _answerStringTextToPass = "******";
        }

        ClientsClass newClient = new ClientsClass(_nameSender, _answerIndex, _answerStringTextToPass);

        Debug.Log(newClient);
        gameSession[currentQuestion].clientClassArch.Add(newClient);

        Debug.Log("ANSWER INDEX: " + _answerIndex + " e ANSWER STRING: " + _answerStringTextToPass);
        Debug.Log(clientsList.Count);
    }
コード例 #2
0
        public List <ClientsClass> GetAllClient(int id)
        {
            int ShowRecords = 20;
            int skip        = id * ShowRecords;
            var DesiMasala  = "";

            var AllRecords = obj.Clients.Where(x => x.Status != 0);
            var Records    = AllRecords.Count();
            int max        = (skip + ShowRecords);

            if (max > Records)
            {
                max = Records;
            }
            DesiMasala = (skip + 1).ToString() + "-" + max.ToString() + "/" + Records.ToString();

            List <ClientsClass> li = new List <ClientsClass>();

            var AllClients = obj.Clients.Skip(skip).Take(ShowRecords).Where(x => x.Status != 0).ToList();
            var count      = AllClients.Count();

            foreach (var details in AllClients)
            {
                ClientsClass temp = new ClientsClass();
                temp.Id          = details.Id;
                temp.Name        = details.Name;
                temp.Testimonial = details.Testimonials;
                temp.Count       = count;
                if (max >= Records)
                {
                    temp.Next = id;
                }
                else
                {
                    temp.Next = id + 1;
                }
                if (id == 0)
                {
                    temp.Prev = id;
                }
                else
                {
                    temp.Prev = id - 1;
                }
                temp.NumberOfShowing = DesiMasala;
                li.Add(temp);
            }
            return(li);
        }
コード例 #3
0
        public List <ClientsClass> GetAllClientsByName(string id)
        {
            List <ClientsClass> li = new List <ClientsClass>();

            var AllClients = obj.Clients.Where(x => x.Status != 0 && x.Name.Equals(id)).ToList();
            var count      = AllClients.Count();

            foreach (var details in AllClients)
            {
                ClientsClass temp = new ClientsClass();
                temp.Id          = details.Id;
                temp.Name        = details.Name;
                temp.Testimonial = details.Testimonials;
                temp.Count       = count;
                li.Add(temp);
            }
            return(li);
        }
コード例 #4
0
        public int UpdateClient(ClientsClass CC)
        {
            int check = 0;

            try
            {
                Client client = obj.Clients.First(x => x.Id.Equals(CC.Id));
                client.Name         = CC.Name;
                client.Testimonials = CC.Testimonial;
                obj.SubmitChanges();
                check = client.Id;
                List <ClientPakage> cp = obj.ClientPakages.Where(x => x.ClientId.Equals(client.Id)).ToList();
                obj.ClientPakages.DeleteAllOnSubmit(cp);
                obj.SubmitChanges();
            }
            catch (Exception e) { check = 0; }
            return(check);
        }
コード例 #5
0
        public List <ClientsClass> GetAllClientsPakageById(int id)
        {
            List <ClientsClass> li = new List <ClientsClass>();

            var AllClients = obj.ClientPakages.Where(x => x.ClientId.Equals(id)).ToList();
            var count      = AllClients.Count();

            foreach (var details in AllClients)
            {
                ClientsClass temp = new ClientsClass();
                temp.PakageId = details.PakagesId;

                temp.Count = count;

                li.Add(temp);
            }
            return(li);
        }
コード例 #6
0
    // Aggiunge le domande e le risposte date da ogni Clients alla Game Session corrente
    public void SetupGameSession(string _nameSender, int _answerIndex)
    {
        string _answerStringTextToPass;

        //estrapolo il testo della risposta in base all'indice passato
        if (_answerIndex != -1)
        {
            _answerStringTextToPass = answerStringList[_answerIndex];
        }
        else
        {
            _answerStringTextToPass = "******";
        }

        ClientsClass newClient = new ClientsClass(_nameSender, _answerIndex, _answerStringTextToPass);

        Debug.Log(newClient);
        gameSession[currentQuestion].clientClassArch.Add(newClient);

        Debug.Log("ANSWER INDEX: " + _answerIndex + " e ANSWER STRING: " + _answerStringTextToPass);
        Debug.Log(clientsList.Count);
    }
コード例 #7
0
        public int PostClient(ClientsClass CC)
        {
            int check       = 0;
            int Id          = 0;
            var typeOfImage = "";


            try
            {
                Client client = new Client();
                client.Name         = CC.Name;
                client.Testimonials = CC.Testimonial;
                client.Status       = 1;

                client.AddDate = DateTime.Now.ToShortDateString();
                obj.Clients.InsertOnSubmit(client);
                obj.SubmitChanges();
                check = client.Id;
                Id    = client.Id;
            }
            catch (Exception e) { check = 0; }
            return(check);
        }
コード例 #8
0
 public ProjectApiController(ClientsClass api)
 {
     this.api = api;
 }
コード例 #9
0
 public ClientApiController(ClientsClass clientApi)
 {
     this.clientApi = clientApi;
 }