Пример #1
0
        private void bind()
        {
            string where = "replytype=1";
            List <wx_ReplyMesageInfo> list = BLL.wx_ReplyMesageBLL.GetList(1, where, "");

            if (list != null && list.Count > 0)
            {
                wx_ReplyMesageInfo info = list[0];
                id           = info.ReplyID;
                refid        = info.RefID;
                reftype      = info.RefType;
                txbBody.Text = info.Body;
            }
        }
Пример #2
0
        private void bind()
        {
            if (replyid <= 0)
            {
                Response.Write("<script>alert('replyid错误');history.go(-1);</script>");
                return;
            }
            wx_ReplyMesageInfo info = BLL.wx_ReplyMesageBLL.GetModel(replyid);

            if (info == null || info.ReplyID != replyid)
            {
                Response.Write("<script>alert('不存在对应的数据');history.go(-1);</script>");
                return;
            }
            title = info.Name;
            Repeater1bind();
        }
Пример #3
0
        /// <summary>
        /// 关注事件回复
        /// </summary>
        /// <param name="em">事件类型</param>
        /// <param name="companyid">companyid</param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static string SetReply_Event_subscribe(Event em)
        {
            List <wx_ReplyMesageInfo> Message_list = wx_ReplyMesageBLL.GetList(1, "replytype=1", "");

            if (Message_list == null || Message_list.Count == 0)
            {
                return("");
            }
            wx_ReplyMesageInfo Message = Message_list[0];

            //设置欢迎语句
            if (Message != null && Message.ReplyID > 0)
            {
                return(setReply(em.FromUserName, em.ToUserName, Message.ReplyID));
            }

            return("");
        }
Пример #4
0
        private void bind()
        {
            if (id > 0)
            {
                hfid.Value = id.ToString();
                wx_ReplyMesageInfo info = BLL.wx_ReplyMesageBLL.GetModel(id);

                if (info == null || info.ReplyID != id)
                {
                    Response.Write("<script>alert('不存在对应的数据');history.go(-1);</script>");
                    return;
                }
                txbName.Text           = info.Name;
                ddlState.SelectedValue = info.State.ToString();
                refid        = info.RefID;
                reftype      = info.RefType;
                txbBody.Text = info.Body;
            }
        }
Пример #5
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                int State = int.Parse(ddlState.SelectedValue);
                if (State != 0 && State != 1)
                {
                    Response.Write("<script>parent.fail('状态错误!');</script>");
                    return;
                }


                wx_ReplyMesageInfo model = new wx_ReplyMesageInfo();
                if (id > 0)
                {
                    model = BLL.wx_ReplyMesageBLL.GetModel(id);
                    if (model == null || model.ReplyID != id)
                    {
                        Response.Write("<script>parent.fail('参数id错误!');</script>");
                        return;
                    }
                }
                model.ReplyType = 2;
                model.Name      = txbName.Text.Trim();
                model.State     = int.Parse(ddlState.SelectedValue);
                model.RefType   = Common.Utils.ObjectToint(Request["reftype"]);
                model.Body      = "";
                model.RefID     = 0;

                if (model.RefType == 1)
                {
                    model.Body = txbBody.Text;
                }
                else if (model.RefType == 2)
                {
                    model.RefID = Common.Utils.ObjectToint(Request["refid"]);
                }
                else if (model.RefType == 3)
                {
                    model.RefID = Common.Utils.ObjectToint(Request["refid"]);
                }
                else
                {
                    Response.Write("<script>parent.fail('回复类型错误!');</script>");
                    return;
                }


                int    saveresult = 0;
                string resultmsg  = "";
                if (id > 0)
                {
                    saveresult = BLL.wx_ReplyMesageBLL.update(model, ref resultmsg);
                }
                else
                {
                    model.companyid  = "";
                    model.CreateTime = DateTime.Now;
                    saveresult       = BLL.wx_ReplyMesageBLL.add(model, ref resultmsg);
                }
                if (saveresult > 0)
                {
                    Response.Write("<script>parent.success('提交成功!');</script>");
                }
                else
                {
                    Response.Write("<script>parent.fail('提交失败!" + resultmsg.Replace("'", "").Replace("\r", "").Replace("\n", "") + "');</script>");
                }
            }
            catch (Exception exc)
            {
                Response.Write("<script>parent.fail('提交失败!" + exc.Message.Replace("'", "").Replace("\r", "").Replace("\n", "") + "');</script>");
            }
        }
