private void redpacket_used(HttpContext context)
        {
            string unique_code = DTRequest.GetQueryString("code");
            StringBuilder sb = new StringBuilder();
            if (string.IsNullOrEmpty(unique_code) || unique_code == "unsafe string")
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            BLL.redpacket bll_redpacket = new BLL.redpacket();
            int count = 0;
            DataSet ds_redpacket = bll_redpacket.GetRedPacketList_WebService(1, 1, "unique_code='" + unique_code + "'", "status desc", out count);
            if (ds_redpacket == null || count == 0)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            //验证红包状态
            if (int.Parse(ds_redpacket.Tables[0].Rows[0]["status"].ToString()) != 1)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码状态不符合,请检查消费码状态!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            //验证是否过期
            string start_date =ds_redpacket.Tables[0].Rows[0]["start_date"].ToString();
            string end_date=ds_redpacket.Tables[0].Rows[0]["end_date"].ToString();
            if (DateTime.Now < DateTime.Parse(start_date) || DateTime.Now > DateTime.Parse(end_date))
            {
                sb.Append("  <dl><dt></dt><dd>不在红包有效期内,请检查红包有限期!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            int guid_id = 0;
            int redpacket_id = 0;
            int.TryParse(ds_redpacket.Tables[0].Rows[0]["guid_id"].ToString(), out  guid_id);
            int.TryParse(ds_redpacket.Tables[0].Rows[0]["redpacket_id"].ToString(), out  redpacket_id);
            if (guid_id == 0 || redpacket_id == 0)
            {
                sb.Append("  <dl><dt></dt><dd>数据异常,请联系管理员!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            BLL.redpacket_guid bll_redpacket_guid = new BLL.redpacket_guid();
            if (bll_redpacket_guid.UpdateField(guid_id, redpacket_id, "status=2"))
            {
                sb.Append("  <dl><dt></dt><dd>消费成功!</dd></dl>");
            }
            else
            {
                sb.Append("  <dl><dt></dt><dd>消费失败!</dd></dl>");
            }
            context.Response.Write(sb.ToString());
            return;
        }
        private void redpacket_info(HttpContext context)
        {
            string unique_code = DTRequest.GetQueryString("code");
            StringBuilder sb = new StringBuilder();
            if (string.IsNullOrEmpty(unique_code) || unique_code == "unsafe string")
            {
                sb.Append("  <dl><dt></dt><dd>消费码不能为空!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            BLL.redpacket bll_redpacket = new BLL.redpacket();
            int count = 0;
            DataSet ds_redpacket = bll_redpacket.GetRedPacketList_WebService(1, 1, "unique_code='" + unique_code + "'", "status desc", out count);
            if (ds_redpacket == null || count == 0)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            DataTable dt_redpacket = ds_redpacket.Tables[0];

            BLL.users bll_user = new BLL.users();
            Model.users model_user = bll_user.GetModel(int.Parse(dt_redpacket.Rows[0]["guid_id"].ToString()));
            if (model_user == null)
            {
                sb.Append("  <dl><dt></dt><dd>数据异常,请联系管理员!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            sb.Append("  <dl><dt></dt><dd>红包名称:" + dt_redpacket.Rows[0]["title"] + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>红包状态:" + GetUserStatus(int.Parse(dt_redpacket.Rows[0]["status"].ToString())) + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>有效期:" + dt_redpacket.Rows[0]["start_date"] + "至" + dt_redpacket.Rows[0]["end_date"] + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>会员名:" + model_user.user_name + " (昵称:" + model_user.nick_name + ")</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>工种:" + (model_user.work_type == 1 ? "领队" : "导游") + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>手机号:" + model_user.mobile + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>导游证号:" + model_user.guid_card + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>身份证号:" + model_user.card + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>申请时间:" + dt_redpacket.Rows[0]["apply_time"] + "</dd></dl>");

            context.Response.Write(sb.ToString());
            return;
        }