Exemple #1
0
        public async Task Saludar(IDialogContext context, IAwaitable <object> activity, LuisResult result)
        {
            string message = $"";

            Models.NewStartersDBEntities1 DB = new Models.NewStartersDBEntities1();
            message += "¡Hola!";
            await context.PostAsync(message);

            context.Wait(MessageReceived);
            return;
        }
Exemple #2
0
        public async Task QuienEres(IDialogContext context, IAwaitable <object> activity, LuisResult result)
        {
            string message = $"";

            Models.NewStartersDBEntities1 DB = new Models.NewStartersDBEntities1();
            message += "Hola, soy New Starter, soy un asistente que te permite ponerte al corriente " +
                       "con la empresa, preguntame lo que necesites";
            await context.PostAsync(message);

            context.Wait(MessageReceived);
            return;
        }
Exemple #3
0
        public async Task NombresCompas(IDialogContext context, IAwaitable <object> activity, LuisResult result)
        {
            Models.NewStartersDBEntities1 DB = new Models.NewStartersDBEntities1();
            //Mis datos es literalmente todo lo de mi mismo (Bruno) se accede de la forma misDatos[0].foto
            var misDatos = (from compas in DB.Empleado
                            where compas.jefeInmediatoID == 4
                            select new
            {
                nombre = compas.nombre,
                apellido = compas.apellido,
                numero = compas.numero,
                puesto = compas.puesto,
                mail = compas.mail,
                foto = compas.fotoURL,
                tel = compas.numero,
                sede = compas.sede
            }
                            ).ToList();

            string message = $"Tus compañeros de trabajo de tu jerarquia son:";
            await context.PostAsync(message);

            foreach (var item in misDatos)
            {
                if (!item.nombre.Equals("Bruno"))
                {
                    List <CardImage> cardImages = new List <CardImage>();
                    HeroCard         card       = new HeroCard();
                    card.Title    = $"{item.nombre} {item.apellido}";
                    card.Subtitle = $"{item.puesto}";
                    card.Text     = $"Teléfono: {item.numero}  \n";
                    card.Text    += $"Correo: {item.mail}";
                    cardImages.Add(new CardImage(item.foto));
                    card.Images = cardImages;
                    List <CardAction> cardButtons = new List <CardAction>();
                    CardAction        callButton  = new CardAction()
                    {
                        Value = $"tel:{item.tel}",
                        Type  = "call",
                        Title = "Llamar"
                    };
                    int sedeID    = (int)item.sede;
                    var ubicacion = (from s in DB.Sede
                                     where s.sedeID == sedeID
                                     select s.direccion).ToList();
                    CardAction mapButton = new CardAction()
                    {
                        Value = $"https://www.google.com.mx/maps/place/" + $"{ubicacion[0].Replace(" ", "+")}",
                        Type  = "openUrl",
                        Title = "Ir a sede"
                    };
                    cardButtons.Add(callButton);
                    cardButtons.Add(mapButton);
                    card.Buttons = cardButtons;
                    Attachment       att   = card.ToAttachment();
                    IMessageActivity reply = context.MakeMessage();
                    reply.Attachments.Add(att);
                    await context.PostAsync(reply);
                }
            }
            context.Wait(MessageReceived);
            return;
        }
