예제 #1
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BLL.redpacket bll = new BLL.redpacket();
            Repeater rptList = new Repeater();
            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "sort_id=" + sortId.ToString());
            }
            JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&keywords={1}&property={2}",
            this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
        }
예제 #2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.redpacket bll = new BLL.redpacket();
            Repeater rptList = new Repeater();
            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    bll.Delete(id);
                }
            }
            JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&keywords={1}&property={2}",
            this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
        }
예제 #3
0
        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;
        }
예제 #4
0
        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;
        }
예제 #5
0
        private bool DoAdd()
        {
            bool result = true;
            Model.redpacket model = new Model.redpacket();
            BLL.redpacket bll = new BLL.redpacket();

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.content = Utils.ToHtml(txtContent.Text);
            model.market_price = decimal.Parse(txtMarketPrice.Text);
            model.sell_price = decimal.Parse(txtSellPrice.Text);
            model.total_count = int.Parse(txtTotal.Text.Trim());
            model.book_count = 0;
            model.img_url =txtImgUrl.Text.Trim();
            model.start_date = txtStartDate.Text.Trim();
            model.end_date = txtEndDate.Text.Trim();
            model.status = string.IsNullOrEmpty(rdoStatus.SelectedValue) ? 0 : int.Parse(rdoStatus.SelectedValue);
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.add_time = DateTime.Now;
            model.is_slide = 0;
            model.is_top = 0;
            model.is_red = 0;
            model.remark1 = "";
            model.remark2 = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_red = 1;
            }

            model.albums = null;

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }
예제 #6
0
        private void ShowInfo(int _id)
        {
            BLL.redpacket bll = new BLL.redpacket();
            Model.redpacket model = bll.GetRedPacketModel(_id);

            txtTitle.Text = model.title;
            txtContent.Text = Utils.ToTxt(model.content);
            txtMarketPrice.Text = model.market_price.ToString();
            txtSellPrice.Text = model.sell_price.ToString();
            txtTotal.Text = model.total_count.ToString();
            txtImgUrl.Text = model.img_url;
            txtStartDate.Text = model.start_date;
            txtEndDate.Text = model.end_date;
            rdoStatus.SelectedValue = model.status.ToString();
            txtSortId.Text = model.sort_id.ToString();

            if (model.is_top == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
        }
예제 #7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);

            this.ddlProperty.SelectedValue = this.property;
            this.txtKeywords.Text = this.keywords;
            //图表或列表显示
            BLL.redpacket bll = new BLL.redpacket();
            this.rptList1.DataSource = bll.GetRedPacketList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList1.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}",
            this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
예제 #8
0
 //设置操作
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //检查权限
     int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
     BLL.redpacket bll = new BLL.redpacket();
     Model.redpacket model = bll.GetRedPacketModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtntop":
             if (model.is_top == 1)
                 bll.UpdateField(id, "is_top=0");
             else
                 bll.UpdateField(id, "is_top=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateField(id, "is_red=0");
             else
                 bll.UpdateField(id, "is_red=1");
             break;
     }
     this.RptBind("id>0" + CombSqlTxt(this.channel_id ,this.keywords, this.property), " status desc,sort_id asc,add_time desc");
 }