public int ShowConditions(List <QuickReportCore.Objects.Condition> list) { pnlConditions.SuspendLayout(); GobalConditionList = new List <QuickReportCore.Objects.Condition>(); Hashtable newUcConditionControls = new Hashtable(); int timer = 0; for (int i = 0; i < list.Count; i++) { if (!ucConditionObjectControls.Contains(list[i].ID)) { ucConditionObject uc = new ucConditionObject(); uc.ActivateOn += new ucConditionObject.ActivateHandle(uc_ActivateOn); uc.ConditionShowChanged += new ucConditionObject.ConditionShowChangedHandle(uc_ConditionShowChanged); uc.Condition = list[i]; uc.Condition.SortId = timer; uc.InitFormConditionEditor(f); timer++; ucConditionObjectControls.Add(list[i].ID, uc); newUcConditionControls.Add(list[i].ID, uc); } else { if (!newUcConditionControls.Contains(list[i].ID)) { Objects.Condition tempCondition = (ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition.Clone(); tempCondition.Name = list[i].Name; tempCondition.SortId = timer; (ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition = tempCondition; timer++; newUcConditionControls.Add(list[i].ID, ucConditionObjectControls[list[i].ID]); } } if ((ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition.Use) { GobalConditionList.Add((ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition); } } ucConditionObjectControls = newUcConditionControls; pnlConditions.Controls.Clear(); foreach (DictionaryEntry de in ucConditionObjectControls) { pnlConditions.Controls.Add(de.Value as Control); int i = (de.Value as ucConditionObject).Condition.SortId; if (i == 0) { (de.Value as ucConditionObject).Location = new Point(leftMargin, topMargin); } else { (de.Value as ucConditionObject).Location = new Point(leftMargin, topMargin + (ucConditionObjectControls[list[i].ID] as ucConditionObject).Height * i + eatchMargin * i); } } pnlConditions.ResumeLayout(); return(1); }
public void ParseFromXml(XmlDocument xmlDocument) { GobalConditionList = new List <QuickReportCore.Objects.Condition>(); System.Xml.XmlNodeList nodeList = xmlDocument.SelectNodes("//" + ucConditionObject.XmlAttrDic.ConditionObject.ToString()); Objects.Condition[] conditions = new QuickReportCore.Objects.Condition[nodeList.Count]; foreach (System.Xml.XmlNode node in nodeList) { Objects.Condition condition = new QuickReportCore.Objects.Condition(); condition.ID = Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.tID.ToString(), string.Empty); condition.Name = Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.tName.ToString(), string.Empty); condition.ConditionType.ID = Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.tConditionTypeID.ToString(), string.Empty); condition.ConditionType.Name = Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.tConditionTypeName.ToString(), string.Empty); condition.ConditionType.Content = node.SelectSingleNode(Forms.frmToolBoxConditionTypeEditor.XmlAttrDic.ConditionTypeContent.ToString()) as System.Xml.XmlElement; condition.DefaultShow = Convert.ToBoolean(Convert.ToInt32(Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.bDefaultShow.ToString(), "0"))); condition.Use = Convert.ToBoolean(Convert.ToInt32(Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.bUse.ToString(), "0"))); condition.NotNull = Convert.ToBoolean(Convert.ToInt32(Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.bNotNull.ToString(), "0"))); condition.SortId = Convert.ToInt32(Managers.Functions.GetNodeAttrValue(node, ucConditionObject.XmlAttrDic.tSortID.ToString(), "0")); condition.ConditionSetting = node.SelectSingleNode(ucConditionObject.XmlAttrDic.ConditionSetting.ToString()) as XmlElement; conditions[condition.SortId] = condition.Clone(); if (conditions[condition.SortId].Use) { GobalConditionList.Add(conditions[condition.SortId]); } } ucConditionObjectControls = new Hashtable(); for (int i = 0; i < conditions.Length; i++) { if (!ucConditionObjectControls.Contains(conditions[i].ID)) { ucConditionObject uc = new ucConditionObject(); uc.ActivateOn += new ucConditionObject.ActivateHandle(uc_ActivateOn); uc.ConditionShowChanged += new ucConditionObject.ConditionShowChangedHandle(uc_ConditionShowChanged); uc.InitFormConditionEditor(f); uc.Condition = conditions[i]; ucConditionObjectControls.Add(conditions[i].ID, uc); } } pnlConditions.Controls.Clear(); foreach (DictionaryEntry de in ucConditionObjectControls) { pnlConditions.Controls.Add(de.Value as Control); int i = (de.Value as ucConditionObject).Condition.SortId; if (i == 0) { (de.Value as ucConditionObject).Location = new Point(leftMargin, topMargin); } else { (de.Value as ucConditionObject).Location = new Point(leftMargin, topMargin + (ucConditionObjectControls[conditions[i].ID] as ucConditionObject).Height * i + eatchMargin * i); } } }