Esempio n. 1
0
        public SearchGenericResult Search69B(int idSearch, string RFC, int tipoBusqueda, string fecha)
        {
            USER_SEARCH_HISTORY usrHist   = db.USER_SEARCH_HISTORY.Find(idSearch);
            SearchGenericResult resultado = new SearchGenericResult();

            try
            {
                var res = db.SIMPLE_SEARCH_RFC_69B_DAYDATE_BY_DATE(RFC, tipoBusqueda, tipoBusqueda == 1 ? "" : fecha.Split('/')[2] + "-" + fecha.Split('/')[1] + "-" + fecha.Split('/')[0]).FirstOrDefault();

                if (res.Registros != null)
                {
                    resultado.Registros   = res.Registros.Value;
                    resultado.DateUpdated = res.TablaQuery;
                    resultado.Archivo     = res.TablaQuery;
                    resultado.Date69B     = res.Date69B == null ? 1000 : res.Date69B.Value;

                    usrHist.C69_B      = res.TablaQuery;
                    usrHist.C69_BC     = res.Registros.Value;
                    usrHist.C69_B_DATE = res.D69B;
                    db.SaveChanges();
                }

                return(resultado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public int NewSearch(int iduser, string RFC, int tipoBusqueda, string fecha)
        {
            try
            {
                USER_SEARCH_HISTORY usrHist = new USER_SEARCH_HISTORY();

                usrHist.ID_USER     = iduser;
                usrHist.INSERT_DATE = DateTime.Now;
                usrHist.RFC         = RFC;
                usrHist.TYPE_SEARCH = tipoBusqueda;

                if (tipoBusqueda == 2)
                {
                    usrHist.SEARCH_DATE = Convert.ToDateTime(fecha);
                }

                db.USER_SEARCH_HISTORY.Add(usrHist);
                db.SaveChanges();

                return(usrHist.ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }