public void UpdateStockTaking(NZString UserCD, NZString MachineCD) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); dao.UpdateStockTaking(UserCD, MachineCD); dao.DeleteStockTakingTemp(UserCD, MachineCD); CommonLib.Common.CurrentDatabase.Commit(); } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }
public void InsertStockTakingTemp(List<ImportStockTakingDTO> listData) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); dao.DeleteStockTakingTemp(Common.CurrentUserInfomation.UserCD, Common.CurrentUserInfomation.Machine); foreach (ImportStockTakingDTO dto in listData) { dao.InsertStockTakingTemp(dto); } CommonLib.Common.CurrentDatabase.Commit(); } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }
public List<ImportStockTakingDTO> ValidateStockTakingTemp(NZString UserCD, NZString MachineCD) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { List<ImportStockTakingDTO> listError = null; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); listError = dao.ValidateStockTakingTemp(UserCD, MachineCD); CommonLib.Common.CurrentDatabase.Commit(); return listError; } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }
public DataTable LoadStockTakingEntryData(StockTakingDTO argStockTaking) { DataTable ret = null; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); ret = dao.LoadStockTakingEntryData(argStockTaking); return ret; }
public StockTakingDTO LoadLastStockTaking() { StockTakingDTO ret = null; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); ret = dao.LoadLastStockTaking(); return ret; }
public string GetTextEffectInventory(StockTakingDTO argStockTaking) { string strEffectInventory = ""; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); strEffectInventory = dao.GetTextEffectInventory(argStockTaking); return strEffectInventory; }
public bool CheckExistsStockTaking(StockTakingDTO argStockTaking) { bool bExistsStockTaking = false; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); bExistsStockTaking = dao.CheckExistsStockTaking(argStockTaking); return bExistsStockTaking; }
public int GetFlagRunUpdateProcess(StockTakingDTO argStockTaking) { int ret = 1; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); ret = dao.GetFlagRunUpdateProcess(argStockTaking); return ret; }
public bool CheckCompleteInputData(StockTakingDTO argStockTaking) { bool bCompleteInput = false; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); bCompleteInput = dao.CheckCompleteInputData(argStockTaking); return bCompleteInput; }
public bool CheckLocationRunUpdateProcess(StockTakingDTO argStockTaking) { bool bRunUpdateProcess = false; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); bRunUpdateProcess = dao.CheckLocationRunUpdateProcess(argStockTaking); return bRunUpdateProcess; }
public StockTakingDTO RunStockTakingPreProcess(StockTakingDTO argStockTaking) { StockTakingDTO ret = null; argStockTaking.CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD; argStockTaking.CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; argStockTaking.UPD_BY = CommonLib.Common.CurrentUserInfomation.UserCD; argStockTaking.UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); dao.RunStockTakingPreProcess(argStockTaking); return ret; }
public void UpdateStockTakingData(List<StockTakingDetailDTO> listDataInsert, List<StockTakingDetailDTO> listDataUpdate, List<StockTakingDetailDTO> listDataDelete) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); foreach (StockTakingDetailDTO dtoInsert in listDataInsert) { dao.InsertStockTakingEntry(dtoInsert); } foreach (StockTakingDetailDTO dtoUpdate in listDataUpdate) { dao.UpdateStockTakingEntry(dtoUpdate); } foreach (StockTakingDetailDTO dtoDelete in listDataDelete) { dao.DeleteStockTakingEntry(dtoDelete); } CommonLib.Common.CurrentDatabase.Commit(); } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }
public bool DoAdjustInventory() { StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); return dao.DoAdjustInventory(); }
public void RunStockTakingUpdateProcess(StockTakingDTO argStockTaking) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { argStockTaking.CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD; argStockTaking.CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; argStockTaking.UPD_BY = CommonLib.Common.CurrentUserInfomation.UserCD; argStockTaking.UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); //load stock taking entry data and set flag as adjusted DataTable dtStockTakingEntry = dao.LoadStockTakingForUpdateProcess(argStockTaking); InventoryBIZ inventoryBIZ = new InventoryBIZ(); InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoPeriod = bizPeriod.LoadCurrentPeriod(); DateTime dtmCurrentDate = Common.GetDatabaseDateTime().Date; DateTime dtmAdjustDate = dtmCurrentDate; if (dtmCurrentDate < dtoPeriod.PERIOD_BEGIN_DATE.StrongValue) { dtmAdjustDate = dtoPeriod.PERIOD_BEGIN_DATE.StrongValue; } else { if (dtmCurrentDate > dtoPeriod.PERIOD_END_DATE.StrongValue) { dtmAdjustDate = dtoPeriod.PERIOD_END_DATE.StrongValue; } else { dtmAdjustDate = dtmCurrentDate; } } //adjust inventory foreach (DataRow dr in dtStockTakingEntry.Rows) { InventoryTransactionDTO invTrans = ConvertToInventoryTransactionDTO(argStockTaking.STOCK_TAKING_DATE, dtmAdjustDate, dr); inventoryBIZ.AddInventoryTransaction(CommonLib.Common.CurrentDatabase, invTrans, true); } CommonLib.Common.CurrentDatabase.Commit(); } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }