Exemplo n.º 1
0
        public static historique getMaPartie(Guid resultat)
        {
            historique monHistorique = new historique();

            monHistorique = historiqueDAL.getMonResultat(resultat);
            return(monHistorique);
        }
Exemplo n.º 2
0
        public static historique getMonResultat(Guid Resultat)
        {
            historique    monH           = new historique();
            SqlConnection sqlConnection1 = new SqlConnection(getDbConnexion());
            SqlCommand    cmd            = new SqlCommand();
            SqlDataReader reader;

            cmd.CommandText = "select * from [dbo].[sudoku_historique] where resultat ='" + Resultat + "'";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = sqlConnection1;

            sqlConnection1.Open();

            reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                monH.Id           = (Guid)reader[0];
                monH.Numero       = reader[1].ToString();
                monH.Resultat     = (Guid)reader[2];
                monH.Difficulte   = reader[3].ToString();
                monH.NumeroIndice = reader[4].ToString();
            }

            // Data is accessible through the DataReader object here.

            sqlConnection1.Close();


            return(monH);
        }
Exemplo n.º 3
0
        public static SDTO_Historique GetHistoriqueExploitation(string CodeExploitation, string Periode)
        {
            SDTO_Historique Result = null;
            historique      histo  = null;

            if (!string.IsNullOrEmpty(Periode) && !string.IsNullOrEmpty(CodeExploitation))
            {
                histo = new DAL <historique>().Find(p => p.codexp == CodeExploitation && p.perfact.Trim() == Periode.Trim()).FirstOrDefault();
            }

            if (histo != null)
            {
                Result = new SDTO_Historique()
                {
                    codexp     = histo.codexp,
                    codsite    = histo.codsite,
                    datecpte   = histo.datecpte,
                    datextract = histo.datextract,
                    datoper    = histo.datoper,
                    datrecept  = histo.datrecept,
                    modextract = histo.modextract,
                    modrecept  = histo.modrecept,
                    nbrmvt     = histo.nbrmvt,
                    numoperec  = histo.numoperec,
                    numoperex  = histo.numoperex,
                    perfact    = histo.perfact,
                };
            }
            return(Result);
        }
Exemplo n.º 4
0
        public static bool MiseAJourHistorique(string CodeExploitation, string Periode, ref string errmess)
        {
            bool Result = false;

            try
            {
                historique histo = null;
                if (!string.IsNullOrEmpty(Periode) && !string.IsNullOrEmpty(CodeExploitation))
                {
                    histo = new DAL <historique>().Find(p => p.codexp == CodeExploitation && p.perfact.Trim() == Periode.Trim()).FirstOrDefault();
                }

                if (histo != null)
                {
                    histo.modextract = Convert.ToChar("1");
                    histo.datextract = DateTime.Now;
                    new DAL <historique>().UpdateRow(histo, p => p.codexp == histo.codexp.Trim() && p.perfact.Trim() == histo.perfact.Trim());
                    Result = true;
                }
            }
            catch (Exception ex)
            {
                errmess = ex.Message;
                Result  = false;
            }
            return(Result);
        }
Exemplo n.º 5
0
        public static void addHistorique(string numero, Guid resultat, string difficulte, string numeroindice)
        {
            historique maPartie = new historique();

            maPartie.Id           = new Guid();
            maPartie.Id           = Guid.NewGuid();
            maPartie.Difficulte   = difficulte;
            maPartie.NumeroIndice = numeroindice;
            maPartie.Resultat     = resultat;
            maPartie.Numero       = numero;


            historiqueDAL.addHistorique(maPartie);
        }
Exemplo n.º 6
0
        public static void addHistorique(historique monH)
        {
            SqlConnection sqlConnection1 = new SqlConnection(getDbConnexion());
            SqlCommand    cmd            = new SqlCommand();
            SqlDataReader reader;

            cmd.CommandText = "INSERT INTO [dbo].[sudoku_historique] VALUES ('" + monH.Id + "','" + monH.Numero + "','" + monH.Resultat + "','" + monH.Difficulte + "','" + monH.NumeroIndice + "')";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = sqlConnection1;



            sqlConnection1.Open();

            reader = cmd.ExecuteReader();



            // Data is accessible through the DataReader object here.

            sqlConnection1.Close();
        }
