Пример #1
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, 43968);

            ViewBag.Permission = permission;
            var varDetalle_de_Ingredientes = new Detalle_de_IngredientesModel();

            ViewBag.ObjectId  = "43968";
            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_de_IngredientesApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_IngredientesData = _IDetalle_de_IngredientesApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Ingredientess[0];
                if (Detalle_de_IngredientesData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Ingredientes = new Detalle_de_IngredientesModel
                {
                    Clave                    = (int)Detalle_de_IngredientesData.Clave
                    , Cantidad               = Detalle_de_IngredientesData.Cantidad
                    , Unidad                 = Detalle_de_IngredientesData.Unidad
                    , UnidadUnidad           = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IngredientesData.Unidad), "Unidades_de_Medida") ?? (string)Detalle_de_IngredientesData.Unidad_Unidades_de_Medida.Unidad
                    , Nombre_del_Ingrediente = Detalle_de_IngredientesData.Nombre_del_Ingrediente
                    , Nombre_del_IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IngredientesData.Nombre_del_Ingrediente), "Ingredientes") ?? (string)Detalle_de_IngredientesData.Nombre_del_Ingrediente_Ingredientes.Nombre_Ingrediente
                    , Nombre_de_presentacion            = Detalle_de_IngredientesData.Nombre_de_presentacion
                    , Nombre_de_presentacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IngredientesData.Nombre_de_presentacion), "Presentacion") ?? (string)Detalle_de_IngredientesData.Nombre_de_presentacion_Presentacion.Descripcion
                    , Nombre_de_Marca            = Detalle_de_IngredientesData.Nombre_de_Marca
                    , Nombre_de_MarcaDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_IngredientesData.Nombre_de_Marca), "Marca") ?? (string)Detalle_de_IngredientesData.Nombre_de_Marca_Marca.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IUnidades_de_MedidaApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Unidades_de_Medidas_Unidad = _IUnidades_de_MedidaApiConsumer.SelAll(true);

            if (Unidades_de_Medidas_Unidad != null && Unidades_de_Medidas_Unidad.Resource != null)
            {
                ViewBag.Unidades_de_Medidas_Unidad = Unidades_de_Medidas_Unidad.Resource.Where(m => m.Unidad != null).OrderBy(m => m.Unidad).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Unidades_de_Medida", "Unidad") ?? m.Unidad.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Ingredientess_Nombre_del_Ingrediente = _IIngredientesApiConsumer.SelAll(true);

            if (Ingredientess_Nombre_del_Ingrediente != null && Ingredientess_Nombre_del_Ingrediente.Resource != null)
            {
                ViewBag.Ingredientess_Nombre_del_Ingrediente = Ingredientess_Nombre_del_Ingrediente.Resource.Where(m => m.Nombre_Ingrediente != null).OrderBy(m => m.Nombre_Ingrediente).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Ingredientes", "Nombre_Ingrediente") ?? m.Nombre_Ingrediente.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IPresentacionApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Presentacions_Nombre_de_presentacion = _IPresentacionApiConsumer.SelAll(true);

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

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_de_Ingredientes));
        }
        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, 44723);

            ViewBag.Permission = permission;
            var varMR_Detalle_Platillo = new MR_Detalle_PlatilloModel();

            ViewBag.ObjectId  = "44723";
            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));
                }
                _IMR_Detalle_PlatilloApiConsumer.SetAuthHeader(_tokenManager.Token);
                var MR_Detalle_PlatilloData = _IMR_Detalle_PlatilloApiConsumer.GetByKeyComplete(Id).Resource.MR_Detalle_Platillos[0];
                if (MR_Detalle_PlatilloData == null)
                {
                    return(HttpNotFound());
                }

                varMR_Detalle_Platillo = new MR_Detalle_PlatilloModel
                {
                    Folio         = (int)MR_Detalle_PlatilloData.Folio
                    , Ingrediente = MR_Detalle_PlatilloData.Ingrediente
                    , IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(MR_Detalle_PlatilloData.Ingrediente), "Ingredientes") ?? (string)MR_Detalle_PlatilloData.Ingrediente_Ingredientes.Nombre_Ingrediente
                    , Cantidad             = MR_Detalle_PlatilloData.Cantidad
                    , Cantidad_en_Fraccion = MR_Detalle_PlatilloData.Cantidad_en_Fraccion
                    , Unidad                = MR_Detalle_PlatilloData.Unidad
                    , UnidadUnidad          = CultureHelper.GetTraduction(Convert.ToString(MR_Detalle_PlatilloData.Unidad), "Unidades_de_Medida") ?? (string)MR_Detalle_PlatilloData.Unidad_Unidades_de_Medida.Unidad
                    , Cantidad_a_mostrar    = MR_Detalle_PlatilloData.Cantidad_a_mostrar
                    , Ingrediente_a_mostrar = MR_Detalle_PlatilloData.Ingrediente_a_mostrar
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Ingredientess_Ingrediente = _IIngredientesApiConsumer.SelAll(true);

            if (Ingredientess_Ingrediente != null && Ingredientess_Ingrediente.Resource != null)
            {
                ViewBag.Ingredientess_Ingrediente = Ingredientess_Ingrediente.Resource.Where(m => m.Nombre_Ingrediente != null).OrderBy(m => m.Nombre_Ingrediente).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Ingredientes", "Nombre_Ingrediente") ?? m.Nombre_Ingrediente.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IUnidades_de_MedidaApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Unidades_de_Medidas_Unidad = _IUnidades_de_MedidaApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varMR_Detalle_Platillo));
        }
