Example #1
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Tipo_Movimiento,
                                    string Nombre,
                                    string Servicio,
                                    string Direccion)
        {
            List <object> listaMovimiento = new List <object>();
            object        respuesta       = null;

            try
            {
                var movimiento = from omovimiento in db.Movimiento
                                 join operador in db.Operador
                                 on omovimiento.Id_Operador equals operador.Id
                                 join servicio in db.Servicio
                                 on omovimiento.Id_Servicio equals servicio.Id
                                 where omovimiento.Activo == 1 && omovimiento.Id_LineaNegocio == lineaNegocio &&
                                 operador.Activo == 1 && operador.Id_LineaNegocio == lineaNegocio &&
                                 servicio.Activo == 1 && servicio.Id_LineaNegocio == lineaNegocio

                                 && DbFiltro.String(omovimiento.Tipo_Movimiento, Tipo_Movimiento) &&
                                 DbFiltro.String(operador.Nombre, Nombre) &&
                                 DbFiltro.String(servicio.Servicio1, Servicio) &&
                                 DbFiltro.String(omovimiento.Direccion, Direccion)

                                 select new
                {
                    omovimiento.Id,
                    omovimiento.Direccion,
                    operador.Nombre,
                    omovimiento.Id_Operador,
                    omovimiento.Id_Servicio,
                    omovimiento.Tipo_Movimiento,
                    servicio.Servicio1
                };

                foreach (var elemento in movimiento)
                {
                    listaMovimiento.Add(new
                    {
                        Id              = elemento.Id,
                        Direccion       = elemento.Direccion,
                        Id_Operador     = elemento.Id_Operador,
                        Id_Servicio     = elemento.Id_Servicio,
                        Tipo_Movimiento = elemento.Tipo_Movimiento,
                        Nombre          = elemento.Nombre,
                        Servicio        = elemento.Servicio1
                    });
                }
                respuesta = new { success = true,
                                  results = listaMovimiento.Skip(start).Take(limit).ToList(),
                                  total   = listaMovimiento.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult LlenaGrid(int lineaNegocio, int start, int limit, string Mes_ConsumoFormato,
                                    string Moneda_Origen,
                                    string TC_MXN,
                                    string TC_USD,
                                    string TC_CORPORATIVO)
        {
            List <object> listaTCCierre = new List <object>();
            object        respuesta     = null;

            try {
                var tccierre = from elemento in db.TC_Cierre
                               join moneda in db.Moneda
                               on elemento.Id_Moneda equals moneda.Id
                               where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio &&
                               moneda.Activo == 1 && moneda.Id_LineaNegocio == lineaNegocio

                               && DbFiltro.Date(elemento.Mes_Consumo, Mes_ConsumoFormato, "am") &&
                               DbFiltro.String(moneda.Moneda1, Moneda_Origen) &&
                               DbFiltro.Decimal(elemento.TC_MXN, TC_MXN) &&
                               DbFiltro.Decimal(elemento.TC_USD, TC_USD) &&
                               DbFiltro.Decimal(elemento.TC_CORPORATIVO, TC_CORPORATIVO)

                               select new
                {
                    elemento.Id,
                    elemento.Mes_Consumo,
                    moneda.Moneda1,
                    elemento.TC_MXN,
                    elemento.TC_USD,
                    elemento.TC_CORPORATIVO,
                    elemento.Sentido
                };

                foreach (var elemento in tccierre)
                {
                    listaTCCierre.Add(new
                    {
                        elemento.Id,
                        elemento.Mes_Consumo,
                        Mes_ConsumoFormato = elemento.Mes_Consumo.ToString("yyyy MMMM", new CultureInfo("es-ES")).ToUpper(),
                        Moneda_Origen      = elemento.Moneda1,
                        elemento.TC_MXN,
                        elemento.TC_USD,
                        elemento.TC_CORPORATIVO,
                        elemento.Sentido
                    });
                }
                respuesta = new { success = true,
                                  results = listaTCCierre.Skip(start).Take(limit).ToList(),
                                  total   = listaTCCierre.Count };
            } catch (Exception ex) {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Id_TraficoTR,
                                    string Sentido,
                                    string Descripcion,
                                    string Servicio)
        {
            List <object> listaTrafico = new List <object>();
            object        respuesta    = null;

            try
            {
                var trafico = from elemento in db.Trafico
                              join oServicio in db.Servicio
                              on elemento.Id_ServicioTR equals oServicio.Id
                              where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio &&
                              oServicio.Activo == 1 && oServicio.Id_LineaNegocio == lineaNegocio

                              && DbFiltro.String(elemento.Id_TraficoTR, Id_TraficoTR) &&
                              DbFiltro.String(elemento.Sentido, Sentido) &&
                              DbFiltro.String(elemento.Descripcion, Descripcion) &&
                              DbFiltro.String(oServicio.Servicio1, Servicio)

                              select new
                {
                    oServicio.Id_Servicio,
                    elemento.Sentido,
                    elemento.Descripcion,
                    elemento.Id_TraficoTR,
                    elemento.Id,
                    oServicio.Servicio1
                };

                foreach (var elemento in trafico)
                {
                    listaTrafico.Add(new
                    {
                        Id_TraficoTR = elemento.Id_TraficoTR,
                        Sentido      = elemento.Sentido,
                        Descripcion  = elemento.Descripcion,
                        Id_Servicio  = elemento.Id_Servicio,
                        Id           = elemento.Id,
                        Servicio     = elemento.Servicio1
                    });
                }

                respuesta = new { success = true,
                                  results = listaTrafico.Skip(start).Take(limit).ToList(),
                                  total   = listaTrafico.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }

            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Sentido,
                                    string TraficoDescripcion,
                                    string Cuenta,
                                    string Codigo_Material,
                                    string Material)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;
            int           total     = 0;

            try {
                var cuenta = from elemento in db.CuentaResultado
                             join trafico in db.Trafico
                             on elemento.Trafico_Id equals trafico.Id
                             where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                             && DbFiltro.String(elemento.Sentido, Sentido) &&
                             DbFiltro.String(elemento.TraficoDescripcion, TraficoDescripcion) &&
                             DbFiltro.String(elemento.Cuenta, Cuenta) &&
                             DbFiltro.String(elemento.Codigo_Material, Codigo_Material) &&
                             DbFiltro.String(elemento.Material, Material)

                             select new
                {
                    elemento.Id,
                    elemento.Sentido,
                    elemento.Trafico_Id,
                    trafico.Descripcion,
                    elemento.Cuenta,
                    elemento.Codigo_Material,
                    elemento.Material
                };

                foreach (var elemento in cuenta)
                {
                    lista.Add(new
                    {
                        Id                 = elemento.Id,
                        Sentido            = elemento.Sentido,
                        Trafico_Id         = elemento.Trafico_Id,
                        TraficoDescripcion = elemento.Descripcion,
                        //TraficoDescripcion = db.Trafico.Where(x => x.Id == elemento.Trafico_Id).SingleOrDefault().Descripcion,
                        Cuenta          = elemento.Cuenta,
                        Codigo_Material = elemento.Codigo_Material,
                        Material        = elemento.Material
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total = total };
            } catch (Exception ex) {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Id_Sociedad,
                                    string Abreviatura,
                                    string Nombre,
                                    string Id_SAP,
                                    string Sociedad_SAP)
        {
            List <object> listaSociedad = new List <object>();
            object        respuesta     = null;
            int           total         = 0;

            try
            {
                var sociedad = from elemento in db.Sociedad
                               where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                               && DbFiltro.String(elemento.Id_Sociedad, Id_Sociedad) &&
                               DbFiltro.String(elemento.AbreviaturaSociedad, Abreviatura) &&
                               DbFiltro.String(elemento.NombreSociedad, Nombre) &&
                               DbFiltro.String(elemento.Id_SAP, Id_SAP) &&
                               DbFiltro.String(elemento.Sociedad_SAP, Sociedad_SAP)

                               select new
                {
                    elemento.Id,
                    elemento.Id_Sociedad,
                    elemento.AbreviaturaSociedad,
                    elemento.NombreSociedad,
                    elemento.Id_SAP,
                    elemento.Sociedad_SAP
                };

                foreach (var elemento in sociedad)
                {
                    listaSociedad.Add(new
                    {
                        Id_Sociedad  = elemento.Id_Sociedad,
                        Abreviatura  = elemento.AbreviaturaSociedad,
                        Nombre       = elemento.NombreSociedad,
                        Id_SAP       = elemento.Id_SAP,
                        Sociedad_SAP = elemento.Sociedad_SAP,
                        Id           = elemento.Id
                    });
                }
                total         = listaSociedad.Count();
                listaSociedad = listaSociedad.Skip(start).Take(limit).ToList();
                respuesta     = new { success = true,
                                      results = listaSociedad.Skip(start).Take(limit).ToList(),
                                      total   = listaSociedad.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Nombre,
                                    string TraficoDescripcion,
                                    string Concepto1)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;
            int           total     = 0;

            try {
                var concepto = from elemento in db.Concepto
                               join operador in db.Operador
                               on elemento.Operador_Id equals operador.Id
                               join trafico in db.Trafico
                               on elemento.Trafico_Id equals trafico.Id
                               where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                               && DbFiltro.String(operador.Nombre, Nombre) &&
                               DbFiltro.String(elemento.TraficoDescripcion, TraficoDescripcion) &&
                               DbFiltro.String(elemento.Concepto1, Concepto1)

                               select new
                {
                    elemento.Id,
                    elemento.Operador_Id,
                    operador.Nombre,
                    //operador.Id_Operador,
                    elemento.Trafico_Id,
                    trafico.Descripcion,
                    elemento.Concepto1,
                };

                foreach (var elemento in concepto)
                {
                    lista.Add(new
                    {
                        Id                 = elemento.Id,
                        Operador_Id        = elemento.Operador_Id,
                        Nombre             = elemento.Nombre,
                        Trafico_Id         = elemento.Trafico_Id,
                        TraficoDescripcion = elemento.Descripcion,
                        //TraficoDescripcion = db.Trafico.Where(x => x.Id == elemento.Trafico_Id).SingleOrDefault().Descripcion,
                        Concepto1 = elemento.Concepto1
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total = total };
            } catch (Exception ex) {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string TraficoDescripcion,
                                    string CC,
                                    string Area_Funcional)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;
            int           total     = 0;

            try {
                using (db)
                {
                    var centrocosto = from elemento in db.CentroCosto
                                      join trafico in db.Trafico
                                      on elemento.Trafico_Id equals trafico.Id
                                      where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                                      && DbFiltro.String(elemento.TraficoDescripcion, TraficoDescripcion) &&
                                      DbFiltro.String(elemento.CC, CC) &&
                                      DbFiltro.String(elemento.Area_Funcional, Area_Funcional)

                                      select new
                    {
                        elemento.Id,
                        elemento.Trafico_Id,
                        trafico.Descripcion,
                        elemento.CC,
                        elemento.Area_Funcional
                    };

                    foreach (var elemento in centrocosto)
                    {
                        lista.Add(new
                        {
                            Id                 = elemento.Id,
                            Trafico_Id         = elemento.Trafico_Id,
                            TraficoDescripcion = elemento.Descripcion,
                            //TraficoDescripcion = db.Trafico.Where(x => x.Id == elemento.Trafico_Id).SingleOrDefault().Descripcion,
                            CC             = elemento.CC,
                            Area_Funcional = elemento.Area_Funcional
                        });
                    }
                }

                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total = total };
            } catch (Exception ex) {
                respuesta = new { success = true, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Sentido,
                                    string Nivel,
                                    string Etiqueta,
                                    string Utilizacion)
        {
            List <object> listaAgrupacion = new List <object>();
            object        respuesta       = null;

            try
            {
                var agrupacion = from elemento in db.Agrupacion
                                 where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                                 && DbFiltro.String(elemento.Sentido, Sentido) &&
                                 DbFiltro.Decimal(elemento.Nivel, Nivel) &&
                                 DbFiltro.String(elemento.Etiqueta, Etiqueta) &&
                                 DbFiltro.String(elemento.Utilizacion, Utilizacion)

                                 select new
                {
                    elemento.Id,
                    elemento.Sentido,
                    elemento.Nivel,
                    elemento.Etiqueta,
                    elemento.Utilizacion
                };

                foreach (var elemento in agrupacion)
                {
                    listaAgrupacion.Add(new
                    {
                        Id          = elemento.Id,
                        Sentido     = elemento.Sentido,
                        Nivel       = elemento.Nivel,
                        Etiqueta    = elemento.Etiqueta,
                        Utilizacion = elemento.Utilizacion
                    });
                }
                respuesta = new
                {
                    success = true,
                    results = listaAgrupacion.Skip(start).Take(limit).ToList(),
                    total   = listaAgrupacion.Count()
                };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #9
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Id_Servicio,
                                    string Servicio,
                                    string Orden)
        {
            List <object> listaServicio = new List <object>();
            object        respuesta     = null;
            int           total         = 0;

            try
            {
                var servicio = from elemento in db.Servicio
                               where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                               && DbFiltro.String(elemento.Id_Servicio, Id_Servicio) &&
                               DbFiltro.String(elemento.Servicio1, Servicio) &&
                               DbFiltro.Int(elemento.Orden, Orden)

                               select new
                {
                    elemento.Id_Servicio,
                    elemento.Servicio1,
                    elemento.Orden,
                    elemento.Activo,
                    elemento.Id
                };

                foreach (var elemento in servicio)
                {
                    listaServicio.Add(new
                    {
                        Id_Servicio = elemento.Id_Servicio,
                        Servicio    = elemento.Servicio1,
                        Orden       = elemento.Orden,
                        Id          = elemento.Id
                                      //Activo = elemento.Activo
                    });
                }
                total         = listaServicio.Count();
                listaServicio = listaServicio.Skip(start).Take(limit).ToList();
                respuesta     = new { success = true,
                                      results = listaServicio.Skip(start).Take(limit).ToList(),
                                      total   = listaServicio.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #10
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Empresa_Id,
                                    string Abreviatura,
                                    string Nombre)
        {
            List <object> listaEmpresa = new List <object>();
            object        respuesta    = null;
            int           total;

            try
            {
                var empresa = from elemento in db.EmpresaIC
                              where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                              && DbFiltro.String(elemento.Id_Empresa, Empresa_Id) &&
                              DbFiltro.String(elemento.Abreviatura, Abreviatura) &&
                              DbFiltro.String(elemento.Nombre_Empresa, Nombre)

                              select new
                {
                    elemento.Id_Empresa,
                    elemento.Id,
                    elemento.Abreviatura,
                    elemento.Nombre_Empresa
                };

                foreach (var elemento in empresa)
                {
                    listaEmpresa.Add(new
                    {
                        Empresa_Id  = elemento.Id_Empresa,
                        id_control  = elemento.Id,
                        Abreviatura = elemento.Abreviatura,
                        Nombre      = elemento.Nombre_Empresa
                    });
                }
                total        = listaEmpresa.Count();
                listaEmpresa = listaEmpresa.Skip(start).Take(limit).ToList();
                respuesta    = new { success = true, results = listaEmpresa, total = total };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Acreedor,
                                    string Nombre)
        {
            List <object> listaAcreedor = new List <object>();
            object        respuesta     = null;
            int           total         = 0;

            try
            {
                var acreedor = from elemento in db.Acreedor
                               where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                               && DbFiltro.String(elemento.Acreedor1, Acreedor) &&
                               DbFiltro.String(elemento.NombreAcreedor, Nombre)

                               select new
                {
                    elemento.Acreedor1,
                    elemento.NombreAcreedor,
                    elemento.Id
                };

                foreach (var elemento in acreedor)
                {
                    listaAcreedor.Add(new
                    {
                        Acreedor = elemento.Acreedor1,
                        Nombre   = elemento.NombreAcreedor,
                        Id       = elemento.Id
                    });
                }

                respuesta = new { success = true,
                                  results = listaAcreedor.Skip(start).Take(limit).ToList(),
                                  total   = listaAcreedor.Count() };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message, total = total };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #12
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Moneda1,
                                    string Descripcion)
        {
            List <object> listaMoneda = new List <object>();
            object        respuesta   = null;

            try
            {
                var moneda = from elemento in db.Moneda
                             where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                             && DbFiltro.String(elemento.Moneda1, Moneda1) &&
                             DbFiltro.String(elemento.Descripcion, Descripcion)

                             select new
                {
                    elemento.Id,
                    elemento.Moneda1,
                    elemento.Descripcion
                };

                foreach (var elemento in moneda)
                {
                    listaMoneda.Add(new
                    {
                        Id          = elemento.Id,
                        Moneda1     = elemento.Moneda1,
                        Descripcion = elemento.Descripcion
                    });
                }
                respuesta = new { success = true,
                                  results = listaMoneda.Skip(start).Take(limit).ToList(),
                                  total   = listaMoneda.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int start, int limit, string Id, string Nombre)
        {
            object respuesta = null;

            try
            {
                List <object> lista    = new List <object>();
                var           consulta = from oPer in db.Perfil
                                         where oPer.Activo == true &&
                                         DbFiltro.Int(oPer.Id, Id) &&
                                         DbFiltro.String(oPer.Nombre, Nombre)

                                         select new
                {
                    oPer.Id,
                    oPer.Nombre
                };
                foreach (var item in consulta)
                {
                    lista.Add(new
                    {
                        Id     = item.Id,
                        Nombre = item.Nombre
                    });
                }

                respuesta = new
                {
                    success = true,
                    results = lista.Skip(start).Take(limit).ToList(),
                    total   = lista.Count
                };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Id_Acuerdo,
                                    string Nombre,
                                    string Grupo)
        {
            List <object> listaAcuerdoGrupo = new List <object>();
            object        respuesta         = null;
            int           total             = 0;

            try
            {
                var acuerdoGrupo = from oacuerdoGrupo in db.Acuerdo_Grupo
                                   join grupo in db.Grupo
                                   on oacuerdoGrupo.Id_Grupo equals grupo.Id
                                   join acuerdoTarifa in db.AcuerdoTarifa
                                   on oacuerdoGrupo.Id_Acuerdo equals acuerdoTarifa.IdAcuerdo
                                   join operador in db.Operador
                                   on oacuerdoGrupo.Id_Operador equals operador.Id
                                   where oacuerdoGrupo.Activo == 1 && oacuerdoGrupo.Id_LineaNegocio == lineaNegocio &&
                                   acuerdoTarifa.Activo == 1 && acuerdoTarifa.Id_LineaNegocio == lineaNegocio &&
                                   grupo.Activo == 1 && grupo.Id_LineaNegocio == lineaNegocio &&
                                   operador.Activo == 1 && operador.Id_LineaNegocio == lineaNegocio

                                   && DbFiltro.String(acuerdoTarifa.Id_Acuerdo, Id_Acuerdo) &&
                                   DbFiltro.String(operador.Nombre, Nombre) &&
                                   DbFiltro.String(grupo.Grupo1, Grupo)

                                   select new
                {
                    oacuerdoGrupo.Id,
                    acuerdoTarifa.IdAcuerdo,
                    acuerdoTarifa.Id_Acuerdo,
                    operador.Nombre,
                    grupo.Grupo1,
                    grupo.DescripcionGrupo,
                    oacuerdoGrupo.Id_Operador,
                    oacuerdoGrupo.Id_Grupo
                };

                foreach (var elemento in acuerdoGrupo)
                {
                    listaAcuerdoGrupo.Add(new
                    {
                        Id          = elemento.Id,
                        Id_Acuerdo  = elemento.Id_Acuerdo,
                        IdAcuerdo   = elemento.IdAcuerdo,
                        Id_Operador = elemento.Id_Operador,
                        Nombre      = elemento.Nombre,
                        Grupo       = elemento.DescripcionGrupo,
                        Id_Grupo    = elemento.Id_Grupo
                    });
                }
                total             = listaAcuerdoGrupo.Count();
                listaAcuerdoGrupo = listaAcuerdoGrupo.Skip(start).Take(limit).ToList();
                respuesta         = new { success = true, results = listaAcuerdoGrupo, total = total };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #15
0
        public JsonResult llenaGrid(int start, int limit, string id, string IdUsuario, string Nombres, string ApellidoPaterno, string ApellidoMaterno,
                                    string NPerfil, string NLinea, string FechaCreacion, string FechaModificacion, string paginaInicio)
        {
            List <object> lstUsuarios = new List <object>();
            object        respuesta   = null;

            try
            {
                var usuario = from usu in db.usuarios
                              join per in db.Perfil on usu.IdPerfil equals per.Id
                              join cat in db.cat_TipoLinea on usu.IdLineaNegocio equals cat.Id
                              join men in db.MenuIC on usu.PaginaInicio equals men.Id
                              where per.Activo == true && usu.Activo == true &&
                              DbFiltro.Int(usu.Id, id) &&
                              DbFiltro.String(usu.IdUsuario, IdUsuario) &&
                              DbFiltro.String(usu.Nombre, Nombres) &&
                              DbFiltro.String(usu.APaterno, ApellidoPaterno) &&
                              DbFiltro.String(usu.AMaterno, ApellidoMaterno) &&
                              DbFiltro.String(per.Nombre, NPerfil) &&
                              DbFiltro.String(cat.nombre, NLinea) &&
                              DbFiltro.Date(usu.FechaCreacion, FechaCreacion, null) &&
                              DbFiltro.Date(usu.FechaModificacion, FechaModificacion, null) &&
                              DbFiltro.String(men.Descripcion, paginaInicio)
                              select new
                {
                    usu.Id,
                    usu.IdUsuario,
                    usu.Nombre,
                    usu.APaterno,
                    usu.AMaterno,
                    NombrePerfil = per.Nombre,
                    IdPerfil     = per.Id,
                    NombreLinea  = cat.nombre,
                    IdRegLinea   = cat.Id,
                    usu.FechaCreacion,
                    usu.FechaModificacion,
                    men.Descripcion,
                    IdMenu = men.Id
                };

                foreach (var elemento in usuario)
                {
                    lstUsuarios.Add(new
                    {
                        Id                = elemento.Id,
                        IdUsuario         = elemento.IdUsuario,
                        Nombres           = elemento.Nombre,
                        ApellidoPaterno   = elemento.APaterno,
                        ApellidoMaterno   = elemento.AMaterno,
                        NPerfil           = elemento.NombrePerfil,
                        IdPerfil          = elemento.IdPerfil,
                        NLinea            = elemento.NombreLinea,
                        IdRegLinea        = elemento.IdRegLinea,
                        FechaCreacion     = elemento.FechaCreacion.ToString("dd-MM-yyyy"),
                        FechaModificacion = elemento.FechaModificacion.ToString("dd-MM-yyyy"),
                        paginaInicio      = elemento.Descripcion,
                        IdMenu            = elemento.IdMenu
                    });
                }


                respuesta = new
                {
                    success = true,
                    results = lstUsuarios.Skip(start).Take(limit).ToList(),
                    total   = lstUsuarios.Count
                };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }

            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult LlenaGrid(DateTime periodo, string trafico, string deudor, int start, int limit, string fecha_contable,
                                    string fecha_proceso,
                                    string Month,
                                    string Movimiento,
                                    string Currency,
                                    string Servicio,
                                    string grupo,
                                    string Operador,
                                    string DeudorCol,
                                    string TraficoCol,
                                    string Segundos,
                                    string MinFact,
                                    string TarifaEXT,
                                    string Llamadas,
                                    string cantidad,
                                    string Importe_Ingreso,
                                    string no_factura_referencia,
                                    string monto_facturado)
        {
            object        respuesta = null;
            List <object> lista     = new List <object>();
            int           total     = 0;

            try {
                var ingresos = from ingreso in db.DataIngresoLDI
                               join Mov in db.Movimiento
                               on ingreso.id_movimiento equals Mov.Id into gjmv
                               join moneda in db.Moneda
                               on ingreso.id_moneda equals moneda.Id into gjmn
                               join servicio in db.Servicio
                               on ingreso.id_servicio equals servicio.Id into gjsv
                               join grp in db.Grupo
                               on ingreso.id_grupo equals grp.Id into gjgr
                               join operador in db.Operador
                               on ingreso.id_operador equals operador.Id into gjop
                               join deudorDB in db.Deudor
                               on ingreso.id_deudor equals deudorDB.Id into gjdd
                               join traficoTb in db.Trafico
                               on ingreso.id_trafico equals traficoTb.Id into gjtf
                               from submovimiento in gjmv.DefaultIfEmpty()
                               from submoneda in gjmn.DefaultIfEmpty()
                               from subservicio in gjsv.DefaultIfEmpty()
                               from subgrupo in gjgr.DefaultIfEmpty()
                               from suboperador in gjop.DefaultIfEmpty()
                               from subdeudor in gjdd.DefaultIfEmpty()
                               from subtrafico in gjtf.DefaultIfEmpty()
                               where
                               DbFiltro.Date(ingreso.fecha_contable, fecha_contable, "dma") &&
                               DbFiltro.Date(ingreso.fecha_proceso, fecha_proceso, "dma") &&
                               DbFiltro.Date(ingreso.mes, Month, "am") &&
                               DbFiltro.String(submovimiento.Tipo_Movimiento, Movimiento) &&
                               DbFiltro.String(submoneda.Moneda1, Currency) &&
                               DbFiltro.String(subservicio.Servicio1, Servicio) &&
                               DbFiltro.String(subgrupo.Grupo1, grupo) &&
                               DbFiltro.String(suboperador.Nombre, Operador) &&
                               DbFiltro.String(subdeudor.Deudor1, DeudorCol) &&
                               DbFiltro.String(subtrafico.Id_TraficoTR, TraficoCol) &&
                               DbFiltro.String(ingreso.no_factura_referencia, no_factura_referencia) &&
                               DbFiltro.Decimal(ingreso.segundos, Segundos) &&
                               DbFiltro.Decimal(ingreso.min_fact, MinFact) &&
                               DbFiltro.Decimal(ingreso.tarifa_ext, TarifaEXT) &&
                               DbFiltro.Decimal(ingreso.llamadas, Llamadas) &&
                               DbFiltro.Decimal(ingreso.cantidad, cantidad) &&
                               DbFiltro.Decimal(ingreso.importe_ingreso, Importe_Ingreso) &&
                               DbFiltro.Decimal(ingreso.monto_facturado, monto_facturado)

                               select new
                {
                    ingreso.id,
                    ingreso.mes,
                    ingreso.id_moneda,
                    ingreso.id_servicio,
                    ingreso.id_grupo,
                    Moneda1 = submoneda.Moneda1 ?? String.Empty,
                    ingreso.id_movimiento,
                    Tipo_Movimiento = submovimiento.Tipo_Movimiento ?? String.Empty,
                    Servicio1       = subservicio.Servicio1 ?? String.Empty,
                    Grupo1          = subgrupo.Grupo1 ?? String.Empty,
                    ingreso.id_operador,
                    Nombre       = suboperador.Nombre ?? String.Empty,
                    Id_TraficoTR = subtrafico.Id_TraficoTR ?? String.Empty,
                    ingreso.id_trafico,
                    ingreso.segundos,
                    ingreso.llamadas,
                    ingreso.importe_ingreso,
                    ingreso.tarifa_ext,
                    Deudor1 = subdeudor.Deudor1 ?? String.Empty,
                    ingreso.min_fact,
                    ingreso.cantidad,
                    ingreso.fecha_contable,
                    ingreso.fecha_proceso,
                    ingreso.no_factura_referencia,
                    ingreso.monto_facturado,
                    ingreso.iva,
                    ingreso.sobrecargo
                };

                if (!string.IsNullOrEmpty(trafico) && !string.IsNullOrEmpty(deudor))
                {
                    ingresos = ingresos.Where(i => i.Id_TraficoTR == trafico && i.Deudor1 == deudor);
                }
                else if (!string.IsNullOrEmpty(trafico))
                {
                    ingresos = ingresos.Where(i => i.Id_TraficoTR == trafico);
                }
                else if (!string.IsNullOrEmpty(deudor))
                {
                    ingresos = ingresos.Where(i => i.Deudor1 == deudor);
                }
                foreach (var elemento in ingresos)
                {
                    lista.Add(new
                    {
                        Id              = elemento.id,
                        Month           = elemento.mes.Value.Year + " " + meses[elemento.mes.Value.Month],
                        Currency        = elemento.Moneda1,
                        Servicio        = elemento.Servicio1,
                        grupo           = elemento.Grupo1,
                        Operador        = elemento.Nombre,
                        Trafico         = elemento.Id_TraficoTR,
                        Segundos        = elemento.segundos,
                        Llamadas        = elemento.llamadas,
                        Importe_Ingreso = elemento.importe_ingreso,
                        TarifaEXT       = elemento.tarifa_ext,
                        Deudor          = elemento.Deudor1,
                        MinFact         = elemento.min_fact,
                        elemento.cantidad,
                        Movimiento     = elemento.Tipo_Movimiento,
                        fecha_contable = elemento.fecha_proceso.Value.ToString("dd-MM-yyyy"),
                        fecha_proceso  = elemento.fecha_contable.Value.ToString("dd-MM-yyyy"),
                        elemento.no_factura_referencia,
                        elemento.monto_facturado,
                        elemento.iva,
                        elemento.sobrecargo
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { succes  = true,
                                  results = lista,
                                  start   = start,
                                  limit   = limit,
                                  total   = total };
            } catch (Exception ex) {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #17
0
        public JsonResult LlenaGrid(string servicio, int start, int limit, string Id_Documento,
                                    string activo,
                                    string caracterFinLinea,
                                    string caracterSeparador,
                                    string diaCorte,
                                    string horaCorte,
                                    string nombreArchivo,
                                    string nombreDocumento,
                                    string pathURL,
                                    string servicioCol)
        {
            List <object> listaParametros = new List <object>();
            object        respuesta       = null;

            try
            {
                var catDocCarg = from elemento in db.parametrosCargaDocumento
                                 where elemento.activo == 1 && elemento.servicio == servicio

                                 && DbFiltro.String(elemento.idDocumento, Id_Documento) &&
                                 DbFiltro.Int(elemento.activo, activo) &&
                                 DbFiltro.String(elemento.caracterFinLinea, caracterFinLinea) &&
                                 DbFiltro.String(elemento.caracterSeparador, caracterSeparador) &&
                                 DbFiltro.Int(elemento.diaCorte, diaCorte) &&
                                 DbFiltro.Int(elemento.horaCorte, horaCorte) &&
                                 DbFiltro.String(elemento.nombreArchivo, nombreArchivo) &&
                                 DbFiltro.String(elemento.nombreDocumento, nombreDocumento) &&
                                 DbFiltro.String(elemento.pathURL, pathURL) &&
                                 DbFiltro.String(elemento.servicio, servicioCol)

                                 select new
                {
                    elemento.Id,
                    elemento.idDocumento,
                    elemento.servicio,
                    elemento.nombreDocumento,
                    elemento.nombreArchivo,
                    elemento.pathURL,
                    elemento.diaCorte,
                    elemento.horaCorte,
                    elemento.caracterSeparador,
                    elemento.caracterFinLinea,
                    elemento.activo
                };

                foreach (var elemento in catDocCarg)
                {
                    listaParametros.Add(new
                    {
                        Id                = elemento.Id,
                        idDocumento       = elemento.idDocumento,
                        servicio          = elemento.servicio,
                        nombreDocumento   = elemento.nombreDocumento,
                        nombreArchivo     = elemento.nombreArchivo,
                        pathURL           = elemento.pathURL,
                        diaCorte          = elemento.diaCorte,
                        horaCorte         = elemento.horaCorte,
                        caracterSeparador = elemento.caracterSeparador,
                        caracterFinLinea  = elemento.caracterFinLinea,
                        activo            = elemento.activo
                    });
                }

                respuesta = new
                {
                    success = true,
                    results = listaParametros.Skip(start).Take(limit).ToList(),
                    total   = listaParametros.Count()
                };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message.ToString() };
            }

            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int?lineaNegocio, DateTime periodo, int start, int limit, string deudorAcreedor,
                                    string grupo,
                                    string importe,
                                    string mes_consumo,
                                    string moneda,
                                    string operador,
                                    string sentido,
                                    string servicio,
                                    string sociedad,
                                    string trafico)
        {
            object respuesta = null;

            if (periodo != null)
            {
                List <object> lista = new List <object>();
                int           total = 0;
                try {
                    var notacredito = from nc in db.NotaCredito
                                      join soc in db.Sociedad
                                      on nc.id_sociedad equals soc.Id
                                      join traf in db.Trafico
                                      on nc.id_trafico equals traf.Id
                                      join serv in db.Servicio
                                      on nc.id_servicio equals serv.Id
                                      join oper in db.Operador
                                      on nc.id_operador equals oper.Id
                                      join grp in db.Grupo
                                      on nc.id_grupo equals grp.Id
                                      join mon in db.Moneda
                                      on nc.id_moneda equals mon.Id
                                      where nc.activo == 1 && nc.id_lineaNegocio == lineaNegocio &&
                                      soc.Activo == 1 && soc.Id_LineaNegocio == lineaNegocio &&
                                      traf.Activo == 1 && traf.Id_LineaNegocio == lineaNegocio &&
                                      serv.Activo == 1 && serv.Id_LineaNegocio == lineaNegocio &&
                                      oper.Activo == 1 && oper.Id_LineaNegocio == lineaNegocio &&
                                      grp.Activo == 1 && grp.Id_LineaNegocio == lineaNegocio &&
                                      mon.Activo == 1 && mon.Id_LineaNegocio == lineaNegocio &&
                                      nc.periodo_carga.Year == periodo.Year &&
                                      nc.periodo_carga.Month == periodo.Month

                                      && DbFiltro.String(nc.deudorAcreedor, deudorAcreedor) &&
                                      DbFiltro.String(grp.Grupo1, grupo) &&
                                      DbFiltro.Decimal(nc.importe, importe) &&
                                      DbFiltro.Date(nc.mes_consumo, mes_consumo, "am") &&
                                      DbFiltro.String(mon.Moneda1, moneda) &&
                                      DbFiltro.String(oper.Razon_Social, operador) &&
                                      DbFiltro.String(nc.sentido, sentido) &&
                                      DbFiltro.String(serv.Servicio1, servicio) &&
                                      DbFiltro.String(soc.NombreSociedad, sociedad) &&
                                      DbFiltro.String(traf.Descripcion, trafico)

                                      select new
                    {
                        nc.id,
                        nc.sentido,
                        nc.id_sociedad,
                        soc.NombreSociedad,
                        nc.id_trafico,
                        traf.Descripcion,
                        nc.id_servicio,
                        serv.Servicio1,
                        nc.deudorAcreedor,
                        nc.id_operador,
                        oper.Razon_Social,
                        nc.id_grupo,
                        grp.Grupo1,
                        nc.importe,
                        nc.id_moneda,
                        mon.Moneda1,
                        nc.mes_consumo
                    };

                    foreach (var elemento in notacredito)
                    {
                        lista.Add(new
                        {
                            id               = elemento.id,
                            sentido          = elemento.sentido,
                            id_sociedad      = elemento.id_sociedad,
                            sociedad         = elemento.NombreSociedad,
                            id_trafico       = elemento.id_trafico,
                            trafico          = elemento.Descripcion,
                            id_servicio      = elemento.id_servicio,
                            servicio         = elemento.Servicio1,
                            deudorAcreedor   = elemento.deudorAcreedor,
                            id_operador      = elemento.id_operador,
                            operador         = elemento.Razon_Social,
                            id_grupo         = elemento.id_grupo,
                            grupo            = elemento.Grupo1,
                            importe          = elemento.importe.Value.ToString("C").Replace("$", ""),
                            id_moneda        = elemento.id_moneda,
                            moneda           = elemento.Moneda1,
                            mes_consumo_drop = elemento.mes_consumo,
                            mes_consumo      = elemento.mes_consumo.Day.ToString("00") + "-" + elemento.mes_consumo.Month.ToString("00") + "-" + elemento.mes_consumo.Year,
                        });
                    }
                    total     = lista.Count();
                    lista     = lista.Skip(start).Take(limit).ToList();
                    respuesta = new { success = true, total = total, results = lista };
                } catch (Exception e) {
                    respuesta = new { success = false, results = e.Message };
                }
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #19
0
        public JsonResult LlenaGrid(int?lineaNegocio, DateTime fechaInicial, DateTime fechaFinal, int start, int limit, string ano,
                                    string fechaContable,
                                    string fechaConsumo,
                                    string compania,
                                    string servicio,
                                    string grupo,
                                    string acreedor,
                                    string operador,
                                    string nombreOperador,
                                    string codigoMaterial,
                                    string trafico,
                                    string montoIva,
                                    string iva,
                                    string moneda,
                                    string minutos,
                                    string tarifa,
                                    string monto,
                                    string montoFacturado,
                                    string fechaFactura,
                                    string factura,
                                    string tipoCambio,
                                    string montoMXP,
                                    string cuentaContable,
                                    string claseDocumento,
                                    string claseDocumentoSAP,
                                    string numDocumentoPF)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;

            int total;

            try {
                var datos = from oDatos in db.documentosCosto
                            where oDatos.activo == 1 &&
                            oDatos.lineaNegocio == lineaNegocio &&
                            oDatos.fechaContable >= fechaInicial && oDatos.fechaContable <= fechaFinal

                            && DbFiltro.Date(oDatos.ano, ano, "am") &&
                            DbFiltro.Date(oDatos.fechaContable, fechaContable, "dma") &&
                            DbFiltro.Date(oDatos.fechaConsumo, fechaConsumo, "dma") &&
                            DbFiltro.String(oDatos.compania, compania) &&
                            DbFiltro.String(oDatos.servicio, servicio) &&
                            DbFiltro.String(oDatos.grupo, grupo) &&
                            DbFiltro.String(oDatos.acreedor, acreedor) &&
                            DbFiltro.String(oDatos.operador, operador) &&
                            DbFiltro.String(oDatos.nombreOperador, nombreOperador) &&
                            DbFiltro.String(oDatos.codigoMaterial, codigoMaterial) &&
                            DbFiltro.String(oDatos.trafico, trafico) &&
                            DbFiltro.Decimal(oDatos.montoIva, montoIva) &&
                            DbFiltro.Decimal(oDatos.iva, iva) &&
                            DbFiltro.String(oDatos.moneda, moneda) &&
                            DbFiltro.Decimal(oDatos.minutos, minutos) &&
                            DbFiltro.Decimal(oDatos.tarifa, tarifa) &&
                            DbFiltro.Decimal(oDatos.monto, monto) &&
                            DbFiltro.Decimal(oDatos.montoFacturado, montoFacturado) &&
                            DbFiltro.Date(oDatos.fechaFactura, fechaFactura, "dma") &&
                            DbFiltro.String(oDatos.factura, factura) &&
                            DbFiltro.Decimal(oDatos.tipoCambio, tipoCambio) &&
                            DbFiltro.Decimal(oDatos.montoMXP, montoMXP) &&
                            DbFiltro.String(oDatos.cuentaContable, cuentaContable) &&
                            DbFiltro.String(oDatos.claseDocumento, claseDocumento) &&
                            DbFiltro.String(oDatos.claseDocumentoSAP, claseDocumentoSAP) &&
                            DbFiltro.String(oDatos.numDocumentoPF, numDocumentoPF)

                            select new
                {
                    oDatos.Id,
                    oDatos.ano,
                    oDatos.fechaContable,
                    oDatos.fechaConsumo,
                    oDatos.idSociedad,
                    oDatos.compania,
                    oDatos.idServicio,
                    oDatos.servicio,
                    oDatos.idGrupo,
                    oDatos.grupo,
                    oDatos.idAcreedor,
                    oDatos.acreedor,
                    oDatos.idOperador,
                    oDatos.operador,
                    oDatos.nombreOperador,
                    oDatos.codigoMaterial,
                    oDatos.idTrafico,
                    oDatos.trafico,
                    oDatos.montoIva,
                    oDatos.iva,
                    oDatos.idMoneda,
                    oDatos.moneda,
                    oDatos.minutos,
                    oDatos.tarifa,
                    oDatos.monto,
                    oDatos.montoFacturado,
                    oDatos.fechaFactura,
                    oDatos.factura,
                    oDatos.tipoCambio,
                    oDatos.montoMXP,
                    oDatos.idCuentaResultado,
                    oDatos.cuentaContable,
                    oDatos.claseDocumento,
                    oDatos.claseDocumentoSAP,
                    oDatos.numDocumentoPF
                };

                foreach (var elemento in datos)
                {
                    lista.Add(new
                    {
                        elemento.Id,
                        ano            = elemento.ano.Year,
                        fechaContable  = elemento.fechaContable.Day.ToString("00") + "-" + elemento.fechaContable.Month.ToString("00") + "-" + +elemento.fechaContable.Year,
                        fechaContableR = elemento.fechaContable.Day.ToString("00") + "-" + elemento.fechaContable.Month.ToString("00") + "-" + elemento.fechaContable.Year,
                        fechaConsumo   = elemento.fechaConsumo.Day.ToString("00") + "-" + elemento.fechaConsumo.Month.ToString("00") + "-" + +elemento.fechaConsumo.Year,
                        fechaConsumoR  = elemento.fechaConsumo.Day.ToString("00") + "-" + elemento.fechaConsumo.Month.ToString("00") + "-" + elemento.fechaConsumo.Year,
                        elemento.idSociedad,
                        elemento.compania,
                        elemento.idServicio,
                        elemento.servicio,
                        elemento.idGrupo,
                        elemento.grupo,
                        elemento.idAcreedor,
                        elemento.acreedor,
                        elemento.idOperador,
                        elemento.operador,
                        elemento.nombreOperador,
                        elemento.codigoMaterial,
                        elemento.idTrafico,
                        elemento.trafico,
                        elemento.montoIva,
                        elemento.iva,
                        elemento.idMoneda,
                        elemento.moneda,
                        elemento.minutos,
                        elemento.tarifa,
                        elemento.monto,
                        elemento.montoFacturado,
                        fechaFactura  = elemento.fechaFactura.Day.ToString("00") + "-" + elemento.fechaFactura.Month.ToString("00") + "-" + +elemento.fechaFactura.Year,
                        fechaFacturaR = elemento.fechaFactura.Day.ToString("00") + "-" + elemento.fechaFactura.Month.ToString("00") + "-" + elemento.fechaFactura.Year,
                        elemento.factura,
                        elemento.tipoCambio,
                        elemento.montoMXP,
                        elemento.idCuentaResultado,
                        elemento.cuentaContable,
                        elemento.claseDocumento,
                        elemento.claseDocumentoSAP,
                        elemento.numDocumentoPF
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true,
                                  results = lista,
                                  total   = total };
            } catch (Exception e) {
                lista     = null;
                respuesta = new { success = false, results = e.Message };
            }

            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Consulta(DateTime Periodo, int start, int limit, string Franchise,
                                   string Direccion,
                                   string Billed_Product,
                                   string Rating_Component,
                                   string Billing_Operator,
                                   string Unit_Cost_User,
                                   string Month,
                                   string Calls,
                                   string Actual_Usage,
                                   string Charge_Usage,
                                   string Currency,
                                   string Amount,
                                   string Iva,
                                   string Trafico,
                                   string Sobrecargo)
        {
            object respuesta = null;
            int    total     = 0;

            try {
                List <object> lista = new List <object>();
                var           datos = from oDatos in db.DatosTraficoLDI
                                      join moneda in db.Moneda
                                      on oDatos.id_moneda equals moneda.Id into gjmn
                                      join operador in db.Operador
                                      on oDatos.Billing_Operator equals operador.Id into gjop
                                      join traficoTb in db.Trafico
                                      on oDatos.id_trafico equals traficoTb.Id into gjtf
                                      from submoneda in gjmn.DefaultIfEmpty()
                                      from suboperador in gjop.DefaultIfEmpty()
                                      from subtrafico in gjtf.DefaultIfEmpty()
                                      where oDatos.fecha_contable == Periodo

                                      && DbFiltro.Date(oDatos.Month, Month, "dma") &&
                                      DbFiltro.String(oDatos.Franchise, Franchise) &&
                                      DbFiltro.String(oDatos.Direccion, Direccion) &&
                                      DbFiltro.String(oDatos.Billed_Product, Billed_Product) &&
                                      DbFiltro.String(oDatos.Rating_Component, Rating_Component) &&
                                      DbFiltro.Decimal(oDatos.Unit_Cost_User, Unit_Cost_User) &&
                                      DbFiltro.Decimal(oDatos.Calls, Calls) &&
                                      DbFiltro.Decimal(oDatos.Actual_Usage, Actual_Usage) &&
                                      DbFiltro.Decimal(oDatos.Charge_Usage, Charge_Usage) &&
                                      DbFiltro.Decimal(oDatos.Amount, Amount) &&
                                      DbFiltro.Decimal(oDatos.Iva, Iva) &&
                                      DbFiltro.Decimal(oDatos.Sobrecargo, Sobrecargo) &&
                                      DbFiltro.String(subtrafico.Id_TraficoTR, Trafico) &&
                                      DbFiltro.String(suboperador.Id_Operador, Billing_Operator) &&
                                      DbFiltro.String(submoneda.Moneda1, Currency)

                                      select new
                {
                    oDatos.Franchise,
                    oDatos.Direccion,
                    oDatos.Billed_Product,
                    oDatos.Rating_Component,
                    Id_Operador = suboperador.Id_Operador ?? string.Empty,
                    oDatos.Unit_Cost_User,
                    oDatos.Month,
                    oDatos.Calls,
                    oDatos.Actual_Usage,
                    oDatos.Charge_Usage,
                    Moneda1 = submoneda.Moneda1 ?? string.Empty,
                    oDatos.Amount,
                    oDatos.Iva,
                    Id_TraficoTR = subtrafico.Id_TraficoTR ?? string.Empty,
                    oDatos.Sobrecargo
                };
                foreach (var elemento in datos)
                {
                    lista.Add(new
                    {
                        Franchise        = elemento.Franchise,
                        Direccion        = elemento.Direccion,
                        Billed_Product   = elemento.Billed_Product,
                        Rating_Component = elemento.Rating_Component,
                        Billing_Operator = elemento.Id_Operador,
                        Unit_Cost_User   = elemento.Unit_Cost_User,
                        Month            = elemento.Month.Value.ToString("dd-MM-yyyy"),
                        Calls            = elemento.Calls,
                        Actual_Usage     = elemento.Actual_Usage,
                        Charge_Usage     = elemento.Charge_Usage,
                        Currency         = elemento.Moneda1,
                        Amount           = elemento.Amount,
                        Iva        = elemento.Iva,
                        Trafico    = elemento.Id_TraficoTR,
                        Sobrecargo = elemento.Sobrecargo
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total = total };
            } catch (Exception e) {
                respuesta = new { success = false, results = e.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #21
0
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Descripcion,
                                    string DescripcionGrupo,
                                    string Fecha_Fin,
                                    string Fecha_Inicio,
                                    string Fee,
                                    string NombreSociedad,
                                    string Porcentaje,
                                    string Tarifa)
        {
            List <object> listaTarifa_Fee = new List <object>();
            object        respuesta       = null;

            try
            {
                var tarifa_fee = from elemento in db.Tarifa_Fee
                                 join oSociedad in db.Sociedad
                                 on elemento.Id_Sociedad equals oSociedad.Id
                                 join oGrupo in db.Grupo
                                 on elemento.Id_Grupo equals oGrupo.Id
                                 join oTrafico in db.Trafico
                                 on elemento.Id_Trafico equals oTrafico.Id
                                 where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio &&
                                 oSociedad.Activo == 1 && oGrupo.Activo == 1 && oTrafico.Activo == 1 &&
                                 oSociedad.Id_LineaNegocio == lineaNegocio && oGrupo.Id_LineaNegocio == lineaNegocio &&
                                 oTrafico.Id_LineaNegocio == lineaNegocio

                                 && DbFiltro.Date(elemento.Fecha_Fin, Fecha_Fin, "dma") &&
                                 DbFiltro.Date(elemento.Fecha_Inicio, Fecha_Inicio, "dma") &&
                                 DbFiltro.String(oTrafico.Descripcion, Descripcion) &&
                                 DbFiltro.String(oGrupo.DescripcionGrupo, DescripcionGrupo) &&
                                 DbFiltro.String(elemento.Fee, Fee) &&
                                 DbFiltro.String(oSociedad.NombreSociedad, NombreSociedad) &&
                                 DbFiltro.Decimal(elemento.Porcentaje, Porcentaje) &&
                                 DbFiltro.Decimal(elemento.Tarifa, Tarifa)

                                 select new
                {
                    elemento.Id,
                    elemento.Id_Sociedad,
                    oGrupo.Grupo1,
                    oTrafico.Id_TraficoTR,
                    elemento.Fee,
                    elemento.Fecha_Inicio,
                    elemento.Fecha_Fin,
                    elemento.Tarifa,
                    elemento.Porcentaje,
                    oGrupo.DescripcionGrupo,
                    oSociedad.NombreSociedad,
                    oTrafico.Descripcion,
                    elemento.Id_Trafico,
                    elemento.Id_Grupo
                    // oSociedad.Id_Sociedad as idSociedad
                };

                foreach (var elemento in tarifa_fee)
                {
                    listaTarifa_Fee.Add(new
                    {
                        Id               = elemento.Id,
                        Sociedad         = elemento.Id_Sociedad,
                        Grupo            = elemento.Grupo1,
                        Trafico          = elemento.Id_Trafico,
                        Fee              = elemento.Fee,
                        Fecha_Inicio     = elemento.Fecha_Inicio.Value.ToString("dd-MM-yyyy"),
                        Fecha_Fin        = elemento.Fecha_Fin.Value.ToString("dd-MM-yyyy"),
                        Tarifa           = elemento.Tarifa,
                        Porcentaje       = elemento.Porcentaje,
                        DescripcionGrupo = elemento.DescripcionGrupo,
                        NombreSociedad   = elemento.NombreSociedad,
                        Descripcion      = elemento.Descripcion,
                        Id_Grupo         = elemento.Id_Grupo
                    });
                }

                respuesta = new
                {
                    success = true,
                    results = listaTarifa_Fee.Skip(start).Take(limit).ToList(),
                    total   = listaTarifa_Fee.Count
                };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #22
0
        public JsonResult LlenaGrid(int lineaNegocio, int start, int limit, string Ambito,
                                    string Bundle,
                                    string Canal,
                                    string CodigoMaterial,
                                    string Cuenta,
                                    string DescripcionMaterial,
                                    string Nlicencia,
                                    string Producto,
                                    string Region,
                                    string SegmentoPA,
                                    string Sentido,
                                    string SubsegmentoPA,
                                    string Subtipolinea,
                                    string TraficoDescripcion)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;
            int           total     = 0;

            try {
                var cuenta = from elemento in db.CaracteristicasPA
                             where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                             && DbFiltro.String(elemento.Ambito, Ambito) &&
                             DbFiltro.String(elemento.Bundle, Bundle) &&
                             DbFiltro.String(elemento.Canal, Canal) &&
                             DbFiltro.String(elemento.CodigoMaterial, CodigoMaterial) &&
                             DbFiltro.String(elemento.Cuenta, Cuenta) &&
                             DbFiltro.String(elemento.DescripcionMaterial, DescripcionMaterial) &&
                             DbFiltro.String(elemento.Nlicencia, Nlicencia) &&
                             DbFiltro.String(elemento.Producto, Producto) &&
                             DbFiltro.String(elemento.Region, Region) &&
                             DbFiltro.String(elemento.SegmentoPA, SegmentoPA) &&
                             DbFiltro.String(elemento.Sentido, Sentido) &&
                             DbFiltro.String(elemento.SubsegmentoPA, SubsegmentoPA) &&
                             DbFiltro.String(elemento.Subtipolinea, Subtipolinea) &&
                             DbFiltro.String(elemento.TraficoDescripcion, TraficoDescripcion)

                             select new
                {
                    elemento.Id,
                    elemento.Sentido,
                    elemento.CodigoMaterial,
                    elemento.DescripcionMaterial,
                    elemento.Cuenta,
                    elemento.SubsegmentoPA,
                    elemento.SegmentoPA,
                    elemento.Producto,
                    elemento.Canal,
                    elemento.Bundle,
                    elemento.TraficoDescripcion,
                    elemento.Subtipolinea,
                    elemento.Nlicencia,
                    elemento.Region,
                    elemento.Ambito,
                };

                foreach (var elemento in cuenta)
                {
                    lista.Add(new
                    {
                        elemento.Id,
                        elemento.Sentido,
                        elemento.CodigoMaterial,
                        elemento.DescripcionMaterial,
                        elemento.Cuenta,
                        elemento.SubsegmentoPA,
                        elemento.SegmentoPA,
                        elemento.Producto,
                        elemento.Canal,
                        elemento.Bundle,
                        elemento.TraficoDescripcion,
                        elemento.Subtipolinea,
                        elemento.Nlicencia,
                        elemento.Region,
                        elemento.Ambito
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total };
            } catch (Exception ex) {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #23
0
        public JsonResult llenaGrid(int IdLineaNegocio, int start, int limit, string Sentido,
                                    string DescripcionTR,
                                    string ServicioDesc,
                                    string NombreSociedad,
                                    string DeudorAcreedor,
                                    string DescripcionGR,
                                    string Importe)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;

            try
            {
                var objecion = from objObjecion in db.Objecion
                               join oTrafico in db.Trafico
                               on objObjecion.Id_trafico equals oTrafico.Id
                               join oServicio in db.Servicio
                               on objObjecion.Id_servicio equals oServicio.Id
                               join oSociedad in db.Sociedad
                               on objObjecion.Id_Sociedad equals oSociedad.Id
                               join oGrupo in db.Grupo
                               on objObjecion.Id_Grupo equals oGrupo.Id
                               where objObjecion.Activo == 1 && objObjecion.Id_LineaNegocio == IdLineaNegocio &&
                               oTrafico.Activo == 1 && oTrafico.Id_LineaNegocio == IdLineaNegocio &&
                               oServicio.Activo == 1 && oServicio.Id_LineaNegocio == IdLineaNegocio &&
                               oSociedad.Activo == 1 && oSociedad.Id_LineaNegocio == IdLineaNegocio &&
                               oGrupo.Activo == 1 && oGrupo.Id_LineaNegocio == IdLineaNegocio

                               && DbFiltro.String(objObjecion.Sentido, Sentido) &&
                               DbFiltro.String(oTrafico.Descripcion, DescripcionTR) &&
                               DbFiltro.String(oServicio.Servicio1, ServicioDesc) &&
                               DbFiltro.String(oSociedad.NombreSociedad, NombreSociedad) &&
                               DbFiltro.String(objObjecion.Deudor_Acreedor, DeudorAcreedor) &&
                               DbFiltro.String(oGrupo.DescripcionGrupo, DescripcionGR) &&
                               DbFiltro.Decimal(objObjecion.Importe, Importe)

                               select new
                {
                    objObjecion.Sentido,
                    oTrafico.Id_TraficoTR,
                    oServicio.Id_Servicio,
                    oSociedad.Id_Sociedad,
                    objObjecion.Deudor_Acreedor,
                    oGrupo.Grupo1,
                    objObjecion.Importe,
                    objObjecion.id,
                    oTrafico.Descripcion,
                    oServicio.Servicio1,
                    oSociedad.NombreSociedad,
                    oGrupo.DescripcionGrupo
                };
                foreach (var elemento in objecion)
                {
                    lista.Add(new
                    {
                        Id             = elemento.id,
                        Sentido        = elemento.Sentido,
                        Trafico        = elemento.Id_TraficoTR,
                        Servicio       = elemento.Id_Servicio,
                        Sociedad       = elemento.Id_Sociedad,
                        DeudorAcreedor = elemento.Deudor_Acreedor,
                        Grupo          = elemento.Grupo1,
                        Importe        = elemento.Importe,
                        DescripcionTR  = elemento.Descripcion,
                        ServicioDesc   = elemento.Servicio1,
                        NombreSociedad = elemento.NombreSociedad,
                        DescripcionGR  = elemento.DescripcionGrupo
                    });
                }

                respuesta = new { success = true,
                                  results = lista.Skip(start).Take(limit).ToList(),
                                  total   = lista.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Costo,
                                    string DescripcionEntrada,
                                    string DescripcionSalida,
                                    string EntInferior,
                                    string EntSuperior,
                                    string FechaFin,
                                    string FechaInicio,
                                    string Ingreso,
                                    string Nombre,
                                    string Ratio,
                                    string SalInferior,
                                    string SalSuperior,
                                    string TarifaEnt,
                                    string TarifaSal)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;
            int           total     = 0;

            try
            {
                var acuerdo = from elemento in db.AcuerdoTarifa

                              join operador in db.Operador
                              on elemento.Id_Operador equals operador.Id into gjop
                              join traficoEnt in db.Trafico
                              on elemento.Id_TraficoEntrada equals traficoEnt.Id into gjte
                              join traficoSal in db.Trafico
                              on elemento.Id_TraficoSalida equals traficoSal.Id into gjts
                              from suboperador in gjop.DefaultIfEmpty()
                              from subtraficoEnt in gjte.DefaultIfEmpty()
                              from subtraficoSal in gjts.DefaultIfEmpty()
                              where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                              && DbFiltro.Decimal(elemento.Costo, Costo) &&
                              DbFiltro.String(subtraficoEnt.Descripcion, DescripcionEntrada) &&
                              DbFiltro.String(subtraficoSal.Descripcion, DescripcionSalida) &&
                              DbFiltro.Decimal(elemento.EntInferior, EntInferior) &&
                              DbFiltro.Decimal(elemento.EntSuperior, EntSuperior) &&
                              DbFiltro.Date(elemento.FechaFin, FechaFin, "dma") &&
                              DbFiltro.Date(elemento.FechaInicio, FechaInicio, "dma") &&
                              DbFiltro.Decimal(elemento.Ingreso, Ingreso) &&
                              DbFiltro.String(suboperador.Nombre, Nombre) &&
                              DbFiltro.Decimal(elemento.Ratio, Ratio) &&
                              DbFiltro.Decimal(elemento.SalInferior, SalInferior) &&
                              DbFiltro.Decimal(elemento.SalSuperior, SalSuperior) &&
                              DbFiltro.Decimal(elemento.TarifaEnt, TarifaEnt) &&
                              DbFiltro.Decimal(elemento.TarifaSal, TarifaSal)

                              select new
                {
                    elemento.IdAcuerdo,
                    elemento.Id_Acuerdo,
                    elemento.Id_Operador,
                    Nombre      = suboperador.Nombre ?? String.Empty,
                    EntInferior = elemento.EntInferior,
                    EntSuperior = elemento.EntSuperior,
                    TarifaEnt   = elemento.TarifaEnt,
                    Ingreso     = elemento.Ingreso,
                    SalInferior = elemento.SalInferior,
                    SalSuperior = elemento.SalSuperior,
                    TarifaSal   = elemento.TarifaSal,
                    Costo       = elemento.Costo,
                    Ratio       = elemento.Ratio,
                    elemento.FechaInicio,
                    elemento.FechaFin,
                    Id_TraficoEntrada = elemento.Id_TraficoEntrada,
                    Id_TraficoSalida  = elemento.Id_TraficoSalida,
                    descripcionEnt    = subtraficoEnt.Descripcion ?? String.Empty,
                    descripcionSal    = subtraficoSal.Descripcion ?? String.Empty
                };

                foreach (var elemento in acuerdo)
                {
                    lista.Add(new
                    {
                        Id                 = elemento.IdAcuerdo,
                        Id_Acuerdo         = elemento.Id_Acuerdo,
                        Id_Operador        = elemento.Id_Operador,
                        Nombre             = elemento.Nombre,
                        EntInferior        = elemento.EntInferior,
                        EntSuperior        = elemento.EntSuperior,
                        TarifaEnt          = elemento.TarifaEnt,
                        Ingreso            = elemento.Ingreso,
                        SalInferior        = elemento.SalInferior,
                        SalSuperior        = elemento.SalSuperior,
                        TarifaSal          = elemento.TarifaSal,
                        Costo              = elemento.Costo,
                        Ratio              = elemento.Ratio,
                        FechaInicio        = elemento.FechaInicio.Value.ToString("dd-MM-yyyy"),
                        FechaFin           = elemento.FechaFin.Value.ToString("dd-MM-yyyy"),
                        Id_TraficoEntrada  = elemento.Id_TraficoEntrada,
                        Id_TraficoSalida   = elemento.Id_TraficoSalida,
                        DescripcionEntrada = elemento.descripcionEnt,
                        DescripcionSalida  = elemento.descripcionSal
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total = total };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int lineaNegocio, int start, int limit, string Id_Operador,
                                    string Nombre,
                                    string Razon_Social,
                                    string DescripcionGrupo,
                                    string Acreedor,
                                    string Deudor,
                                    string RFC,
                                    string NombreSociedad,
                                    string Sociedad_GL,
                                    string Tipo_Operador)
        {
            List <object> listaOperador = new List <object>();
            object        respuesta     = null;
            int           total         = 0;

            try
            {
                var operador = from elemento in db.Operador
                               join grupo in db.Grupo
                               .Where(x => x.Activo == 1 && x.Id_LineaNegocio == lineaNegocio)
                               on elemento.Id_Grupo equals grupo.Id into lGrupo
                               from leftGrupo in  lGrupo.DefaultIfEmpty()
                               join deudor in db.Deudor
                               .Where(x => x.Activo == 1 && x.Id_LineaNegocio == lineaNegocio)
                               on elemento.Id_Deudor equals deudor.Id into lDeudor
                               from leftDeudor in lDeudor.DefaultIfEmpty()
                               join acreedor in db.Acreedor
                               .Where(x => x.Activo == 1 && x.Id_LineaNegocio == lineaNegocio)
                               on elemento.Id_Acreedor equals acreedor.Id into lAcreedor
                               from leftAcreedor in lAcreedor.DefaultIfEmpty()
                               join sociedad in db.Sociedad
                               on elemento.Id_Sociedad equals sociedad.Id
                               where elemento.Activo == 1 && elemento.Id_LineaNegocio == lineaNegocio

                               && DbFiltro.String(elemento.Id_Operador, Id_Operador) &&
                               DbFiltro.String(elemento.Nombre, Nombre) &&
                               DbFiltro.String(elemento.Razon_Social, Razon_Social) &&
                               DbFiltro.String(leftGrupo.DescripcionGrupo, DescripcionGrupo) &&
                               DbFiltro.String(leftAcreedor.Acreedor1, Acreedor) &&
                               DbFiltro.String(leftDeudor.Deudor1, Deudor) &&
                               DbFiltro.String(elemento.RFC, RFC) &&
                               DbFiltro.String(sociedad.NombreSociedad, NombreSociedad) &&
                               DbFiltro.String(elemento.Sociedad_GL, Sociedad_GL) &&
                               DbFiltro.String(elemento.Tipo_Operador, Tipo_Operador)

                               select new
                {
                    elemento.Id,
                    elemento.Id_Operador,
                    elemento.Nombre,
                    elemento.Razon_Social,
                    elemento.Id_Grupo,
                    elemento.Id_Deudor,
                    elemento.Id_Acreedor,
                    elemento.Id_Sociedad,
                    leftGrupo.Grupo1,
                    leftGrupo.DescripcionGrupo,
                    leftDeudor.Deudor1,
                    leftDeudor.NombreDeudor,
                    leftAcreedor.Acreedor1,
                    leftAcreedor.NombreAcreedor,
                    sociedad.NombreSociedad,
                    elemento.RFC,
                    elemento.Sociedad_GL,
                    elemento.Tipo_Operador
                };

                foreach (var elemento in operador)
                {
                    listaOperador.Add(new
                    {
                        Id_Operador      = elemento.Id_Operador,
                        Id               = elemento.Id,
                        Nombre           = elemento.Nombre,
                        Razon_Social     = elemento.Razon_Social,
                        Id_Grupo         = (elemento.Grupo1 != null && elemento.Grupo1 != "")? elemento.Id_Grupo:null,
                        Grupo            = elemento.Grupo1,
                        Deudor           = elemento.Deudor1,
                        NombreDeudor     = elemento.NombreDeudor,
                        NombreAcreedor   = elemento.NombreAcreedor,
                        Id_Deudor        = (elemento.Deudor1 != null && elemento.Deudor1 != "")? elemento.Id_Deudor:null,
                        Acreedor         = elemento.Acreedor1,
                        Id_Acreedor      = (elemento.Acreedor1 != null && elemento.Acreedor1 != "")? elemento.Id_Acreedor:null,
                        Id_Sociedad      = elemento.Id_Sociedad,
                        RFC              = elemento.RFC,
                        Sociedad_GL      = elemento.Sociedad_GL,
                        Tipo_Operador    = elemento.Tipo_Operador,
                        DescripcionGrupo = elemento.DescripcionGrupo,
                        NombreSociedad   = elemento.NombreSociedad
                    });
                }
                total         = listaOperador.Count();
                listaOperador = listaOperador.Skip(start).Take(limit).ToList();
                respuesta     = new { success = true,
                                      results = listaOperador.Skip(start).Take(limit).ToList(),
                                      total   = listaOperador.Count };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult llenaGrid(int start, int limit, string NombrePerfil, string Etiqueta, string CanRead, string CanNew, string CanEdit, string CanDelete, string WriteLog)
        {
            object respuesta = null;

            try
            {
                List <object> lista    = new List <object>();
                var           consulta = from per in db.Perfil
                                         join perm in db.permisos on per.Id equals perm.ID_Perfil
                                         join men in db.MenuIC on perm.IDMenu equals men.Id
                                         where perm.Activo == true && men.Activo == true && per.Activo == true &&
                                         DbFiltro.String(per.Nombre, NombrePerfil) &&
                                         DbFiltro.String(men.Etiqueta, Etiqueta) &&
                                         DbFiltro.Int(perm.CanRead, CanRead != string.Empty ? (CanRead.ToUpper() == "SI" ? "1" : "0") : "") &&
                                         DbFiltro.Int(perm.CanNew, CanNew != string.Empty ? (CanNew.ToUpper() == "SI" ? "1" : "0") : "") &&
                                         DbFiltro.Int(perm.CanEdit, CanEdit != string.Empty ? (CanEdit.ToUpper() == "SI" ? "1" : "0") : "") &&
                                         DbFiltro.Int(perm.CanDelete, CanDelete != string.Empty ? (CanDelete.ToUpper() == "SI" ? "1" : "0") : "") &&
                                         DbFiltro.Int(perm.WriteLog, WriteLog != string.Empty ? (WriteLog.ToUpper() == "SI" ? "1" : "0") : "")
                                         select new
                {
                    perm.Id,
                    per.Nombre,
                    men.Descripcion,
                    IdMenu = perm.IDMenu,
                    perm.CanRead,
                    perm.CanNew,
                    perm.CanEdit,
                    perm.CanDelete,
                    perm.WriteLog,
                    IdPerfil = per.Id
                };
                foreach (var item in consulta)
                {
                    lista.Add(new
                    {
                        Id           = item.Id,
                        IdPerfil     = item.IdPerfil,
                        IdMenu       = item.IdMenu,
                        NombrePerfil = item.Nombre,
                        Etiqueta     = item.Descripcion,
                        CanRead      = (item.CanRead == 1 ? "Si" : "No"),
                        CanNew       = (item.CanNew == 1 ? "Si" : "No"),
                        CanEdit      = (item.CanEdit == 1 ? "Si" : "No"),
                        CanDelete    = (item.CanDelete == 1 ? "Si" : "No"),
                        WriteLog     = (item.WriteLog == 1 ? "Si" : "No")
                    });
                }

                respuesta = new
                {
                    success = true,
                    results = lista.Skip(start).Take(limit).ToList(),
                    total   = lista.Count
                };
            }
            catch (Exception ex)
            {
                respuesta = new { success = false, results = ex.Message };
            }


            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Example #27
0
        public JsonResult LlenaGrid(int?lineaNegocio, DateTime periodoContable, string sentido, List <string> trafico, DateTime?periodo, int start, int limit, string deudorAcreedor,
                                    string grupo,
                                    string minutos,
                                    string importe,
                                    string moneda,
                                    string operador,
                                    string periodoCol,
                                    string sentidoCol,
                                    string servicio,
                                    string sociedad,
                                    string traficoCol)
        {
            List <object> lista     = new List <object>();
            object        respuesta = null;

            int total;

            try
            {
                var datos = from oDatos in db.AjustesObjecion
                            where
                            oDatos.activo == 1 &&
                            oDatos.lineaNegocio == lineaNegocio &&
                            oDatos.periodo_carga == periodoContable

                            && DbFiltro.String(oDatos.deudorAcreedor, deudorAcreedor) &&
                            DbFiltro.String(oDatos.grupo, grupo) &&
                            DbFiltro.Decimal(oDatos.minutos, minutos) &&
                            DbFiltro.Decimal(oDatos.importe, importe) &&
                            DbFiltro.String(oDatos.moneda, moneda) &&
                            DbFiltro.String(oDatos.operador, operador) &&
                            DbFiltro.Date(oDatos.periodo, periodoCol, "am") &&
                            DbFiltro.String(oDatos.sentido, sentidoCol) &&
                            DbFiltro.String(oDatos.servicio, servicio) &&
                            DbFiltro.String(oDatos.sociedad, sociedad) &&
                            DbFiltro.String(oDatos.trafico, traficoCol)

                            select new
                {
                    oDatos.Id,
                    oDatos.sentido,
                    oDatos.idSociedad,
                    oDatos.sociedad,
                    oDatos.idTrafico,
                    oDatos.trafico,
                    oDatos.idServicio,
                    oDatos.servicio,
                    oDatos.idDeudorAcreedor,
                    oDatos.deudorAcreedor,
                    oDatos.idOperador,
                    oDatos.operador,
                    oDatos.idGrupo,
                    oDatos.grupo,
                    oDatos.periodo,
                    oDatos.minutos,
                    oDatos.importe,
                    oDatos.moneda
                };

                if (!string.IsNullOrEmpty(sentido) && trafico != null && periodo != null)
                {
                    datos = datos.Where(c => c.sentido == sentido && c.periodo.Year == periodo.Value.Year && c.periodo.Month == periodo.Value.Month && trafico.Contains(c.trafico));
                }
                else if (!string.IsNullOrEmpty(sentido) && trafico != null)
                {
                    datos = datos.Where(c => c.sentido == sentido && trafico.Contains(c.trafico));
                }
                else if (!string.IsNullOrEmpty(sentido) && periodo != null)
                {
                    datos = datos.Where(c => c.sentido == sentido && c.periodo.Year == periodo.Value.Year && c.periodo.Month == periodo.Value.Month);
                }
                else if (trafico != null && periodo != null)
                {
                    datos = datos.Where(c => c.periodo.Year == periodo.Value.Year && c.periodo.Month == periodo.Value.Month && trafico.Contains(c.trafico));
                }
                else if (!string.IsNullOrEmpty(sentido))
                {
                    datos = datos.Where(c => c.sentido == sentido);
                }
                else if (trafico != null)
                {
                    datos = datos.Where(c => trafico.Contains(c.trafico));
                }
                else if (periodo != null)
                {
                    datos = datos.Where(c => c.periodo.Year == periodo.Value.Year && c.periodo.Month == periodo.Value.Month);
                }


                foreach (var elemento in datos)
                {
                    lista.Add(new
                    {
                        Id               = elemento.Id,
                        sentido          = elemento.sentido,
                        idSociedad       = elemento.idSociedad,
                        sociedad         = elemento.sociedad,
                        idTrafico        = elemento.idTrafico,
                        trafico          = elemento.trafico,
                        idServicio       = elemento.idServicio,
                        servicio         = elemento.servicio,
                        idDeudorAcreedor = elemento.idDeudorAcreedor,
                        deudorAcreedor   = elemento.deudorAcreedor,
                        idOperador       = elemento.idOperador,
                        operador         = elemento.operador,
                        idGrupo          = elemento.idGrupo,
                        grupo            = elemento.grupo,
                        periodo          = elemento.periodo.ToString("yyyy MMMM", new CultureInfo("es-ES")).ToUpper(),
                        minutos          = Convert.ToDecimal(elemento.minutos),
                        importe          = Convert.ToDecimal(elemento.importe),
                        moneda           = elemento.moneda
                    });
                }
                total     = lista.Count();
                lista     = lista.Skip(start).Take(limit).ToList();
                respuesta = new { success = true, results = lista, total = total };
            }
            catch (Exception e)
            {
                lista     = null;
                respuesta = new { success = false, results = e.Message };
            }

            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }