1app.controller('UserController', function ($scope, Profileservice, ChangePasswordservice, Loginservice, blockUI, TokenNumber) { 2 3 $scope.flagvalue; 4 $scope.UserProfile = null; 5 6 //var flag = ChangePasswordservice.isUserLogin().success(function (data) { 7 // //alert(data); 8 // if (data == 'False') 9 // $('#myModal').modal('show'); 10 // else { 11 12 $scope.UserProfileID = $('#User').val(); 13 // alert($('#User').val()); 14 15 blockUI.start(); 16 if ($scope.UserProfileID > 0) { 17 GetuserRecords(); 18 } 19 20 blockUI.stop(); 21 22 23 //} 24 //}) 25 26 function GetuserRecords() { 27 var promiseGet = Profileservice.GetUserData($scope.UserProfileID); 28 promiseGet.then(function (pl) { 29 // alert(pl.data.loggedby); 30 $scope.AreaRecord = pl.data; 31 //////////localStorage.setItem("name", $scope.AreaRecord.Name); 32 //////////localStorage.setItem("city", $scope.AreaRecord.City); 33 //////////localStorage.setItem("email", $scope.AreaRecord.EmailID);
34 //////////localStorage.setItem("phone", $scope.AreaRecord.PhoneNumber); 35 setTimeout(function () { 36 $scope.UserProfile.Name = $scope.AreaRecord.Name; 37 $scope.UserProfile.City = $scope.AreaRecord.City; 38 $scope.UserProfile.EmailID = $scope.AreaRecord.EmailID; 39 $scope.UserProfile.PhoneNumber = $scope.AreaRecord.PhoneNumber; 40 }, 2000) 41 42 43 44 if (pl.data.loggedby == 2) { 45 $("#editEmail").attr("readonly", "readonly"); 46 } else { 47 $("#editPhone").attr("readonly", "readonly"); 48 } 49 }, 50 function (pl) { 51 $scope.error = "An Error has occured while Loading users! " + pl.ExceptionMessage; 52 }); 53 54 55 // $scope.AreaRecord.Name = localStorage.name; 56 } 57 58 $scope.UpdateUser = function (UserProfile) { 59 debugger; 60 var flag = ChangePasswordservice.isUserLogin().success(function (data) { 61 console.log(flag); 62 if (data == 'False') 63 $('#myModal').modal('show'); 64 65 else { 66 67 if (UserProfile.$valid) { 68 $scope.AreaRecord.City = $('#City').val(); 69 blockUI.start(); 70 71 var currentUser = { Name: $scope.AreaRecord.Name, City: $scope.AreaRecord.City, EmailID: $scope.AreaRecord.EmailID, PhoneNumber: $scope.AreaRecord.PhoneNumber, ID: $scope.UserProfileID, loggedby: $scope.AreaRecord.loggedby } 72 var promisePost = Profileservice.UpdateUser(currentUser); 73 console.log(promisePost); 74 promisePost.then(function (pl) { 75 76 if (pl.data.Status != 0) { 77 $scope.error = pl.data.Message; 78 $("#AlertMsg").removeClass("alert-success"); 79 $("#AlertMsg").addClass("alert-danger"); 80 } else { 81 82 $("#AlertMsg").removeClass("alert-danger"); 83 $("#AlertMsg").addClass("alert-success"); 84 } 85 blockUI.stop(); 86 $("#pMesagess").html(pl.data.Message); 87 $scope.error = pl.data.Message;// "Your profile has been updated successfully."; 88 //$('#AlertMsg').show(); 89 $('#AlertMsg').show(0).delay(18000).hide(0); 90 setTimeoutAlertMsg(); 91 /// window.location.href = "Index?GetType=3&IsUpdate=1"; 92 }, function (data) { 93 $scope.error = "An Error has occured while Updating user! " + data.ExceptionMessage; 94 }); 95 } 96 } 97 }) 98 99 }; 100 101 $scope.HideMsg = function () { 102 $('#AlertMsg').hide(); 103 } 104 $scope.Close = function () { 105 $('#AlertMsg').hide(); 106 } 107 108 109 $scope.SignUp = function (UserProfile) { 110 111 if (UserProfile.$valid) { 112 113 blockUI.start(); 114 var currentUser = { EmailID: $scope.EmailID, Name: $scope.Name, Password: $scope.Password, PhoneNumber: $scope.PhoneNumber, City: "Jaipur,Rajasthan,India", TokenNo: TokenNumber } 115 var promisePost = Profileservice.SignUp(currentUser); 116 promisePost.then(function (data) { 117 118 //alert(JSON.stringify(data)); 119 //alert(data[0].Status); 120 //alert(data.Status); 121 // alert(data.data.Status); 122 //alert(data.Message); 123 $scope.error = data.data.Message; 124 // alert(data.TransactionMessage.Status); 125 126 if (data.data.Status == "0") { 127 var currentUser1 = { UserName: $scope.EmailID, Password: $scope.Password } 128 var flag = Loginservice.Login(currentUser1).success(function (data1) { 129 //$scope.users = data1; 130 //alert(data1.Message); 131 //if (data1.TransactionMessage.Status == "0") { 132 //alert(angular.toJson(data1)); 133 //alert(data1.Message); 134 //$scope.error = data1.Message; 135 //if (data.data.Status == 0) { 136 window.location.href = location.href.split('#')[0]; 137 //} 138 139 140 141 //} 142 }) 143 } 144 145 $('#AlertMsg').show(); 146 blockUI.stop(); 147 }, function (data) { 148 $scope.error = "An Error has occured while Updating user! " + data.ExceptionMessage; 149 }); 150 } 151 } 152 153 function setTimeoutAlertMsg() { 154 setTimeout(function () { 155 $("#AlertMsg").fadeOut(); 156 }, 5000); 157 } 158 159 //function Login(username, password ) { 160 161 // var currentUser = { UserName: $scope.UserName, Password: $scope.Password } 162 // var flag = Loginservice.Login(currentUser).success(function (data) { 163 // $scope.users = data; 164 // if (data.TransactionMessage.Status == "0") { 165 // $scope.UserId = data.UserId; 166 // $('#UserID').text(data.UserId); 167 // //$cookies['PLAY_SESSION']; 168 // //$cookieStore.get('UserId'); 169 // //$('#myModal').modal('hide'); 170 // // $('#divUser').show(); 171 // // $('#divLogin').hide(); 172 // //alert($scope.UserId); 173 // // $('#UserID').text($scope.UserId); 174 175 // //alert($('#UserID').text()); 176 // //alert(location.href); 177 // //alert(window.location.href.split('#')[0]); 178 // window.location.href = location.href.split('#')[0]; 179 // //$location.path(location.href); 180 // } 181 // }).error(function (data) { 182 // $scope.error = "An Error has occured while Updating user! " + data.ExceptionMessage; 183 // });
184 185 //} 186 187});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.