public AddOrderRecieptResponse AddOrderReciept(AddOrderRecieptRequest request) { AddOrderRecieptResponse addOrderRecieptResponse = new AddOrderRecieptResponse(); addOrderRecieptResponse.Message = "Reciept order not added successfully."; if (String.IsNullOrEmpty(request.AuthToken)) { addOrderRecieptResponse.Message = "Please pass all mandatory fields."; return(addOrderRecieptResponse); } AuthenticationToken authToken = new Helper().GetAuthenticationToken(request.AuthToken); if (authToken == null) { addOrderRecieptResponse.Message = "Unauthorizes user."; return(addOrderRecieptResponse); } if (request.ReceiverStoreID == 0 || request.RecieptID == 0) { addOrderRecieptResponse.Message = "Please pass all values."; return(addOrderRecieptResponse); } ReceiptOrderEL recieptOrderEL = new ReceiptOrderEL(); request.SenderStoreID = Convert.ToInt32(authToken.FkUserID); recieptOrderEL = MapperUtility.MapTo(request, recieptOrderEL); if (orderReceiptHelper.IsOrderRecieptAvailable(recieptOrderEL)) { addOrderRecieptResponse.Message = "This reciept already sent to this store."; return(addOrderRecieptResponse); } if (orderReceiptHelper.AddOrderReceipt(recieptOrderEL)) { addOrderRecieptResponse.Message = "Reciept order added successfully."; addOrderRecieptResponse.IsSuccess = true; RecieptEL recEL = new RecieptEL(); recEL.Price = "0.00"; recEL.Status = ((int)ReceiptStatus.ProcessedToVendor).ToString(); recEL.RecieptID = request.RecieptID; receiptHelper.UpdateOrderReceipt(recEL); return(addOrderRecieptResponse); } else { addOrderRecieptResponse.Message = "Some error occured."; return(addOrderRecieptResponse); } }
private async void SendRecieptClicked(object obj) { AddOrderRecieptRequest addOrderRecieptRequest = new AddOrderRecieptRequest(); addOrderRecieptRequest.AuthToken = SessionHelper.AccessToken; addOrderRecieptRequest.ListReceiverStoreIDs = ListReceiversID; addOrderRecieptRequest.OrderTime = DateTime.Now.ToString(); addOrderRecieptRequest.ReceiverStoreId = 30; addOrderRecieptRequest.RecieptId = GlobalRecieptID; addOrderRecieptRequest.SenderStoreId = 29; JsonValue addOrderRecieptResponse = await HttpRequestHelper <AddOrderRecieptRequest> .POSTreq(ServiceTypes.AddOrderReciept, addOrderRecieptRequest); AddOrderRecieptResponce addOrderRecieptResponce = JsonConvert.DeserializeObject <AddOrderRecieptResponce>(addOrderRecieptResponse.ToString()); if (addOrderRecieptResponce.IsSuccess) { await App.Current.MainPage.DisplayAlert("Success", addOrderRecieptResponce.Message, "Ok"); } else { await App.Current.MainPage.DisplayAlert("Error", addOrderRecieptResponce.Message, "Ok"); } }