コード例 #1
0
ファイル: tb_Bodega_Data.cs プロジェクト: arocajorge/ERPUTAN
        public int getId(int idempresa, int idsucursal)
        {
            int Id = 0;

            try
            {
                EntitiesGeneral OEGeneral = new EntitiesGeneral();
                var             select    = from q in OEGeneral.tb_bodega
                                            where q.IdEmpresa == idempresa &&
                                            q.IdSucursal == idsucursal
                                            select q;

                if (select.ToList().Count < 1)
                {
                    Id = 1;
                }
                else
                {
                    var select_pv = (from q in OEGeneral.tb_bodega
                                     where q.IdEmpresa == idempresa
                                     select q.IdBodega).Max();
                    Id = Convert.ToInt32(select_pv.ToString()) + 1;
                }
                return(Id);
            }
            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
ファイル: tb_tarjeta_Data.cs プロジェクト: arocajorge/ERPFJ
        public Boolean ModificarDB(tb_tarjeta_Info Info)
        {
            try
            {
                EntitiesGeneral context = new EntitiesGeneral();
                var             tarjeta = context.tb_tarjeta.First(var => var.IdTarjeta == Info.IdTarjeta);
                tarjeta.tr_Descripcion = Info.tr_Descripcion;
                tarjeta.IdBanco        = Info.IdBanco;
                tarjeta.Estado         = Info.Estado;
                context.SaveChanges();

                return(true);
            }
            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());
            }
        }
コード例 #3
0
        public Boolean VericarExisteIdString(string codigo, ref string mensaje)
        {
            try
            {
                Boolean Existe;
                string  scodigo;

                scodigo = codigo.Trim();
                mensaje = "";
                Existe  = false;

                EntitiesGeneral B = new EntitiesGeneral();

                var select_ = from t in B.tb_sis_reporte
                              where t.CodReporte == scodigo
                              select t;

                foreach (var item in select_)
                {
                    mensaje = mensaje + " " + item.Nombre;
                    Existe  = true;
                }

                return(Existe);
            }
            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());
            }
        }
コード例 #4
0
        public Boolean GuardarDB(tb_transportista_Info Info, ref decimal IdTransportista)
        {
            try
            {
                using (EntitiesGeneral oEnti = new EntitiesGeneral())
                {
                    var consulta = from q in oEnti.tb_transportista
                                   where q.IdEmpresa == Info.IdEmpresa && q.Cedula == Info.Cedula
                                   select q;
                    if (consulta.ToList().Count == 0)
                    {
                        var registo = new tb_transportista();

                        registo.IdEmpresa       = Info.IdEmpresa;
                        registo.IdTransportista = Info.IdTransportista = IdTransportista = GetIdTransportista(Info.IdEmpresa);
                        registo.Nombre          = Info.Nombre;
                        registo.Cedula          = Info.Cedula;
                        registo.Estado          = Info.Estado;
                        registo.Placa           = Info.Placa;
                        oEnti.tb_transportista.Add(registo);
                        oEnti.SaveChanges();
                    }
                }
                return(true);
            }
            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());
            }
        }
コード例 #5
0
        public int Get_numEstablecimiento_x_empresa_SRI(int IdEmpresa)
        {
            try
            {
                int x = 0;

                using (EntitiesGeneral Context = new EntitiesGeneral())
                {
                    var lst = from q in Context.tb_sucursal
                              where q.IdEmpresa == IdEmpresa &&
                              q.Es_establecimiento == true
                              select q;

                    if (lst.Count() == 0)
                    {
                        x = 1;
                    }
                    else
                    {
                        x = lst.Count();
                    }
                }

                return(x);
            }
            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());
            }
        }
コード例 #6
0
        public Boolean ActualizarDB(tb_sis_impuesto_Info Info, ref string msg)
        {
            try
            {
                bool resultado = false;
                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    var address = context.tb_sis_Impuesto.FirstOrDefault(v => v.IdCod_Impuesto == Info.IdCod_Impuesto);
                    if (address != null)
                    {
                        address.nom_impuesto     = Info.nom_impuesto;
                        address.Usado_en_Ventas  = Info.Usado_en_Ventas;
                        address.Usado_en_Compras = Info.Usado_en_Compras;
                        address.porcentaje       = Info.porcentaje;
                        address.IdCodigo_SRI     = Info.IdCodigo_SRI;
                        address.estado           = Info.estado;
                        address.IdTipoImpuesto   = Info.IdTipoImpuesto;


                        context.SaveChanges();
                        msg       = "Se ha modificado el Banco #: " + address.IdCod_Impuesto.ToString() + " exitosamente.";
                        resultado = true;
                    }
                }
                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());
            }
        }
コード例 #7
0
ファイル: tb_Bodega_Data.cs プロジェクト: arocajorge/ERPUTAN
        public Boolean Grabar_Lista(List <tb_Bodega_Info> lista_nueva, List <tb_Bodega_Info> lista_antigua, ref string msg)
        {
            try
            {
                //eliminamos la lista antigua de los puntos de ventas
                foreach (var item in lista_antigua)
                {
                    //EliminarDB(
                }

                return(true);
            }
            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;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #8
0
 public Boolean Anular(Info.General.tb_sis_Documento_Tipo_Talonario_Info Info)
 {
     try
     {
         using (EntitiesGeneral Context = new EntitiesGeneral())
         {
             var Address = Context.tb_sis_Documento_Tipo_Talonario.FirstOrDefault(cot => cot.IdEmpresa == Info.IdEmpresa && cot.CodDocumentoTipo == Info.CodDocumentoTipo && cot.IdSucursal == Info.IdSucursal && cot.NumDocumento == Info.NumDocumento);
             if (Address != null)
             {
                 Address.Estado = "I";
                 Context.SaveChanges();
             }
         }
         return(true);
     }
     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 mensajeErrorLog);
         throw new Exception(ex.ToString());
     }
 }
