Пример #1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (rbtDetail.Checked)
     {
         if (lsvDetailReferences.SelectedItems.Count == 0)
         {
             StdDialog.ShowError("s_please_select_foreign_key");
             return;
         }
         IForeignKey fk = (IForeignKey)lsvDetailReferences.SelectedItems[0].Tag;
         m_result   = CreateDetailReference(fk, m_dialect);
         m_resultFk = fk;
     }
     if (rbtMaster.Checked)
     {
         if (lsvMasterReferences.SelectedItems.Count == 0)
         {
             StdDialog.ShowError("s_please_select_foreign_key");
             return;
         }
         IForeignKey fk = (IForeignKey)lsvMasterReferences.SelectedItems[0].Tag;
         m_resultFk = fk;
         m_result   = CreateMasterReference(fk, m_dialect);
     }
     DialogResult = DialogResult.OK;
     Close();
 }
Пример #2
0
        public static ReferenceViewDefinition CreateDetailReference(IForeignKey fk, ISqlDialect dialect)
        {
            var res = new ReferenceViewDefinition();

            res.Dialect = dialect;
            res.SourceColumns.AddRange(from c in fk.PrimaryKeyColumns select c.ColumnName);
            res.ReferenceColumns.AddRange(from c in fk.Columns select c.ColumnName);
            res.TableName = fk.Table.FullName;
            return(res);
        }
Пример #3
0
        internal void GoToReference(ReferenceViewDefinition refdef, BedRow masterRow)
        {
            ITabularDataView newdata = DataStatePer.TableData.TableSource.Database.GetTable(refdef.TableName).GetTabularData();
            int delcnt = m_historyChain.Count - m_historyPosition - 1;

            if (delcnt > 0)
            {
                m_historyChain.RemoveRange(m_historyPosition + 1, delcnt);
            }
            var state = new PerspectiveIndependendState();

            state.TableData           = newdata;
            state.AdditionalCondition = refdef.GetCondition(masterRow);
            m_historyChain.Add(state);
            m_historyPosition++;
        }
Пример #4
0
        public ReferencesTableDataFrame(TableDataFrame masterFrame, ReferenceViewDefinition refdef, BedRow masterRow)
        {
            InitializeComponent();
            //ParentFrame = parentFrame;
            //m_parentFrame = parentFrame;
            MasterFrame = masterFrame;
            m_baseView  = masterFrame.TabularData;
            m_refdef    = refdef;
            m_masterRow = masterRow;
            var src = m_baseView.DatabaseSource.GetTable(m_refdef.TableName);

            State = new TableRelatedState();
            DataStatePer.AdditionalCondition = m_refdef.GetCondition(m_masterRow);
            DataStatePer.TableData           = src.GetTabularData();

            //RefreshCurrentViewNoRedock();
            //MainWindow.Instance.RunInMainWindow(RefreshCurrentViewNoRedock);
            //btnReferences.Enabled = false;
            //TabularData = src.GetTabularDataAndReuse();
            //LoadDependendData();
        }
Пример #5
0
 public FrameDef()
 {
     ReferenceDef = new ReferenceViewDefinition();
 }