Exemple #4
0
        public async Task NombreJefeInmediatoIntent(IDialogContext context, IAwaitable <object> activity, LuisResult result)
        {
            string message = $"";

            Models.NewStartersDBEntities1 DB = new Models.NewStartersDBEntities1();
            HeroCard         card            = new HeroCard();
            List <CardImage> cardImages      = new List <CardImage>();

            card.Title = "Jefe";
            //Mis datos es literalmente todo lo de mi mismo (Bruno) se accede de la forma misDatos[0].foto
            var misDatos = (from yo in DB.Empleado
                            where yo.empleadoID == 6
                            select new
            {
                nombre = yo.nombre,
                apellido = yo.apellido,
                jefeId = yo.jefeInmediatoID,
                puesto = yo.puesto,
                sede = yo.sede,
                departamentoID = yo.departamento,
                foto = yo.fotoURL,
                jerarquia = yo.jerarquia
            }
                            ).ToList();
            int id        = (int)misDatos[0].jefeId;
            var datosJefe = (from jefe in DB.Empleado
                             where jefe.empleadoID == id
                             select new
            {
                nombre = jefe.nombre,
                apellido = jefe.apellido,
                sede = jefe.sede,
                foto = jefe.fotoURL,
                tel = jefe.numero,
                mail = jefe.mail
            }
                             ).ToList();

            cardImages.Add(new CardImage(datosJefe[0].foto));
            card.Images   = cardImages;
            card.Subtitle = $"{datosJefe[0].nombre} {datosJefe[0].apellido}";
            card.Text     = $"Tu jefe es {datosJefe[0].nombre}  \nCorreo: {datosJefe[0].mail}";
            List <CardAction> cardButtons = new List <CardAction>();
            CardAction        callButton  = new CardAction()
            {
                Value = $"tel:{datosJefe[0].tel}",
                Type  = "call",
                Title = "Llamar"
            };
            int sedeID    = (int)datosJefe[0].sede;
            var ubicacion = (from s in DB.Sede
                             where s.sedeID == sedeID
                             select s.direccion).ToList();
            CardAction mapButton = new CardAction()
            {
                Value = $"https://www.google.com.mx/maps/place/" + $"{ubicacion[0].Replace(" ", "+")}",
                Type  = "openUrl",
                Title = "Ir a sede"
            };

            cardButtons.Add(callButton);
            cardButtons.Add(mapButton);
            card.Buttons = cardButtons;
            Attachment       att   = card.ToAttachment();
            IMessageActivity reply = context.MakeMessage();

            reply.Attachments.Add(att);
            await context.PostAsync(reply);

            context.Wait(MessageReceived);
            return;
        }
Exemple #5
0
        public async Task Mercadotecnia(IDialogContext context, IAwaitable <object> activity, LuisResult result)
        {
            Models.NewStartersDBEntities1 DB = new Models.NewStartersDBEntities1();
            //Mis datos es literalmente todo lo de mi mismo (Bruno) se accede de la forma misDatos[0].foto
            var misDatos = (from dept in DB.Empleado_Departamento
                            where dept.departamentoID == 2
                            select new
            {
                representate = dept.representanteID,
                jefe = dept.jefeID,
                dept = dept.departamentoID
            }
                            ).ToList();

            int id3        = (int)misDatos[0].dept;
            var datosJefe3 = (from depto in DB.Departamento
                              where depto.departamentoID == id3
                              select new
            {
                ubicacion = depto.ubicacion
            }
                              ).ToList();
            string message = $"El departamento de Mercadotecnia se encuentra en {datosJefe3[0].ubicacion} y el contacto es:";
            await context.PostAsync(message);


            int id        = (int)misDatos[0].jefe;
            var datosJefe = (from jefe in DB.Empleado
                             where jefe.empleadoID == id
                             select new
            {
                nombre = jefe.nombre,
                apellido = jefe.apellido,
                sede = jefe.sede,
                foto = jefe.fotoURL,
                mail = jefe.mail,
                tel = jefe.numero
            }
                             ).ToList();
            int id2      = (int)misDatos[0].representate;
            var datosRep = (from representante in DB.Empleado
                            where representante.empleadoID == id
                            select new
            {
                nombre = representante.nombre,
                apellido = representante.apellido,
                sede = representante.sede
            }
                            ).ToList();
            List <CardImage> cardImages = new List <CardImage>();
            HeroCard         card       = new HeroCard();

            card.Title    = $"{datosJefe[0].nombre} {datosJefe[0].apellido}";
            card.Subtitle = "Jefe del departamento de mercadotecnia";
            card.Text     = $"Teléfono: {datosJefe[0].tel}  \n";
            card.Text    += $"Correo: {datosJefe[0].mail}";
            cardImages.Add(new CardImage(datosJefe[0].foto));
            card.Images = cardImages;
            List <CardAction> cardButtons = new List <CardAction>();
            CardAction        callButton  = new CardAction()
            {
                Value = $"tel:{datosJefe[0].tel}",
                Type  = "call",
                Title = "Llamar"
            };
            int sedeID    = (int)datosJefe[0].sede;
            var ubicacion = (from s in DB.Sede
                             where s.sedeID == sedeID
                             select s.direccion).ToList();
            CardAction mapButton = new CardAction()
            {
                Value = $"https://www.google.com.mx/maps/place/" + $"{ubicacion[0].Replace(" ", "+")}",
                Type  = "openUrl",
                Title = "Ir a sede"
            };

            cardButtons.Add(callButton);
            cardButtons.Add(mapButton);
            card.Buttons = cardButtons;
            Attachment       att   = card.ToAttachment();
            IMessageActivity reply = context.MakeMessage();

            reply.Attachments.Add(att);
            await context.PostAsync(reply);

            context.Wait(MessageReceived);
            return;
        }
