public User_Response SignIn(User_Request userRequest) { User_Response objUserResponse = new User_Response(); try { var vList = GetUserByLoginId(userRequest.Login_Id); if (vList == null && vList.isActive != 1) { throw new UserNotFoundException("User Not Found"); } objUserResponse.isAvailable = true; if (!userPasswordRepository.VerifyPassword(userRequest.Password, vList.Password.ToString())) { throw new OldPasswordDoesNotMatchException("Old Password Does Not Match. Please Enter New Password."); } objUserResponse.User_Id = vList.User_Id; objUserResponse.Login_Id = vList.Login_Id; objUserResponse.EmpName = vList.FirstName + " " + vList.MiddleName + " " + vList.LastName; // objUserResponse.Company_Id = vList.Company_Id; if (vList.PasswordExpiryDate <= DateTime.Now) //need one check for temporary password { objUserResponse.isExpired = true; } else { objUserResponse.isExpired = false; } objUserResponse.Token_No = tokenService.GenerateToken(); tokenService.Add(new User_Token { User_Id = vList.User_Id, Token_No = objUserResponse.Token_No, AddedBy = vList.User_Id }); objUserResponse.isVerify = true; //users role list objUserResponse.UserRoles = GetUserActiveRolesList(vList.User_Id); } catch (Exception ex) { objUserResponse.Reset(); throw ex; } finally { //create UserLog AddUserLog(userRequest.Ip_Address, userRequest.Host_Name, userRequest.User_Id, userRequest.Login_Id); } return(objUserResponse); }
public Nutzungsbedingungen(User_Response user = null) { //anzeige der Nutzungsbedingungen InitializeComponent(); if (user != null) { UserManagment.IsVisible = true; this.user = user.id; } else { UserManagment.IsVisible = false; } }
public User_Response SignIn(User_Request userRequest) { User_Response objUserResponse = new User_Response(); try { var vList = GetUserByLoginId(userRequest.Login_Id); if (vList != null && vList.isActive == 1) { objUserResponse.isAvailable = true; bool blnVerify = user_PasswordRepository.VerifyPassword(userRequest.Password, vList.Password.ToString()); if (blnVerify) { objUserResponse.User_Id = vList.User_Id; objUserResponse.Login_Id = vList.Login_Id; objUserResponse.Company_Id = vList.Company_Id; if (vList.PasswordExpiryDate <= DateTime.Now) //need one check for temporary password { objUserResponse.isTemporary = true; } else { objUserResponse.Token_No = tokenService.GenerateToken(); tokenService.Add(new User_Token { User_Id = vList.User_Id, Token_No = objUserResponse.Token_No, AddedBy = vList.User_Id }); objUserResponse.isTemporary = false; objUserResponse.isVerify = true; } } } } catch (Exception ex) { throw ex; } finally { //create UserLog AddUserLog(userRequest.Ip_Address, userRequest.Host_Name, userRequest.User_Id, userRequest.Login_Id); } return(objUserResponse); }
private async void UnitTest_Page_Loaded(object sender, RoutedEventArgs e) { // NOTE(duan): get root Root_Response GET_ROOT = await LiveCodingAPI.GetRoot(); // NOTE(duan): get coding categories CodingCategoryList_Response GET_CODING_CATEGORIES = await LiveCodingAPI.GetCodingCategories(); // build the ViewModel _vm_coding_category.DataSource = new ObservableCollection <CodingCategory>(GET_CODING_CATEGORIES.CodingCategories); // set the datacontext HS_CodingCategory.DataContext = _vm_coding_category; CodingCategory_Response GET_SINGLE_CODE_CATEGORY = null; if (GET_CODING_CATEGORIES != null) { if (GET_CODING_CATEGORIES.CodingCategories.Count > 0) { GET_SINGLE_CODE_CATEGORY = await LiveCodingAPI.GetCodingCategoryByName(GET_CODING_CATEGORIES.CodingCategories[0].Name); } } // NOTE(duan): get languages LanguageList_Response GET_LANGUAGES = await LiveCodingAPI.GetLanguages(); // build ViewModel _vm_language.DataSource = new ObservableCollection <Language>(GET_LANGUAGES.Languages); // set the datacontext HS_Language.DataContext = _vm_language; // NOTE(duan): get a single language Language_Response GET_LANGUAGE_BY_NAME = await LiveCodingAPI.GetLanguageByName("French"); // NOTE(duan): get a list of livestreams // LiveStreamList_Response GET_LIVESTREAMS = await LiveCodingAPI.GetLiveStreams(); LiveStreamList_Response GET_LIVESTREAMS = await LiveCodingAPI.GetOnAirStreams(); // build the ViewModel _vm_livestream.DataSource = new ObservableCollection <LiveStream>(GET_LIVESTREAMS.LiveStreams); // set the datacontext HS_LiveStream.DataContext = _vm_livestream; // NOTE(duan): get a single stream LiveStream_Response GET_STREAM = await LiveCodingAPI.GetStreamByName("chubosaurus"); // NOTE(duan): get scheduled broadcasts ScheduledBroadcastList_Response GET_SCHEDULED = await LiveCodingAPI.GetScheduledBroadcast(); // NOTE(duan): get scheduled broadcast by id ScheduledBroadcast_Response GET_SCHEDULED_BROADCAST_BY_ID = null; if (GET_SCHEDULED != null) { if (GET_SCHEDULED.ScheduledBroadcasts.Count > 0) { GET_SCHEDULED_BROADCAST_BY_ID = await LiveCodingAPI.GetScheduledBroadcastById(GET_SCHEDULED.ScheduledBroadcasts[0].Id); } } // NOTE(duan): get current user info User_Response GET_USER = await LiveCodingAPI.GetCurrentUser(); // NOTE(duan): get followers UserList_Response GET_USER_FOLLOWER = await LiveCodingAPI.GetCurrentUserFollowers(); // NOTE(duan): get following UserList_Response GET_USER_FOLLOW_LIST = await LiveCodingAPI.GetCurrentUserFollowing(); // NOTE(duan): get viewing key ViewKey_Response GET_VK = await LiveCodingAPI.GetUserViewingKey(); // NOTE(duan): get chat account XMPPAccount_Response GET_CHAT_ACCOUNT = await LiveCodingAPI.GetUserChatAccount(); // NOTE(duan): get the user's channel AuthenticatedLiveStreamList_Response GET_USER_CHANNEL = await LiveCodingAPI.GetUserChannel(); // NOTE(duan): get the user's channel (on-air) AuthenticatedLiveStreamList_Response GET_USER_CHANNEL_ON_AIR = await LiveCodingAPI.GetUserChannelOnAir(); // NOTE(duan): get the user's videos VideoList_Response GET_USER_VIDEOS = await LiveCodingAPI.GetUserVideos(); LatestVideoList_Response GET_USER_LATEST_VIDEOS = await LiveCodingAPI.GetUserLatestVideos(); // build the ViewModel //_vm_video.DataSource = new ObservableCollection<Video>(GET_USER_VIDEOS.Videos); _vm_video.DataSource = new ObservableCollection <Video>(GET_USER_LATEST_VIDEOS); // set the datacontext HS_Videos.DataContext = _vm_video; // NOTE(duan): get public user information User_Response PUBLIC_USER = await LiveCodingAPI.GetUserInfo("chubosaurus"); // NOTE(duan): get all vidoes VideoList_Response ALL_VIDEOS = await LiveCodingAPI.GetVideoList(); Video_Response SINGLE_VIDEO = null; if (ALL_VIDEOS != null) { if (ALL_VIDEOS.Videos.Count > 0) { SINGLE_VIDEO = await LiveCodingAPI.GetVideoBySlug(ALL_VIDEOS.Videos[0].Slug); } } }
async void StartButton_Clicked(object sender, EventArgs e) { // Zählvariable wenn i == 1 sind den Nutzungsbedigungen schon zugestimmt bei 0 müssen diesen noch zugestimmt werden int i = 0; string err; if (!this.IsBusy) { //Ladebalken startet try { this.IsBusy = true; los.IsVisible = false; await Task.Run(() => { string ids; if (Application.Current.Properties.ContainsKey("Zst")) { ids = Convert.ToString(Application.Current.Properties["Zst"]); } else { ids = "false"; } //restaufruf //request_User param = new request_User() { Id = ids }; //String request = JsonConvert.SerializeObject(param); //RESTConnector rconn = new RESTConnector(); //User_Response erg = new User_Response() { }; //string answer; //string adress = "http://192.168.178.41:4438/api/UsersManagment"; //string adress = "http://localhost:50088/api/Usermanagment"; //auswerten nach (timeout?) // answer = rconn.HTTP_POST(adress, request, 5, false); //if (answer.Contains("REST_HTTP_ERROR")) //{ //kein Antwort vom Webservice user muss Nutzungsbedingungen zustimmen //Navigation.PushModalAsync(new Nutzungsbedingungen()); //erg.id = ""; if (ids == "false") { i = 0; } if (ids == "false") { i = 0; } if (ids == "true") { i = 1; } //Vereinfachung //if (Application.Current.Properties.ContainsKey("id")) //{ // i = 1; //} //else //{ // i = 0; //} //p = new Nutzungsbedingungen(erg); // Navigation.PushModalAsync(new Nutzungsbedingungen(erg)); // } //else //{ // erg = JsonConvert.DeserializeObject<User_Response>(answer); // if (erg.EventStatus == 1) // { // Application.Current.Properties.Clear(); // Application.Current.Properties.Add("id", erg.id); // Application.Current.SavePropertiesAsync(); // } // if (erg.EventStatus == -1) // { // //gab einen Fehler User wurde nicht gefunden oder in DB eingetragen --muss daher Nutzerbedignugen zustimmen // i = 0; // //Navigation.PushModalAsync(new Nutzungsbedingungen(erg)); // } // if (erg.Nutzung == true) // { // //User wurd erkannt und hat bereits den Bedingeunen zusgestimmt er kann die App sofort nutzen // i = 1; // // Navigation.PushModalAsync(new MasterDetailPage1()); // } // else // { // //User wurde erkannt oder neu angelegt und hat den Nutzerbedignugen noch nicht zusgtstimmt und muss dies erst machen bevor er die App nutzen kann // i = 0; // //Navigation.PushModalAsync(new Nutzungsbedingungen(erg)); // } //} }); } //Ladebalken schließt finally { this.IsBusy = false; los.IsVisible = true; if (i == 0) { User_Response er = new User_Response() { }; er.id = ""; await Navigation.PushModalAsync(new Nutzungsbedingungen(er)); } else if (i == 1) { await Navigation.PushModalAsync(new MasterDetailPage1()); } //Fehlermeldung wenn keine Connection //else //{ // err = "Keine Verbindung zum Server"; // await DisplayAlert("Hinweis",err , "OK"); //} } } }