示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string type = HttpUtil.GetReqStrValue("type");
        //string isSaveFile = HttpUtil.GetReqStrValue("isSaveFile");
        WEC_XX_MESSAGE conf = new WEC_XX_MESSAGE();

        conf.OPENID = HttpUtil.GetReqStrValue("openid");
        conf.OrderBy("ADDTIME DESC");
        WEC_XX_MESSAGE xx_message = BLLTable <WEC_XX_MESSAGE> .GetRowData(new WEC_XX_MESSAGE(), conf);


        if ("0".Equals(type))//Îı¾»Ø¸´
        {
            string          message     = HttpUtil.GetReqStrValue("message");
            WEC_HF_RESPONSE hf_response = new WEC_HF_RESPONSE();
            hf_response.R_CONTENT  = message;
            hf_response.OPENID     = HttpUtil.GetReqStrValue("openid");
            hf_response.ADDTIME    = DateTime.Now;
            hf_response.REQUEST_ID = xx_message.ID;
            hf_response.TYPE       = 0;
            BLLTable <WEC_HF_RESPONSE> .Insert(hf_response, WEC_HF_RESPONSE.Attribute.ID);

            string responseText = "<div class='res right'>" + hf_response.ADDTIME + "<br/>" + hf_response.R_CONTENT + "</div><br/>";
            //  Response.Write("{\"res\":\""+responseText+"\"}");
            responseText = responseText.Replace("\n", "<br/>");
            Response.Write("{\"res\":\"" + responseText + "\"}");

            WeiXinUtil.Factory(this).actificialResponseText(hf_response.OPENID, hf_response.R_CONTENT);
        }
        else if ("1".Equals(type))//ͼƬ»Ø¸´
        {
            HttpFileCollection postedFile = Request.Files;
            string             path       = Request.PhysicalApplicationPath + "UploadFiles\\Res_Pic\\" + userBase2.Curraid;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
            postedFile[0].SaveAs(path + "\\" + filename);

            // WEC_HF_RESPONSE hf_response = new WEC_HF_RESPONSE();
            WEC_HF_RESPONSE hf_response = new WEC_HF_RESPONSE();
            hf_response.R_CONTENT  = "UploadFiles/Res_Pic/" + userBase2.Curraid + "/" + filename;
            hf_response.OPENID     = HttpUtil.GetReqStrValue("openid");
            hf_response.ADDTIME    = DateTime.Now;
            hf_response.REQUEST_ID = xx_message.ID;
            hf_response.TYPE       = 1;
            BLLTable <WEC_HF_RESPONSE> .Insert(hf_response, WEC_HF_RESPONSE.Attribute.ID);

            string responseText = "<div class='res right'>" + hf_response.ADDTIME + "<br/>" + "<img class=\"img\" src='" + WebHelper.GetAppPath() + hf_response.R_CONTENT + "'/>" + "</div><br/>";
            //  Response.Write("{\"res\":\""+responseText+"\"}");
            Response.Write(responseText);
            WeiXinUtil.Factory(this).actificialResponseImg(hf_response.OPENID, path + "\\" + filename);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region//默认隐藏的列
        //hideTableColumnList = new List<AttributeItem>();
        //hideTableColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP1);
        //hideTableColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP2);
        //hideTableColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP3);
        //valObj.LoadAllAttributes(true);//暂时加此代码,以后框架更新将不需要
        //valObj.Remove(hideTableColumnList);

        //hideFindColumnList = new List<AttributeItem>();
        //hideFindColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP1);
        //hideFindColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP2);
        //hideFindColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP3);
        #endregion
        condObj.OrderBy(WEC_XX_MESSAGE.Attribute.ID, Order.Desc);

        if (!IsPostBack)
        {
            btnFind.Text              = LanguageService.GetLanguageString("btnFind", "查询");
            aspPager.PageSize         = 10;
            aspPager.CurrentPageIndex = 1;

            if (!string.IsNullOrEmpty(Request["ids"]))
            {
                WEC_XX_MESSAGE roleOld = new WEC_XX_MESSAGE();
                roleOld.Where(WEC_XX_MESSAGE.Attribute.ID, Request["ids"].ToString());
                listObj = BLLTable <WEC_XX_MESSAGE> .Select(valObj, roleOld);

                for (int i = 0; i < listObj.Count; i++)
                {
                    if (i > 0)
                    {
                        hidOld.Value     += ",";
                        hidInitIDS.Value += ",";
                    }
                    hidOld.Value     += "{ID:'" + listObj[i].ID + "',Name:'" + listObj[i].ID + "'}";//这里的Name用于显示在列表中,请自行重定义。
                    hidInitIDS.Value += listObj[i].ID;
                }
            }
            try
            {
                listObj = BLLTable <WEC_XX_MESSAGE> .SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);

                repList.DataSource = listObj;
                repList.DataBind();
                aspPager.RecordCount = recount;
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string type=HttpUtil.GetReqStrValue("type");
        //string isSaveFile = HttpUtil.GetReqStrValue("isSaveFile");
        WEC_XX_MESSAGE conf = new WEC_XX_MESSAGE();
        conf.OPENID = HttpUtil.GetReqStrValue("openid");
        conf.OrderBy("ADDTIME DESC");
        WEC_XX_MESSAGE xx_message = BLLTable<WEC_XX_MESSAGE>.GetRowData(new WEC_XX_MESSAGE(), conf);

        if("0".Equals(type)){//�ı��ظ�
            string message = HttpUtil.GetReqStrValue("message");
            WEC_HF_RESPONSE hf_response = new WEC_HF_RESPONSE();
            hf_response.R_CONTENT = message;
            hf_response.OPENID = HttpUtil.GetReqStrValue("openid");
            hf_response.ADDTIME = DateTime.Now;
            hf_response.REQUEST_ID = xx_message.ID;
            hf_response.TYPE = 0;
            BLLTable<WEC_HF_RESPONSE>.Insert(hf_response, WEC_HF_RESPONSE.Attribute.ID);
            string responseText = "<div class='res right'>" + hf_response.ADDTIME + "<br/>" + hf_response.R_CONTENT + "</div><br/>";
          //  Response.Write("{\"res\":\""+responseText+"\"}");
           responseText= responseText.Replace("\n","<br/>");
           Response.Write("{\"res\":\"" + responseText + "\"}");

            WeiXinUtil.Factory(this).actificialResponseText(hf_response.OPENID, hf_response.R_CONTENT);
        }
        else if ("1".Equals(type))//ͼƬ�ظ�
        {

            HttpFileCollection postedFile = Request.Files;
            string path = Request.PhysicalApplicationPath + "UploadFiles\\Res_Pic\\" + userBase2.Curraid;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
            postedFile[0].SaveAs(path + "\\" + filename);

           // WEC_HF_RESPONSE hf_response = new WEC_HF_RESPONSE();
            WEC_HF_RESPONSE hf_response = new WEC_HF_RESPONSE();
            hf_response.R_CONTENT = "UploadFiles/Res_Pic/" + userBase2.Curraid + "/" + filename;
            hf_response.OPENID = HttpUtil.GetReqStrValue("openid");
            hf_response.ADDTIME = DateTime.Now;
            hf_response.REQUEST_ID = xx_message.ID;
            hf_response.TYPE = 1;
            BLLTable<WEC_HF_RESPONSE>.Insert(hf_response, WEC_HF_RESPONSE.Attribute.ID);
            string responseText = "<div class='res right'>" + hf_response.ADDTIME + "<br/>" + "<img class=\"img\" src='" +WebHelper.GetAppPath()+hf_response.R_CONTENT+ "'/>" + "</div><br/>";
            //  Response.Write("{\"res\":\""+responseText+"\"}");
            Response.Write(responseText);
            WeiXinUtil.Factory(this).actificialResponseImg(hf_response.OPENID, path + "\\" + filename);

        }
    }
示例#4
0
    /// <summary>
    /// 保存用户信息
    /// ygh 2014/3/16
    /// </summary>
    /// <param name="openid"></param>
    /// <param name="type"></param>
    /// <param name="content"></param>
    /// <param name="channelid"></param>
    public void saveUserMessage(string openid, int type, string content, int channelid, string toUserName)
    {
        string access_token = HttpUtil.getAccessToken(this.APPID, this.APPSECRET);
        string user_info    = HttpUtil.httpForm("", "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + access_token + "&openid=" + openid + "&lang=zh_CN", "GET");

        JavaScriptSerializer        jss = new JavaScriptSerializer();
        Dictionary <string, object> map = (Dictionary <string, object>)jss.DeserializeObject(user_info);
        WEC_XX_MESSAGE message          = new WEC_XX_MESSAGE();

        message.OPENID = openid;

        message.TYPE = type;
        WEC_PUBLICLIST conf = new WEC_PUBLICLIST();

        conf.PLC_SOURCEID = toUserName;
        WEC_PUBLICLIST publiclist = BLLTable <WEC_PUBLICLIST> .GetRowData(new WEC_PUBLICLIST(), conf);

        message.AID     = publiclist.AID;//公众号编号,
        message.ADDTIME = DateTime.Now;

        if (type != 1)
        {
            if (map.ContainsKey("province"))
            {
                message.PROVINCE   = (string)map["province"];
                message.CITY       = (string)map["city"];
                message.COUNTRY    = (string)map["country"];
                message.HEADIMGURL = (string)map["headimgurl"];
                message.CHANNELID  = channelid;
            }
        }
        if (type == 2 || type == 3)
        {
            message.S_CONTENT = content;
            WEC_WZ_LOCATION conf2 = new WEC_WZ_LOCATION();
            conf2.OPENID      = openid;
            conf2.af_WhereSQL = " ORDER BY ADDTIME";
            WEC_WZ_LOCATION location = BLLTable <WEC_WZ_LOCATION> .GetRowData(new WEC_WZ_LOCATION(), conf2);

            if (location != null)
            {
                message.LATITUDE  = location.LATITUDE;
                message.LONGITUDE = location.LONGITUDE;
                message.PRECISION = location.PRECISION;
                message.CHANNELID = channelid;
            }
        }
        BLLTable <WEC_XX_MESSAGE> .Insert(message, WEC_XX_MESSAGE.Attribute.ID);
    }
 protected void aspPager_PageChanged(object sender, EventArgs e)
 {
     try
     {
         recount = aspPager.RecordCount;
         if (hidCondition.Value != "")
         {
             condObj = JsonServiceBase.FromJson<WEC_XX_MESSAGE>(hidCondition.Value);
         }
         List<WEC_XX_MESSAGE> listVal = BLLTable<WEC_XX_MESSAGE>.SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount);
         repList.DataSource = listVal;
         repList.DataBind();
     }
     catch (Exception ex)
     {
          litWarn.Text = ex.Message;
     }
 }
    protected void aspPager_PageChanged(object sender, EventArgs e)
    {
        try
        {
            if (hidCondition.Value != "")
            {
                condObj = JsonServiceBase.FromJson <WEC_XX_MESSAGE>(hidCondition.Value);
            }
            listObj = BLLTable <WEC_XX_MESSAGE> .SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount);

            repCus.DataSource = listObj;
            repCus.DataBind();
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new WEC_XX_MESSAGE();


        if (txtID.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.ID, Convert.ToDecimal(txtID.Value));
        }


        if (txtOPENID.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.OPENID, Convert.ToString(txtOPENID.Value));
        }


        if (txtTYPE.Value != "")
        {
            condObj.TYPE = Convert.ToInt32(txtTYPE.Value);
        }


        if (txtS_CONTENT.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.S_CONTENT, Convert.ToString(txtS_CONTENT.Value));
        }


        if (txtADDTIME.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.ADDTIME, Convert.ToDateTime(txtADDTIME.Value));
        }


        if (txtISCOLLECT.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.ISCOLLECT, Convert.ToString(txtISCOLLECT.Value));
        }


        if (txtLATITUDE.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.LATITUDE, Convert.ToString(txtLATITUDE.Value));
        }


        if (txtLONGITUDE.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.LONGITUDE, Convert.ToString(txtLONGITUDE.Value));
        }


        if (txtPRECISION.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.PRECISION, Convert.ToString(txtPRECISION.Value));
        }


        if (txtCITY.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.CITY, Convert.ToString(txtCITY.Value));
        }


        if (txtPROVINCE.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.PROVINCE, Convert.ToString(txtPROVINCE.Value));
        }


        if (txtCOUNTRY.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.COUNTRY, Convert.ToString(txtCOUNTRY.Value));
        }


        if (txtHEADIMGURL.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.HEADIMGURL, Convert.ToString(txtHEADIMGURL.Value));
        }


        if (txtCHANNELID.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.CHANNELID, Convert.ToDecimal(txtCHANNELID.Value));
        }


        if (txtAID.Value != "")
        {
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.AID, Convert.ToDecimal(txtAID.Value));
        }

        try
        {
            hidCondition.Value = condObj.ToJson(20);

            listObj = BLLTable <WEC_XX_MESSAGE> .SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);

            repList.DataSource = listObj;
            repList.DataBind();
        }
        catch (Exception ex)
        {
            litWarn.Text = ex.Message;
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        condObj = new WEC_XX_MESSAGE();

        if(txtID.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.ID, Convert.ToDecimal(txtID.Value));

        if(txtOPENID.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.OPENID, Convert.ToString(txtOPENID.Value));

        if(txtTYPE.Value !="" )
            condObj.TYPE = Convert.ToInt32(txtTYPE.Value);

        if(txtS_CONTENT.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.S_CONTENT, Convert.ToString(txtS_CONTENT.Value));

        if(txtADDTIME.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.ADDTIME, Convert.ToDateTime(txtADDTIME.Value));

        if(txtISCOLLECT.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.ISCOLLECT, Convert.ToString(txtISCOLLECT.Value));

        if(txtLATITUDE.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.LATITUDE, Convert.ToString(txtLATITUDE.Value));

        if(txtLONGITUDE.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.LONGITUDE, Convert.ToString(txtLONGITUDE.Value));

        if(txtPRECISION.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.PRECISION, Convert.ToString(txtPRECISION.Value));

        if(txtCITY.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.CITY, Convert.ToString(txtCITY.Value));

        if(txtPROVINCE.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.PROVINCE, Convert.ToString(txtPROVINCE.Value));

        if(txtCOUNTRY.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.COUNTRY, Convert.ToString(txtCOUNTRY.Value));

        if(txtHEADIMGURL.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.HEADIMGURL, Convert.ToString(txtHEADIMGURL.Value));

        if(txtCHANNELID.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.CHANNELID, Convert.ToDecimal(txtCHANNELID.Value));

        if(txtAID.Value !="" )
            condObj.Like_OR(WEC_XX_MESSAGE.Attribute.AID, Convert.ToDecimal(txtAID.Value));

        try
        {
            hidCondition.Value = condObj.ToJson(20);

            listObj = BLLTable<WEC_XX_MESSAGE>.SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);
            repList.DataSource = listObj;
            repList.DataBind();
        }
        catch (Exception ex)
        {
             litWarn.Text = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region//Ĭ�����ص���
        //hideTableColumnList = new List<AttributeItem>();
        //hideTableColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP1);
        //hideTableColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP2);
        //hideTableColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP3);
        //valObj.LoadAllAttributes(true);//��ʱ�Ӵ˴��룬�Ժ��ܸ��½�����Ҫ
        //valObj.Remove(hideTableColumnList);

        //hideFindColumnList = new List<AttributeItem>();
        //hideFindColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP1);
        //hideFindColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP2);
        //hideFindColumnList.Add(WEC_XX_MESSAGE.Attribute.EXP3);
        #endregion
        condObj.OrderBy(WEC_XX_MESSAGE.Attribute.ID, Order.Desc);

        if (!IsPostBack)
        {
            btnFind.Text = LanguageService.GetLanguageString("btnFind", "��ѯ");
            aspPager.PageSize = 10;
            aspPager.CurrentPageIndex = 1;

            if (!string.IsNullOrEmpty(Request["ids"]))
            {
                WEC_XX_MESSAGE roleOld = new WEC_XX_MESSAGE();
                roleOld.Where(WEC_XX_MESSAGE.Attribute.ID, Request["ids"].ToString());
                listObj = BLLTable<WEC_XX_MESSAGE>.Select(valObj, roleOld);
                for (int i = 0; i < listObj.Count; i++)
                {
                    if (i > 0)
                    {
                        hidOld.Value += ",";
                        hidInitIDS.Value += ",";
                    }
                    hidOld.Value += "{ID:'" + listObj[i].ID + "',Name:'" + listObj[i].ID + "'}";//�����Name������ʾ���б��У��������ض��塣
                    hidInitIDS.Value += listObj[i].ID;
                }
            }
            try
            {

                listObj = BLLTable<WEC_XX_MESSAGE>.SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount);
                repList.DataSource = listObj;
                repList.DataBind();
                aspPager.RecordCount = recount;
            }
            catch (Exception ex)
            {
                 litWarn.Text = ex.Message;
            }

        }
    }