예제 #1
0
        public ExtraFrecuency(MainWindow main)
        {
            InitializeComponent();
            DataContext = this;
            Main = main;
            DaysMonth = new ObservableCollection<string>();
            for (int i = 1; i <= 31; i++)
            {
                DaysMonth.Add(i.ToString());
            }
            
            DaysWeek=new ObservableCollection<string>(new List<string>(){"DO","LU","MA","MI","JU","VI","SA"});
            
            Months = new ObservableCollection<string>(new List<string>() 
            { "Enero", "Febrero", "Marzo", "Abril","Mayo","Junio",
                "Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"});

            var d = Util.LastDate.AddDays(1);
            _selectMonth = Util.Month1[d.Month];
            _selectDayWeek = Util.DaysWeek2[Util.DaysWeek[(d.DayOfWeek).ToString()]];
            _selectDayMonth = (d.Day).ToString();

            
            var cad = "";
            if (d.Day < 10)
                cad += "0" + d.Day.ToString();
            else cad += d.Day.ToString();
            cad += "/";
            if (d.Month < 10)
                cad += "0" + d.Month.ToString();
            else cad += d.Month.ToString();
            cad += "/";
            cad += d.Year;
            cad += "/N-000-00-00";
            Combination comb = new Combination(cad, _selectDayWeek);

            FrecuencyMonths=new ObservableCollection<NumberFrecuency>();
            FrecuencyDaysW=new ObservableCollection<NumberFrecuency>();
            FrecuencyDaysM=new ObservableCollection<NumberFrecuency>();

            list.Add(new List<NumberFrecuency>(100));
            list.Add(new List<NumberFrecuency>(100));
            list.Add(new List<NumberFrecuency>(100));
            list.Add(new List<NumberFrecuency>(100));

            Filtrar(new DateTime(1991, 7, 4), Util.LastDate);
        }
예제 #2
0
        /// <summary>
        /// Inserta una combinacion a la bases de datos
        /// </summary>
        /// <param name="comb"></param>
        /// <param name="exist"></param>
        private void InsertCombination(Combination comb,bool exist)
        {
            if (Lotto.Combinations == null)
                return;

            DateTime date = new DateTime(comb.Date.Year, comb.Date.Month, comb.Date.Day);
            comb.DayWeek = Util.DaysWeek[date.DayOfWeek.ToString()];

            if(centenaCB.IsChecked==true)
                comb.ChanceShowCentena(true);
            else comb.ChanceShowCentena(false);

            Lotto.InsertDay(comb, exist);

        }
예제 #3
0
        /// <summary>
        /// Verifica que el tiro a introducir sea el correcto
        /// </summary>
        /// <param name="comb"></param>
        /// <returns></returns>
        private bool IsNext(Combination comb)
        {
            var date1 = Lotto.CombinationsAll.Last().Value.Date;
            var date2 = comb.Date;
            var d1 = new DateTime(date1.Year, date1.Month, date1.Day);
            var d2 = new DateTime(date2.Year, date2.Month, date2.Day);
            var true_d2 = d1.AddDays(1);


            if (comb.Occasion == Lotto.CombinationsAll.Last().Value.Occasion)
                return false;

            if (comb.Occasion == "N" && (d1.Day != d2.Day ||
                                         d1.Month != d2.Month || d1.Year != d2.Year))
            {
                return false;
            }
            if (comb.Occasion == "D" && !(true_d2.Day == d2.Day && true_d2.Month == d2.Month
                                          && true_d2.Year == d2.Year))
            {
                return false;
            }
            return true;
        }
