public HttpResponseMessage GetHistory(Filter _Filter)
        {
            DResponse _DResponse = new DResponse();

            try
            {
                if (!FilterValidation.ValidateFilter(_Filter, ref StrErrMsg))
                {
                    throw new Exception(StrErrMsg);
                }

                _DResponse.Data   = CountSubSet.GetHistory(_Filter);
                _DResponse.status = "success";

                Logger.WritetoFile(LogPath, "Success in Request History: " + _DResponse.status + " at DateTime : " + DateTime.Now);

                return(Request.CreateResponse <DResponse>(HttpStatusCode.OK, _DResponse));
            }
            catch (Exception ex)
            {
                _DResponse.status = ex.Message;

                Logger.WritetoFile(LogPath, "Error in History : " + ex.Message + " at DateTime : " + DateTime.Now);
                return(Request.CreateResponse <DResponse>(HttpStatusCode.BadRequest, _DResponse));
            }
        }
示例#2
0
        public HttpResponseMessage Get(string searchString, string asc, int pageIndex, int pageSizeSelected, string sortKey)
        {
            DResponse           dto     = new DResponse();
            CRUDService         service = new CRUDService();
            HttpResponseMessage response;

            try
            {
                dto      = service.GetDResponse(searchString, pageIndex, pageSizeSelected, sortKey, asc);
                response = Request.CreateResponse(HttpStatusCode.OK, dto);
            }
            catch (ApplicationException ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
            }

            return(response);
        }
示例#3
0
        /*Berem SQLite bazo preko navadnega selecta*/
        public DResponse GetDResponse(string SearchString, int pageIndex, int pageSelected, string sortKey, string asc)
        {
            DaoService dao = new DaoService();
            DResponse  dto;

            try
            {
                dto = new DResponse
                {
                    DataList = dao.GetData(SearchString.Replace("undefined", ""), pageIndex, pageSelected, sortKey, asc),
                    //RowsCount = dao.GetRowsCount(SearchString)
                    RowsCount = 10
                };
            }
            catch (Exception ex)
            {
                Log.Error("Napaka pri branju Aplikacij /" + ex);
                throw new ApplicationException("Napaka pri branju Aplikacij /" + ex);
            }

            return(dto);
        }