private string GetLabel(IncidentBoxRule ibr, bool IsFirst) { string retVal = ""; if (IsFirst) { int iLevel = Util.CommonHelper.CountOf(ibr.OutlineLevel, ".") - 1; if (iLevel > 0) { iLevel = iLevel * 40; retVal += String.Format("<img alt='' src='{1}' width='{0}px' height='1px' border='0' />", iLevel, this.Page.ResolveUrl("~/layouts/images/blank.gif")); } } string sAnd_OR = ""; if (ibr.OutlineLevel == ".") { if (ibr.OutlineIndex > 0) { sAnd_OR = LocRM.GetString("tAND"); } } else { string sLevel = ibr.OutlineLevel; if (sLevel.EndsWith(".")) { sLevel = sLevel.Substring(0, sLevel.Length - 1); } sLevel = sLevel.Substring(sLevel.LastIndexOf(".") + 1); int iNum = int.Parse(sLevel); IncidentBoxRule ibr1 = IncidentBoxRule.Load(iNum); if (ibr1.RuleType == IncidentBoxRuleType.OrBlock && ibr.OutlineIndex > ibr1.OutlineIndex + 1) { sAnd_OR = LocRM.GetString("tOR"); } if (ibr1.RuleType == IncidentBoxRuleType.AndBlock && ibr.OutlineIndex > ibr1.OutlineIndex + 1) { sAnd_OR = LocRM.GetString("tAND"); } } if (IsFirst || sAnd_OR != "") { retVal += "<font color='green'><b>" + sAnd_OR + "</b></font>"; } return(retVal); }
private void BindIssBoxes() { IncidentBox[] ibList = IncidentBox.List(); DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("IncidentBoxId", typeof(int))); dt.Columns.Add(new DataColumn("IsDefault", typeof(bool))); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("IdentifierMask", typeof(string))); dt.Columns.Add(new DataColumn("Routing", typeof(string))); dt.Columns.Add(new DataColumn("Rules", typeof(string))); DataRow dr; foreach (IncidentBox ib in ibList) { dr = dt.NewRow(); dr["IncidentBoxId"] = ib.IncidentBoxId; dr["Name"] = ib.Name; dr["IsDefault"] = ib.IsDefault; dr["IdentifierMask"] = ib.IdentifierMask; dr["Routing"] = " "; dr["Rules"] = " "; IncidentBoxDocument ibd = IncidentBoxDocument.Load(ib.IncidentBoxId); if (ibd != null) { if (ibd.EMailRouterBlock.AllowEMailRouting) { dr["Routing"] = "<img border='0' align='top' src='" + ResolveUrl("~/layouts/images/incidentbox_routing.gif") + "' title='" + LocRM.GetString("tEmailRoutingEnabled") + "'/>"; } } IncidentBoxRule[] ibr = IncidentBoxRule.List(ib.IncidentBoxId); if (ibr != null && ibr.Length > 0) { dr["Rules"] = "<img border='0' align='top' src='" + ResolveUrl("~/layouts/images/incidentbox_rules.gif") + "' title='" + LocRM.GetString("tRulesExist") + "'/>"; } dt.Rows.Add(dr); } rpIssBoxes.DataSource = dt; rpIssBoxes.DataBind(); foreach (RepeaterItem ri in rpIssBoxes.Items) { LinkButton lb = (LinkButton)ri.FindControl("ibDelete"); if (lb != null) { lb.Attributes.Add("onclick", "javascript:return confirm('" + LocRM.GetString("tDelete") + "'+'?')"); } } }
private int Reccurence(IncidentBoxRule[] ibList, out string ss, string thisLevel, int i) { ss = ""; while (++i < ibList.Length && ibList[i].OutlineLevel.StartsWith(thisLevel)) { IncidentBoxRule ibr = ibList[i]; if (ibr.RuleType == IncidentBoxRuleType.OrBlock || ibr.RuleType == IncidentBoxRuleType.AndBlock) { string thisLevel1 = ibr.OutlineLevel + ibr.IncidentBoxRuleId + "."; ss += GetLabel(ibr, false) + " <b>(</b>"; string ss1 = ""; i = Reccurence(ibList, out ss1, thisLevel1, i); ss += ss1 + "<b>)</b>"; } else { ss += GetLabel(ibr, false) + " <b>(</b> " + GetInnerText(ibr) + "<b>) </b>"; } } return(--i); }
private void BindValues() { lblRules.Text = " "; IncidentBox issb = IncidentBox.Load(IssBoxId); lblIssBoxName.Text = issb.Name; IncidentBoxRule[] ibList = IncidentBoxRule.List(IssBoxId); string retVal = ""; for (int i = 0; i < ibList.Length; i++) { retVal += "<tr><td width='30px'>"; IncidentBoxRule ibr = ibList[i]; if (ibr.RuleType == IncidentBoxRuleType.OrBlock || ibr.RuleType == IncidentBoxRuleType.AndBlock) { string thisLevel = ibr.OutlineLevel + ibr.IncidentBoxRuleId + "."; retVal += GetLabel(ibr, true) + "</td><td><b>(</b>"; string ss = ""; i = Reccurence(ibList, out ss, thisLevel, i); retVal += ss + "<b>)</b>"; } else { retVal += GetLabel(ibr, true); retVal += "</td><td><b>(</b> " + GetInnerText(ibr) + "<b>)</b>"; } retVal += "</td></tr>"; } if (retVal != "") { lblRules.Text = String.Format("<table cellspacing='0' cellpadding='5' border='0' class='text'>{0}</table>", retVal); } else { lblRules.Text = "<font color='red' class='text'>" + LocRM.GetString("tIssueBoxRules") + "</font>"; } }
protected string GetRuleButton(int id) { IncidentBoxRule[] ibList = IncidentBoxRule.List(id); string Tooltip = LocRM.GetString("tIssBoxRules"); if (ibList.Length > 0) { return(String.Format("<a href=\"javascript:OpenWindow('{2}', 640,480,false)\"><img border='0' align='absmiddle' src='{0}' title='{1}'/></a>", this.Page.ResolveUrl("~/layouts/images/rules.gif"), Tooltip, String.Format("{0}?IssBoxId={1}", this.Page.ResolveUrl("~/Admin/EMailIssueBoxRulesView.aspx"), id))); } else { return(String.Format("<a href='{2}'><img border='0' align='absmiddle' src='{0}' title='{1}'/></a>", this.Page.ResolveUrl("~/layouts/images/rulesnew.gif"), Tooltip, String.Format("{0}?IssBoxId={1}", this.Page.ResolveUrl("~/Admin/EMailIssueBoxRules.aspx"), id))); } }
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); }
private void BindValues() { if (IssRuleId > 0 && !IsNewIn) { IncidentBoxRule ibr = IncidentBoxRule.Load(IssRuleId); Util.CommonHelper.SafeSelect(ddKey, ibr.Key); if (ibr.Key == "TypeId") { Util.CommonHelper.SafeSelect(ddType, ibr.Value); } else if (ibr.Key == "EMailBox") { Util.CommonHelper.SafeSelect(ddEmailBoxes, ibr.Value); } else if (ibr.Key == "CreatorId") { Util.CommonHelper.SafeSelect(ddCreator, ibr.Value); } else if (ibr.Key == "ProjectId") { Util.CommonHelper.SafeSelect(ddProject, ibr.Value); } else if (ibr.Key == "PriorityId") { Util.CommonHelper.SafeSelect(ddPriority, ibr.Value); } else if (ibr.Key == "SeverityId") { Util.CommonHelper.SafeSelect(ddSeverity, ibr.Value); } else if (ibr.Key == "GeneralCategories") { string[] _values = ibr.Value.Split(';'); foreach (string sId in _values) { Util.CommonHelper.SafeMultipleSelect(lbGenCats, sId); } } else if (ibr.Key == "IncidentCategories") { string[] _values = ibr.Value.Split(';'); foreach (string sId in _values) { Util.CommonHelper.SafeMultipleSelect(lbIssCats, sId); } } else { txtValue.Text = ibr.Value; } if (ddRuleType.SelectedValue == "4") //Block { Util.CommonHelper.SafeSelect(ddKey, ((int)ibr.RuleType).ToString()); } if (ddRuleType.SelectedValue == "6") //Function { Util.CommonHelper.SafeSelect(ddKey, ibr.Key); int funcId = int.Parse(ibr.Key); IncidentBoxRuleFunction brf = IncidentBoxRuleFunction.Load(funcId); ArrayList paramItems = new ArrayList(); foreach (Match match in Regex.Matches(ibr.Value, "\"(?<Param>[^\"]+)\";?", RegexOptions.IgnoreCase | RegexOptions.Singleline)) { string Value = match.Groups["Param"].Value; paramItems.Add(Value); } System.Reflection.ParameterInfo[] paramsList = brf.GetParameters(); DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Position", typeof(int))); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("DefaultValue", typeof(string))); DataRow dr; foreach (System.Reflection.ParameterInfo par in paramsList) { dr = dt.NewRow(); dr["Position"] = par.Position; dr["Name"] = par.Name; dr["DefaultValue"] = paramItems[par.Position]; dt.Rows.Add(dr); } dgParams.DataSource = dt.DefaultView; dgParams.DataBind(); } } }
private void BindTypes() { ddRuleType.Items.Clear(); ddRuleType.Items.Add(new ListItem(LocRM.GetString("Operator"), "0")); //0,1,2 ddRuleType.Items.Add(new ListItem(LocRM.GetString("Block"), "4")); //4,5 ddRuleType.Items.Add(new ListItem(LocRM.GetString("Function"), "6")); //6 ddOperator.Items.Clear(); ddOperator.Items.Add(new ListItem(GetRuleType(IncidentBoxRuleType.Contains), ((int)IncidentBoxRuleType.Contains).ToString())); ddOperator.Items.Add(new ListItem(GetRuleType(IncidentBoxRuleType.NotContains), ((int)IncidentBoxRuleType.NotContains).ToString())); ddOperator.Items.Add(new ListItem(GetRuleType(IncidentBoxRuleType.RegexMatch), ((int)IncidentBoxRuleType.RegexMatch).ToString())); ddOperator.Items.Add(new ListItem(GetRuleType(IncidentBoxRuleType.IsEqual), ((int)IncidentBoxRuleType.IsEqual).ToString())); ddOperator.Items.Add(new ListItem(GetRuleType(IncidentBoxRuleType.NotIsEqual), ((int)IncidentBoxRuleType.NotIsEqual).ToString())); ddIndex.Items.Clear(); if (!IsNewIn) { if (IssRuleId > 0) { IncidentBoxRule ibr = IncidentBoxRule.Load(IssRuleId); string sLevel = ibr.OutlineLevel; if (sLevel != ".") { if (sLevel.EndsWith(".")) { sLevel = sLevel.Substring(0, sLevel.Length - 1); } sLevel = sLevel.Substring(sLevel.LastIndexOf(".") + 1); int iNum = int.Parse(sLevel); int[] intList = IncidentBoxRule.GetAvailableIndex(IssBoxId, iNum); for (int i = 0; i < intList.Length - 1; i++) { ddIndex.Items.Add(new ListItem(intList[i].ToString(), intList[i].ToString())); } } else { int[] intList = IncidentBoxRule.GetAvailableIndex(IssBoxId); for (int i = 0; i < intList.Length - 1; i++) { ddIndex.Items.Add(new ListItem(intList[i].ToString(), intList[i].ToString())); } } } else { int[] intList = IncidentBoxRule.GetAvailableIndex(IssBoxId); for (int i = 0; i < intList.Length; i++) { ddIndex.Items.Add(new ListItem(intList[i].ToString(), intList[i].ToString())); } } } else { int[] intList = IncidentBoxRule.GetAvailableIndex(IssBoxId, IssRuleId); for (int i = 0; i < intList.Length; i++) { ddIndex.Items.Add(new ListItem(intList[i].ToString(), intList[i].ToString())); } } if (IssRuleId < 0 || IsNewIn) { ddIndex.SelectedIndex = ddIndex.Items.Count - 1; } if (IssRuleId > 0 && !Page.IsPostBack && !IsNewIn) { IncidentBoxRule ibr = IncidentBoxRule.Load(IssRuleId); if ((int)ibr.RuleType < (int)IncidentBoxRuleType.Function || (int)ibr.RuleType > (int)IncidentBoxRuleType.Function) { Util.CommonHelper.SafeSelect(ddRuleType, "0"); Util.CommonHelper.SafeSelect(ddOperator, ((int)ibr.RuleType).ToString()); } else if ((int)ibr.RuleType < (int)IncidentBoxRuleType.Function) { Util.CommonHelper.SafeSelect(ddRuleType, "4"); } else { Util.CommonHelper.SafeSelect(ddRuleType, "6"); } Util.CommonHelper.SafeSelect(ddIndex, ibr.OutlineIndex.ToString()); } }
private string GetInnerText(IncidentBoxRule ibr) { string retVal = ""; switch (ibr.RuleType) { case IncidentBoxRuleType.Contains: case IncidentBoxRuleType.IsEqual: case IncidentBoxRuleType.RegexMatch: case IncidentBoxRuleType.NotContains: case IncidentBoxRuleType.NotIsEqual: string sKey = ibr.Key; sKey = (sKey == "TypeId") ? "Type" : sKey; sKey = (sKey == "PriorityId") ? "Priority" : sKey; sKey = (sKey == "SeverityId") ? "Severity" : sKey; sKey = (sKey == "TypeId") ? "Type" : sKey; sKey = (sKey == "CreatorId") ? "Creator" : sKey; sKey = (sKey == "ProjectId") ? "Project" : sKey; sKey = (sKey == "EMailBox") ? "E-mail Box" : sKey; sKey = (sKey == "TitleOrDescriptionOrEMailBody") ? "Title or Description or EMailBody" : sKey; retVal += "<font color='#0000ff'>[" + sKey + "]</font> "; retVal += "<b>" + GetRuleType(ibr.RuleType) + "</b>"; if (ibr.Value.Length > 0) { if (sKey == "Type") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.Common.GetIncidentType(int.Parse(ibr.Value)) + "'</font>"; } else if (sKey == "E-mail Box") { // OZ 2008-11-27 Fix Problem if Pop3Box has been deleted. retVal += " <font color='#ff0000'>'"; try { retVal += Mediachase.IBN.Business.EMail.EMailRouterPop3Box.Load(int.Parse(ibr.Value)).Name; } catch { retVal += "Error: Wrong POP3 box id."; } retVal += "'</font>"; } else if (sKey == "Creator") { retVal += " <font color='#ff0000'>'" + Util.CommonHelper.GetUserStatusPureName(int.Parse(ibr.Value)) + "'</font>"; } else if (sKey == "Project") { retVal += " <font color='#ff0000'>'" + Task.GetProjectTitle(int.Parse(ibr.Value)) + "'</font>"; } else if (sKey == "Priority") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.Common.GetPriority(int.Parse(ibr.Value)) + "'</font>"; } else if (sKey == "Severity") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.Common.GetIncidentSeverity(int.Parse(ibr.Value)) + "'</font>"; } else if (sKey == "GeneralCategories" && ibr.Value.Length > 0) { retVal += " <font color='red'>"; string[] _values = ibr.Value.Split(';'); for (int i = 0; i < _values.Length; i++) { string sId = _values[i]; if (i > 0) { if (ibr.RuleType == IncidentBoxRuleType.Contains || ibr.RuleType == IncidentBoxRuleType.NotContains) { retVal += " " + LocRM.GetString("tAND") + " "; } if (ibr.RuleType == IncidentBoxRuleType.IsEqual || ibr.RuleType == IncidentBoxRuleType.NotIsEqual) { retVal += " " + LocRM.GetString("tOR") + " "; } } retVal += "'" + Mediachase.IBN.Business.Common.GetGeneralCategory(int.Parse(sId)) + "' "; } retVal += "</font>"; } else if (sKey == "IncidentCategories" && ibr.Value.Length > 0) { retVal += " <font color='red'>"; string[] _values = ibr.Value.Split(';'); for (int i = 0; i < _values.Length; i++) { string sId = _values[i]; if (i > 0) { if (ibr.RuleType == IncidentBoxRuleType.Contains || ibr.RuleType == IncidentBoxRuleType.NotContains) { retVal += " " + LocRM.GetString("tAND") + " "; } if (ibr.RuleType == IncidentBoxRuleType.IsEqual || ibr.RuleType == IncidentBoxRuleType.NotIsEqual) { retVal += " " + LocRM.GetString("tOR") + " "; } } retVal += "'" + Mediachase.IBN.Business.Common.GetIncidentCategory(int.Parse(sId)) + "' "; } retVal += "</font>"; } else { if (ibr.RuleType == IncidentBoxRuleType.Contains || ibr.RuleType == IncidentBoxRuleType.IsEqual || ibr.RuleType == IncidentBoxRuleType.NotContains || ibr.RuleType == IncidentBoxRuleType.NotIsEqual) { retVal += " <font color='red'>"; string[] _values = ibr.Value.Split(';'); for (int i = 0; i < _values.Length; i++) { string sId = _values[i]; if (i > 0) { if (ibr.RuleType == IncidentBoxRuleType.Contains || ibr.RuleType == IncidentBoxRuleType.NotContains) { retVal += " " + LocRM.GetString("tAND") + " "; } if (ibr.RuleType == IncidentBoxRuleType.IsEqual || ibr.RuleType == IncidentBoxRuleType.NotIsEqual) { retVal += " " + LocRM.GetString("tOR") + " "; } } retVal += "'" + sId + "' "; } retVal += "</font>"; } else { retVal += " <font color='#ff0000'>'" + ibr.Value + "'</font>"; } } } break; case IncidentBoxRuleType.Function: retVal += "<b>" + GetRuleType(ibr.RuleType) + "</b>"; IncidentBoxRuleFunction brf = IncidentBoxRuleFunction.Load(int.Parse(ibr.Key)); retVal += " <font color='#0000ff'>" + brf.Name + "( </font>"; retVal += "<font color='#ff0000'>" + ibr.Value + "</font><font color='#0000ff'> )</font>"; break; default: break; } return(retVal); }
protected string GetLabel(object _type, object _key, object _value, object _index, object _level) { string retVal = ""; int iLevel = Util.CommonHelper.CountOf(_level.ToString(), ".") - 1; if (iLevel > 0) { iLevel = iLevel * 40; retVal += String.Format("<img alt='' src='{1}' width='{0}px' height='1px' border='0' />", iLevel, this.Page.ResolveUrl("~/layouts/images/blank.gif")); } string sAnd_OR = " "; if (_level.ToString() == ".") { if ((int)_index > 0) { sAnd_OR = LocRM.GetString("tAND"); } } else { string sLevel = _level.ToString(); if (sLevel.EndsWith(".")) { sLevel = sLevel.Substring(0, sLevel.Length - 1); } sLevel = sLevel.Substring(sLevel.LastIndexOf(".") + 1); int iNum = int.Parse(sLevel); IncidentBoxRule ibr = IncidentBoxRule.Load(iNum); if (ibr.RuleType == IncidentBoxRuleType.OrBlock && (int)_index > ibr.OutlineIndex + 1) { sAnd_OR = LocRM.GetString("tOR"); } if (ibr.RuleType == IncidentBoxRuleType.AndBlock && (int)_index > ibr.OutlineIndex + 1) { sAnd_OR = LocRM.GetString("tAND"); } } retVal += "<span style='width:40px;'><font color='green'><b>" + sAnd_OR + "</b></font> </span>"; switch ((IncidentBoxRuleType)_type) { case IncidentBoxRuleType.Contains: case IncidentBoxRuleType.IsEqual: case IncidentBoxRuleType.RegexMatch: case IncidentBoxRuleType.NotContains: case IncidentBoxRuleType.NotIsEqual: string sKey = _key.ToString(); sKey = (sKey == "TypeId") ? "Type" : sKey; sKey = (sKey == "PriorityId") ? "Priority" : sKey; sKey = (sKey == "SeverityId") ? "Severity" : sKey; sKey = (sKey == "TypeId") ? "Type" : sKey; sKey = (sKey == "CreatorId") ? "Creator" : sKey; sKey = (sKey == "ProjectId") ? "Project" : sKey; sKey = (sKey == "EMailBox") ? "E-mail Box" : sKey; sKey = (sKey == "TitleOrDescriptionOrEMailBody") ? "Title or Description or EMailBody" : sKey; retVal += "<font color='#0000ff'>[" + sKey + "]</font> "; retVal += "<b>" + GetRuleType((IncidentBoxRuleType)_type) + "</b>"; if (_value.ToString().Length > 0) { if (sKey == "Type") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.Common.GetIncidentType(int.Parse(_value.ToString())) + "'</font>"; } else if (sKey == "E-mail Box") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.EMail.EMailRouterPop3Box.Load(int.Parse(_value.ToString())).Name + "'</font>"; } else if (sKey == "Creator") { retVal += " <font color='#ff0000'>'" + Util.CommonHelper.GetUserStatusPureName(int.Parse(_value.ToString())) + "'</font>"; } else if (sKey == "Project") { retVal += " <font color='#ff0000'>'" + Task.GetProjectTitle(int.Parse(_value.ToString())) + "'</font>"; } else if (sKey == "Priority") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.Common.GetPriority(int.Parse(_value.ToString())) + "'</font>"; } else if (sKey == "Severity") { retVal += " <font color='#ff0000'>'" + Mediachase.IBN.Business.Common.GetIncidentSeverity(int.Parse(_value.ToString())) + "'</font>"; } else if (sKey == "GeneralCategories" && _value.ToString().Length > 0) { retVal += " <font color='red'>"; string[] _values = _value.ToString().Split(';'); for (int i = 0; i < _values.Length; i++) { string sId = _values[i]; if (i > 0) { if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.Contains || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotContains) { retVal += " " + LocRM.GetString("tAND") + " "; } if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.IsEqual || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotIsEqual) { retVal += " " + LocRM.GetString("tOR") + " "; } } retVal += "'" + Mediachase.IBN.Business.Common.GetGeneralCategory(int.Parse(sId)) + "' "; } retVal += "</font>"; } else if (sKey == "IncidentCategories" && _value.ToString().Length > 0) { retVal += " <font color='red'>"; string[] _values = _value.ToString().Split(';'); for (int i = 0; i < _values.Length; i++) { string sId = _values[i]; if (i > 0) { if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.Contains || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotContains) { retVal += " " + LocRM.GetString("tAND") + " "; } if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.IsEqual || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotIsEqual) { retVal += " " + LocRM.GetString("tOR") + " "; } } retVal += "'" + Mediachase.IBN.Business.Common.GetIncidentCategory(int.Parse(sId)) + "' "; } retVal += "</font>"; } else { if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.Contains || (IncidentBoxRuleType)_type == IncidentBoxRuleType.IsEqual || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotContains || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotIsEqual) { retVal += " <font color='red'>"; string[] _values = _value.ToString().Split(';'); for (int i = 0; i < _values.Length; i++) { string sId = _values[i]; if (i > 0) { if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.Contains || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotContains) { retVal += " " + LocRM.GetString("tAND") + " "; } if ((IncidentBoxRuleType)_type == IncidentBoxRuleType.IsEqual || (IncidentBoxRuleType)_type == IncidentBoxRuleType.NotIsEqual) { retVal += " " + LocRM.GetString("tOR") + " "; } } retVal += "'" + sId + "' "; } retVal += "</font>"; } else { retVal += " <font color='#ff0000'>'" + _value.ToString() + "'</font>"; } } } break; case IncidentBoxRuleType.AndBlock: case IncidentBoxRuleType.OrBlock: retVal += "<b>" + GetRuleType((IncidentBoxRuleType)_type) + "</b>"; break; case IncidentBoxRuleType.Function: retVal += "<b>" + GetRuleType((IncidentBoxRuleType)_type) + "</b>"; IncidentBoxRuleFunction brf = IncidentBoxRuleFunction.Load(int.Parse(_key.ToString())); retVal += " <font color='#0000ff'>" + brf.Name + "( </font>"; retVal += "<font color='#ff0000'>" + _value.ToString() + "</font><font color='#0000ff'> )</font>"; break; default: break; } return(retVal); }
private void BindEmailValues() { EMailMessageInfo mi = EMailMessageInfo.Load(EMailMessageId); IncidentInfo incidentInfo = EMailIncidentMappingHandler.CreateMapping(EMailMessageId); // Eval IncidentBox ddlFolder.SelectedValue = IncidentBoxRule.Evaluate(incidentInfo).IncidentBoxId.ToString(); txtTitle.Text = incidentInfo.Title; ftbDescription.Text = incidentInfo.Description; CommonHelper.SafeSelect(ddlPriority, incidentInfo.PriorityId.ToString()); CommonHelper.SafeSelect(ddlSeverity, incidentInfo.SeverityId.ToString()); CommonHelper.SafeSelect(ddlType, incidentInfo.TypeId.ToString()); ddProject.ObjectTypeId = (int)ObjectTypes.Project; ddProject.ObjectId = incidentInfo.ProjectId; if (incidentInfo.GeneralCategories != null) { foreach (int CatId in incidentInfo.GeneralCategories) { CommonHelper.SafeMultipleSelect(lbCategory, CatId.ToString()); } } if (incidentInfo.IncidentCategories != null) { foreach (int CatId in incidentInfo.IncidentCategories) { CommonHelper.SafeMultipleSelect(lbIncidentCategory, CatId.ToString()); } } //try from MailSenderEmail PrimaryKeyId contactUid = PrimaryKeyId.Empty; PrimaryKeyId orgUid = PrimaryKeyId.Empty; Client client = Common.GetClient(incidentInfo.MailSenderEmail); if (client != null) { if (client.IsContact) { contactUid = client.Id; ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = contactUid; } else { orgUid = client.Id; ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = orgUid; } } //from incidentinfo if (orgUid == PrimaryKeyId.Empty && contactUid == PrimaryKeyId.Empty) { if (incidentInfo.OrgUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = OrganizationEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = incidentInfo.OrgUid; } else if (incidentInfo.ContactUid != PrimaryKeyId.Empty) { ClientControl.ObjectType = ContactEntity.GetAssignedMetaClassName(); ClientControl.ObjectId = incidentInfo.ContactUid; } } trHtmlAttach.Visible = false; trEmail.Visible = true; string sBody = ""; if (mi.HtmlBody != null) { sBody = EMailMessageInfo.CutHtmlBody(mi.HtmlBody, 256, "..."); } if (sBody.Trim() != "") { lblEmail.Text = String.Format("{0}<p align=right class='text'><a href=\"javascript:OpenSizableWindow('EMailView.aspx?EMailId={2}', 750, 550)\"><b>{1}</b></a>", sBody, LocRM4.GetString("More"), EMailMessageId); } else { lblEmail.Text = sBody; } }