Example #1
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.user_ordergoods bll = new BLL.user_ordergoods();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Example #2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_ordergoods", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.user_ordergoods bll = new BLL.user_ordergoods();
            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)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除订单购买商品表" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", this.keywords));
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_ordergoods", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.user_ordergoods   bll   = new BLL.user_ordergoods();
            Model.user_ordergoods model = bll.GetModel(this.id);

            model.order_id       = Convert.ToInt32(txtorder_id.Text);
            model.goods_group    = Convert.ToInt32(txtgoods_group.Text);
            model.goods_id       = Convert.ToInt32(txtgoods_id.Text);
            model.goods_title    = Convert.ToString(txtgoods_title.Text);
            model.goods_subtitle = Convert.ToString(txtgoods_subtitle.Text);
            model.goods_spec     = Convert.ToString(txtgoods_spec.Text);
            model.goods_stock    = Convert.ToInt32(txtgoods_stock.Text);
            model.img_url        = Convert.ToString(txtimg_url.Text);
            model.goods_oprice   = Convert.ToDecimal(txtgoods_oprice.Text);
            model.goods_price    = Convert.ToDecimal(txtgoods_price.Text);
            model.quantity       = Convert.ToInt32(txtquantity.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改订单购买商品表信息,主键:" + id); //记录日志
                JscriptMsg("修改订单购买商品表信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
 private void BindInfo()
 {
     BLL.user_ordergoods   bll   = new BLL.user_ordergoods();
     Model.user_ordergoods model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtorder_id.Text       = model.order_id + "";
     txtgoods_group.Text    = model.goods_group + "";
     txtgoods_id.Text       = model.goods_id + "";
     txtgoods_title.Text    = model.goods_title + "";
     txtgoods_subtitle.Text = model.goods_subtitle + "";
     txtgoods_spec.Text     = model.goods_spec + "";
     txtgoods_stock.Text    = model.goods_stock + "";
     txtimg_url.Text        = model.img_url + "";
     txtgoods_oprice.Text   = model.goods_oprice + "";
     txtgoods_price.Text    = model.goods_price + "";
     txtquantity.Text       = model.quantity + "";
 }
Example #5
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_ordergoods", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtorder_id.Text.Trim() == "" || txtorder_id.Text.Trim().Length > 4)
            {
                strError += "订单id为空或超出长度![br]";
            }
            if (txtgoods_group.Text.Trim() == "" || txtgoods_group.Text.Trim().Length > 4)
            {
                strError += "商品分组为空或超出长度![br]";
            }
            if (txtgoods_id.Text.Trim() == "" || txtgoods_id.Text.Trim().Length > 4)
            {
                strError += "商品id为空或超出长度![br]";
            }
            if (txtgoods_title.Text.Trim() == "" || txtgoods_title.Text.Trim().Length > 100)
            {
                strError += "标题为空或超出长度![br]";
            }
            if (txtgoods_subtitle.Text.Trim() == "" || txtgoods_subtitle.Text.Trim().Length > 255)
            {
                strError += "副标题为空或超出长度![br]";
            }
            if (txtgoods_spec.Text.Trim() == "" || txtgoods_spec.Text.Trim().Length > 4000)
            {
                strError += "规格为空或超出长度![br]";
            }
            if (txtgoods_stock.Text.Trim() == "" || txtgoods_stock.Text.Trim().Length > 4)
            {
                strError += "库存为空或超出长度![br]";
            }
            if (txtimg_url.Text.Trim() == "" || txtimg_url.Text.Trim().Length > 255)
            {
                strError += "封面图为空或超出长度![br]";
            }
            if (txtgoods_oprice.Text.Trim() == "" || txtgoods_oprice.Text.Trim().Length > 8)
            {
                strError += "原价为空或超出长度![br]";
            }
            if (txtgoods_price.Text.Trim() == "" || txtgoods_price.Text.Trim().Length > 8)
            {
                strError += "现价为空或超出长度![br]";
            }
            if (txtquantity.Text.Trim() == "" || txtquantity.Text.Trim().Length > 4)
            {
                strError += "数量为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.user_ordergoods model = new Model.user_ordergoods();
            BLL.user_ordergoods   bll   = new BLL.user_ordergoods();

            model.order_id       = Convert.ToInt32(txtorder_id.Text);
            model.goods_group    = Convert.ToInt32(txtgoods_group.Text);
            model.goods_id       = Convert.ToInt32(txtgoods_id.Text);
            model.goods_title    = Convert.ToString(txtgoods_title.Text);
            model.goods_subtitle = Convert.ToString(txtgoods_subtitle.Text);
            model.goods_spec     = Convert.ToString(txtgoods_spec.Text);
            model.goods_stock    = Convert.ToInt32(txtgoods_stock.Text);
            model.img_url        = Convert.ToString(txtimg_url.Text);
            model.goods_oprice   = Convert.ToDecimal(txtgoods_oprice.Text);
            model.goods_price    = Convert.ToDecimal(txtgoods_price.Text);
            model.quantity       = Convert.ToInt32(txtquantity.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加订单购买商品表信息,主键:" + id); //记录日志
                JscriptMsg("添加订单购买商品表信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }