// GET: coadmin/facilidades
 public ActionResult disponibles(string Error, string searchStr = "")
 {
     if (Session["USER_ID"] != null)
     {
         try
         {
             long userId  = (long)Session["USER_ID"];
             user curUser = entities.users.Find(userId);
             List <ShowMessage> pubMessageList = ep.GetChatMessages(userId);
             List <efac>        efacList       = new List <efac>();
             long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]);
             if (searchStr == "")
             {
                 var query = (from r in entities.efacs where r.community_id == communityAct select r);
                 efacList = query.ToList();
             }
             else
             {
                 var query1 = (from r in entities.efacs
                               where r.first_name.Contains(searchStr) == true && r.community_id == communityAct
                               select r);
                 efacList = query1.ToList();
             }
             facilidadesViewModel viewModel = new facilidadesViewModel();
             communityList                    = ep.GetCommunityList(userId);
             viewModel.communityList          = communityList;
             viewModel.side_menu              = "facilidades";
             viewModel.side_sub_menu          = "facilidades_disponibles";
             viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList();
             viewModel.efacList               = efacList;
             viewModel.curUser                = curUser;
             viewModel.searchStr              = searchStr;
             viewModel.pubTaskList            = ep.GetNotifiTaskList(userId);
             viewModel.pubMessageList         = pubMessageList;
             ViewBag.msgError                 = Error;
             viewModel.messageCount           = ep.GetUnreadMessageCount(pubMessageList);
             return(View(viewModel));
         }
         catch (Exception ex)
         {
             return(Redirect(Url.Action("error", "control", new { area = "coadmin", Error = "Facilidades disponibles: " + ex.Message })));
         }
     }
     else
     {
         return(Redirect(ep.GetLogoutUrl()));
     }
 }
示例#2
0
        public ActionResult solicitudes(string searchStr = "")
        {
            if (Session["USER_ID"] != null)
            {
                long userId  = (long)Session["USER_ID"];
                user curUser = entities.users.Find(userId);
                List <ShowMessage> pubMessageList = ep.GetChatMessages(userId);;
                List <efac>        efacList       = new List <efac>();

                long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]);

                if (searchStr == "")
                {
                    var query = (from r in entities.efacs where r.community_id == communityAct select r);
                    efacList = query.ToList();
                }
                else
                {
                    var query1 = (from r in entities.efacs where r.first_name.Contains(searchStr) == true && r.community_id == communityAct select r);
                    efacList = query1.ToList();
                }

                facilidadesViewModel viewModel = new facilidadesViewModel();
                viewModel.side_menu     = "facilidades";
                viewModel.side_sub_menu = "facilidades_solicitudes";

                viewModel.searchStr      = searchStr;
                viewModel.efacList       = efacList;
                viewModel.curUser        = curUser;
                viewModel.pubTaskList    = ep.GetNotifiTaskList(userId);
                viewModel.pubMessageList = pubMessageList;
                viewModel.messageCount   = ep.GetUnreadMessageCount(pubMessageList);
                return(View(viewModel));
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }
示例#3
0
        public ActionResult reservartwo()
        {
            if (Session["USER_ID"] != null)
            {
                long userId  = (long)Session["USER_ID"];
                user curUser = entities.users.Find(userId);
                List <ShowMessage>   pubMessageList = ep.GetChatMessages(userId);
                facilidadesViewModel viewModel      = new facilidadesViewModel();
                viewModel.side_menu     = "facilidades";
                viewModel.side_sub_menu = "facilidades_reservartwo";
                viewModel.pubTaskList   = ep.GetNotifiTaskList(userId);

                viewModel.curUser        = curUser;
                viewModel.pubMessageList = pubMessageList;
                viewModel.messageCount   = ep.GetUnreadMessageCount(pubMessageList);
                return(View(viewModel));
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }
示例#4
0
        public ActionResult reservar(long?id)
        {
            if (Session["USER_ID"] != null)
            {
                if (Session["CURRENT_COMU"] != null)
                {
                    if (id != null)
                    {
                        efac facilidad = entities.efacs.Find(id);
                        if (facilidad != null)
                        {
                            try{
                                long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]);
                                long userId       = (long)Session["USER_ID"];
                                user curUser      = entities.users.Find(userId);
                                List <ShowMessage>   pubMessageList = ep.GetChatMessages(userId);
                                facilidadesViewModel viewModel      = new facilidadesViewModel();
                                string        inicio     = Convert.ToString(facilidad.start_time);
                                string        final      = Convert.ToString(facilidad.end_time);
                                TimeSpan      horaInicio = TimeSpan.Parse(inicio);
                                TimeSpan      horaFin    = TimeSpan.Parse(final);
                                TimeSpan      masU       = TimeSpan.FromHours(1);
                                List <string> timeList   = new List <string>();
                                while (horaInicio < horaFin)
                                {
                                    timeList.Add(
                                        horaInicio.ToString("hh':'mm") + " - " +
                                        horaInicio.Add(masU).ToString("hh':'mm"));

                                    horaInicio = horaInicio.Add(masU);
                                }
                                titulosList                      = ep.GetTitulosByTitular(userId);
                                listComunities                   = ep.GetCommunityListByTitular(titulosList);
                                viewModel.communityList          = listComunities;
                                viewModel.timeList               = timeList;
                                viewModel.facilidadSe            = facilidad;
                                viewModel.side_menu              = "reservar";
                                viewModel.side_sub_menu          = "facilidades_reservar";
                                viewModel.curUser                = curUser;
                                viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList();
                                viewModel.pubTaskList            = ep.GetNotifiTaskList(userId);
                                viewModel.pubMessageList         = pubMessageList;
                                viewModel.messageCount           = ep.GetUnreadMessageCount(pubMessageList);
                                viewModel.communityName          = ep.GetCommunityCoInfo(userId)[0];
                                viewModel.communityApart         = ep.GetCommunityCoInfo(userId)[1];
                                return(View(viewModel));
                            }
                            catch (Exception ex)
                            {
                                return(Redirect(Url.Action("error", "control", new { Error = "Reservar facilidad: ", ex.Message })));
                            }
                        }
                        else
                        {
                            return(Redirect(Url.Action("disponibles", "facilidades", new { Error = "No existe la facilidad" })));
                        }
                    }
                    else
                    {
                        return(Redirect(Url.Action("disponibles", "facilidades")));
                    }
                }
                else
                {
                    return(Redirect(Url.Action("disponibles", "facilidades", new { Error = "No permitido. Usted no pertence a ninguna comunidad" })));
                }
            }
            else
            {
                return(Redirect(ep.GetLogoutUrl()));
            }
        }