public SelectList combineModes(object selObjId) { if (m_combineModes == null) { m_combineModes = new CombineModeCollection(); SortExpression se = new SortExpression(CombineModeFields.Name | SortOperator.Ascending); m_combineModes.GetMulti(null, 0, se); } SelectList selList = new SelectList(m_combineModes, "Id", "Name", selObjId); return(selList); }
private void loadPolicyBase(int idx, string title, PolicyEntity pe, XmlNode node) { XmlNode attr = node.Attributes.GetNamedItem("combine"); string combine = "deny-overrides"; if (attr != null) { combine = attr.Value; } CombineModeCollection cmcoll = new CombineModeCollection(); cmcoll.GetMulti((CombineModeFields.Name == combine)); if (cmcoll.Count != 1) { throw new Exception(string.Format("unrecognised policy combine mode: {0}", combine)); } attr = node.Attributes.GetNamedItem("description"); if (attr != null) { pe.Description = attr.Value; } else { if (pe.Set) { pe.Description = string.Format("{0}-set-{1}", title, idx); } else { pe.Description = string.Format("{0}-policy-{1}", title, idx); } } pe.CombineMode = cmcoll[0]; pe.Uid = Guid.NewGuid(); XmlNode target = node.SelectSingleNode("target"); loadTarget(pe, target); }
private void CreatePolicy(policyData vData, int?id, bool set, bool isLibrary) { vData.Policy = new PolicyEntity(); vData.Policy.LibraryId = vData.Library.Id; vData.Policy.Description = set ? "new policy set" : "new policy"; vData.Policy.Set = set; vData.Policy.IsLibrary = isLibrary; vData.Policy.Target.Description = string.Empty; vData.PolicyLink = new PolicyLinkEntity(); vData.PolicyLink.Policy = vData.Policy; if (id.HasValue) { vData.PolicyLink.ParentId = id; PolicyLinkCollection maxColl = new PolicyLinkCollection(); PredicateExpression pe = new PredicateExpression(PolicyLinkFields.ParentId == id); object maxObj = maxColl.GetScalar(PolicyLinkFieldIndex.Order, null, AggregateFunction.Max, pe); if (maxObj != null && maxObj != DBNull.Value) { vData.PolicyLink.Order = (int)maxObj + 1; } else { vData.PolicyLink.Order = 0; } } CombineModeCollection cmcoll = new CombineModeCollection(); cmcoll.GetMulti((CombineModeFields.Name == "deny-overrides")); vData.Policy.CombineModeId = cmcoll[0].Id; vData.Policy.Save(true); }
public SelectList combineModes(object selObjId) { if (m_combineModes == null) { m_combineModes = new CombineModeCollection(); SortExpression se = new SortExpression(CombineModeFields.Name | SortOperator.Ascending); m_combineModes.GetMulti(null, 0, se); } SelectList selList = new SelectList(m_combineModes, "Id", "Name", selObjId); return selList; }
private void loadPolicyBase(int idx, string title,PolicyEntity pe,XmlNode node) { XmlNode attr = node.Attributes.GetNamedItem("combine"); string combine = "deny-overrides"; if (attr != null) combine = attr.Value; CombineModeCollection cmcoll = new CombineModeCollection(); cmcoll.GetMulti((CombineModeFields.Name == combine)); if (cmcoll.Count != 1) throw new Exception(string.Format("unrecognised policy combine mode: {0}", combine)); attr = node.Attributes.GetNamedItem("description"); if (attr != null) pe.Description = attr.Value; else { if (pe.Set) pe.Description = string.Format("{0}-set-{1}", title, idx); else pe.Description = string.Format("{0}-policy-{1}", title, idx); } pe.CombineMode = cmcoll[0]; pe.Uid = Guid.NewGuid(); XmlNode target = node.SelectSingleNode("target"); loadTarget(pe,target); }
private void CreatePolicy(policyData vData, int? id, bool set,bool isLibrary) { vData.Policy = new PolicyEntity(); vData.Policy.LibraryId = vData.Library.Id; vData.Policy.Description = set ? "new policy set" : "new policy"; vData.Policy.Set = set; vData.Policy.IsLibrary = isLibrary; vData.Policy.Target.Description = string.Empty; vData.PolicyLink = new PolicyLinkEntity(); vData.PolicyLink.Policy = vData.Policy; if (id.HasValue) { vData.PolicyLink.ParentId = id; PolicyLinkCollection maxColl = new PolicyLinkCollection(); PredicateExpression pe = new PredicateExpression(PolicyLinkFields.ParentId == id); object maxObj = maxColl.GetScalar(PolicyLinkFieldIndex.Order, null, AggregateFunction.Max, pe); if (maxObj != null && maxObj != DBNull.Value) vData.PolicyLink.Order = (int)maxObj + 1; else vData.PolicyLink.Order = 0; } CombineModeCollection cmcoll = new CombineModeCollection(); cmcoll.GetMulti((CombineModeFields.Name == "deny-overrides")); vData.Policy.CombineModeId = cmcoll[0].Id; vData.Policy.Save(true); }