private bool DoEdit(int _id) { bool result = false; BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); model.account_id = Utils.StrToInt(ddlAccountId.SelectedValue, 0); model.keywords = txtKeywords.Text.Trim(); model.is_like_query = Utils.StrToInt(rblIsLikeQuery.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); List <Model.weixin_request_content> ls = new List <Model.weixin_request_content>(); ls.Add(new Model.weixin_request_content() { account_id = model.account_id, rule_id = model.id, content = txtContent.Text.Trim() }); model.contents = ls; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改微信文本回复,关健字:" + model.keywords); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); txtKeywords.Text = model.keywords; rblIsLikeQuery.SelectedValue = model.is_like_query.ToString(); txtSortId.Text = model.sort_id.ToString(); txtContent.Text = model.contents[0].content; }
private bool DoEdit(int _id) { bool result = false; BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); model.account_id = Utils.StrToInt(ddlAccountId.SelectedValue, 0); model.keywords = txtKeywords.Text.Trim(); model.is_like_query = Utils.StrToInt(rblIsLikeQuery.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); #region 赋值规则图片 string[] itemIdArr = Request.Form.GetValues("item_id"); string[] itemTitleArr = Request.Form.GetValues("item_title"); string[] itemContentArr = Request.Form.GetValues("item_content"); string[] itemImgUrlArr = Request.Form.GetValues("item_imgurl"); string[] itemLinkUrlArr = Request.Form.GetValues("item_linkurl"); string[] itemSortIdArr = Request.Form.GetValues("item_sortid"); if (itemIdArr != null && itemTitleArr != null && itemImgUrlArr != null && itemLinkUrlArr != null && itemSortIdArr != null && itemContentArr != null) { if ((itemIdArr.Length == itemTitleArr.Length) && (itemTitleArr.Length == itemImgUrlArr.Length) && (itemImgUrlArr.Length == itemLinkUrlArr.Length) && (itemLinkUrlArr.Length == itemSortIdArr.Length) && (itemSortIdArr.Length == itemContentArr.Length)) { List <Model.weixin_request_content> ls = new List <Model.weixin_request_content>(); for (int i = 0; i < itemIdArr.Length; i++) { Model.weixin_request_content modelt = new Model.weixin_request_content(); modelt.id = Utils.StrToInt(itemIdArr[i].Trim(), 0); modelt.rule_id = model.id; modelt.account_id = model.account_id; modelt.title = itemTitleArr[i].Trim(); modelt.content = itemContentArr[i].Trim(); modelt.img_url = itemImgUrlArr[i].Trim(); modelt.link_url = itemLinkUrlArr[i].Trim(); modelt.sort_id = Utils.StrToInt(itemSortIdArr[i].Trim(), 99); ls.Add(modelt); } model.contents = ls; } } else { model.contents = null; } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改微信图文回复,关健字:" + model.keywords); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); ddlAccountId.SelectedValue = model.account_id.ToString(); ddlAccountId.Enabled = false; txtKeywords.Text = model.keywords; rblIsLikeQuery.SelectedValue = model.is_like_query.ToString(); txtSortId.Text = model.sort_id.ToString(); txtContent.Text = model.contents[0].content; }
private void ShowInfo(int _id) { BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); ddlAccountId.SelectedValue = model.account_id.ToString(); ddlAccountId.Enabled = false; txtKeywords.Text = model.keywords; rblIsLikeQuery.SelectedValue = model.is_like_query.ToString(); txtSortId.Text = model.sort_id.ToString(); rptList.DataSource = model.contents; rptList.DataBind(); }
private void ShowInfo(int _id) { BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); ddlAccountId.SelectedValue = model.account_id.ToString(); ddlAccountId.Enabled = false; txtSortId.Text = model.sort_id.ToString(); txtKeywords.Text = model.keywords; rblIsLikeQuery.SelectedValue = model.is_like_query.ToString(); txtTitle.Text = model.contents[0].title; txtMediaUrl.Text = model.contents[0].media_url; txtContent.Text = model.contents[0].content; }
private bool DoEdit(int _id, out string errmsg) { API.Weixin.Common.CRMComm wxComm = new API.Weixin.Common.CRMComm(); BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); model.account_id = Utils.StrToInt(ddlAccountId.SelectedValue, 0); model.keywords = txtKeywords.Text.Trim(); model.is_like_query = Utils.StrToInt(rblIsLikeQuery.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //判断是否需要重新上传素材 string mediaId = model.contents[0].media_id; if (model.contents[0].img_url != txtImgUrl.Text.Trim()) { if (!string.IsNullOrEmpty(mediaId)) { wxComm.DeleteForeverMedia(model.account_id, mediaId, out errmsg); //删除永久素材 } mediaId = wxComm.UploadForeverMedia(model.account_id, Utils.GetMapPath(txtImgUrl.Text.Trim()), out errmsg); //重新上传素材 } List <Model.weixin_request_content> ls = new List <Model.weixin_request_content>(); ls.Add(new Model.weixin_request_content() { account_id = model.account_id, rule_id = model.id, title = txtTitle.Text.Trim(), img_url = txtImgUrl.Text.Trim(), media_id = mediaId, media_url = txtMediaUrl.Text.Trim(), meida_hd_url = txtMediaUrl.Text.Trim(), content = txtContent.Text.Trim() }); model.contents = ls; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改微信语音回复,关健字:" + model.keywords); //记录日志 errmsg = string.Empty; return(true); } errmsg = "保存过程中出错!"; return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); model.account_id = Utils.StrToInt(ddlAccountId.SelectedValue, 0); model.keywords = txtKeywords.Text.Trim(); model.is_like_query = Utils.StrToInt(rblIsLikeQuery.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); List<Model.weixin_request_content> ls = new List<Model.weixin_request_content>(); ls.Add(new Model.weixin_request_content() { account_id = model.account_id, rule_id = model.id, title = txtTitle.Text.Trim(), media_url = txtMediaUrl.Text.Trim(), content = txtContent.Text.Trim() }); model.contents = ls; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改微信语音回复,关健字:" + model.keywords); //记录日志 result = true; } return result; }
private bool DoEdit(int _id) { bool result = false; BLL.weixin_request_rule bll = new BLL.weixin_request_rule(); Model.weixin_request_rule model = bll.GetModel(_id); model.account_id = Utils.StrToInt(ddlAccountId.SelectedValue, 0); model.keywords = txtKeywords.Text.Trim(); model.is_like_query = Utils.StrToInt(rblIsLikeQuery.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); #region 赋值规则图片 string[] itemIdArr = Request.Form.GetValues("item_id"); string[] itemTitleArr = Request.Form.GetValues("item_title"); string[] itemContentArr = Request.Form.GetValues("item_content"); string[] itemImgUrlArr = Request.Form.GetValues("item_imgurl"); string[] itemLinkUrlArr = Request.Form.GetValues("item_linkurl"); string[] itemSortIdArr = Request.Form.GetValues("item_sortid"); if (itemIdArr != null && itemTitleArr != null && itemImgUrlArr != null && itemLinkUrlArr != null && itemSortIdArr != null && itemContentArr != null) { if ((itemIdArr.Length == itemTitleArr.Length) && (itemTitleArr.Length == itemImgUrlArr.Length) && (itemImgUrlArr.Length == itemLinkUrlArr.Length) && (itemLinkUrlArr.Length == itemSortIdArr.Length) && (itemSortIdArr.Length == itemContentArr.Length)) { List<Model.weixin_request_content> ls = new List<Model.weixin_request_content>(); for (int i = 0; i < itemIdArr.Length; i++) { Model.weixin_request_content modelt = new Model.weixin_request_content(); modelt.id = Utils.StrToInt(itemIdArr[i].Trim(), 0); modelt.rule_id = model.id; modelt.account_id = model.account_id; modelt.title = itemTitleArr[i].Trim(); modelt.content = itemContentArr[i].Trim(); modelt.img_url = itemImgUrlArr[i].Trim(); modelt.link_url = itemLinkUrlArr[i].Trim(); modelt.sort_id = Utils.StrToInt(itemSortIdArr[i].Trim(), 99); ls.Add(modelt); } model.contents = ls; } } else { model.contents = null; } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改微信图文回复,关健字:" + model.keywords); //记录日志 result = true; } return result; }