Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. onPress: function(oEvent) {
  2. var event = this.getView().getModel("loggin").getProperty("/TypeCon");
  3. var TestMode = this.getView().getModel("loggin").getProperty("/TestMode");
  4.  
  5. if (event == ""){
  6. event = "SAP";
  7. }
  8.  
  9.  
  10. if (event != 'SAP'){
  11. MessageToast.show("Esta conexão ainda não está disponível");
  12. }else{
  13.  
  14. if(TestMode == 'X'){
  15. this.getRouter().navTo("CockpitGo");
  16. }else{
  17.  
  18. var oEntry = {};
  19. oEntry.User= this.getView().getModel("loggin").getProperty("/User");
  20. oEntry.Password= this.getView().getModel("loggin").getProperty("/Password");
  21.  
  22. var sServiceUrl = "http://abapfox.ddns.net:8000/sap/opu/odata/SAP/YLOGGIN_DATA_SRV/";
  23. var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);
  24.  
  25. //Vamos montar antes o URI pra ver se fica tudo certinho:
  26. var Uri = "/sap/opu/odata/SAP/YLOGGIN_DATA_SRV/LoginDataSet(User='" + oEntry.User + "',Password='" + oEntry.Password + "')";
  27. OData.request({
  28. requestUri: Uri,
  29. method: "GET",
  30. headers: {
  31. "X-Requested-With": "XMLHttpRequest",
  32. "Content-Type": "application/atom+xml",
  33. "DataServiceVersion": "2.0",
  34. "X-CSRF-Token": "Fetch"
  35. }
  36. },
  37. function(data, response) {
  38. if (data.Success === true) {
  39. // show message
  40. MessageToast.show(data.Message);
  41. this.getRouter().navTo("CockpitGo");
  42. } else {
  43. // show message
  44. MessageToast.show(data.Message);
  45.  
  46. }
  47. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement