Exemplo n.º 1
0
 public ct_punto_cargo_Info GetInfo(int IdEmpresa, int IdPunto_cargo)
 {
     try
     {
         ct_punto_cargo_Info info = new ct_punto_cargo_Info();
         using (Entities_contabilidad Context = new Entities_contabilidad())
         {
             ct_punto_cargo Entity = Context.ct_punto_cargo.Where(q => q.IdEmpresa == IdEmpresa && q.IdPunto_cargo == IdPunto_cargo).FirstOrDefault();
             if (Entity == null)
             {
                 return(null);
             }
             info = new ct_punto_cargo_Info
             {
                 IdEmpresa           = Entity.IdEmpresa,
                 IdPunto_cargo_grupo = Entity.IdPunto_cargo_grupo,
                 cod_punto_cargo     = Entity.cod_punto_cargo,
                 IdPunto_cargo       = Entity.IdPunto_cargo,
                 nom_punto_cargo     = Entity.nom_punto_cargo,
                 Estado = Entity.Estado
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public bool guardarDB(ct_punto_cargo_Info info)
 {
     try
     {
         using (Entities_contabilidad Context = new Entities_contabilidad())
         {
             ct_punto_cargo Entity = new ct_punto_cargo
             {
                 IdEmpresa           = info.IdEmpresa,
                 IdPunto_cargo       = info.IdPunto_cargo = get_id(info.IdEmpresa),
                 IdPunto_cargo_grupo = info.IdPunto_cargo_grupo,
                 codPunto_cargo      = info.codPunto_cargo,
                 nom_punto_cargo     = info.nom_punto_cargo,
                 Estado = info.Estado = "A"
             };
             Context.ct_punto_cargo.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
        public bool anularDB(ct_punto_cargo_Info info)
        {
            try
            {
                using (Entities_contabilidad Context = new Entities_contabilidad())
                {
                    ct_punto_cargo Entity = Context.ct_punto_cargo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdPunto_cargo == info.IdPunto_cargo);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.Estado = info.Estado = "I";

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public Boolean GuardarDB(ct_punto_cargo_Info Info, int IdEmpresa)
        {
            try
            {
                using (EntitiesDBConta oEnti = new EntitiesDBConta())
                {
                    var consulta = from q in oEnti.ct_punto_cargo
                                   where q.IdEmpresa == IdEmpresa && q.IdPunto_cargo == Info.IdPunto_cargo
                                   select q;

                    if (consulta.ToList().Count == 0)
                    {
                        var registo = new ct_punto_cargo();

                        registo.IdEmpresa           = IdEmpresa;
                        registo.IdPunto_cargo       = Info.IdPunto_cargo = GetIdPunto_Cargo(IdEmpresa);
                        registo.codPunto_cargo      = (Info.codPunto_cargo == "" || Info.codPunto_cargo == "0" || Info.codPunto_cargo == null) ? Convert.ToString(Info.IdPunto_cargo) : Info.codPunto_cargo;
                        registo.nom_punto_cargo     = Info.nom_punto_cargo;
                        registo.IdPunto_cargo_grupo = Info.IdPunto_cargo_grupo == 0 ? null : Info.IdPunto_cargo_grupo;
                        registo.Estado = Info.Estado;

                        oEnti.ct_punto_cargo.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();
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 5
0
 public bool ModificarDB(ct_punto_cargo_Info info)
 {
     try
     {
         using (Entities_contabilidad Context = new Entities_contabilidad())
         {
             ct_punto_cargo Entity = Context.ct_punto_cargo.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdPunto_cargo_grupo == info.IdPunto_cargo_grupo && q.IdPunto_cargo == info.IdPunto_cargo).FirstOrDefault();
             if (Entity == null)
             {
                 return(false);
             }
             Entity.nom_punto_cargo       = info.nom_punto_cargo;
             Entity.cod_punto_cargo       = info.cod_punto_cargo;
             Entity.IdUsuarioModificacion = info.IdUsuarioModificacion;
             Entity.FechaModificacion     = DateTime.Now;
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }