Esempio n. 1
0
        public void Remove(String key)
        {
            ABCBindingConfig config = GetValueFromKey(key);

            config.Parent.Children.Remove(key);
            Invalidate();
        }
Esempio n. 2
0
        public object Clone( )
        {
            ABCBindingConfig obj = (ABCBindingConfig)this.MemberwiseClone();

            obj.Children = new Dictionary <string, ABCBindingConfig>();
            return(obj);
        }
Esempio n. 3
0
        public void DeSerialization(XmlDocument doc)
        {
            BindingList.Clear();
            DeSerialedList.Clear();

            XmlNodeList nodeList = doc.GetElementsByTagName("B");

            foreach (XmlNode node in nodeList)
            {
                try
                {
                    String strName = node.Attributes["name"].Value.ToString();
                    if (!DeSerialedList.Contains(strName))
                    {
                        ABCBindingConfig currentInfo = DeSerialization(node);

                        if (!BindingList.ContainsKey(currentInfo.Name))
                        {
                            BindingList.Add(currentInfo.Name, currentInfo);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ABCHelper.ABCMessageBox.Show("Bug : Deserialize DataConfig!");
                }
            }
        }
Esempio n. 4
0
 private void GetValuesFromNode(ABCBindingConfig current)
 {
     Values.Add(current);
     foreach (ABCBindingConfig child in current.Children.Values)
     {
         GetValuesFromNode(child);
     }
 }
Esempio n. 5
0
        private void SetValueFromKey(string strKey, ABCBindingConfig value)
        {
            for (int i = 0; i < this.Values.Count; i++)
            {
                if (this.Values[i].Name == strKey)
                {
                    this.Values[i] = value;
                    break;
                }
            }

            Invalidate();
        }
Esempio n. 6
0
        private ABCScreen.ABCBindingConfig InitNodes(ABCCommonTreeListNode parentNode, ABCScreen.ABCBindingConfig bindInfo)
        {
            if (AddedList.Contains(bindInfo))
            {
                return(null);
            }
            AddedList.Add(bindInfo);

            ABCScreen.ABCBindingConfig newBindInfo = (ABCScreen.ABCBindingConfig)bindInfo.Clone();
            ABCCommonTreeListNode      node        = new ABCCommonTreeListNode(parentNode, newBindInfo);

            foreach (ABCScreen.ABCBindingConfig childInfo in bindInfo.Children.Values)
            {
                ABCScreen.ABCBindingConfig newChildBindInfo = InitNodes(node, childInfo);
                if (newChildBindInfo != null)
                {
                    newChildBindInfo.Parent = newBindInfo;
                    newBindInfo.Children.Add(newChildBindInfo.Name, newChildBindInfo);
                }
            }
            return(newBindInfo);
        }
Esempio n. 7
0
 public bool ContainsValue(ABCBindingConfig config)
 {
     return(Values.Contains(config));
 }
Esempio n. 8
0
 public void Add(String key, ABCBindingConfig config)
 {
     InnerList.Add(key, config);
     Invalidate();
 }
Esempio n. 9
0
        public ABCBindingConfig DeSerialization(XmlNode currentNode)
        {
            ABCBindingConfig currentInfo = new ABCBindingConfig();

            try
            {
                #region Current Node
                if (currentInfo != null)
                {
                    currentInfo.Children.Clear();
                }

                currentInfo.Name        = currentNode.Attributes["name"].Value.ToString();
                currentInfo.TableName   = currentNode.Attributes["table"].Value.ToString();
                currentInfo.OwnerConfig = this;

                if (currentNode.Attributes["IsList"] != null)
                {
                    currentInfo.IsList = Convert.ToBoolean(currentNode.Attributes["IsList"].Value.ToString());
                }

                if (currentNode.Attributes["IsMainObject"] != null)
                {
                    currentInfo.IsMainObject = Convert.ToBoolean(currentNode.Attributes["IsMainObject"].Value.ToString());
                }

                if (currentNode.Attributes["DisplayOnly"] != null)
                {
                    currentInfo.DisplayOnly = Convert.ToBoolean(currentNode.Attributes["DisplayOnly"].Value.ToString());
                }

                if (currentNode.Attributes["AutoSave"] != null)
                {
                    currentInfo.AutoSave = Convert.ToBoolean(currentNode.Attributes["AutoSave"].Value.ToString());
                }

                if (currentNode.Attributes["ConfirmSaveChildren"] != null)
                {
                    currentInfo.ConfirmSaveChildren = Convert.ToBoolean(currentNode.Attributes["ConfirmSaveChildren"].Value.ToString());
                }

                if (currentNode.Attributes["DefaultField"] != null)
                {
                    currentInfo.DefaultField = currentNode.Attributes["DefaultField"].Value.ToString();
                }

                if (currentNode.Attributes["DefaultValue"] != null)
                {
                    currentInfo.DefaultValue = currentNode.Attributes["DefaultValue"].Value.ToString();
                }

                if (currentNode.Attributes["TopCount"] != null)
                {
                    currentInfo.TopCount = Convert.ToInt32(currentNode.Attributes["TopCount"].Value.ToString());
                }

                if (currentNode.Attributes["CurrentUserOnly"] != null)
                {
                    currentInfo.CurrentUserOnly = Convert.ToBoolean(currentNode.Attributes["CurrentUserOnly"].Value.ToString());
                }

                if (currentNode.Attributes["CurrentUserGroupOnly"] != null)
                {
                    currentInfo.CurrentUserGroupOnly = Convert.ToBoolean(currentNode.Attributes["CurrentUserGroupOnly"].Value.ToString());
                }

                if (currentNode.Attributes["CurrentEmployeeOnly"] != null)
                {
                    currentInfo.CurrentEmployeeOnly = Convert.ToBoolean(currentNode.Attributes["CurrentEmployeeOnly"].Value.ToString());
                }

                if (currentNode.Attributes["CurrentCompanyUnitOnly"] != null)
                {
                    currentInfo.CurrentCompanyUnitOnly = Convert.ToBoolean(currentNode.Attributes["CurrentCompanyUnitOnly"].Value.ToString());
                }

                if (currentNode.Attributes["parentField"] != null)
                {
                    currentInfo.ParentField = currentNode.Attributes["parentField"].Value.ToString();
                }

                if (currentNode.Attributes["childField"] != null)
                {
                    currentInfo.ChildField = currentNode.Attributes["childField"].Value.ToString();
                }

                if (currentNode.Attributes["parentField1"] != null)
                {
                    currentInfo.ParentField1 = currentNode.Attributes["parentField1"].Value.ToString();
                }

                if (currentNode.Attributes["childField1"] != null)
                {
                    currentInfo.ChildField1 = currentNode.Attributes["childField1"].Value.ToString();
                }

                if (currentNode.Attributes["parentField2"] != null)
                {
                    currentInfo.ParentField2 = currentNode.Attributes["parentField2"].Value.ToString();
                }

                if (currentNode.Attributes["childField2"] != null)
                {
                    currentInfo.ChildField2 = currentNode.Attributes["childField2"].Value.ToString();
                }

                if (currentNode.Attributes["parentField3"] != null)
                {
                    currentInfo.ParentField3 = currentNode.Attributes["parentField3"].Value.ToString();
                }

                if (currentNode.Attributes["childField3"] != null)
                {
                    currentInfo.ChildField3 = currentNode.Attributes["childField3"].Value.ToString();
                }

                if (currentNode.Attributes["SQLExtension"] != null)
                {
                    currentInfo.SQLExtension = currentNode.Attributes["SQLExtension"].Value.ToString();
                }

                if (currentNode.Attributes["SQLQuery"] != null)
                {
                    currentInfo.SQLQuery = currentNode.Attributes["SQLQuery"].Value.ToString();
                }

                if (currentNode.Attributes["filterString"] != null)
                {
                    currentInfo.FilterCondition = currentNode.Attributes["filterString"].Value.ToString();
                }

                if (currentNode.Attributes["SQLFilterString"] != null)
                {
                    currentInfo.SQLFilterCondition = currentNode.Attributes["SQLFilterString"].Value.ToString();
                }

                foreach (XmlNode nodeFilter in currentNode.SelectNodes("Filter"))
                {
                    String strField        = nodeFilter.Attributes["Field"].Value.ToString();
                    String strFilterString = nodeFilter.InnerText;

                    ABCBindingConfig.FieldFilterConfig config = new ABCBindingConfig.FieldFilterConfig();
                    config.Field        = strField;
                    config.FilterString = strFilterString;
                    config.TableName    = DataStructureProvider.GetTableNameOfForeignKey(currentInfo.TableName, strField);
                    currentInfo.FieldFilterConditions.Add(config);
                }
                #endregion

                foreach (XmlNode node in currentNode.SelectNodes("B"))
                {
                    ABCBindingConfig bindInfo = DeSerialization(node);
                    currentInfo.Children.Add(bindInfo.Name, bindInfo);
                    bindInfo.Parent     = currentInfo;
                    bindInfo.ParentName = currentInfo.Name;
                }

                DeSerialedList.Add(currentInfo.Name);
            }
            catch (Exception ex)
            {
                ABCHelper.ABCMessageBox.Show(String.Format("Can not Deserialize ABCBindingConfig : {0}", currentInfo.Name));
            }
            return(currentInfo);
        }
Esempio n. 10
0
        public XmlElement Serialization(XmlDocument doc, ABCBindingConfig bindInfo)
        {
            #region Current BindInfo
            XmlElement ele = doc.CreateElement("B");
            ele.SetAttribute("name", bindInfo.Name);
            ele.SetAttribute("table", bindInfo.TableName);

            if (bindInfo.IsList)
            {
                ele.SetAttribute("IsList", bindInfo.IsList.ToString());
            }

            if (bindInfo.IsMainObject)
            {
                ele.SetAttribute("IsMainObject", bindInfo.IsMainObject.ToString());
            }

            ele.SetAttribute("DisplayOnly", bindInfo.DisplayOnly.ToString());
            ele.SetAttribute("AutoSave", bindInfo.AutoSave.ToString());
            ele.SetAttribute("ConfirmSaveChildren", bindInfo.ConfirmSaveChildren.ToString());
            ele.SetAttribute("DefaultField", bindInfo.DefaultField.ToString());
            ele.SetAttribute("DefaultValue", bindInfo.DefaultValue.ToString());
            ele.SetAttribute("TopCount", bindInfo.TopCount.ToString());


            ele.SetAttribute("CurrentUserOnly", bindInfo.CurrentUserOnly.ToString());
            ele.SetAttribute("CurrentUserGroupOnly", bindInfo.CurrentUserGroupOnly.ToString());
            ele.SetAttribute("CurrentEmployeeOnly", bindInfo.CurrentEmployeeOnly.ToString());
            ele.SetAttribute("CurrentCompanyUnitOnly", bindInfo.CurrentCompanyUnitOnly.ToString());

            if (string.IsNullOrWhiteSpace(bindInfo.SQLExtension) == false)
            {
                ele.SetAttribute("SQLExtension", bindInfo.SQLExtension);
            }

            if (string.IsNullOrWhiteSpace(bindInfo.SQLQuery) == false)
            {
                ele.SetAttribute("SQLQuery", bindInfo.SQLQuery);
            }

            if (string.IsNullOrWhiteSpace(bindInfo.ParentField) == false)
            {
                ele.SetAttribute("parentField", bindInfo.ParentField);
            }
            if (string.IsNullOrWhiteSpace(bindInfo.ChildField) == false)
            {
                ele.SetAttribute("childField", bindInfo.ChildField);
            }

            if (string.IsNullOrWhiteSpace(bindInfo.ParentField1) == false)
            {
                ele.SetAttribute("parentField1", bindInfo.ParentField1);
            }
            if (string.IsNullOrWhiteSpace(bindInfo.ChildField1) == false)
            {
                ele.SetAttribute("childField1", bindInfo.ChildField1);
            }

            if (string.IsNullOrWhiteSpace(bindInfo.ParentField2) == false)
            {
                ele.SetAttribute("parentField2", bindInfo.ParentField2);
            }
            if (string.IsNullOrWhiteSpace(bindInfo.ChildField2) == false)
            {
                ele.SetAttribute("childField2", bindInfo.ChildField2);
            }

            if (string.IsNullOrWhiteSpace(bindInfo.ParentField3) == false)
            {
                ele.SetAttribute("parentField3", bindInfo.ParentField3);
            }
            if (string.IsNullOrWhiteSpace(bindInfo.ChildField3) == false)
            {
                ele.SetAttribute("childField3", bindInfo.ChildField3);
            }

            if (string.IsNullOrWhiteSpace(bindInfo.FilterCondition) == false)
            {
                ele.SetAttribute("filterString", bindInfo.FilterCondition);
            }
            if (string.IsNullOrWhiteSpace(bindInfo.SQLFilterCondition) == false)
            {
                ele.SetAttribute("SQLFilterString", bindInfo.SQLFilterCondition);
            }

            if (bindInfo.FieldFilterConditions.Count > 0)
            {
                foreach (ABCBindingConfig.FieldFilterConfig config in bindInfo.FieldFilterConditions)
                {
                    //if ( String.IsNullOrWhiteSpace( config.FilterString )==false )
                    //{
                    XmlElement eleFilter = doc.CreateElement("Filter");
                    eleFilter.SetAttribute("Field", config.Field);
                    eleFilter.InnerText = config.FilterString;
                    ele.AppendChild(eleFilter);
                    //    }
                }
            }
            #endregion

            foreach (ABCBindingConfig childInfo in bindInfo.Children.Values)
            {
                XmlElement childEle = Serialization(doc, childInfo);
                ele.AppendChild(childEle);
            }

            SerialedList.Add(bindInfo.Name);
            return(ele);
        }