public ErrorItem CheckWorkResultDate(NZDateTime date) { if (date.IsNull) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0046.ToString())); } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto == null) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0047.ToString())); } // edit by tar // AddMonths(1) to period end date if (date.StrongValue.Date.CompareTo(dto.PERIOD_BEGIN_DATE.StrongValue.Date) < 0 || date.StrongValue.Date.CompareTo(dto.PERIOD_END_DATE.StrongValue.AddMonths(1).Date) > 0) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0047.ToString())); } return(null); }
public ErrorItem CheckIssueDate(NZDateTime IssueDate) { if (IssueDate.IsNull) { return(new ErrorItem(IssueDate.Owner, TKPMessages.eValidate.VLM0031.ToString())); } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); //NZString YearMonth = new NZString(IssueDate.Owner, IssueDate.StrongValue.ToString("yyyyMM")); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto == null) { return(new ErrorItem(IssueDate.Owner, TKPMessages.eValidate.VLM0032.ToString())); } // edit by tar // AddMonths(1) to period end date if (dto.PERIOD_BEGIN_DATE.StrongValue.Date > IssueDate.StrongValue.Date || dto.PERIOD_END_DATE.StrongValue.AddMonths(1).Date < IssueDate.StrongValue.Date) { return(new ErrorItem(IssueDate.Owner, TKPMessages.eValidate.VLM0032.ToString())); } return(null); }
private void InitializeScreen() { InitializeSpread(); InitialFormat(); //txt.KeyPress += CommonLib.CtrlUtil.SetRestrictKeyInput; //txtSearch.KeyPress += CommonLib.CtrlUtil.SetRestrictKeyInput; //txtSearch.TextChanged += CommonLib.CtrlUtil.FilterRestrictChar; dtPeriodBegin.KeyPress += CtrlUtil.SetNextControl; dtPeriodEnd.KeyPress += CtrlUtil.SetNextControl; dtPeriodBegin.Format = Common.CurrentUserInfomation.DateFormatString; dtPeriodEnd.Format = Common.CurrentUserInfomation.DateFormatString; CtrlUtil.EnabledControl(false, txtAmount, txtAmountTHB, txtQty); InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriodWithQueryRange(); if (dto != null) { dtPeriodBegin.Value = dto.PERIOD_BEGIN_DATE.StrongValue; dtPeriodEnd.Value = dto.PERIOD_END_DATE.StrongValue; } }
private void LoadDefaultPeriod() { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); dtMonth.NZValue = dto.PERIOD_BEGIN_DATE; }
private ErrorItem CheckCanRunProcess() { try { // get year month InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoPeriod = bizPeriod.LoadCurrentPeriod(); if (!dtoPeriod.YEAR_MONTH.StrongValue.Equals(Convert.ToDateTime(dtpStockTakingDate.Value).ToString("yyyyMM"))) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0084.ToString(), new[] { "" })); } if (Convert.ToDateTime(dtpLastSTKDate.DateValue) > Convert.ToDateTime(dtpStockTakingDate.Value)) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0084.ToString(), new[] { "" })); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } return(null); }
private void InitialScreen() { picWaiting.Visible = false; switch (CommonLib.Common.CurrentUserInfomation.DateFormat) { case eDateFormat.DMY: case eDateFormat.MDY: dtInventoryMonth.Format = "MM/yyyy"; break; case eDateFormat.YMD: dtInventoryMonth.Format = "yyyy/MM"; break; } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); DateTime currentYearMonth = new DateTime( Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)), Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), 1); dtInventoryMonth.DateValue = currentYearMonth; CommonLib.CtrlUtil.EnabledControl(false, txtInfo, dtInventoryMonth); }
private void InitialScreen() { InitailSpread(); InitialComboBox(); tsbNew.Visible = false; tsSeperator1.Visible = false; //txtSearch.KeyPress += CommonLib.CtrlUtil.SetRestrictKeyInput; //txtSearch.KeyUp += CommonLib.CtrlUtil.FilterRestrictChar; dtPeriodBegin.Format = Common.CurrentUserInfomation.DateFormatString; dtPeriodEnd.Format = Common.CurrentUserInfomation.DateFormatString; //NZString YearMonth = new NZString(null, Common.GetDatabaseDateTime().ToString("yyyyMM")); InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto != null) { dtPeriodBegin.Value = dto.PERIOD_BEGIN_DATE.StrongValue; dtPeriodEnd.Value = dto.PERIOD_END_DATE.StrongValue; } LoadData(); dtPeriodBegin.Focus(); }
private void LoadDefaultPeriod(bool LoadCurrentPeriod, bool LoadDefaultYearMonth) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto; if (LoadCurrentPeriod) { dto = biz.LoadCurrentPeriod(); } else { dto = biz.LoadPeriodByDate(new NZDateTime(dtInventoryMonth, dtInventoryMonth.Value)); } if (dto != null) { int year = Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)); int month = Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)); if (LoadDefaultYearMonth) { dtInventoryMonth.Value = new DateTime(year, month, 1); } dtPeriodFrom.Value = dto.PERIOD_BEGIN_DATE.StrongValue; dtPeriodTo.Value = dto.PERIOD_END_DATE.StrongValue; } else { dtPeriodFrom.Value = new DateTime(dtInventoryMonth.Value.Value.Year, dtInventoryMonth.Value.Value.Month, 1); dtPeriodTo.Value = new DateTime(dtInventoryMonth.Value.Value.Year, dtInventoryMonth.Value.Value.Month, DateTime.DaysInMonth(dtInventoryMonth.Value.Value.Year, dtInventoryMonth.Value.Value.Month)); } }
private void LoadDefaultPeriod() { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriodWithQueryRange(); dtPeriodBegin.NZValue = dto.PERIOD_BEGIN_DATE; dtPeriodEnd.NZValue = dto.PERIOD_END_DATE; }
private void LoadItemData(string keyFilter) { //set ให้ show column ทั้งหมด shtView.Columns[0, shtView.Columns.Count - 1].Visible = true; InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ(); InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod(); DataTable dt = null; InventoryBIZ inventoryBIZ = new InventoryBIZ(); if (m_searchType == eSearchType.All) { dt = inventoryBIZ.LoadAllLotNo(inventoryPeriodDTO.YEAR_MONTH); shtView.Columns[(int)eColView.ON_HAND_QTY].Visible = false; } else if (m_searchType == eSearchType.DependOnItemAndLocation) { dt = inventoryBIZ.LoadAllLotNoByItemAndLocation(inventoryPeriodDTO.YEAR_MONTH, m_itemCode, m_locationCode); } else { dt = inventoryBIZ.LoadAllLotNo(inventoryPeriodDTO.YEAR_MONTH); shtView.Columns[(int)eColView.ON_HAND_QTY].Visible = false; } DataTable dtView = dt.Clone(); if (keyFilter != string.Empty) { // string filterString = string.Format(@" // {1} LIKE '%{0}%' // OR {2} LIKE '%{0}%' // ", keyFilter, eColView.LOT_NO, eColView.PACK_NO); string filterString = FilterStringUtil.GetFilterstring(dtView, keyFilter); //get only the rows you want DataRow[] results = dt.Select(filterString); //populate new destination table foreach (DataRow dr in results) { dtView.ImportRow(dr); } } else { foreach (DataRow dr in dt.Rows) { dtView.ImportRow(dr); } } fpView.DataSource = dtView; }
public ErrorItem CheckCurrentPeriod(NZString YearMonth) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto.YEAR_MONTH.StrongValue != YearMonth.StrongValue) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0078.ToString())); } return(null); }
private void TRN010_Load(object sender, EventArgs e) { InitializeScreen(); InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriodWithQueryRange(); dtPeriodBegin.NZValue = dto.PERIOD_BEGIN_DATE; dtPeriodEnd.NZValue = dto.PERIOD_END_DATE; LoadData(dto.PERIOD_BEGIN_DATE, dto.PERIOD_END_DATE); }
private NZString GetYearMonth(DateTime?dtDate) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadPeriodByDate(new NZDateTime(null, dtDate.Value)); if (dto == null) { return(new NZString(null, dtDate.Value.ToString("yyyyMM"))); } return(dto.YEAR_MONTH); }
public AdjustmentEntryUIDM ConvertDTOToUIDM(InventoryTransactionDTO dto) { AdjustmentEntryUIDM model = new AdjustmentEntryUIDM(); model.TransactionID = dto.TRANS_ID; model.AdjustNo = dto.SLIP_NO; model.AdjustDate = dto.TRANS_DATE; model.AdjustType = dto.IN_OUT_CLS; model.ItemCode = dto.ITEM_CD; model.StoredLoc = dto.LOC_CD; model.LotNo = dto.LOT_NO; model.PackNo = dto.PACK_NO; model.FGNo = dto.FG_NO; model.ExternalLotNo = dto.EXTERNAL_LOT_NO; model.AdjustWeight = dto.WEIGHT; model.AdjustQty = dto.QTY; model.Remark = dto.REMARK; model.ReasonCode = dto.TRAN_SUB_CLS; //== Get Item Description. ItemBIZ biz = new ItemBIZ(); ItemDTO itemDTO = biz.LoadItem(dto.ITEM_CD); model.ItemDesc = itemDTO.SHORT_NAME; //-- Get Customer Name DealingBIZ bizCust = new DealingBIZ(); DealingDTO dtoCust = bizCust.LoadLocation(itemDTO.CUSTOMER_CD); model.CustomerName = dtoCust.LOC_DESC; //== Get OnHand. InventoryBIZ inventoryBIZ = new InventoryBIZ(); InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ(); InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod(); InventoryOnhandDTO inventoryOnhandDTO = inventoryBIZ.LoadInventoryOnHandByDate(inventoryPeriodDTO.YEAR_MONTH, dto.TRANS_DATE, dto.ITEM_CD, dto.LOC_CD, dto.LOT_NO, dto.PACK_NO); if (inventoryOnhandDTO == null) { model.OnHandQty.Value = 0; } else { model.OnHandQty = inventoryOnhandDTO.ON_HAND_QTY; } return(model); }
private void RollingStart(eMonthlyCloseProcess ProcessType) { try { NZString YearMonth = Convert.ToDateTime(dtInventoryMonth.DateValue).ToString("yyyyMM").ToNZString(); InventoryPeriodValidator val = new InventoryPeriodValidator(); //val.CheckBeforeRunProcess(ProcessType); ErrorItem err = val.CheckBeforeRunClosingProcess(ProcessType, YearMonth); if (err != null) { MessageDialogResult cf = MessageDialog.ShowConfirmation(this, EVOFramework.Message.LoadMessage(TKPMessages.eValidate.VLM0076.ToString()).MessageDescription, MessageDialogButtons.YesNo); if (cf != MessageDialogResult.Yes) { return; } } MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(TKPMessages.eConfirm.CFM0005.ToString()).MessageDescription, MessageDialogButtons.YesNo); if (dr == MessageDialogResult.Yes) { if (RunProcess(ProcessType)) { MessageDialog.ShowBusiness(this, EVOFramework.Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString())); } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); DateTime currentYearMonth = new DateTime( Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)), Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), 1); dtInventoryMonth.DateValue = currentYearMonth; } } catch (ValidateException ex) { MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message); } catch (BusinessException ex) { MessageDialog.ShowBusiness(this, ex.Error.Message); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
/// <summary> /// check ว่ามีการทำ inventory move หรือยัง /// </summary> /// <returns></returns> public ErrorItem CheckInventoryCurrentPeriod() { InventoryPeriodBIZ bizInventoryPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoInventoryPeriod = bizInventoryPeriod.LoadCurrentPeriod(); if (IsInDateRange(dtoInventoryPeriod.PERIOD_BEGIN_DATE.StrongValue, dtoInventoryPeriod.PERIOD_END_DATE.StrongValue , CommonLib.Common.GetDatabaseDateTime())) { return(null); } return(new ErrorItem(null, SystemMaintenance.Messages.eInformation.INF9005.ToString())); //return false; }
/// <summary> /// Check if date is between date range of current period? /// </summary> /// <param name="checkDate"></param> /// <returns></returns> public ErrorItem DateIsInCurrentPeriod(DateTime checkDate) { InventoryPeriodBIZ bizInventoryPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoInventoryPeriod = bizInventoryPeriod.LoadCurrentPeriod(); if (dtoInventoryPeriod.PERIOD_BEGIN_DATE.StrongValue > checkDate.Date || dtoInventoryPeriod.PERIOD_END_DATE.StrongValue.AddMonths(1).Date < checkDate.Date) { //return new ErrorItem(null, Message.LoadMessage(TKPMessages.eValidate.VLM0075.ToString()).MessageDescription); return(new ErrorItem(null, TKPMessages.eValidate.VLM0075.ToString())); } //IsInDateRange(dtoInventoryPeriod.PERIOD_BEGIN_DATE.StrongValue, // dtoInventoryPeriod.PERIOD_END_DATE.StrongValue.AddMonths(1) // , checkDate) return(null); }
internal int UpdatePeriod(NZString YearMonth, NZDateTime PeriodBegin, NZDateTime PeriodEnd) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = new InventoryPeriodDTO(); dto.YEAR_MONTH = YearMonth; dto.PERIOD_BEGIN_DATE = PeriodBegin; dto.PERIOD_END_DATE = PeriodEnd; dto.CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD; dto.CRT_DATE.Value = CommonLib.Common.GetDatabaseDateTime(); dto.CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; dto.UPD_BY = CommonLib.Common.CurrentUserInfomation.UserCD; dto.UPD_DATE.Value = CommonLib.Common.GetDatabaseDateTime(); dto.UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; return(biz.UpdatePeriod(dto)); }
private bool ValidateMandatory() { if (!dtInvoiceDate.Value.HasValue) { ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Delivery Date" })); return(false); } if (cboCustomerCode.SelectedValue == null) { ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0105.ToString(), new object[] { "Customer Code" })); return(false); } // Validate Data before Save if (shtCustomerOrder.Rows.Count == 0) { ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0190.ToString())); } //if (!CheckChooseLotForOrder()) //{ // ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0194.ToString())); //} //if (!CheckChooseLotOverRemain()) //{ // ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0214.ToString())); //} ShipEntryValidator valShip = new ShipEntryValidator(); IssueEntryValidator valIssue = new IssueEntryValidator(); InventoryOnhandValidator valINV = new InventoryOnhandValidator(); TransactionValidator valTRN = new TransactionValidator(); CommonBizValidator commonVal = new CommonBizValidator(); ErrorItem errorItem; errorItem = valTRN.DateIsInCurrentPeriod(new NZDateTime(dtInvoiceDate, dtInvoiceDate.Value)); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } NZString YearMonth = new InventoryPeriodBIZ().LoadCurrentPeriod().YEAR_MONTH; return(true); }
public ErrorItem CheckOnhandQty(NZString YearMonth, NZString ItemCD, NZString FromLoc, NZString LotNo) { InventoryBIZ bizInv = new InventoryBIZ(); InventoryPeriodDTO dtoPeriod = new InventoryPeriodBIZ().LoadByPK(YearMonth); ActualOnhandViewDTO dtoOnhand = bizInv.LoadActualInventoryOnHand(ItemCD, FromLoc, LotNo); if (dtoOnhand == null) { return(new ErrorItem(YearMonth.Owner, TKPMessages.eValidate.VLM0029.ToString())); } if (dtoOnhand.ONHAND_QTY.IsNull || dtoOnhand.ONHAND_QTY.StrongValue == 0) { return(new ErrorItem(YearMonth.Owner, TKPMessages.eValidate.VLM0029.ToString())); } return(null); }
private void PUR010_Load(object sender, EventArgs e) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriodWithQueryRange(); dtPeriodBegin.NZValue = dto.PERIOD_BEGIN_DATE; dtPeriodEnd.NZValue = dto.PERIOD_END_DATE; dtPeriodBegin.Format = Common.CurrentUserInfomation.DateFormatString; dtPeriodEnd.Format = Common.CurrentUserInfomation.DateFormatString; shtView.Columns[(int)eColumn.DUE_DATE].CellType = CtrlUtil.CreateDateTimeCellType(); shtView.Columns[(int)eColumn.PO_DATE].CellType = CtrlUtil.CreateDateTimeCellType(); this.m_dtShown = m_BizPurchaseOrder.LoadPurchaseOrderDByPONo(Convert.ToDateTime(dtPeriodBegin.Value), Convert.ToDateTime(dtPeriodEnd.Value)); ShowSheet(this.m_dtShown); SetSpreadBGColor(); SetContextMenu(); }
private void InitializeScreen() { InitializeSpread(); //txtSearch.KeyPress += CommonLib.CtrlUtil.SetRestrictKeyInput; //txtSearch.KeyUp += CommonLib.CtrlUtil.FilterRestrictChar; dtPeriodBegin.KeyPress += CtrlUtil.SetNextControl; dtPeriodEnd.KeyPress += CtrlUtil.SetNextControl; dtPeriodBegin.Format = Common.CurrentUserInfomation.DateFormatString; dtPeriodEnd.Format = Common.CurrentUserInfomation.DateFormatString; InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriodWithQueryRange(); dtPeriodBegin.NZValue = dto.PERIOD_BEGIN_DATE; dtPeriodEnd.NZValue = dto.PERIOD_END_DATE; LoadData(dto.PERIOD_BEGIN_DATE, dto.PERIOD_END_DATE); }
/// <summary> /// Check empty and not in current period. /// </summary> /// <param name="date"></param> /// <returns></returns> public ErrorItem CheckReceiveDate(NZDateTime date) { if (date.IsNull) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0041.ToString())); } // Check in using period. InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ(); InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod(); InventoryPeriodValidator inventoryPeriodValidator = new InventoryPeriodValidator(); // fix by tar // AddMonths(1) to period end date if (date.StrongValue.Date < inventoryPeriodDTO.PERIOD_BEGIN_DATE.StrongValue.Date || date.StrongValue.Date > inventoryPeriodDTO.PERIOD_END_DATE.StrongValue.AddMonths(1).Date) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0042.ToString())); } return(null); }
private void LoadCurrentStockTakingData() { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); //DateTime currentYearMonth = new DateTime( // Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)), // Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), // 1); txtYearMonth.Text = dto.YEAR_MONTH; dtpStockTakingDate.Value = DateTime.Today; StockTakingBIZ stkBiz = new StockTakingBIZ(); StockTakingDTO stkDTO = stkBiz.LoadLastStockTaking(); if (stkDTO != null) { this.txtLastRemark.Text = stkDTO.REMARK; this.dtpLastSTKDate.DateValue = stkDTO.STOCK_TAKING_DATE; this.txtLastPreProcessBy.Text = stkDTO.PRE_PROCESS_BY + " - " + stkDTO.PRE_PROCESS_NAME; } //CommonLib.CtrlUtil.EnabledControl(false, txtInfo, dtInventoryMonth); }
private void InitialScreen() { InitailSpread(); InitialComboBox(); InitialFormat(); CtrlUtil.EnabledControl(false, txtAmount, txtQty); dtPeriodBegin.KeyPress += CtrlUtil.SetNextControl; dtPeriodEnd.KeyPress += CtrlUtil.SetNextControl; //txtSearch.KeyPress += CommonLib.CtrlUtil.SetRestrictKeyInput; //txtSearch.KeyUp += CommonLib.CtrlUtil.FilterRestrictChar; InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriodWithQueryRange(); if (dto != null) { dtPeriodBegin.Value = dto.PERIOD_BEGIN_DATE.StrongValue; dtPeriodEnd.Value = dto.PERIOD_END_DATE.StrongValue; } LoadData(); }
private bool CheckMandatory() { try { IssueEntryValidator val = new IssueEntryValidator(); CommonBizValidator commonVal = new CommonBizValidator(); #region Mandatory check ErrorItem errorItem; NZString FromLoc = new NZString(cboFromLoc, cboFromLoc.SelectedValue); NZString ToLoc = new NZString(cboToLoc, cboToLoc.SelectedValue); NZString ItemCD = new NZString(txtItemCode, txtItemCode.Text); NZString LotNo = new NZString(txtLotNo, txtLotNo.Text); InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadPeriodByDate(new NZDateTime(dtIssueDate, dtIssueDate.Value)); errorItem = val.CheckIssueDate(new NZDateTime(null, dtIssueDate.Value)); if (null != errorItem) { // ถ้าเป็น issue ของเดือนถัดไปจะต้องทำได้ errorItem = val.CheckIssueMonth(new NZDateTime(null, dtIssueDate.Value)); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } } errorItem = val.CheckEmptyItemCode(ItemCD); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } errorItem = val.CheckEmptyLocFrom(FromLoc); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } errorItem = val.CheckEmptyLocTo(ToLoc); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } errorItem = val.CheckFromToLocation(FromLoc, ToLoc); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } if (m_Mode == eSaveMode.ADD) { //if (txtLotNo.Text == string.Empty) // ValidateException.ThrowErrorItem(new ErrorItem(txtLotNo, // TKPMessages.eValidate.VLM0067.ToString(), // new[] { FromLoc.StrongValue })); errorItem = commonVal.CheckInputLot(ItemCD, FromLoc, LotNo, true); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } } if (txtIssueQty.Text.Trim() == string.Empty) { txtIssueQty.Text = "0"; } if (txtOnHandQty.Text.Trim() == string.Empty) { txtOnHandQty.Text = "0"; } errorItem = val.CheckIssueQTY(new NZDecimal(txtIssueQty, Convert.ToDecimal(txtIssueQty.Text))); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } #endregion return(true); } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (ValidateException err) { MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message); err.ErrorResults[0].FocusOnControl(); } return(false); }