using System; using System.Collections.Generic; using System.Linq; using System.Text; using CY.IDAL.Inquiry; using CY.Model; using System.Data; using System.Data.SqlClient; using System.Transactions; using CY.Infrastructure.Common; using CY.Model.Inquiry; namespace CY.SQLDAL { /// /// 纸张相关操作--SQL数据库操作 /// public class PaperInfoDAL : IPaperInfoDAL { private Database _dataBase = null; public PaperInfoDAL() { _dataBase = new Database(); } public PaperInfoDAL(Database dataBase) { _dataBase = dataBase; } /// /// 新增一条纸张记录 /// /// /// public bool InserModel(Infrastructure.Domain.IAggregateRoot model) { Model.SysInquiry_PaperInfo trueModel = model as Model.SysInquiry_PaperInfo; if (trueModel == null) { return false; } SqlParameter[] parameters = { new SqlParameter("@PapeId", SqlDbType.Int,4), new SqlParameter("@PaperName", SqlDbType.VarChar,50), new SqlParameter("@GramWeight", SqlDbType.Int,4), new SqlParameter("@DefaultBrandId",SqlDbType.Int,4), new SqlParameter("@Status", SqlDbType.Bit,1), new SqlParameter("@Operater", SqlDbType.VarChar,20), new SqlParameter("@OperateTime", SqlDbType.DateTime), new SqlParameter("@LastUpdateTime", SqlDbType.DateTime), new SqlParameter("@OrderNum", SqlDbType.Int,4), new SqlParameter("@PaperTypeId", SqlDbType.Int,4) }; parameters[0].Value = trueModel.PapeId; parameters[1].Value = trueModel.PaperName; parameters[2].Value = trueModel.GramWeight; parameters[3].Value = DBNull.Value; parameters[4].Value = trueModel.Status; parameters[5].Value = trueModel.Operater; parameters[6].Value = trueModel.OperateTime; parameters[7].Value = trueModel.LastUpdateTime; parameters[8].Value = trueModel.OrderNum; parameters[9].Value = trueModel.PaperTypeId; try { _dataBase.Query("SysInquiry_PaperInfo_ADD", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } ///// ///// 保存纸张的品牌列表 ///// //public bool SaveBrandListByPaper(SysInquiry_BrandListByPaper brandPaperModel,SysInquiry_PaperInfo paperModel) //{ // bool isSuccess = true; // isSuccess = DeleteBrandListByPaper(brandPaperModel); // isSuccess = InsertBrandByPaper(brandPaperModel); // if (isSuccess) // { // if (paperModel != null) // { // isSuccess = UpdateDefaultBrand(paperModel); // } // } // return isSuccess; //} /// /// 新增纸张的品牌 /// /// /// public bool InsertBrandByPaper(SysInquiry_BrandListByPaper model, SysInquiry_PaperInfo paperModel) { bool isSuccess = true; if (model == null) { isSuccess = false; } else { SqlParameter[] parameters = { new SqlParameter("@PaperId", SqlDbType.Int,4), new SqlParameter("@BrandId", SqlDbType.Int,4)}; parameters[0].Value = model.PaperId; parameters[1].Value = model.BrandId; try { _dataBase.Query("SysInquiry_BrandListByPaper_ADD", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } } if (isSuccess) { if (paperModel != null) { isSuccess = UpdateDefaultBrand(paperModel); } } return true; } /// /// 修改纸张的品牌 /// /// /// public bool UpdateBrandByPaper(SysInquiry_BrandListByPaper model, SysInquiry_PaperInfo paperModel,SysInquiry_PaperInfo orPaperModel) { bool isSuccess = true; if (model == null) { isSuccess = false; } else { SqlParameter[] parameters = { new SqlParameter("@PaperId", SqlDbType.Int,4), new SqlParameter("@BrandId", SqlDbType.Int,4)}; parameters[0].Value = model.PaperId; parameters[1].Value = model.BrandId; try { _dataBase.Query("SysInquiry_BrandListByPaper_Update", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } } if (isSuccess) { if (paperModel != null) { isSuccess = UpdateDefaultBrand(paperModel); } if (orPaperModel != null) { isSuccess = UpdateDefaultBrand(orPaperModel); } } return true; } /// /// 判断是否存在 /// /// public bool isExists(SysInquiry_BrandListByPaper model) { string condition = string.Empty; condition = " PaperId=" + model.PaperId + " and BrandId=" + model.BrandId + " "; IList result = _dataBase.SelectModel("*", "SysInquiry_BrandListByPaper", condition); if (result != null && result.Count > 0) return true; else return false; } /// /// 删除纸张的品牌 /// /// /// public bool DeleteBrandListByPaper(SysInquiry_BrandListByPaper model) { SqlParameter[] parameters = { new SqlParameter("@PaperId", SqlDbType.Int,4), new SqlParameter("@BrandId", SqlDbType.Int,4)}; parameters[0].Value = model.PaperId; parameters[1].Value = model.BrandId; try { _dataBase.Query("SysInquiry_BrandListByPaper_Delete", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } /// /// 修改一条纸张信息 /// /// /// public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model) { Model.SysInquiry_PaperInfo trueModel = model as Model.SysInquiry_PaperInfo; if (trueModel == null) { return false; } SqlParameter[] parameters = { new SqlParameter("@PapeId", SqlDbType.Int,4), new SqlParameter("@PaperName", SqlDbType.VarChar,50), new SqlParameter("@GramWeight", SqlDbType.Int,4), new SqlParameter("@DefaultBrandId",SqlDbType.Int,4), new SqlParameter("@Status", SqlDbType.Bit,1), new SqlParameter("@Operater", SqlDbType.VarChar,20), new SqlParameter("@OperateTime", SqlDbType.DateTime), new SqlParameter("@LastUpdateTime", SqlDbType.DateTime), new SqlParameter("@OrderNum", SqlDbType.Int,4), new SqlParameter("@PaperTypeId", SqlDbType.Int,4) }; parameters[0].Value = trueModel.PapeId; parameters[1].Value = trueModel.PaperName; parameters[2].Value = trueModel.GramWeight; parameters[3].Value = DBNull.Value; parameters[4].Value = trueModel.Status; parameters[5].Value = trueModel.Operater; parameters[6].Value = trueModel.OperateTime; parameters[7].Value = trueModel.LastUpdateTime; parameters[8].Value = trueModel.OrderNum; parameters[9].Value = trueModel.PaperTypeId; try { _dataBase.Query("SysInquiry_PaperInfo_Update", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } /// /// 修改纸张状态 /// /// /// public bool UpdatePaperStatus(SysInquiry_PaperInfo model) { if (model == null) { return true; } SqlParameter[] parameters = { new SqlParameter("@Status", SqlDbType.Bit,1), new SqlParameter("@PaperTypeId", SqlDbType.Int,4) }; parameters[0].Value = model.Status; parameters[1].Value = model.PaperTypeId; try { _dataBase.Query("SysInquiry_PaperInfo_Update2", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } /// /// 修改纸张的默认品牌 /// /// /// public bool UpdateDefaultBrand(SysInquiry_PaperInfo model) { if (model == null) return true; SqlParameter dfaultBrandIdPar = null; if (model.DefaultBrandId == null) { dfaultBrandIdPar = new SqlParameter("@DefaultBrandId", DBNull.Value); } else { dfaultBrandIdPar = new SqlParameter("@DefaultBrandId", model.DefaultBrandId.Value); } SqlParameter[] parameters = { new SqlParameter("@PapeId", SqlDbType.Int,4), dfaultBrandIdPar }; parameters[0].Value = model.PapeId; try { _dataBase.Query("SysInquiry_PaperInfo_Update1", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } /// /// 删除一条纸张信息 /// /// /// public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model) { Model.SysInquiry_PaperInfo trueModel = model as Model.SysInquiry_PaperInfo; if (trueModel == null) { return false; } SqlParameter[] parameters = { new SqlParameter("@KeyId", SqlDbType.Int,4) }; parameters[0].Value = trueModel.KeyId; try { _dataBase.Query("SysInquiry_PaperInfo_Delete", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } /// /// 分页获取纸张列表 /// /// 品牌名称 /// 分页参数 /// public IEnumerable GetPaperListByPaging(string paperName,int paperTypeId,string stauts,Infrastructure.Query.Pagination pa) { string selectTarget = " t.PapeId,t.PaperTypeOrderNum,t.OrderNum "; string fromSouce = string.Empty; fromSouce = "( SELECT DISTINCT a.PapeId,b.OrderNum AS PaperTypeOrderNum,a.OrderNum FROM SysInquiry_PaperInfo a INNER JOIN dbo.SysInquiry_PaperType b ON a.PaperTypeId=b.KeyId where a.PapeId!=0 "; if (!string.IsNullOrEmpty(paperName)) { fromSouce += " and a.PaperName LIKE '%" + paperName + "%' "; } if (paperTypeId != -1) { fromSouce += " and a.PaperTypeId=" + paperTypeId; } if (!string.IsNullOrEmpty(stauts)) { fromSouce += " and a.Status='" + stauts + "'"; } fromSouce += " ) AS t "; return _dataBase.SelectModelPage(pa, selectTarget, fromSouce, "t.PaperTypeOrderNum,t.OrderNum", "PaperTypeOrderNum,OrderNum",string.Empty); } /// /// 根据paperId获取纸张信息 /// /// /// public IEnumerable GetPaperList(int paperId) { string selectTarget = " a.KeyId,a.PapeId,a.DefaultBrandId,b.BrandName AS DefaultBrandName,a.GramWeight,a.PaperName,a.Status,a.PaperTypeId,a.OrderNum,c.PaperTypeName"; string fromSouce = " SysInquiry_PaperInfo a left JOIN dbo.SysInquiry_BrandInfo b ON a.DefaultBrandId=b.KeyId left join SysInquiry_PaperType c on a.PaperTypeId=c.KeyId "; string condition = string.Empty; condition = " PapeId=" + paperId; IList result = _dataBase.SelectModel(selectTarget, fromSouce , condition); return result; } /// /// 根据paperId获取其对应的品牌列表 /// /// /// public IEnumerable GetBrandInfoListByPaper(int paperId) { string selectTarget = "b.*"; string fromSouce = "dbo.SysInquiry_BrandListByPaper a INNER JOIN dbo.SysInquiry_BrandInfo b ON a.BrandId=b.KeyId "; string condition = string.Empty; condition = " a.PaperId=" + paperId + " ORDER BY b.OrderNum"; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); return result; } /// /// 判断是否有相同的纸扎名称 /// /// /// public bool IsExistspeperName(string peperName) { string condition = string.Empty; condition = " PaperName='" + peperName + "'"; IList result = _dataBase.SelectModel("*", "SysInquiry_PaperInfo", condition); if (result != null && result.Count != 0) { return true; } else { return false; } } /// /// 获取最新的纸张编号 /// /// public int GetNewPaperId() { string selColumns = " MAX(PapeId) as papeNum "; string tableSql = " SysInquiry_PaperInfo"; DataTable result = _dataBase.SelectModel(selColumns, tableSql, string.Empty); int newPaperId = 0; if (result != null && result.Rows.Count > 0) { string resultStr = result.Rows[0][0].ToString(); if (string.IsNullOrEmpty(resultStr)) { newPaperId = 1; } else { newPaperId = Convert.ToInt32(resultStr) + 1; } } else { newPaperId = 1; } return newPaperId; } /// /// 新增纸张 /// /// /// public bool InsertPaper(IList modelList, IList brandList) { bool isSuccess = true; using (TransactionScope scope = new TransactionScope()) { foreach (SysInquiry_PaperInfo model in modelList) { isSuccess = InserModel(model); if (!isSuccess) break; } //isSuccess = SaveBrandListByPaper(brandList); if (isSuccess) scope.Complete(); } return isSuccess; } /// /// 修改纸张 /// /// /// public bool UpdatePaper(IList modelList, IList brandList) { if (modelList == null || modelList.Count == 0) return false; int paperId = modelList[0].PapeId; List allPaperList = GetPaperList(paperId).ToList(); List insertPaperList = new List(); List updatePaperList = new List(); List deletePaperList = new List(); foreach (SysInquiry_PaperInfo obj in modelList) { if (!isExists(allPaperList, obj.GramWeight)) insertPaperList.Add(obj); else updatePaperList.Add(obj); } foreach (SysInquiry_PaperInfo obj in allPaperList) { if (!isExists(modelList.ToList(), obj.GramWeight)) deletePaperList.Add(obj); } bool isSuccess = true; using (TransactionScope scope = new TransactionScope()) { foreach (SysInquiry_PaperInfo model in insertPaperList) { isSuccess = InserModel(model); if (!isSuccess) break; } if (isSuccess) { foreach (SysInquiry_PaperInfo model in updatePaperList) { isSuccess = UpdateModel(model); if (!isSuccess) break; } } if (isSuccess) { foreach (SysInquiry_PaperInfo model in deletePaperList) { isSuccess = DeleteModel(model); if (!isSuccess) break; } } //if (isSuccess) //{ // isSuccess = SaveBrandListByPaper(brandList); //} if (isSuccess) scope.Complete(); } return isSuccess; } /// /// 判断是否存在 /// /// private bool isExists(List paperList, int gramWeight) { foreach (SysInquiry_PaperInfo model in paperList) { if (model.GramWeight == gramWeight) return true; } return false; } /// /// 获取有效的纸张列表(不包括自带纸) /// /// public IEnumerable GetPaperList() { string selectTarget = " a.*,b.PaperTypeName "; string fromSouce = " SysInquiry_PaperInfo a INNER JOIN SysInquiry_PaperType b ON a.PaperTypeId=b.KeyId "; string condition = " a.Status='true' and a.papeId<>0 ORDER BY b.OrderNum,a.OrderNum "; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); return result; } /// /// 获取纸张类型下的所有有效纸张 /// /// /// public IEnumerable GetPaperListByPaperType(int paperTypeId) { string condition = string.Empty; condition = " PaperTypeId=" + paperTypeId + " and Status='true' and papeId<>0 order by OrderNum"; IList result = _dataBase.SelectModel(" DISTINCT PapeId,PaperName,OrderNum ", "SysInquiry_PaperInfo", condition); return result; } /// /// 获取有效的纸张列表(包括自带纸) /// /// public IEnumerable GetAllPaperList() { string condition = string.Empty; condition = " Status='true' order by OrderNum "; IList result = _dataBase.SelectModel("*", "SysInquiry_PaperInfo", condition); return result; } /// /// 根据纸张Id和品牌Id获取纸价列表 /// /// /// /// /// public IEnumerable GetAllPaperPriceList(int paperId, int brandId, Guid inquiryId) { string selectTarget = " a.GramWeight,ISNULL(PaperPrice,0) AS PaperPrice "; string fromSouce = " dbo.SysInquiry_PaperInfo a LEFT JOIN dbo.Inquiry_PaperPriceInfo b ON a.PapeId=b.PaperId and a.gramweight=b.gramweight AND b.BrandId=" + brandId + " and FirmId='" + inquiryId.ToString() + "'"; string condition = " a.PapeId=" + paperId+" order by a.GramWeight"; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); return result; } /// /// 根据纸张Id和品牌Id获取系统设置的纸价列表 /// /// /// /// private IEnumerable GetAllPaperPriceListByAdmin(int paperId, int brandId) { string selectTarget = " a.GramWeight,ISNULL(PaperPrice,0) AS PaperPrice "; string fromSouce = " dbo.SysInquiry_PaperInfo a LEFT JOIN dbo.Inquiry_PaperPriceInfo b ON a.PapeId=b.PaperId and a.gramweight=b.gramweight AND b.BrandId=" + brandId + " and FirmId='" + UtilConst.AdminFirmId + "'"; string condition = " a.PapeId=" + paperId; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); return result; } /// /// 根据纸张Id和品牌Id获取厂商设置的纸价列表 /// /// /// /// private IEnumerable GetAllPaperPriceListByFirm(int paperId, int brandId, string firmId) { string selectTarget = " a.GramWeight,ISNULL(PaperPrice,0) AS PaperPrice "; string fromSouce = " dbo.SysInquiry_PaperInfo a LEFT JOIN dbo.Inquiry_PaperPriceInfo b ON a.PapeId=b.PaperId and a.gramweight=b.gramweight AND b.BrandId=" + brandId; string condition = " a.PapeId=" + paperId + " and b.FirmId='" + firmId + "' and b.CustomerId is null "; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); return result; } /// /// 根据纸张Id和品牌Id获取厂商的客户设置的纸价列表 /// /// /// /// private IEnumerable GetAllPaperPriceListByCustomer(int paperId, int brandId, string firmId, string customerId) { string selectTarget = " a.GramWeight,ISNULL(PaperPrice,0) AS PaperPrice "; string fromSouce = " dbo.SysInquiry_PaperInfo a LEFT JOIN dbo.Inquiry_PaperPriceInfo b ON a.PapeId=b.PaperId and a.gramweight=b.gramweight AND b.BrandId=" + brandId; string condition = " a.PapeId=" + paperId + " and b.FirmId='" + firmId + "' and b.CustomerId='" + customerId + "'"; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); return result; } /// /// 根据纸张Id和品牌ID保存纸价 /// /// /// public bool SavePaperPrice(List modelList, InquiryCondition inquiryCondition) { bool isSuccess = true; using (TransactionScope scope = new TransactionScope()) { if (inquiryCondition.ActualFirmId != Guid.Parse(UtilConst.AdminFirmId)) { //执行复制全部询价参数数据 if (inquiryCondition.IsFirstSave()) { new CommonInquiryHelper(_dataBase).CopyALLInquiryParameter(inquiryCondition); } foreach (Inquiry_PaperPriceInfo model in modelList) { isSuccess = UpdatePaperPriceModel(model); if (!isSuccess) break; } } else { foreach (Inquiry_PaperPriceInfo model in modelList) { isSuccess = SavePaperPriceByGramWeightValue(model); if (!isSuccess) break; } } if (isSuccess) scope.Complete(); } return isSuccess; } /// /// 根据纸张Id和品牌ID,克重值保存纸价 /// /// /// /// /// /// /// /// private bool SavePaperPriceByGramWeightValue(Inquiry_PaperPriceInfo model) { bool isExits = IsExitsPaperPriceByGramWeightValue(model.PaperId, model.BrandId, model.GramWeight, model.PaperPrice, model.FirmId); if (isExits) { return UpdatePaperPriceModel(model); } else { return InsertPaperPriceModel(model); } return true; } /// /// 判断价格是否已存在 /// /// /// /// /// /// /// /// private bool IsExitsPaperPriceByGramWeightValue(int paperId, int brandId, int gramWeightValue, decimal paperPrice, Guid firmId) { string selectTarget = " KeyId "; string fromSouce = " Inquiry_PaperPriceInfo "; string condition = string.Empty; condition = " PaperId=" + paperId + " AND BrandId=" + brandId + " AND GramWeight=" + gramWeightValue + " AND FirmId='" + firmId + "'"; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); if (result == null || result.Count == 0) return false; else return true; } /// /// 新增纸价信息 /// private bool InsertPaperPriceModel(Inquiry_PaperPriceInfo model) { Model.Inquiry_PaperPriceInfo trueModel = model as Model.Inquiry_PaperPriceInfo; if (trueModel == null) { return false; } SqlParameter[] parameters = { new SqlParameter("@FirmId", SqlDbType.UniqueIdentifier,16), new SqlParameter("@PaperId", SqlDbType.Int,4), new SqlParameter("@GramWeight", SqlDbType.Int,4), new SqlParameter("@BrandId", SqlDbType.Int,4), new SqlParameter("@PaperPrice", SqlDbType.Money,8), new SqlParameter("@Unit", SqlDbType.VarChar,10), new SqlParameter("@Status", SqlDbType.Bit,1), new SqlParameter("@Operater", SqlDbType.VarChar,20), new SqlParameter("@OperateTime", SqlDbType.DateTime), new SqlParameter("@LastUpdateTime", SqlDbType.DateTime) }; parameters[0].Value = trueModel.FirmId; parameters[1].Value = trueModel.PaperId; parameters[2].Value = trueModel.GramWeight; parameters[3].Value = trueModel.BrandId; parameters[4].Value = trueModel.PaperPrice; parameters[5].Value = trueModel.Unit; parameters[6].Value = trueModel.Status; parameters[7].Value = trueModel.Operater; parameters[8].Value = trueModel.OperateTime; parameters[9].Value = trueModel.LastUpdateTime; try { _dataBase.Query("Inquiry_PaperPriceInfo_ADD", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } /// /// 修改纸张价格 /// /// /// private bool UpdatePaperPriceModel(Inquiry_PaperPriceInfo model) { Model.Inquiry_PaperPriceInfo trueModel = model as Model.Inquiry_PaperPriceInfo; if (trueModel == null) { return false; } SqlParameter[] parameters = { new SqlParameter("@FirmId", SqlDbType.UniqueIdentifier,16), new SqlParameter("@PaperId", SqlDbType.Int,4), new SqlParameter("@GramWeight", SqlDbType.Int,4), new SqlParameter("@BrandId", SqlDbType.Int,4), new SqlParameter("@PaperPrice", SqlDbType.Money,8), new SqlParameter("@Operater", SqlDbType.VarChar,20), new SqlParameter("@LastUpdateTime", SqlDbType.DateTime) }; parameters[0].Value = trueModel.FirmId; parameters[1].Value = trueModel.PaperId; parameters[2].Value = trueModel.GramWeight; parameters[3].Value = trueModel.BrandId; parameters[4].Value = trueModel.PaperPrice; parameters[5].Value = trueModel.Operater; parameters[6].Value = trueModel.LastUpdateTime; try { _dataBase.Query("Inquiry_PaperPriceInfo_Update", CommandType.StoredProcedure, parameters); } catch (Exception ex) { throw ex; } return true; } public decimal GetTonsOfPrice(int paperId, int gramWeight, int brandId, Guid inquiryId) { decimal tonsOfPrice = 0; string selectTarget = " PaperPrice "; string fromSouce = " Inquiry_PaperPriceInfo "; string condition = string.Empty; condition = " PaperId=" + paperId + " AND BrandId=" + brandId + " AND GramWeight=" + gramWeight + " AND FirmId='" + inquiryId.ToString() + "'"; IList result = _dataBase.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { tonsOfPrice = result[0].PaperPrice; } return tonsOfPrice; } /// /// 获取纸张的品牌列表,第一个是默认品牌 /// /// /// public IList GetBrandInfoByPaper(int paperId) { IList resultList = new List(); IList paperList = GetPaperList(paperId).ToList(); int defaultBrandId = -1; if (paperList != null && paperList.Count()>0) { if (paperList[0].DefaultBrandId.HasValue) { defaultBrandId = paperList[0].DefaultBrandId.Value; BrandInfoDAL _brandInfoDAL = new BrandInfoDAL(_dataBase); SysInquiry_BrandInfo defaultModel = _brandInfoDAL.SelectModelByKey(defaultBrandId); if (defaultModel!=null) resultList.Add(defaultModel); } } string selectTarget = " b.* "; string fromSouce = " dbo.SysInquiry_BrandListByPaper a INNER JOIN dbo.SysInquiry_BrandInfo b ON a.BrandId=b.KeyId "; string condition = " a.PaperId=" + paperId + " and a.BrandId<>" + defaultBrandId + " and b.Status='1' ORDER BY b.OrderNum "; IList brandInfoList = _dataBase.SelectModel(selectTarget, fromSouce, condition); if (brandInfoList != null && brandInfoList.Count > 0) { foreach (SysInquiry_BrandInfo brand in brandInfoList) { resultList.Add(brand); } } return resultList; } /// /// 获取最新排序顺序 /// /// public int GetOrderNumByMax(int paperTypeId) { int orderNum = 1; IList result = _dataBase.SelectModel(" MAX(OrderNum)+1 AS OrderNum ", "SysInquiry_PaperInfo", " PaperTypeId=" + paperTypeId); if (result != null && result.Count > 0) { orderNum = result[0].OrderNum.Value; } return orderNum; } } }