Exemple #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Trim().Length > 0 && txtPrice.Text.Trim().Length > 0 && txtMaxs.Text.Trim().Length > 0 && ddlCategory.SelectedIndex > -1)
     {
         try
         {
             if (txtCost.Text.Trim().Length == 0)
             {
                 txtCost.Text = "0";
             }
             CouponBLL bll = new CouponBLL();
             if (hidAction.Value.Equals("add"))
             {
                 if (bll.addCommodity(txtName.Text, int.Parse(ddlCategory.SelectedValue), Convert.ToInt32(txtCost.Text), Convert.ToInt32(txtPrice.Text.Trim()), Convert.ToInt32(txtMaxs.Text.Trim()), txtMark.Text, chkPoint.Checked))
                 {
                     Response.Redirect("Commodity.aspx");
                 }
                 else
                 {
                     throw new Exception();
                 }
             }
             else if (hidAction.Value.Equals("edt"))
             {
                 if (bll.setCommodity(Convert.ToInt32(Request.QueryString["id"]), txtName.Text, int.Parse(ddlCategory.SelectedValue), Convert.ToInt32(txtCost.Text), Convert.ToInt32(txtPrice.Text.Trim()), Convert.ToInt32(txtMaxs.Text.Trim()), txtMark.Text, chkPoint.Checked))
                 {
                     Response.Redirect("Commodity.aspx");
                 }
                 else
                 {
                     throw new Exception();
                 }
             }
         }
         catch (FormatException)
         {
             ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('输入数据类型不正确!')</script>");
         }
         catch (Exception)
         {
             ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('操作失败!')</script>");
         }
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('请输入对应数据!(带*为必填项)')</script>");
     }
 }
