示例#1
0
        /// <summary>
        /// Changes the index of the outline.
        /// </summary>
        /// <param name="IncidentBoxRuleId">The incident box Rule id.</param>
        /// <param name="NewOutlineIndex">New index of the outline.</param>
        public static void ChangeOutlineIndex(int IncidentBoxRuleId, int NewOutlineIndex)
        {
            IncidentBoxRuleRow newRow = new IncidentBoxRuleRow(IncidentBoxRuleId);

            newRow.OutlineIndex = NewOutlineIndex;

            newRow.Update();
        }
示例#2
0
        /// <summary>
        /// Lists the specified incident box id.
        /// </summary>
        /// <param name="IncidentBoxId">The incident box id.</param>
        /// <returns></returns>
        public static IncidentBoxRule[] List(int IncidentBoxId)
        {
            ArrayList retVal = new ArrayList();

            foreach (IncidentBoxRuleRow row in IncidentBoxRuleRow.List(IncidentBoxId))
            {
                retVal.Add(new IncidentBoxRule(row));
            }

            return((IncidentBoxRule[])retVal.ToArray(typeof(IncidentBoxRule)));
        }
示例#3
0
        /// <summary>
        /// Creates the specified incident box id.
        /// </summary>
        /// <param name="IncidentBoxId">The incident box id.</param>
        /// <param name="OutlineIndex">Index of the outline.</param>
        /// <param name="RuleType">Type of the Rule.</param>
        /// <param name="Key">The key.</param>
        /// <param name="Value">The value.</param>
        /// <returns></returns>
        public static int Create(int IncidentBoxId, int OutlineIndex, IncidentBoxRuleType RuleType, string Key, string Value)
        {
            IncidentBoxRuleRow newRow = new IncidentBoxRuleRow();

            newRow.IncidentBoxId = IncidentBoxId;

            newRow.OutlineIndex = OutlineIndex;
            newRow.OutlineLevel = ".";

            newRow.RuleType = (int)RuleType;
            newRow.Key      = Key;
            newRow.Value    = Value;

            newRow.Update();

            return(newRow.PrimaryKeyId);
        }
示例#4
0
        /// <summary>
        /// Gets the index of the available.
        /// </summary>
        /// <param name="IncidentBoxId">The incident box id.</param>
        /// <param name="ParentIncidentBoxRuleId">The parent incident box rule id.</param>
        /// <returns></returns>
        public static int[] GetAvailableIndex(int IncidentBoxId, int ParentIncidentBoxRuleId)
        {
            IncidentBoxRuleRow[] rules = IncidentBoxRuleRow.List(IncidentBoxId);

            ArrayList retVal = new ArrayList();

            string outlineLevelMask = string.Format(".{0}.", ParentIncidentBoxRuleId);

            int parendIndex = 0;
            int childItems  = 0;

            for (int index = 0; index < rules.Length; index++)
            {
                IncidentBoxRuleRow rule = rules[index];

                if (rule.IncidentBoxRuleId == ParentIncidentBoxRuleId)
                {
                    parendIndex = index;
                }

                if (rule.OutlineLevel.Contains(outlineLevelMask))
                {
                    childItems++;
                }

                if (rule.OutlineLevel.EndsWith(outlineLevelMask))
                {
                    retVal.Add((int)index);
                }
            }

            if (retVal.Count > 0)
            {
                retVal.Add(parendIndex + 1 + childItems);
            }
            else
            {
                retVal.Add(parendIndex + 1);
            }

            return((int[])retVal.ToArray(typeof(int)));
        }
示例#5
0
        /// <summary>
        /// Gets the index of the available.
        /// </summary>
        /// <param name="IncidentBoxId">The incident box id.</param>
        /// <returns></returns>
        public static int[] GetAvailableIndex(int IncidentBoxId)
        {
            IncidentBoxRuleRow[] rules = IncidentBoxRuleRow.List(IncidentBoxId);

            ArrayList retVal = new ArrayList();

            int index = 0;

            for (index = 0; index < rules.Length; index++)
            {
                IncidentBoxRuleRow rule = rules[index];
                if (rule.OutlineLevel == ".")
                {
                    retVal.Add((int)index);
                }
            }

            retVal.Add(index);

            return((int[])retVal.ToArray(typeof(int)));
        }
示例#6
0
        /// <summary>
        /// Creates the child.
        /// </summary>
        /// <param name="IncidentBoxId">The incident box id.</param>
        /// <param name="ParentIncidentBoxRuleId">The parent incident box rule id.</param>
        /// <param name="OutlineIndex">Index of the outline.</param>
        /// <param name="RuleType">Type of the rule.</param>
        /// <param name="Key">The key.</param>
        /// <param name="Value">The value.</param>
        /// <returns></returns>
        public static int CreateChild(int IncidentBoxId, int ParentIncidentBoxRuleId, int OutlineIndex, IncidentBoxRuleType RuleType, string Key, string Value)
        {
            IncidentBoxRuleRow parentRule = new IncidentBoxRuleRow(ParentIncidentBoxRuleId);

            if ((parentRule.RuleType & (int)(IncidentBoxRuleType.AndBlock | IncidentBoxRuleType.OrBlock)) == 0)
            {
                throw new ArgumentException("ParentIncidentBoxRule RuleType Should be either AndBlock or OrBlock.", "ParentIncidentBoxRuleId");
            }

            IncidentBoxRuleRow newRow = new IncidentBoxRuleRow();

            newRow.IncidentBoxId = IncidentBoxId;

            newRow.OutlineIndex = OutlineIndex;
            newRow.OutlineLevel = string.Format("{0}{1}.", parentRule.OutlineLevel, parentRule.IncidentBoxRuleId);

            newRow.RuleType = (int)RuleType;
            newRow.Key      = Key;
            newRow.Value    = Value;

            newRow.Update();

            return(newRow.PrimaryKeyId);
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IncidentBoxRule"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 private IncidentBoxRule(IncidentBoxRuleRow row)
 {
     _srcRow = row;
 }
示例#8
0
 /// <summary>
 /// Deletes the specified incident box Rule id.
 /// </summary>
 /// <param name="IncidentBoxRuleId">The incident box Rule id.</param>
 public static void Delete(int IncidentBoxRuleId)
 {
     IncidentBoxRuleRow.Delete(IncidentBoxRuleId);
 }