Пример #6
0
        /// <summary>
        /// 关键字回复
        /// </summary>
        /// <param name="em">事件类型</param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static string SetReply_KeyWord(Text em, string content)
        {
            List <wx_ReplyKeyInfo> keylist = BLL.wx_ReplyKeyBLL.GetList(1, " [Name] like '%" + content + "%'", "");

            if (keylist != null && keylist.Count > 0)
            {
                wx_ReplyMesageInfo Message = wx_ReplyMesageBLL.GetModel(keylist[0].ReplyID);
                //设置欢迎语句
                if (Message != null && Message.ReplyID == keylist[0].ReplyID)
                {
                    return(setReply(em.FromUserName, em.ToUserName, Message.ReplyID));
                }
            }
            return("");

            #region
            //Companys_PayConfigInfo cinfo = Companys_PayConfigBLL.GetModel(companyid);
            //string AppId = ""; string AppSecret = "";
            //if (cinfo != null && cinfo.CompanyId.Equals(companyid))
            //{
            //    AppId = cinfo.AppId;
            //    AppSecret = cinfo.AppSecret;
            //}
            //string strhtml = string.Empty;
            //try
            //{
            //    //FileUtility.WriteLog("companyid:" + companyid + " content:" + content + "\r\n");
            //    List<wx_ReplyKeyInfo> keylist = BLL.wx_ReplyKeyBLL.GetList(1, BLL.DataPermissionBLL.getclientsql(companyid, "") + " AND [Name] like '%" + content + "%'", "");
            //    if (keylist != null && keylist.Count > 0)
            //    {
            //        wx_ReplyMesageInfo Message = wx_ReplyMesageBLL.GetModel(keylist[0].ReplyID);
            //        //设置欢迎语句
            //        if (Message != null && Message.ReplyID == keylist[0].ReplyID)
            //        {
            //            StringBuilder strHtml = new StringBuilder();
            //            string host = "http://" + HttpContext.Current.Request.Url.Host + (HttpContext.Current.Request.Url.Port == 80 ? "" : ":" + HttpContext.Current.Request.Url.Port);
            //            //FileUtility.WriteLog("host:" + host + "\r\n");
            //            if (Message.RefType == 1)
            //            {
            //                strhtml = string.Format(Template.TextTemplate, em.FromUserName, em.ToUserName, Common.GetNowTime(), Message.Body);
            //            }
            //            else
            //            {
            //                //FileUtility.WriteLog("Message.RefID:" + Message.RefID + "\r\n");
            //                //string strlist = wx_MaterialBLL.getjson_appmsg(Message.RefID);
            //                //FileUtility.WriteLog("strlist:" + strlist + "\r\n");
            //                IList<wx_MaterialInfo> list = wx_MaterialBLL.getlist_appmsg(Message.RefID);
            //                //设置欢迎语句
            //                //IList<wx_MaterialInfo> list = JSONHelper.JsonToObject<IList<wx_MaterialInfo>>(strlist);
            //                if (list != null && list.Count > 0)
            //                {
            //                    //FileUtility.WriteLog("list.Count:" + list.Count + "\r\n");
            //                    //1文字,2图片,3图文,4音频,5视频
            //                    switch (list[0].Type)
            //                    {
            //                        case 1:
            //                            strhtml = string.Format(Template.TextTemplate, em.FromUserName, em.ToUserName, Common.GetNowTime(), list[0].Body);
            //                            break;
            //                        case 2:
            //                            strhtml = string.Format(Template.ImageTemplate, em.FromUserName, em.ToUserName, Common.GetNowTime(), Media.GetMediaId(AppId, AppSecret, "image", list[0].Url));
            //                            break;
            //                        case 3:
            //                            foreach (wx_MaterialInfo m in list)
            //                            {
            //                                strHtml.Append(string.Format(Template.ItemTemplate, m.Name, m.Paper, host + m.ImgUrl, host + "/mobile/wx/wx_appmsg.aspx?id=" + m.wx_MaterialID));
            //                            }
            //                            strhtml = string.Format(Template.NewsTemplate, em.FromUserName, em.ToUserName, Common.GetNowTime(), list.Count, strHtml.ToString());
            //                            break;
            //                        case 4:
            //                            strhtml = string.Format(Template.VoiceTemplate, em.FromUserName, em.ToUserName, Common.GetNowTime(), Media.GetMediaId(AppId, AppSecret, "voice", list[0].Url));
            //                            break;
            //                        case 5:
            //                            strhtml = string.Format(Template.VideoTemplate, em.FromUserName, em.ToUserName, Common.GetNowTime(), Media.GetMediaId(AppId, AppSecret, "video", list[0].Url), list[0].Name, list[0].Paper);
            //                            break;
            //                    }
            //                }
            //            }
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            ////FileUtility.WriteLog("文本回复:" + strhtml + "\r\n");
            //return strhtml;
            #endregion
        }
