コード例 #1
0
ファイル: PersonalController.cs プロジェクト: LuisAP/Artex
        public ActionResult Crear()
        {
            EmpleadoModel model = new EmpleadoModel();

            try
            {
                EmpleadoDAO CLDAO = new EmpleadoDAO();


                model.activo = true;

                model.paisList        = PaisDAO.GetAlls(db);
                model.pais            = model.paisList.FirstOrDefault(m => m.NOMBRE.Contains("Mex")).ID;
                model.estadoList      = EstadoDAO.GetByIdPais((int)model.pais, db);
                model.estado          = model.estadoList.FirstOrDefault(m => m.NOMBRE.Contains("Jalis")).ID;
                model.areaTrabajoList = AreaTrabajoDAO.GetAlls(db);
                model.sucursalList    = db.tienda;
            }
            catch (Exception e)
            {
                LogUtil.ExceptionLog(e);
            }
            ViewBag.Editar = true;
            return(View(CREAR_EDITAR_ABSOLUTE_PATH, model));
        }
コード例 #2
0
ファイル: PersonalController.cs プロジェクト: LuisAP/Artex
        public EmpleadoModel copiarEntidadmodelo(ref EmpleadoModel model, ref empleado entity)
        {
            model.idPersona = entity.ID_PERSONA_FISICA;
            model.id        = entity.ID;

            model.areaTrabajo     = entity.ID_AREA_TRABAJO != null ? (int)entity.ID_AREA_TRABAJO : entity.ID_AREA_TRABAJO;
            model.areaTrabajoList = AreaTrabajoDAO.GetAlls(db);
            model.sucursalList    = db.tienda;
            model.puesto          = entity.PUESTO;
            model.fechaIngreso    = entity.FECHA_INGRESO != null?ExtensionMethods.DateFormat((DateTime)entity.FECHA_INGRESO) : null;

            model.fechaBaja = entity.FECHA_BAJA != null?ExtensionMethods.DateFormat((DateTime)entity.FECHA_BAJA) : null;

            model.nss           = entity.IMSS;
            model.salario       = ExtensionMethods.ToMoneyFormat(entity.SALARIO);
            model.correoEmpresa = entity.EMAIL;
            model.activo        = entity.ACTIVO;

            model.sucursal = entity.tienda.Count > 0 ? entity.tienda.FirstOrDefault().ID:0;

            PersonaFisicaDAO personaFisicaDAO = new PersonaFisicaDAO();
            var persona = personaFisicaDAO.GetById(entity.ID_PERSONA_FISICA);

            model.nombre          = persona.NOMBRE;
            model.apellidoPaterno = persona.APELLIDO_PATERNO;
            model.apellidoMaterno = persona.APELLIDO_MATERNO;
            model.fechaNacimiento = persona.FECHA_NACIMIENTO != null?ExtensionMethods.DateFormat((DateTime)persona.FECHA_NACIMIENTO) : null;

            model.curp     = persona.CURP;
            model.rfc      = persona.RFC;
            model.sexo     = persona.SEXO;
            model.correo   = persona.EMAIL;
            model.telefono = persona.TELEFONO;
            model.celular  = persona.CELULAR;

            DireccionDAO direccionDAO = new DireccionDAO();
            var          direccion    = direccionDAO.GetById((int)persona.ID_DIRECCION);

            model.calle        = direccion.CALLE;
            model.numInterior  = direccion.NUM_INTERIOR;
            model.numExterior  = direccion.NUM_EXTERIOR;
            model.colonia      = direccion.COLONIA;
            model.ciudad       = direccion.CIUDAD;
            model.municipio    = direccion.MUNICIPIO;
            model.codigoPostal = direccion.CP;
            model.estado       = direccion.ID_ESTADO;
            model.pais         = direccion.ID_PAIS;
            model.paisList     = PaisDAO.GetAlls(db);
            model.estadoList   = EstadoDAO.GetByIdPais((int)model.pais, db);



            return(model);
        }
コード例 #3
0
        public JsonResult GetById(int id)
        {
            AreaTrabajoDAO dao = new AreaTrabajoDAO();
            area_trabajo   c   = dao.GetById(id);

            var jsnResult = new
            {
                ID          = c.ID,
                NOMBRE      = c.NOMBRE,
                DESCRIPCION = c.DESCRIPCION,
                ACTIVO      = c.ACTIVO,
                Success     = true
            };

            return(Json(jsnResult, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public JsonResult Delete(int id)
        {
            var rm = new ResponseModel();


            AreaTrabajoDAO dao = new AreaTrabajoDAO();

            rm.response = dao.DeleteById(id);

            if (rm.response)
            {
                rm.message = "El registro  se elimino correctamente";
            }

            return(Json(rm, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public JsonResult Guardar(AreaTrabajoModel model)
        {
            var rm = new ResponseModel();

            if (!ModelState.IsValid)
            {
                rm.message  = "Hubo un problema verifique sus datos e intente de nuevo.";
                rm.message += ExtensionMethods.GetAllErrorsFromModelState(this);
                return(Json(rm, JsonRequestBehavior.AllowGet));
            }


            using (ArtexConnection db = new ArtexConnection())
            {
                AreaTrabajoDAO dao    = new AreaTrabajoDAO();
                var            entity = dao.GetById(model.Id, db);

                if (entity == null)
                {
                    entity             = new area_trabajo();
                    entity.NOMBRE      = model.Nombre;
                    entity.DESCRIPCION = model.Descripcion;
                    entity.ACTIVO      = model.Activo;

                    db.area_trabajo.Add(entity);
                }
                else
                {
                    entity.NOMBRE      = model.Nombre;
                    entity.DESCRIPCION = model.Descripcion;
                    entity.ACTIVO      = model.Activo;
                }

                if (db.SaveChanges() > 0 || db.Entry(entity).State == EntityState.Unchanged)
                {
                    rm.response = true;
                    rm.message  = "Sus datos se guardaron correctamente";
                    rm.function = "reload(true,'" + rm.message + "')";
                }
            }


            return(Json(rm, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public ActionResult GetAlls()
        {
            List <area_trabajo> consulta = AreaTrabajoDAO.GetAlls();

            var jsonData = new
            {
                rows = (
                    from c in consulta
                    select new
                {
                    ID = c.ID,
                    NOMBRE = c.NOMBRE,
                    DESCRIPCION = c.DESCRIPCION,
                    ACTIVO = c.ACTIVO
                }).ToArray()
            };

            return(Json(jsonData.rows, JsonRequestBehavior.AllowGet));
        }