Exemple #2
0
        /// <summary>
        /// 用户优惠券列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetUserCoupon()
        {
            int couponType = RequestHelper.GetQueryString <int>("userCouponType");
            UserCouponSearchInfo searchInfo = new UserCouponSearchInfo();

            searchInfo.UserId    = uid;
            searchInfo.IsTimeOut = -1;//不限期限有没过期
            //未使用
            if (couponType == 1)
            {
                searchInfo.IsUse     = (int)BoolType.False;
                searchInfo.IsTimeOut = (int)BoolType.False;
            }
            //已使用
            if (couponType == 2)
            {
                searchInfo.IsUse     = (int)BoolType.True;
                searchInfo.IsTimeOut = -1;//不限期限有没过期
            }
            //已过期
            if (couponType == 3)
            {
                searchInfo.IsUse     = (int)BoolType.False;
                searchInfo.IsTimeOut = (int)BoolType.True;
            }

            var ucouponlist = UserCouponBLL.SearchList(searchInfo);

            List <VirtualCoupon> vucoupon = new List <VirtualCoupon>();

            foreach (var item in ucouponlist)
            {
                CouponInfo    tempCoupon = CouponBLL.Read(item.CouponId);
                VirtualCoupon vcou       = new VirtualCoupon()
                {
                    id        = item.Id,
                    name      = tempCoupon.Name,
                    money     = tempCoupon.Money,
                    minmoney  = tempCoupon.UseMinAmount,
                    startdate = tempCoupon.UseStartDate,
                    enddate   = tempCoupon.UseEndDate,
                    isused    = item.IsUse,
                };
                vucoupon.Add(vcou);
            }

            return(Json(new { ucouponlist = vucoupon }, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("SendCoupon", PowerCheckType.Single);
            int sendCount = 0;

            int.TryParse(SendCount.Text.Trim(), out sendCount);
            int    couponID = RequestHelper.GetQueryString <int>("CouponID");
            string sendUser = RequestHelper.GetForm <string>("RelationUser");

            if (sendCount + sendUser.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length > 0)
            {
                CouponInfo     coupon      = CouponBLL.Read(couponID);
                UserCouponInfo userCoupon  = UserCouponBLL.ReadLast(couponID);
                int            startNumber = 0;
                if (userCoupon.Id > 0)
                {
                    string tempNumber = userCoupon.Number.Substring(3, 5);
                    while (tempNumber.Substring(0, 1) == "0")
                    {
                        tempNumber = tempNumber.Substring(1);
                    }
                    startNumber = Convert.ToInt32(tempNumber);
                }
                //如果线上、线下发放数量超过了优惠券剩余量
                if (coupon.UsedCount + sendCount + sendUser.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length > coupon.TotalCount)
                {
                    ScriptHelper.Alert("优惠券剩余量不足");
                }
                else
                {
                    CreateOfflineCoupon(couponID, sendCount, ref startNumber);
                    SeandUserCoupon(couponID, sendUser, ref startNumber);
                    //优惠券发放量增加
                    coupon.UsedCount += sendCount + sendUser.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length;
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    dict.Add("[UsedCount]", coupon.UsedCount);
                    CouponBLL.UpdatePart("[Coupon]", dict, coupon.Id);
                }
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("SendCoupon"), coupon.Id);
                string alertMessage = ShopLanguage.ReadLanguage("SendOK");
                ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
            }
            else
            {
                //ScriptHelper.Alert("请选择在线发放用户或输入线下发放数量");
                ScriptHelper.Alert("请选择在线发放用户");
            }
        }
Exemple #4
0
        protected void btnBuy_Click(object sender, EventArgs e)
        {
            CouponBLL bll = new CouponBLL();

            if (bll.deductPoint(Convert.ToInt32(Request.QueryString["account"]), Convert.ToInt64(labBalance.Text)))
            {
                bll.addPointLog(Convert.ToInt32(Request.QueryString["account"]), Convert.ToInt32(labConmmoid.Text), labCommodity.Text, Convert.ToInt32(labPoint.Text), Convert.ToInt32(txtCount.Text), Convert.ToInt32(labPrice.Text), DateTime.Now);
                ClientScript.RegisterStartupScript(GetType(), "back", "top.closeMoy('dialogBuy');", true);
                //ClientScript.RegisterStartupScript(GetType(), "back", "<script>parent.document.getElementById(\"divClose\").click();</script>");
                //Response.Redirect("Store.aspx?id=" + Request.QueryString["account"] + "&s=true");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "err", "<script>alert('购买失败!');</script>");
            }
        }
Exemple #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] == null)
     {
         Response.Redirect("BNSCoupon.aspx");
     }
     if (!IsPostBack)
     {
         CouponBLL bll = new CouponBLL();
         getAccount(bll, int.Parse(Request.QueryString["id"]));
         gvOrderList.DataSource = getOrderList(bll, int.Parse(Request.QueryString["id"]));
         gvOrderList.DataBind();
         litPager.Text        = (gvOrderList.PageCount > 1) ? ((gvOrderList.PageIndex + 1) + "/" + gvOrderList.PageCount) : "";
         hlkStore.NavigateUrl = "Store.aspx?id=" + Request.QueryString["id"];
     }
 }
Exemple #6
0
        protected void likHidden_Click(object sender, EventArgs e)
        {
            CouponBLL bll = new CouponBLL();

            getAccount(bll, Convert.ToInt32(Request.QueryString["id"]));
            gvOrderList.DataSource = bll.getOrderList(Convert.ToInt32(Request.QueryString["id"]));
            gvOrderList.DataBind();
            if (!ddlCategory.SelectedValue.Equals("0"))
            {
                getData(bll, Convert.ToInt32(ddlCategory.SelectedValue));
            }
            else
            {
                getData(bll, txtKeywords.Text);
            }
        }
Exemple #7
0
        private void getAccount(CouponBLL bll, int id)
        {
            DataSet ds  = bll.getAccountList(id);
            DataRow row = ds.Tables[0].Rows[0];

            txtQQ.Text               = row["qq"].ToString();
            txtPassword.Text         = row["psd"].ToString();
            txtNickName.Text         = row["name"].ToString();
            rblGenders.SelectedValue = row["sex"].ToString();
            setVocation(bll, rblGenders.SelectedValue);
            ddlVocation.SelectedValue = row["vocation"].ToString();
            txtRedate.Text            = Convert.ToDateTime(row["redate"]).ToString("yyyy-MM-dd");
            txtLevel.Text             = row["level"].ToString();
            txtStard.Text             = row["stard"].ToString();
            txtRemark.Text            = row["remark"].ToString();
        }
