protected string GetRuleType(IncidentBoxRuleType _type)
 {
     string retVal = "";
     switch (_type)
     {
         case IncidentBoxRuleType.IsEqual:
             retVal = LocRM.GetString("tIsEqual");
             break;
         case IncidentBoxRuleType.Contains:
             retVal = LocRM.GetString("tContains");
             break;
         case IncidentBoxRuleType.NotContains:
             retVal = LocRM.GetString("tNotContains");
             break;
         case IncidentBoxRuleType.NotIsEqual:
             retVal = LocRM.GetString("tIsNotEqual");
             break;
         case IncidentBoxRuleType.RegexMatch:
             retVal = LocRM.GetString("tRegExMatch");
             break;
         case IncidentBoxRuleType.OrBlock:
             retVal = LocRM.GetString("tORBlock");
             break;
         case IncidentBoxRuleType.AndBlock:
             retVal = LocRM.GetString("tANDBlock");
             break;
         default:
             retVal = _type.ToString();
             break;
     }
     return retVal;
 }
Exemple #2
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);
        }
Exemple #3
0
        private string GetRuleType(IncidentBoxRuleType _type)
        {
            string retVal = "";

            switch (_type)
            {
            case IncidentBoxRuleType.IsEqual:
                retVal = LocRM.GetString("tIsEqual");
                break;

            case IncidentBoxRuleType.Contains:
                retVal = LocRM.GetString("tContains");
                break;

            case IncidentBoxRuleType.NotContains:
                retVal = LocRM.GetString("tNotContains");
                break;

            case IncidentBoxRuleType.NotIsEqual:
                retVal = LocRM.GetString("tIsNotEqual");
                break;

            case IncidentBoxRuleType.RegexMatch:
                retVal = LocRM.GetString("tRegExMatch");
                break;

            case IncidentBoxRuleType.OrBlock:
                retVal = LocRM.GetString("tORBlock");
                break;

            case IncidentBoxRuleType.AndBlock:
                retVal = LocRM.GetString("tANDBlock");
                break;

            case IncidentBoxRuleType.Function:
                retVal = LocRM.GetString("Function");
                break;

            default:
                retVal = _type.ToString();
                break;
            }
            return(retVal);
        }
        private void imbSave_ServerClick(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            IncidentBoxRuleType _type = IncidentBoxRuleType.Contains;
            string _key   = "";
            string _value = "";

            switch (ddRuleType.SelectedValue)
            {
            case "0":                           //Operator
                _type = (IncidentBoxRuleType)(int.Parse(ddOperator.SelectedValue));
                _key  = ddKey.SelectedValue;
                if (_key == "TypeId")
                {
                    _value = ddType.SelectedValue;
                }
                else if (_key == "EMailBox")
                {
                    _value = ddEmailBoxes.SelectedValue;
                }
                else if (_key == "CreatorId")
                {
                    _value = ddCreator.SelectedValue;
                }
                else if (_key == "ProjectId")
                {
                    _value = ddProject.SelectedValue;
                }
                else if (_key == "PriorityId")
                {
                    _value = ddPriority.SelectedValue;
                }
                else if (_key == "SeverityId")
                {
                    _value = ddSeverity.SelectedValue;
                }
                else if (_key == "GeneralCategories")
                {
                    string sValue2 = "";
                    foreach (ListItem li in lbGenCats.Items)
                    {
                        if (li.Selected)
                        {
                            sValue2 += li.Value + ";";
                        }
                    }
                    if (sValue2.Length > 0)
                    {
                        _value = sValue2.Substring(0, sValue2.Length - 1);
                    }
                }
                else if (_key == "IncidentCategories")
                {
                    string sValue3 = "";
                    foreach (ListItem li in lbIssCats.Items)
                    {
                        if (li.Selected)
                        {
                            sValue3 += li.Value + ";";
                        }
                    }
                    if (sValue3.Length > 0)
                    {
                        _value = sValue3.Substring(0, sValue3.Length - 1);
                    }
                }
                else
                {
                    _value = txtValue.Text;
                }
                if (_value == "")
                {
                    lblValueError.Style.Add("display", "");
                    return;
                }
                break;

            case "4":                           //Block
                _type  = (IncidentBoxRuleType)(int.Parse(ddKey.SelectedValue));
                _key   = "";
                _value = "";
                break;

            case "6":                           //Function
                _type = IncidentBoxRuleType.Function;
                _key  = ddKey.SelectedValue;
                string sValue1 = "";
                foreach (DataGridItem dgi in dgParams.Items)
                {
                    TextBox tb = (TextBox)dgi.Cells[2].FindControl("tbValue");
                    if (tb != null)
                    {
                        sValue1 += "\"" + tb.Text + "\";";
                    }
                }
                if (sValue1.Length > 0)
                {
                    _value = sValue1.Substring(0, sValue1.Length - 1);
                }
                break;

            default:
                break;
            }

            if (IssRuleId > 0 && !IsNewIn)
            {
                IncidentBoxRule ibr = IncidentBoxRule.Load(IssRuleId);
                ibr.RuleType = _type;
                ibr.Key      = _key;
                ibr.Value    = _value;
                IncidentBoxRule.Update(ibr, int.Parse(ddIndex.SelectedValue));
            }
            else if (!IsNewIn)
            {
                IncidentBoxRule.Create(IssBoxId, int.Parse(ddIndex.SelectedValue), _type, _key, _value);
            }
            else if (IsNewIn)
            {
                IncidentBoxRule.CreateChild(IssBoxId, IssRuleId, int.Parse(ddIndex.SelectedValue),
                                            _type, _key, _value);
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                    "try {window.opener.location.href=window.opener.location.href;}" +
                                                    "catch (e){} window.close();", true);
        }
Exemple #5
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);
        }
Exemple #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;
        }
Exemple #7
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;
        }
 private string GetRuleType(IncidentBoxRuleType _type)
 {
     string retVal = "";
     switch (_type)
     {
         case IncidentBoxRuleType.IsEqual:
             retVal = LocRM.GetString("tIsEqual");
             break;
         case IncidentBoxRuleType.Contains:
             retVal = LocRM.GetString("tContains");
             break;
         case IncidentBoxRuleType.NotContains:
             retVal = LocRM.GetString("tNotContains");
             break;
         case IncidentBoxRuleType.NotIsEqual:
             retVal = LocRM.GetString("tIsNotEqual");
             break;
         case IncidentBoxRuleType.RegexMatch:
             retVal = LocRM.GetString("tRegExMatch");
             break;
         case IncidentBoxRuleType.Function:
             retVal = LocRM.GetString("Function");
             break;
         default:
             retVal = _type.ToString();
             break;
     }
     return retVal;
 }