private bool DoEdit(int _id) { bool result = false; ps_product_category model = new ps_product_category(); if (model.Exists(txttitle.Text.Trim(), _id)) { mym.JscriptMsg(this.Page, "您输入的商品类别名称已经存在,请检查!", "", "Error"); return(false); } model.GetModel(_id); model.title = txttitle.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.remark = txtremark.Text.Trim(); if (model.Update()) { mym.AddAdminLog("修改", "修改商品类别:" + txttitle.Text); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { ps_product_category model = new ps_product_category(); model.GetModel(_id); txttitle.Text = model.title; txtSortId.Text = model.sort_id.ToString(); txtremark.Text = model.remark; }
private void ZYBind() { ps_product_category bll = new ps_product_category(); DataTable dt = bll.GetList("1=1").Tables[0]; this.ddlproduct_category_id.Items.Clear(); this.ddlproduct_category_id.Items.Add(new ListItem("==全部==", "0")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); string Title = dr["title"].ToString().Trim(); this.ddlproduct_category_id.Items.Add(new ListItem(Title, Id)); } }
private void RptBind(string _strWhere, string _orderby) { this.page = AXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; ps_product_category bll = new ps_product_category(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("product_category_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ps_product_category bll = new ps_product_category(); Repeater rptList = new Repeater(); rptList = this.rptList; 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()); } mym.JscriptMsg(this.Page, " 排序保存成功", Utils.CombUrlTxt("product_category_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success"); }
private bool DoAdd() { ps_product_category model = new ps_product_category(); if (model.Exists(txttitle.Text.Trim())) { mym.JscriptMsg(this.Page, "您输入的商品类别名称已经存在,请检查!", "", "Error"); return(false); } model.title = txttitle.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.remark = txtremark.Text.Trim(); if (model.Add() > 0) { mym.AddAdminLog("增加", "添加商品类别:" + txttitle.Text); //记录日志 return(true); } return(false); }
// 单个删除 protected void lbtnDelCa_Click(object sender, EventArgs e) { // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ps_product_category bll = new ps_product_category(); bll.GetModel(caId); string title = bll.title; ps_here_depot bllpp = new ps_here_depot(); bllpp.product_category_id = caId; if (!bllpp.ExistsBM())//查找是否存在下级商品 { bll.Delete(caId); mym.AddAdminLog("删除", "删除商品类别:" + title + ""); //记录日志 mym.JscriptMsg(this.Page, " 成功删除商品类别:" + title + "", Utils.CombUrlTxt("product_category_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success"); } else { mym.JscriptMsg(this.Page, "有商品属于该商品类别,不能删除!", "", "Error"); return; } }