Exemple #8
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int id = RequestHelper.GetQueryString <int>("Id");

            coupon = CouponBLL.Read(id);
            //如果已经结束或者暂未开始
            if (coupon.UseEndDate.Date < DateTime.Now.Date || coupon.UseStartDate.Date > DateTime.Now.Date)
            {
                isOutOfDate = true;
            }


            Title = coupon.Name + " - 优惠券领取";
        }
Exemple #9
0
        protected void btnBuy_Click(object sender, EventArgs e)
        {
            CouponBLL bll = new CouponBLL();

            if (bll.deductCoupon(Convert.ToInt32(Request.QueryString["account"]), Convert.ToInt64(labBalance.Text)))
            {
                bll.addOrderLog(Convert.ToInt32(Request.QueryString["account"]), 4093, "购买金币(比例 1:" + txtUnit.Text + ")", (int)Convert.ToSingle(txtUnit.Text), Convert.ToInt32(txtCount.Text), Convert.ToInt32(txtPrice.Text), DateTime.Now);
                ClientScript.RegisterStartupScript(GetType(), "back", "top.closeMoy('dialogBuym');", true);
                //ClientScript.RegisterStartupScript(GetType(), "back", "Dialog.getInstance('money_" + Request.QueryString["account"] + "');", true);
                //Response.Redirect("Store.aspx?id=" + Request.QueryString["account"] + "&s=true");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "err", "<script>alert('购买失败!');</script>");
            }
        }
Exemple #10
0
 protected void lnkAddCategory_Click(object sender, EventArgs e)
 {
     if (txtCatename.Text.Trim().Length > 0)
     {
         CouponBLL bll = new CouponBLL();
         if (bll.addCategory(txtCatename.Text.Trim()))
         {
             showCategory(bll);
         }
         txtCatename.Text = string.Empty;
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "varn", "<script>alert('请将数据填写完整!');</script>");
     }
 }
Exemple #11
0
        public string GenerateCoupon(string pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            var rp = pRequest.DeserializeJSONTo <APIRequest <GenerateCouponRP> >();

            rp.Parameters.Validate();

            var rd        = new EmptyRD();
            var couponBLL = new CouponBLL(loggingSessionInfo);

            rd = couponBLL.GenerateCoupon(rp.Parameters);

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
Exemple #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         int queryString = RequestHelper.GetQueryString <int>("ID");
         if (queryString != -2147483648)
         {
             base.CheckAdminPower("ReadCoupon", PowerCheckType.Single);
             CouponInfo info = CouponBLL.ReadCoupon(queryString);
             this.Name.Text         = info.Name;
             this.Money.Text        = info.Money.ToString();
             this.UseMinAmount.Text = info.UseMinAmount.ToString();
             this.UseStartDate.Text = info.UseStartDate.ToString("yyyy-MM-dd");
             this.UseEndDate.Text   = info.UseEndDate.ToString("yyyy-MM-dd");
         }
     }
 }
Exemple #13
0
 protected void lnkAddGender_Click(object sender, EventArgs e)
 {
     if (txtGenderId.Text.Trim().Length > 0 && txtGender.Text.Trim().Length > 0)
     {
         CouponBLL bll = new CouponBLL();
         int       pid = Convert.ToInt32(txtGenderId.Text);
         if (bll.addGender(pid, txtGender.Text))
         {
             showGenders(bll);
         }
         txtGender.Text = txtGenderId.Text = string.Empty;
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "varn", "<script>alert('请将数据填写完整!');</script>");
     }
 }