Exemple #6
0
        public async Task NombreSublevados(IDialogContext context, IAwaitable <object> activity, LuisResult result)
        {
            string message = $"";

            Models.NewStartersDBEntities1 DB = new Models.NewStartersDBEntities1();
            //Mis datos es literalmente todo lo de mi mismo (Bruno) se accede de la forma misDatos[0].foto
            var misDatos = (from yo in DB.Empleado
                            where yo.empleadoID == 6
                            select new
            {
                nombre = yo.nombre,
                apellido = yo.apellido,
                jefeId = yo.jefeInmediatoID,
                puesto = yo.puesto,
                sede = yo.sede,
                departamentoID = yo.departamento,
                foto = yo.fotoURL,
                jerarquia = yo.jerarquia,
                empleadoID = yo.empleadoID
            }
                            ).ToList();
            int id = (int)misDatos[0].empleadoID;

            System.Diagnostics.Debug.WriteLine($"id: {id}");
            var datosEmpleados = (from empleado in DB.Empleado
                                  where empleado.jefeInmediatoID == id
                                  select new
            {
                nombre = empleado.nombre,
                apellido = empleado.apellido,
                sede = empleado.sede,
                idPrueba = empleado.empleadoID,
                foto = empleado.fotoURL,
                tel = empleado.numero,
                mail = empleado.mail
            }
                                  ).ToList();

            if (datosEmpleados.Count() == 0)
            {
                message += "De momento no tienes registrados empleados";
                await context.PostAsync(message);

                context.Wait(MessageReceived);
                return;
            }
            else
            {
                for (int i = 0; i < datosEmpleados.Count; i++)
                {
                    if (i == 0)
                    {
                        message += $"Tus empleados son: ";
                        await context.PostAsync(message);
                    }
                    List <CardImage> cardImages = new List <CardImage>();
                    HeroCard         card       = new HeroCard();
                    card.Title    = $"{datosEmpleados[i].nombre} {datosEmpleados[i].apellido}";
                    card.Subtitle = "Datos de contacto:";
                    card.Text     = $"Teléfono: {datosEmpleados[i].tel}  \n";
                    card.Text    += $"Correo: {datosEmpleados[i].mail}";
                    cardImages.Add(new CardImage(datosEmpleados[i].foto));
                    card.Images = cardImages;
                    List <CardAction> cardButtons = new List <CardAction>();
                    CardAction        callButton  = new CardAction()
                    {
                        Value = $"tel:{datosEmpleados[i].tel}",
                        Type  = "call",
                        Title = "Llamar"
                    };
                    int sedeID    = (int)datosEmpleados[i].sede;
                    var ubicacion = (from s in DB.Sede
                                     where s.sedeID == sedeID
                                     select s.direccion).ToList();
                    CardAction mapButton = new CardAction()
                    {
                        Value = $"https://www.google.com.mx/maps/place/" + $"{ubicacion[0].Replace(" ", "+")}",
                        Type  = "openUrl",
                        Title = "Ir a sede"
                    };
                    cardButtons.Add(callButton);
                    cardButtons.Add(mapButton);
                    card.Buttons = cardButtons;
                    Attachment       att   = card.ToAttachment();
                    IMessageActivity reply = context.MakeMessage();
                    reply.Attachments.Add(att);
                    await context.PostAsync(reply);
                }
            }


            await context.PostAsync(message);

            context.Wait(MessageReceived);
            return;
        }