private void SaveCases(PalmCaseInfoClass InfoCases)
        {
            using (CaseEntities Ctx = new CaseEntities())
            {
                foreach (var WrkCase in InfoCases.ListaCasos)
                {
                    // Salvar Info en MainCases
                    MAINCAS Mc = new MAINCAS();
                    Mc.ID              = Guid.NewGuid();
                    Mc.COUNTY          = County;
                    Mc.CASENUMBER      = CleanString(WrkCase.CaseNumber);
                    Mc.CASETYPE        = WrkCase.CaseType;
                    Mc.CASESTATUS      = WrkCase.CaseStatus;
                    Mc.PRIMARY_PARTY   = WrkCase.PrimaryParty;
                    Mc.SECONDARY_PARTY = WrkCase.SecondaryParty;
                    Mc.FILEDATE        = WrkCase.FileDate;
                    Mc.NOTES           = WrkCase.Courts;

                    Ctx.MAINCASES.Add(Mc);
                }

                // Salvar Cuantos Records por fecha.
                RecordsXdia Rdia = new RecordsXdia();
                Rdia.COUNTY = InfoCases.County;
                Rdia.DATE1  = StartDay;
                Rdia.DATE2  = EndDay;
                Rdia.CASOS  = InfoCases.NumberOfCases;
                Ctx.RecordsXdias.Add(Rdia);

                // Save Changes.
                var x = Ctx.SaveChanges();
            }
        }
        private void logclick(string page)
        {
            using (CaseEntities Ctx = new CaseEntities())
            {
                // Salvar Cuantos Records por fecha.
                ClickPageLog clog = new ClickPageLog();
                clog.COUNTY = County;
                clog.PAGE   = page;
                clog.TIEMPO = System.DateTime.Now;
                Ctx.ClickPageLogs.Add(clog);

                // Save Changes.
                var x = Ctx.SaveChanges();
            }
        }
        private void DiasFeriados(string County, DateTime fecha)
        {
            SelectNewDayRange();
            using (CaseEntities Ctx = new CaseEntities())
            {
                // Salvar Cuantos Records por fecha.
                RecordsXdia Rdia = new RecordsXdia();
                Rdia.COUNTY = County;
                Rdia.DATE1  = StartDay;
                Rdia.DATE2  = EndDay;
                Rdia.CASOS  = 0;
                Ctx.RecordsXdias.Add(Rdia);

                // Save Changes.
                var x = Ctx.SaveChanges();
            }
        }
        private DateTime GetMeDate()
        {
            DateTime BuscaFecha = new DateTime();

            using (CaseEntities Ctx = new CaseEntities())
            {
                //var UltimaFecha = Ctx.MAINCASES
                //            .Where(x => x.COUNTY == County && x.FILEDATE.Year == nupYear.Value)
                //            .OrderByDescending(o => o.FILEDATE)
                //            .Select(s => s.FILEDATE).FirstOrDefault();

                BuscaFecha = BuscaFechaGlobal.AddDays(1);

                if (BuscaFecha < Convert.ToDateTime("12/31/2007"))
                {
                    DiasFeriados(County, Convert.ToDateTime("01/01/" + nupYear.Value.ToString()));
                    BuscaFecha = Convert.ToDateTime("01/02/" + nupYear.Value.ToString());
                }

                switch (BuscaFecha.DayOfWeek)
                {
                case DayOfWeek.Sunday:
                {
                    BuscaFecha = BuscaFecha.AddDays(1);
                    break;
                }

                case DayOfWeek.Saturday:
                {
                    BuscaFecha = BuscaFecha.AddDays(2);
                    break;
                }
                }
            }
            BuscaFechaGlobal = BuscaFecha;
            return(BuscaFecha);
        }