protected void btnSave_Click(object sender, EventArgs e) { MetaObject mo = Mediachase.Ibn.Data.Services.Security.GetGlobalAceByPrincipal(mc, PrincipalId); MetaObject moState = StateMachineUtil.GetGlobalAclStateItem(ClassName, mo.PrimaryKeyId.Value, StateMachineId, StateId); if (moState == null) { MetaClass stateClass = StateMachineUtil.GetGlobalAclStateMetaClass(ClassName); moState = new MetaObject(stateClass); } MetaObjectPropertyCollection properties = moState.Properties; properties[StateMachineUtil.GlobalAclField].Value = mo.PrimaryKeyId.Value; properties[StateMachineUtil.StateMachineField].Value = StateMachineId; properties[StateMachineUtil.StateField].Value = StateId; for (int i = 0; i < rights.Count; i++) { string rightName = rights[i].ToString(); properties[rightName].Value = ((CheckControl)checkControls[i]).Value; } moState.Save(); // Closing window if (RefreshButton == String.Empty) { CHelper.CloseItAndRefresh(Response); } else // Dialog Mode { CHelper.CloseItAndRefresh(Response, RefreshButton); } }