示例#1
0
        public FAQDTO GetFAQDetail(string ID)
        {
            FAQDTO item = new FAQDTO();

            try
            {
                GetFAQRequest paraBody = new GetFAQRequest();
                paraBody.ID = ID;

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.FAQAPIGetList, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["ListFAQ"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                item = JsonConvert.DeserializeObject <List <FAQDTO> >(lstObject)[0];

                NSLog.Logger.Info("FAQGetDetail", item);

                return(item);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("FAQGetDetail_Fail", e);
                return(item);
            }
        }
示例#2
0
        public static GetAllResponse GetAll(GetFAQRequest request)
        {
            GetAllResponse response = new GetAllResponse();

            try
            {
                using (FAQDao dao = new FAQDao())
                {
                    MFaq[] faqs = dao.GetFaqs(request.page_number, request.row_per_page);
                    if (faqs.Length > 0)
                    {
                        FAQDto[] faqDtos = new FAQDto[faqs.Length];
                        for (int i = 0; i < faqs.Length; i++)
                        {
                            FAQDto dto = new FAQDto();
                            dto.faq_id   = faqs[i].FaqID;
                            dto.question = faqs[i].Question;
                            dto.answer   = faqs[i].Answer;
                            faqDtos[i]   = dto;
                        }
                        response.faq_list     = faqDtos;
                        response.code         = 0;
                        response.has_resource = 1;
                        response.message      = MessagesSource.GetMessage("faq.list");
                        return(response);
                    }
                    else
                    {
                        response.code         = 0;
                        response.has_resource = 0;
                        response.message      = MessagesSource.GetMessage("faq.list.not.found");
                    }
                }
            }
            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
            }
            return(response);
        }
示例#3
0
        public List <FAQModels> GetListFAQData(string SearchString = null)
        {
            List <FAQModels> listData = new List <FAQModels>();

            try
            {
                GetFAQRequest paraBody = new GetFAQRequest();

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.FAQAPIGetList, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["ListFAQ"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                listData = JsonConvert.DeserializeObject <List <FAQModels> >(lstObject);

                NSLog.Logger.Info("FAQGetListData", listData);

                return(listData);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("FAQGetListData_Fail", e);
                return(listData);
            }
        }
示例#4
0
        public IHttpActionResult GetFAQ([FromUri] GetFAQRequest getFAQRequest)
        {
            var responses = new Responses();

            try
            {
                if (Utility.UserId < 0)
                {
                    return(BadRequest(Utility.INVALID_USER));
                }

                if (getFAQRequest == null)
                {
                    getFAQRequest = new GetFAQRequest();
                }

                if (getFAQRequest.PageSize == null)
                {
                    getFAQRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                }

                var fAQ = new FAQ()
                {
                    FAQId            = getFAQRequest.FAQId,
                    SearchText       = getFAQRequest.SearchText,
                    IsActive         = getFAQRequest.IsActive,
                    PageNumber       = getFAQRequest.PageNumber,
                    PageSize         = Convert.ToInt32(getFAQRequest.PageSize),
                    IsPagingRequired = (getFAQRequest.PageNumber != null) ? true : false,
                    OrderBy          = getFAQRequest.OrderBy,
                    OrderByDirection = getFAQRequest.OrderByDirection
                };
                var fAQs = iFAQ.GetFAQ(fAQ);

                var fAQList = new List <GetFAQResponse>();
                foreach (var fAQDetail in fAQs)
                {
                    fAQList.Add(new GetFAQResponse()
                    {
                        FAQId          = Convert.ToInt32(fAQDetail.FAQId),
                        CategoryId     = Convert.ToInt32(fAQDetail.CategoryId),
                        CategoryName   = fAQDetail.CategoryName,
                        TopicName      = fAQDetail.TopicName,
                        PDF            = fAQDetail.PDF,
                        IsActive       = Convert.ToBoolean(fAQDetail.IsActive),
                        CreatedBy      = fAQDetail.CreatedBy,
                        TotalPageCount = fAQDetail.TotalPageCount,
                        TotalRecord    = fAQDetail.TotalRecord
                    });
                }

                responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                responses.Description = "FAQ retrieved successfully";
                responses.Response    = fAQList;
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while retrieving FAQ.";

                Utility.WriteLog("GetFAQ", getFAQRequest, "Error while retrieving FAQ. (FAQUserController)", ex.ToString());
            }
            return(Ok(responses));
        }
        public NegotiatedContentResult <GetAllResponse> GetAllFAQs(GetFAQRequest request)
        {
            GetAllResponse resp = FaqServices.GetAll(request);

            return(Content(HttpStatusCode.OK, resp));
        }