ERP商品类型管理相关业务处理(三十五)

网友投稿 606 2022-11-10

ERP商品类型管理相关业务处理(三十五)

ERP商品类型管理相关业务处理(三十五)

根据类型编号获取父类名称

-- =============================================CREATE FUNCTION [dbo].[FN_getParentTypeNameByTypeID]( @TypeID INT)RETURNS NVARCHAR(100)ASBEGIN DECLARE @parentTypename NVARCHAR(100) SELECT @parentTypename=TypeName FROM BioProType WHERE TypeID=(SELECT ParentTypeID FROM dbo.BioProType WHERE TypeID=@TypeID) RETURN @parentTypenameEND

1.管理页面实现产品类型列表显示(分页)。

前端的代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProTypeListShow.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.Product.ProTypeListShow" %><%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>

产品类型管理
产品类型修改
类型名称
所属大类

删除节点的通用方法:

///

/// 删除指定表 父级节点下面的所有子节点。 /// /// 表名 /// 编号 public static void deleteParentNode(string NodeID) { //DataTable dt = "select id from table where upid=" + id; DataTable dt = SqlComm.GetDataByCondition("BioProType", "TypeID", " ParentTypeID=" + NodeID).Tables[0]; //存在子级的 if(dt.Rows.Count>0) { foreach (DataRow aRow in dt.Rows) { //递归搜索子级 deleteParentNode(aRow["TypeID"].ToString()); } //删除子节点后再删除当前节点。 SqlComm.DeleteTableByCondition("BioProType", " where TypeID=" + NodeID); } //删除不存在的 else { SqlComm.DeleteTableByCondition("BioProType", " where TypeID=" + NodeID); } }

后台代码:

public static int pageindex = 0; public static int pagesize = 10; public static string condition = ""; protected void Page_Load(object sender, EventArgs e) { ////Session["Userid"] = "29"; if (!IsPostBack) { getallPageList(); } } ///

/// 查询所有联系人信息 /// private void getallPageList() { this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("dbo.BioProType", condition); this.AspNetPager1.PageSize = pagesize; this.GridView1.DataSource = SqlComm.getDataByPageIndex("dbo.BioProType", "*,parentTypeName=dbo.FN_getParentTypeNameByTypeID(TypeID)", "TypeID", condition, pageindex, pagesize); this.GridView1.DataBind(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { pageindex = this.AspNetPager1.CurrentPageIndex - 1; getallPageList(); } protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e) { pageindex = 0; condition = ""; if (txtName.Text.Trim() != null && this.txtName.Text.Trim().Length != 0) { condition = condition + " and TypeName like '" + txtName.Text + "%'"; } getallPageList(); } protected void imgbtnNew_Click(object sender, ImageClickEventArgs e) { Response.Redirect("ProTypeInsert.aspx"); } BioProType type = null; static string id = ""; protected void btnSubmit_Click(object sender, EventArgs e) { //if (type == null) //{ // ScriptManager.RegisterStartupScript(this, this.GetType(), "teet", "alert('请选择类型后再修改')", true); // return; //} BioProType type = new BioProType(); type.TypeID = int.Parse(id); type.TypeName =this.txtTypeName.Text; type.ParentTypeID =int.Parse(this.txtSupertTypeID.Text); BioProTypeBLL typebll = new BioProTypeBLL(); if (typebll.ProTypeUpdate(type) != 0) { getallPageList(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "teet", "alert('修改不成功')", true); } } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { BioProTypeBLL typebll = new BioProTypeBLL(); type = new BioProType(); if (e.CommandName == "ImgEdit") { id = e.CommandArgument.ToString(); type = typebll.getProTypeByTypeID(id); this.txtTypeName.Text = type.TypeName; this.txtSupertTypeID.Text = type.ParentTypeID.ToString(); } if (e.CommandName == "ImgDelete") { string Typeid = e.CommandArgument.ToString(); SqlComm.deleteParentNode(Typeid); getallPageList(); } } /// /// 分页 /// /// /// protected void AspNetPager1_PageChanged1(object sender, EventArgs e) { pageindex = this.AspNetPager1.CurrentPageIndex - 1; getallPageList(); }

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:ERP产品购进批量提交文件(三十六)
下一篇:ERP发货系统的修改(四十三)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~