public bool ValidateRequest(ExternalOrderFormServiceResponseDto order)
        {
            if (order == null)
            {
                return(false);
            }

            if (order.responses == null)
            {
                return(false);
            }
            if (order.responses.FirstOrDefault().hidden == null)
            {
                return(false);
            }
            if (order.responses.FirstOrDefault().hidden.supplierid == null)
            {
                return(false);
            }
            if (order.responses.FirstOrDefault().hidden.customerid == null)
            {
                return(false);
            }
            if (order.responses.FirstOrDefault().hidden.userid == null)
            {
                return(false);
            }
            if (order.responses.FirstOrDefault().hidden.departmentid == null)
            {
                return(false);
            }
            if (order.responses.FirstOrDefault().hidden.channel == null)
            {
                return(false);
            }
            return(true);
        }
        private List <List <OrderLine> > GetOrderRowsLine(ExternalOrderFormServiceResponseDto order, int supplierId, int companyId, out int cardCount, AspNetUser user)
        {
            Logger.Debug("Generating order rows");

            int usage = 0, userOrderCount = 1;
            int count         = AllowedItemsInOrder(supplierId, out usage, companyId);
            int numberOfCards = 0;

            List <OrderLine>         rows           = new List <OrderLine>();
            List <OrderLine>         rowsForSupport = new List <OrderLine>();
            List <List <OrderLine> > response       = new List <List <OrderLine> >();
            string                      values      = "";
            List <Question>             all         = null;
            Dictionary <string, string> fields      = new Dictionary <string, string>();

            foreach (var line in order.questions)
            {
                try
                {
                    values = "";

                    if (fields.ContainsKey(line.field_id))
                    {
                        continue;
                    }

                    all = order.questions.Where(q => q.field_id == line.field_id && !q.id.Contains("fileupload")).ToList();
                    foreach (var key in all)
                    {
                        if (!order.responses.FirstOrDefault().answers.ContainsKey(key.id))
                        {
                            continue;
                        }

                        if (key.id.Contains("date"))   // Unix to Date Conversion
                        {
                            var date = order.responses.FirstOrDefault().answers[key.id];
                            Logger.Debug("Converting date: {0}", date);

                            try
                            {
                                values += DateTime.UtcNow.ToDateTime(Convert.ToInt64(date.Substring(0, 10))).ToString("dd-MM-yyyy") + " ,";
                            }
                            catch (Exception ex)
                            {
                                Logger.Debug(ex, "Error converting date");
                                values += DateTime.Parse(date).ToString("dd-MM-yyyy") + ",";
                            }
                        }
                        else if (count > 0)
                        {
                            // for limit suppliers
                            var yesNoValue = order.responses.FirstOrDefault().answers.FirstOrDefault(d => d.Key == key.id).Value;
                            if (key.id.Contains("yesno") && yesNoValue == "1")
                            {
                                userOrderCount++;
                            }
                            if (!key.id.Contains("yesno")) //dont add add more field
                            {
                                values += order.responses.FirstOrDefault().answers[key.id] + " ,";
                            }
                        }
                        else
                        { //normal fields
                            if (key.id.Contains("yesno"))
                            {
                                if (order.responses.FirstOrDefault().answers[key.id].Equals("1"))
                                {
                                    values += _translationRepository.GetTranslation("CaseEmail-Yes", user.LanguageCode) + " ,";
                                }
                                else
                                {
                                    values += _translationRepository.GetTranslation("CaseEmail-No", user.LanguageCode) + " ,";
                                }
                            }
                            else
                            {
                                values += order.responses.FirstOrDefault().answers[key.id] + " ,";
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(values))
                    {
                        var result = values.Substring(0, values.Length - 1);
                        if (count > 0) //to add support or normal order
                        {
                            if (usage + userOrderCount <= count)
                            {
                                numberOfCards = userOrderCount;

                                rows.Add(new OrderLine()
                                {
                                    LineKey = line.question, LineValue = result
                                });
                            }
                            else
                            {
                                rowsForSupport.Add(new OrderLine()
                                {
                                    LineKey = line.question, LineValue = result
                                });
                            }
                        }
                        else
                        {
                            if (line.question.Contains("{{answer_"))
                            {
                                line.question = line.question.Substring(0, line.question.IndexOf(":", StringComparison.Ordinal) + 1) + "</strong>";
                            }
                            if (line.question.Contains("{{hidden_suppliername}}"))
                            {
                                line.question = line.question.Replace("{{hidden_suppliername}}", "");
                            }
                            if (!string.IsNullOrWhiteSpace(result))
                            {
                                rows.Add(new OrderLine()
                                {
                                    LineKey = line.question, LineValue = result
                                });
                            }
                        }
                    }
                    fields.Add(line.field_id, "added");
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Error generating order line");
                }
            }
            cardCount = numberOfCards;
            response.Add(rows);
            response.Add(rowsForSupport);
            return(response);
        }