Beispiel #1
0
        public List <GruposDocumentos> obtenerGruposDocumentosConciliacion(Documentos D, int idGrupo)
        {
            List <GruposDocumentos> list2;

            try
            {
                //this.gd.GruposDocumentos.First().DocId
                this.gd = new GestorDocumentalEnt();
                List <GruposDocumentos> list = (from d in this.gd.Documentos
                                                join g in this.gd.GruposDocumentos on d.DocId equals g.DocId
                                                where g.DocId == D.DocId && g.GDocId == 6
                                                orderby g.Orden
                                                select g).ToList();

                GruposDocumentos item = new GruposDocumentos
                {
                    DocId           = 0,
                    GDocId          = 0,
                    GDocDescripcion = "Seleccione..."
                };
                list.Insert(0, item);
                list2 = list;
            }
            catch (Exception exception)
            {
                LogRepository.registro("Error en DocumentosController metodo obtenerGruposDocumentosConciliacion " + exception.Message + " stack " + exception.StackTrace);
                throw exception;
            }
            return(list2);
        }
Beispiel #2
0
 public Campos ObtenerCampoComodin(GruposDocumentos GD, Clientes Cli)
 {
     try
     {
         this.gd = new GestorDocumentalEnt();
         return((from c in gd.Campos where c.TcId == 10 & c.GDocId == GD.GDocId select c).First());
     }
     catch (Exception exception)
     {
         LogRepository.registro("Error en CamposController metodo ObtenerCampoComodin " + exception.Message);
         throw exception;
     }
 }
