Esempio n. 1
0
        public ro_EmpleadoNovedadCargaMasiva_Info get_info(int IdEmpresa, decimal IdCarga)
        {
            try
            {
                ro_EmpleadoNovedadCargaMasiva_Info info = new ro_EmpleadoNovedadCargaMasiva_Info();

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

                    info = new ro_EmpleadoNovedadCargaMasiva_Info
                    {
                        IdEmpresa    = Entity.IdEmpresa,
                        IdCarga      = Entity.IdCarga,
                        IdRubro      = Entity.IdRubro,
                        FechaCarga   = Entity.FechaCarga,
                        Estado       = Entity.Estado,
                        Observacion  = Entity.Observacion,
                        IdNomina     = Entity.IdNomina,
                        IdNominaTipo = Entity.IdNominaTipo,
                        IdSucursal   = Entity.IdSucursal,
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult Anular(int IdEmpresa = 0, decimal IdCarga = 0)
        {
            #region Validar Session
            if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
            {
                return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
            }
            SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
            SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
            #endregion

            ro_EmpleadoNovedadCargaMasiva_Info model = bus_novedad.get_info(IdEmpresa, IdCarga);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            model.detalle = bus_novedad_detalle_bus.get_list(IdEmpresa, IdCarga);
            detalle.set_list(model.detalle, model.IdTransaccionSession);

            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.FechaCarga, cl_enumeradores.eModulo.RRHH, 0, ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }
            #endregion

            cargar_combos();
            return(View(model));
        }
        public ActionResult Nuevo()
        {
            #region Validar Session
            if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
            {
                return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
            }
            SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
            SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
            #endregion

            empleado_info_list.set_list(bus_empleado.get_list_combo(Convert.ToInt32(SessionFixed.IdEmpresa)), Convert.ToDecimal(SessionFixed.IdTransaccionSession));

            ro_EmpleadoNovedadCargaMasiva_Info model = new ro_EmpleadoNovedadCargaMasiva_Info
            {
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa),
                FechaCarga           = DateTime.Now,
                IdNomina             = 1,
                IdNominaTipo         = 2,
                IdSucursal           = Convert.ToInt32(SessionFixed.IdSucursal),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)
            };
            model.detalle = new List <ro_EmpleadoNovedadCargaMasiva_det_Info>();
            detalle.set_list(model.detalle, model.IdTransaccionSession);
            cargar_combos();
            return(View(model));
        }
        public ActionResult GridViewPartial_importacion_novedades_det()
        {
            ro_EmpleadoNovedadCargaMasiva_Info modelReturn = new ro_EmpleadoNovedadCargaMasiva_Info();

            modelReturn.detalle = detalle.get_list();
            return(PartialView("_GridViewPartial_importacion_novedades_det", modelReturn));
        }
        public ActionResult EditingDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ro_EmpleadoNovedadCargaMasiva_det_Info info_det)
        {
            detalle.DeleteRow(info_det.Secuancia);
            ro_EmpleadoNovedadCargaMasiva_Info model = new ro_EmpleadoNovedadCargaMasiva_Info();

            model.detalle = detalle.get_list();
            return(PartialView("_GridViewPartial_importacion_novedades_det", model));
        }
        public ActionResult GridViewPartial_importacion_novedades_det()
        {
            ro_EmpleadoNovedadCargaMasiva_Info modelReturn = new ro_EmpleadoNovedadCargaMasiva_Info();

            SessionFixed.IdTransaccionSessionActual = Request.Params["TransaccionFixed"] != null ? Request.Params["TransaccionFixed"].ToString() : SessionFixed.IdTransaccionSessionActual;

            modelReturn.detalle = detalle.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            return(PartialView("_GridViewPartial_importacion_novedades_det", modelReturn));
        }
 public bool AnularDB(ro_EmpleadoNovedadCargaMasiva_Info info)
 {
     try
     {
         return(odata.AnularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ro_EmpleadoNovedadCargaMasiva_det_Info info_det)
        {
            if (ModelState.IsValid)
            {
                detalle.UpdateRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            }
            ro_EmpleadoNovedadCargaMasiva_Info model = new ro_EmpleadoNovedadCargaMasiva_Info();

            model.detalle = detalle.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            return(PartialView("_GridViewPartial_importacion_novedades_det", model));
        }
 public ActionResult Anular(ro_EmpleadoNovedadCargaMasiva_Info model)
 {
     model.detalle         = detalle.get_list(model.IdTransaccionSession);
     model.IdUsuarioUltAnu = SessionFixed.IdUsuario;
     model.Fecha_UltAnu    = DateTime.Now;
     if (!bus_novedad.AnularDB(model))
     {
         SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString();
         cargar_combos();
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Anular(decimal IdCarga)
        {
            int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
            ro_EmpleadoNovedadCargaMasiva_Info model = bus_novedad.get_info(IdEmpresa, IdCarga);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.detalle = bus_novedad_detalle_bus.get_list(IdEmpresa, IdCarga);
            detalle.set_list(model.detalle);
            cargar_combos();
            return(View(model));
        }
        public ActionResult Anular(ro_EmpleadoNovedadCargaMasiva_Info model)
        {
            model.detalle = detalle.get_list();

            model.IdEmpresa       = Convert.ToInt32(SessionFixed.IdEmpresa);
            model.IdUsuarioUltAnu = SessionFixed.IdUsuario;
            model.Fecha_UltAnu    = DateTime.Now;
            if (!bus_novedad.AnularDB(model))
            {
                cargar_combos();
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
 public bool GuardarDB(ro_EmpleadoNovedadCargaMasiva_Info info)
 {
     try
     {
         return(odata.GuardarDB(info));
     }
     catch (Exception ex)
     {
         tb_LogError_Bus LogData = new tb_LogError_Bus();
         LogData.GuardarDB(new tb_LogError_Info {
             Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "ro_EmpleadoNovedadCargaMasiva_Bus", Metodo = "GuardarDB", IdUsuario = info.IdUsuario
         });
         return(false);
     }
 }
        public ActionResult Nuevo()
        {
            empleado_info_list.set_list(bus_empleado.get_list_combo(Convert.ToInt32(SessionFixed.IdEmpresa)));

            ro_EmpleadoNovedadCargaMasiva_Info model = new ro_EmpleadoNovedadCargaMasiva_Info
            {
                IdEmpresa    = Convert.ToInt32(SessionFixed.IdEmpresa),
                FechaCarga   = DateTime.Now,
                IdNomina     = 1,
                IdNominaTipo = 2,
                IdSucursal   = Convert.ToInt32(SessionFixed.IdSucursal),
            };

            model.detalle = new List <ro_EmpleadoNovedadCargaMasiva_det_Info>();
            detalle.set_list(model.detalle);
            cargar_combos();
            return(View(model));
        }
Esempio n. 14
0
        public bool AnularDB(ro_EmpleadoNovedadCargaMasiva_Info info)
        {
            try
            {
                ro_EmpleadoNovedadCargaMasiva_det_Data oda_det = new ro_EmpleadoNovedadCargaMasiva_det_Data();
                var lista = oda_det.get_list(info.IdEmpresa, info.IdCarga);
                using (Entities_rrhh contex = new Entities_rrhh())
                {
                    foreach (var item in lista)
                    {
                        ro_empleado_Novedad entity_det = contex.ro_empleado_Novedad.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdEmpleado == item.IdEmpleado && q.IdNovedad == item.IdNovedad);
                        if (entity_det != null)
                        {
                            entity_det.Estado          = "I";
                            entity_det.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                            entity_det.Fecha_UltAnu    = DateTime.Now;
                            contex.SaveChanges();
                        }
                    }
                }

                using (Entities_rrhh contex = new Entities_rrhh())
                {
                    ro_EmpleadoNovedadCargaMasiva entity = contex.ro_EmpleadoNovedadCargaMasiva.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdCarga == info.IdCarga);

                    if (entity == null)
                    {
                        return(false);
                    }
                    entity.Fecha_UltAnu    = info.Fecha_UltAnu = DateTime.Now;
                    entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    entity.Estado          = false;
                    contex.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult Nuevo(ro_EmpleadoNovedadCargaMasiva_Info model)
        {
            model.detalle = detalle.get_list();
            if (model.detalle == null || model.detalle.Count() == 0)
            {
                ViewBag.mensaje = "No existe detalle para la novedad";
                cargar_combos();
                return(View(model));
            }



            model.IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
            model.IdUsuario = SessionFixed.IdUsuario;
            if (!bus_novedad.GuardarDB(model))
            {
                cargar_combos();
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Anular(decimal IdCarga)
        {
            int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
            ro_EmpleadoNovedadCargaMasiva_Info model = bus_novedad.get_info(IdEmpresa, IdCarga);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.detalle = bus_novedad_detalle_bus.get_list(IdEmpresa, IdCarga);
            detalle.set_list(model.detalle);

            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.FechaCarga, cl_enumeradores.eModulo.RRHH, 0, ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }
            #endregion

            cargar_combos();
            return(View(model));
        }
Esempio n. 17
0
        public bool GuardarDB(ro_EmpleadoNovedadCargaMasiva_Info info)
        {
            try
            {
                decimal IdNovedad = odata_novedad.get_id(info.IdEmpresa);


                using (Entities_rrhh Contex = new Entities_rrhh())
                {
                    ro_EmpleadoNovedadCargaMasiva entity = new ro_EmpleadoNovedadCargaMasiva
                    {
                        IdEmpresa     = info.IdEmpresa,
                        IdCarga       = info.IdCarga = Get_id(info.IdEmpresa),
                        FechaCarga    = info.FechaCarga.Date,
                        Observacion   = info.Observacion,
                        IdNomina      = info.IdNomina,
                        IdNominaTipo  = info.IdNominaTipo,
                        IdSucursal    = info.IdSucursal,
                        IdRubro       = info.IdRubro,
                        IdUsuario     = info.IdUsuario,
                        Fecha_Transac = DateTime.Now,
                        Estado        = true
                    };
                    Contex.ro_EmpleadoNovedadCargaMasiva.Add(entity);

                    foreach (var item in info.detalle)
                    {
                        ro_empleado_Novedad Entity = new ro_empleado_Novedad
                        {
                            IdEmpresa          = info.IdEmpresa,
                            IdSucursal         = info.IdSucursal,
                            IdNovedad          = item.IdNovedad = IdNovedad,
                            IdNomina_Tipo      = info.IdNomina,
                            IdNomina_TipoLiqui = info.IdNominaTipo,
                            IdEmpleado         = item.IdEmpleado,
                            Fecha = info.FechaCarga.Date,

                            Observacion   = info.Observacion == null?"":info.Observacion,
                            Estado        = "A",
                            IdUsuario     = info.IdUsuario,
                            Fecha_Transac = info.Fecha_Transac = DateTime.Now
                        };
                        Contex.ro_empleado_Novedad.Add(Entity);

                        ro_empleado_novedad_det Entity_det = new ro_empleado_novedad_det
                        {
                            IdEmpresa     = info.IdEmpresa,
                            IdNovedad     = item.IdNovedad,
                            FechaPago     = info.FechaCarga.Date,
                            IdRubro       = info.IdRubro,
                            Valor         = item.Valor,
                            Observacion   = item.Observacion,
                            EstadoCobro   = "PEN",
                            Secuencia     = 1,
                            CantidadHoras = item.CantidadHoras
                        };
                        Contex.ro_empleado_novedad_det.Add(Entity_det);

                        ro_EmpleadoNovedadCargaMasiva_det Entity_det_ = new ro_EmpleadoNovedadCargaMasiva_det
                        {
                            IdEmpresa     = info.IdEmpresa,
                            IdCarga       = info.IdCarga,
                            IdNovedad     = item.IdNovedad,
                            IdEmpleado    = item.IdEmpleado,
                            Observacion   = item.Observacion,
                            Secuencia     = item.Secuancia,
                            IdEmpresa_nov = info.IdEmpresa
                        };
                        Contex.ro_EmpleadoNovedadCargaMasiva_det.Add(Entity_det_);
                        IdNovedad++;
                    }
                    Contex.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }