Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session[SessionVariables.UserIdInSession] == null)
     {
         Response.Redirect("~/AccountManagement/Logout.aspx");
     }
     NavigationMenu.Items.Clear();
     if (Session[SessionVariables.UserIdInSession] != null)
     {
         var user = PageDataService.GetUserByIdInAdoNet(Convert.ToInt32(Session[SessionVariables.UserIdInSession].ToString()));
         if (user != null)
         {
             User userGroups = PageDataService.GetUserGroupAssociationsByUserIdByAdoNet(user.UserId);
             foreach (var userGroupAssociation in userGroups.UserGroupAssociations)
             {
                 if (userGroupAssociation.Group.GroupCode.Equals("Admin"))
                 {
                     AddMenuItems(userGroupAssociation.Group.GroupCode);
                     break;
                 }
                 if (userGroupAssociation.Group.GroupCode.Equals("Staff"))
                 {
                     AddMenuItems(userGroupAssociation.Group.GroupCode);
                     break;
                 }
             }
         }
     }
 }
Пример #2
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (Session[SessionVariables.UserSelectedToUpdateInUserMaintenance] != null)
     {
         var user =
             PageDataService.GetUserByIdInAdoNet(
                 Convert.ToInt32(Session[SessionVariables.UserSelectedToUpdateInUserMaintenance].ToString()));
         if (user != null)
         {
             var userGroups =
                 PageDataService.GetUserGroupAssociationsByUserIdByAdoNet(
                     Convert.ToInt32(Session[SessionVariables.UserSelectedToUpdateInUserMaintenance].ToString()));
             txtUserName.Text        = user.UserName;
             txtUserEmail.Text       = user.UserEmail;
             wdcEffectiveDate.Text   = Convert.ToString(Convert.ToDateTime(user.EffectiveDate).Date);
             wdcExpirationDate.Text  = Convert.ToString(Convert.ToDateTime(user.ExpirationDate).Date);
             txtUserPassword.Text    = user.UserPassword;
             txtConfirmPassword.Text = user.UserPassword;
             txtAddressLineOne.Text  = user.Address.AdrressLineOne;
             txtVillage.Text         = user.Address.Village;
             txtDistrict.Text        = user.Address.District;
             txtPincode.Text         = user.Address.Pincode;
             foreach (ListItem chk in chklstGroup.Items)
             {
                 foreach (var userGroupAssociation in userGroups.UserGroupAssociations)
                 {
                     if (chk.Value.Equals(userGroupAssociation.GroupId.ToString(CultureInfo.InvariantCulture)))
                     {
                         chk.Selected = true;
                         break;
                     }
                 }
             }
         }
     }
 }