Example #1
0
        public HttpResponseMessage DeleteFromBasket()
        {
            CirculationInfo Circulation = new CirculationInfo();
            BasketDelete    request;
            string          JSONRequest = Request.Content.ReadAsStringAsync().Result;

            try
            {
                request = JsonConvert.DeserializeObject <BasketDelete>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }

            try
            {
                Circulation.DeleteFromBasket(request);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }
            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #2
0
        public HttpResponseMessage Authorize()
        {
            string        JSONRequest = Request.Content.ReadAsStringAsync().Result;
            AuthorizeInfo request;

            try
            {
                request = JsonConvert.DeserializeObject <AuthorizeInfo>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }
            ReaderInfo reader;

            try
            {
                reader = ReaderInfo.Authorize(request);
            }
            catch (Exception ex)
            {
                HttpResponseMessage rm = ALISErrorFactory.CreateError("R001", Request);
                return(rm);
            }
            ReaderSimpleView result = ReaderViewFactory.GetReaderSimpleView(reader);

            return(ALISResponseFactory.CreateResponse(result, Request));
        }
Example #3
0
        public HttpResponseMessage SetPasswordLocalReader()
        {
            string JSONRequest = Request.Content.ReadAsStringAsync().Result;
            SetPasswordLocalReader request;

            try
            {
                request = JsonConvert.DeserializeObject <SetPasswordLocalReader>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }

            ReaderInfo reader;

            try
            {
                reader = ReaderInfo.GetReader(request.ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError("R004", Request));
            }
            try
            {
                reader.SetPasswordLocalReader(request, reader);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }

            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #4
0
        public HttpResponseMessage PreRegisterRemoteReader()
        {
            ALISReaderRemote.ReaderRemote re = new ALISReaderRemote.ReaderRemote(RegisterConnectionString);
            string JSONRequest = Request.Content.ReadAsStringAsync().Result;
            PreRegisterRemoteReader request;

            try
            {
                request = JsonConvert.DeserializeObject <PreRegisterRemoteReader>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }
            DateTime BirthDate;

            if (!DateTime.TryParseExact(request.BirthDate, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out BirthDate))
            {
                throw new Exception("G001");
            }
            try
            {
                re.RegSendEmailAndSaveTemp(request.FamilyName, request.Name, request.FatherName, BirthDate, request.Email, request.CountryId, request.MobilePhone, request.Password);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #5
0
        public HttpResponseMessage GetLoginType()
        {
            string    JSONRequest = Request.Content.ReadAsStringAsync().Result;
            UserLogin request     = new UserLogin();

            try
            {
                request = JsonConvert.DeserializeObject <UserLogin>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }


            string result = ReaderInfo.GetLoginType(request.Login);

            if (result.ToLower() == "notdefined")
            {
                return(ALISErrorFactory.CreateError("R003", Request));
            }
            LoginType type = new LoginType();

            type.LoginTypeValue = result;
            return(ALISResponseFactory.CreateResponse(type, Request));
        }
Example #6
0
        public HttpResponseMessage SetPasswordRemoteReader()
        {
            string JSONRequest = Request.Content.ReadAsStringAsync().Result;
            SetPasswordRemoteReader request;

            try
            {
                request = JsonConvert.DeserializeObject <SetPasswordRemoteReader>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }

            ReaderRemote re = new ReaderRemote(RegisterConnectionString);

            try
            {
                re.PasSaveBaseAndDelTemp(request.Url, request.Password);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #7
0
        public HttpResponseMessage CheckPasswordUrl()
        {
            string           JSONRequest = Request.Content.ReadAsStringAsync().Result;
            CheckPasswordUrl request;

            try
            {
                request = JsonConvert.DeserializeObject <CheckPasswordUrl>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }

            ReaderRemote re = new ReaderRemote(RegisterConnectionString);

            try
            {
                re.PasGetURL(request.Url);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #8
0
        //[ResponseType(typeof(ReaderInfo))]
        public HttpResponseMessage Order()
        {
            string    JSONRequest = Request.Content.ReadAsStringAsync().Result;
            MakeOrder request;

            try
            {
                request = JsonConvert.DeserializeObject <MakeOrder>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }

            CirculationInfo Circulation = new CirculationInfo();


            try
            {
                Circulation.MakeOrder(request);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #9
0
        public HttpResponseMessage ByEmail()
        {
            string    JSONRequest = Request.Content.ReadAsStringAsync().Result;
            UserEmail request     = new UserEmail();

            try
            {
                request = JsonConvert.DeserializeObject <UserEmail>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }


            ReaderInfo reader;

            try
            {
                reader = ReaderInfo.GetReader(request.Email);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            if (reader == null)
            {
                return(ALISErrorFactory.CreateError("R004", Request));
            }
            ReaderSimpleView result = ReaderViewFactory.GetReaderSimpleView(reader);

            return(ALISResponseFactory.CreateResponse(result, Request));
        }
        public HttpResponseMessage CountriesList()
        {
            Dictionary <int, string> Countries;

            try
            {
                Countries = ReaderInfo.GetCountriesList();
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(Countries, Request));
        }
Example #11
0
        public HttpResponseMessage ProlongOrder(int OrderId)
        {
            CirculationInfo Circulation = new CirculationInfo();

            try
            {
                Circulation.ProlongOrder(OrderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(Request));
        }
Example #12
0
        public HttpResponseMessage Basket([Description("Номер чит билета")] int ReaderId)
        {
            CirculationInfo   Circulation = new CirculationInfo();
            List <BasketInfo> basket;

            try
            {
                basket = Circulation.GetBasket(ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }
            return(ALISResponseFactory.CreateResponse(basket, Request));
        }
Example #13
0
        public HttpResponseMessage Orders([Description("Номер чит билета")] int ReaderId)
        {
            CirculationInfo  Circulation = new CirculationInfo();
            List <OrderInfo> result      = new List <OrderInfo>();

            try
            {
                result = Circulation.GetOrders(ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(result, Request));
        }
Example #14
0
        public HttpResponseMessage LitresAccount([Description("Номер чит билета")] int ReaderId)
        {
            CirculationInfo Circulation = new CirculationInfo();
            LitresInfo      result;

            try
            {
                result = Circulation.GetLitresAccount(ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(result, Request));
        }
Example #15
0
        public HttpResponseMessage OrdersById(int OrderId)
        {
            CirculationInfo Circulation = new CirculationInfo();
            OrderInfo       result      = new OrderInfo();

            try
            {
                result = Circulation.GetOrder(OrderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(result, Request));
        }
Example #16
0
        public HttpResponseMessage AssignLitresAccount(int ReaderId)
        {
            CirculationInfo Circulation = new CirculationInfo();
            LitresInfo      result;

            try
            {
                result = Circulation.AssignLitresAccount(ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            return(ALISResponseFactory.CreateResponse(result, Request));
        }
Example #17
0
        public HttpResponseMessage Get(int ReaderId)
        {
            ReaderInfo reader;

            try
            {
                reader = ReaderInfo.GetReader(ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            ReaderSimpleView result = ReaderViewFactory.GetReaderSimpleView(reader);

            return(ALISResponseFactory.CreateResponse(result, Request));
        }
Example #18
0
        public HttpResponseMessage Get(string id)
        {
            BookSimpleView book;

            try
            {
                book = ViewFactory.GetBookSimpleViewWithAvailabilityStatus(id);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            if (book == null)
            {
                return(ALISErrorFactory.CreateError("B001", Request));
            }
            return(ALISResponseFactory.CreateResponse(book, Request));
        }
Example #19
0
        public HttpResponseMessage GetElectronicCopyFullView(string id)
        {
            ElectronicCopyFullView book;

            try
            {
                book = ViewFactory.GetElectronicCopyFullView(id);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }
            if (book == null)
            {
                return(ALISErrorFactory.CreateError("B001", Request));
            }
            return(ALISResponseFactory.CreateResponse(book, Request));
        }
Example #20
0
        public HttpResponseMessage IsBirthDateMatchReaderId()
        {
            string JSONRequest = Request.Content.ReadAsStringAsync().Result;
            BirthDateMatchReaderId request;

            try
            {
                request = JsonConvert.DeserializeObject <BirthDateMatchReaderId>(JSONRequest, ALISSettings.ALISDateFormatJSONSettings);
            }
            catch
            {
                return(ALISErrorFactory.CreateError("G001", Request));
            }

            ReaderInfo reader;

            try
            {
                reader = ReaderInfo.GetReader(request.ReaderId);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError("R004", Request));
            }
            BooleanResponse result = new BooleanResponse();

            try
            {
                result.Result = reader.IsBirthDateMatchReaderId(request);
            }
            catch (Exception ex)
            {
                return(ALISErrorFactory.CreateError(ex.Message, Request));
            }

            return(ALISResponseFactory.CreateResponse(result, Request));
        }
 public HttpResponseMessage StatusNameList()
 {
     return(ALISResponseFactory.CreateResponse(CirculationStatuses.ListView, Request));
 }
 public HttpResponseMessage StatusNameToReadiness()
 {
     return(ALISResponseFactory.CreateResponse(KeyValueMapping.StatusNameToReadiness, Request));
 }
 public HttpResponseMessage ALISErrorList()
 {
     return(ALISResponseFactory.CreateResponse(LibflClassLibrary.ALISAPI.Errors.ALISErrorList._list, Request));
 }
 public HttpResponseMessage AccessCodeToOrderType()
 {
     return(ALISResponseFactory.CreateResponse(KeyValueMapping.AccessCodeToOrderTypeId, Request));
 }
 public HttpResponseMessage AccessCodeToName()
 {
     return(ALISResponseFactory.CreateResponse(KeyValueMapping.AccessCodeToNameALISVersion, Request));
 }
 public HttpResponseMessage LocationCodeToName()
 {
     return(ALISResponseFactory.CreateResponse(KeyValueMapping.LocationCodeToName, Request));
 }
 public HttpResponseMessage OrderTypeList()
 {
     return(ALISResponseFactory.CreateResponse(OrderTypes.ListView, Request));
 }