コード例 #9
0
        //Obtiene lista Tipo cata
        public List <tbSys_Ge_Comparativo_Modulo_vs_Contas_Info> Get_List_Comparativo_Modulo_vs_Contas(int IdEmpresa, DateTime Fecha_Ini, DateTime Fecha_Fin)
        {
            try
            {
                List <tbSys_Ge_Comparativo_Modulo_vs_Contas_Info> lista = new List <tbSys_Ge_Comparativo_Modulo_vs_Contas_Info>();
                EntitiesGeneral OCatalogo = new EntitiesGeneral();
                var             Doc       = from C in OCatalogo.spSys_Ge_Comparativo_Modulo_vs_Contas(IdEmpresa, Fecha_Ini, Fecha_Fin)
                                            select C;


                foreach (var item in Doc)
                {
                    tbSys_Ge_Comparativo_Modulo_vs_Contas_Info info = new tbSys_Ge_Comparativo_Modulo_vs_Contas_Info();


                    info.IdEmpresa         = item.IdEmpresa;
                    info.IdSucursal        = item.IdSucursal;
                    info.cod_sucu          = item.cod_sucu;
                    info.IdBodega          = item.IdBodega;
                    info.IdCbteVta         = item.IdCbteVta;
                    info.vt_tipoDoc        = item.vt_tipoDoc;
                    info.vt_serie1         = item.vt_serie1;
                    info.vt_serie2         = item.vt_serie2;
                    info.vt_NumFactura     = item.vt_NumFactura;
                    info.IdCliente         = item.IdCliente;
                    info.pe_nombreCompleto = item.pe_nombreCompleto;
                    info.vt_fecha          = item.vt_fecha;
                    info.vt_Observacion    = item.vt_Observacion;
                    info.Debito_Vta        = item.Debito_Vta;
                    info.Credito_Vta       = item.Credito_Vta;
                    info.cb_Fecha          = item.cb_Fecha;
                    info.cb_Observacion    = item.cb_Observacion;
                    info.IdCtaCble         = item.IdCtaCble;
                    info.Debito_Conta      = item.Debito_Conta;
                    info.Credito_Conta     = item.Credito_Conta;
                    info.pc_Cuenta         = item.pc_Cuenta;
                    info.IdEmpresa_ct      = item.IdEmpresa_ct;
                    info.IdTipoCbte_ct     = item.IdTipoCbte_ct;
                    info.IdCbteCble_ct     = item.IdCbteCble_ct;
                    info.secuencia         = item.secuencia;
                    info.TIPO       = item.TIPO;
                    info.referencia = item.referencia;
                    info.Diferencia = (info.Debito_Vta + info.Credito_Vta) - (info.Debito_Conta + info.Credito_Conta);
                    info.Diferencia = Math.Round(Convert.ToDouble(info.Diferencia), 2);



                    lista.Add(info);
                }

                return(lista);
            }
            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());
            }
        }
コード例 #10
0
ファイル: tb_Bodega_Data.cs プロジェクト: arocajorge/ERPFJ
        public Boolean ModificarDB(tb_Bodega_Info info, ref string msg)
        {
            try
            {
                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    var selecte = context.tb_bodega.Count(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal && q.IdBodega == info.IdBodega);

                    if (selecte == 0)
                    {
                        tb_Sucursal_Data        odata   = new tb_Sucursal_Data();
                        List <tb_Sucursal_Info> listaSu = new List <tb_Sucursal_Info>();
                        listaSu = odata.Get_List_Sucursal(info.IdEmpresa);

                        tb_Sucursal_Info infoSu = new tb_Sucursal_Info();
                        infoSu = listaSu.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal);

                        msg = "La Sucursal : " + infoSu.Su_Descripcion + " no tiene bodega creada";
                        return(false);
                    }

                    else
                    {
                        var contact = context.tb_bodega.First(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega);
                        if (info.Estado == false)
                        {
                            if (VerificarSiBodegaTieneMovimientos(info, ref msg))
                            {
                                return(false);
                            }
                        }

                        contact.bo_Descripcion       = info.bo_Descripcion;
                        contact.cod_punto_emision    = info.cod_punto_emision;
                        contact.bo_EsBodega          = info.bo_esBodega;
                        contact.bo_manejaFacturacion = info.bo_manejaFacturacion;
                        contact.IdUsuarioUltMod      = info.IdUsuarioUltMod;
                        contact.Fecha_UltMod         = info.Fecha_UltMod;
                        contact.IdCentroCosto        = info.IdCentroCosto;
                        contact.nom_pc = info.nom_pc;
                        contact.ip     = info.ip;
                        contact.Estado = (info.Estado == true) ? "A" : "I";
                        contact.IdEstadoAproba_x_Ing_Egr_Inven = info.IdEstadoAproba_x_Ing_Egr_Inven;

                        contact.IdCtaCtble_Inve  = (info.IdCtaCtble_Inve == "") ? null : info.IdCtaCtble_Inve;
                        contact.IdCtaCtble_Costo = (info.IdCtaCtble_Costo == "") ? null : info.IdCtaCtble_Costo;


                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro de la Bodega #: " + info.IdBodega.ToString() + " exitosamente";
                    }
                }
                return(true);
            }
            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;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #11
