protected override void OnSubmit() { var isNew = _module == null; if (isNew) { _module = new ModulePromo(); _pageModule = new PageModule(); _pageModule.ModuleTypeId = ModuleService.ModuleTypes[ModuleService.MODULE_PROMO]; _pageModule.PageId = _page.Id; _pageModule.Position = _page.PageModules.Count + 1; Position = _pageModule.Position; } _module.Image = Image; _module.Text = Text; _module.ButtonText = ButtonText; _module.ButtonLink = !string.IsNullOrEmpty(ButtonText) ? ButtonLink : string.Empty; _module.ImageRight = ImageRight; _module.TitleTop = TitleTop; _pageModule.Title = Title; _pageModule.BlueTitle = BlueTitle; _pageModule.Theme = Theme; _pageModule.TransparentBackground = TransparentBackground; _pageModule.LootBox = LootBox; _pageModule.LootBoxTop = LootBoxTop; _pageModule.LootBoxLeft = LootBoxLeft; _pageModule.State = State; using (var conn = new NTGDBTransactional()) { _module.Save(conn); _pageModule.ModuleId = _module.Id; _pageModule.Save(conn); NTGLogger.LogSiteAction(HttpContext.Current.Request, SessionVariables.User, (isNew ? "Created" : "Editted") + " Module", _page.Id, _page.Name, _module.Id, ModuleService.MODULE_PROMO, conn); conn.Commit(); Id = _module.Id; PageModuleId = _pageModule.Id; ModuleService.RefreshCacheModule(_pageModule.Id); AddMessage(Message.GLOBAL, new Message("Module saved", MessageTypes.Success)); } }
protected override void OnSubmit() { using (var conn = new NTGDBTransactional()) { var claim = new LootBoxClaim(); claim.Email = Email; claim.FirstName = FirstName; claim.LastName = LastName; claim.Date = DateTime.UtcNow; claim.Save(conn); _pageModule.LootBox = false; _pageModule.Save(conn); conn.Commit(); AddMessage(Message.GLOBAL, new Message("Congratulations!!! You have claimed this loot box!", MessageTypes.Success)); } }
protected override void OnSubmit() { var isNew = _module == null; if (isNew) { _module = new ModuleGallery(); _pageModule = new PageModule(); _pageModule.ModuleTypeId = ModuleService.ModuleTypes[ModuleService.MODULE_GALLERY]; _pageModule.PageId = _page.Id; _pageModule.Position = _page.PageModules.Count + 1; Position = _pageModule.Position; } _pageModule.Title = Title; _pageModule.BlueTitle = BlueTitle; _pageModule.Theme = Theme; _pageModule.TransparentBackground = TransparentBackground; _pageModule.LootBox = LootBox; _pageModule.LootBoxTop = LootBoxTop; _pageModule.LootBoxLeft = LootBoxLeft; _pageModule.State = State; using (var conn = new NTGDBTransactional()) { _module.Save(conn); var subFormSuccess = true; var subForm = new CreateEditModuleGalleryImageSubFormModel(); var positionReduction = 0; foreach (var image in Images.OrderBy(i => i.Position)) { if (image.IsDelete) { positionReduction++; } else if (positionReduction > 0) { image.IsModified = true; image.Position -= positionReduction; } if (image.IsModified || image.IsDelete) { subForm.Id = image.Id; subForm.Image = image.Image; subForm.Position = image.Position; subForm.ModuleGallery = _module; subForm.IsDelete = image.IsDelete; subForm.IsNewModule = Id == 0; subForm.Links = image.ModuleGalleryImageLinks.ToList(); subForm.Submit(conn, Messages); subFormSuccess = subFormSuccess && subForm.Success; image.Id = subForm.Id; image.ModuleGalleryId = subForm.ModuleGallery.Id; image.ModuleGalleryImageLinks = subForm.Links; image.IsModified = false; } } if (subFormSuccess) { _pageModule.ModuleId = _module.Id; _pageModule.Save(conn); NTGLogger.LogSiteAction(HttpContext.Current.Request, SessionVariables.User, (isNew ? "Created" : "Editted") + " Module", _page.Id, _page.Name, _module.Id, ModuleService.MODULE_GALLERY, conn); conn.Commit(); Id = _module.Id; PageModuleId = _pageModule.Id; Images.RemoveAll(c => c.IsDelete); ModuleService.RefreshCacheModule(_pageModule.Id); AddMessage(Message.GLOBAL, new Message("Module saved", MessageTypes.Success)); } } }
protected override void OnSubmit() { var isNew = _module == null; if (isNew) { _module = new ModuleProfileCards(); _pageModule = new PageModule(); _pageModule.ModuleTypeId = ModuleService.ModuleTypes[ModuleService.MODULE_PROFILE_CARDS]; _pageModule.PageId = _page.Id; _pageModule.Position = _page.PageModules.Count + 1; Position = _pageModule.Position; } _pageModule.Title = Title; _pageModule.BlueTitle = BlueTitle; _pageModule.Theme = Theme; _pageModule.TransparentBackground = TransparentBackground; _pageModule.LootBox = LootBox; _pageModule.LootBoxTop = LootBoxTop; _pageModule.LootBoxLeft = LootBoxLeft; _pageModule.State = State; using (var conn = new NTGDBTransactional()) { _module.Save(conn); var subFormSuccess = true; var subForm = new CreateEditModuleProfileCardsCardSubFormModel(); var positionReduction = 0; foreach (var card in Cards.OrderBy(c => c.Position)) { if (card.IsDelete) { positionReduction++; } else if (positionReduction > 0) { card.IsModified = true; card.Position -= positionReduction; } if (card.IsModified || card.IsDelete) { subForm.Id = card.Id; subForm.Name = card.Name; subForm.FacebookUrl = card.FacebookUrl; subForm.TwitterUrl = card.TwitterUrl; subForm.TwitchUrl = card.TwitchUrl; subForm.InstagramUrl = card.InstagramUrl; subForm.YouTubeUrl = card.YouTubeUrl; subForm.Image = card.Image; subForm.Position = card.Position; subForm.ModuleProfileCards = _module; subForm.IsNewModule = Id == 0; subForm.IsDelete = card.IsDelete; subForm.Links = card.ModuleProfileCardsCardLinks.ToList(); subForm.Submit(conn, Messages); subFormSuccess = subFormSuccess && subForm.Success; card.Id = subForm.Id; card.ModuleProfileCardsId = subForm.ModuleProfileCards.Id; card.ModuleProfileCardsCardLinks = subForm.Links; card.IsModified = false; } } if (subFormSuccess) { _pageModule.ModuleId = _module.Id; _pageModule.Save(conn); NTGLogger.LogSiteAction(HttpContext.Current.Request, SessionVariables.User, (isNew ? "Created" : "Editted") + " Module", _page.Id, _page.Name, _module.Id, ModuleService.MODULE_PROFILE_CARDS, conn); conn.Commit(); Id = _module.Id; PageModuleId = _pageModule.Id; Cards.RemoveAll(c => c.IsDelete); ModuleService.RefreshCacheModule(_pageModule.Id); AddMessage(Message.GLOBAL, new Message("Module saved", MessageTypes.Success)); } } }
protected override void OnSubmit() { var isNew = _module == null; if (isNew) { _module = new ModuleBoxes(); _pageModule = new PageModule(); _pageModule.ModuleTypeId = ModuleService.ModuleTypes[ModuleService.MODULE_BOXES]; _pageModule.PageId = _page.Id; _pageModule.Position = _page.PageModules.Count + 1; Position = _pageModule.Position; } _module.Text = Text; _pageModule.Title = Title; _pageModule.BlueTitle = BlueTitle; _pageModule.Theme = Theme; _pageModule.TransparentBackground = TransparentBackground; _pageModule.LootBox = LootBox; _pageModule.LootBoxLeft = LootBoxLeft; _pageModule.LootBoxTop = LootBoxTop; _pageModule.State = State; using (var conn = new NTGDBTransactional()) { _module.Save(conn); var subFormSuccess = true; var subForm = new CreateEditModuleBoxesBoxSubFormModel(); var positionReduction = 0; foreach (var box in Boxes.OrderBy(b => b.Position)) { if (box.IsDelete) { positionReduction++; } else if (positionReduction > 0) { box.IsModified = true; box.Position -= positionReduction; } if (box.IsModified || box.IsDelete) { subForm.Id = box.Id; subForm.Title = box.Title; subForm.Icon = box.Icon; subForm.Color = box.Color; subForm.Text = box.Text; subForm.Url = box.Url; subForm.Position = box.Position; subForm.ModuleBoxes = _module; subForm.IsDelete = box.IsDelete; subForm.IsNewModule = Id == 0; subForm.Submit(conn, Messages); subFormSuccess = subFormSuccess && subForm.Success; box.Id = subForm.Id; box.ModuleBoxesId = subForm.ModuleBoxes.Id; box.IsModified = false; } } if (subFormSuccess) { _pageModule.ModuleId = _module.Id; _pageModule.Save(conn); NTGLogger.LogSiteAction(HttpContext.Current.Request, SessionVariables.User, (isNew ? "Created" : "Editted") + " Module", _page.Id, _page.Name, _module.Id, ModuleService.MODULE_BOXES, conn); conn.Commit(); Id = _module.Id; PageModuleId = _pageModule.Id; Boxes.RemoveAll(b => b.IsDelete); ModuleService.RefreshCacheModule(_pageModule.Id); AddMessage(Message.GLOBAL, new Message("Module saved", MessageTypes.Success)); } } }