public override void CreateEntities(PxMetaModel.PcAxisMetabaseEntities context) { PxMetaModel.MenuSelection menuSelection = new PxMetaModel.MenuSelection(); menuSelection.Menu = Parent.Menu; menuSelection.Selection = Menu; menuSelection.PresText = PresText; menuSelection.PresTextS = PresTextS; menuSelection.Presentation = Presentation; menuSelection.LevelNo = LevelNo; menuSelection.Description = Description; menuSelection.SortCode = SortCode; menuSelection.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name; menuSelection.LogDate = DateTime.Now; context.AddToMenuSelections(menuSelection); PxMetaModel.MenuSelection_Eng menuSelectionEng = new PxMetaModel.MenuSelection_Eng(); menuSelectionEng.MenuSelection = menuSelection; menuSelectionEng.PresText = PresTextEnglish; menuSelectionEng.PresTextS = PresTextSEnglish; menuSelectionEng.Presentation = PresentationEnglish; menuSelectionEng.Description = DescriptionEnglish; menuSelectionEng.SortCode = SortCodeEnglish; menuSelectionEng.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name; menuSelectionEng.LogDate = DateTime.Now; context.AddToMenuSelection_Eng(menuSelectionEng); }
public static bool UpdateMenuSelection(PxMenuSelection selection) { try { PxMetaModel.PcAxisMetabaseEntities context = new PxMetaModel.PcAxisMetabaseEntities(); var selectedMenu = from sm in context.MenuSelections where sm.Menu == selection.Parent.Menu && sm.Selection == selection.Menu select sm; PxMetaModel.MenuSelection ms = selectedMenu.First(); ms.PresText = selection.PresText; ms.PresTextS = selection.PresTextS; ms.Presentation = selection.Presentation; ms.Description = selection.Description; ms.SortCode = selection.SortCode; ms.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name; ms.LogDate = DateTime.Now; var selectedMenuEng = from sm in context.MenuSelection_Eng where sm.Menu == selection.Parent.Menu && sm.Selection == selection.Menu select sm; PxMetaModel.MenuSelection_Eng msEng = selectedMenuEng.First(); msEng.PresText = selection.PresTextEnglish; msEng.PresTextS = selection.PresTextSEnglish; msEng.Presentation = selection.PresentationEnglish; msEng.Description = selection.DescriptionEnglish; msEng.SortCode = selection.SortCodeEnglish; msEng.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name; msEng.LogDate = DateTime.Now; context.SaveChanges(); selection.MarkAsOld(); } catch (Exception) { return(false); } return(true); }
public override void CreateEntities(PxMetaModel.PcAxisMetabaseEntities context) { PxMetaModel.MenuSelection menuSelection = new PxMetaModel.MenuSelection(); menuSelection.Menu = Parent.Menu; menuSelection.Selection = Menu; menuSelection.PresText = PresText; menuSelection.PresTextS = PresTextS; menuSelection.Presentation = Presentation; menuSelection.LevelNo = LevelNo; menuSelection.Description = Description; menuSelection.SortCode = SortCode; menuSelection.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name; menuSelection.LogDate = DateTime.Now; context.AddToMenuSelections(menuSelection); PxMetaModel.MenuSelection_Eng menuSelectionEng = new PxMetaModel.MenuSelection_Eng(); menuSelectionEng.MenuSelection = menuSelection; menuSelectionEng.PresText = PresTextEnglish; menuSelectionEng.PresTextS = PresTextSEnglish; menuSelectionEng.Presentation = PresentationEnglish; menuSelectionEng.Description = DescriptionEnglish; menuSelectionEng.SortCode = SortCodeEnglish; menuSelectionEng.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name; menuSelectionEng.LogDate = DateTime.Now; context.AddToMenuSelection_Eng(menuSelectionEng); }