/// <summary> /// 取得ChepPallet的所有记录数据 /// </summary> /// <param name="?"></param> /// <returns>IList<ChepPalletDef> chepList</returns> public IList<ChepPalletDef> GetChepPalletList() { IList<ChepPalletDef> chepList = new List<ChepPalletDef>(); IList<ChepPalletInfo> listInfo = new List<ChepPalletInfo>(); try { IPalletRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository>(); listInfo = itemRepository.GetChepPalletList(); foreach (ChepPalletInfo chepPalletInfo in listInfo) { ChepPalletDef item = new ChepPalletDef(); item.palletNo = chepPalletInfo.palletNo; item.editor = chepPalletInfo.editor; item.id = chepPalletInfo.id; if (chepPalletInfo.cdt == DateTime.MinValue) { item.cdt = ""; } else { item.cdt = ((System.DateTime)chepPalletInfo.cdt).ToString("yyyy-MM-dd HH:mm:ss"); } if (chepPalletInfo.udt == DateTime.MinValue) { item.udt = ""; } else { item.udt = ((System.DateTime)chepPalletInfo.udt).ToString("yyyy-MM-dd HH:mm:ss"); } chepList.Add(item); } return chepList; } catch (Exception) { throw; } }
/// <summary> /// 取得一条ChepPallet的记录数据 /// </summary> /// <param name="?">String chepPalletNo</param> /// <returns>ChepPalletDef chepPalletDef</returns> public ChepPalletDef GetChepPalletInfor(String chepPalletNo) { try { IPalletRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository>(); ChepPalletInfo chepPalletInfo = itemRepository.GetChepPalletInfo(chepPalletNo); ChepPalletDef chepPalletDef = new ChepPalletDef(); chepPalletDef.palletNo = chepPalletInfo.palletNo; chepPalletDef.editor = chepPalletInfo.editor; chepPalletDef.id = chepPalletInfo.id; if (chepPalletInfo.cdt == DateTime.MinValue) { chepPalletDef.cdt = ""; } else { chepPalletDef.cdt = ((System.DateTime)chepPalletInfo.cdt).ToString("yyyy-MM-dd HH:mm:ss"); } if (chepPalletInfo.udt == DateTime.MinValue) { chepPalletDef.udt = ""; } else { chepPalletDef.udt = ((System.DateTime)chepPalletInfo.udt).ToString("yyyy-MM-dd HH:mm:ss"); } return chepPalletDef; } catch (Exception) { throw; } }
/// <summary> /// 保存一条ChepPallet的记录数据(Add) /// </summary> /// <param name="Object">ChepPalletDef item</param> public void AddChepPallet(ChepPalletDef item) { FisException ex; List<string> paraError = new List<string>(); try { ChepPalletInfo chepPalletInfo = new ChepPalletInfo(); IPalletRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository>(); UnitOfWork uow = new UnitOfWork(); //检查要添加的信息是否已经存在 if (itemRepository.GetChepPalletInfo(item.palletNo) == null) { chepPalletInfo.palletNo = item.palletNo; chepPalletInfo.editor = item.editor; chepPalletInfo.cdt = DateTime.Now; chepPalletInfo.udt = DateTime.Now; itemRepository.AddGetChepPalletInfoDefered(uow, chepPalletInfo); uow.Commit(); } else { //要添加的数据已经存在 ex = new FisException("DMT072", paraError); throw ex; } } catch (Exception) { throw; } }
//添加处理 protected void btnAdd_ServerClick(Object sender, EventArgs e) { ChepPalletDef item = new ChepPalletDef(); string chepPallletNo = this.chepPalletNo.Text.Trim().ToUpper(); item.palletNo = chepPallletNo; item.editor = this.HiddenUserName.Value; try { iChepPallet.AddChepPallet(item); } catch (FisException ex) { ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "DealHideWait", "DealHideWait();", true); showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "DealHideWait", "DealHideWait();", true); //show error showErrorMessage(ex.Message); return; } //读取并显示列表信息 ShowChepPalletInfo(); chepPallletNo = replaceSpecialChart(chepPallletNo); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + chepPallletNo + "');DealHideWait();", true); }