Beispiel #1
0
        private void fillGrid(int parentId)
        {
            System.Collections.Hashtable hash = new Hashtable();
            //hash.Add("colorField", InsuranceTypeData.INSURANCETYPECOLOR_FIELD);
            if (parentId < 0)
            {
                _basicInfoEntity = _basicInfoBl.getRoots();
            }
            else
            {
                _basicInfoEntity = _basicInfoBl.getByParentId(parentId, true);
            }

            _gridTools.bindDataToGrid(dataGridView1, _basicInfoEntity, new GridTools.changingRow(_gridTools.changeColor), hash);
        }
        public void load()
        {
            int             biId   = _basicInfoBL.getId(_engName);
            BasicInfoEntity entity = _basicInfoBL.getByParentId(biId);
            CheckBox        cb;

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string desc = entity.get(i, BasicInfoEntity.FIELD_DESCRIPTION).ToString();
                int    id   = int.Parse(entity.get(i, BasicInfoEntity.FIELD_ID).ToString());

                cb         = new CheckBox();
                cb.Checked = false;
                cb.Tag     = id;
                cb.Text    = desc;
                cb.Height  = 20;
                cb.Width   = flowLayoutPanel1.Width - 5;
                flowLayoutPanel1.Controls.Add(cb);
            }
        }
Beispiel #3
0
        public static void fillComboBox(ComboBox cmb, int parentId, int defaultItemId)
        {
            BasicInfoEntity parentEntity    = _basicInfoBL.get(parentId);
            Boolean         containsUnknown = false;
            string          c = parentEntity.get(BasicInfoEntity.FIELD_CONTAINUNKNOWN).ToString();

            if (c != null && c.Trim().Length > 0)
            {
                containsUnknown = Boolean.Parse(c);
            }

            BasicInfoEntity entity     = _basicInfoBL.getByParentId(parentId);
            var             dataSource = new List <ComboBoxItem>();

            try
            {
                cmb.Items.Clear();
            }
            catch (Exception ex) { }
            if (containsUnknown == true)
            {
                AddUnKnown(dataSource);
            }

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string id         = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_ID].ToString();
                string desc       = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_DESCRIPTION].ToString();
                string customData = "";
                if (entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_CUSTOMFIELD] != null)
                {
                    customData = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString();
                }

                dataSource.Add(new ComboBoxItem(desc, id, customData));
            }

            // is inActive? or not
            BasicInfoEntity niEntity = _basicInfoBL.get(defaultItemId);

            if (niEntity.Tables[niEntity.FilledTableName].Rows.Count > 0)
            {
                bool isActive = bool.Parse(niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ACTIVE].ToString());;
                if (isActive == false)
                {
                    string id         = niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ID].ToString();
                    string desc       = niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_DESCRIPTION].ToString();
                    string customData = "";
                    if (niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD] != null)
                    {
                        customData = niEntity.Tables[entity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString();
                    }

                    dataSource.Add(new ComboBoxItem(desc, id, customData));
                }
            }
            cmb.DataSource    = dataSource;
            cmb.DisplayMember = "Text";
            cmb.ValueMember   = "Value";

            for (int i = 0; i < cmb.Items.Count; i++)
            {
                if (((ComboBoxItem)cmb.Items[i]).Value.Equals(defaultItemId.ToString()))
                {
                    cmb.SelectedIndex = i;
                    break;
                }
            }
        }