0
        public tb_sis_Documento_Tipo_Talonario_Info Get_Info_Ult_Documento
            (int IdEmpresa, string puntoemision, string establecimiento, string tipodoc)
        {
            try
            {
                tb_sis_Documento_Tipo_Talonario_Info Info = new tb_sis_Documento_Tipo_Talonario_Info();

                List <tb_sis_Documento_Tipo_Talonario_Info> lm = new List <tb_sis_Documento_Tipo_Talonario_Info>();
                EntitiesGeneral OEGeneral = new EntitiesGeneral();
                var             q         = (from A in OEGeneral.tb_sis_Documento_Tipo_Talonario
                                             where A.IdEmpresa == IdEmpresa &&
                                             A.PuntoEmision == puntoemision &&
                                             A.CodDocumentoTipo == tipodoc &&
                                             A.Establecimiento == establecimiento &&
                                             A.Estado == "A"
                                             select A.NumDocumento).Max();

                string UltRegistro = "";

                if (q == null)
                {
                    UltRegistro = "000000000";
                }
                else
                {
                    UltRegistro = q.ToString();
                }

                var querry = from A in OEGeneral.tb_sis_Documento_Tipo_Talonario
                             where A.IdEmpresa == IdEmpresa &&
                             A.PuntoEmision == puntoemision &&
                             A.CodDocumentoTipo == tipodoc &&
                             A.Establecimiento == establecimiento &&
                             A.NumDocumento == UltRegistro
                             select A;

                if (querry != null)
                {
                    foreach (var item in querry)
                    {
                        Info.IdEmpresa                = item.IdEmpresa;
                        Info.IdSucursal               = item.IdSucursal;
                        Info.CodDocumentoTipo         = item.CodDocumentoTipo;
                        Info.Establecimiento          = item.Establecimiento;
                        Info.Estado                   = item.Estado;
                        Info.FechaCaducidad           = item.FechaCaducidad;
                        Info.NumAutorizacion          = item.NumAutorizacion;
                        Info.NumDocumento             = item.NumDocumento;
                        Info.PuntoEmision             = item.PuntoEmision;
                        Info.Usado                    = item.Usado;
                        Info.es_Documento_electronico = Convert.ToBoolean(item.es_Documento_Electronico);
                    }
                }
                else
                {
                    Info.IdEmpresa        = IdEmpresa;
                    Info.IdSucursal       = 0;
                    Info.CodDocumentoTipo = tipodoc;
                    Info.Establecimiento  = establecimiento;
                    Info.Estado           = "A";
                    Info.FechaCaducidad   = DateTime.Now;
                    Info.NumAutorizacion  = "0000000000000";
                    Info.NumDocumento     = "000000000";
                    Info.PuntoEmision     = puntoemision;
                    Info.Usado            = false;
                }

                return(Info);
            }
            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 mensajeErrorLog);
                throw new Exception(ex.ToString());
            }
        }
