public static RuleConditionPlus FromSecurityCondition(SecurityCondition rc) { RuleConditionPlus rcp = new RuleConditionPlus(); rcp.ColIndexDest = rc.DestinationCol; rcp.ColIndexSrc = rc.SourceCol; rcp.Desc = string.Empty; rcp.Guid = rc.ConditionGuid; rcp.IsUsingDestCol = rc.IsUsingDestCol; rcp.Relation = rc.RelationName; IRelation relation = RelationService.Instance.GetRelation(rc.RelationName); if (relation.ParamsCount == 1) { rcp.Condition = rc.GetContent(); } else { StringBuilder sb = new StringBuilder(); for (int i = 0; i < rc.MultiValues.Count; i++) { sb.Append(rc.MultiValues[i]); if (i != rc.MultiValues.Count - 1) { sb.Append(";"); } } rcp.Condition = sb.ToString(); } return(rcp); }
public static SecurityCondition ToSecurityCondition(RuleConditionPlus rcp) { SecurityCondition conditon = new SecurityCondition(); conditon.DestinationCol = rcp.ColIndexDest; conditon.IsUsingDestCol = rcp.IsUsingDestCol; conditon.RelationName = rcp.Relation; conditon.SourceCol = rcp.ColIndexSrc; conditon.ConditionGuid = rcp.Guid; IRelation relation = RelationService.Instance.GetRelation(conditon.RelationName); if (relation.ParamsCount == 1) { conditon.SetContent(rcp.Condition); } else { string[] datas = rcp.Condition.Split(";".ToCharArray()); conditon.SetMultiValues(new List <string>(datas)); } return(conditon); }