Beispiel #3
0
        public JsonResult CargarCampos()
        {
            try
            {
                Table tblControls = new Table();

                GruposDocumentos g = new GruposDocumentos();
                g.GDocId = Convert.ToInt32(Session["_GDocId"].ToString());

                P_Etapas e = new P_Etapas();
                e.IdEtapa = 1;

                Captura       n         = (Captura)this.Session["NEGOCIO"];
                List <Campos> lstCampos = this.bCampos.ObtenerCamposCliente(g, e, n);
                Session["_listaCampos"] = lstCampos;
                if (lstCampos.Count == 0)
                {
                    Campos camp = new Campos();
                    camp.Activo = false;
                    lstCampos.Add(camp);
                }

                List <spObtenerRespuestasAnteriores_Result> lstRespAnt = null;

                int gDocID  = Convert.ToInt32(Session["_GDocId"].ToString());
                int idETAPA = Convert.ToInt32(((P_Etapas)this.Session["ETAPA"]).IdEtapa);
                //string noCaptura = base.Request.QueryString["CAPTURA"].ToString();
                int    _idDocumento    = Convert.ToInt32(Session["_idDocId"].ToString());
                int    _NegId          = Convert.ToInt32((int)((Captura)this.Session["NEGOCIO"]).NegId);
                string camposGenerados = formulario.GenerarCampos(tblControls, lstCampos, lstRespAnt, gDocID, idETAPA, "0", _idDocumento, _NegId);
                ViewData["CamposGenerados"] = camposGenerados;
                Campos campos = lstCampos.Find(c => c.CampId == 5);

                Hashtable hashtable = this.bCampos.CamposPresentados(this.bCampos.ObtenerCamposCliente(g, e, n));
                if (String.IsNullOrEmpty(camposGenerados))
                {
                    FormCollection collection = new FormCollection();
                    //Guardar(collection);
                }

                return(Json(ViewData["CamposGenerados"], JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LogRepository.registro("Error en Validacion Documental metodo CargarCampos " + exception.Message);
                throw;
            }
        }
        /// <summary>
        /// Método que Inserta o Modifica una Entidad Tabla según Corresponda.
        /// </summary>
        /// <param name="Entidad">Objeto de la Entidad Tabla</param>
        /// <returns>Resultado general de la Acción en el Atributo ResultadoGeneral del Objeto Resultado</returns>
        public Resultado <GruposDocumentos> Guardar(GruposDocumentos Entidad)
        {
            var ObjetoResultado = new Resultado <GruposDocumentos>();

            try
            {
                //Entidad.UsuarioModificacion_Id = (int)Administracion.NegUsuarios.UsuarioId;
                ObjetoResultado = AccesoDatos.Operacion <GruposDocumentos>(Entidad, Documental.Data.Global.SP.GruposDocumentos_INS, Documental.Data.Global.Accion.Guardar);

                return(ObjetoResultado);
            }
            catch (Exception)
            {
                ObjetoResultado.ResultadoGeneral = false;
                ObjetoResultado.Mensaje          = ArchivoRecursos.ObtenerValorNodo(Constantes.MensajesUsuario.ErrorGuardar.ToString()) + " GruposDocumentos";
                return(ObjetoResultado);
            }
        }
        /// <summary>
        /// Método que realiza una Búsqueda en la tabla Grupos Documentos
        /// </summary>
        /// <param name="Entidad">Objeto GrupoDocumento con el Filtro de Búsqueda correspondiente</param>
        /// <returns>Lista de la Entidad UsuarioInfo en el Atributo Lista del Objeto Resultado.</returns>
        public Resultado <GruposDocumentos> ObtenerGrupoDocumentos(GruposDocumentos Entidad)
        {
            var ObjetoResultado = new Resultado <GruposDocumentos>();

            try
            {
                ObjetoResultado = AccesoDatos.Buscar <GruposDocumentos, GruposDocumentos>(Entidad, Documental.Data.Global.SP.GruposDocumentosPortal_QRY);
                ObjetoResultado.ValorDecimal = ObjetoResultado.Lista.Count();


                return(ObjetoResultado);
            }
            catch (Exception)
            {
                ObjetoResultado.ResultadoGeneral = false;
                ObjetoResultado.Mensaje          = ArchivoRecursos.ObtenerValorNodo(Constantes.MensajesUsuario.ErrorListar.ToString()) + " GruposDocumentosPortal";
                return(ObjetoResultado);
            }
        }
 private void CargarCampos()
 {
     if (this.lstGrupos.SelectedIndex > 0)
     {
         GruposDocumentos g = new GruposDocumentos
         {
             GDocId = Convert.ToInt32(this.lstGrupos.SelectedValue)
         };
         P_Etapas e = new P_Etapas
         {
             IdEtapa = int.Parse(base.Request.QueryString["CAPTURA"])
         };
         Captura       n         = (Captura)this.Session["NEGOCIO"];
         List <Campos> lstCampos = this.bCampos.ObtenerCamposCliente(g, e, n);
         this.GenerarCampos(this.tblControls, lstCampos);
         Campos    campos    = lstCampos.Find(c => c.CampId == 5);
         Hashtable hashtable = this.bCampos.CamposPresentados(this.bCampos.ObtenerCamposCliente(g, e, n));
         this.UpdatePanel2.Update();
     }
 }
Beispiel #7
0
        public List <Campos> obtenerCamposFaltantes(GruposDocumentos g, P_Etapas e, Captura n, List <Campos> list)
        {
            //agregar campos capturados en -999
            List <Campos> listRest = new List <Campos>();

            try
            {
                List <Campos> list1 = (from c in this.gd.Campos
                                       join cap in this.gd.Captura on c.CampId equals cap.CampId
                                       where (c.GDocId == g.GDocId) & (c.Activo == true) & (c.CampNumCaptura == 1) & (cap.NegId == n.NegId) & (cap.NumCaptura == 1) & ((cap.NegValor == "-999") | (cap.NegValor == "-111"))
                                       select c).ToList <Campos>();

                foreach (Campos l3 in list1)
                {
                    if (listRest.Where(c1 => c1.CampId == l3.CampId).Count() == 0 && list.Where(c1 => c1.CampId == l3.CampId).Count() == 0)
                    {
                        listRest.Add(l3);
                    }
                }

                List <Campos> list2 = (from c in this.gd.Campos
                                       join cap in this.gd.Captura on c.CampId equals cap.CampId
                                       where (c.GDocId == g.GDocId) & (c.Activo == true) & (c.CampNumCaptura2 == true) & (cap.NegId == n.NegId) & (cap.NumCaptura == 2) & ((cap.NegValor == "-999") | (cap.NegValor == "-111"))
                                       select c).ToList <Campos>();

                foreach (Campos l3 in list2)
                {
                    if (listRest.Where(c1 => c1.CampId == l3.CampId).Count() == 0 && list.Where(c1 => c1.CampId == l3.CampId).Count() == 0)
                    {
                        listRest.Add(l3);
                    }
                }
            }
            catch (Exception exception)
            {
                LogRepository.registro("Error en CamposController metodo ObtenerCamposCliente " + exception.Message + " stack trace " + exception.StackTrace);
                throw exception;
            }

            return(listRest);
        }
Beispiel #8
0
        public List <Campos> ObtenerCamposCliente(GruposDocumentos g, P_Etapas e, Captura n)
        {
            List <Campos> list4;

            try
            {
                this.gd = new GestorDocumentalEnt();
                List <Campos> list = null;
                if (e.IdEtapa == 1)
                {
                    list = (from c in this.gd.Campos
                            where c.GDocId == g.GDocId & (c.Activo == true) & (c.CampNumCaptura == 1)
                            orderby c.CampOrden
                            select c).ToList <Campos>();
                }
                else if (e.IdEtapa == 2)
                {
                    list = (from c in this.gd.Campos
                            where (c.GDocId == g.GDocId) & (c.CampNumCaptura2 == true) & (c.Activo == true)
                            orderby c.CampOrden
                            select c).ToList <Campos>();
                }
                else if (e.IdEtapa == 3)
                {
                    List <Captura> list2 = (from c in this.gd.Campos
                                            join cap in this.gd.Captura on c.CampId equals cap.CampId
                                            where (c.GDocId == g.GDocId) & (c.ControlCalidad == true) & (c.Activo == true) & (cap.NegId == n.NegId) & (c.CampNumCaptura == 1) & (cap.NumCaptura == 1)
                                            select cap).Union((from c in this.gd.Campos
                                                               join cap in this.gd.Captura on c.CampId equals cap.CampId
                                                               where (c.GDocId == g.GDocId) & (c.ControlCalidad == true) & (c.Activo == true) & (cap.NegId == n.NegId) & (c.CodFormulario != null) & (cap.NumCaptura == 1)
                                                               select cap))
                                           .ToList <Captura>();

                    List <Captura> list3 = (from c in this.gd.Campos
                                            join cap in this.gd.Captura on c.CampId equals cap.CampId
                                            where (c.GDocId == g.GDocId) & (c.ControlCalidad == true) & (c.Activo == true) & (c.CampNumCaptura2 == true) & (cap.NegId == n.NegId) & (cap.NumCaptura == 2)
                                            select cap).ToList <Captura>();

                    List <Captura> ListResult = (from c1 in list2
                                                 join c2 in list3 on c1.CampId equals c2.CampId
                                                 join c in this.gd.Campos on c2.CampId equals c.CampId
                                                 where (c1.NegValor.ToString().ToUpper().Trim() != c2.NegValor.ToString().ToUpper().Trim())
                                                 select c1).ToList();

                    list = (from c in gd.Campos.ToList() //where ListResult.Select(x=> x.CampId ).Contains(c.CampId) select c).ToList();
                            join r in ListResult on c.CampId equals r.CampId
                            orderby c.CampOrden
                            select c).ToList();

                    // se agregan los campos que quedaron en captura 1 y 2 en -999 o -1
                    List <Campos> listRest = null;
                    listRest = obtenerCamposFaltantes(g, e, n, list);
                    if (listRest.Count > 0)
                    {
                        list.AddRange(listRest);
                    }

                    if (list.Count > 0)
                    {
                        List <Campos> ListPadresipad = new List <Campos>();
                        ListPadresipad = obtenerPadres(list2, list, ListPadresipad);
                        if (ListPadresipad.Count > 0)
                        {
                            list.AddRange(ListPadresipad);
                        }
                    }

                    //verificamos si alguno de los campos depende de otro , en tal caso debemos mostrar el campo del cuel depende
                    List <Campos> lstDependientes = new List <Campos>();
                    Campos        CampDep;

                    foreach (Campos item in list)
                    {
                        if ((gd.Campos.Where(c => c.CampDependiente == item.CampId).Count() > 0))
                        {
                            CampDep = gd.Campos.Where(c => c.CampDependiente == item.CampId).First();
                            if (!(list.Any(k => k.CampId == CampDep.CampId)))
                            {
                                lstDependientes.Add(gd.Campos.Where(c => c.CampDependiente == item.CampId).First());
                            }
                        }
                    }

                    list.AddRange(lstDependientes);

                    //valida si existe captura para una grilla
                    if (list.Count == 0)
                    {
                        List <Captura> ListGrillas = (from c in this.gd.Campos
                                                      join cap in this.gd.Captura on c.CampId equals cap.CampId
                                                      where (c.GDocId == g.GDocId) & (c.ControlCalidad == true) & (c.CampNumCaptura2 == true) & (cap.NegId == n.NegId) & (cap.NumCaptura == 2)
                                                      select cap).ToList <Captura>();
                        if (ListGrillas.Count > 0)
                        {
                            Campos camp = new Campos();
                            camp.Activo          = false;
                            camp.CampDescripcion = "";
                            list.Add(camp);
                        }
                    }

                    list = list.OrderBy(o => o.CampOrden).ToList();
                }
                else if (e.IdEtapa == 4)
                {
                    list = (from c in this.gd.Campos
                            where (c.GDocId == g.GDocId) & (c.CampNumCaptura == 4) & (c.Activo == true)
                            select c).ToList <Campos>();
                }
                list4 = list;
            }
            catch (Exception exception)
            {
                LogRepository.registro("Error en CamposController metodo ObtenerCamposCliente " + exception.Message + " stack trace " + exception.StackTrace);
                throw exception;
            }
            //Session["TOTAL_CAMPOS"] = list4.Count;
            //SessionRepository.setAtributo("TOTAL_CAMP",list4.Count);
            return(list4);
        }