Пример #3
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, 44553);

            ViewBag.Permission = permission;
            var varDetalle_Platillos = new Detalle_PlatillosModel();

            ViewBag.ObjectId  = "44553";
            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_PlatillosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_PlatillosData = _IDetalle_PlatillosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Platilloss[0];
                if (Detalle_PlatillosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Platillos = new Detalle_PlatillosModel
                {
                    Folio = (int)Detalle_PlatillosData.Folio
                    , Lleva_fracciones          = Detalle_PlatillosData.Lleva_fracciones.GetValueOrDefault()
                    , Cantidad                  = Detalle_PlatillosData.Cantidad
                    , Cantidad_fraccion         = Detalle_PlatillosData.Cantidad_fraccion
                    , Cantidad_fraccionCantidad = CultureHelper.GetTraduction(Convert.ToString(Detalle_PlatillosData.Cantidad_fraccion), "Cantidad_fraccion_platillos") ?? (string)Detalle_PlatillosData.Cantidad_fraccion_Cantidad_fraccion_platillos.Cantidad
                    , Unidad      = Detalle_PlatillosData.Unidad
                    , Ingrediente = Detalle_PlatillosData.Ingrediente
                    , IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(Detalle_PlatillosData.Ingrediente), "Ingredientes") ?? (string)Detalle_PlatillosData.Ingrediente_Ingredientes.Nombre_Ingrediente
                    , Caracteristica          = Detalle_PlatillosData.Caracteristica
                    , Unidad_SMAE             = Detalle_PlatillosData.Unidad_SMAE
                    , Equivalente_Unidad_SMAE = Detalle_PlatillosData.Equivalente_Unidad_SMAE
                    , Porciones     = Detalle_PlatillosData.Porciones
                    , Detalle       = Detalle_PlatillosData.Detalle
                    , Detalle_Super = Detalle_PlatillosData.Detalle_Super
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ICantidad_fraccion_platillosApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Cantidad_fraccion_platilloss_Cantidad_fraccion = _ICantidad_fraccion_platillosApiConsumer.SelAll(true);

            if (Cantidad_fraccion_platilloss_Cantidad_fraccion != null && Cantidad_fraccion_platilloss_Cantidad_fraccion.Resource != null)
            {
                ViewBag.Cantidad_fraccion_platilloss_Cantidad_fraccion = Cantidad_fraccion_platilloss_Cantidad_fraccion.Resource.Where(m => m.Cantidad != null).OrderBy(m => m.Cantidad).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Cantidad_fraccion_platillos", "Cantidad") ?? m.Cantidad.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Ingredientess_Ingrediente = _IIngredientesApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Platillos));
        }
        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, 44445);

            ViewBag.Permission = permission;
            var varMS_Exclusion_Ingredientes_Paciente = new MS_Exclusion_Ingredientes_PacienteModel();

            ViewBag.ObjectId  = "44445";
            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));
                }
                _IMS_Exclusion_Ingredientes_PacienteApiConsumer.SetAuthHeader(_tokenManager.Token);
                var MS_Exclusion_Ingredientes_PacienteData = _IMS_Exclusion_Ingredientes_PacienteApiConsumer.GetByKeyComplete(Id).Resource.MS_Exclusion_Ingredientes_Pacientes[0];
                if (MS_Exclusion_Ingredientes_PacienteData == null)
                {
                    return(HttpNotFound());
                }

                varMS_Exclusion_Ingredientes_Paciente = new MS_Exclusion_Ingredientes_PacienteModel
                {
                    Folio         = (int)MS_Exclusion_Ingredientes_PacienteData.Folio
                    , Ingrediente = MS_Exclusion_Ingredientes_PacienteData.Ingrediente
                    , IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(MS_Exclusion_Ingredientes_PacienteData.Ingrediente), "Ingredientes") ?? (string)MS_Exclusion_Ingredientes_PacienteData.Ingrediente_Ingredientes.Nombre_Ingrediente
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Ingredientess_Ingrediente = _IIngredientesApiConsumer.SelAll(true);

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


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varMS_Exclusion_Ingredientes_Paciente));
        }