示例#1
0
    public static List <Model_AppFeatureRole> GetAppFeature(byte UserRoleID)
    {
        Model_AppFeatureRole ma = new Model_AppFeatureRole();

        return(ma.GetAppFeatureList(UserRoleID));
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Model_usersRole role = new Model_usersRole
        {
            Title  = RoleTitle.Text,
            Status = bool.Parse(status.SelectedValue)
        };

        byte RoleID = UsersController.AddUserRole(role);

        if (RoleID > 0)
        {
            byte intUsersRoleId = RoleID;

            int staffmodule = int.Parse(chkStaffModule.Attributes["value"]);

            int intContentModule = int.Parse(ChkContentModule.Attributes["value"]);
            int intUserModule    = int.Parse(chkUserModule.Attributes["value"]);
            int intSettingModule = int.Parse(ChkSttingModule.Attributes["value"]);


            //Response.Write(intUserModule);
            //Response.End();.Where(li => li.Selected)

            List <ListItem> selectedStaff = chklistStaff.Items.Cast <ListItem>().ToList();


            foreach (ListItem i in selectedStaff)
            {
                Model_AppFeatureRole ma = new Model_AppFeatureRole
                {
                    UsersRoleId = intUsersRoleId,
                    ModuleID    = staffmodule,
                    ActionID    = int.Parse(i.Value)
                };
                UsersController.InsertUserRole(ma, i.Selected);
            }

            List <ListItem> selectedUser = checkUserAction.Items.Cast <ListItem>().ToList();

            foreach (ListItem i in selectedUser)
            {
                Model_AppFeatureRole ma = new Model_AppFeatureRole
                {
                    UsersRoleId = intUsersRoleId,
                    ModuleID    = intUserModule,
                    ActionID    = int.Parse(i.Value)
                };
                UsersController.InsertUserRole(ma, i.Selected);
            }


            List <ListItem> selectedContent = CheckContentAction.Items.Cast <ListItem>().ToList();

            foreach (ListItem i in selectedContent)
            {
                Model_AppFeatureRole ma = new Model_AppFeatureRole
                {
                    UsersRoleId = intUsersRoleId,
                    ModuleID    = intContentModule,
                    ActionID    = int.Parse(i.Value)
                };
                UsersController.InsertUserRole(ma, i.Selected);
            }



            List <ListItem> selectedSetting = checksettingAction.Items.Cast <ListItem>().ToList();

            foreach (ListItem i in selectedSetting)
            {
                Model_AppFeatureRole ma = new Model_AppFeatureRole
                {
                    UsersRoleId = intUsersRoleId,
                    ModuleID    = intSettingModule,
                    ActionID    = int.Parse(i.Value)
                };
                UsersController.InsertUserRole(ma, i.Selected);
            }

            Response.Redirect("Role");
        }
    }
示例#3
0
    public static int InsertUserRole(Model_AppFeatureRole ma, bool Selected)
    {
        ma.DeleteAppFeature(ma);

        return(Selected ? ma.AddAppFeatureRole(ma) : 0);
    }