示例#1
0
 protected void ctlDeleteGroup_Click(object sender, ImageClickEventArgs e)
 {
     foreach (GridViewRow row in ctlGroupGrid.Rows)
     {
         if ((row.RowType == DataControlRowType.DataRow) && (((CheckBox)row.FindControl("ctlSelect")).Checked))
         {
             try
             {
                 long       userId = UIHelper.ParseLong(ctlGroupGrid.DataKeys[row.RowIndex].Value.ToString());
                 SuUserRole group  = QueryProvider.SuUserRoleQuery.FindUserRoleByUserRoleId(userId);
                 SuUserRoleService.DeleteGroup(group);
             }
             catch (ServiceValidationException ex)
             {
                 ValidationErrors.MergeErrors(ex.ValidationErrors);
             }
             catch (Exception ex)
             {
                 string exMessage = ex.Message;
                 Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors();
                 errors.AddError("DeleteGroup.Error", new Spring.Validation.ErrorMessage("CannotDelete"));
                 ValidationErrors.MergeErrors(errors);
             }
         }
     }
     ctlGroupGrid.DataCountAndBind();
     ctlUpdatePanelGroup.Update();
 }
示例#2
0
        //protected void ctlGroupLookup_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        //{
        //    IList<SuRole> groupList = (List<SuRole>)e.ObjectReturn;

        //    ////Add Approver to SuUserFavorite
        //    ////.....

        //    SuUser user = GetUser();
        //    foreach (SuRole ur in groupList)
        //    {
        //        SuUserRole UserRole = new SuUserRole();
        //        UserRole.Active = true;
        //        UserRole.CreBy = UserAccount.UserID;
        //        UserRole.CreDate = DateTime.Now;
        //        UserRole.Role = ur;
        //        UserRole.UpdBy = UserAccount.UserID;
        //        UserRole.UpdDate = DateTime.Now;
        //        UserRole.UpdPgm = UserAccount.CurrentProgramCode;
        //        UserRole.User = user;

        //        SuUserRoleService.AddFavoriteGroup(UserRole);

        //    }
        //    ctlGroupGrid.DataCountAndBind();
        //    ctlUpdatePanelGroup.Update();

        //}
        protected void ctlGroupLookup_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        {
            IList <SuRole> groupList    = (List <SuRole>)e.ObjectReturn;
            ArrayList      groupArrList = new ArrayList();

            ////Add Approver to SuUserFavorite
            ////.....

            foreach (GridViewRow row in ctlGroupGrid.Rows)
            {
                Label ctlGroup = (Label)ctlGroupGrid.Rows[row.RowIndex].FindControl("ctlGroup");

                groupArrList.Add(ctlGroup.Text);
            }
            SuUser user = GetUser();

            foreach (SuRole ur in groupList)
            {
                if (!groupArrList.Contains(ur.RoleName))
                {
                    SuUserRole UserRole = new SuUserRole();
                    UserRole.Active  = true;
                    UserRole.CreBy   = UserAccount.UserID;
                    UserRole.CreDate = DateTime.Now;
                    UserRole.Role    = ur;
                    UserRole.UpdBy   = UserAccount.UserID;
                    UserRole.UpdDate = DateTime.Now;
                    UserRole.UpdPgm  = UserAccount.CurrentProgramCode;
                    UserRole.User    = user;

                    SuUserRoleService.AddFavoriteGroup(UserRole);
                }
            }
            ctlGroupGrid.DataCountAndBind();
            ctlUpdatePanelGroup.Update();
        }
示例#3
0
 private void GetServiceDataRoles()
 {
     AllDataRoles = SuUserRoleService.FindAll();
     HttpContext.Current.Application[ApplicationEnum.WebApplication.DataRoles.ToString()] = AllDataRoles;
 }