protected void lbopen_Command(object sender, CommandEventArgs e) { string id = e.CommandArgument.ToString(); Cms.BLL.wx_ConcernReply bllarticle = new Cms.BLL.wx_ConcernReply(); Cms.Model.wx_ConcernReply modelarticle = new Cms.Model.wx_ConcernReply(); modelarticle = bllarticle.GetModel(int.Parse(id)); bool bl = false; if (modelarticle != null) { int isRecommend = int.Parse(modelarticle.isopen.ToString()); if (isRecommend == 1) { isRecommend = 0; } else { bl = true; isRecommend = 1; string strSql = "update wx_ConcernReply set isopen=0 where id not in(" + id + ")"; DbHelperSQL.ExecuteSql(strSql); } modelarticle.isopen = isRecommend; bllarticle.Update(modelarticle); Bind(); } if (bl) { adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "微信开通成功:" + bllarticle.GetModel(int.Parse(id)).title); //记录日志 JscriptMsg("开通成功!", "CReplylist.aspx", "Success"); } else { JscriptMsg("取消开通!", "CReplylist.aspx", "Success"); } }
public void bind_date(int _id) { Cms.BLL.wx_ConcernReply bll = new Cms.BLL.wx_ConcernReply(); DataTable dt = bll.GetList("id=" + _id).Tables[0]; if (dt.Rows.Count > 0) { string type = dt.Rows[0]["typeid"].ToString(); string isopen = dt.Rows[0]["isopen"].ToString(); if (type == "0") { rbtype.Items[0].Selected = true; } if (type == "1") { rbtype.Items[1].Selected = true; photoUrl.Text = dt.Rows[0]["fileurl"].ToString(); } if (type == "2") { rbtype.Items[2].Selected = true; Attachment.Value = dt.Rows[0]["fileurl"].ToString(); } if (isopen == "0") { rbopen.Items[0].Selected = true; } else { rbopen.Items[1].Selected = true; } tbinfo.Value = dt.Rows[0]["contents"].ToString(); tburl.Text = dt.Rows[0]["url"].ToString(); tbtilte.Text = dt.Rows[0]["title"].ToString(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { Cms.BLL.wx_ConcernReply bll = new Cms.BLL.wx_ConcernReply(); Cms.Model.wx_ConcernReply bml = new Cms.Model.wx_ConcernReply(); string action = this.Request.QueryString["action"] ?? "";//编辑:edit 添加:add int id = Convert.ToInt32(this.Request.QueryString["id"] ?? "0"); bool bl = false; bool bls = true; string channel_name = "文本"; string urlhot = Request.Url.Host.ToString(); if (action == "add") { bml.typeid = int.Parse(rbtype.SelectedValue.ToString()); bml.url = tburl.Text.Trim(); bml.title = tbtilte.Text.Trim(); if (urlhot.IndexOf("http") > -1 || urlhot.IndexOf("HTTP") > -1 || urlhot.IndexOf("https") > -1 || urlhot.IndexOf("HTTPS") > -1) { } else { urlhot = "http://" + urlhot; } if (rbtype.SelectedValue.ToString() == "1") { channel_name = "图文"; bml.fileurl = urlhot + photoUrl.Text; } if (rbtype.SelectedValue.ToString() == "2") { channel_name = "语音"; bml.fileurl = Attachment.Value; string media_id = HttpUploadFile(bml.fileurl); if (media_id.Length < 40) { bls = false; } bml.media_id = media_id; } bml.contents = tbinfo.Value; bml.updatetime = DateTime.Now; bml.isopen = int.Parse(rbopen.SelectedValue.ToString()); bl = bll.Add(bml) > 0 ? true : false; adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "微信:" + bml.title); //记录日志 } else { bml = bll.GetModel(id); bml.typeid = int.Parse(rbtype.SelectedValue.ToString()); bml.url = tburl.Text.Trim(); bml.title = tbtilte.Text.Trim(); if (rbtype.SelectedValue.ToString() == "1") { if (photoUrl.Text.IndexOf("http") > -1 || photoUrl.Text.IndexOf("HTTP") > -1 || photoUrl.Text.IndexOf("https") > -1 || photoUrl.Text.IndexOf("HTTPS") > -1) { urlhot = ""; } else { urlhot = "http://" + urlhot; } bml.fileurl = urlhot + photoUrl.Text; channel_name = "图文"; } if (rbtype.SelectedValue.ToString() == "2") { channel_name = "语音"; bml.fileurl = Attachment.Value; string media_id = HttpUploadFile(bml.fileurl); if (media_id.Length < 40) { bls = false; } bml.media_id = media_id; } bml.contents = tbinfo.Value; if (rbopen.SelectedValue.ToString() == "1") { string strSql = "update wx_ConcernReply set isopen=0 where id not in(" + id + ")"; DbHelperSQL.ExecuteSql(strSql); } bml.updatetime = DateTime.Now; bml.isopen = int.Parse(rbopen.SelectedValue.ToString()); bl = bll.Update(bml); adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "微信:" + bml.title); //记录日志 } if (bl && bls) { if (action == "add") { adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加" + channel_name); //记录日志 ShowConfirm("是否继续添加?", "CReplyedit.aspx?action=add", "CReplylist.aspx"); } else { adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改" + channel_name); //记录日志 JscriptMsg("提交成功!", "CReplylist.aspx", "Success"); } } else { JscriptMsg("提交失败!", "CReplyedit.aspx?action=edit?id=" + id, "Error"); } }