private static OnlineKidsUserInfo GetKidsUser(UserProfile userinfo, bool RefreshSSOUser) { try { KidsUser u = KidsUser_DataProvider.GetKidsUser(SSOUserName: userinfo.UserID).FirstOrDefault(); if (u == null) throw new ApplicationException("Invalid User"); if (RefreshSSOUser) userinfo = BMIUserInteraction.GetBMIUserProfile(userinfo.UserID); return new OnlineKidsUserInfo { Kids_UserInfo = u, SSOUser = userinfo }; } catch (ApplicationException) { throw new SecurityException("Invalid User Info 2"); } }
private void SetPrimitiveSSOInformation(UserProfile userProfile) { try { lblSSOUserName.Text = OnlineKidsUser.SSOUser.UserID; txtChildAddress.Text = userProfile.Address; var datetime = PersianDateTime.TryPersianToMiladi(userProfile.Birthdate.Replace("/", "")); ucBirthDate.SelectedDateTime = datetime; txtChildEmailAddress.Text = userProfile.Email; txtChildFatherName.Text = userProfile.FatherName; drpSex.SelectedValue = userProfile.Gender == Genders.Female ? "True" : "False"; txtChildIdentityNo.Text = userProfile.IdNumber; txtChildMobileNumber.Text = userProfile.Mobile; txtChildName.Text = userProfile.Name.Split(' ')[0]; txtChildFamily.Text = userProfile.Name.Split(' ').JoinPart(1); txtChildMelliCode.Text = userProfile.NationalCode; txtChildPhoneNumber2.Text = userProfile.PhoneNumber; } catch { } }
private static OnlineSystemUserInfo GetSystemUser(UserProfile userinfo, bool RefreshAdminSSOUser) { try { SystemUser u = SystemUser_DataProvider.GetValidSystemUser(userinfo.UserID); if (u == null) throw new ApplicationException("Invalid User"); if (RefreshAdminSSOUser) userinfo = BMIUserInteraction.GetBMIUserProfile(userinfo.UserID); return new OnlineSystemUserInfo { System_UserInfo = u, SSOUser = userinfo }; } catch (ApplicationException) { HttpContext.Current.Response.Redirect("~/Error/NotAccess.aspx"); return null; } }
private bool IsValidSSOUser(UserProfile userProfile) { if (PersianDateTime.PersianToMiladi(userProfile.Birthdate).CalculateAge() > 18) { ShowMessageBox(@"کاربرگرامی ضمن تشکر از حسن توجه شما <BR> سن شما بیش از 18 سال میباشد و شما نمیتوانید از مزایای حساب آرزو بهره مند شوید" , "خطا"); pnlAccCreation.Visible = false; BMIUserInteraction.LogOutCurrentUser("", GoToSSO: false, forceRedirect: false); return false; } return true; }
private static OnlineKidsUserInfo GetKidsUser(UserProfile userinfo, bool RefreshSSOUser) { try { KidsUser u = KidsUser_DataProvider.GetKidsUser(SSOUserName: userinfo.UserID).FirstOrDefault(); if (RefreshSSOUser) userinfo = BMIUserInteraction.GetBMIUserProfile(userinfo.UserID); if (u == null) { //var reqUrl = HttpContext.Current.Request.Url.ToString(); //if ( // reqUrl.Contains("Register.aspx") || // reqUrl.Contains("JpegImage.aspx") // ) return new OnlineKidsUserInfo { Kids_UserInfo = null, SSOUser = userinfo }; //throw new ApplicationException("Invalid User!"); } return new OnlineKidsUserInfo { Kids_UserInfo = u, SSOUser = userinfo }; } catch (ApplicationException) { //HttpContext.Current.Response.Redirect("~/Register.aspx", true); return null; } }