/// <summary> /// InsertInfo /// </summary> /// <param name="info"></param> /// <returns></returns> public bool InsertInfo(InboundTypeInfo info) { int cnt = dal.GetCounts("[ITEM_NAME] = N'" + info.ItemName + "' and [CODE_FID] = N'" + codeFid + "'"); if (cnt > 0) { throw new Exception("MC:0x00000119");///进仓类型不能重复 } string itemValue = new SeqDefineDAL().GetCurrentCode("INBOUND_TYPE_VALUE"); cnt = dal.GetCounts("[ITEM_VALUE] = " + itemValue + " and [CODE_FID] = N'" + codeFid + "'"); if (cnt > 0 || string.IsNullOrEmpty(itemValue)) { throw new Exception("MC:0x00000119");///进仓类型不能重复 } CodeItemInfo codeItemInfo = new CodeItemInfo(); codeItemInfo.Fid = Guid.NewGuid(); codeItemInfo.ItemValue = int.Parse(itemValue); codeItemInfo.ItemName = info.ItemName; codeItemInfo.Comments = info.Comments; codeItemInfo.CodeFid = Guid.Parse(codeFid); codeItemInfo.ValidFlag = true; codeItemInfo.CreateUser = info.CreateUser; codeItemInfo.CreateDate = info.CreateDate; return(dal.Add(codeItemInfo) > 0 ? true : false); }
/// <summary> /// SelectInfo /// </summary> /// <param name="id"></param> /// <returns></returns> public InboundTypeInfo SelectInfo(long id) { CodeItemInfo codeItemInfo = dal.GetInfo(id); if (codeItemInfo == null) { throw new Exception("MC:0x00000084");///数据错误 } InboundTypeInfo inboundTypeInfo = new InboundTypeInfo(); inboundTypeInfo.Id = codeItemInfo.Id; inboundTypeInfo.ItemValue = codeItemInfo.ItemValue.GetValueOrDefault(); inboundTypeInfo.ItemName = codeItemInfo.ItemName; inboundTypeInfo.Comments = codeItemInfo.Comments; inboundTypeInfo.ValidFlag = codeItemInfo.ValidFlag.GetValueOrDefault(); inboundTypeInfo.CreateUser = codeItemInfo.CreateUser; inboundTypeInfo.CreateDate = codeItemInfo.CreateDate.GetValueOrDefault(); return(inboundTypeInfo); }
/// <summary> /// GetListByPage /// </summary> /// <param name="textWhere"></param> /// <param name="textOrder"></param> /// <param name="pageIndex"></param> /// <param name="pageRow"></param> /// <param name="dataCount"></param> /// <returns></returns> public List <InboundTypeInfo> GetListByPage(string textWhere, string textOrder, int pageIndex, int pageRow, out int dataCount) { textWhere += " and [CODE_FID] = N'" + codeFid + "'"; dataCount = dal.GetCounts(textWhere); List <CodeItemInfo> codeItemInfos = dal.GetListByPage(textWhere, textOrder, pageIndex, pageRow); List <InboundTypeInfo> inboundTypeInfos = new List <InboundTypeInfo>(); foreach (var codeItemInfo in codeItemInfos) { InboundTypeInfo inboundTypeInfo = new InboundTypeInfo(); inboundTypeInfo.Id = codeItemInfo.Id; inboundTypeInfo.ItemValue = codeItemInfo.ItemValue.GetValueOrDefault(); inboundTypeInfo.ItemName = codeItemInfo.ItemName; inboundTypeInfo.Comments = codeItemInfo.Comments; inboundTypeInfo.ValidFlag = codeItemInfo.ValidFlag.GetValueOrDefault(); inboundTypeInfo.CreateUser = codeItemInfo.CreateUser; inboundTypeInfo.CreateDate = codeItemInfo.CreateDate.GetValueOrDefault(); inboundTypeInfos.Add(inboundTypeInfo); } return(inboundTypeInfos); }