Exemple #14
0
        private void getCommodity(CouponBLL bll, int id)
        {
            DataSet ds = bll.getCommodityListById(id);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row   = ds.Tables[0].Rows[0];
                long    price = Convert.ToInt32(row["price"]);
                labConmmoid.Text  = row["id"].ToString();
                labCommodity.Text = row["name"].ToString();
                labCategory.Text  = row["catename"].ToString();
                labRemark.Text    = row["mark"].ToString();
                if (Convert.ToBoolean(row["hasPoint"]))
                {
                    hidHasPoint.Value = "Y";
                }
                else
                {
                    hidHasPoint.Value = "N";
                    palPoint.Visible  = false;
                }
                //Changed on 20150829 vbe -start
                if (!row["cost"].Equals(DBNull.Value))
                {
                    int cost = Convert.ToInt32(row["cost"]);
                    if (cost != 0)
                    {
                        trConst.Visible   = true;
                        labCostprice.Text = cost.ToString();
                    }
                    else
                    {
                        trConst.Visible = false;
                    }
                }
                labUnitprice.Text = price.ToString();
                int max = Convert.ToInt32(row["maxs"]);
                btnAdd.Enabled = btnReduce.Enabled = !(max == 0 || max == 1);
                labMaxs.Text   = max.ToString();
                //Changed on 20150829 vbe -stop
                labPrice.Text = price.ToString();
                getPoint(price);
                labBalance.Text = "" + (Convert.ToInt64(labRemaining.Text) - price);
                setButtonState(labRemaining.Text, labPrice.Text);
            }
        }
Exemple #15
0
        private void getCommodity(CouponBLL bll)
        {
            int     id = Convert.ToInt32(Request.QueryString["id"]);
            DataSet ds = bll.getCommodityList(id);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                txtName.Text = row["name"].ToString();
                ddlCategory.SelectedValue = row["category"].ToString();
                txtCost.Text     = row["cost"].ToString();
                txtPrice.Text    = row["price"].ToString();
                txtMaxs.Text     = row["maxs"].ToString();
                txtMark.Text     = row["mark"].ToString();
                chkPoint.Checked = Convert.ToBoolean(row["hasPoint"]);
            }
        }
Exemple #16
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Trim().Length > 0 && txtPrice.Text.Trim().Length > 0 && txtMaxs.Text.Trim().Length > 0)
     {
         try
         {
             CouponBLL bll = new CouponBLL();
             if (hidAction.Value.Equals("add"))
             {
                 if (bll.addPointData(txtName.Text, Convert.ToInt32(txtPrice.Text.Trim()), Convert.ToInt32(txtMaxs.Text.Trim()), txtMark.Text))
                 {
                     Response.Redirect("CommodityPoint.aspx");
                 }
                 else
                 {
                     throw new Exception();
                 }
             }
             else if (hidAction.Value.Equals("edt"))
             {
                 if (bll.updatePointData(Convert.ToInt32(Request.QueryString["id"]), txtName.Text, Convert.ToInt32(txtPrice.Text.Trim()), Convert.ToInt32(txtMaxs.Text.Trim()), txtMark.Text))
                 {
                     Response.Redirect("CommodityPoint.aspx");
                 }
                 else
                 {
                     throw new Exception();
                 }
             }
         }
         catch (FormatException)
         {
             ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('输入数据类型不正确!')</script>");
         }
         catch (Exception)
         {
             ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('操作失败!')</script>");
         }
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('请输入对应数据!(带*为必填项)')</script>");
     }
 }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            CouponInfo coupon = new CouponInfo();

            coupon.Id           = RequestHelper.GetQueryString <int>("ID");
            coupon.Name         = Name.Text;
            coupon.Money        = Convert.ToDecimal(Money.Text);
            coupon.UseMinAmount = Convert.ToDecimal(UseMinAmount.Text);
            coupon.UseStartDate = Convert.ToDateTime(UseStartDate.Text);
            coupon.UseEndDate   = Convert.ToDateTime(UseEndDate.Text).AddDays(1).AddSeconds(-1);
            coupon.Type         = Convert.ToInt32(Type.Text);
            if (coupon.UseEndDate < coupon.UseStartDate)
            {
                ScriptHelper.Alert("结束日期不得小于开始日期");
            }
            if (coupon.Type == (int)CouponKind.Common)
            {//商家优惠券可以设置图片、总数
                coupon.TotalCount = Convert.ToInt32(TotalCount.Text) < 0 ? 0 : Convert.ToInt32(TotalCount.Text);
                coupon.Photo      = Photo.Text.Trim();
            }
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (coupon.Id == int.MinValue)
            {
                CheckAdminPower("AddCoupon", PowerCheckType.Single);
                coupon.Id = CouponBLL.Add(coupon);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Coupon"), coupon.Id);
            }
            else
            {
                CheckAdminPower("UpdateCoupon", PowerCheckType.Single);
                if (coupon.Type == (int)CouponKind.Common)
                {//商家优惠券总数量不能小于已发放量
                    if (coupon.TotalCount < CouponBLL.Read(coupon.Id).UsedCount)
                    {
                        ScriptHelper.Alert("总数不得小于已发放数量");
                    }
                }
                CouponBLL.Update(coupon);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Coupon"), coupon.Id);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
Exemple #18
0
 protected void linkAddWhere_Click(object sender, EventArgs e)
 {
     if (txtMinLevel.Text.Trim().Length > 0 && txtCoupon.Text.Trim().Length > 0)
     {
         if (txtMinStard.Text.Trim().Length <= 0)
         {
             txtMinStard.Text = "0";
         }
         CouponBLL bll = new CouponBLL();
         if (bll.addWhere(txtMinLevel.Text.Trim(), txtMinStard.Text.Trim(), txtCoupon.Text.Trim(), ddlCycle.SelectedValue, txtWhereRemark.Text))
         {
             showWhereList(bll);
         }
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "varn", "<script>alert('请将数据填写完整!');</script>");
     }
 }
