コード例 #1
0
        private Record insertIncomeForm(Record record)
        {
            int curRecord = contextMenuRowIndex - 1;
            int curNumber = -1;

            while (curRecord >= 0)
            {
                Record rec = m_mainDiary.GetRecord(curRecord);
                if (rec.Type == Record.RecordType.Income)
                {
                    curNumber = rec.TypeID;
                    break;
                }
                curRecord--;
            }
            if (curNumber == -1)
            {
                curNumber = m_mainDiary.TypeCounts[(int)Record.RecordType.Income];
            }
            record.TypeID = curNumber + 1;

            incomeForm iForm = new incomeForm(record, this);

            iForm.ShowDialog();
            if (iForm.Result == inoutParentForm.InOutFormResult.OK)
            {
                return(iForm.getDataRec());
            }
            return(null);
        }
コード例 #2
0
        private void btnIncome_Click(object sender, EventArgs e)
        {
            Record newRecord = new Record();    //todo kdo nastavi defaulty?

            initRecord(ref newRecord, m_mainDiary);

            newRecord.TypeID = m_mainDiary.TypeCounts[(int)Record.RecordType.Income] + 1;
            incomeForm iform = new incomeForm(newRecord, this);

            iform.ShowDialog();
            if (iform.Result != inoutParentForm.InOutFormResult.Cancel)
            {
                m_mainDiary.AppendRecord(iform.getDataRec());
                EnsureRecordVisibility(m_mainDiary.RecordsCount - 1);
                UpdateCurrentPage();
            }
        }