public bool SetType(int chapterType)
        {
            if (false == chapterManager.GetChapterTypeList(out List <ChapterType> chapterTypeList))
            {
                return(false);
            }

            bool   isExists = false;
            string name     = "";

            foreach (ChapterType chapterTypeInfo in chapterTypeList)
            {
                if (chapterTypeInfo.ID == chapterType)
                {
                    isExists = true;
                    name     = chapterTypeInfo.Name;
                    break;
                }
            }
            if (isExists == false)
            {
                return(false);
            }
            _Type        = chapterType;
            lblInfo.Text = "添加" + name + "分组";
            return(true);
        }
        public FormChapterAdd()
        {
            InitializeComponent();
            chapterManager = new ChapterManager();
            m_chapter      = new ChapterInfo();

            chapterManager.GetChapterTypeList(out List <ChapterType> chapterTypeList);

            cboxChapterType.Items.Clear();
            foreach (ChapterType chapterTypeInfo in chapterTypeList)
            {
                cboxChapterType.Items.Add(chapterTypeInfo);
            }
        }
示例#3
0
        private void FormQuestionManage_Load(object sender, EventArgs e)
        {
            dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.PaleTurquoise;
            dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;
            dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            dataGridView1.Rows.Clear();

            //dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
            dataGridView1.RowsDefaultCellStyle.WrapMode = (DataGridViewTriState.True);



            foreach (var classification in Question._ModelClassificationInfo)
            {
                cboxClassification.Items.Add(classification);
            }
            cboxClassification.SelectedIndex = 0;

            foreach (var typeInfo in Question._TypeInfo)
            {
                comboBoxType.Items.Add(typeInfo);
            }
            comboBoxType.SelectedIndex = 0;

            chapterManager = new ChapterManager();
            chapterManager.GetChapterTypeList(out List <ChapterType> chapterTypeList, true);
            cboxChaperType.Items.Clear();

            foreach (ChapterType chapterType in chapterTypeList)
            {
                cboxChaperType.Items.Add(chapterType);
            }

            cboxChaperType.SelectedIndex = 0;

            isLoadSuccess = true;
        }