Пример #1
0
        public override void CreateEntities(PxMetaModel.PcAxisMetabaseEntities context)
        {
            if (IsNew)
            {
                PxMetaModel.MainTable mainTable = new PxMetaModel.MainTable();

                mainTable.MainTable1 = TableId;
                mainTable.PresText = PresText;
                mainTable.PresTextS = PressTextS;
                mainTable.TableStatus = TableStatus;
                mainTable.SpecCharExists = SpecCharExists;
                mainTable.ContentsVariable = ContentVariable;
                mainTable.TableId = TableId;
                mainTable.PresCategory = PresCategory;
                mainTable.ProductId = ProductId;
                mainTable.SubjectCode = Theme;
                mainTable.TimeScale = TimeScaleId;
                mainTable.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                mainTable.LogDate = DateTime.Now;

                context.AddToMainTables(mainTable);

                PxMetaModel.MainTable_Eng mainTableEng = new PxMetaModel.MainTable_Eng();
                mainTableEng.MainTable1 = mainTable;
                mainTableEng.PresText = TableTitleEnglish;
                mainTableEng.PresTextS = TableTitleEnglish;
                mainTableEng.Status = EnglishStatus;
                mainTableEng.Published = EnglishPublished;
                mainTableEng.ContentsVariable = ContentVariableEnglish;
                mainTableEng.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                mainTableEng.LogDate = DateTime.Now;

                context.AddToMainTable_Eng(mainTableEng);

                short counter = 0;
                foreach (var content in _contents)
                {
                    counter++;
                    content.StoreColumnNo = counter;
                    content.MainTable = this;
                    content.Save(context);

                }

                PxMetaModel.SubTable subTable = new PxMetaModel.SubTable();
                subTable.MainTable1 = mainTable;
                subTable.SubTable1 = "1";
                subTable.PresText = mainTable.PresText;
                subTable.CleanTable = "X";
                subTable.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                subTable.LogDate = DateTime.Now;

                context.AddToSubTables(subTable);

                PxMetaModel.SubTable_Eng subTableEng = new PxMetaModel.SubTable_Eng();
                subTableEng.SubTable1 = subTable;
                subTableEng.PresText = mainTableEng.PresText;
                subTableEng.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                subTableEng.LogDate = DateTime.Now;

                counter = 0;
                foreach (var variable in _variables)
                {
                    counter++;
                    variable.StoreColumnNo = counter;
                    variable.MainTable = this;
                    variable.Save(context);
                }

                foreach (var footnote in Footnotes)
                {
                    footnote.MainTable = this;

                    footnote.Save(context);
                }

                foreach (var mainTableValueFootnote in MainTableValueFootnotes)
                {
                    mainTableValueFootnote.MainTable = this;
                    mainTableValueFootnote.Save(context);
                }

            }
        }