Example #1
0
        private ChatReplyRawContent InitChatQuestionAnswer(Question question)
        {
            var content = new ChatReplyRawContent
            {
                ChatText    = "No Question found!",
                QuestionIDs = new Dictionary <string, string>()
            };

            string msg = "<strong>" + question.QuestionText + ":</strong><br />";

            var types = _dbContext.QuestionAnswers.Where(q => q.QuestionId == question.QuestionId).ToArray();


            for (int i = 0; i < types.Length; i++)
            {
                var type = types[i];

                content.QuestionIDs.Add((i + 1).ToString(), type.QuestionAnswerId.ToString());

                if (i == 0)
                {
                    msg += string.Format("<strong>{0}</strong> - {1}", (i + 1), type.AnswerText);
                }
                else
                {
                    msg += string.Format("<br /> <strong>{0}</strong> - {1}", (i + 1), type.AnswerText);
                }
            }

            content.ChatText = msg;

            return(content);
        }
Example #2
0
        private ChatReplyRawContent InitUserNetworks()
        {
            var content = new ChatReplyRawContent
            {
                ChatText    = "You have no networks registered!",
                QuestionIDs = new Dictionary <string, string>()
            };

            var types = _dbContext.Networks.Where(i => i.UserId == userId).ToArray();

            if (types == null || types.Length == 0)
            {
                return(content);
            }

            string msg = "<strong>Select the network:</strong><br />";

            for (int i = 0; i < types.Length; i++)
            {
                var type = types[i];

                content.QuestionIDs.Add((i + 1).ToString(), type.NetworkId.ToString());

                if (i == 0)
                {
                    msg += string.Format("<strong>{0}</strong> - {1}", i + 1, type.Name);
                }
                else
                {
                    msg += string.Format("<br /> <strong>{0}</strong> - {1}", i + 1, type.Name);
                }
            }

            content.ChatText = msg;

            return(content);
        }
Example #3
0
        private ChatReplyRawContent InitIncidentTypes()
        {
            var content = new ChatReplyRawContent
            {
                ChatText    = "No active Incident Types!",
                QuestionIDs = new Dictionary <string, string>()
            };

            var types = _dbContext.IncidentTypes.Where(i => i.IsActive).ToArray();

            if (types == null || types.Length == 0)
            {
                return(content);
            }

            string msg = "<strong>Select your incident type:</strong><br />";

            for (int i = 0; i < types.Length; i++)
            {
                var type = types[i];

                content.QuestionIDs.Add((i + 1).ToString(), type.IncidentTypeId.ToString());

                if (i == 0)
                {
                    msg += string.Format("<strong>{0}</strong> - {1}", i + 1, type.IncidentTypeName);
                }
                else
                {
                    msg += string.Format("<br /> <strong>{0}</strong> - {1}", i + 1, type.IncidentTypeName);
                }
            }

            content.ChatText = msg;

            return(content);
        }
Example #4
0
        private ChatReplyRawContent InitUserNetworkEquipments(int networkId)
        {
            var content = new ChatReplyRawContent {
                ChatText    = "You have no network equipments registered!",
                QuestionIDs = new Dictionary <string, string>()
            };

            var types = _dbContext.UserNetworkEquipments.Include("Equipment").Where(i => i.NetworkId == networkId).ToArray();

            if (types == null || types.Length == 0)
            {
                return(content);
            }

            string msg = "<strong>Select fault Equipment:</strong><br />";

            for (int i = 0; i < types.Length; i++)
            {
                var type = types[i];

                content.QuestionIDs.Add((i + 1).ToString(), type.UserNetworkEquipmentId.ToString());

                if (i == 0)
                {
                    msg += string.Format("<strong>{0}</strong> - {1}", i + 1, string.Format("{0} - {1} ({2})", type?.Tag, type?.IpAddress, type.Equipment?.Name));
                }
                else
                {
                    msg += string.Format("<br /> <strong>{0}</strong> - {1}", i + 1, string.Format("{0} - {1} ({2})", type?.Tag, type?.IpAddress, type.Equipment?.Name));
                }
            }

            content.ChatText = msg;

            return(content);
        }