ERP商品管理业务逻辑封装(三十四)

网友投稿 573 2022-08-31

ERP商品管理业务逻辑封装(三十四)

ERP商品管理业务逻辑封装(三十四)

产品购进管理业务逻辑:

public class ProductBLL { ///

/// 产品对象添加 并且返回产品编号 /// /// 产品视图对象 public int BiotbProductAdd(ViewProInfo model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@ProID", SqlDbType.Int,4), new SqlParameter("@ProName", SqlDbType.NVarChar,100), new SqlParameter("@TypeID", SqlDbType.Int,4), new SqlParameter("@CustomerID", SqlDbType.Int,4), new SqlParameter("@ProLogo", SqlDbType.NVarChar,200), new SqlParameter("@Spec", SqlDbType.NVarChar,100), new SqlParameter("@ProFullName", SqlDbType.NVarChar,100), new SqlParameter("@ConfirmNo", SqlDbType.NVarChar,100), new SqlParameter("@Unit", SqlDbType.NVarChar,50), new SqlParameter("@ProSize", SqlDbType.NVarChar,50), new SqlParameter("@Grossweight", SqlDbType.NVarChar,50), new SqlParameter("@MadeEnterprise", SqlDbType.NVarChar,100), new SqlParameter("@Retailprice", SqlDbType.Money,8), new SqlParameter("@BidPrice", SqlDbType.Money,8), new SqlParameter("@TradePrice", SqlDbType.Money,8), new SqlParameter("@AdvicePrice", SqlDbType.Money,8), new SqlParameter("@CountyPrice", SqlDbType.Money,8), new SqlParameter("@CityPrice", SqlDbType.Money,8), new SqlParameter("@ProvincePrice", SqlDbType.Money,8), new SqlParameter("@NetPrice", SqlDbType.Money,8), new SqlParameter("@NetVipPrice", SqlDbType.Money,8), new SqlParameter("@NetMemberprice", SqlDbType.Money,8), new SqlParameter("@OurCompany", SqlDbType.NVarChar,100), new SqlParameter("@ChannelID", SqlDbType.Int,4), new SqlParameter("@Usefullife", SqlDbType.NVarChar,50), new SqlParameter("@SubmitTime", SqlDbType.DateTime), new SqlParameter("@StockMost", SqlDbType.NVarChar,100), new SqlParameter("@StockLess", SqlDbType.NVarChar,100), new SqlParameter("@Remark", SqlDbType.NVarChar,1000)}; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.ProName; parameters[2].Value = model.TypeID; parameters[3].Value = model.CustomerID; parameters[4].Value = model.ProLogo; parameters[5].Value = model.Spec; parameters[6].Value = model.ProFullName; parameters[7].Value = model.ConfirmNo; parameters[8].Value = model.Unit; parameters[9].Value = model.ProSize; parameters[10].Value = model.Grossweight; parameters[11].Value = model.MadeEnterprise; parameters[12].Value = model.Retailprice; parameters[13].Value = model.BidPrice; parameters[14].Value = model.TradePrice; parameters[15].Value = model.AdvicePrice; parameters[16].Value = model.CountyPrice; parameters[17].Value = model.CityPrice; parameters[18].Value = model.ProvincePrice; parameters[19].Value = model.NetPrice; parameters[20].Value = model.NetVipPrice; parameters[21].Value = model.NetMemberprice; parameters[22].Value = model.OurCompany; parameters[23].Value = model.ChannelID; parameters[24].Value = model.Usefullife; parameters[25].Value = model.SubmitTime; parameters[26].Value = model.StockMost; parameters[27].Value = model.StockLess; parameters[28].Value = model.Remark; rowsAffected= DataBaseHelper.ExcuteSqlReturnInt("BiotbProduct_ADD", CommandType.StoredProcedure, parameters); if (rowsAffected != 0) { return int.Parse(parameters[0].ToString()); } else { return 0; } } /// /// 修改产品对象 /// /// 产品对象 /// int public int BiotbProductUpdate(ViewProInfo model) { SqlParameter[] parameters = { new SqlParameter("@ProID", SqlDbType.Int,4), new SqlParameter("@ProName", SqlDbType.NVarChar,100), new SqlParameter("@TypeID", SqlDbType.Int,4), new SqlParameter("@CustomerID", SqlDbType.Int,4), new SqlParameter("@ProLogo", SqlDbType.NVarChar,200), new SqlParameter("@Spec", SqlDbType.NVarChar,100), new SqlParameter("@ProFullName", SqlDbType.NVarChar,100), new SqlParameter("@ConfirmNo", SqlDbType.NVarChar,100), new SqlParameter("@Unit", SqlDbType.NVarChar,50), new SqlParameter("@ProSize", SqlDbType.NVarChar,50), new SqlParameter("@Grossweight", SqlDbType.NVarChar,50), new SqlParameter("@MadeEnterprise", SqlDbType.NVarChar,100), new SqlParameter("@Retailprice", SqlDbType.Money,8), new SqlParameter("@BidPrice", SqlDbType.Money,8), new SqlParameter("@TradePrice", SqlDbType.Money,8), new SqlParameter("@AdvicePrice", SqlDbType.Money,8), new SqlParameter("@CountyPrice", SqlDbType.Money,8), new SqlParameter("@CityPrice", SqlDbType.Money,8), new SqlParameter("@ProvincePrice", SqlDbType.Money,8), new SqlParameter("@NetPrice", SqlDbType.Money,8), new SqlParameter("@NetVipPrice", SqlDbType.Money,8), new SqlParameter("@NetMemberprice", SqlDbType.Money,8), new SqlParameter("@OurCompany", SqlDbType.NVarChar,100), new SqlParameter("@ChannelID", SqlDbType.Int,4), new SqlParameter("@Usefullife", SqlDbType.NVarChar,50), new SqlParameter("@SubmitTime", SqlDbType.DateTime), new SqlParameter("@StockMost", SqlDbType.NVarChar,100), new SqlParameter("@StockLess", SqlDbType.NVarChar,100), new SqlParameter("@Remark", SqlDbType.NVarChar,1000)}; parameters[0].Value = model.ProID; parameters[1].Value = model.ProName; parameters[2].Value = model.TypeID; parameters[3].Value = model.CustomerID; parameters[4].Value = model.ProLogo; parameters[5].Value = model.Spec; parameters[6].Value = model.ProFullName; parameters[7].Value = model.ConfirmNo; parameters[8].Value = model.Unit; parameters[9].Value = model.ProSize; parameters[10].Value = model.Grossweight; parameters[11].Value = model.MadeEnterprise; parameters[12].Value = model.Retailprice; parameters[13].Value = model.BidPrice; parameters[14].Value = model.TradePrice; parameters[15].Value = model.AdvicePrice; parameters[16].Value = model.CountyPrice; parameters[17].Value = model.CityPrice; parameters[18].Value = model.ProvincePrice; parameters[19].Value = model.NetPrice; parameters[20].Value = model.NetVipPrice; parameters[21].Value = model.NetMemberprice; parameters[22].Value = model.OurCompany; parameters[23].Value = model.ChannelID; parameters[24].Value = model.Usefullife; parameters[25].Value = model.SubmitTime; parameters[26].Value = model.StockMost; parameters[27].Value = model.StockLess; parameters[28].Value = model.Remark; return DataBaseHelper.ExcuteSqlReturnInt("BioProType_Update", CommandType.StoredProcedure, parameters); } /// /// 根据产品编号返回产品视图实体对象 /// /// /// public ViewProInfo getProViewByProId(string ProID) { SqlParameter[] parameters = { new SqlParameter("@ProID", SqlDbType.Int,4)}; parameters[0].Value = ProID; ViewProInfo model = new ViewProInfo(); DataSet ds = DataBaseHelper.SelectSQLReturnDataSet("View_ProInfo_GetModel",CommandType.StoredProcedure,parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ProID"].ToString() != "") { model.ProID = int.Parse(ds.Tables[0].Rows[0]["ProID"].ToString()); } model.ProName = ds.Tables[0].Rows[0]["ProName"].ToString(); if (ds.Tables[0].Rows[0]["TypeID"].ToString() != "") { model.TypeID = int.Parse(ds.Tables[0].Rows[0]["TypeID"].ToString()); } model.TypeName = ds.Tables[0].Rows[0]["TypeName"].ToString(); if (ds.Tables[0].Rows[0]["CustomerID"].ToString() != "") { model.CustomerID = int.Parse(ds.Tables[0].Rows[0]["CustomerID"].ToString()); } model.CustomerName = ds.Tables[0].Rows[0]["CustomerName"].ToString(); model.ProLogo = ds.Tables[0].Rows[0]["ProLogo"].ToString(); model.Spec = ds.Tables[0].Rows[0]["Spec"].ToString(); model.ProFullName = ds.Tables[0].Rows[0]["ProFullName"].ToString(); model.ConfirmNo = ds.Tables[0].Rows[0]["ConfirmNo"].ToString(); model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString(); model.ProSize = ds.Tables[0].Rows[0]["ProSize"].ToString(); model.Grossweight = ds.Tables[0].Rows[0]["Grossweight"].ToString(); model.MadeEnterprise = ds.Tables[0].Rows[0]["MadeEnterprise"].ToString(); if (ds.Tables[0].Rows[0]["Retailprice"].ToString() != "") { model.Retailprice = decimal.Parse(ds.Tables[0].Rows[0]["Retailprice"].ToString()); } if (ds.Tables[0].Rows[0]["BidPrice"].ToString() != "") { model.BidPrice = decimal.Parse(ds.Tables[0].Rows[0]["BidPrice"].ToString()); } if (ds.Tables[0].Rows[0]["TradePrice"].ToString() != "") { model.TradePrice = decimal.Parse(ds.Tables[0].Rows[0]["TradePrice"].ToString()); } if (ds.Tables[0].Rows[0]["AdvicePrice"].ToString() != "") { model.AdvicePrice = decimal.Parse(ds.Tables[0].Rows[0]["AdvicePrice"].ToString()); } if (ds.Tables[0].Rows[0]["CountyPrice"].ToString() != "") { model.CountyPrice = decimal.Parse(ds.Tables[0].Rows[0]["CountyPrice"].ToString()); } if (ds.Tables[0].Rows[0]["CityPrice"].ToString() != "") { model.CityPrice = decimal.Parse(ds.Tables[0].Rows[0]["CityPrice"].ToString()); } if (ds.Tables[0].Rows[0]["ProvincePrice"].ToString() != "") { model.ProvincePrice = decimal.Parse(ds.Tables[0].Rows[0]["ProvincePrice"].ToString()); } if (ds.Tables[0].Rows[0]["NetPrice"].ToString() != "") { model.NetPrice = decimal.Parse(ds.Tables[0].Rows[0]["NetPrice"].ToString()); } if (ds.Tables[0].Rows[0]["NetVipPrice"].ToString() != "") { model.NetVipPrice = decimal.Parse(ds.Tables[0].Rows[0]["NetVipPrice"].ToString()); } if (ds.Tables[0].Rows[0]["NetMemberprice"].ToString() != "") { model.NetMemberprice = decimal.Parse(ds.Tables[0].Rows[0]["NetMemberprice"].ToString()); } model.OurCompany = ds.Tables[0].Rows[0]["OurCompany"].ToString(); if (ds.Tables[0].Rows[0]["ChannelID"].ToString() != "") { model.ChannelID = int.Parse(ds.Tables[0].Rows[0]["ChannelID"].ToString()); } model.ChannelName = ds.Tables[0].Rows[0]["ChannelName"].ToString(); model.Usefullife = ds.Tables[0].Rows[0]["Usefullife"].ToString(); if (ds.Tables[0].Rows[0]["SubmitTime"].ToString() != "") { model.SubmitTime = DateTime.Parse(ds.Tables[0].Rows[0]["SubmitTime"].ToString()); } model.StockMost = ds.Tables[0].Rows[0]["StockMost"].ToString(); model.StockLess = ds.Tables[0].Rows[0]["StockLess"].ToString(); model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); return model; } else { return null; } } }

商品类型的业务:

public class BioProTypeBLL { ///

/// 添加一个产品类型对象 /// /// /// public int ProTypeAdd(BioProType model) { SqlParameter[] parameters = { new SqlParameter("@ParentTypeID", SqlDbType.Int,4), new SqlParameter("@TypeName", SqlDbType.NVarChar,100)}; parameters[0].Value = model.ParentTypeID; parameters[1].Value = model.TypeName; return DataBaseHelper.ExcuteSqlReturnInt("BioProType_Add", CommandType.StoredProcedure, parameters); } /// /// 产品类型修改 /// /// /// public int ProTypeUpdate(BioProType model) { SqlParameter[] parameters = { new SqlParameter("@TypeID", SqlDbType.Int,4), new SqlParameter("@ParentTypeID", SqlDbType.Int,4), new SqlParameter("@TypeName", SqlDbType.NVarChar,100)}; parameters[0].Value = model.TypeID; parameters[1].Value = model.ParentTypeID; parameters[2].Value = model.TypeName; return DataBaseHelper.ExcuteSqlReturnInt("BioProType_Update", CommandType.StoredProcedure, parameters); } /// /// 根据产品类型编号返回产品类型对象 /// /// /// public BioProType getProTypeByTypeID(string id) { SqlDataReader reader= SqlComm.GetDataReaderByCondition("dbo.BioProType", "*", " TypeID=" + id); BioProType type = new BioProType(); if (reader.Read()) { if (reader["TypeID"] != null) { type.TypeID = int.Parse(reader["TypeID"].ToString()); } if (reader["ParentTypeID"] != null) { type.ParentTypeID = int.Parse(reader["ParentTypeID"].ToString()); } if (reader["TypeName"] != null) { type.TypeName = reader["TypeName"].ToString(); } } return type; } }

商品图片的BLL:

///

/// 添加一条图片对象 /// /// /// public int BiotbProImgsAdd(BiotbProImgs images) { SqlParameter[] parameters = { new SqlParameter("@ProID", SqlDbType.Int,4), new SqlParameter("@ProImg", SqlDbType.NVarChar,200)}; parameters[0].Value = images.ProID; parameters[1].Value = images.ProImg; return DataBaseHelper.ExcuteSqlReturnInt("BiotbProImgs_ADD", CommandType.StoredProcedure, parameters); }

添加产品类型的页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProTypeList.aspx.cs" Inherits="BioErpWeb.PersonList.ProTypeList" %>

选择的js

function showProType() { var re = showModalDialog("../../PersonList/ProTypeList.aspx", "", "dialogWidth=350px;dialogHeight=400px"); var obj = window.event.srcElement; var td = obj.parentNode; var txts = td.getElementsByTagName('input'); if (re == null || re == "") { if (txts[0].value == "" || txts[0].value == null) { txts[0].value = "请选择"; } } else { txts[0].value = re; }}

后台代码:

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CreateTreeVeiw(); } } DataSet ds; DataTable dt; private void CreateTreeVeiw() { ds = SqlComm.GetDataByCondition("dbo.BioProType", "TypeID,ParentTypeID,TypeName", "1=1"); dt = new DataTable(); dt = ds.Tables[0]; if (dt.Rows.Count == 0) { Response.Write("数据库中没有产品类型数据,请直接输入0即可…"); return; } DataView dv = new DataView(dt, "ParentTypeID=0 or ParentTypeID=null", "TypeID", DataViewRowState.CurrentRows); //遍历父节点 foreach (DataRowView d in dv) { TreeNode n = new TreeNode(d["TypeName"].ToString(), d["TypeID"].ToString()); n.ImageToolTip = dt.TableName; n.NavigateUrl = "javascript:ReturnValue(" + d["TypeID"].ToString() + ");"; TreeView1.Nodes.Add(n); n.Expanded = false; //根据父节点筛选出对应的子节点 dv = new DataView(dt, " ParentTypeID='" + d["TypeID"] + "'", "TypeID", DataViewRowState.CurrentRows); if (dv.Count > 0) { CreateSubTreeView(n, dv); } } } ///

/// 添加子项 /// /// /// private void CreateSubTreeView(TreeNode n, DataView dv) { foreach (DataRowView d in dv) { TreeNode cn = new TreeNode(d["TypeName"].ToString(), d["TypeID"].ToString()); cn.NavigateUrl = "javascript:ReturnValue(" + d["TypeID"].ToString() + ");"; n.ChildNodes.Add(cn); DataView sdv = new DataView(dt, "ParentTypeID='" + d["TypeID"] + "'", "TypeID", DataViewRowState.CurrentRows); if (sdv.Count > 0) { CreateSubTreeView(cn, sdv); } } }

类型的添加:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProTypeInsert.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.Product.ProTypeInsert" %>

产品类型添加
类型名称
所属大类

添加的代码:

BioProTypeBLL typebll=new BioProTypeBLL(); BioProType type = new BioProType(); type.ParentTypeID = int.Parse(this.txtSupertTypeID.Text.Trim()) ; type.TypeName = this.txtTypeName.Text; if (typebll.ProTypeAdd(type) != 0) { ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('添加类型成功')", true); return; }

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

上一篇:图解Go里面的WaitGroup了解编程语言核心实现源码
下一篇:ASP.NET MVC之视图生成URL
相关文章

 发表评论

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