public Boolean GrabarDB(ro_empleado_x_titulos_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesRoles Context = new EntitiesRoles())
                {
                    var Address = new ro_empleado_x_titulos();

                    int idtitulo = getId(Info.IdEmpresa, Info.IdEmpleado);

                    Address.IdEmpresa     = Info.IdEmpresa;
                    Address.IdEmpleado    = Info.IdEmpleado;
                    Address.Secuencia     = idtitulo;
                    Address.fecha         = Info.fecha;
                    Address.IdInstitucion = Info.IdInstitucion;
                    Address.IdTitulo      = Info.IdTitulo;
                    Address.Observacion   = Info.Observacion;

                    Context.ro_empleado_x_titulos.Add(Address);
                    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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public Boolean getExiste(ro_empleado_x_titulos_Info info)
        {
            try
            {
                Boolean Existe;

                Existe = false;

                EntitiesRoles OERol_Empleado = new EntitiesRoles();

                var select = from A in OERol_Empleado.ro_empleado_x_titulos
                             where A.IdEmpresa == info.IdEmpresa && A.IdEmpleado == info.IdEmpleado &&
                             A.Secuencia == info.Secuencia
                             select A;

                foreach (var item in select)
                {
                    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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
 public ActionResult Modificar(ro_empleado_x_titulos_Info info)
 {
     try
     {
         info.IdEmpresa = GetIdEmpresa();
         if (ModelState.IsValid)
         {
             if (!bus_cargo.modificarDB(info))
             {
                 cargar_combos();
                 return(View(info));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         else
         {
             return(View(info));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        public Boolean ModificarDB(ro_empleado_x_titulos_Info info, ref string msg)
        {
            try
            {
                using (EntitiesRoles context = new EntitiesRoles())
                {
                    var contact = context.ro_empleado_x_titulos.First(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdEmpleado == info.IdEmpleado);

                    contact.fecha         = info.fecha;
                    contact.IdInstitucion = info.IdInstitucion;
                    contact.IdTitulo      = info.IdTitulo;
                    contact.Observacion   = info.Observacion;

                    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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
 public ActionResult Nuevo(ro_empleado_x_titulos_Info info)
 {
     try
     {
         if (ModelState.IsValid)
         {
             info.IdEmpresa = GetIdEmpresa();
             info.IdUsuario = Session["IdUsuario"].ToString();
             if (!bus_cargo.guardarDB(info))
             {
                 cargar_combos();
                 return(View(info));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         else
         {
             return(View(info));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #6
0
 public bool guardarDB(ro_empleado_x_titulos_Info info)
 {
     try
     {
         using (Entities_rrhh Context = new Entities_rrhh())
         {
             ro_empleado_x_titulos Entity = new ro_empleado_x_titulos
             {
                 IdEmpresa     = info.IdEmpresa,
                 IdEmpleado    = info.IdEmpleado,
                 Secuencia     = get_id(info.IdEmpresa, info.IdEmpleado),
                 IdInstitucion = info.IdInstitucion,
                 IdTitulo      = info.IdTitulo,
                 fecha         = info.fecha,
                 Observacion   = info.Observacion,
                 estado        = "A",
                 IdUsuario     = info.IdUsuario,
                 Fecha_Transac = DateTime.Now
             };
             Context.ro_empleado_x_titulos.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #7
0
        public ro_empleado_x_titulos_Info get_info(int IdEmpresa, decimal IdEmpleado, int Secuencia)
        {
            try
            {
                ro_empleado_x_titulos_Info info = new ro_empleado_x_titulos_Info();

                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_x_titulos Entity = Context.ro_empleado_x_titulos.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdEmpleado == IdEmpleado && q.Secuencia == Secuencia);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new ro_empleado_x_titulos_Info
                    {
                        IdEmpresa     = Entity.IdEmpresa,
                        IdEmpleado    = Entity.IdEmpleado,
                        IdInstitucion = Entity.IdInstitucion,
                        IdTitulo      = Entity.IdTitulo,
                        Secuencia     = Entity.Secuencia,
                        fecha         = Entity.fecha,
                        Observacion   = Entity.Observacion
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #8
0
        public bool modificarDB(ro_empleado_x_titulos_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_x_titulos Entity = Context.ro_empleado_x_titulos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdEmpleado == info.IdEmpleado && q.Secuencia == info.Secuencia);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdInstitucion   = info.IdInstitucion;
                    Entity.IdTitulo        = info.IdTitulo;
                    Entity.Observacion     = info.Observacion;
                    Entity.fecha           = info.fecha;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #9
0
        public Boolean GrabarDB(ro_empleado_x_titulos_Info info, ref string msg)
        {
            try
            {
                Boolean valorRetornar = false;

                if (oRo_empleado_x_titulos_Data.getExiste(info))
                {
                    valorRetornar = oRo_empleado_x_titulos_Data.ModificarDB(info, ref msg);
                }
                else
                {
                    valorRetornar = oRo_empleado_x_titulos_Data.GrabarDB(info, ref msg);
                }

                return(valorRetornar);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(ro_empleado_x_titulos_Bus)
                      };
            }
        }
 public bool modificarDB(ro_empleado_x_titulos_Info info)
 {
     try
     {
         return(odata.modificarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public ActionResult Nuevo()
 {
     try
     {
         ro_empleado_x_titulos_Info info = new ro_empleado_x_titulos_Info();
         cargar_combos();
         return(View(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #12
0
 public Boolean AnularDB(ro_empleado_x_titulos_Info info)
 {
     try
     {
         return(oRo_empleado_x_titulos_Data.AnularDB(info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "AnularDB", ex.Message), ex)
               {
                   EntityType = typeof(ro_empleado_x_titulos_Bus)
               };
     }
 }
Пример #13
0
        public List <ro_empleado_x_titulos_Info> Get_List_empleado_x_titulos(int IdEmpresa, decimal IdEmpleado)
        {
            List <ro_empleado_x_titulos_Info> lst = new List <ro_empleado_x_titulos_Info>();
            EntitiesRoles oEnti = new EntitiesRoles();

            try
            {
                var Objeto = from T in oEnti.ro_empleado_x_titulos
                             where T.IdEmpresa == IdEmpresa && T.IdEmpleado == IdEmpleado
                             select T;

                foreach (var item in Objeto)
                {
                    ro_empleado_x_titulos_Info Info = new ro_empleado_x_titulos_Info();

                    Info.IdEmpresa     = item.IdEmpresa;
                    Info.IdEmpleado    = item.IdEmpleado;
                    Info.Secuencia     = item.Secuencia;
                    Info.fecha         = item.fecha;
                    Info.IdInstitucion = item.IdInstitucion;
                    Info.IdTitulo      = item.IdTitulo;
                    Info.Observacion   = item.Observacion;

                    lst.Add(Info);
                }


                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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #14
0
        public List <ro_empleado_x_titulos_Info> Get_List_empleado_x_titulos(int IdEmpresa)
        {
            List <ro_empleado_x_titulos_Info> Lst = new List <ro_empleado_x_titulos_Info>();
            EntitiesRoles oEnti = new EntitiesRoles();

            try
            {
                var Query = from q in oEnti.ro_empleado_x_titulos
                            where q.IdEmpresa == IdEmpresa
                            select q;

                foreach (var item in Query)
                {
                    ro_empleado_x_titulos_Info Obj = new ro_empleado_x_titulos_Info();

                    Obj.IdEmpresa     = item.IdEmpresa;
                    Obj.IdEmpleado    = item.IdEmpleado;
                    Obj.Secuencia     = item.Secuencia;
                    Obj.fecha         = item.fecha;
                    Obj.IdInstitucion = item.IdInstitucion;
                    Obj.IdTitulo      = item.IdTitulo;
                    Obj.Observacion   = item.Observacion;

                    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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #15
0
        public bool anularDB(ro_empleado_x_titulos_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_x_titulos Entity = Context.ro_empleado_x_titulos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdEmpleado == info.IdEmpleado && q.Secuencia == info.Secuencia);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.estado          = "I";
                    Entity.Fecha_UltAnu    = DateTime.Now;
                    Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }