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" %>