コード例 #12
0
        public List <tb_contacto_Info> Get_List_Contacto(int IdEmpresa)
        {
            List <tb_contacto_Info> listaCon = new List <tb_contacto_Info>();

            try
            {
                EntitiesGeneral Base   = new EntitiesGeneral();
                var             select = from A in Base.vwtb_contacto
                                         where A.IdEmpresa == IdEmpresa
                                         orderby A.IdContacto
                                         select A;

                foreach (var item in select)
                {
                    tb_contacto_Info info = new tb_contacto_Info();
                    info.IdEmpresa              = item.IdEmpresa;
                    info.IdContacto             = item.IdContacto;
                    info.IdPersona              = item.IdPersona;
                    info.CodContacto            = item.CodContacto;
                    info.Organizacion           = item.Organizacion;
                    info.Cargo                  = item.Cargo;
                    info.Mostrar_como           = item.Mostrar_como;
                    info.Fecha_alta             = item.Fecha_alta;
                    info.Fecha_Ult_Contacto     = item.Fecha_Ult_Contacto;
                    info.IdNacionalidad         = item.IdNacionalidad;
                    info.Notas                  = item.Notas;
                    info.Pagina_Web             = item.Pagina_Web;
                    info.Codigo_postal          = item.Codigo_postal;
                    info.Estado                 = item.Estado;
                    info.Pais_Info.IdPais       = item.IdPais;
                    info.Ciudad_Info.IdCiudad   = item.IdCiudad;
                    info.Provi_Info.IdProvincia = item.IdProvincia;
                    info.IdNacionalidad         = item.IdNacionalidad;

                    tb_persona_Info personaInfo = new tb_persona_Info();
                    personaInfo.IdPersona          = item.IdPersona;
                    personaInfo.IdTipoDocumento    = item.IdTipoDocumento;
                    personaInfo.pe_apellido        = item.pe_apellido;
                    personaInfo.pe_nombre          = item.pe_nombre;
                    personaInfo.pe_nombreCompleto  = item.pe_nombre + item.pe_apellido;
                    personaInfo.pe_correo          = item.pe_correo;
                    personaInfo.pe_celular         = item.pe_celular;
                    personaInfo.pe_cedulaRuc       = item.pe_cedulaRuc;
                    personaInfo.pe_direccion       = item.pe_direccion;
                    personaInfo.pe_fechaNacimiento = item.pe_fechaNacimiento;
                    personaInfo.pe_razonSocial     = item.pe_razonSocial;
                    personaInfo.pe_Naturaleza      = item.pe_Naturaleza;
                    info.Persona_Info = personaInfo;

                    tb_pais_Info paisInfo = new tb_pais_Info();
                    paisInfo.IdPais       = item.IdPais;
                    info.IdPais           = paisInfo.IdPais;
                    paisInfo.Nacionalidad = item.Nacionalidad;


                    tb_ciudad_Info ciudadInfo = new tb_ciudad_Info();
                    ciudadInfo.IdCiudad = item.IdCiudad;
                    info.IdCiudad       = ciudadInfo.IdCiudad;


                    tb_provincia_Info ProvInfo = new tb_provincia_Info();
                    ProvInfo.IdProvincia = item.IdProvincia;
                    info.IdProvincia     = ProvInfo.IdProvincia;



                    listaCon.Add(info);
                }
                return(listaCon);
            }
            catch (Exception ex)
            {
                string arreglo      = ToString();
                string MensajeError = string.Empty;
                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);
                MensajeError = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #13
0
        public tb_Empresa_Info Get_Info_Empresa(int IdEmpresa)
        {
            try
            {
                EntitiesGeneral OEselecEmpresa = new EntitiesGeneral();
                var             selectEmpresa  = from C in OEselecEmpresa.tb_empresa
                                                 where C.IdEmpresa == IdEmpresa
                                                 select C;

                tb_Empresa_Info Cbt = new tb_Empresa_Info();

                foreach (var item in selectEmpresa)
                {
                    Cbt.IdEmpresa       = item.IdEmpresa;
                    Cbt.em_nombre       = item.em_nombre;
                    Cbt.em_gerente      = item.em_gerente;
                    Cbt.em_ruc          = item.em_ruc;
                    Cbt.em_telefonos    = item.em_telefonos;
                    Cbt.em_fax          = item.em_fax;
                    Cbt.em_notificacion = Convert.ToInt32(item.em_notificacion);
                    Cbt.em_direccion    = item.em_direccion;
                    Cbt.em_contador     = item.em_contador;

                    Cbt.em_tel_int = item.em_tel_int;
                    Cbt.em_logo    = item.em_logo;
                    //Cbt.em_fondo = item.em_fondo; NO OPTENGO EL FONDO POR Q ES PESADO
                    Cbt.em_fechaInicioContable = item.em_fechaInicioContable;
                    Cbt.Estado = item.Estado;
                    Cbt.codigo = item.codigo;

                    Cbt.em_logo_Image  = Funciones.ArrayAImage(item.em_logo);
                    Cbt.em_fondo_Image = Funciones.ArrayAImage(item.em_fondo);

                    Cbt.RazonSocial           = item.RazonSocial;
                    Cbt.NombreComercial       = item.NombreComercial;
                    Cbt.ContribuyenteEspecial = item.ContribuyenteEspecial;
                    Cbt.ObligadoAllevarConta  = item.ObligadoAllevarConta;
                    Cbt.cod_entidad_dinardap  = item.cod_entidad_dinardap;
                    Cbt.em_Email = item.em_Email;

                    Cbt.em_fax       = item.em_fax;
                    Cbt.em_Email     = item.em_Email;
                    Cbt.em_tel_int   = item.em_tel_int;
                    Cbt.em_telefonos = item.em_telefonos;
                    Cbt.em_gerente   = item.em_gerente;
                }

                return(Cbt);
            }
            catch (Exception ex)
            {
                try
                {
                    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());
                }
                catch (Exception)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }
コード例 #14
0
        public List <tb_persona_Info> Get_List_Persona()
        {
            try
            {
                List <tb_persona_Info> lM             = new List <tb_persona_Info>();
                EntitiesGeneral        OEselecEmpresa = new EntitiesGeneral();
                var selectPersona = from C in OEselecEmpresa.tb_persona
                                    select C;

                foreach (var item in selectPersona)
                {
                    tb_persona_Info Cbt = new tb_persona_Info();
                    Cbt.IdPersona            = item.IdPersona;
                    Cbt.IdEstadoCivil        = item.IdEstadoCivil.Trim();
                    Cbt.pe_apellido          = item.pe_apellido;
                    Cbt.pe_nombre            = item.pe_nombre;
                    Cbt.pe_casilla           = item.pe_casilla;
                    Cbt.pe_cedulaRuc         = item.pe_cedulaRuc;
                    Cbt.pe_celular           = item.pe_celular;
                    Cbt.pe_correo            = item.pe_correo;
                    Cbt.pe_direccion         = item.pe_direccion;
                    Cbt.pe_estado            = item.pe_estado.Trim();
                    Cbt.pe_fax               = item.pe_fax;
                    Cbt.pe_fechaCreacion     = item.pe_fechaCreacion;
                    Cbt.pe_fechaModificacion = item.pe_fechaModificacion;
                    Cbt.pe_fechaNacimiento   = item.pe_fechaNacimiento;
                    Cbt.pe_Naturaleza        = item.pe_Naturaleza.Trim();
                    Cbt.pe_nombreCompleto    = item.pe_nombreCompleto;
                    Cbt.pe_razonSocial       = item.pe_razonSocial;
                    Cbt.pe_sexo              = item.pe_sexo.Trim();
                    Cbt.pe_telefonoCasa      = item.pe_telefonoCasa;
                    Cbt.pe_telefonoInter     = item.pe_telefonoInter;
                    Cbt.pe_telefonoOfic      = item.pe_telefonoOfic;
                    Cbt.pe_telfono_Contacto  = item.pe_telfono_Contacto;
                    Cbt.IdTipoDocumento      = item.IdTipoDocumento.Trim();
                    Cbt.pe_UltUsuarioModi    = item.pe_UltUsuarioModi;
                    Cbt.pe_celularSecundario = item.pe_celularSecundario;

                    Cbt.pe_correo_secundario1 = item.pe_correo_secundario1;
                    Cbt.pe_correo_secundario2 = item.pe_correo_secundario2;

                    Cbt.IdTipoCta_acreditacion_cat = item.IdTipoCta_acreditacion_cat;
                    Cbt.num_cta_acreditacion       = item.num_cta_acreditacion;
                    Cbt.IdBanco_acreditacion       = item.IdBanco_acreditacion;


                    lM.Add(Cbt);
                }

                return(lM);
            }

            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());
            }
        }