예제 #4
0
        /// <summary>
        /// Agrega una combinacion desde textbox grande
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddCombination_Click(object sender, RoutedEventArgs e)
        {
            //var visual = new VisualBrush(loading){Stretch=Stretch.None};
            ////borderLoading.Background = visual;

            //fechafijocorrido.Background = visual;

            bool change = false;
            foreach (
                var line in fechafijocorrido.Text.Split(new char[] {'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries))
            {
                var temp = line.Replace('d', 'D').Replace('n', 'N');
                if (temp == "18/03/1996/N-06-26-05")
                    continue;
                if (Lotto.IsCombinationValid(temp))
                {
                    change = true;
                    
                    var comb = new Combination(temp, "");

                    if (Lotto.ContainCombination(comb))
                    {
                        if (MessageBox.Show("Ya este día esta registrado: " + Lotto.CombinationsAll[comb.Key].str +
                                            " .Decea remplazarlo por: " + comb.str, "Actualizar", MessageBoxButton.YesNo) ==
                            MessageBoxResult.Yes)
                        {
                            InsertCombination(comb, true);
                        }
                    }
                    else
                    {
                        if (IsNext(comb))
                        {
                            InsertCombination(comb,false);
                        }
                        else
                        {
                            MessageBox.Show("Las combinaciones deben ser introducidas en orden", "Error");
                            break;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("No se insertó la linea :" + line, "Error de Formato");
                    fechafijocorrido.Background =System.Windows.Media.Brushes.WhiteSmoke;
                    fechafijocorrido.Text = "18/03/1996/N-06-26-05";
                    fechafijocorrido.FontStyle = FontStyles.Oblique;
                    fechafijocorrido.Foreground = System.Windows.Media.Brushes.Gray;
                    fechafijocorrido.FontFamily = new System.Windows.Media.FontFamily("Myanmar Text");
                }
            }
            if (!change)
            {
                return;
            }
            UpdateAfterInsert();
            //Lotto.TimeLine=new RepeatBehavior(0);
        }
예제 #5
0
        /// <summary>
        /// Agregra una combinacion desde textbox pequenno
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddCombinationOk_Click(object sender, RoutedEventArgs e)
        {
            var f = 100;
            var c1 = 100;
            var c2 = 100;
            try
            {
                f = int.Parse(fijo.Text);
                c1 = int.Parse(corrido1.Text);
                c2 = int.Parse(corrido2.Text);
                if (f <= 999 && f >= 0 && c1 < 100 && c1 >= 0 & c2 < 100 && c2 >= 0)
                {
                    var str = "";
                    var d = datePicker.SelectedDate.Value.Day;
                    var m = datePicker.SelectedDate.Value.Month;
                    var a = datePicker.SelectedDate.Value.Year;

                    str = d < 10 ? "0" + d.ToString() : d.ToString();
                    str += "/";
                    str += m < 10 ? "0" + m.ToString() : m.ToString();
                    str += "/";
                    str += a.ToString();
                    str += "/";
                    str += dia.IsChecked == true ? "D-" : "N-";
                    str += fijo.Text;
                    str += "-";
                    str += c1 < 10 ? "0" + c1.ToString() : c1.ToString();
                    str += "-";
                    str += c2 < 10 ? "0" + c2.ToString() : c2.ToString();

                    var comb = new Combination(str, "");

                    if (Lotto.ContainCombination(comb))
                    {
                        if (MessageBox.Show("Ya este día esta registrado: " + Lotto.CombinationsAll[comb.Key].str +
                                            " .Decea remplazarlo por: " + comb.str, "Actualizar", MessageBoxButton.YesNo) ==
                            MessageBoxResult.Yes)
                        {
                           InsertCombination(comb, true);
                        }
                    }
                    else
                    {
                        if (IsNext(comb))
                        {
                            InsertCombination(comb,false);

                            UpdateAfterInsert();

                        }
                        else
                        {
                            MessageBox.Show("Las combinaciones deben ser introducidas en orden", "Error");
                            return;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Inserte los números correctamente");
                    fijo.Text = "";
                    corrido1.Text = "";
                    corrido2.Text = "";
                }
            }
            catch
            {
                MessageBox.Show("Inserte los datos correctamente");
                fijo.Text = "";
                corrido1.Text = "";
                corrido2.Text = "";
            }
        }
예제 #6
0
        /// <summary>
        /// Actualiza las listas ordenadas de frecuencias en meses...en el rango de fecha seleccionada
        /// </summary>
        /// <param name="desde"></param>
        /// <param name="hasta"></param>
        /// <param name="list"></param>
        /// <param name="month"></param>
        /// <param name="dayW"></param>
        /// <param name="dayM"></param>
        /// <param name="fijcoramb">Especifica si se va a especificar para fijo-corrido-ambos</param>
        /// <param name="duplexFilter"></param>
        public void FiltroFechaLMDSDM(DateTime desde,DateTime hasta,List<List<NumberFrecuency>> list
            ,string month,string dayW,int dayM,int fijcoramb,bool duplexFilter)
        {
            if (Lotto == null || desde == Util.LastDate || Lotto.Combinations==null)
                return;
            var comb = new Combination("04/07/1991/N-905-02-30", "Jueves");
            for (int i = 0; i < 100; i++)
            {
                if (list[0] != null)
                {
                    list[0].Add(new NumberFrecuency(i < 10 ? "0" + i.ToString() : i.ToString(), 0));
                    list[0][i].LastCombination = new DateTime(comb.Date.Year, comb.Date.Month, comb.Date.Day);
                }
                if (list[1] != null)
                {
                    list[1].Add(new NumberFrecuency(i < 10 ? "0" + i.ToString() : i.ToString(), 0));
                    list[1][i].LastCombination = new DateTime(comb.Date.Year, comb.Date.Month, comb.Date.Day);
                }
                if (list[2] != null)
                {
                    list[2].Add(new NumberFrecuency(i < 10 ? "0" + i.ToString() : i.ToString(), 0));
                    list[2][i].LastCombination = new DateTime(comb.Date.Year, comb.Date.Month, comb.Date.Day);
                }
            }
            int index = -1; int index1 = -1; int index2 = -1;
            var dateTime = DateTime.Now;
            if(fijcoramb==0)
            {
                #region Fijos
                foreach (var combination in Lotto.Combinations)
                {
                    dateTime = new DateTime(combination.Value.Date.Year, combination.Value.Date.Month, combination.Value.Date.Day);
                    if (dateTime < desde)
                        continue;
                    if (dateTime > hasta)
                        break;
                    if (duplexFilter && Util.Month1[combination.Value.Date.Month] != month)
                        continue;
                    index = int.Parse(combination.Value.Fijo);
                    
                    if (list[0] != null && Util.Month1[combination.Value.Date.Month] == month)
                    {
                        list[0][index].Count++;
                        list[0][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[0][index].StringLastCombination = combination.Value.str;
                    }
                    if (list[1] != null && combination.Value.DayWeek == dayW)
                    {
                        list[1][index].Count++;
                        list[1][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[1][index].StringLastCombination = combination.Value.str;
                    }
                    if (list[2] != null && combination.Value.Date.Day == dayM)
                    {
                        list[2][index].Count++;
                        list[2][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[2][index].StringLastCombination = combination.Value.str;
                    }
                }
                #endregion
            }
            else if(fijcoramb==1)
            {
                #region Corridos
                foreach (var combination in Lotto.Combinations)
                {
                    dateTime = new DateTime(combination.Value.Date.Year, combination.Value.Date.Month, combination.Value.Date.Day);
                    if (dateTime < desde)
                        continue;
                    if (dateTime > hasta)
                        break;
                    if (duplexFilter && Util.Month1[combination.Value.Date.Month] != month)
                        continue;
                    index = int.Parse(combination.Value.Corrido1);
                    index1 = int.Parse(combination.Value.Corrido2);
                    
                    if (list[0] != null && Util.Month1[combination.Value.Date.Month] == month)
                    {
                        list[0][index].Count++;
                        list[0][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[0][index].StringLastCombination = combination.Value.str;

                        list[0][index1].Count++;
                        list[0][index1].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[0][index1].StringLastCombination = combination.Value.str;
                    }
                    if (list[1] != null && combination.Value.DayWeek == dayW)
                    {
                        list[1][index].Count++;
                        list[1][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[1][index].StringLastCombination = combination.Value.str;

                        list[1][index1].Count++;
                        list[1][index1].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[1][index1].StringLastCombination = combination.Value.str;
                    }
                    if (list[2] != null && combination.Value.Date.Day == dayM)
                    {
                        list[2][index].Count++;
                        list[2][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[2][index].StringLastCombination = combination.Value.str;

                        list[2][index1].Count++;
                        list[2][index1].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[2][index1].StringLastCombination = combination.Value.str;
                    }
                }
                #endregion
            }
            else
            {
                #region Fijos-Corridos
                foreach (var combination in Lotto.Combinations)
                {
                    dateTime = new DateTime(combination.Value.Date.Year, combination.Value.Date.Month, combination.Value.Date.Day);
                    if (dateTime < desde)
                        continue;
                    if (dateTime > hasta)
                        break;
                    if (duplexFilter && Util.Month1[combination.Value.Date.Month] != month)
                        continue;
                    index = int.Parse(combination.Value.Fijo);
                    index1 = int.Parse(combination.Value.Corrido1);
                    index2 = int.Parse(combination.Value.Corrido2);
                    
                    if (list[0] != null && Util.Month1[combination.Value.Date.Month] == month)
                    {
                        list[0][index].Count++;
                        list[0][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[0][index].StringLastCombination = combination.Value.str;

                        list[0][index1].Count++;
                        list[0][index1].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[0][index1].StringLastCombination = combination.Value.str;

                        list[0][index2].Count++;
                        list[0][index2].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[0][index2].StringLastCombination = combination.Value.str;
                    }
                    if (list[1] != null && combination.Value.DayWeek == dayW)
                    {
                        list[1][index].Count++;
                        list[1][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[1][index].StringLastCombination = combination.Value.str;

                        list[1][index1].Count++;
                        list[1][index1].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[1][index1].StringLastCombination = combination.Value.str;

                        list[1][index2].Count++;
                        list[1][index2].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[1][index2].StringLastCombination = combination.Value.str;
                    }
                    if (list[2] != null && combination.Value.Date.Day == dayM)
                    {
                        list[2][index].Count++;
                        list[2][index].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[2][index].StringLastCombination = combination.Value.str;

                        list[2][index1].Count++;
                        list[2][index1].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[2][index1].StringLastCombination = combination.Value.str;

                        list[2][index2].Count++;
                        list[2][index2].LastCombination =
                            new DateTime(combination.Value.Date.Year, combination.Value.Date.Month,
                                         combination.Value.Date.Day);
                        list[2][index2].StringLastCombination = combination.Value.str;
                    }
                }
                #endregion
            }
        }