static void bst_GetAllBooksCompleted(object sender, WS.GetAllBooksCompletedEventArgs e) { foreach (var book in e.Result) { Console.WriteLine("{0}\t{1}",book.BookName,book.BookPrice); }; }
public bool Logout(string pSession) { try { WS ws = new WS(); return ws.Logout(pSession); } catch (Exception ex) { hzyMessage.ErrorMessage = ex.Message; HZY.COM.Common.Log.WirteLogWS(ex, ""); return false; } }
public string Login(string pAppName, string pCompany, string pEnv, string pLoginEnv, string pUserName, string pPassword) { hzyMessage = new HZYmessage(); try { WS ws = new WS(); return ws.Login(pEnv, pLoginEnv, pUserName, pPassword); } catch (Exception ex) { hzyMessage.ErrorMessage = ex.Message; HZY.COM.Common.Log.WirteLogWS(ex,""); return ""; } }
public MessageWindow(CS classStyle, WS style, WS_EX exStyle, Rect location, string name, WndProc callback) { // A null callback means just use DefWindowProc. _wndProcCallback = callback; _className = "MessageWindowClass+" + Guid.NewGuid().ToString(); var wc = new WNDCLASSEX { cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), style = classStyle, lpfnWndProc = s_WndProc, hInstance = NativeMethods.GetModuleHandle(null), hbrBackground = NativeMethods.GetStockObject(StockObject.NULL_BRUSH), lpszMenuName = "", lpszClassName = _className, }; NativeMethods.RegisterClassEx(ref wc); GCHandle gcHandle = default(GCHandle); try { gcHandle = GCHandle.Alloc(this); IntPtr pinnedThisPtr = (IntPtr)gcHandle; Handle = NativeMethods.CreateWindowEx( exStyle, _className, name, style, (int)location.X, (int)location.Y, (int)location.Width, (int)location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pinnedThisPtr); } finally { gcHandle.Free(); } _dispatcher = Dispatcher.CurrentDispatcher; }
public void LookupAllExplicit() { var x = new WS(); var y = new DbW(); var z = new DbR(); var w = new UI(); var needs = new Needs(); needs.Set<IWebService>(x); needs.Set<IDatabaseCommand>(y); needs.Set<IDatabaseQuery>(z); needs.Set<IUserInterface>(w); Expect.Some(z, needs.Get<IDatabaseQuery>()); Expect.Some(y, needs.Get<IDatabaseCommand>()); Expect.Some(w, needs.Get<IUserInterface>()); Expect.Some(x, needs.Get<IWebService>()); }
private void Check() { string strSession_ID, strMenuID; string strReturn = ""; strSession_ID = Request["SessionID"]; strMenuID = Request["MenuID"]; if (strSession_ID == null || strSession_ID == "") { strReturn = "缺少参数:SessionID"; } else if (strMenuID == null || strMenuID == "") { strReturn = "缺少参数:MenuID"; } else { System.Threading.Thread.Sleep(5000); WS ws = new WS(); strReturn = ws.CheckUser_Authorization(strSession_ID, strMenuID, "", ""); } if (Request["jsoncallback"] != null) { Response.Write(Request["jsoncallback"]); } //Response.Write("({\"msg\":\""+strReturn+"\"})"); Response.Write("var msg={msg:\"" + strReturn + "\"};"); //Response.Write(strReturn); //Response.Write("var ojb = {msg:'js跨域请求成功'};"); Response.End(); }
public static extern bool AdjustWindowRectEx(ref RECT lpRect, WS style, bool bMenu, WS_EX exStyle);
public static IntPtr CreateWindowEx(WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam) { IntPtr intPtr = Standard.NativeMethods._CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); if (IntPtr.Zero == intPtr) { HRESULT.ThrowLastError(); } return(intPtr); }
public static extern HWND CreateWindowEx(WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
protected void Page_Load(object sender, EventArgs e) { string action = WS.RequestString("a"); switch (action) { case "getrules": GetRules(); break; case "getlistmovies": GetListMovie(WS.RequestString("rulename"), WS.RequestString("listurl")); break; case "getmovieinfo": string rulename = WS.RequestString("rulename"); string url = WS.RequestString("url"); string cls = WS.RequestString("cls"); string title = WS.RequestString("title"); string director = WS.RequestString("director"); string actors = WS.RequestString("actors"); string tags = WS.RequestString("tags"); string location = WS.RequestString("location"); string publicyear = WS.RequestString("publicyear"); string intro = WS.RequestString("intro"); string image = WS.RequestString("image"); GetMovieInfo(rulename, url, cls, title, director, actors, tags, location, publicyear, intro, image); break; case "getbaidudrama": rulename = WS.RequestString("rulename"); url = WS.RequestString("url"); title = WS.RequestString("title"); int movieid = WS.RequestInt("movieid"); string movietitle = WS.RequestString("movietitle"); GetBaiduDrama(rulename, url, title, movieid, movietitle); break; case "getkuaibodrama": rulename = WS.RequestString("rulename"); url = WS.RequestString("url"); title = WS.RequestString("title"); movieid = WS.RequestInt("movieid"); movietitle = WS.RequestString("movietitle"); GetKuaiboDrama(rulename, url, title, movieid, movietitle); break; case "getbaidusourceurl": rulename = WS.RequestString("rulename"); url = WS.RequestString("url"); title = WS.RequestString("title"); movieid = WS.RequestInt("movieid"); movietitle = WS.RequestString("movietitle"); GetBaiduSourceUrl(rulename, url, title, movieid, movietitle); break; case "getkuaibosourceurl": rulename = WS.RequestString("rulename"); url = WS.RequestString("url"); title = WS.RequestString("title"); movieid = WS.RequestInt("movieid"); movietitle = WS.RequestString("movietitle"); GetKuaiboSourceUrl(rulename, url, title, movieid, movietitle); break; case "createcontentpage": int id = WS.RequestInt("id"); //CreateContentPage(id); break; case "createlistpage": id = WS.RequestInt("id"); //CreateListPage(id); break; case "createindexpage": //CreateIndexPage(); break; } }
/// <summary> /// 加载列表 /// </summary> protected void LoadInfo() { pager.PageSize = SystemSetting.MagageListSize; ddl_Class.DataSource = NewsAction.NewsClass.Where(pa => pa.IsLeafClass == true && pa.ModelID == 3).ToList(); ddl_Class.DataTextField = "ClassName"; ddl_Class.DataValueField = "ID"; ddl_Class.DataBind(); ddl_Class.Items.Add(new ListItem("--所有栏目--", "")); ddl_Class.SelectedValue = ""; ddl_Zt.DataSource = NewsAction.NewsZt; ddl_Zt.DataTextField = "ZtName"; ddl_Zt.DataValueField = "ID"; ddl_Zt.DataBind(); ddl_Zt.Items.Add(new ListItem("--所有专题--", "")); ddl_Zt.SelectedValue = ""; ddl_Class_search.DataSource = NewsAction.NewsClass.Where(pa => pa.IsLeafClass == true && pa.ModelID == 3).ToList(); ddl_Class_search.DataTextField = "ClassName"; ddl_Class_search.DataValueField = "ID"; ddl_Class_search.DataBind(); ddl_Class_search.Items.Add(new ListItem("--新增请选择栏目--", "")); ddl_Class_search.SelectedValue = ""; if (WS.RequestInt("class") > 0) { ddl_Class_search.SelectedValue = WS.RequestString("class"); } DataEntities ent = new DataEntities(); var q = from l in ent.Question select l; if (txt_Key.Text.Trim().Length > 0 && txt_Column.SelectedValue != "") { string k = txt_Key.Text.Trim(); q = q.Where(p => p.Title.Contains(k) || p.Content.Contains(k)); } if (ddl_Class.SelectedValue != "") { int clsid = ddl_Class.SelectedValue.ToInt32(); q = q.Where(p => p.ClassID == clsid); } if (cls > 0) { q = q.Where(p => p.ClassID == cls); ddl_Class_search.Enabled = false; } if (ddl_Class_search.SelectedValue != "") { int clsid = ddl_Class_search.SelectedValue.ToInt32(); q = q.Where(p => p.ClassID == clsid); } if (zt > 0) { q = q.Where(p => p.ZtID == zt); } rp_list.DataSource = q.Skip(pager.CurrentPageIndex - 1).Take(pager.PageSize); pager.RecordCount = q.Count(); rp_list.DataBind(); ent.Dispose(); }
public static RECT AdjustWindowRectEx(RECT lpRect, WS dwStyle, bool bMenu, WS_EX dwExStyle) { // Native version modifies the parameter in place. if (!_AdjustWindowRectEx(ref lpRect, dwStyle, bMenu, dwExStyle)) { HRESULT.ThrowLastError(); } return lpRect; }
private static extern bool _AdjustWindowRectEx(ref RECT lpRect, WS dwStyle, bool bMenu, WS_EX dwExStyle);
protected void btn_Del_Click(object sender, EventArgs e) { string ids = WS.RequestString("id"); TemplateVarView.Del(string.Format("id in ({0})", ids)); }
public static extern int SetWindowLong(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] GWL nIndex, [MarshalAs(UnmanagedType.U4)] WS dwNewLong);
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); cls = WS.RequestInt("class", 0); zt = WS.RequestInt("zt", 0); url = string.Format("NewsList.aspx?class={0}&zt={1}", cls, zt); News n = new News(); if (WS.RequestInt("id") > 0) { n = //NewsView.GetModelByID(WS.RequestString("id")); (from l in ent.News where l.ID == id select l).FirstOrDefault(); cls = n.ClassID.ToInt32(); } else { n.ClassID = cls; n.ZtID = zt; } Class c = NewsAction.NewsClass.Where(p => p.ID.ToString() == ddl_Class.SelectedValue).First(); n.ClassID = ddl_Class.SelectedValue.ToInt32(); n.Title = txt_Title.Text.TrimDbDangerousChar(); n.TitleColor = cp_TitleColor.Value.TrimDbDangerousChar(); n.TitleB = chk_TitleB.Checked; n.TitleI = chk_TitleI.Checked; n.TitleS = chk_TitleS.Checked; n.FTitle = txt_FTitle.Text.TrimDbDangerousChar(); n.Audit = chk_Audit.Checked; n.Tuijian = chk_Tuijian.Checked; n.Toutiao = chk_Toutiao.Checked; n.KeyWords = txt_Key.Text.TrimDbDangerousChar(); //关键词写入系统 txt_Key.Text = Regex.Replace(txt_Key.Text, "\\s", ","); string[] keys = Regex.Replace(txt_Key.Text, "\\s", ",").Split(','); foreach (string k in keys) { InsertKeyWords(1, k); } n.NavUrl = txt_NavUrl.Text.TrimDbDangerousChar(); n.NewsTime = txt_NewsTime.Text.ToDateTime(); n.TitleImage = txt_TitleImage.Text.TrimDbDangerousChar(); n.Description = txt_Description.Text.TrimDbDangerousChar(); n.Author = txt_Author.Text.TrimDbDangerousChar(); n.Source = txt_Source.Text.TrimDbDangerousChar(); n.Content = FCKeditor1.Text.TrimDbDangerousChar(); //n.ContentEn = FCKeditor2.Text.TrimDbDangerousChar(); n.SetTop = chk_SetTop.Checked; n.EnableReply = !chk_CloseReply.Checked; n.ModelID = ddl_contentTemp.SelectedValue.ToInt32(); n.ClickCount = txt_ClickCount.Text.ToInt32(); n.DownCount = txt_DownCount.Text.ToInt32(); n.FileForder = txt_FileForder.Text; n.FileName = txt_FileName.Text; n.ReplyCount = 0; if (id <= 0) { ent.AddToNews(n); } ent.SaveChanges(); ent.Dispose(); if (SystemSetting.EnableStatic) { CreatePage.CreateContentPage(n, c); News news_pre = GetPreNews(n, c); if (news_pre != null) { CreatePage.CreateContentPage(news_pre, c); } switch (c.EditcreateList) { case 0: break; case 1: CreatePage.CreateListPage(c, 1); break; case 2: CreatePage.GreateIndexPage(); break; case 3: case 4: CreatePage.CreateListPage(c, 1); break; case 5: CreatePage.GreateIndexPage(); break; case 6: CreatePage.CreateListPage(c, 1); CreatePage.GreateIndexPage(); break; } } Js.AlertAndChangUrl("保存成功!", url); }
/// <summary> /// 加载信息 /// </summary> protected void LoadInfo() { DataEntities ent = new DataEntities(); cp_TitleColor.Value = "000"; sp_cor.Style["background-color"] = "#" + cp_TitleColor.Value; ddl_Class.DataSource = NewsAction.NewsClass; ddl_Class.DataTextField = "ClassName"; ddl_Class.DataValueField = "ID"; ddl_Class.DataBind(); ddl_Class.SelectedValue = cls.ToS(); ddl_contentTemp.DataSource = //TemplateContentView.GetModelList(); from l in ent.TemplateContent select l; ddl_contentTemp.DataTextField = "TempName"; ddl_contentTemp.DataValueField = "ID"; ddl_contentTemp.DataBind(); ddl_contentTemp.Items.Add(new ListItem("--使用默认模板--", "0")); ddl_contentTemp.SelectedValue = "0"; txt_FileForder.Text = DateTime.Now.ToString("yyyy-MM-dd"); txt_Author.Text = SysUserAction.LocalUser.UserName; if (WS.RequestInt("id") <= 0) { txt_NewsTime.Text = DateTime.Now.ToString(); return; } News n = //NewsView.GetModelByID(WS.RequestString("id")); (from l in ent.News where l.ID == id select l).FirstOrDefault(); ddl_Class.SelectedValue = n.ClassID.ToS(); txt_Title.Text = n.Title; cp_TitleColor.Value = n.TitleColor; chk_TitleB.Checked = n.TitleB.ToBoolean(); chk_TitleI.Checked = n.TitleI.ToBoolean(); chk_TitleS.Checked = n.TitleS.ToBoolean(); txt_FTitle.Text = n.FTitle; chk_Audit.Checked = n.Audit.ToBoolean(); chk_Tuijian.Checked = n.Tuijian.ToBoolean(); chk_Toutiao.Checked = n.Toutiao.ToBoolean(); txt_Key.Text = n.KeyWords; txt_NavUrl.Text = n.NavUrl; txt_NewsTime.Text = n.NewsTime.ToString(); txt_TitleImage.Text = n.TitleImage; txt_Description.Text = n.Description; txt_Author.Text = n.Author; txt_Source.Text = n.Source; FCKeditor1.Text = n.Content; //FCKeditor2.Text = n.ContentEn; chk_SetTop.Checked = n.SetTop.ToBoolean(); chk_CloseReply.Checked = !n.EnableReply.ToBoolean(); ddl_contentTemp.SelectedValue = n.ModelID.ToString(); txt_ClickCount.Text = n.ClickCount.ToString(); txt_DownCount.Text = n.DownCount.ToString(); txt_FileForder.Text = n.FileForder; txt_FileName.Text = n.FileName; ent.Dispose(); }
public void LoadInfo() { string action = WS.RequestString("action", "IndexContent"); txt_Content.Text = GetHelper().ExecuteScalar(CommandType.Text, string.Format("select top 1 {0} from TemplatePublic where id>0", action)).ToString(); }
internal static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, WS dwNewLong);
public static WS SetWindowStyle (this Window window, WS style) { return (WS)SetWindowLong(GetHandle(window), GWL.STYLE, (uint)style); }
public static bool _ModifyStyle(this IntPtr _hwnd, WS removeStyle, WS addStyle) { var dwStyle = GetWindowLong(_hwnd, GWL.STYLE); var dwNewStyle = (dwStyle & ~removeStyle) | addStyle; if (dwStyle == dwNewStyle) { return false; } SetWindowLong(_hwnd, GWL.STYLE, dwNewStyle); return true; }
} // PowerShell実行コマンドのパスを指定。powershell or pwsh #region ReceiverSide public override async Task Init(InitInfo info) { // powrshell用コマンドパスを自動敵に探してDefaultPSCommandPathにセット。 // info.Remarkで指定されている場合はこちらを使用。 // もし指定されていな変えればDefaultPSCommandPathを使用。 // なぜかパスが見つからなかったという場合はエラー終了。 string psPath = info.Extension.TryGetValue(Ex_InitInfo_PSPath, out string tempPSPath) ? tempPSPath : ""; if (string.IsNullOrEmpty(psPath)) { if (string.IsNullOrEmpty(Item.DefualtPSCommandPath)) { foreach (string psCommand in new string[] { "pwsh", "powershell" }) { using (Process proc = new Process()) { proc.StartInfo.FileName = "where.exe"; proc.StartInfo.Arguments = psCommand; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); string output_psCommandPath = proc.StandardOutput.ReadLine(); //最初の1行のみ取得 proc.WaitForExit(); if (proc.ExitCode == 0) { Item.DefualtPSCommandPath = output_psCommandPath.Trim(); break; } } } } this.PSPath = Item.DefualtPSCommandPath; } else { using (Process proc = new Process()) { proc.StartInfo.FileName = "where.exe"; proc.StartInfo.Arguments = psPath; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); string output_psCommandPath = proc.StandardOutput.ReadLine(); //最初の1行のみ取得 proc.WaitForExit(); if (proc.ExitCode == 0) { this.PSPath = output_psCommandPath.Trim(); } } } if (string.IsNullOrEmpty(PSPath)) { this.Remark = "Error: PowerShell command path is missing."; await WS.SendAsync( new ArraySegment <byte>(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(info))), WebSocketMessageType.Text, true, CancellationToken.None); return; } // バージョンチェック if (info.CheckVersion()) { this.Enabled = true; info.Success = true; } else { this.Remark = string.Format( "Error: Version mismatch. Sender->{0} Receiver->{1}", info.Version, WebSocketParam.Version); //"Error: Version mismatch. Sender->{0} Receiver->{1}", info.Version, Item.Version); } await WS.SendAsync( new ArraySegment <byte>(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(info))), WebSocketMessageType.Text, true, CancellationToken.None); }
/// <summary> /// /// </summary> /// <param name="hwnd"></param> /// <param name="value"></param> public static void SetWindowStyle(IntPtr hwnd, WS value) { NativeMethods.SetWindowLong(hwnd, GWL.STYLE, (int)value); }
/// <summary> /// 加载列表 /// </summary> protected void LoadInfo() { pager.PageSize = SystemSetting.MagageListSize; ddl_Class.DataSource = NewsAction.NewsClass.Where(pa => pa.IsLeafClass && pa.ModelID == 2).ToList(); ddl_Class.DataTextField = "ClassName"; ddl_Class.DataValueField = "ID"; ddl_Class.DataBind(); ddl_Class.Items.Add(new ListItem("--所有栏目--", "")); ddl_Class.SelectedValue = ""; ddl_Zt.DataSource = NewsAction.NewsZt; ddl_Zt.DataTextField = "ZtName"; ddl_Zt.DataValueField = "ID"; ddl_Zt.DataBind(); ddl_Zt.Items.Add(new ListItem("--所有专题--", "")); ddl_Zt.SelectedValue = ""; ddl_Class_search.DataSource = NewsAction.NewsClass.Where(pa => pa.IsLeafClass && pa.ModelID == 2).ToList(); ddl_Class_search.DataTextField = "ClassName"; ddl_Class_search.DataValueField = "ID"; ddl_Class_search.DataBind(); ddl_Class_search.Items.Add(new ListItem("--新增请选择栏目--", "")); ddl_Class_search.SelectedValue = ""; if (WS.RequestInt("class") > 0) { ddl_Class_search.SelectedValue = WS.RequestString("class"); } string str_sql = ""; if (ddl_Prop.SelectedValue != "") { switch (ddl_Prop.SelectedValue) { case "SetTop": str_sql += "SetTop=1 "; break; } } if (txt_Key.Text.Trim().Length > 0 && txt_Column.SelectedValue != "") { if (str_sql.Trim().Length > 0) { str_sql += " and "; } str_sql += txt_Column.SelectedValue + " like '%" + txt_Key.Text + "%'"; } if (ddl_Class.SelectedValue != "") { if (str_sql.Trim().Length > 0) { str_sql += " and "; } str_sql += "ClassID=" + ddl_Class.SelectedValue;; } if (cls > 0) { if (str_sql.Trim().Length > 0) { str_sql += " and "; } str_sql += "ClassID=" + cls; //ddl_Class_search.Visible = false; ddl_Class_search.Enabled = false; } if (ddl_Class_search.SelectedValue != "") { if (str_sql.Trim().Length > 0) { str_sql += " and "; } str_sql += "ClassID=" + ddl_Class_search.SelectedValue; } if (zt > 0) { if (str_sql.Trim().Length > 0) { str_sql += " and "; } str_sql += "ZtID=" + zt; } //str_sql += "order by " + ddl_Order.SelectedValue + " " + ddl_Desc.SelectedValue; ph p = new ph(); p.CurrentPage = pager.CurrentPageIndex; p.Fields = "*"; p.Filter = str_sql; p.group = ""; p.PageSize = pager.PageSize; p.PrimaryKey = "ID"; p.Sort = ddl_Order.SelectedValue + " " + ddl_Desc.SelectedValue; p.Tables = "ImageAlbum"; rp_list.DataSource = p.GetTable(); pager.RecordCount = p.Count(); rp_list.DataBind(); }
private static extern bool _AdjustWindowRectEx(ref RECT lpRect, WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, WS_EX dwExStyle);
public static void SetWindowStyle(Form form, WS style) { SetWindowLong(form.Handle, GWL.STYLE, (int)style); CheckLastError(); }
/// <summary> /// 加载列表 /// </summary> protected void LoadInfo() { pager.PageSize = SystemSetting.MagageListSize; ddl_Class.DataSource = ClassAction.Classes.Where(pa => pa.IsLeafClass == true && pa.ModelID == 4).ToList(); ddl_Class.DataTextField = "ClassName"; ddl_Class.DataValueField = "ID"; ddl_Class.DataBind(); ddl_Class.Items.Add(new ListItem("--所有栏目--", "")); ddl_Class.SelectedValue = ""; ddl_Zt.DataSource = NewsAction.NewsZt; ddl_Zt.DataTextField = "ZtName"; ddl_Zt.DataValueField = "ID"; ddl_Zt.DataBind(); ddl_Zt.Items.Add(new ListItem("--所有专题--", "")); //ddl_Zt.SelectedValue = ""; ddl_Class_search.DataSource = NewsAction.NewsClass.Where(pa => pa.IsLeafClass == true && pa.ModelID == 4).ToList(); ddl_Class_search.DataTextField = "ClassName"; ddl_Class_search.DataValueField = "ID"; ddl_Class_search.DataBind(); ddl_Class_search.Items.Add(new ListItem("--新增请选择栏目--", "")); ddl_Class_search.SelectedValue = ""; if (WS.RequestInt("class") > 0) { ddl_Class_search.SelectedValue = WS.RequestString("class"); ddl_Class.SelectedValue = WS.RequestString("class"); } DataEntities ent = new DataEntities(); var q = from l in ent.Book select l; if (ddl_Prop.SelectedValue != "") { switch (ddl_Prop.SelectedValue) { case "IsVip": q = q.Where(p => p.IsVip == true); break; case "Enable": q = q.Where(p => p.Enable == true); break; case "IsFirstPost": q = q.Where(p => p.IsFirstPost == true); break; } } if (txt_Key.Text.Trim().Length > 0 && txt_Column.SelectedValue != "") { string k = txt_Key.Text.Trim(); //str_sql += txt_Column.SelectedValue + " like '%" + txt_Key.Text + "%'"; q = from l in q where l.Title.Contains(k) || l.Author.Contains(k) || l.Intro.Contains(k) select l; } if (ddl_Class.SelectedValue != "") { int clsid = ddl_Class.SelectedValue.ToInt32(); q = q.Where(p => p.ClassID == clsid); } if (cls > 0) { q = q.Where(p => p.ClassID == cls); //ddl_Class_search.Visible = false; ddl_Class_search.Enabled = false; ddl_Class.Enabled = false; } if (ddl_Class_search.SelectedValue != "") { int clsid = ddl_Class_search.SelectedValue.ToInt32(); q = q.Where(p => p.ClassID == clsid); } rp_list.DataSource = q.OrderByDescending(p => p.ID).Skip(pager.CurrentPageIndex - 1).Take(pager.PageSize); pager.RecordCount = q.Count(); rp_list.DataBind(); }
protected void btn_Save_Click(object sender, EventArgs e) { User u = UserAction.opuser; UserGroup g = UserGroupView.GetModelByID(u.Group.ToS()); if (FileUpload1.FileName.IsNullOrEmpty()) { Js.AlertAndGoback("为提高您文章的排名,请选择一张标题图片"); return; } #region 图片 SysSetting ss = BasePage.SystemSetting; HttpPostedFile file = Request.Files["FileUpload1"]; string FileName = file.FileName.GetFileNameFromPath(); //文件名 string ExtName = file.FileName.GetFileExtNameFromPath(); //扩展名 string NewName = @string.GetGuid() + ExtName; //新文件名 if (!ExtName.Replace(".", "").IsInArray(ss.FileExtNameFilter.Split(','))) { Js.AlertAndGoback("不允许上传此类文件"); return; } if (file.ContentLength > ss.MaxPostFileSize) { Js.AlertAndGoback("文件太大"); return; } string Folder = ss.FileDir + "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/"; //文件目录 string FolderShotCut = Folder + "ShortCut/"; //缩略图目录 string FilePath = Folder + NewName; //文件路径 string FilePath_ShortCut = FolderShotCut + NewName; //缩略图路径 file.SaveAs(Server.MapPath(FilePath), true); ImageHelper.MakeThumbnail(Server.MapPath(FilePath), Server.MapPath(FilePath_ShortCut), 105, 118, "Cut"); FileInfo savedFile = new FileInfo(Server.MapPath(FilePath)); Voodoo.Model.File f = new Voodoo.Model.File(); f.FileDirectory = ss.FileDir; f.FileExtName = ExtName; f.FilePath = FilePath; f.FileSize = (savedFile.Length / 1024).ToInt32(); //f.FileType= f.SmallPath = FilePath_ShortCut; f.UpTime = DateTime.Now; FileView.Insert(f); #endregion News n = new News(); n.Author = txt_Author.Text.TrimDbDangerousChar(); n.AutorID = UserAction.opuser.ID; n.ClassID = ddl_Class.SelectedValue.ToInt32(); n.ClickCount = 0; n.Content = txt_Content.Text.TrimDbDangerousChar(); n.Description = txt_Description.Text.TrimDbDangerousChar(); n.DownCount = 0; n.EnableReply = false; n.FTitle = txtFtitle.Text.TrimDbDangerousChar(); n.KeyWords = txt_Keyword.Text.TrimDbDangerousChar(); n.ModelID = 0; n.NavUrl = ""; n.NewsTime = DateTime.Now; n.SetTop = false; n.Source = txt_Source.Text.TrimDbDangerousChar(); n.Title = txt_Title.Text.TrimDbDangerousChar(); n.TitleColor = "000"; n.TitleImage = FilePath;//上传图片 n.ZtID = 0; n.Audit = g.PostAotuAudit; n.FileForder = DateTime.Now.ToString("yyyy-MM-dd"); n.ID = WS.RequestInt("id"); Result r = NewsAction.UserPost(n, UserAction.opuser); if (r.Success) { Js.AlertAndChangUrl(r.Text, "PostList.aspx"); } else { Js.AlertAndGoback(r.Text); } }
// Use this for initialization void Start() { GameObject wsc = GameObject.Find("WSCommunication"); ws = wsc.GetComponent <WS>(); }
/// <summary> /// QQ用户登录 /// </summary> protected void QQLogin() { DataEntities ent = new DataEntities(); if (Request.Params["code"] != null) { QOpenClient qzone = null; QConnectSDK.Models.User currentUser = null; var verifier = Request.Params["code"]; string state = Session["requeststate"].ToString(); qzone = new QOpenClient(verifier, state); // currentUser = qzone.GetCurrentUser(); if (null != currentUser) { string openid = qzone.OAuthToken.OpenId; var SysUser = //UserView.Find(string.Format("UserName=N'{0}'", openid)); (from l in ent.User where l.UserName == openid select l).FirstOrDefault(); if (SysUser.ID <= 0) { SysUser.Cent = SystemSetting.RegCent; SysUser.ChineseName = currentUser.Nickname; SysUser.Enable = true; SysUser.Group = 0; SysUser.Image = currentUser.Figureurl; SysUser.LastLoginIP = WS.GetIP(); SysUser.LastLoginTime = DateTime.UtcNow.AddHours(8); SysUser.LoginCount = 1; SysUser.PostCount = 0; SysUser.RegIP = WS.GetIP(); SysUser.RegTime = DateTime.UtcNow.AddHours(8); SysUser.StudentNo = ""; SysUser.TeachNo = ""; SysUser.Tel = ""; SysUser.Twitter = ""; SysUser.UserName = openid; SysUser.UserPass = ""; SysUser.WebSite = ""; //SysUser.Weibo = ""; try { var i = qzone.GetWeiboUserInfo("", qzone.OAuthToken.OpenId); SysUser.Address = i.Data.Location; SysUser.Email = i.Data.Email; SysUser.Intro = i.Data.Introduction; SysUser.ZipCode = i.Data.City_code.ToS(); } catch { } //UserView.Insert(SysUser); ent.AddToUser(SysUser); } else { SysUser.LoginCount++; SysUser.LastLoginIP = WS.GetIP(); SysUser.LastLoginTime = DateTime.UtcNow.AddHours(8); } ent.SaveChanges(); //System.Web.HttpContext.Current.Session["sys_user"] = SysUser.ID; System.Web.HttpCookie cookie = new System.Web.HttpCookie("User"); cookie.Expires = DateTime.Now.AddDays(7); cookie.Values.Add("uid", SysUser.ID.ToString()); cookie.Values.Add("k", Voodoo.Security.Encrypt.Md5(string.Format("{0}{1}{2}", SysUser.ID, SysUser.UserName, SysUser.UserPass, BasePage.SystemSetting.SiteName ))); Voodoo.Cookies.Cookies.SetCookie(cookie); Response.Redirect("/"); } Session["QzoneOauth"] = qzone; } ent.Dispose(); }
private void Subscribe(string evt) { WS.Send($"[5, \"{evt}\"]"); }
private bool _ModifyStyle(WS removeStyle, WS addStyle) { Assert.IsNotDefault(_hwnd); var intPtr = NativeMethods.GetWindowLongPtr(_hwnd, GWL.STYLE); var dwStyle = (WS)(Environment.Is64BitProcess ? intPtr.ToInt64() : intPtr.ToInt32()); var dwNewStyle = (dwStyle & ~removeStyle) | addStyle; if (dwStyle == dwNewStyle) { return false; } NativeMethods.SetWindowLongPtr(_hwnd, GWL.STYLE, new IntPtr((int)dwNewStyle)); return true; }
public static WS SetWindowLong(this IntPtr hWnd, WS dwNewLong) { return (WS) SetWindowLong(hWnd, (int) GWL.STYLE, (int) dwNewLong); }
protected void Page_Load(object sender, EventArgs e) { CreateTxt(WS.RequestInt("id")); }
// GetWindowStyle public static WS SetWindowStyle(IntPtr hWnd, WS value) { return((WS)SetWindowLong(hWnd, (int)GWL.STYLE, (int)value)); }
private static void Combo() { Obj_AI_Hero target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Magical); Orbwalker.SetAttack((!Q.IsReady() || !E.IsReady() || !W.IsReady())); if (target != null) { if (HumanForm) { // Human Rotation if (Player.Distance(target) <= Q.Range && Config.Item("UseQHuman").GetValue <bool>() && Q.IsReady()) { Q.Cast(target); } if (Player.Distance(target) <= W.Range && Config.Item("UseWHuman").GetValue <bool>() && W.IsReady()) { W.Cast(target); } if (Player.Distance(target) <= E.Range && Config.Item("UseEHuman").GetValue <bool>() && E.IsReady()) { var pred = E.GetPrediction(target); E.Cast(pred.CastPosition); } if (!Q.IsReady() && !W.IsReady() && !E.IsReady() && Player.Distance(target) <= 750 && Config.Item("UseR").GetValue <bool>()) { R.Cast(); } } // Spider Rotation if (SpiderForm) { if (Player.Distance(target) <= QS.Range && Config.Item("UseQSpider").GetValue <bool>() && QS.IsReady()) { QS.Cast(target); } if (Player.Distance(target) <= 300 && Config.Item("UseWSpider").GetValue <bool>() && WS.IsReady()) { WS.Cast(); } if (Player.Distance(target) <= ES.Range && Player.Distance(target) > QS.Range && Config.Item("UseESpider").GetValue <bool>() && ES.IsReady()) { ES.Cast(target); } if (Player.Distance(target) > QS.Range && !ES.IsReady() && R.IsReady() && Player.Distance(target) <= 1075 && Config.Item("UseR").GetValue <bool>()) { R.Cast(); } if (!QS.IsReady() && !ES.IsReady() && R.IsReady() && Player.Distance(target) <= 1075 && Config.Item("UseR").GetValue <bool>()) { R.Cast(); } if (ES.IsReady() && Player.Distance(target) > QS.Range && Config.Item("UseESpider").GetValue <bool>()) { ES.Cast(target); } } } }
public static StrongHWND CreateWindowEx(WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam) { HWND hwnd = NativeMethods.CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); return new StrongHWND(hwnd.DangerousGetHandle()); }
public static WS SetWindowLong(this IntPtr hWnd, WS dwNewLong) { return((WS)SetWindowLong(hWnd, (int)GWL.STYLE, (int)dwNewLong)); }
public static extern IntPtr CreateWindowEx(int dwExStyle, string lpClassName, string lpWindowName, WS style, int x, int y, int width, int height, IntPtr hwndParent, IntPtr hmenu, IntPtr hInstance, IntPtr lpParam);
/// <summary> /// 保存加速度实时数据汇总 /// </summary> /// <param name="param">上传数据对象</param> /// <param name="dev">设备信息</param> /// <param name="ws">WS信息</param> /// <param name="site">测量位置信息</param> /// <param name="vibSingal">振动信号信息</param> /// <param name="status">测量位置状态</param> private void SaveRealTimeCollectInfoWaveAcc(UploadWaveDataParameter param, Device dev, WS ws, MeasureSite site, VibSingal vibSingal, int peakStatus, int peakPeakStatus, int effStatus, DateTime peakSamplingDate, DateTime peakPeakSamplingDate, DateTime effSamplingDate) { try { //重新获取测点信息 MeasureSite newMeasureSite = measureSiteRepository.GetByKey(site.MSiteID); //获取实时数据信息 RealTimeCollectInfo realTimeCollectInfo = realTimeCollectInfoRepository .GetDatas <RealTimeCollectInfo>(p => p.MSID == newMeasureSite.MSiteID, false) .FirstOrDefault(); if (realTimeCollectInfo == null) { realTimeCollectInfo = new RealTimeCollectInfo(); MeasureSiteType siteType = cacheDICT.GetInstance() .GetCacheType <MeasureSiteType>(p => p.ID == newMeasureSite.MSiteName) .FirstOrDefault(); realTimeCollectInfo.DevID = dev.DevID; realTimeCollectInfo.MSID = newMeasureSite.MSiteID; realTimeCollectInfo.MSName = siteType.Name; realTimeCollectInfo.MSStatus = newMeasureSite.MSiteStatus; realTimeCollectInfo.MSDesInfo = siteType.Describe; //realTimeCollectInfo.MSDataStatus = ws.LinkStatus; realTimeCollectInfo.MSACCSingalID = vibSingal.SingalID; realTimeCollectInfo.MSACCVirtualValue = param.EffectiveValue; realTimeCollectInfo.MSACCPeakValue = param.PeakValue; realTimeCollectInfo.MSACCPeakPeakValue = param.PeakPeakValue; realTimeCollectInfo.MSACCVirtualStatus = effStatus; realTimeCollectInfo.MSACCPeakStatus = peakStatus; realTimeCollectInfo.MSACCPeakPeakStatus = peakPeakStatus; realTimeCollectInfo.MSACCPeakTime = (peakSamplingDate == DateTime.MinValue ? DateTime.Now : peakSamplingDate); realTimeCollectInfo.MSACCPeakPeakTime = (peakPeakSamplingDate == DateTime.MinValue ? DateTime.Now : peakPeakSamplingDate); realTimeCollectInfo.MSACCVirtualTime = (effSamplingDate == DateTime.MinValue ? DateTime.Now : effSamplingDate); #region 添加网关连接状态 ADDED BY QXM, 2016/11/18 //var wg = gatewayRepository.GetByKey(ws.WGID); //if (wg != null) //{ // realTimeCollectInfo.MSWGLinkStatus = wg.LinkStatus; //} #endregion realTimeCollectInfoRepository.AddNew(realTimeCollectInfo); } else { realTimeCollectInfo.MSStatus = newMeasureSite.MSiteStatus; //realTimeCollectInfo.MSDataStatus = ws.LinkStatus; realTimeCollectInfo.MSACCSingalID = vibSingal.SingalID; realTimeCollectInfo.MSACCVirtualValue = param.EffectiveValue; realTimeCollectInfo.MSACCPeakValue = param.PeakValue; realTimeCollectInfo.MSACCPeakPeakValue = param.PeakPeakValue; realTimeCollectInfo.MSACCVirtualStatus = effStatus; realTimeCollectInfo.MSACCPeakStatus = peakStatus; realTimeCollectInfo.MSACCPeakPeakStatus = peakPeakStatus; realTimeCollectInfo.MSACCPeakTime = (peakSamplingDate == DateTime.MinValue ? DateTime.Now : peakSamplingDate); realTimeCollectInfo.MSACCPeakPeakTime = (peakPeakSamplingDate == DateTime.MinValue ? DateTime.Now : peakPeakSamplingDate); realTimeCollectInfo.MSACCVirtualTime = (effSamplingDate == DateTime.MinValue ? DateTime.Now : effSamplingDate); realTimeCollectInfoRepository.Update(realTimeCollectInfo); #region 添加报警阈值在时实表中 List <EigenValueType> eigenValueTypeList = cacheDICT.GetInstance() .GetCacheType <EigenValueType>() .ToList(); //获取阈值 var alarmThresholdList = signalAlmSetRepository.GetDatas <SignalAlmSet>(item => item.SingalID == vibSingal.SingalID, true); if (alarmThresholdList != null && alarmThresholdList.Any()) { //阈值 foreach (var alarmThreshold in alarmThresholdList) { var eigenValue = eigenValueTypeList.Where(item => item.ID == alarmThreshold.ValueType).FirstOrDefault(); var vibSignalType = (int)EnumMeasureSiteThresholdType.ACC; var eigenValueType = (int)EnumEigenType.EffectivityValue; var samplingDate = DateTime.Now; switch (eigenValue.Code) { //有效值 case "EIGENVALUE_20_YXZ": { eigenValueType = (int)EnumEigenType.EffectivityValue; samplingDate = effSamplingDate; } break; //峰值 case "EIGENVALUE_18_FZ": { eigenValueType = (int)EnumEigenType.PeakValue; samplingDate = peakSamplingDate; } break; //峰峰值 case "EIGENVALUE_19_FFZ": { eigenValueType = (int)EnumEigenType.PeakPeakValue; samplingDate = peakPeakSamplingDate; } break; } var realTimeAlarmThreshold = realTimeAlarmThresholdRepository.GetDatas <RealTimeAlarmThreshold>(item => item.MeasureSiteID == site.MSiteID && item.MeasureSiteThresholdType == vibSignalType && item.EigenValueType == eigenValueType, true).FirstOrDefault(); //更新 if (realTimeAlarmThreshold != null) { //添加关联阈值表数据 realTimeAlarmThreshold.AlarmThresholdValue = alarmThreshold.WarnValue; realTimeAlarmThreshold.DangerThresholdValue = alarmThreshold.AlmValue; realTimeAlarmThresholdRepository.Update(realTimeAlarmThreshold); } else { //添加关联阈值表数据 realTimeAlarmThreshold = new RealTimeAlarmThreshold(); realTimeAlarmThreshold.MeasureSiteID = site.MSiteID; realTimeAlarmThreshold.MeasureSiteThresholdType = vibSignalType; realTimeAlarmThreshold.AddDate = DateTime.Now; realTimeAlarmThreshold.AlarmThresholdValue = alarmThreshold.WarnValue; realTimeAlarmThreshold.DangerThresholdValue = alarmThreshold.AlmValue; realTimeAlarmThreshold.EigenValueType = eigenValueType; realTimeAlarmThreshold.SamplingDate = samplingDate; realTimeAlarmThresholdRepository.AddNew(realTimeAlarmThreshold); } } } #endregion } } catch (Exception ex) { LogHelper.WriteLog(ex); } }
protected virtual bool IsWindowed(IntPtr hWnd) { WS dwStyle = (WS)GetWindowLong(hWnd, GWL.STYLE); return((dwStyle & WS.CAPTION) != 0); }
/// <summary>Add and remove a native WindowStyle from the HWND.</summary> /// <param name="removeStyle">The styles to be removed. These can be bitwise combined.</param> /// <param name="addStyle">The styles to be added. These can be bitwise combined.</param> /// <returns>Whether the styles of the HWND were modified as a result of this call.</returns> private bool _ModifyStyle(WS removeStyle, WS addStyle) { Assert.IsNotDefault(_hwnd); var dwStyle = (WS)NativeMethods.GetWindowLongPtr(_hwnd, GWL.STYLE).ToInt32(); var dwNewStyle = (dwStyle & ~removeStyle) | addStyle; if (dwStyle == dwNewStyle) { return false; } NativeMethods.SetWindowLongPtr(_hwnd, GWL.STYLE, new IntPtr((int)dwNewStyle)); return true; }
public override void OnLoad() { base.OnLoad(); ReportService report = (ReportService)dw_1.Services.Add(ServiceName.Report); report.RequestorDrawTitle = false; this.Visible = false; //dw_1.Retrieve(); //dw_1.Modify("DataWindow.Readonly=yes"); var method = "getTaxRate"; //var code = "5407520091"; var code = this.Request["code"].ToString(); //var tsflag = this.Request["tsflag"].ToString(); string strFile = AppDomain.CurrentDomain.BaseDirectory; var timestamp = Context.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"); string sign = WS.MD5("hd01" + "750a8953a27a4d0aa6b4a70576574ead" + timestamp); //method = "getVisualLogistics"; string format = "xml"; string uid = "hd01"; string url = ""; //取随机数 Random rnd = new Random(); int n = rnd.Next(10000, 99999); url = "http://api.trainer.nbeport.com/router/rest?method=" + method + "&format=" + format + "&code=" + code + "&user_id=" + uid + "×tamp=" + timestamp + "&sign=" + sign + "&t=" + n; //url = Server.UrlEncode(url); //WriteTextLog(url); strFile = strFile + "XML\\" + code + ".xml"; //WS.DownLoadAndCreateXML(url, strFile); var Stream = WS.WriteCardToStream(url); //STREAM转换为string StreamReader reader = new StreamReader(Stream); string text = reader.ReadToEnd(); var row = 0; var sxrq = ""; var jsrq = ""; var insertrow = 0; var name = ""; var unit = ""; var dwcode = ""; var zssl_Set = ""; var tsl = ""; var hgbm = ""; //for (row = dw_1.RowCount; row > 0; row--) //{ // dw_1.DeleteRow(row); //} //for (row = ds_1.RowCount; row > 0; row--) //{ // ds_1.DeleteRow(row); //} ds_1.ImportString(text, Sybase.DataWindow.FileSaveAsType.Xml); if (ds_1.RowCount > 1) { //更新行号 for (row = ds_1.RowCount; row > 0; row--) { insertrow = dw_1.InsertRow(0); sxrq = ds_1.GetItemString(row, "vesselname"); jsrq = ds_1.GetItemString(row, "voyage"); name = ds_1.GetItemString(row, "hgbm"); if (sxrq != null && sxrq != "") { hgbm = ds_1.GetItemString(row + 1, "stepname"); unit = ds_1.GetItemString(row + 1, "remark"); dwcode = ds_1.GetItemString(row + 1, "ctnno"); zssl_Set = ds_1.GetItemString(row + 1, "billno"); tsl = ds_1.GetItemString(row + 1, "procresul"); } dw_1.SetItemString(insertrow, "vesselname", sxrq); dw_1.SetItemString(insertrow, "voyage", jsrq); dw_1.SetItemString(insertrow, "stepname", name); dw_1.SetItemString(insertrow, "remark", unit); dw_1.SetItemString(insertrow, "ctnno", dwcode); dw_1.SetItemString(insertrow, "procresul", tsl); dw_1.SetItemString(insertrow, "billno", zssl_Set); dw_1.SetItemString(insertrow, "hgbm", hgbm); } for (row = dw_1.RowCount; row > 0; row--) { if (dw_1.GetItemString(row, "stepname") == "" || dw_1.GetItemString(row, "stepname") == null) { dw_1.DeleteRow(row); } } } //dw_1.ImportString(text, Sybase.DataWindow.FileSaveAsType.Xml); //dw_1.Retrieve(); dw_1.Modify("DataWindow.Readonly=yes"); }
internal static bool xModifyHwndStyle(IntPtr hwnd, WS removeStyle, WS addStyle) { WS ws = (WS)GetWindowLongPtr(hwnd, GWL.STYLE).ToInt32(); WS ws2 = (ws & ~removeStyle) | addStyle; if (ws == ws2) { return false; } SetWindowLongPtr(hwnd, GWL.STYLE, new IntPtr((int)ws2)); return true; }
public static StrongHWND CreateWindowEx(WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam) { HWND hwnd = NativeMethods.CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); return(new StrongHWND(hwnd.DangerousGetHandle())); }
public static IntPtr CreateWindowEx( WS_EX dwExStyle, string lpClassName, string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam) { IntPtr ret = _CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); if (IntPtr.Zero == ret) { HRESULT.ThrowLastError(); } return ret; }
public static extern long SetWindowLong(IntPtr hwnd, GWL gwl, WS ws);
private static extern IntPtr _CreateWindowEx( WS_EX dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
protected void Page_Load(object sender, EventArgs e) { int BookID = WS.RequestInt("bookid"); string BookTitle = WS.RequestString("booktitle"); int ClassID = WS.RequestInt("classid"); string ClassName = WS.RequestString("classname"); string Content = WS.RequestString("content").HtmlDeCode(); string Title = WS.RequestString("title"); Class cls = ClassView.GetModelByID(ClassID.ToS()); BookChapter c = new BookChapter(); if (Title.Trim().Length == 0) { c.ID = -1; c.Title = "采集失败"; Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(c)); return; } if (BookChapterView.Exist(string.Format("BookTitle=N'{0}' and Title=N'{1}'", BookTitle, Title))) { c.Title = "已经存在"; Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(c)); return; } c.BookID = BookID; c.BookTitle = BookTitle; c.ChapterIndex = 0; c.ClassID = ClassID; c.ClassName = ClassName; c.ClickCount = 0; //c.Content = Content; c.Enable = true; c.IsFree = true; c.IsImageChapter = false; c.IsTemp = false; c.IsVipChapter = false; c.TextLength = Content.TrimHTML().Length; c.Title = Title; c.UpdateTime = DateTime.Now; c.ValumeID = 0; BookChapterView.Insert(c); //创建内容txt Voodoo.IO.File.Write(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Content); Book b = BookView.GetModelByID(BookID.ToString()); b.LastChapterID = c.ID; b.LastChapterTitle = c.Title; b.UpdateTime = c.UpdateTime; BookView.Update(b); Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(c)); }