public int GetNextSequenceOfUpperItem(NZString UPPER_ITEM_CD) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); int maxSeq = dao.LoadMaxSequenceOfUpperItem(null, UPPER_ITEM_CD); return(maxSeq + 1); }
public int AddNew(ItemDTO dtoItem, List <ItemProcessDTO> NewProcess, List <BOMDTO> NewComponent, List <ItemMachineDTO> NewItemMachine) { ItemValidator validator = new ItemValidator(); validator.ValidateBeforeSaveNew(dtoItem, null); Database db = CommonLib.Common.CurrentDatabase; db.KeepConnection = true; db.BeginTransaction(); try { ItemDAO daoItem = new ItemDAO(CommonLib.Common.CurrentDatabase); daoItem.AddNew(null, dtoItem); ItemProcessDAO daoItemProcess = new ItemProcessDAO(CommonLib.Common.CurrentDatabase); BOMDAO daoBOM = new BOMDAO(CommonLib.Common.CurrentDatabase); ItemMachineDAO daoItemMachine = new ItemMachineDAO(CommonLib.Common.CurrentDatabase); foreach (ItemProcessDTO dto in NewProcess) { daoItemProcess.AddNew(null, dto); } //Component foreach (BOMDTO dto in NewComponent) { daoBOM.AddNew(null, dto); } //Item Machine foreach (ItemMachineDTO dto in NewItemMachine) { daoItemMachine.AddNew(null, dto); } db.Commit(); return(1); } catch (Exception err) { db.Rollback(); throw err; } finally { if (db.DBConnectionState == ConnectionState.Open) { db.Close(); } } }
public List <ItemComponentDTO> LoadItemComponentList(NZString ItemCD) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadComponentListByItemCD(null, ItemCD)); }
public int UpdateWithoutPK(ItemDTO dtoItem, List <ItemProcessDTO> NewProcess, List <ItemProcessDTO> EditProcess, List <ItemProcessDTO> DeleteProcess, List <BOMDTO> NewComponent, List <BOMDTO> EditComponent, List <BOMDTO> DeleteComponent, List <ItemMachineDTO> ItemMachine) { ItemValidator validator = new ItemValidator(); validator.ValidateBeforeSaveUpdate(dtoItem, null); Database db = CommonLib.Common.CurrentDatabase; db.KeepConnection = true; db.BeginTransaction(); try { ItemDAO daoItem = new ItemDAO(CommonLib.Common.CurrentDatabase); daoItem.UpdateWithoutPK(null, dtoItem); ItemProcessDAO daoItemProcess = new ItemProcessDAO(CommonLib.Common.CurrentDatabase); BOMDAO daoBOM = new BOMDAO(CommonLib.Common.CurrentDatabase); ItemMachineDAO daoItemMachine = new ItemMachineDAO(CommonLib.Common.CurrentDatabase); foreach (ItemProcessDTO dto in DeleteProcess) { daoItemProcess.Delete(null, dto.ITEM_CD, dto.ITEM_SEQ); } foreach (ItemProcessDTO dto in NewProcess) { daoItemProcess.AddNew(null, dto); } foreach (ItemProcessDTO dto in EditProcess) { daoItemProcess.UpdateWithoutPK(null, dto); } //Component foreach (BOMDTO dto in DeleteComponent) { daoBOM.Delete(null, dto.UPPER_ITEM_CD, dto.LOWER_ITEM_CD, dto.ITEM_SEQ); } foreach (BOMDTO dto in NewComponent) { daoBOM.AddNew(null, dto); } foreach (BOMDTO dto in EditComponent) { daoBOM.UpdateWithoutPK(null, dto); } //Item Machine daoItemMachine.DelteItemMachineByItemCD(dtoItem.ITEM_CD); foreach (ItemMachineDTO dto in ItemMachine) { daoItemMachine.AddNew(null, dto); } db.Commit(); return(1); } catch (Exception err) { db.Rollback(); throw err; } finally { if (db.DBConnectionState == ConnectionState.Open) { db.Close(); } } }
public int UpdateWithPK(BOMDTO dto, NZString oldUPPER_ITEM_CD, NZString oldLOWER_ITEM_CD, NZInt oldITEM_SEQ) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.UpdateWithPK(null, dto, oldUPPER_ITEM_CD, oldLOWER_ITEM_CD, oldITEM_SEQ)); }
public int AddNew(BOMDTO dto) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.AddNew(null, dto)); }
public ItemProcessDTO LoadLocationandMRPFLag(string strItemCode) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadLocationandMRPFlag(null, strItemCode)); }
public DataTable LoadBOMList() { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadBOMList()); }
public List <BOMSetupViewDTO> LoadBOMByKey(NZString UPPER_ITEM_CD, NZString LOWER_ITEM_CD) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadBOMSetup(null, UPPER_ITEM_CD, LOWER_ITEM_CD)); }
/// <summary> /// Load Child Part With Level Fix /// </summary> /// <param name="ITEM_CD"></param> /// <param name="Level"></param> /// <returns></returns> public List <BOMSetupViewDTO> LoadChildPartWithLevelFix(NZString ITEM_CD, int Level) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadChildPartWithLevelFix(null, ITEM_CD, Level)); }
public List <BOMSetupDTO> LoadBOMImplosion(NZString LOWER_ITEM_CD) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadBOMImplosion(null, LOWER_ITEM_CD)); }
public List <ComponentUsageDTO> LoadComponentUsage(NZString strMasterNo, NZDecimal decQty) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadComponentUsage(null, strMasterNo, decQty)); }
public string LoadMRPFLag(NZString strMRPFLag) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadMRPFLag(null, strMRPFLag)); }
public NZString FindMRPFlag(NZString strMRPFlag) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.FindMRPFlag(null, strMRPFlag)); }
public int Delete(BOMDTO dto) { BOMDAO dao = new BOMDAO(CommonLib.Common.CurrentDatabase); return(dao.Delete(null, dto.UPPER_ITEM_CD, dto.LOWER_ITEM_CD, dto.ITEM_SEQ)); }