Esempio n. 1
0
 private void setComboBoxColumnContent(DataGridViewComboBoxColumn column, subExtra extra)
 {
     foreach (checkType type in extra.getAllCheckType())
     {
         column.Items.Add(type.typeName);
     }
 }
Esempio n. 2
0
        public DataGridViewComboBoxColumn init_createColumn(subExtra extra)
        {
            DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();

            setComboBoxColumnStyle(column);
            column.HeaderText       = extra.name;
            column.Name             = extra.UUID;
            column.ContextMenuStrip = HKMenuStrip.createRightMenu(
                new HKMenuStrip.ItemStruct("修改考勤记录标题", modifyExtraTitle, column),
                new HKMenuStrip.ItemStruct("删除该列考勤记录", confirmToExtraDelete, column));
            setComboBoxColumnContent(column, extra);
            return(column);
        }
Esempio n. 3
0
        public ExtraResult showForm()
        {
            ShowDialog();
            ExtraResult result = new ExtraResult();

            result.confirm = confirm;
            if (confirm == true)
            {
                checkType[] checkTypes = getCheckTypeFromPanel();
                subExtra    subExt     = new subExtra(nameInputBox.text, checkTypes);
                result.subExt = subExt;
            }
            return(result);
        }
Esempio n. 4
0
        private void changeExtra(Student stu, subExtra subExt, string value)
        {
            StuExtra stuExt = stu.getStuExtra(subExt.UUID);

            if (stuExt == null)
            {
                stuExt = new StuExtra(subExt, value);
                stu.addStuExtra(stuExt);
            }
            else
            {
                stuExt.name   = subExt.name;
                stuExt.result = subExt[value];
            }
        }
Esempio n. 5
0
 private void addAnExtraItem(subExtra subExt)
 {
     Model.Course course = courseRef;
     if (!course.containsExtra(subExt.name))
     {
         course.addExtra(subExt);
         GlobalStation.shareInstance.librarySave(delegate() {
             mainGrid.Columns.Add(init_createColumn(subExt));
         }, delegate() {
             course.removeExtra(subExt.UUID);
         });
     }
     else
     {
         HKConfirmForm.showConfirmForm("已有同名的考勤项目存在");
     }
 }
Esempio n. 6
0
        private void changeSpecalAttribute(Model.Course course, StuList stuList, DataGridViewCellEventArgs e)
        {
            Student            stu    = stuList[editingStudentId];
            DataGridViewColumn column = mainGrid.Columns[e.ColumnIndex];
            string             UUID   = column.Name;
            SubAttandance      subAtt = course.getSubAttandance(UUID);
            string             value  = (string)mainGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;

            if (subAtt != null)
            {
                Record recordToChangeTo = course.getRecord(value);
                changeAttandance(stu, subAtt, recordToChangeTo);
                mainGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = recordToChangeTo.recordColor;
            }
            else
            {
                subExtra subExt = course.getExtra(UUID);
                changeExtra(stu, subExt, value);
                mainGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = subExt[value].typeColor;
            }
        }
Esempio n. 7
0
        private void modifyExtraTitle(string itemText, object userData)
        {
            DataGridViewColumn column   = userData as DataGridViewColumn;
            InputResult        result   = HKTextInputForm.showInputform("修改标题", column.HeaderText);
            subExtra           subExt   = null;
            string             oldTitle = null;

            if (result.confirm)
            {
                string extraUUID = column.Name;
                subExt      = courseRef.getExtra(extraUUID);
                oldTitle    = subExt.name;
                subExt.name = result.input;
                GlobalStation.shareInstance.librarySave(delegate() {
                    stopCellValueChanged();
                    column.HeaderText = result.input;
                    startCellValueChanged();
                }, delegate() {
                    subExt.name = oldTitle;
                });
            }
        }