コード例 #15
0
        public Boolean GrabarDB(tb_persona_Info info, ref decimal idPersonaOut, ref string msgError)
        {
            try
            {
                decimal idPersona = 0;

                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    EntitiesGeneral EDB = new EntitiesGeneral();
                    var             Q   = from per in EDB.tb_persona
                                          where per.IdPersona == info.IdPersona

                                          select per;
                    if (Q.ToList().Count == 0)
                    {
                        idPersona = idPersonaOut = getIdPersona();

                        tb_persona address = new tb_persona();

                        if (info.CodPersona == string.Empty || (info.CodPersona == null))
                        {
                            info.CodPersona = idPersona.ToString();
                        }

                        address.IdPersona         = idPersona;
                        address.CodPersona        = (info.CodPersona == null)? null :info.CodPersona.Trim();
                        address.pe_Naturaleza     = (info.pe_Naturaleza == null)? null : info.pe_Naturaleza.Trim();
                        address.pe_nombreCompleto = info.pe_nombre.Trim() + " " + info.pe_apellido.Trim();
                        address.pe_razonSocial    = (info.pe_razonSocial == null)? null :info.pe_razonSocial.Trim();
                        address.pe_apellido       = (info.pe_apellido == null)? null : info.pe_apellido.Trim();
                        address.pe_nombre         = (info.pe_nombre == null)? null : info.pe_nombre.Trim();
                        address.IdTipoPersona     = info.IdTipoPersona;
                        address.IdTipoDocumento   = info.IdTipoDocumento;
                        address.pe_cedulaRuc      = (info.pe_cedulaRuc == null)? null : info.pe_cedulaRuc.Trim();
                        address.pe_direccion      = (info.pe_direccion == null)? null : info.pe_direccion.Trim();

                        address.pe_telefonoCasa      = (info.pe_telefonoCasa == null)? null : info.pe_telefonoCasa.Trim();
                        address.pe_telefonoInter     = (info.pe_telefonoInter == null)? null : info.pe_telefonoInter.Trim();
                        address.pe_telefonoOfic      = (info.pe_telefonoOfic == null)? null : info.pe_telefonoOfic.Trim();
                        address.pe_telfono_Contacto  = (info.pe_telfono_Contacto == null)? null : info.pe_telfono_Contacto.Trim();
                        address.pe_celular           = (info.pe_celular == null)? null : info.pe_celular.Trim();
                        address.pe_celularSecundario = (info.pe_celularSecundario == null) ? null : info.pe_celularSecundario.Trim();

                        address.pe_correo          = info.pe_correo == null ? "" : info.pe_correo.Trim();
                        address.pe_fax             = (info.pe_fax == null)? null : info.pe_fax.Trim();
                        address.pe_casilla         = (info.pe_casilla == null)? null : info.pe_casilla.Trim();
                        address.pe_sexo            = (info.pe_sexo == null)? null : info.pe_sexo.Trim();// "SEXO_MAS";
                        address.IdEstadoCivil      = info.IdEstadoCivil;
                        address.pe_fechaNacimiento = info.pe_fechaNacimiento;
                        address.pe_estado          = "A";
                        address.pe_fechaCreacion   = DateTime.Now;
                        //address.pe_fechaModificacion = DateTime.Now;
                        address.pe_UltUsuarioModi = info.pe_UltUsuarioModi;

                        address.pe_correo_secundario1 = (info.pe_correo_secundario1 == null || info.pe_correo_secundario1 == "")? null : info.pe_correo_secundario1.Trim();
                        address.pe_correo_secundario2 = (info.pe_correo_secundario2 == null || info.pe_correo_secundario2 == "")? null : info.pe_correo_secundario2.Trim();

                        address.IdTipoCta_acreditacion_cat = (info.IdTipoCta_acreditacion_cat == "") ? null : info.IdTipoCta_acreditacion_cat;
                        address.num_cta_acreditacion       = info.num_cta_acreditacion;
                        address.IdBanco_acreditacion       = (info.IdBanco_acreditacion == 0) ? null : info.IdBanco_acreditacion;


                        context.tb_persona.Add(address);

                        context.SaveChanges();
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            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;
                mensaje = "Error al Grabar" + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #16
0
        public Boolean ModificarDB(tb_persona_Info info, ref string msgError)
        {
            try
            {
                try
                {
                    using (EntitiesGeneral context = new EntitiesGeneral())
                    {
                        var address = context.tb_persona.FirstOrDefault(minfo => minfo.IdPersona == info.IdPersona);
                        if (address != null)
                        {
                            if (info.CodPersona == string.Empty || info.CodPersona == null)
                            {
                                info.CodPersona = info.IdPersona.ToString();
                            }
                            address.IdPersona         = info.IdPersona;
                            address.CodPersona        = (info.CodPersona == null)? null : info.CodPersona.Trim();
                            address.pe_Naturaleza     = (info.pe_Naturaleza == null) ? address.pe_Naturaleza : info.pe_Naturaleza.Trim();
                            address.pe_nombreCompleto = info.pe_nombre.Trim() + " " + info.pe_apellido.Trim();
                            address.pe_razonSocial    = (info.pe_razonSocial == null)? null : info.pe_razonSocial.Trim();
                            address.pe_apellido       = (info.pe_apellido == null)? null :info.pe_apellido.Trim();
                            address.pe_nombre         = (info.pe_nombre == null)? null : info.pe_nombre.Trim();
                            address.IdTipoPersona     = info.IdTipoPersona;
                            address.IdTipoDocumento   = info.IdTipoDocumento;
                            address.pe_cedulaRuc      = (info.pe_cedulaRuc == null)? null : info.pe_cedulaRuc.Trim();

                            address.pe_direccion         = (info.pe_direccion == null) ? null : info.pe_direccion.Trim();
                            address.pe_telefonoCasa      = (info.pe_telefonoCasa == null)? null : info.pe_telefonoCasa.Trim();
                            address.pe_telefonoInter     = (info.pe_telefonoInter == null)? null : info.pe_telefonoInter.Trim();
                            address.pe_telefonoOfic      = (info.pe_telefonoOfic == null)? null : info.pe_telefonoOfic.Trim();
                            address.pe_telfono_Contacto  = (info.pe_telfono_Contacto == null)? null : info.pe_telfono_Contacto.Trim();
                            address.pe_celular           = (info.pe_celular == null)? address.pe_celular : info.pe_celular.Trim();
                            address.pe_celularSecundario = (info.pe_celularSecundario == null)? null : info.pe_celularSecundario.Trim();

                            address.pe_correo          = info.pe_correo == null ? address.pe_correo : info.pe_correo.Trim();
                            address.pe_fax             = (info.pe_fax == null)? null : info.pe_fax.Trim();
                            address.pe_casilla         = (info.pe_casilla == null)? null : info.pe_casilla.Trim();
                            address.pe_sexo            = (info.pe_sexo == null)? null : info.pe_sexo.Trim();
                            address.IdEstadoCivil      = info.IdEstadoCivil;
                            address.pe_fechaNacimiento = info.pe_fechaNacimiento;
                            //address.pe_estado = (info.pe_estado == null) ? "A" : info.pe_estado;
                            //address.pe_fechaCreacion = (info.pe_fechaCreacion == null) ? DateTime.Now : info.pe_fechaCreacion;
                            address.pe_fechaModificacion = (info.pe_fechaModificacion == null) ? DateTime.Now : info.pe_fechaModificacion;
                            address.pe_UltUsuarioModi    = info.IdUsuario;

                            address.pe_correo_secundario1 = (info.pe_correo_secundario1 == null || info.pe_correo_secundario1 == "")? null : info.pe_correo_secundario1.Trim();
                            address.pe_correo_secundario2 = (info.pe_correo_secundario2 == null || info.pe_correo_secundario2 == "")? null : info.pe_correo_secundario2.Trim();

                            address.IdTipoCta_acreditacion_cat = (info.IdTipoCta_acreditacion_cat == "") ? null : info.IdTipoCta_acreditacion_cat;
                            address.num_cta_acreditacion       = info.num_cta_acreditacion;
                            address.IdBanco_acreditacion       = (info.IdBanco_acreditacion == 0) ? null : info.IdBanco_acreditacion;


                            context.SaveChanges();
                        }
                    }
                    return(true);
                }
                catch (DbEntityValidationException 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;
                    mensaje = "Error al Grabar" + ex.Message;
                    throw new Exception(ex.ToString());
                }
            }
            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());
            }
        }
コード例 #17
0
        public bool GuardarContacto(tb_contacto_Info Info, decimal idContacto, ref string mensaje)
        {
            try
            {
                bool            resultado;
                EntitiesGeneral Conexion = new EntitiesGeneral();
                {
                    try
                    {
                        tb_contacto Base = new tb_contacto();
                        if (idContacto == 0)
                        {
                            idContacto      = getId(Info.IdEmpresa);
                            Info.IdContacto = idContacto;
                        }
                        decimal idPersona = 0;
                        if (Info.Persona_Info.IdPersona == 0)
                        {
                            resultado = GrabarPersonaDB(Info.Persona_Info, ref idPersona);
                        }
                        else
                        {
                            ActualizarPersonaDB(Info.Persona_Info, ref mensaje);
                            idPersona = Info.Persona_Info.IdPersona;
                            resultado = true;
                        }


                        if (resultado)
                        {
                            Base.IdEmpresa          = Info.IdEmpresa;
                            Base.IdContacto         = Info.IdContacto;
                            Base.IdPersona          = idPersona;
                            Base.CodContacto        = (string.IsNullOrEmpty(Info.CodContacto) || Info.CodContacto == "0") ? idContacto.ToString() : Info.CodContacto;
                            Base.Organizacion       = Info.Organizacion;
                            Base.Cargo              = Info.Cargo;
                            Base.Mostrar_como       = Info.Mostrar_como;
                            Base.Fecha_alta         = Info.Fecha_alta;
                            Base.Fecha_Ult_Contacto = Info.Fecha_Ult_Contacto;
                            Base.IdPais             = Info.IdPais;
                            Base.IdProvincia        = Info.IdProvincia;
                            Base.IdCiudad           = Info.IdCiudad;
                            Base.IdNacionalidad     = Info.IdNacionalidad;
                            Base.Notas              = Info.Notas;
                            Base.Pagina_Web         = Info.Pagina_Web;
                            Base.foto            = Info.foto;
                            Base.Codigo_postal   = Info.Codigo_postal;
                            Base.FechaCreacion   = DateTime.Now;
                            Base.UsuarioCreacion = Info.UsuarioCreacion;
                            Base.Estado          = Info.Estado;
                            Conexion.tb_contacto.Add(Base);
                            Conexion.SaveChanges();
                            mensaje = "Se ha Guardado el contacto #: " + idContacto.ToString() + " exitosamente.";
                        }
                    }
                    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.InnerException + " " + ex.Message;
                        throw new Exception(ex.InnerException.ToString());
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo      = ToString();
                String MensajeError = string.Empty;
                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);
                MensajeError = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                mensaje = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #18
0
        public Boolean GrabarDB(tb_Empresa_Info info)
        {
            try
            {
                int idEmpresa = 0;
                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    EntitiesGeneral EDB = new EntitiesGeneral();
                    var             Q   = from per in EDB.tb_empresa
                                          where per.IdEmpresa == info.IdEmpresa
                                          select per;
                    if (Q.ToList().Count == 0)
                    {
                        idEmpresa = getIdEmpresa();

                        var address = new tb_empresa();

                        if (info.codigo == "")
                        {
                            info.codigo = idEmpresa.ToString();
                        }
                        address.IdEmpresa              = idEmpresa;
                        address.em_nombre              = info.em_nombre;
                        address.em_ruc                 = info.em_ruc;
                        address.em_gerente             = info.em_gerente;
                        address.em_contador            = info.em_contador;
                        address.em_rucContador         = info.em_rucContador;
                        address.em_telefonos           = info.em_telefonos;
                        address.em_fax                 = info.em_fax;
                        address.em_notificacion        = info.em_notificacion;
                        address.em_direccion           = info.em_direccion;
                        address.em_tel_int             = info.em_tel_int;
                        address.em_logo                = info.em_logo;
                        address.em_fondo               = info.em_fondo;
                        address.em_fechaInicioContable = info.em_fechaInicioContable;
                        address.Estado                 = info.Estado;
                        address.codigo                 = info.codigo;
                        address.RazonSocial            = info.RazonSocial;
                        address.NombreComercial        = info.NombreComercial;
                        address.ContribuyenteEspecial  = info.ContribuyenteEspecial;
                        address.ObligadoAllevarConta   = info.ObligadoAllevarConta;
                        address.cod_entidad_dinardap   = info.cod_entidad_dinardap;
                        address.em_Email               = info.em_Email;
                        context.tb_empresa.Add(address);
                        context.SaveChanges();

                        tb_Sucursal_Data oDataSucursal = new tb_Sucursal_Data();
                        tb_Sucursal_Info infoSucursal  = new tb_Sucursal_Info();

                        int    id  = 0;
                        string msg = "";

                        infoSucursal.IdEmpresa      = idEmpresa;
                        infoSucursal.Su_Descripcion = "MATRIZ";
                        infoSucursal.Fecha_Transac  = DateTime.Now;

                        oDataSucursal.GrabarDB(infoSucursal, ref id, ref msg);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            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());
            }
        }
コード例 #19
0
        public tb_sis_Documento_Tipo_Talonario_Info Get_Info_Primer_Documento_no_usado(int IdEmpresa, string establecimiento, string puntoemision, string tipodoc, bool Es_Documento_Electronico, bool Considerar_punto_emision)
        {
            try
            {
                tb_sis_Documento_Tipo_Talonario_Info Info = new tb_sis_Documento_Tipo_Talonario_Info();


                List <tb_sis_Documento_Tipo_Talonario_Info> lm = new List <tb_sis_Documento_Tipo_Talonario_Info>();
                EntitiesGeneral OEGeneral = new EntitiesGeneral();
                string          q;
                IQueryable <tb_sis_Documento_Tipo_Talonario> querry;

                if (!Considerar_punto_emision)
                {
                    q = (from A in OEGeneral.tb_sis_Documento_Tipo_Talonario
                         where A.IdEmpresa == IdEmpresa
                         //&& A.PuntoEmision == puntoemision
                         && A.CodDocumentoTipo == tipodoc &&
                         A.Establecimiento == establecimiento &&
                         A.es_Documento_Electronico == Es_Documento_Electronico &&
                         A.Usado == false &&
                         A.Estado == "A"

                         select A.NumDocumento).Min();
                    if (q != null)
                    {
                        string UltRegistro = q.ToString();


                        querry = from A in OEGeneral.tb_sis_Documento_Tipo_Talonario
                                 where A.IdEmpresa == IdEmpresa
                                 //&& A.PuntoEmision == puntoemision
                                 && A.CodDocumentoTipo == tipodoc &&
                                 A.Establecimiento == establecimiento &&
                                 A.Usado == false &&
                                 A.NumDocumento == UltRegistro
                                 select A;

                        foreach (var item in querry)
                        {
                            Info.IdEmpresa                = item.IdEmpresa;
                            Info.IdSucursal               = item.IdSucursal;
                            Info.CodDocumentoTipo         = item.CodDocumentoTipo;
                            Info.Establecimiento          = item.Establecimiento;
                            Info.Estado                   = item.Estado;
                            Info.FechaCaducidad           = item.FechaCaducidad;
                            Info.NumAutorizacion          = item.NumAutorizacion;
                            Info.NumDocumento             = item.NumDocumento;
                            Info.PuntoEmision             = item.PuntoEmision;
                            Info.Usado                    = item.Usado;
                            Info.es_Documento_electronico = Convert.ToBoolean(item.es_Documento_Electronico);
                        }
                    }
                }
                else
                {
                    q = (from A in OEGeneral.tb_sis_Documento_Tipo_Talonario
                         where A.IdEmpresa == IdEmpresa &&
                         A.PuntoEmision == puntoemision &&
                         A.CodDocumentoTipo == tipodoc &&
                         A.Establecimiento == establecimiento &&
                         A.es_Documento_Electronico == Es_Documento_Electronico &&
                         A.Usado == false &&
                         A.Estado == "A"

                         select A.NumDocumento).Min();
                    if (q != null)
                    {
                        string UltRegistro = q.ToString();


                        querry = from A in OEGeneral.tb_sis_Documento_Tipo_Talonario
                                 where A.IdEmpresa == IdEmpresa &&
                                 A.PuntoEmision == puntoemision &&
                                 A.CodDocumentoTipo == tipodoc &&
                                 A.Establecimiento == establecimiento &&
                                 A.Usado == false &&
                                 A.NumDocumento == UltRegistro
                                 select A;

                        foreach (var item in querry)
                        {
                            Info.IdEmpresa                = item.IdEmpresa;
                            Info.IdSucursal               = item.IdSucursal;
                            Info.CodDocumentoTipo         = item.CodDocumentoTipo;
                            Info.Establecimiento          = item.Establecimiento;
                            Info.Estado                   = item.Estado;
                            Info.FechaCaducidad           = item.FechaCaducidad;
                            Info.NumAutorizacion          = item.NumAutorizacion;
                            Info.NumDocumento             = item.NumDocumento;
                            Info.PuntoEmision             = item.PuntoEmision;
                            Info.Usado                    = item.Usado;
                            Info.es_Documento_electronico = Convert.ToBoolean(item.es_Documento_Electronico);
                        }
                    }
                }



                return(Info);
            }
            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 mensajeErrorLog);
                throw new Exception(ex.ToString());
            }
        }
コード例 #20
0
        public Boolean GrabarDB(tb_Catalogo_Info info, ref string msg, ref int id)
        {
            try
            {
                int idCat;
                int orden;

                using (EntitiesGeneral EDG = new EntitiesGeneral())
                {
                    var codigo = (from per in EDG.tb_Catalogo
                                  where per.CodCatalogo == info.CodCatalogo
                                  select per).Count();
                    if (codigo != 0)
                    {
                        msg = "El Codigo Ingresado Ya Existe Favor Ingrese uno diferente";
                        return(false);
                    }

                    idCat            = GetId();
                    info.IdCatalogo  = idCat;
                    info.CodCatalogo = (info.CodCatalogo == null || info.CodCatalogo == "") ? Convert.ToString(idCat) : info.CodCatalogo;

                    var Q = from per in EDG.tb_Catalogo
                            where per.IdCatalogo == info.IdCatalogo
                            select per;

                    if (Q.ToList().Count == 0)
                    {
                        tb_Catalogo address = new tb_Catalogo();

                        address.IdCatalogo     = info.IdCatalogo;
                        address.CodCatalogo    = info.CodCatalogo;
                        address.IdTipoCatalogo = info.IdTipoCatalogo;

                        orden            = GetOrdenSegunTipo(info.IdTipoCatalogo);
                        address.ca_orden = orden;

                        address.ca_estado      = info.ca_estado;
                        address.ca_descripcion = info.ca_descripcion;

                        EDG.tb_Catalogo.Add(address);
                        EDG.SaveChanges();

                        msg = "El Catálogo #" + address.CodCatalogo + " se grabó Exitosamente";
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            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;
                msg     = "Error al Grabar .." + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #21
0
ファイル: tb_Bodega_Data.cs プロジェクト: arocajorge/ERPFJ
        public List <tb_Bodega_Info> Get_List_Bodega(int idempresa, Cl_Enumeradores.eTipoFiltro TipoCarga = Cl_Enumeradores.eTipoFiltro.Normal)
        {
            try
            {
                List <tb_Bodega_Info> lM        = new List <tb_Bodega_Info>();
                EntitiesGeneral       OEGeneral = new EntitiesGeneral();

                var select_pv = from A in OEGeneral.tb_bodega
                                join B in OEGeneral.tb_sucursal
                                on new { A.IdEmpresa, A.IdSucursal } equals new { B.IdEmpresa, B.IdSucursal }
                where A.IdEmpresa == idempresa
                select new
                {
                    A.IdEmpresa,
                    A.IdBodega,
                    A.IdSucursal,
                    A.cod_bodega,
                    A.bo_Descripcion,
                    A.cod_punto_emision,
                    A.bo_EsBodega,
                    A.bo_manejaFacturacion,
                    A.Estado,
                    B.Su_Descripcion,
                    A.IdCtaCtble_Costo,
                    A.IdCtaCtble_Inve
                };
                if (TipoCarga == Cl_Enumeradores.eTipoFiltro.todos)
                {
                    tb_Bodega_Info info = new tb_Bodega_Info();
                    info.bo_Descripcion  = "Todas";
                    info.bo_Descripcion2 = "Todas";
                    info.IdBodega        = 0;
                    lM.Add(info);
                }
                foreach (var item in select_pv)
                {
                    tb_Bodega_Info info = new tb_Bodega_Info();
                    info.IdEmpresa            = item.IdEmpresa;
                    info.IdBodega             = item.IdBodega;
                    info.IdSucursal           = item.IdSucursal;
                    info.cod_bodega           = item.cod_bodega;
                    info.bo_Descripcion       = item.bo_Descripcion.Trim();
                    info.cod_punto_emision    = item.cod_punto_emision;
                    info.bo_esBodega          = item.bo_EsBodega;
                    info.bo_manejaFacturacion = item.bo_manejaFacturacion;
                    info.Estado      = (item.Estado == "A") ? true : false;
                    info.NomSucursal = item.Su_Descripcion.Trim();

                    info.IdCtaCtble_Inve  = item.IdCtaCtble_Inve;
                    info.IdCtaCtble_Costo = item.IdCtaCtble_Costo;

                    lM.Add(info);
                }
                return(lM);
            }
            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());
            }
        }
コード例 #22
0
        public List <tb_sis_reporte_Info> Get_List_reporte_x_Modulo(List <tb_modulo_Info> lstModulo)
        {
            try
            {
                List <tb_sis_reporte_Info> Lst = new List <tb_sis_reporte_Info>();
                var list = new List <string>();
                foreach (var item in lstModulo)
                {
                    list.Add(item.CodModulo);
                }
                EntitiesGeneral oEnti = new EntitiesGeneral();
                var             Query = from q in oEnti.tb_sis_reporte
                                        where q.se_Muestra_Admin_Reporte == true &&
                                        q.Estado == "A" && (list.Contains(q.Modulo))
                                        select q;


                foreach (var item in Query)
                {
                    tb_sis_reporte_Info Obj = new tb_sis_reporte_Info();
                    Obj.CodReporte               = item.CodReporte;
                    Obj.Nombre                   = item.Nombre;
                    Obj.NombreCorto              = item.NombreCorto;
                    Obj.Modulo                   = item.Modulo;
                    Obj.VistaRpt                 = item.VistaRpt;
                    Obj.Formulario               = item.Formulario;
                    Obj.Orden                    = item.Orden;
                    Obj.Class_NomReporte         = item.Class_NomReporte;
                    Obj.Observacion              = item.Observacion;
                    Obj.imgByt                   = item.imagen;
                    Obj.imagen                   = Funciones.ArrayAImage(item.imagen);
                    Obj.nom_Asembly              = item.nom_Asembly;
                    Obj.Tipo_Balance             = item.Tipo_Balance;
                    Obj.Estado                   = item.Estado;
                    Obj.se_Muestra_Admin_Reporte = Convert.ToBoolean(item.se_Muestra_Admin_Reporte);
                    Obj.VersionActual            = Convert.ToInt32(item.VersionActual);

                    Obj.SQuery = item.SQuery;


                    Obj.Class_Info = item.Class_Info;
                    Obj.Class_Bus  = item.Class_Bus;
                    Obj.Class_Data = item.Class_Data;

                    Obj.Store_proce_rpt = item.Store_proce_rpt;
                    Obj.Disenio_reporte = item.Disenio_reporte;

                    Obj.Se_Muestra_Icono = true;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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());
            }
        }