protected void sendButton_Click(object sender, EventArgs e) { M_Blog_Msg model = FillMsg(MsgContent_T.Value, Mid); msgBll.Insert(model); MsgContent_T.Value = ""; MyBind(); }
protected void SaveContent_Click(object sender, EventArgs e) { M_Blog_Msg msgMod = FillMsg(Content_T.Text); msgBll.Insert(msgMod); Response.Redirect("/Plat/Blog/"); }
//protected void Type_SelectedIndexChanged(object sender, EventArgs e) //{ // int modelID = DataConvert.CLng(Type.SelectedValue.ToString()); // if (modelID > 0) // { // mmis = bmis.SelReturnModel(modelID); // Content.Text = mmis.ModelContent; // } // else // { // Content.Text = ""; // } //} //protected void proDP_SelectedIndexChanged(object sender, EventArgs e) //{ // if (proDP.SelectedIndex == 0) return; // int proID = DataConvert.CLng(proDP.SelectedValue); // proMod = proBll.SelReturnModel(proID); // if (proMod.AllowAttach == 1) // { // upFileTR.Visible = true; // } //} //保存 #endregion protected void saveBtn_Click(object sender, EventArgs e) { int proID = DataConverter.CLng(proDP.SelectedValue); if (Request.QueryString["Edit"] == "1" && Request.QueryString["appID"] != "") { moa = boa.SelReturnModel(DataConvert.CLng(Request.QueryString["appID"])); FillMod(0, moa); boa.UpdateByID(moa); } else { moa = FillMod(0); moa.ID = boa.insert(moa); } M_MisProcedure proceMod = proBll.SelReturnModel(moa.ProID); oaCom.CreateStep(moa, proceMod, new OAStepParam() { IsFirst = true, ReferUser = RUserID_Hid.Value, StepNum = 1 }); { //同步入能力中心 M_User_Plat upMod = B_User_Plat.GetLogin(); if (upMod != null) { B_Blog_Msg msgBll = new B_Blog_Msg(); M_Blog_Msg msgMod = new M_Blog_Msg(); msgMod.CompID = upMod.CompID; msgMod.CUser = upMod.UserID; msgMod.CUName = upMod.TrueName; msgMod.MsgContent = "[" + upMod.TrueName + "]发布了一条公文,标题:<a href=\"/Office/Office/ReadOffice.aspx?AppID=" + moa.ID + "\" target=\"_blank\">" + moa.Title + "</a>"; msgMod.GroupIDS = ""; msgBll.Insert(msgMod); } } Response.Redirect("ViewDrafting.aspx?ID=" + moa.ID); }
protected void Sure_Btn_Click(object sender, EventArgs e) { string addr = Pos_Hid.Value + " " + Request.Form["add_rad"]; string content = "<i class='fa fa-map-marker'></i><a href='/Plat/Blog?Skey=" + HttpUtility.UrlEncode("地理位置签到") + "' title='话题浏览'>地理位置签到</a>:"; content += "<a href='/Plat/Blog/MapByPoint.aspx?Point=" + Point_Hid.Value + "' class='hidden-lg hidden-md'>" + addr + "</a>"; content += "<a href=\"javascript:;\" onclick=\'ShowByPoint(" + Point_Hid.Value + ");\' class='hidden-xs hidden-sm'>" + addr + "</a>"; content += "<br />" + HttpUtility.HtmlEncode(Msg_T.Text); M_Blog_Msg msgMod = FillMsg(content); msgBll.Insert(msgMod); switch (Source) { case "mobile": Response.Redirect("/Plat/Blog/Default.aspx"); break; case "pc": default: function.Script(this, "Signed();"); break; } }
protected void EBtnSubmit_Click(object sender, EventArgs e)//添加文章 { M_UserInfo mu = buser.GetLogin(); M_Node nodeMod = nodeBll.SelReturnModel(NodeID); IList <string> content = new List <string>(); M_CommonData CData = new M_CommonData(); DataTable dt = mfieldBll.SelByModelID(ModelID, false); Call commonCall = new Call(); DataTable table = commonCall.GetDTFromPage(dt, Page, ViewState, content); if (GeneralID > 0) { CData = contentBll.GetCommonData(GeneralID); } else { CData.NodeID = NodeID; CData.ModelID = ModelID; CData.TableName = modelBll.GetModelById(CData.ModelID).TableName; } CData.Title = txtTitle.Text.Trim(); CData.EliteLevel = 0; CData.InfoID = ""; CData.UpDateType = 2; CData.TagKey = Request.Form["tabinput"]; CData.Status = nodeMod.SiteContentAudit; CData.DefaultSkins = 0; string parentTree = ""; CData.FirstNodeID = nodeBll.SelFirstNodeID(NodeID, ref parentTree); CData.ParentTree = parentTree; CData.TitleStyle = ThreadStyle.Value; //CData.TopImg = Request.Form["selectpic"];//首页图片 CData.Subtitle = Subtitle.Text; CData.PYtitle = PYtitle.Text; CData.RelatedIDS = RelatedIDS_Hid.Value; CData.IsComm = 1; if (GeneralID > 0)//修改内容 { contentBll.UpdateContent(table, CData); } else { CData.Inputer = mu.UserName; CData.GeneralID = contentBll.AddContent(table, CData); //插入信息给两个表,主表和从表:CData-主表的模型,table-从表 } if (GeneralID <= 0) //添加时增加积分 { //积分 if (SiteConfig.UserConfig.InfoRule > 0) { buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { UserID = mu.UserID, detail = "添加内容:" + txtTitle.Text + "增加积分", score = SiteConfig.UserConfig.InfoRule, ScoreType = (int)M_UserExpHis.SType.Point }); } } if (true)//nodeMod.CUName.Equals("能力中心") { M_Blog_Msg msgMod = new M_Blog_Msg(); M_User_Plat upMod = B_User_Plat.GetLogin(); //M_Common_Notify comMod = new M_Common_Notify(); B_Blog_Msg msgBll = new B_Blog_Msg(); //B_Common_Notify comBll = new B_Common_Notify(); RegexHelper regHelper = new RegexHelper(); string msg = "#" + nodeMod.NodeName + "#[" + upMod.TrueName + "]发布了[<a href='/Item/" + CData.GeneralID + ".aspx' title='点击访问'>" + CData.Title + "</a>]"; string deftopic = "#插入话题#"; if (msg.Contains("#")) { msg = msg.Replace(deftopic, ""); string tlp = "<a href='/Plat/Blog?Skey={0}' title='话题浏览'>{1}</a>"; Dictionary <string, string> itemDic = new Dictionary <string, string>(); for (int i = 0; !string.IsNullOrEmpty(regHelper.GetValueBySE(msg, "#", "#", false)) && i < 5; i++)//最多不能超过5个话题 { string topic = "#" + regHelper.GetValueBySE(msg, "#", "#", false) + "#"; msg = msg.Replace(topic, "{" + i + "}"); topic = topic.Replace(" ", "").Replace(",", ""); itemDic.Add("{" + i + "}", string.Format(tlp, Server.UrlEncode(topic), topic)); msgMod.Topic += topic + ","; } foreach (var item in itemDic) { msg = msg.Replace(item.Key, item.Value); } } msgMod.MsgType = 1; msgMod.Status = 1; msgMod.CUser = upMod.UserID; msgMod.CUName = upMod.TrueName; msgMod.CompID = upMod.CompID; msgMod.ProID = 0; msgMod.pid = 0; msgMod.ReplyID = 0; msgMod.GroupIDS = ""; msgMod.ColledIDS = ""; msgMod.MsgContent = msg; msgMod.Title = CData.Title; msgMod.ID = msgBll.Insert(msgMod); } function.WriteSuccessMsg("操作成功!", "MyContent.aspx?NodeID=" + NodeID); }
protected void Page_Load(object sender, EventArgs e) { #region AJAX请求 //正数为消息,负数为贴吧 if (function.isAjax()) { string action = Request["action"]; string result = ""; int id = DataConvert.CLng(Regex.Split(Request["value"] ?? "", ":::")[0]); //思路,信息都存在贴吧中,ID为负数 switch (action) { case "add": { string puremsg = ""; msgMod = FillMsg(Request.Form["MsgContent_T"], out puremsg); result = msgBll.Insert(msgMod).ToString(); #region 步至微博 if (!string.IsNullOrWhiteSpace(Request.Form["sync_chk"])) { puremsg = StringHelper.SubStr(puremsg, 140, ""); string sync = Request.Form["sync_chk"]; M_UserInfo mu = buser.GetLogin(); M_User_Token tokenMod = tokenBll.SelModelByUid(mu.UserID); if (tokenMod != null) { try { if (sync.Contains("qqblog") && !string.IsNullOrWhiteSpace(tokenMod.QQToken)) { qqBll = new QQHelper(tokenMod.QQToken, tokenMod.QQOpenID); if (!string.IsNullOrEmpty(msgMod.Attach)) { qqBll.AddBlog(puremsg, msgMod.Attach.Split('|')[0]); } else { qqBll.AddBlog(puremsg); } } if (sync.Contains("sina") && !string.IsNullOrWhiteSpace(tokenMod.SinaToken)) { sinaBll = new SinaHelper(tokenMod.SinaToken); string err = sinaBll.PostStatus(puremsg, (msgMod.Attach ?? "").Split('|')[0]); ZLLog.L(err); } } catch (Exception ex) { ZLLog.L("[" + sync + "]同步失败,用户[" + mu.UserName + "]原因:" + ex.Message); } } } #endregion } break; case "addvote": { msgMod = FillMsg(Request.Form["MsgContent_T"]); msgMod.MsgType = 2; msgMod.Title = HttpUtility.HtmlEncode(VoteTitle_T.Text); msgMod.VoteOP = Request.Form["VoteOption_T1"] + "," + Request.Form["VoteOption_T"]; //为Jquery验证 msgMod.VoteOP = HttpUtility.HtmlEncode(msgMod.VoteOP); msgMod.VoteResult = ""; msgMod.EndTime = DateTime.Parse(EndDate_T.Text); result = msgBll.Insert(msgMod).ToString(); } break; case "addarticle": //里面包含html|图片|附件,暂不同步微博 { string msg = Request.Form["msg"]; UEHelper ueHelper = new UEHelper(); msgMod = FillMsg(""); msgMod.MsgContent = msg; msgMod.MsgType = 3; msgMod.Title = ueHelper.GetSubTitle(msgMod.MsgContent); result = msgBll.Insert(msgMod).ToString(); } break; case "AddReply": case "AddReply2": if (id == 0) { throw new Exception("传入的ID不正确"); } result = PlatAJAX(); break; case "UserVote": result = PlatAJAX(); break; default: if (id == 0) { throw new Exception("信息ID不正确"); } if (id > 0) { result = PlatAJAX(); } else { result = BarAJAX(); } break; } Response.Write(result); Response.Flush(); Response.End(); } #endregion if (!IsPostBack) { MyBind(); } }
public ContentResult Blog_API() { //正数为plat,负数为bar string action = GetParam("action"); string result = ""; int id = DataConvert.CLng(Regex.Split(GetParam("value"), ":::")[0]); //思路,信息都存在贴吧中,ID为负数 switch (action) { case "add": { string puremsg = ""; msgMod = FillMsg(Request.Form["MsgContent_T"], out puremsg); result = msgBll.Insert(msgMod).ToString(); #region 步至微博 if (!string.IsNullOrWhiteSpace(Request.Form["sync_chk"])) { puremsg = StringHelper.SubStr(puremsg, 140, ""); string sync = Request.Form["sync_chk"]; M_User_Token tokenMod = tokenBll.SelModelByUid(mu.UserID); if (tokenMod != null) { try { if (sync.Contains("sina") && !string.IsNullOrWhiteSpace(tokenMod.SinaToken)) { //sinaBll = new SinaHelper(tokenMod.SinaToken); //string err = sinaBll.PostStatus(puremsg, (msgMod.Attach ?? "").Split('|')[0]); //ZLLog.L(err); } } catch (Exception ex) { ZLLog.L("[" + sync + "]同步失败,用户[" + mu.UserName + "]原因:" + ex.Message); } } } #endregion } break; case "addvote": { msgMod = FillMsg(Request.Form["MsgContent_T"]); msgMod.MsgType = 2; msgMod.Title = HttpUtility.HtmlEncode(GetParam("VoteTitle_T")); msgMod.VoteOP = Request.Form["VoteOption_T1"] + "," + Request.Form["VoteOption_T"]; //为Jquery验证 msgMod.VoteOP = HttpUtility.HtmlEncode(msgMod.VoteOP); msgMod.VoteResult = ""; msgMod.EndTime = DateTime.Parse(GetParam("EndDate_T")); result = msgBll.Insert(msgMod).ToString(); } break; case "addarticle": //里面包含html|图片|附件,暂不同步微博 { string msg = GetParam("msg"); UEHelper ueHelper = new UEHelper(); msgMod = FillMsg(""); msgMod.MsgContent = msg; msgMod.MsgType = 3; msgMod.Title = ueHelper.GetSubTitle(msgMod.MsgContent); result = msgBll.Insert(msgMod).ToString(); } break; case "AddReply": case "AddReply2": if (id == 0) { throw new Exception("传入的ID不正确"); } result = PlatAJAX(); break; case "UserVote": result = PlatAJAX(); break; default: if (id == 0) { throw new Exception("信息ID不正确"); } if (id > 0) { result = PlatAJAX(); } else { result = BarAJAX(); } break; } return(Content(result)); }