Пример #7
0
        public static string setReply(string FromUserName, string ToUserName, int ReplyID)
        {
            string        AppId = ""; string AppSecret = "";
            wx_configInfo cinfo = wx_configBLL.getInfo();

            if (cinfo != null)
            {
                AppId     = cinfo.AppId;
                AppSecret = cinfo.AppSecret;
            }
            string strhtml = string.Empty;

            try
            {
                wx_ReplyMesageInfo Message = wx_ReplyMesageBLL.GetModel(ReplyID);
                //设置欢迎语句
                if (Message != null && Message.ReplyID == ReplyID)
                {
                    StringBuilder strHtml = new StringBuilder();
                    string        host    = "http://" + HttpContext.Current.Request.Url.Host + (HttpContext.Current.Request.Url.Port == 80 ? "" : ":" + HttpContext.Current.Request.Url.Port);
                    //FileUtility.WriteLog("host:" + host + "\r\n");
                    if (Message.RefType == 1)
                    {
                        strhtml = string.Format(Template.TextTemplate, FromUserName, ToUserName, Common.GetNowTime(), Message.Body);
                    }
                    else
                    {
                        //FileUtility.WriteLog("Message.RefID:" + Message.RefID + "\r\n");
                        IList <wx_MaterialInfo> list = wx_MaterialBLL.getlist_appmsg(Message.RefID);
                        //设置欢迎语句
                        //IList<wx_MaterialInfo> list = JSONHelper.JsonToObject<IList<wx_MaterialInfo>>(strlist);
                        if (list != null && list.Count > 0)
                        {
                            //FileUtility.WriteLog("list.Count:" + list.Count + "\r\n");
                            //1文字,2图片,3图文,4音频,5视频
                            switch (list[0].Type)
                            {
                            case 1:
                                strhtml = string.Format(Template.TextTemplate, FromUserName, ToUserName, Common.GetNowTime(), list[0].Body);
                                break;

                            case 2:
                                strhtml = string.Format(Template.ImageTemplate, FromUserName, ToUserName, Common.GetNowTime(), Media.GetMediaId(AppId, AppSecret, "image", list[0].Url));
                                break;

                            case 3:
                                foreach (wx_MaterialInfo m in list)
                                {
                                    string url = host + "/mobile/wx/wx_appmsg.aspx?id=" + m.wx_MaterialID;
                                    if (m.Url.Trim().Length > 0)
                                    {
                                        url = m.Url;
                                    }
                                    strHtml.Append(string.Format(Template.ItemTemplate, m.Name, m.Paper, host + m.ImgUrl, url));
                                }
                                strhtml = string.Format(Template.NewsTemplate, FromUserName, ToUserName, Common.GetNowTime(), list.Count, strHtml.ToString());
                                break;

                            case 4:
                                strhtml = string.Format(Template.VoiceTemplate, FromUserName, ToUserName, Common.GetNowTime(), Media.GetMediaId(AppId, AppSecret, "voice", list[0].Url));
                                break;

                            case 5:
                                strhtml = string.Format(Template.VideoTemplate, FromUserName, ToUserName, Common.GetNowTime(), Media.GetMediaId(AppId, AppSecret, "video", list[0].Url), list[0].Name, list[0].Paper);
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //FileUtility.WriteLog("文本回复:" + strhtml + "\r\n");
            return(strhtml);
        }