Beispiel #1
0
        //
        // GET: /Convocatoria/Details/5

        public void DetailsAsync(int idConv)
        {
            AsyncManager.OutstandingOperations.Increment(3);
            var front = new FrontOffice.FrontOfficeServiceClient();

            AsyncManager.Parameters["confirmo"]       = true;
            front.GetFuentesDatosMovimientoCompleted += (s, e) =>
            {
                AsyncManager.Parameters["fweb"] = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.GetFuentesDatosMovimientoAsync((int)Session["idMov"]);

            front.ObtenerConvocatoriaXIdCompleted += (s, e) =>
            {
                AsyncManager.Parameters["conv"] = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.ObtenerConvocatoriaXIdAsync(idConv);

            if ((Session["logueado"] != null && (bool)Session["logueado"]) && Membership.FindUsersByName((String)Session["emailUs"]).Count > 0)
            {
                front.ConfirmoAsistenciaUsuarioCompleted += (s, e) =>
                {
                    AsyncManager.Parameters["confirmo"] = e.Result;
                    AsyncManager.OutstandingOperations.Decrement();
                };
                front.ConfirmoAsistenciaUsuarioAsync(idConv, (int)Session["idUsr"]);
            }
            else
            {
                AsyncManager.OutstandingOperations.Decrement();
            }
        }
        public void InadecuadoAsync(int idContenido)
        {
            var logueado = Session["logueado"];

            if (logueado != null)
            {
                if ((bool)logueado)
                {
                    AsyncManager.OutstandingOperations.Increment(2);
                    var front = new FrontOffice.FrontOfficeServiceClient();

                    front.AddInadecuadoCompleted += (s, e) =>
                    {
                        AsyncManager.Parameters["idCont"] = idContenido;
                        AsyncManager.Parameters["exito"]  = !e.Cancelled;
                        AsyncManager.OutstandingOperations.Decrement();
                        front.GetOpcionesContenidoAsync((int)Session["idUsr"], idContenido);
                    };
                    front.GetOpcionesContenidoCompleted += (s, e) =>
                    {
                        ViewBag.IdContenido = idContenido;
                        ViewBag.MeGusta     = e.Result.MeGusta;
                        ViewBag.Inadecuado  = e.Result.Inadecuado;
                        ViewBag.CantMegusta = e.Result.CantMeGusta;
                        AsyncManager.OutstandingOperations.Decrement();
                    };

                    front.AddInadecuadoAsync((int)Session["idUsr"], idContenido);
                }
            }
        }
        public void CreatePostAsync(Contenido cont, HttpPostedFileBase uploadFile)
        {
            if (uploadFile == null || (uploadFile != null && uploadFile.ContentLength > 0))
            {
                if (uploadFile != null && uploadFile.ContentLength > 0)
                {
                    MyStorageService _myStorageService = new MyStorageService();
                    _myStorageService.Upload("contenido" + (int)Session["idMov"], uploadFile);
                    cont.Ubicacion = "http://repoindignado.blob.core.windows.net/contenido" + (int)Session["idMov"] + "/" + uploadFile.FileName;
                }

                AsyncManager.OutstandingOperations.Increment();
                cont.EspecificacionUsuarioId = (int)Session["idUsr"];

                var front = new FrontOffice.FrontOfficeServiceClient();
                front.CompartirContenidoCompleted += (s, e) =>
                {
                    AsyncManager.Parameters["exito"] = !e.Cancelled;
                    AsyncManager.OutstandingOperations.Decrement();
                };

                front.CompartirContenidoAsync(cont);
            }
            else
            {
                AsyncManager.Parameters["exito"] = false;
            }
        }
        public void IndexAsync()
        {
            if ((int)Session["idMov"] != 0)
            {
                AsyncManager.OutstandingOperations.Increment();

                var front = new FrontOffice.FrontOfficeServiceClient();
                front.ObtenerConvocatoriasMovimientoCompleted += (s, e) =>
                {
                    AsyncManager.Parameters["items"]  = e.Result;
                    AsyncManager.Parameters["items2"] = null;
                    AsyncManager.OutstandingOperations.Decrement();
                };
                front.ObtenerConvocatoriasMovimientoAsync((int)Session["idMov"]);
                bool logueado = ((Session["logueado"] != null && (bool)Session["logueado"]) && Membership.FindUsersByName((String)Session["emailUs"]).Count > 0);
                if (logueado)
                {
                    AsyncManager.OutstandingOperations.Increment();
                    var chatService = new ChatService.IntegracionServiceClient();
                    chatService.obtenerMensajesCompleted += (s, e) =>
                    {
                        Session["chatMessages"] = e.Result;

                        AsyncManager.OutstandingOperations.Decrement();
                        chatService.Close();
                    };
                    chatService.obtenerMensajesAsync((int)Session["idMov"]);
                }
            }
            else
            {
                AsyncManager.Parameters["items"]  = null;
                AsyncManager.Parameters["items2"] = null;
            }
        }
        public void ObtenerContenidoAsync(int combo, string filtro)
        {
            AsyncManager.OutstandingOperations.Increment();
            var front = new FrontOffice.FrontOfficeServiceClient();

            if (combo == 2)
            {
                front.ObtenerContenidoMasRecienteCompleted += (s, e) =>
                {
                    AsyncManager.Parameters["items"] = e.Result;
                    AsyncManager.Parameters["exito"] = !e.Cancelled;
                    AsyncManager.OutstandingOperations.Decrement();
                };
                front.ObtenerContenidoMasRecienteAsync((int)Session["idMov"], filtro);
            }
            else if (combo == 1)
            {
                front.ObtenerContenidoMasRankeadoCompleted += (s, e) =>
                {
                    AsyncManager.Parameters["items"] = e.Result;
                    AsyncManager.Parameters["exito"] = !e.Cancelled;
                    AsyncManager.OutstandingOperations.Decrement();
                };
                front.ObtenerContenidoMasRankeadoAsync((int)Session["idMov"], filtro);
            }
        }
Beispiel #6
0
        //
        // GET: /Convocatoria/Create

        public void CreateAsync()
        {
            AsyncManager.OutstandingOperations.Increment();

            var front = new FrontOffice.FrontOfficeServiceClient();

            front.ObtenerCategoriasTematicasCompleted += (s, e) =>
            {
                AsyncManager.Parameters["cat"] = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.ObtenerCategoriasTematicasAsync();
        }
        public void ObtenerMapaAsync()
        {
            AsyncManager.OutstandingOperations.Increment();

            var front = new FrontOffice.FrontOfficeServiceClient();

            front.ObtenerConvocatoriasMovimientoCompleted += (s, e) =>
            {
                AsyncManager.Parameters["items"] = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.ObtenerConvocatoriasMovimientoAsync((int)Session["idMov"]);
        }
        public void ObtenerOpcionesContenidoAsync(int idCont)
        {
            AsyncManager.OutstandingOperations.Increment();
            var front = new FrontOffice.FrontOfficeServiceClient();

            front.GetOpcionesContenidoCompleted += (s, e) =>
            {
                ViewBag.IdContenido = idCont;
                ViewBag.MeGusta     = e.Result.MeGusta;
                ViewBag.Inadecuado  = e.Result.Inadecuado;
                ViewBag.CantMegusta = e.Result.CantMeGusta;
                AsyncManager.OutstandingOperations.Decrement();
            };

            front.GetOpcionesContenidoAsync((int)Session["idUsr"], idCont);
        }
Beispiel #9
0
        public void ConfirmarAsistenciaAsync(int idConv)
        {
            var logueado = Session["logueado"];

            if (logueado != null)
            {
                if ((bool)logueado)
                {
                    var front = new FrontOffice.FrontOfficeServiceClient();
                    AsyncManager.OutstandingOperations.Increment();
                    front.ConfirmarAsistenciaConvocatoriaCompleted += (s, e) =>
                    {
                        AsyncManager.OutstandingOperations.Decrement();
                    };
                    front.ConfirmarAsistenciaConvocatoriaAsync(idConv, (int)Session["idUsr"]);
                }
            }
        }
        private void AgregarEspecificacionUsuarioAsync(RegisterModel model)
        {
            EspecificacionUsuario espus = new EspecificacionUsuario();

            espus.Membership = model.Email;
            espus.Nombre     = model.nombre + " " + model.apellido;
            CategoriaTematica[] categs = (CategoriaTematica[])Session["Categorias"];
            int j = 0;

            for (var i = 0; i < categs.Length; i++)
            {
                if (Request[categs[i].Nombre] == "true,false")
                {
                    j++;
                }
            }
            espus.UbicacionLatitud  = model.latitud;
            espus.UbicacionLongitud = model.longitud;
            espus.MovimientoId      = (int)Session["idMov"];
            String[] icol = new String[j];
            int      z    = 0;

            for (var i = 0; i < categs.Length; i++)
            {
                if (Request[categs[i].Nombre] == "true,false")
                {
                    icol[z] = categs[i].Nombre;
                    z++;
                }
            }

            var front = new FrontOffice.FrontOfficeServiceClient();

            AsyncManager.OutstandingOperations.Increment();
            front.AgregarUsuarioCompleted += (s, e) =>
            {
                EspecificacionUsuario aux = e.Result;
                Session["logueado"] = true;
                Session["idUsr"]    = e.Result.Id;
                Session["emailUs"]  = e.Result.Membership;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.AgregarUsuarioAsync(espus, this.Site, icol);
        }
Beispiel #11
0
        private void AgregarEspecificacionUsuarioAsync(RegisterModel model)
        {
            EspecificacionUsuario espus = new EspecificacionUsuario();

            espus.Membership = model.Email;
            espus.Nombre     = model.nombre + " " + model.apellido;
            CategoriaTematica[] categs = (CategoriaTematica[])Session["Categorias"];
            espus.UbicacionLatitud  = model.latitud;
            espus.UbicacionLongitud = model.longitud;
            espus.MovimientoId      = (int)Session["idnmov"];

            var front = new FrontOffice.FrontOfficeServiceClient();

            AsyncManager.OutstandingOperations.Increment();
            front.AgregarUsuarioCompleted += (s, e) =>
            {
                EspecificacionUsuario aux = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.AgregarUsuarioAsync(espus, null, null);
        }
Beispiel #12
0
        public void CreatePostAsync(Convocatoria conv, string UbicacionLatitud, string UbicacionLongitud)
        {
            if (System.Math.Abs(float.Parse(UbicacionLatitud)) > 500)
            {
                //esto es para que funcione bien localmente
                conv.UbicacionLatitud  = float.Parse(UbicacionLatitud.Replace(".", ","));
                conv.UbicacionLongitud = float.Parse(UbicacionLongitud.Replace(".", ","));
            }
            else
            {
                //esto en la nube
                conv.UbicacionLatitud  = float.Parse(UbicacionLatitud);
                conv.UbicacionLongitud = float.Parse(UbicacionLongitud);
            }
            AsyncManager.OutstandingOperations.Increment();
            conv.MovimientoId = (int)Session["idMov"];
            //conv.CategoriaTematicaId = 1;

            //creo la fecha a partir del input inicio
            string inicio = Request["inicio"];

            string[] datetime = inicio.Split(' ');
            string[] date     = datetime[0].Split('/');
            string[] time     = datetime[1].Split(':');
            DateTime dt       = new DateTime(int.Parse(date[2]), int.Parse(date[1]), int.Parse(date[0]), int.Parse(time[0]), int.Parse(time[1]), 0);

            //asigno la fecha creada a el atributo inicio de la convocatoria
            conv.Inicio = dt;

            var front = new FrontOffice.FrontOfficeServiceClient();

            front.AgregarConvocatoriaCompleted += (s, e) =>
            {
                AsyncManager.Parameters["exito"] = !e.Cancelled;
                AsyncManager.OutstandingOperations.Decrement();
            };

            front.AgregarConvocatoriaAsync(conv);
        }
        public void SetearLogueoSessionAsync(String membership, int idmov)
        {
            AsyncManager.OutstandingOperations.Increment();
            var front = new FrontOffice.FrontOfficeServiceClient();

            front.ObtenerEspecificacionUsuarioXMembershipCompleted += (s, e) =>
            {
                AsyncManager.Parameters["espus"] = e.Result;
                if (e.Result != null)
                {
                    Session["idUsr"]    = e.Result.Id;
                    Session["logueado"] = true;
                    Session["emailUs"]  = e.Result.Membership;
                    AsyncManager.OutstandingOperations.Decrement();
                }
                else
                {
                    Session["logueado"] = false;
                }
            };
            front.ObtenerEspecificacionUsuarioXMembershipAsync(membership, idmov);
        }
        public void EditAsync()
        {
            String membership = (String)Session["emailUs"];
            int    idmov      = (int)Session["idMov"];

            AsyncManager.OutstandingOperations.Increment(2);
            var front = new FrontOffice.FrontOfficeServiceClient();

            front.ObtenerCategoriasTematicasCompleted += (s, e) =>
            {
                AsyncManager.Parameters["categs"] = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.ObtenerCategoriasTematicasAsync();

            front.ObtenerEspecificacionUsuarioXMembershipCompleted += (s, e) =>
            {
                AsyncManager.Parameters["espus"] = e.Result;
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.ObtenerEspecificacionUsuarioXMembershipAsync(membership, idmov);
        }
        private void EditarEspecificacionUsuarioAsync(EditModel model)
        {
            EspecificacionUsuario espus = (EspecificacionUsuario)Session["EspUsEdit"];

            espus.Nombre = model.nombre;
            CategoriaTematica[] categs = (CategoriaTematica[])Session["CategoriasEdit"];
            int j = 0;

            for (var i = 0; i < categs.Length; i++)
            {
                if (Request[categs[i].Nombre] == "true,false")
                {
                    j++;
                }
            }
            espus.UbicacionLatitud  = model.latitud;
            espus.UbicacionLongitud = model.longitud;
            String[] icol = new String[j];
            int      z    = 0;

            for (var i = 0; i < categs.Length; i++)
            {
                if (Request[categs[i].Nombre] == "true,false")
                {
                    icol[z] = categs[i].Nombre;
                    z++;
                }
            }

            var front = new FrontOffice.FrontOfficeServiceClient();

            AsyncManager.OutstandingOperations.Increment();
            front.ModificarEspecificacionUsuarioCompleted += (s, e) =>
            {
                AsyncManager.OutstandingOperations.Decrement();
            };
            front.ModificarEspecificacionUsuarioAsync(espus, icol);
        }