コード例 #1
0
        public Boolean DeleteDB(int IdEmpresa, string IdCod_Impuesto)
        {
            try
            {
                Boolean resultado = false;

                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    var contact = context.tb_sis_Impuesto_x_ctacble.FirstOrDefault(obj => obj.IdEmpresa_cta == IdEmpresa && obj.IdCod_Impuesto == IdCod_Impuesto);
                    if (contact != null)
                    {
                        context.tb_sis_Impuesto_x_ctacble.Remove(contact);
                        context.SaveChanges();
                        context.Dispose();
                    }
                }

                return(resultado);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #2
0
        public List <tb_empresa_Info> get_list(int skip, int take, string filter)
        {
            try
            {
                List <tb_empresa_Info> Lista = new List <tb_empresa_Info>();

                EntitiesGeneral context_g = new EntitiesGeneral();

                var lstg = context_g.tb_empresa.Where(q => q.Estado == "A" && (q.IdEmpresa.ToString() + " " + q.em_nombre).Contains(filter)).OrderBy(q => q.IdEmpresa).Skip(skip).Take(take);
                foreach (var q in lstg)
                {
                    Lista.Add(new tb_empresa_Info
                    {
                        IdEmpresa = q.IdEmpresa,
                        codigo    = q.codigo,
                        em_nombre = q.em_nombre
                    });
                }
                context_g.Dispose();
                return(Lista);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        public List <tbl_bodega_Info> get_list(int IdEmpresa, bool mostrar_no_asignados)
        {
            try
            {
                List <tbl_bodega_Info> Lista;

                EntitiesGeneral       Context_g  = new EntitiesGeneral();
                List <tb_Bodega_Info> lst_bodega = (from b in Context_g.tb_bodega
                                                    join s in Context_g.tb_sucursal
                                                    on new { b.IdEmpresa, b.IdSucursal } equals new { s.IdEmpresa, s.IdSucursal }
                                                    where b.IdEmpresa == IdEmpresa
                                                    select new tb_Bodega_Info
                {
                    IdEmpresa = b.IdEmpresa,
                    IdSucursal = b.IdSucursal,
                    IdBodega = b.IdBodega,
                    NomSucursal = s.Su_Descripcion,
                    bo_Descripcion = b.bo_Descripcion
                }).ToList();
                Context_g.Dispose();
                Entities_mobileSCI context_m = new Entities_mobileSCI();

                List <tbl_bodega_Info> lst_filtro = (from q in context_m.tbl_bodega
                                                     where q.IdEmpresaSCI == IdEmpresa
                                                     select new tbl_bodega_Info
                {
                    IdEmpresa = q.IdEmpresa,
                    IdSucursal = q.IdSucursal,
                    IdBodega = q.IdBodega,
                }).ToList();



                if (mostrar_no_asignados)
                {
                    Lista = (from q in lst_bodega
                             join b in lst_filtro
                             on new { q.IdEmpresa, q.IdSucursal, q.IdBodega } equals new { b.IdEmpresa, b.IdSucursal, b.IdBodega }
                             into gr
                             from p in gr.DefaultIfEmpty()
                             where q.IdEmpresa == IdEmpresa
                             select new tbl_bodega_Info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdSucursal = q.IdSucursal,
                        IdBodega = q.IdBodega,
                        nom_sucursal = q.NomSucursal,
                        nom_bodega = q.bo_Descripcion,
                        seleccionado = p == null ? false : true
                    }).ToList();
                }
                else
                {
                    Lista = (from q in lst_filtro
                             join b in lst_bodega
                             on new { q.IdEmpresa, q.IdSucursal, q.IdBodega } equals new { b.IdEmpresa, b.IdSucursal, b.IdBodega }
                             into gr
                             from p in gr.DefaultIfEmpty()
                             where q.IdEmpresa == IdEmpresa
                             select new tbl_bodega_Info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdSucursal = q.IdSucursal,
                        IdBodega = q.IdBodega,
                        nom_sucursal = p.NomSucursal,
                        nom_bodega = p.bo_Descripcion,
                        seleccionado = true
                    }).ToList();
                }
                context_m.Dispose();
                return(Lista);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #4
0
        public string Get_Id(string codPadre)
        {
            string idHijo = "";


            try
            {
                //declaracion de variables
                //int numDigitosxPadre = 0;
                int i_nivelPadre    = 0;
                int numDigitosxHijo = 0;
                int i_nivelHijo     = 0;

                EntitiesGeneral OEUbicacion = new EntitiesGeneral();
                var             tb          = from C in OEUbicacion.tb_ubicacion
                                              where C.IdUbicacion == codPadre
                                              select new { C.ub_nivel };
                foreach (var item in tb)
                {
                    //obtengo el nivel del padre de dicha cta
                    i_nivelPadre = Convert.ToInt32(item.ub_nivel);
                }

                OEUbicacion.Dispose();

                //numDigitosxPadre = 3;
                numDigitosxHijo = 3;

                // al nivel del hijo le sumo uno
                i_nivelHijo = i_nivelPadre + 1;

                OEUbicacion = new EntitiesGeneral();
                //var tb3 = from F in OEUbicacion.tb_ubicacion
                //          where F.IdUbicacion.StartsWith(codPadre)
                //          select new { id = F.IdUbicacion.Substring(F.IdUbicacion_Padre.Trim().Length) };
                IQueryable <string> tb3;;
                if (string.IsNullOrEmpty(codPadre))
                {
                    tb3 = from F in OEUbicacion.tb_ubicacion
                          where F.IdUbicacion_Padre == codPadre
                          select F.IdUbicacion;
                }
                else
                {
                    //tb3 = from q in

                    tb3 = from F in OEUbicacion.tb_ubicacion
                          where F.IdUbicacion.StartsWith(codPadre) && F.IdUbicacion != codPadre
                          select F.IdUbicacion;
                }

                //.Substring(F.IdUbicacion_Padre.Trim().Length)

                List <int> lista = new List <int>();
                foreach (var item in tb3)
                {
                    var valor = item.Substring(codPadre.Trim().Length);
                    if (valor.Length == 3)
                    {
                        lista.Add(Convert.ToInt32(item));
                    }
                }

                if (lista.Count > 0)
                {
                    //obtengo el max de loxs id
                    var temp = (from A in lista
                                select A).Max() + 1;
                    idHijo = temp.ToString();
                    idHijo = "000000000" + idHijo;
                    int value = idHijo.Length - numDigitosxHijo;
                    idHijo = idHijo.Substring(value, numDigitosxHijo);
                    idHijo = codPadre + idHijo;
                }
                else
                {
                    //asigno el primer valor cuando no obtengo nada de la lista
                    idHijo = codPadre + "001";
                }

                string result = idHijo.ToString();  //.Substring(value, numDigitosxHijo);

                return(result);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }