public static int Add(FlashInfo entity) { entity.Id = dal.Add(entity); UploadBLL.UpdateUpload(TableID, 0, entity.Id, Cookies.Admin.GetRandomNumber(false)); CacheHelper.Remove(cacheKey); return(entity.Id); }
protected void SubmitButton_Click(object sender, EventArgs e) { FlashInfo flash = new FlashInfo(); flash.ID = RequestHelper.GetQueryString <int>("ID"); flash.Title = this.Title.Text; flash.Introduce = this.Introduce.Text; flash.Width = Convert.ToInt32(this.Width.Text); flash.Height = Convert.ToInt32(this.Height.Text); string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (flash.ID == -2147483648) { base.CheckAdminPower("AddFlash", PowerCheckType.Single); int id = FlashBLL.AddFlash(flash); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Flash"), id); } else { base.CheckAdminPower("UpdateFlash", PowerCheckType.Single); FlashBLL.UpdateFlash(flash); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Flash"), flash.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { FlashInfo flash = new FlashInfo(); flash.Id = RequestHelper.GetQueryString <int>("ID"); flash.Title = Title.Text; flash.Introduce = Introduce.Text; flash.Width = Convert.ToInt32(Width.Text) < 0 ?0 : Convert.ToInt32(Width.Text); flash.Height = Convert.ToInt32(Height.Text) < 0 ? 0 : Convert.ToInt32(Height.Text); flash.EndDate = DateTime.Now.AddYears(1); string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (flash.Id == int.MinValue) { CheckAdminPower("AddFlash", PowerCheckType.Single); int id = FlashBLL.Add(flash); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Flash"), id); } else { CheckAdminPower("UpdateFlash", PowerCheckType.Single); FlashBLL.Update(flash); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Flash"), flash.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } CheckAdminPower("ReadAdImage", PowerCheckType.Single); string action = RequestHelper.GetQueryString <string>("Action"); if (action == "Delete") { CheckAdminPower("DeleteAdImage", PowerCheckType.Single); int id = RequestHelper.GetQueryString <int>("Id"); if (id > 0) { AdImageBLL.Delete(id); AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("FlashPhoto"), id); } } classId = RequestHelper.GetQueryString <int>("class_id"); adType = RequestHelper.GetQueryString <int>("fp_type"); if (adType > 0) { theFlash = FlashBLL.Read(adType); } var images = AdImageBLL.ReadList(adType); BindControl(images, RecordList); }
public static void FlashWindow(Window window, uint flags, uint count, uint timeout) { var helper = new WindowInteropHelper(window); var info = new FlashInfo(helper.Handle, flags, count, timeout); FlashWindowEx(ref info); }
public void Update(FlashInfo entity) { using (var conn = new SqlConnection(connectString)) { string sql = @"UPDATE [Flash] SET Title = @Title,[Introduce]=@Introduce,[Width]=@Width,[Height]=@Height,[EndDate]=@EndDate,[AddCol1]=@AddCol1,[AddCol2]=@AddCol2,[AddCol3]=@AddCol3 where Id=@Id"; conn.Execute(sql, entity); } }
public int Add(FlashInfo entity) { using (var conn = new SqlConnection(connectString)) { string sql = @"INSERT INTO [Flash]([Title],[Introduce],[Width],[Height],[EndDate],[AddCol1],[AddCol2],[AddCol3]) VALUES(@Title,@Introduce,@Width,@Height,@EndDate,@AddCol1,@AddCol2,@AddCol3); select SCOPE_IDENTITY()"; return(conn.Query <int>(sql, entity).Single()); } }
public void UpdateFlash(FlashInfo flash) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@title", SqlDbType.NVarChar), new SqlParameter("@introduce", SqlDbType.NText), new SqlParameter("@width", SqlDbType.Int), new SqlParameter("@height", SqlDbType.Int) }; pt[0].Value = flash.ID; pt[1].Value = flash.Title; pt[2].Value = flash.Introduce; pt[3].Value = flash.Width; pt[4].Value = flash.Height; ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateFlash", pt); }
public int AddFlash(FlashInfo flash) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@title", SqlDbType.NVarChar), new SqlParameter("@introduce", SqlDbType.NText), new SqlParameter("@width", SqlDbType.Int), new SqlParameter("@height", SqlDbType.Int), new SqlParameter("@photoCount", SqlDbType.Int) }; pt[0].Value = flash.Title; pt[1].Value = flash.Introduce; pt[2].Value = flash.Width; pt[3].Value = flash.Height; pt[4].Value = flash.PhotoCount; return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddFlash", pt))); }
public void PrepareFlashModel(SqlDataReader dr, List <FlashInfo> flashList) { while (dr.Read()) { FlashInfo item = new FlashInfo(); item.ID = dr.GetInt32(0); item.Title = dr[1].ToString(); item.Introduce = dr[2].ToString(); item.Width = dr.GetInt32(3); item.Height = dr.GetInt32(4); item.PhotoCount = dr.GetInt32(5); flashList.Add(item); } }
/// <summary> Подсветить окно на панели задач пока окно не получит фокус </summary> public static void Flash(System.Windows.Window window) { var flashInfo = new FlashInfo { Hwnd = new WindowInteropHelper(window).Handle, Flags = 15, Count = uint.MaxValue, Timeout = 0 }; flashInfo.Size = Convert.ToUInt32(Marshal.SizeOf(flashInfo)); FlashWindowEx(ref flashInfo); }
public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, int count, TimeSpan timeout) { HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle"); var flashInfo = new FlashInfo { Size = Marshal.SizeOf(typeof(FlashInfo)), Hwnd = windowHandle, Flags = flags, Count = count, Timeout = Convert.ToInt32(timeout.TotalMilliseconds) }; User32.FlashWindowEx(ref flashInfo); }
public static void StopFlashingWindow(this Window win) { win.Dispatcher.Invoke(() => { var h = new WindowInteropHelper(win); var info = new FlashInfo { hwnd = h.Handle }; info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info)); info.dwFlags = FlashwStop; info.uCount = uint.MaxValue; info.dwTimeout = 0; FlashWindowEx(ref info); }); }
public static void RebuildFile(int flashID) { StringBuilder builder = new StringBuilder(); FlashInfo info = ReadFlash(flashID); if (info.ID > 0) { string str = info.Width.ToString(); string str2 = info.Height.ToString(); string flashFile = ShopCommon.GetFlashFile(flashID.ToString()); string title = string.Empty; string uRL = string.Empty; string fileName = string.Empty; bool flag = true; builder.Append("var swf_width=" + str + ";\r\n"); builder.Append("var swf_height=" + str2 + ";\r\n"); List <FlashPhotoInfo> list = FlashPhotoBLL.ReadFlashPhotoByFlash(flashID); foreach (FlashPhotoInfo info2 in list) { if (flag) { flag = false; title = info2.Title; uRL = info2.URL; fileName = info2.FileName; } else { title = title + "|" + info2.Title; uRL = uRL + "|" + info2.URL; fileName = fileName + "|" + info2.FileName; } } builder.Append("var files='" + fileName + "';\r\n"); builder.Append("var links='" + uRL + "';\r\n"); builder.Append("var texts='" + title.Replace("'", "'").Replace("\"", "\\\"") + "';\r\n"); builder.Append("document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\">');\r\n"); builder.Append("document.write('<param name=\"movie\" value=\"/Upload/FlashPhotoUpload/picturePlayer.swf\"><param name=\"quality\" value=\"high\">');\r\n"); builder.Append("document.write('<param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"opaque\">');\r\n"); builder.Append("document.write('<param name=\"FlashVars\" value=\"bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'\">');\r\n"); builder.Append("document.write('<embed src=\"/Upload/FlashPhotoUpload/picturePlayer.swf\" wmode=\"opaque\" FlashVars=\"bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+' menu=\"false\" quality=\"high\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');\r\n"); builder.Append("document.write('</object>'); \r\n"); using (StreamWriter writer = new StreamWriter(ServerHelper.MapPath(flashFile), false, Encoding.UTF8)) { writer.Write(builder.ToString()); } } }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int flashID = RequestHelper.GetQueryString <int>("ID"); if (flashID != int.MinValue) { CheckAdminPower("ReadFlash", PowerCheckType.Single); FlashInfo flash = FlashBLL.Read(flashID); Title.Text = flash.Title; Introduce.Text = flash.Introduce; Width.Text = flash.Width.ToString(); Height.Text = flash.Height.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { int queryString = RequestHelper.GetQueryString <int>("ID"); if (queryString != -2147483648) { base.CheckAdminPower("ReadFlash", PowerCheckType.Single); FlashInfo info = FlashBLL.ReadFlash(queryString); this.Title.Text = info.Title; this.Introduce.Text = info.Introduce; this.Width.Text = info.Width.ToString(); this.Height.Text = info.Height.ToString(); } } }
/// <summary> /// Flashes the specified window. It does not change the active state of the window. /// </summary> /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param> /// <param name="flags">The flash status.</param> /// <param name="count">The number of times to flash the window.</param> /// <param name="timeout">The rate at which the window is to be flashed.</param> public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, int count, TimeSpan timeout) { // Check if the handle is valid HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle"); // Create the data structure var flashInfo = new FlashInfo { Size = Marshal.SizeOf(typeof(FlashInfo)), Hwnd = windowHandle, Flags = flags, Count = count, Timeout = Convert.ToInt32(timeout.TotalMilliseconds) }; // Flash the window User32.FlashWindowEx(ref flashInfo); }
public FlashInfo ReadFlash(int id) { SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar) }; pt[0].Value = id; FlashInfo info = new FlashInfo(); using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadFlash", pt)) { if (reader.Read()) { info.ID = reader.GetInt32(0); info.Title = reader[1].ToString(); info.Introduce = reader[2].ToString(); info.Width = reader.GetInt32(3); info.Height = reader.GetInt32(4); info.PhotoCount = reader.GetInt32(5); } } return(info); }
public static void FlashWindow(this Window win, uint count = uint.MaxValue) { win.Dispatcher.Invoke(() => { if (win.IsActive) { return; } var h = new WindowInteropHelper(win); var info = new FlashInfo { hwnd = h.Handle, dwFlags = FlashwAll | FlashwTimer, uCount = count, dwTimeout = 0 }; info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info)); FlashWindowEx(ref info); }); }
public static void Update(FlashInfo entity) { CacheHelper.Remove(cacheKey); dal.Update(entity); }
public static extern bool FlashWindowEx(ref FlashInfo pwfi);
public static void UpdateFlash(FlashInfo flash) { dal.UpdateFlash(flash); RebuildFile(flash.ID); }
public static int AddFlash(FlashInfo flash) { flash.ID = dal.AddFlash(flash); RebuildFile(flash.ID); return(flash.ID); }
public static extern bool FlashWindowEx(ref FlashInfo pwfi);
internal static extern bool FlashWindowEx(ref FlashInfo info);
void cmdFB(BasePlayer player, string cmd, string[] args) { if (args.Length == 0) { player.SendConsoleCommand("chat.say \"/fb help\" "); return; } ulong steamId = player.userID; switch (args[0]) { case "add": if (!permission.UserHasPermission(steamId.ToString(), "flashbang.admin")) { SendReply(player, "You do not have permission to use this command!"); return; } if (args.Length != 4) { SendReply(player, "/fb add <Duration> <Radius> <Power>"); return; } int fnum; int dur = Convert.ToInt32(args[1]); int rad = Convert.ToInt32(args[2]); string pow = Convert.ToString(args[3]); if (data.FlashInfo == null) { fnum = 1; } else { fnum = GetNewId(); } var info = new FlashInfo(fnum, dur, pow, rad); data.FlashInfo.Add(info); SendReply(player, "You have added a new FlashBang setting!"); Interface.GetMod().DataFileSystem.WriteObject("FlashBang_Settings", data); break; case "help": if (!permission.UserHasPermission(steamId.ToString(), "flashbang.admin")) { SendReply(player, "You do not have permission to use this command!"); return; } SendReply(player, "/fb add <Duration> <Radius> <Power>"); SendReply(player, "/fb remove <ID> "); SendReply(player, "/fb list"); break; case "remove": if (!permission.UserHasPermission(steamId.ToString(), "flashbang.admin")) { SendReply(player, "You do not have permission to use this command!"); return; } if (args.Length != 2) { SendReply(player, "/fb remove <ID> || /fb list"); return; } foreach (FlashInfo infos in data.FlashInfo) { if (infos.ID.ToString() == args[1].ToString()) { data.FlashInfo.Remove(infos); SendReply(player, "You have removed the flashbang setting ID: " + infos.ID.ToString()); Interface.GetMod().DataFileSystem.WriteObject("FlashBang_Settings", data); break; } } break; case "list": if (!permission.UserHasPermission(steamId.ToString(), "flashbang.admin")) { SendReply(player, "You do not have permission to use this command!"); return; } SendReply(player, "<color=#91FFB5>Current Flashbang Settings</color>"); foreach (FlashInfo infom in data.FlashInfo) { SendReply(player, "ID: <color=#91FFB5>{2}</color>\nDuration: <color=cyan>{0}</color> \nPower:<color=orange> {1} </color> \nRadius: <color=lime>{3}</color>", infom.Duration, infom.Power, infom.ID, infom.Radius); SendReply(player, "<color=#91FFB5>*************</color>"); } SendReply(player, "<color=#91FFB5>*************</color>"); break; } }
/// <summary> /// Flashes the specified window. It does not change the active state of the window. /// </summary> /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param> /// <param name="flags">The flash status.</param> /// <param name="count">The number of times to flash the window.</param> /// <param name="timeout">The rate at which the window is to be flashed.</param> public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, uint count, TimeSpan timeout) { // Check if the handle is valid HandleManipulationHelper.ValidateAsArgument(windowHandle, "windowHandle"); // Create the data structure var flashInfo = new FlashInfo { Size = Marshal.SizeOf(typeof (FlashInfo)), Hwnd = windowHandle, Flags = flags, Count = count, Timeout = Convert.ToInt32(timeout.TotalMilliseconds) }; // Flash the window NativeMethods.FlashWindowEx(ref flashInfo); }
private static extern bool FlashWindowEx(ref FlashInfo flashInfo);