コード例 #1
0
        private void buttonFinishEditing_Click(object sender, EventArgs e)
        {
            double           totalFee = 0.0;
            SourcingNoteType note     = GetSourcingNoteFromUI(out totalFee);

            if (note == null)
            {
                return;
            }

            if (mEditMode == EditMode.CreateNew)
            {
                int newNoteId = SourcingNoteDAL.InsertOneSourcingNote(note);
                if (newNoteId > 0)
                {
                    MessageBox.Show("创建采购单成功", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("创建采购单失败", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (SourcingNoteDAL.ModifyOneSourcingNote(note))
                {
                    MessageBox.Show("修改采购单成功", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("创建采购单失败", "抱歉", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        private void ToolStripMenuItemEditNote_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.pagedDgvSourcingNote.DgvData.SelectedRows;

            if (rows == null || rows.Count != 1)
            {
                return;
            }

            DataGridViewRow row = rows[0];

            if (row == null)
            {
                return;
            }

            int noteId            = StringUtil.GetSafeInt(row.Cells[0].Value);
            SourcingNoteType note = SourcingNoteDAL.GetSourcingNoteById(noteId);

            if (note == null)
            {
                return;
            }

            FrmEditSourcingNote frm = new FrmEditSourcingNote(note);

            frm.StartPosition = FormStartPosition.CenterParent;
            frm.ShowDialog();

            this.pagedDgvSourcingNote.LoadData();
        }