Exemple #19
0
        protected void btnCatesave_Click(object sender, EventArgs e)
        {
            LinkButton linkSave   = (LinkButton)sender;
            TableRow   row        = (TableRow)panCategory.FindControl("rowCate" + linkSave.CommandName);
            LinkButton linkUpdate = (LinkButton)row.FindControl("lnkUpdate" + linkSave.CommandName);
            TextBox    text       = (TextBox)row.FindControl("txtCategoryName" + linkSave.CommandName);
            Label      labText    = (Label)row.FindControl("labCategoryName" + linkSave.CommandName);

            if (labText.Text != text.Text)
            {
                CouponBLL bll = new CouponBLL();
                if (bll.updateCategory(int.Parse(linkSave.CommandName), text.Text.Trim()))
                {
                    labText.Text = text.Text;
                }
            }
            text.Visible    = linkSave.Visible = false;
            labText.Visible = linkUpdate.Visible = true;
        }
Exemple #20
0
        private void getCommodity(CouponBLL bll, int id)
        {
            DataSet ds = bll.getPointData(id);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row   = ds.Tables[0].Rows[0];
                int     max   = Convert.ToInt32(row["maxs"]);
                int     point = Convert.ToInt32(row["point"]);
                labConmmoid.Text  = row["id"].ToString();
                labCommodity.Text = row["name"].ToString();
                labRemark.Text    = row["mark"].ToString();
                labPoint.Text     = point.ToString();
                btnAdd.Enabled    = btnReduce.Enabled = !(max == 0 || max == 1);
                labMaxs.Text      = max.ToString();
                labPrice.Text     = point.ToString();
                labBalance.Text   = "" + (Convert.ToInt64(labRemaining.Text) - point);
                setButtonState(labRemaining.Text, labPrice.Text);
            }
        }
Exemple #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] == null)
     {
         Response.Redirect("BNSCoupon.aspx");
     }
     if (!IsPostBack)
     {
         CouponBLL bll = new CouponBLL();
         getAccount(bll, Convert.ToInt32(Request.QueryString["id"]));
         getCategory(bll);
         getSetting(bll);
         gvOrderList.DataSource = bll.getOrderList(Convert.ToInt32(Request.QueryString["id"]));
         gvOrderList.DataBind();
         if (Convert.ToBoolean(hidShowStore.Value))
         {
             getData(bll, txtKeywords.Text);
         }
     }
 }
