protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string eformsn = Request["eformsn"]; if (Wis.Toolkit.Validator.IsInt(eformsn)) { Response.Write("<script language='javascript'>alert ('编号错误!');window.close();</script>"); return; } Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Website.Setting.MeetingConnectionString); dataProvider.Open(); string commandText = string.Format("Select * from wd_75 where eformsn = {0}", eformsn); System.Data.DataTable dt = dataProvider.ExecuteDataset(commandText).Tables[0]; if (dt == null) { Response.Write("<script language='javascript'>alert ('数据不存在!');window.close();</script>"); return; } if (dt.Rows[0]["txtTitle"] != null) titleId.InnerHtml = dt.Rows[0]["txtTitle"].ToString(); if (dt.Rows[0]["txtTitle"] != null) titleId.InnerHtml = dt.Rows[0]["txtTitle"].ToString(); } }
/// <summary> /// /// </summary> /// <param name="context"></param> public void CommentsInsert(HttpContext context) { string eformsn = context.Request["eformsn"]; if (!Wis.Toolkit.Validator.IsInt(eformsn)) { context.Response.Write(0); return; } string Title = context.Request["Title"]; string ContentHtml = context.Request["ContentHtml"]; if (string.IsNullOrEmpty(ContentHtml)) { context.Response.Write(0); return; } string Commentator = ""; //获取用户姓名 if (string.IsNullOrEmpty(Commentator)) Commentator = "匿名用户"; Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(); dataProvider.ConnectionString = Wis.Website.Setting.MeetingConnectionString; dataProvider.Open(); string commandText = string.Format("select meetingGuid from wd_75 where eformsn ={0}", eformsn); object o = dataProvider.ExecuteScalar(commandText); if (o == null) { dataProvider.Close(); context.Response.Write(0); return; } commandText = string.Format("update wd_75 set Comments = Comments + 1 where eformsn ={0}", eformsn); dataProvider.ExecuteNonQuery(commandText); dataProvider.Close(); dataProvider.ConnectionString = Setting.ConnectionString; dataProvider.Open(); try { commandText = string.Format("insert into Comment(ObjectGuid,Title,Commentator,ContentHtml,Original) values('{0}',N'{1}',N'{2}',N'{3}',N'{4}')", o, Title.Replace("'", "\""), Commentator, ContentHtml.Replace("'", "\""), Wis.Toolkit.RequestManager.GetClientIP()); dataProvider.ExecuteNonQuery(commandText); dataProvider.Close(); context.Response.Write(1); return; } catch { if (!dataProvider.IsClosed) dataProvider.Open(); context.Response.Write(0); return; } }
/// <summary> /// 读取列表数据 /// </summary> /// <returns></returns> public static System.Data.DataTable ArticleDt() { Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Setting.ConnectionString); dataProvider.Open(); try { System.Data.DataTable dt = dataProvider.ExecuteDataset(labelEntity.CommandText).Tables[0]; dataProvider.Close(); return dt; } catch { if(!dataProvider.IsClosed) dataProvider.Close(); return null; } }
/// <summary> /// 操作日志 /// </summary> /// <param name="userGuid"></param> /// <param name="title"></param> /// <param name="objectGuid"></param> /// <param name="Message"></param> public static void LoggerInsert(Guid userGuid, string title, Guid objectGuid, string Message) { Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Setting.ConnectionString); dataProvider.Open(); try { string commandText = string.Format(@"insert into Log(UserGuid,Title,SubmissionGuid,Message) values ('{0}',N'{1}','{2}',N'{3}')", userGuid, title, objectGuid, Message); dataProvider.ExecuteNonQuery(commandText); dataProvider.Close(); return; } catch { if (!dataProvider.IsClosed) dataProvider.Close(); return; } }
protected void Button1_Click(object sender, EventArgs e) { Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Website.Setting.ConnectionString); Guid pageGuid = Guid.NewGuid(); if (!Wis.Toolkit.Validator.IsInt(CategoryId.Value)) CategoryId.Value = "null"; string commandText = string.Format("select Count(PageId) from Page where Title =N'{0}'", title.Value); dataProvider.Open(); int o = (int)dataProvider.ExecuteScalar(commandText); if (o > 0) { ViewState["javescript"] = string.Format("alert('页面标题不能重复!');"); dataProvider.Close(); return; } try { commandText = string.Format(@"insert into Page (PageGuid,CategoryId,MetaKeywords,MetaDesc,Title,ContentHtml,TemplatePath,ReleasePath) values ('{0}',{1},'{2}',N'{3}',N'{4}',N'{5}',N'{6}',N'{7}')", pageGuid, CategoryId.Value, MetaKeywords.Value.Replace("'", "\""), MetaDesc.Value.Replace("'", "\""), this.title.Value.Replace("'", "\""), ContentHtml.Value.Replace("'", "\""), TemplatePath.Value, ReleasePath.Value); dataProvider.ExecuteNonQuery(commandText); dataProvider.Close(); //生成静态页面 // } catch { ViewState["javescript"] = string.Format("alert('添加失败!');"); if (!dataProvider.IsClosed) dataProvider.Close(); return; } Wis.Website.Logger.LoggerInsert(Guid.NewGuid(), "添加页面 " + this.title.Value.Replace("'", "\""), pageGuid, this.ContentHtml.Value.Replace("'", "\"")); Response.Redirect("PageList.aspx"); return; }
protected void Button1_Click(object sender, EventArgs e) { Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Website.Setting.ConnectionString); Guid tagGuid = Guid.NewGuid(); dataProvider.Open(); string commandText = string.Format("select count(TemplateLabelId) from TemplateLabel where TemplateLabelName =N'{0}'", TagName.Value.Trim().Replace("'", "\"")); int count = (int)dataProvider.ExecuteScalar(commandText); if (count > 0) { ViewState["javescript"] = string.Format("alert('标签名称重复!');"); dataProvider.Close(); return; } try { commandText = string.Format(@"insert into TemplateLabel (TemplateLabelName,Description,TemplateLabelValue) values (N'{0}',N'{1}',N'{2}')", TagName.Value.Trim().Replace("'", "\""), Description.Value.Replace("'", "\""), ContentHtml.Value.Replace("'", "\"")); dataProvider.ExecuteNonQuery(commandText); dataProvider.Close(); //生成静态页面 Response.Redirect("TemplateLabelList.aspx"); return; } catch { ViewState["javescript"] = string.Format("alert('添加失败!');"); if (!dataProvider.IsClosed) dataProvider.Close(); return; } }
string newsstr() { string ParentId = Request.QueryString["ParentId"]; string liststr = string.Empty; if (string.IsNullOrEmpty(ParentId)) ParentId = "0"; Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Website.Setting.ConnectionString); dataProvider.Open(); //Guid parentGuid; //if (!Wis.Toolkit.Validator.IsGuid(ParentId)) // ParentId = Guid.Empty.ToString(); string commandText; if (ParentId=="0") commandText = string.Format("select * from Category where ParentGuid = '{0}' ", Guid.Empty); else commandText= string.Format("select * from Category where ParentGuid in (select CategoryGuid from Category where CategoryId ={0}) ", ParentId); System.Data.DataTable dt = dataProvider.ExecuteDataset(commandText).Tables[0]; foreach(System.Data.DataRow drow in dt.Rows) { commandText = string.Format("select count(CategoryId) from Category where ParentGuid = '{0}'", drow["CategoryGuid"].ToString()); int o = (int)dataProvider.ExecuteScalar(commandText); if (o > 0 ) { liststr += "<div><img src=\"../../sysImages/normal/b.gif\" alt=\"点击展开子栏目\" border=\"0\" class=\"LableItem\" onClick=\"javascript:SwitchImg(this,'" + drow["CategoryId"] + "');\" /> <span id=\"" + drow["CategoryGuid"] + "\" class=\"LableItem\" ondblclick=\"ReturnValue();\" onClick=\"SelectLable(this);sFiles('" + drow["CategoryGuid"] + "','" + drow["CategoryName"] + "');\">" + drow["CategoryName"] + "</span><div id=\"Parent" + drow["CategoryId"] + "\" class=\"SubItem\" HasSub=\"True\" style=\"height:100%;display:none;\"></div></div>"; } else { liststr += "<div><img src=\"../../sysImages/normal/s.gif\" alt=\"没有子栏目\" border=\"0\" class=\"LableItem\" /> <span id=\"" + drow["CategoryGuid"] + "\" class=\"LableItem\" ondblclick=\"ReturnValue();\" onClick=\"SelectLable(this);sFiles('" + drow["CategoryGuid"] + "','" + drow["CategoryName"] + "');\">" + drow["CategoryName"] + "</span></div>"; } } dataProvider.Close(); if (liststr != string.Empty) liststr = "Succee|||" + ParentId + "|||" + liststr; else liststr = "Fail|||" + ParentId + "|||"; return liststr; }
/// <summary> /// 读取评论 /// </summary> /// <param name="context"></param> public void CommentsLoad(HttpContext context) { string eformsn = context.Request["eformsn"]; if (!Wis.Toolkit.Validator.IsInt(eformsn)) { context.Response.Write(0); return; } context.Response.ContentType = "text/xml"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(); dataProvider.ConnectionString = Wis.Website.Setting.MeetingConnectionString; dataProvider.Open(); string commandText = string.Format("select meetingGuid from wd_75 where eformsn ={0}", eformsn); object o = dataProvider.ExecuteScalar(commandText); dataProvider.Close(); if (o == null) { context.Response.Write(0); return; } dataProvider.ConnectionString = Setting.ConnectionString; dataProvider.Open(); using (StringWriter sw = new StringWriter()) { XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; // xtw.WriteStartDocument(); xtw.WriteStartElement("L"); // League -> L commandText = string.Format("select * from Comment where ObjectGuid ='{0}' order by CommentId", o); System.Data.IDataReader dataReader = dataProvider.ExecuteReader(commandText); while (dataReader.Read()) { xtw.WriteStartElement("A"); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(dataReader["Title"].ToString()); sb.Append(","); // sb.Append(dataReader["Commentator"].ToString()); sb.Append(","); // sb.Append(dataReader["ContentHtml"].ToString()); sb.Append(","); // sb.Append(dataReader["Original"].ToString()); sb.Append(","); // sb.Append(System.Convert.ToDateTime(dataReader["DateCreated"]).ToString("yyyy-mm-dd HH:mm")); sb.Append(","); // xtw.WriteAttributeString("V", sb.ToString()); xtw.WriteEndElement();// ActiveMatch -> A } dataReader.Close(); dataProvider.Close(); xtw.WriteEndElement();// Live -> L context.Response.Write(sw.ToString()); } }
public void MeetingInfo(HttpContext context) { context.Response.ContentType = "text/xml"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); string eformsn = context.Request["eformsn"]; if(!Wis.Toolkit.Validator.IsInt(eformsn)) { context.Response.Write(0); return; } Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Website.Setting.MeetingConnectionString); dataProvider.Open(); string commandText = string.Format("update wd_75 set Hits = Hits + 1 where eformsn ={0}", eformsn); dataProvider.ExecuteNonQuery(commandText); commandText = string.Format("select * from wd_75 where eformsn ={0}", eformsn); System.Data.DataTable dt = dataProvider.ExecuteDataset(commandText).Tables[0]; dataProvider.Close(); if (dt.Rows.Count < 1) { context.Response.Write(0); return; } using (StringWriter sw = new StringWriter()) { XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; // xtw.WriteStartDocument(); xtw.WriteStartElement("L"); // League -> L xtw.WriteStartElement("A"); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(dt.Rows[0]["eformsn"].ToString()); sb.Append(";"); // sb.Append(dt.Rows[0]["txtZhuChi"].ToString().Replace(";", ","));//主持人 sb.Append(";"); // sb.Append(dt.Rows[0]["txtEndDate"].ToString() + " " + dt.Rows[0]["txtEndTime"].ToString());//会议结束日期 sb.Append(";"); // sb.Append(dt.Rows[0]["txtRenShu"].ToString().Replace(";", ","));//参会人数 sb.Append(";"); // sb.Append(dt.Rows[0]["txtDate"].ToString() + " " + dt.Rows[0]["txtTime"].ToString());//会议开始日期 sb.Append(";"); // sb.Append(dt.Rows[0]["txtAddress"].ToString().Replace(";", ","));//会议地点 sb.Append(";"); // sb.Append(dt.Rows[0]["txtTitle"].ToString().Replace(";", ","));//会议名称 sb.Append(";"); // sb.Append(dt.Rows[0]["txtshenqingren"].ToString().Replace(";", ","));//申请人 sb.Append(";"); // sb.Append(dt.Rows[0]["deptName"].ToString().Replace(";", ","));//预定部门 sb.Append(";"); // sb.Append(dt.Rows[0]["txtYuHuiRY"].ToString().Replace(";", ","));//与会人员 sb.Append(";"); // sb.Append(dt.Rows[0]["RichTextBox1"].ToString().Replace(";", ","));//内容 sb.Append(";"); // sb.Append(dt.Rows[0]["Hits"].ToString());//浏览次数 sb.Append(";"); // sb.Append(dt.Rows[0]["Comments"].ToString());//评论条数 sb.Append(";"); // xtw.WriteAttributeString("V", sb.ToString()); xtw.WriteEndElement();// ActiveMatch -> A //commandText = string.Format("select * from webflowAttach where eformsn ={0} and eformID =75", eformsn); //System.Data.DataTable dt1 = dataProvider.ExecuteDataset(commandText).Tables[0]; //foreach(System.Data.DataRow drow in dt1.Rows) //{ // xtw.WriteStartElement("F"); // System.Text.StringBuilder sb1 = new System.Text.StringBuilder(); // xtw.WriteAttributeString("V", sb1.ToString()); // xtw.WriteEndElement();// ActiveMatch -> A //} xtw.WriteEndElement();// Live -> L //xtw.WriteEndDocument(); context.Response.Write(sw.ToString()); } }
public void Count(HttpContext context) { if (context == null) { context.Response.Write(0); return; } string commandText = string.Format("select count(eformsn) from wd_75 where toPublic=1"); Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Website.Setting.MeetingConnectionString); dataProvider.Open(); int count = (int)dataProvider.ExecuteScalar(commandText); dataProvider.Close(); context.Response.Write(count); }
public static bool linkhtml() { Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Setting.ConnectionString); dataProvider.Open(); string commandtext = string.Format("select * from Category where CategoryId = 37"); System.Data.DataTable dt = dataProvider.ExecuteDataset(commandtext).Tables[0]; tempcontent = ReadHtml(dt.Rows[0]["TemplatePath"].ToString()); ReplacelistLabels(); WriteHtmls(tempcontent, System.Web.HttpContext.Current.Request.PhysicalApplicationPath + dt.Rows[0]["ReleasePath"].ToString()); return true; }
/// <summary> /// 生成关联页面 /// </summary> /// <param name="categoryId"></param> /// <returns></returns> public static bool GetTemplateHtml(int categoryId) { Wis.Toolkit.DataProvider dataProvider = new Wis.Toolkit.DataProvider(Setting.ConnectionString); dataProvider.Open(); string CommandText = string.Format("select * from Template where CategoryId ={0}", categoryId); try { System.Data.DataTable dt = dataProvider.ExecuteDataset(CommandText).Tables[0]; dataProvider.Close(); for (int i = 0; i < dt.Rows.Count; i++) { tempcontent = ReadHtml(dt.Rows[i]["TemplatePath"].ToString()); ReplacelistLabels(); WriteHtmls(tempcontent, System.Web.HttpContext.Current.Request.PhysicalApplicationPath + dt.Rows[i]["ReleasePath"].ToString()); } return true; } catch { if (!dataProvider.IsClosed) dataProvider.Close(); return false; } }