Пример #1
0
        public AddRecordDetail GetAddRecordDetail(AddRecordDetail prevDetail)
        {
            form = form ?? new AddRecordForm();

            prevDetail.DataSource.Sort();

            form.DataSource = prevDetail.DataSource;
            form.TableName = prevDetail.TableName;
            form.PKey = prevDetail.PKey;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                return new AddRecordDetail(form.TableName, form.PKey) { IsNew = true };

            if (prevDetail == null) return null;

            prevDetail.IsNew = false;
            return prevDetail;
        }
Пример #2
0
        private void addRecordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            addRecordDetail = addRecordDetail ?? new AddRecordDetail(string.Empty, "0");

            addRecordDetail.DataSource = InformationSchema.Instance.GetTables();

            addRecordDetail = new AddRecordController().GetAddRecordDetail(addRecordDetail);

            if (addRecordDetail.IsNew)
            {
                tableNodeContainer.Nodes.Add(new TableNode(addRecordDetail.TableName,
                    InformationSchema.Instance.GetPrimaryKey(addRecordDetail.TableName), addRecordDetail.PKey));
            }
        }