Exemple #22
0
        protected override void PageLoad()
        {
            base.PageLoad();
            CheckAdminPower("ReadCoupon", PowerCheckType.Single);
            couponKind = RequestHelper.GetQueryString <int>("couponkind");
            //开始状态:未开始、进行中、已结束。默认: 进行中
            timePeriod = RequestHelper.GetQueryString <int>("timeperiod") > 0? RequestHelper.GetQueryString <int>("timeperiod"):2;

            CouponSearchInfo searchInfo = new CouponSearchInfo();

            if (couponKind > 0)
            {
                searchInfo.Type = couponKind;
            }
            if (timePeriod > 0)
            {
                searchInfo.TimePeriod = timePeriod;
            }
            couponList = CouponBLL.SearchList(1, pageSize, searchInfo, ref Count);
        }
Exemple #23
0
 protected void lnkSave_Click(object sender, EventArgs e)
 {
     if (txtCoupon.Text.Trim().Equals("") || txtMinLevel.Text.Trim().Equals("") || txtMinStard.Text.Trim().Equals(""))
     {
         ClientScript.RegisterStartupScript(GetType(), "varrn", "<script>alert('请将数据填写完整!');</script>");
     }
     else
     {
         CouponBLL bll = new CouponBLL();
         if (bll.setWhere(int.Parse(hidWhereID.Value), txtMinLevel.Text, txtMinStard.Text, txtCoupon.Text, ddlCycle.SelectedValue, txtProvideDate.Text, txtWhereRemark.Text))
         {
             showWhere(bll);
             dataBound(bll, true);
         }
         else
         {
             showWhere(bll);
         }
     }
 }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtRedate.Attributes.Add("onclick", "setDay(this);");
                if (Request.QueryString["action"] != null)
                {
                    string    s   = Request.QueryString["action"];
                    CouponBLL bll = new CouponBLL();
                    if (Request.QueryString["id"] != null)
                    {
                        setGenders(bll);
                        switch (s)
                        {
                        case "add":
                            hidAction.Value = "add";
                            litTitle.Text   = "添加账号";
                            setVocation(bll, rblGenders.SelectedValue);
                            break;

                        case "edt":
                            hidAction.Value = "edt";
                            getAccount(bll, Convert.ToInt32(Request.QueryString["id"]));
                            litTitle.Text   = "修改账号信息";
                            txtQQ.Enabled   = false;
                            txtQQ.BackColor = Color.White;
                            break;
                        }
                    }
                    else
                    {
                        if (s.Equals("add"))
                        {
                            setGenders(bll);
                            setVocation(bll, rblGenders.SelectedValue);
                            hidAction.Value = "add";
                        }
                    }
                }
            }
        }
        public string ExportJoinData(string pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var couponBLL          = new CouponBLL(loggingSessionInfo);

            var rd = new CouponManagePagedSearchRD();
            var rp = pRequest.DeserializeJSONTo <APIRequest <CouponManagePagedSearchRP> >();

            rp.Parameters.Validate();

            string fileName = "";

            DataTable dataTable = couponBLL.GetExportData(rp.Parameters);

            //var rsp = new SuccessResponse<IAPIResponseData>(rd);


            fileName = Utils.DataTableToExcel(dataTable, "list", "使用记录", "post");

            return(fileName);
        }
Exemple #26
0
        private void showGenders(CouponBLL bll)
        {
            panGender.Controls.Clear();
            DataSet ds = bll.getGenders();

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    TableRow  _row   = new TableRow();
                    TableCell _cell0 = new TableCell();
                    _cell0.Text = row[1].ToString();
                    TableCell _cell1 = new TableCell();
                    _cell1.Text = row[2].ToString();
                    TableCell _cell2 = new TableCell();
                    //StringBuilder stringBuilder = new System.Text.StringBuilder();
                    //StringWriter stringWriter = new System.IO.StringWriter(stringBuilder);
                    //HtmlTextWriter htmlTextWriter = new System.Web.UI.HtmlTextWriter(stringWriter);
                    //Panel pan = new Panel();
                    LinkButton link = new LinkButton();
                    link.Text        = "删除";
                    link.ID          = "lnkDel" + row[0];
                    link.CommandName = row[0].ToString();
                    //link.ForeColor = Color.Blue;
                    link.Click        += btnDelete_Click;
                    link.OnClientClick = "return confirm('确定要删除吗?');";
                    //pan.Controls.Add(link);
                    //pan.RenderControl(htmlTextWriter);

                    //genders += "<tr><td>" + row[0] + "</td>\n"
                    //    + "<td>" + row[1] + "</td>\n"
                    //    + "<td>"+ stringBuilder.ToString() +"</td>\n</tr>\n";
                    _cell2.Controls.Add(link);
                    _row.Cells.Add(_cell0);
                    _row.Cells.Add(_cell1);
                    _row.Cells.Add(_cell2);
                    panGender.Controls.Add(_row);
                }
            }
        }
