private void UpdateSpec(HttpContext context) { int id = RequestHelper.GetFormInt("id"); string price = RequestHelper.GetFormString("price"); Model.goods_spec_type spec = new BLL.goods_spec_type().GetModel(id); if (spec != null) { spec.price = Utils.StrToDecimal(price, 0); if (new BLL.goods_spec_type().Update(spec)) { context.Response.Write("1"); context.Response.End(); } else { context.Response.Write("0"); context.Response.End(); } } else { context.Response.Write("0"); context.Response.End(); } }
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.goods_spec_type bll = new BLL.goods_spec_type(); 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); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_goods_spec_type", EnumCollection.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.goods_spec_type bll = new BLL.goods_spec_type(); 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)); }
private void BindInfo() { BLL.goods_spec_type bll = new BLL.goods_spec_type(); Model.goods_spec_type model = bll.GetModel(this.id); if (model == null) { JscriptMsg("信息不存在或已被删除!", "back"); return; } txtgoods_id.Text = model.goods_id + ""; txtspec.Text = model.spec + ""; txtstock.Text = model.stock + ""; txtprice.Text = model.price + ""; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_goods_spec_type", EnumCollection.ActionEnum.Add.ToString()); //检查权限 #region string strError = string.Empty; if (txtgoods_id.Text.Trim() == "" || txtgoods_id.Text.Trim().Length > 4) { strError += "商品id为空或超出长度![br]"; } if (txtspec.Text.Trim() == "" || txtspec.Text.Trim().Length > 4) { strError += "规格为空或超出长度![br]"; } if (txtstock.Text.Trim() == "" || txtstock.Text.Trim().Length > 4) { strError += "库存为空或超出长度![br]"; } if (txtprice.Text.Trim() == "" || txtprice.Text.Trim().Length > 9) { strError += "价格为空或超出长度![br]"; } if (strError != string.Empty) { JscriptMsg(strError, "", "Error"); return; } #endregion Model.goods_spec_type model = new Model.goods_spec_type(); BLL.goods_spec_type bll = new BLL.goods_spec_type(); model.goods_id = Convert.ToInt32(txtgoods_id.Text); model.spec = Convert.ToInt32(txtspec.Text); model.stock = Convert.ToInt32(txtstock.Text); model.price = Convert.ToDecimal(txtprice.Text); int id = bll.Add(model); if (id > 0) { AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加商品规格种类信息,主键:" + id); //记录日志 JscriptMsg("添加商品规格种类信息成功!", "Manage.aspx", ""); } else { JscriptMsg("保存过程中发生错误!", ""); } }
private void RptBind(string _strWhere, string _orderby) { this.page = RequestHelper.GetQueryInt("page", 1); BLL.goods_spec_type bll = new BLL.goods_spec_type(); this.totalCount = bll.GetRecordCount("View_SpecTypeInfo", _strWhere); this.rptList.DataSource = bll.GetListByPage("*", "View_SpecTypeInfo", _strWhere, _orderby, page, pageSize); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("dialog_SaveStock.aspx", "keywords={0}&page={1}&id={2}", this.keywords, "__id__", this.id.ToString()); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("_ybd_goods_spec_type", EnumCollection.ActionEnum.Modify.ToString()); //检查权限 BLL.goods_spec_type bll = new BLL.goods_spec_type(); Model.goods_spec_type model = bll.GetModel(this.id); model.goods_id = Convert.ToInt32(txtgoods_id.Text); model.spec = Convert.ToInt32(txtspec.Text); model.stock = Convert.ToInt32(txtstock.Text); model.price = Convert.ToDecimal(txtprice.Text); if (bll.Update(model)) { AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改商品规格种类信息,主键:" + id); //记录日志 JscriptMsg("修改商品规格种类信息成功!", "Manage.aspx"); } else { JscriptMsg("保存过程中发生错误!", ""); } }