Exemplo n.º 7
0
        private void cb_mesParties_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            if (cb_mesParties.SelectedIndex != -1)
            {
                int    x    = 0;
                string temp = "";
                int    y    = 0;
                char[,] grid = new char[9, 9];
                historique monH = new historique();
                Resultat   monR = (Resultat)cb_mesParties.SelectedItem;

                monH               = historiqueService.getMaPartie(monR.Id);
                lb_temps.Text      = int.Parse(monR.Temps) / 60 + ":" + int.Parse(monR.Temps) % 60;
                lb_difficulte.Text = monH.Difficulte;
                for (int i = 0; i < monH.Numero.Length; i++)
                {
                    grid[y, x] = monH.Numero[i];
                    DataGridView1.Rows[y].Cells[x].Value = monH.Numero[i];
                    if (monH.NumeroIndice[i] == '1')
                    {
                        DataGridView1.Rows[y].Cells[x].Style.ForeColor = Color.Black;
                    }
                    else
                    {
                        DataGridView1.Rows[y].Cells[x].Style.ForeColor = Color.Blue;
                    }
                    if (x == 8)
                    {
                        y++;
                        x = 0;
                    }
                    else
                    {
                        x++;
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void initChart(string difficulte)
        {
            chart_stat.Series["stat"].Points.Clear();
            chart_stat.Titles.Clear();
            int nbPartie;


            historique      unH        = new historique();
            List <Resultat> mesParties = new List <Resultat>();

            mesParties = resultatService.getMesResultats(monUser.Id);
            List <Resultat> mesPartiesAvecDifficulte = new List <Resultat>();

            foreach (Resultat unR in mesParties)
            {
                unH = historiqueService.getMaPartie(unR.Id);
                if (unH.Difficulte == difficulte)
                {
                    mesPartiesAvecDifficulte.Add(unR);
                }
            }

            nbPartie = mesPartiesAvecDifficulte.Count();
            if (nbPartie != 0)
            {
                chart_stat.Titles.Add("Statistique de mes parties [" + nbPartie + " jouées]");
                lb_nbPartie.Visible = false;
                int nb1      = 0;
                int nb2      = 0;
                int nb3      = 0;
                int nb4      = 0;
                int nb5      = 0;
                int nb6      = 0;
                int monTemps = 0;
                foreach (Resultat unR in mesPartiesAvecDifficulte)
                {
                    monTemps = int.Parse(unR.Temps) / 60;
                    if (monTemps >= 0 && monTemps < 2)
                    {
                        nb1++;
                    }
                    if (monTemps >= 2 && monTemps < 4)
                    {
                        nb2++;
                    }
                    if (monTemps >= 4 && monTemps < 6)
                    {
                        nb3++;
                    }
                    if (monTemps >= 6 && monTemps < 8)
                    {
                        nb4++;
                    }
                    if (monTemps >= 8 && monTemps < 10)
                    {
                        nb5++;
                    }
                    if (monTemps >= 10)
                    {
                        nb6++;
                    }
                }

                if (nb1 > 0)
                {
                    chart_stat.Series["stat"].Points.AddXY("0-2m[" + nb1 + "]", nb1);
                }
                if (nb2 > 0)
                {
                    chart_stat.Series["stat"].Points.AddXY("2-4m[" + nb2 + "]", nb2);
                }
                if (nb3 > 0)
                {
                    chart_stat.Series["stat"].Points.AddXY("4-6m[" + nb3 + "]", nb3);
                }
                if (nb4 > 0)
                {
                    chart_stat.Series["stat"].Points.AddXY("6-8m[" + nb4 + "]", nb4);
                }
                if (nb5 > 0)
                {
                    chart_stat.Series["stat"].Points.AddXY("8-10m[" + nb5 + "]", nb5);
                }
                if (nb6 > 0)
                {
                    chart_stat.Series["stat"].Points.AddXY(">10m[" + nb6 + "]", nb6);
                }
            }
            else
            {
                lb_nbPartie.Visible = true;
            }
        }