Exemple #27
0
        /// <summary>
        /// 核销优惠券列表
        /// Create By: Sun Xu
        /// Create Date:2015-11-02
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string WriteOffCouponList(string pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var couponBLL          = new CouponBLL(loggingSessionInfo);

            var rq = pRequest.DeserializeJSONTo <APIRequest <WriteOffCouponListRP> >();

            rq.Parameters.Validate();

            ErrorResponse er = new ErrorResponse();

            try
            {
                SuccessResponse <IAPIResponseData> rp = null;

                if (!string.IsNullOrWhiteSpace(rq.Parameters.CouponCode))
                {
                    var couponEntity = couponBLL.QueryByEntity(new CouponEntity()
                    {
                        CouponCode = rq.Parameters.CouponCode
                    }, null);

                    if (couponEntity == null || couponEntity.Length == 0)
                    {
                        rp            = new SuccessResponse <IAPIResponseData>();
                        rp.ResultCode = 103;
                        rp.Message    = "优惠券无效";
                        return(rp.ToJSON());
                    }
                }
                var rd = new WriteOffCouponListRD();
                rd = couponBLL.WriteOffCouponList(rq.Parameters.Mobile, rq.Parameters.CouponCode, rq.Parameters.Status, rq.Parameters.PageSize, rq.Parameters.PageIndex);
                rp = new SuccessResponse <IAPIResponseData>(rd);
                return(rp.ToJSON());
            }
            catch (Exception ex) {
                er.Message = ex.Message;
                return(er.ToJSON());
            }
        }
Exemple #28
0
        private void showWhereList(CouponBLL bll)
        {
            DataSet ds = bll.getWhereList();

            if (ds != null)
            {
                gdWhereList.DataSource = ds;
                gdWhereList.DataBind();
            }
            panAddWhere.Visible = true;
            int en = 0;

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (Convert.ToInt32(row["isvalid"]) == 1)
                {
                    panAddWhere.Visible = false;
                    en++;
                }
            }
            labMoreEnable.Visible = (en > 1);
        }
Exemple #29
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string    s   = getGenders();
            CouponBLL bll = new CouponBLL();

            if (!txtVocation.Text.Trim().Equals("") && s.Length > 0)
            {
                if (hidAction.Value.Equals("edt"))
                {
                    bll.setVocation(Convert.ToInt32(Request.QueryString["id"]), rblRace.SelectedValue, txtVocation.Text, s);
                }
                else if (hidAction.Value.Equals("add"))
                {
                    bll.addVocation(rblRace.SelectedValue, txtVocation.Text, s);
                }
                Response.Redirect("Vocation.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "trim", "<script>alert('请输入对应数据!')</script>");
            }
        }
Exemple #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadCoupon", PowerCheckType.Single);
                couponKind = RequestHelper.GetQueryString <int>("couponkind");
                //开始状态:未开始、进行中、已结束
                timeperiod = RequestHelper.GetQueryString <int>("timeperiod") < 1?2: RequestHelper.GetQueryString <int>("timeperiod");

                CouponSearchInfo searchInfo = new CouponSearchInfo();
                if (couponKind > 0)
                {
                    searchInfo.Type = couponKind;
                }
                if (timeperiod > 0)
                {
                    searchInfo.TimePeriod = timeperiod;
                }
                List <CouponInfo> couponList = CouponBLL.SearchList(CurrentPage, PageSize, searchInfo, ref Count);
                BindControl(couponList, RecordList, MyPager);
            }
        }