Пример #1
0
        private Mapper CreateMapperObject()
        {
            Mapper mapper = new Mapper();
            string labelValue = string.Empty;
            string comboValue = string.Empty;

            foreach (Control ctl in flowLayoutPanel1.Controls)
            {
                Type ctlType = ctl.GetType();

                if (ctlType == typeof(Label))
                {
                    labelValue = ctl.Text;
                }
                else if (ctlType == typeof(ComboBox))
                {
                    comboValue = ctl.Text;
                }

                if (labelValue != string.Empty && comboValue != string.Empty && comboValue != string.Empty)
                {
                    mapper.Add(labelValue, comboValue);

                    labelValue = string.Empty;
                    comboValue = string.Empty;
                }

            }

            return mapper;
        }