Exemple #1
0
        /// <summary>
        /// 添加一个映射元素到集合中
        /// </summary>
        /// <param name="element"></param>
        public void Add(MappingElement element)
        {
            if (Elements == null)
            {
                Elements = new List <MappingElement>();
            }
            if (element == null)
            {
                return;
            }
            var  eles  = Elements;
            bool exist = false;

            foreach (var m in eles)
            {
                if (m == element)
                {
                    exist = true; break;
                }
            }
            if (exist == false)
            {
                eles.Add(element);
                Elements = eles;
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var th = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
            {

                int tables = (int)numTables.Value;
                int cols = (int)numCols.Value;
                AddInfo("开始构造");
                var mapGroup = new MappingGroup();
                mapGroup.Name = "名称";
                mapGroup.ErrorHappened += new Action<string>(mapGroup_ErrorHappened);

                for (int i = 0; i < tables; i++)
                {
                    MapElementCollection mec = new MapElementCollection();
                    mec.Name = "table" + i % (tables + 1);

                    MappingElement ele1 = new MappingElement(
                       new ColumnElement("dept_name"), new ColumnElement("单位名称"));
                    mec.Add(ele1);

                    MappingElement ele = new MappingElement(
                        new ColumnElement("dept_id"), new ColumnElement("单位ID"));
                    mec.Add(ele);

                    mapGroup.Add(mec);
                }

                AddInfo("构造完成");
                yltl.Common.ConfigHelper<MappingGroup>.Reflesh(mapGroup);
                AddInfo("保存完成");
            }));
            th.Start();
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var th = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
            {
                int tables = (int)numTables.Value;
                int cols   = (int)numCols.Value;
                AddInfo("开始构造");
                var mapGroup            = new MappingGroup();
                mapGroup.Name           = "名称";
                mapGroup.ErrorHappened += new Action <string>(mapGroup_ErrorHappened);

                for (int i = 0; i < tables; i++)
                {
                    MapElementCollection mec = new MapElementCollection();
                    mec.Name = "table" + i % (tables + 1);

                    MappingElement ele1 = new MappingElement(
                        new ColumnElement("dept_name"), new ColumnElement("单位名称"));
                    mec.Add(ele1);

                    MappingElement ele = new MappingElement(
                        new ColumnElement("dept_id"), new ColumnElement("单位ID"));
                    mec.Add(ele);



                    mapGroup.Add(mec);
                }

                AddInfo("构造完成");
                yltl.Common.ConfigHelper <MappingGroup> .Reflesh(mapGroup);
                AddInfo("保存完成");
            }));

            th.Start();
        }
 /// <summary>
 /// 添加一个映射元素到集合中
 /// </summary>
 /// <param name="element"></param>
 public void Add(MappingElement element)
 {
     if (Elements == null) Elements = new List<MappingElement>();
     if (element == null) return;
     var eles = Elements;
     bool exist = false;
     foreach (var m in eles)
     {
         if (m == element) { exist = true; break; }
     }
     if (exist == false)
     {
         eles.Add(element);
         Elements = eles;
     }
 }