예제 #1
0
        public ActionResult Post(bool IsNew, Detalle_Plan_Actos_de_InvestigacionModel varDetalle_Plan_Actos_de_Investigacion)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.SetAuthHeader(_tokenManager.Token);


                    if (varDetalle_Plan_Actos_de_Investigacion.Archivo_AdjuntoRemoveAttachment != 0 && varDetalle_Plan_Actos_de_Investigacion.Archivo_AdjuntoFile == null)
                    {
                        varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto = 0;
                    }

                    if (varDetalle_Plan_Actos_de_Investigacion.Archivo_AdjuntoFile != null)
                    {
                        var fileAsBytes = HttpPostedFileHelper.GetPostedFileAsBytes(varDetalle_Plan_Actos_de_Investigacion.Archivo_AdjuntoFile);
                        _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token);
                        varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto = (int)_ISpartane_FileApiConsumer.Insert(new Spartane_File()
                        {
                            File        = fileAsBytes,
                            Description = varDetalle_Plan_Actos_de_Investigacion.Archivo_AdjuntoFile.FileName,
                            File_Size   = fileAsBytes.Length
                        }).Resource;
                    }


                    var result = "";
                    var Detalle_Plan_Actos_de_InvestigacionInfo = new Detalle_Plan_Actos_de_Investigacion
                    {
                        Clave                        = varDetalle_Plan_Actos_de_Investigacion.Clave
                        , Categoria                  = varDetalle_Plan_Actos_de_Investigacion.Categoria
                        , Servicio_a_Solicitar       = varDetalle_Plan_Actos_de_Investigacion.Servicio_a_Solicitar
                        , Hecho_Delictivo_Acreditado = varDetalle_Plan_Actos_de_Investigacion.Hecho_Delictivo_Acreditado
                        , Tiempo_Estandar            = varDetalle_Plan_Actos_de_Investigacion.Tiempo_Estandar
                        , Ponderacion                = varDetalle_Plan_Actos_de_Investigacion.Ponderacion
                        , Fecha_Contestacion         = (!String.IsNullOrEmpty(varDetalle_Plan_Actos_de_Investigacion.Fecha_Contestacion)) ? DateTime.ParseExact(varDetalle_Plan_Actos_de_Investigacion.Fecha_Contestacion, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null
                        , Hora_Contestacion          = varDetalle_Plan_Actos_de_Investigacion.Hora_Contestacion
                        , Contestacion               = varDetalle_Plan_Actos_de_Investigacion.Contestacion
                        , Archivo_Adjunto            = (varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto.HasValue && varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto != 0) ? ((int?)Convert.ToInt32(varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto.Value)) : null

                        , Usuario_que_Contesta = varDetalle_Plan_Actos_de_Investigacion.Usuario_que_Contesta
                    };

                    result = !IsNew?
                             _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.Update(Detalle_Plan_Actos_de_InvestigacionInfo, null, null).Resource.ToString() :
                                 _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.Insert(Detalle_Plan_Actos_de_InvestigacionInfo, null, null).Resource.ToString();

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
예제 #2
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45479);

            ViewBag.Permission = permission;
            var varDetalle_Plan_Actos_de_Investigacion = new Detalle_Plan_Actos_de_InvestigacionModel();

            ViewBag.ObjectId  = "45479";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Plan_Actos_de_InvestigacionData = _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Plan_Actos_de_Investigacions[0];
                if (Detalle_Plan_Actos_de_InvestigacionData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Plan_Actos_de_Investigacion = new Detalle_Plan_Actos_de_InvestigacionModel
                {
                    Clave                          = (int)Detalle_Plan_Actos_de_InvestigacionData.Clave
                    , Categoria                    = Detalle_Plan_Actos_de_InvestigacionData.Categoria
                    , CategoriaDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_Plan_Actos_de_InvestigacionData.Categoria), "Categoria_de_Servicio_de_Apoyo") ?? (string)Detalle_Plan_Actos_de_InvestigacionData.Categoria_Categoria_de_Servicio_de_Apoyo.Descripcion
                    , Servicio_a_Solicitar         = Detalle_Plan_Actos_de_InvestigacionData.Servicio_a_Solicitar
                    , Servicio_a_SolicitarServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_Plan_Actos_de_InvestigacionData.Servicio_a_Solicitar), "Tipo_de_Servicio_de_Apoyo") ?? (string)Detalle_Plan_Actos_de_InvestigacionData.Servicio_a_Solicitar_Tipo_de_Servicio_de_Apoyo.Servicio
                    , Hecho_Delictivo_Acreditado   = Detalle_Plan_Actos_de_InvestigacionData.Hecho_Delictivo_Acreditado
                    , Tiempo_Estandar              = Detalle_Plan_Actos_de_InvestigacionData.Tiempo_Estandar
                    , Ponderacion                  = Detalle_Plan_Actos_de_InvestigacionData.Ponderacion
                    , Fecha_Contestacion           = (Detalle_Plan_Actos_de_InvestigacionData.Fecha_Contestacion == null ? string.Empty : Convert.ToDateTime(Detalle_Plan_Actos_de_InvestigacionData.Fecha_Contestacion).ToString(ConfigurationProperty.DateFormat))
                    , Hora_Contestacion            = Detalle_Plan_Actos_de_InvestigacionData.Hora_Contestacion
                    , Contestacion                 = Detalle_Plan_Actos_de_InvestigacionData.Contestacion
                    , Archivo_Adjunto              = Detalle_Plan_Actos_de_InvestigacionData.Archivo_Adjunto
                    , Usuario_que_Contesta         = Detalle_Plan_Actos_de_InvestigacionData.Usuario_que_Contesta
                    , Usuario_que_ContestaName     = CultureHelper.GetTraduction(Convert.ToString(Detalle_Plan_Actos_de_InvestigacionData.Usuario_que_Contesta), "Spartan_User") ?? (string)Detalle_Plan_Actos_de_InvestigacionData.Usuario_que_Contesta_Spartan_User.Name
                };
                _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token);
                ViewBag.Archivo_AdjuntoSpartane_File = _ISpartane_FileApiConsumer.GetByKey(varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto).Resource;
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICategoria_de_Servicio_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Categoria_de_Servicio_de_Apoyos_Categoria = _ICategoria_de_Servicio_de_ApoyoApiConsumer.SelAll(true);

            if (Categoria_de_Servicio_de_Apoyos_Categoria != null && Categoria_de_Servicio_de_Apoyos_Categoria.Resource != null)
            {
                ViewBag.Categoria_de_Servicio_de_Apoyos_Categoria = Categoria_de_Servicio_de_Apoyos_Categoria.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Categoria_de_Servicio_de_Apoyo", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _ITipo_de_Servicio_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar = _ITipo_de_Servicio_de_ApoyoApiConsumer.SelAll(true);

            if (Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar != null && Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar.Resource != null)
            {
                ViewBag.Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar = Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Servicio_de_Apoyo", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Plan_Actos_de_Investigacion));
        }
예제 #3
0
        public ActionResult AddDetalle_Plan_Actos_de_Investigacion(int rowIndex = 0, int functionMode = 0, int id = 0)
        {
            int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;

            ViewBag.currentRowIndex = rowIndex;
            ViewBag.functionMode    = functionMode;
            ViewBag.Consult         = false;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45479);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Plan_Actos_de_InvestigacionModel varDetalle_Plan_Actos_de_Investigacion = new Detalle_Plan_Actos_de_InvestigacionModel();


            if (id.ToString() != "0")
            {
                var Detalle_Plan_Actos_de_InvestigacionsData = _IDetalle_Plan_Actos_de_InvestigacionApiConsumer.ListaSelAll(0, 1000, "Detalle_Plan_Actos_de_Investigacion.Clave=" + id, "").Resource.Detalle_Plan_Actos_de_Investigacions;

                if (Detalle_Plan_Actos_de_InvestigacionsData != null && Detalle_Plan_Actos_de_InvestigacionsData.Count > 0)
                {
                    var Detalle_Plan_Actos_de_InvestigacionData = Detalle_Plan_Actos_de_InvestigacionsData.First();
                    varDetalle_Plan_Actos_de_Investigacion = new Detalle_Plan_Actos_de_InvestigacionModel
                    {
                        Clave                          = Detalle_Plan_Actos_de_InvestigacionData.Clave
                        , Categoria                    = Detalle_Plan_Actos_de_InvestigacionData.Categoria
                        , CategoriaDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_Plan_Actos_de_InvestigacionData.Categoria), "Categoria_de_Servicio_de_Apoyo") ?? (string)Detalle_Plan_Actos_de_InvestigacionData.Categoria_Categoria_de_Servicio_de_Apoyo.Descripcion
                        , Servicio_a_Solicitar         = Detalle_Plan_Actos_de_InvestigacionData.Servicio_a_Solicitar
                        , Servicio_a_SolicitarServicio = CultureHelper.GetTraduction(Convert.ToString(Detalle_Plan_Actos_de_InvestigacionData.Servicio_a_Solicitar), "Tipo_de_Servicio_de_Apoyo") ?? (string)Detalle_Plan_Actos_de_InvestigacionData.Servicio_a_Solicitar_Tipo_de_Servicio_de_Apoyo.Servicio
                        , Hecho_Delictivo_Acreditado   = Detalle_Plan_Actos_de_InvestigacionData.Hecho_Delictivo_Acreditado
                        , Tiempo_Estandar              = Detalle_Plan_Actos_de_InvestigacionData.Tiempo_Estandar
                        , Ponderacion                  = Detalle_Plan_Actos_de_InvestigacionData.Ponderacion
                        , Fecha_Contestacion           = (Detalle_Plan_Actos_de_InvestigacionData.Fecha_Contestacion == null ? string.Empty : Convert.ToDateTime(Detalle_Plan_Actos_de_InvestigacionData.Fecha_Contestacion).ToString(ConfigurationProperty.DateFormat))
                        , Hora_Contestacion            = Detalle_Plan_Actos_de_InvestigacionData.Hora_Contestacion
                        , Contestacion                 = Detalle_Plan_Actos_de_InvestigacionData.Contestacion
                        , Archivo_Adjunto              = Detalle_Plan_Actos_de_InvestigacionData.Archivo_Adjunto
                        , Usuario_que_Contesta         = Detalle_Plan_Actos_de_InvestigacionData.Usuario_que_Contesta
                        , Usuario_que_ContestaName     = CultureHelper.GetTraduction(Convert.ToString(Detalle_Plan_Actos_de_InvestigacionData.Usuario_que_Contesta), "Spartan_User") ?? (string)Detalle_Plan_Actos_de_InvestigacionData.Usuario_que_Contesta_Spartan_User.Name
                    };
                }
                _ISpartane_FileApiConsumer.SetAuthHeader(_tokenManager.Token);
                ViewBag.Archivo_AdjuntoSpartane_File = _ISpartane_FileApiConsumer.GetByKey(varDetalle_Plan_Actos_de_Investigacion.Archivo_Adjunto).Resource;
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICategoria_de_Servicio_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Categoria_de_Servicio_de_Apoyos_Categoria = _ICategoria_de_Servicio_de_ApoyoApiConsumer.SelAll(true);

            if (Categoria_de_Servicio_de_Apoyos_Categoria != null && Categoria_de_Servicio_de_Apoyos_Categoria.Resource != null)
            {
                ViewBag.Categoria_de_Servicio_de_Apoyos_Categoria = Categoria_de_Servicio_de_Apoyos_Categoria.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Categoria_de_Servicio_de_Apoyo", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _ITipo_de_Servicio_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar = _ITipo_de_Servicio_de_ApoyoApiConsumer.SelAll(true);

            if (Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar != null && Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar.Resource != null)
            {
                ViewBag.Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar = Tipo_de_Servicio_de_Apoyos_Servicio_a_Solicitar.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Servicio_de_Apoyo", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            return(PartialView("AddDetalle_Plan_Actos_de_Investigacion", varDetalle_Plan_Actos_de_Investigacion));
        }