public ActionResult SaveItem(Banners model) { string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); int IdDC = Int32.Parse(MyModels.Decode(model.Ids, API.Models.Settings.SecretId + ControllerName).ToString()); BannersModel data = new BannersModel() { Item = model }; if (ModelState.IsValid) { if (model.Id == IdDC) { model.CreatedBy = int.Parse(HttpContext.Request.Headers["Id"]); model.ModifiedBy = int.Parse(HttpContext.Request.Headers["Id"]); BannersService.SaveItem(model); if (model.Id > 0) { TempData["MessageSuccess"] = "Cập nhật thành công"; } else { TempData["MessageSuccess"] = "Thêm mới thành công"; } return(RedirectToAction("Index", new { CatId = model.CatId, IdCoQuan = model.IdCoQuan })); } } else { data.ListItemsCategories = BannersCategoriesService.GetListSelectItems(); data.ListDMCoQuan = DMCoQuanService.GetListByLoaiCoQuan(0, 1); } return(View(data)); }
public ActionResult UpdateStatus([FromQuery] string Ids, Boolean Status) { string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); Banners item = new Banners() { Id = Int32.Parse(MyModels.Decode(Ids, API.Models.Settings.SecretId + ControllerName).ToString()), Status = Status }; try { if (item.Id > 0) { item.CreatedBy = int.Parse(HttpContext.Request.Headers["Id"]); item.ModifiedBy = int.Parse(HttpContext.Request.Headers["Id"]); dynamic UpdateStatus = BannersService.UpdateStatus(item); TempData["MessageSuccess"] = "Cập nhật Trạng Thái thành công"; return(Json(new MsgSuccess())); } else { TempData["MessageError"] = "Cập nhật Trạng Thái Không thành công"; return(Json(new MsgError())); } } catch { TempData["MessageSuccess"] = "Cập nhật Trạng Thái không thành công"; return(Json(new MsgError())); } }
public ActionResult DeleteItem(string Id) { string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); Banners model = new Banners() { Id = Int32.Parse(MyModels.Decode(Id, API.Models.Settings.SecretId + ControllerName).ToString()) }; try { if (model.Id > 0) { model.CreatedBy = int.Parse(HttpContext.Request.Headers["Id"]); model.ModifiedBy = int.Parse(HttpContext.Request.Headers["Id"]); BannersService.DeleteItem(model); TempData["MessageSuccess"] = "Xóa thành công"; return(Json(new MsgSuccess())); } else { TempData["MessageError"] = "Xóa Không thành công"; return(Json(new MsgError())); } } catch { TempData["MessageSuccess"] = "Xóa không thành công"; return(Json(new MsgError())); } }
private void onConfirmAlertBannerCommand(object parameter) { switch (Banners.ActiveAction) { case BannerData.BannerAction.RemoveFolder: { ChromeBookmarks.CurrentWorkingFolder.folders.Remove(ChromeBookmarks.CurrentWorkingFolder.folders.Where(x => x.IsSelected).FirstOrDefault()); ClearSelectedItems(); Banners.HideAlertBanner(); break; } case BannerData.BannerAction.Alert: { Banners.HideAlertBanner(); break; } case BannerData.BannerAction.ClearAllData: { ChromeBookmarks.RootFolder.Name = "Root Folder"; ChromeBookmarks.CurrentWorkingFolderPath = "Root Folder"; ChromeBookmarks.CurrentWorkingFolderContextMenuText = "Rename 'Root Folder'"; ChromeBookmarks.CurrentWorkingFolder = ChromeBookmarks.RootFolder; ChromeBookmarks.RootFolder.folders.Clear(); ChromeBookmarks.RootFolder.URLs.Clear(); Banners.HideAlertBanner(); break; } } }
private async void OnLoadCommand(object parameter) //This method is going to be changed { if (!Banners.LoadingBannerVisible) { ManagedBookmarks ParsedBookmarks = new ManagedBookmarks(); Banners.ShowLoadingBanner("Loading JSON, please wait..."); SerializeCommand.RaiseCanExecuteChanged(); Info.LoadText = "Loading JSON..."; ParsedBookmarks = await ChromeJSONConverter.ParseJSON(Json.Code); Info.LoadText = "Load"; Banners.LoadingBannerText = "JSON Loaded"; LoadTimer.Start(); if (ParsedBookmarks.RootFolder.Name != "") { ChromeBookmarks.RootFolder = ParsedBookmarks.RootFolder; ChromeBookmarks.CurrentWorkingFolder = ParsedBookmarks.RootFolder; ChromeBookmarks.CurrentWorkingFolderContextMenuText = $"Rename '{ParsedBookmarks.RootFolder.Name}'"; ChromeBookmarks.CurrentWorkingFolderPath = ParsedBookmarks.RootFolder.Name; } } else { Info.LoadText = "Please Wait..."; } }
public Banners Buscar(int id) { try { Banners banner = null; DBSession session = new DBSession(); Query quey = session.CreateQuery("SELECT * FROM banners WHERE idbanner = @id"); quey.SetParameter("id", id); IDataReader reader = quey.ExecuteQuery(); if (reader.Read()) { banner = new Banners(Convert.ToInt32(reader["idbanner"]), Convert.ToInt32(reader["idsite"]), Convert.ToString(reader["txfoto"]), Convert.ToString(reader["txlink"]), Convert.ToInt32(reader["nrordem"]), Convert.ToInt32(reader["flativo"]), Convert.ToDateTime(reader["dtinicio"]), Convert.ToDateTime(reader["dtfim"])); } reader.Close(); session.Close(); return(banner); } catch (Exception error) { throw error; } }
public ActionResult EditBanner(BannerModel model, int id = -1) { BannerInfo bannerInfo = Banners.AdminGetBannerById(id); if (bannerInfo == null) { return(PromptView("Banner不存在")); } if (ModelState.IsValid) { bannerInfo.BanPosId = model.BanPosId; bannerInfo.StartTime = model.StartTime; bannerInfo.EndTime = model.EndTime; bannerInfo.IsShow = model.IsShow; bannerInfo.Title = model.BannerTitle == null ? "" : model.BannerTitle; bannerInfo.Img = model.Img; bannerInfo.Url = model.Url; bannerInfo.DisplayOrder = model.DisplayOrder; Banners.UpdateBanner(model.BanPosId, bannerInfo); AddAdminOperateLog("修改banner", "修改banner,bannerID为:" + id); return(PromptView("banner修改成功")); } Load(); return(View(model)); }
public ActionResult Create() { Banners model = new Banners(); model.Active = true; return(View(model)); }
private void OnRenameSelectedFolderCommand(object parameter) { if (parameter is Folder folderToRename) { Banners.ShowFolderBanner($"Enter a new name for '{folderToRename.Name}'", "Rename", BannerData.BannerAction.RenameFolder); } }
/// <summary> /// 广告列表 /// </summary> public ActionResult BannerList(int banPosId = 0, int pageSize = 15, int pageNumber = 1) { PageModel pageModel = new PageModel(pageSize, pageNumber, Banners.AdminGetBannerCount(banPosId)); BannerListModel model = new BannerListModel() { PageModel = pageModel, BanPosId = banPosId, BannerList = Banners.AdminGetBannerList(pageModel.PageSize, pageModel.PageNumber, banPosId) }; List <SelectListItem> itemList = new List <SelectListItem>(); itemList.Add(new SelectListItem() { Text = "全部Banner位置", Value = "0" }); foreach (BannerPositionInfo bannerPositionInfo in Banners.GetAllBannerPosition()) { itemList.Add(new SelectListItem() { Text = bannerPositionInfo.Title, Value = bannerPositionInfo.BanPosId.ToString() }); } ViewData["bannerPositionList"] = itemList; SiteUtils.SetAdminRefererCookie(Url.Action("bannerlist")); return(View(model)); }
public ActionResult AddBanner(BannerModel model) { if (Banners.GetBannerPositionById(model.BanPosId) == null) { ModelState.AddModelError("BanPosId", "Banner位置不存在"); } if (ModelState.IsValid) { BannerInfo bannerInfo = new BannerInfo() { BanPosId = model.BanPosId, StartTime = model.StartTime, EndTime = model.EndTime, IsShow = model.IsShow, Title = model.BannerTitle == null ? "" : model.BannerTitle, Img = model.Img, Url = model.Url, DisplayOrder = model.DisplayOrder }; Banners.CreateBanner(bannerInfo); AddAdminOperateLog("添加banner", "添加banner,banner为:" + model.BannerTitle); return(PromptView("banner添加成功")); } Load(); return(View(model)); }
public static IServiceCollection AddWhalePublicConfig(this IServiceCollection services, ServiceConfig config) { if (config.Password.IsDefault) { throw new ArgumentException("Cannot set a default password."); } var docsEnabled = (config.Documents?.Count ?? 0) > 0; var uiConfig = new PublicConfig() { Themes = config.Themes, LoginBanner = Banners.ReadBanner(config.LoginBanner), DocScanner = docsEnabled, SearchLists = docsEnabled ? config.Documents?.Select(l => l.Split(';')?.Select(f => f.Trim()).Where(f => !string.IsNullOrWhiteSpace(f))) : Array.Empty <string[]>(), SecScanner = config.Vulnerabilities, AutoLogin = config.AutoLogin, Registry = string.IsNullOrEmpty(config.Registry) ? new() { PlaceholderText = "registry" } : new() { PlaceholderText = config.Registry, IsDefault = true, IsReadonly = true }, UserName = config.UserName, Password = config.Password }; services.AddSingleton(uiConfig); return(services); }
public int CreateBanner(Banners banners) { Banners ObjBanner = new Banners(); var BannerId = ObjBanner.BannerId; return(BannerId); }
public ActionResult DeleteConfirmed(int id) { Banners banners = bannersHandler.GetById(id); bannersHandler.Delete(id); return(RedirectToAction("Index")); }
public JsonResult Get(int pageIndex, int pageSize, string pageOrder) { var list = Banners.Get(pageIndex, pageSize, pageOrder); int total = Banners.Count(); int totalPage = (int)Math.Ceiling((decimal)total / pageSize); if (pageSize > total) { pageSize = total; } if (list.Count < pageSize) { pageSize = list.Count; } JsonResult result = new JsonResult() { Data = new { TotalPages = totalPage, PageIndex = pageIndex, PageSize = pageSize, Rows = list }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return(result); }
private void Tile_Click(object sender, RoutedEventArgs e) { if (Window == null) { Window = new CommandsGeneratorTemplate(this); Window.win = (Application.Current.MainWindow as IMainWindowCommands).AddWindow(Icon, Window, "命令生成器", this); Window.win.WindowClosed += Win_WindowClosed; } object content = null; string title = (sender as Tile).Title; switch (title) { case "基础命令": content = new BasicCommands(Window); break; case "服务器命令": content = new ServerCommands(Window); break; case "实体命令": content = new EntityCommands(Window); break; case "玩家命令": content = new PlayerCommands(Window); break; case "Json书": content = new Book(Window); break; case "告示牌": content = new Sign(Window); break; case "消息文本": content = new Tellraw(Window); break; case "显示标题": content = new Title(Window); break; case "记分板目标": content = new ScoreboardObjective(Window); break; case "记分板玩家": content = new ScoreboardPlayers(Window); break; case "记分板队伍": content = new ScoreboardTeam(Window); break; case "物品NBT": content = new ItemNBT(Window); break; case "实体NBT": content = new EntityNBT(Window); break; case "物品与生成": content = new GetElement(); break; case "检测与执行": content = new ExecuteAndDetect(); break; case "方块NBT/放置填充方块": content = new SetBlocks(Window); break; case "村民交易": content = new VillagerTrade(Window); break; case "刷怪笼": content = new MobSpawner(Window); break; case "烟花": content = new Firework(Window); break; case "旗帜/盾牌": content = new Banners(Window); break; case "药水/药水箭": content = new Potion(Window); break; case "盔甲架": content = new ArmorStand(Window); break; } Window.AddPage(title, content); }
public Militia(MobileParty mobileParty) { MobileParty = mobileParty; Banner = Banners.GetRandomElement(); BannerKey = Banner.Serialize(); Hero = mobileParty.LeaderHero; LogMilitiaFormed(MobileParty); }
private void onRenameParentFolderCommand(object parameter) { if (parameter is Folder folderToRename) { ClearSelectedItems(); Banners.ShowFolderBanner($"Enter a new name for '{folderToRename.Name}'", "Rename", BannerData.BannerAction.RenameFolder); } }
public Militia(MobileParty mobileParty, TroopRoster party, TroopRoster prisoners) { Banner = Banners.GetRandomElement(); BannerKey = Banner.Serialize(); Spawn(mobileParty, party, prisoners); TrainMilitia(); PartyMilitiaMap.Add(MobileParty, this); LogMilitiaFormed(MobileParty); }
public async Task <IActionResult> Update(Banners model) { var apiMsg = await ApiMessage.Wrap(async() => { await bannersBusienss.Update(model); }); return(Json(apiMsg)); }
/// <summary> /// Banner位置列表 /// </summary> /// <returns></returns> public ActionResult BannerPositionList() { BannerPositionListModel model = new BannerPositionListModel { BannerPositionList = Banners.GetAllBannerPosition() }; SiteUtils.SetAdminRefererCookie(Url.Action("bannerpositionlist")); return(View(model)); }
// // GET: /Banner/Delete/5 public ActionResult Delete(int id = 0) { Banners banners = db.Banners.Find(id); if (banners == null) { return(HttpNotFound()); } return(View(banners)); }
public void Update(Banners banner) { using (UspaIdentityDb db = new UspaIdentityDb()) { if (banner != null) { db.Entry(banner).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } } }
public void Add(Banners banner) { using (UspaIdentityDb db = new UspaIdentityDb()) { if (banner != null) { db.Banners.Add(banner); db.SaveChanges(); } } }
public async Task <IActionResult> AddOrUpdate(Banners banner) { var apiMsg = await ApiMessage.Wrap(async() => { ViewData["DataType"] = typeof(Banners); await bannersBusienss.AddOrUpdate(banner); }); return(Json(apiMsg)); //return RedirectToAction("Index"); }
private void onRemoveSelectedCommand(object parameter) { if (ChromeBookmarks.CurrentWorkingFolder.folders.Where(x => x.IsSelected).Count() > 0) { Folder SelectedFolder = ChromeBookmarks.CurrentWorkingFolder.folders.Where(x => x.IsSelected).FirstOrDefault(); string AlertMessage = ""; if (SelectedFolder.folders.Count > 0 || SelectedFolder.URLs.Count > 0) { AlertMessage += $"Folder '{SelectedFolder.Name}' Contains "; if (SelectedFolder.folders.Count() > 0) { if (SelectedFolder.folders.Count > 1) { AlertMessage += $"{SelectedFolder.folders.Count()} folders"; } else { AlertMessage += $"{SelectedFolder.folders.Count()} folder"; } if (SelectedFolder.URLs.Count() > 0) { AlertMessage += " and "; } } if (SelectedFolder.URLs.Count() > 0) { if (SelectedFolder.URLs.Count() > 1) { AlertMessage += $"{SelectedFolder.URLs.Count()} URLs"; } else { AlertMessage += $"{SelectedFolder.URLs.Count()} URL"; } } Banners.ShowAlertBanner(AlertMessage, "Remove", BannerData.BannerAction.RemoveFolder); } else { ChromeBookmarks.CurrentWorkingFolder.folders.Remove(ChromeBookmarks.CurrentWorkingFolder.folders.Where(x => x.IsSelected).FirstOrDefault()); } } if (ChromeBookmarks.CurrentWorkingFolder.URLs.Where(x => x.IsSelected).Count() > 0) { ChromeBookmarks.CurrentWorkingFolder.URLs.Remove(ChromeBookmarks.CurrentWorkingFolder.URLs.Where(x => x.IsSelected).FirstOrDefault()); } RemoveSelectedCommand.RaiseCanExecuteChanged(); }
public BannersSystem() { if(GetBannerFromWeb() && !string.IsNullOrEmpty(bannerFile)){ //Console.WriteLine(bannerFile); banners = Banners.LoadBanners(bannerFile); } else { banners = Banners.OpenBannerCache(); } if(!banners.IsCache){ banners.SaveBannerCache(); } }
public static List <Banners> ListarBanners(int pintIdGrupo, int pintIdIdioma = 0) { string strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString; SqlConnection objConexao = new SqlConnection(strConectionString); SqlCommand objComando = new SqlCommand("SPE_L_BANNERS"); objComando.Connection = objConexao; objComando.CommandType = CommandType.StoredProcedure; //Define parametros da procedure objComando.Parameters.Add("@grupoId", SqlDbType.Int).Value = pintIdGrupo; if (pintIdIdioma > 0) { objComando.Parameters.Add("@idiomaId", SqlDbType.Int).Value = pintIdIdioma; } try { //Abre Conexao objConexao.Open(); //Declara variavel de retorno List <Banners> objList = new List <Banners>(); Banners obj = default(Banners); IDataReader idrReader = default(IDataReader); idrReader = objComando.ExecuteReader(); while ((idrReader.Read())) { obj = new Banners(); obj.FromIDataReader(idrReader); objList.Add(obj); } return(objList); } catch (Exception ex) { throw ex; } finally { //Fecha a conexao se aberta if (objConexao.State != ConnectionState.Closed) { objConexao.Close(); } } }
public override void Execute() { var responseList = Banners.GetAll().Where(b => b.file_id > 0).Select(b => new BannerVM { image = $"url({ServiceUrlPrefixes.CouldFront + Storages.GetByFileId((uint)b.file_id).storage_path})", feed_banner_url = $"{ServiceUrlPrefixes.CouldFront + Storages.GetByFileId((uint)b.file_id).storage_path}", background_color = b.background_color, color = b.color, highlighted = b.highlighted }).ToList(); Response = JsonConvert.SerializeObject(responseList); }
public void Delete(long?id) { using (UspaIdentityDb db = new UspaIdentityDb()) { Banners deleteBanner = db.Banners.FirstOrDefault(ug => ug.id == id); if (deleteBanner != null) { db.Entry(deleteBanner).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } }
// // GET: /Banner/Details/5 public ActionResult Details(int id = 0) { Banners banners = db.Banners.Include("AreaBanner").FirstOrDefault(a => a.Id == id); ViewBag.Tamanho = banners.AreaBanner.FirstOrDefault().Tamanho; ViewBag.Tamanho2 = banners.AreaBanner.FirstOrDefault().Tamanho2; if (banners == null) { return(HttpNotFound()); } return(View(banners)); }