Ejemplo n.º 1
0
        private async void AddRecieptClicked(object obj)
        {
            AddRecieptRequest addRecieptRequest = new AddRecieptRequest();

            addRecieptRequest.AuthToken = SessionHelper.AccessToken;
            RecieptDTO recieptDTO = new RecieptDTO();

            recieptDTO.AddedOn           = DateTime.Now.ToString();
            recieptDTO.Name              = Name;
            recieptDTO.Price             = "";
            recieptDTO.RecieptID         = 0;
            recieptDTO.Status            = ReceiptStatusEnum.New.ToString();
            recieptDTO.StoreID           = 0;
            addRecieptRequest.recieptDTO = recieptDTO;
            JsonValue AddRecieptResponse = await HttpRequestHelper <AddRecieptRequest> .POSTreq(ServiceTypes.AddReciept, addRecieptRequest);

            AddRecieptResponse addRecieptResponse = JsonConvert.DeserializeObject <AddRecieptResponse>(AddRecieptResponse.ToString());

            if (addRecieptResponse.IsSuccess)
            {
                var mdp     = (Application.Current.MainPage as MasterDetailPage);
                var navPage = mdp.Detail as NavigationPage;
                await navPage.PushAsync(new ListManagement(), true);
            }
        }
Ejemplo n.º 2
0
        public AddRecieptResponse AddReciept(AddRecieptRequest request)
        {
            AddRecieptResponse addRecieptResponse = new AddRecieptResponse();

            addRecieptResponse.Message = "Reciept not added successfully.";

            if (String.IsNullOrEmpty(request.AuthToken))
            {
                addRecieptResponse.Message = "Please pass all mandatory fields.";
                return(addRecieptResponse);
            }

            AuthenticationToken authToken = new Helper().GetAuthenticationToken(request.AuthToken);

            if (authToken == null)
            {
                addRecieptResponse.Message = "Unauthorizes user.";
                return(addRecieptResponse);
            }

            if (String.IsNullOrEmpty(request.recieptDTO.Name))
            {
                addRecieptResponse.Message = "Please pass reciept name.";
                return(addRecieptResponse);
            }

            RecieptEL recieptEL = new RecieptEL();

            recieptEL = MapperUtility.MapTo(request.recieptDTO, recieptEL);
            if (receiptHelper.AddReceipt(recieptEL))
            {
                addRecieptResponse.Message   = "Reciept added successfully.";
                addRecieptResponse.IsSuccess = true;
                return(addRecieptResponse);
            }
            else
            {
                addRecieptResponse.Message = "Some error occured.";
                return(addRecieptResponse);
            }
        }
Ejemplo n.º 3
0
        public AddRecieptResponse UpdateRecieptStatus(AddRecieptRequest request)
        {
            AddRecieptResponse addRecieptResponse = new AddRecieptResponse();

            addRecieptResponse.Message = "Reciept status not updated successfully.";

            if (String.IsNullOrEmpty(request.AuthToken))
            {
                addRecieptResponse.Message = "Please pass all mandatory fields.";
                return(addRecieptResponse);
            }

            AuthenticationToken authToken = new Helper().GetAuthenticationToken(request.AuthToken);

            if (authToken == null)
            {
                addRecieptResponse.Message = "Unauthorizes user.";
                return(addRecieptResponse);
            }

            RecieptEL recieptEL = new RecieptEL();

            recieptEL.Status = request.recieptDTO.Status;
            recieptEL.Price  = request.recieptDTO.Price;
            if (receiptHelper.UpdateOrderReceipt(recieptEL))
            {
                addRecieptResponse.Message   = "Reciept status updated successfully.";
                addRecieptResponse.IsSuccess = true;
                return(addRecieptResponse);
            }
            else
            {
                addRecieptResponse.Message = "Some error occured.";
                return(addRecieptResponse);
            }
        }