private void ValidateBeforeSave() { AdjustmentValidator adjustmentValidator = new AdjustmentValidator(); ItemValidator itemValidator = new ItemValidator(); DealingValidator locationValidator = new DealingValidator(); TransactionValidator valTran = new TransactionValidator(); CommonBizValidator commonVal = new CommonBizValidator(); ValidateException.ThrowErrorItem(adjustmentValidator.CheckEmptyAdjustDate(new NZDateTime(dtAdjustDate, dtAdjustDate.Value))); ValidateException.ThrowErrorItem(adjustmentValidator.CheckEmptyReasonCode(new NZString(cboReasonCode, cboReasonCode.SelectedValue))); ValidateException.ThrowErrorItem(valTran.DateIsInCurrentPeriod(new NZDateTime(dtAdjustDate, dtAdjustDate.Value))); ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(new NZString(txtMasterNo, txtMasterNo.Text.Trim()))); ValidateException.ThrowErrorItem(locationValidator.CheckEmptyLocationCode(new NZString(cboStoredLoc, cboStoredLoc.SelectedValue))); if (cboStoredLoc.SelectedValue == null) { return; } string strProcess = cboStoredLoc.SelectedValue.ToString(); DealingConstraintDTO constriant = bizConstraint.LoadDealingConstraint(strProcess.ToNZString()); AdjustmentValidator validator = new AdjustmentValidator(); ErrorItem errorItem = null; //if (constriant != null && constriant.ENABLE_PACK_FLAG.StrongValue == 1) //{ // errorItem = validator.CheckEmptyPackNo(txtPackNo.ToNZString()); // if (null != errorItem) // ValidateException.ThrowErrorItem(errorItem);//error.AddError(errorItem); //} if (rdoDecrease.Checked && constriant != null && constriant.ENABLE_PACK_FLAG.StrongValue == 1) { errorItem = validator.CheckEmptyPackNo(txtPackNo.ToNZString()); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } } if (constriant != null && constriant.ENABLE_LOT_FLAG.StrongValue == 1) { errorItem = validator.CheckEmptyLotNo(txtLotNo.ToNZString()); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem);//error.AddError(errorItem); } FormatUtil.CheckFormatLotNo(new NZString(txtLotNo, txtLotNo.Text.Trim())); //errorItem = validator.CheckEmptyCustomerLotNo(txtCustomerLotNo.ToNZString()); //if (null != errorItem) // ValidateException.ThrowErrorItem(errorItem);//error.AddError(errorItem); } ValidateException.ThrowErrorItem(adjustmentValidator.CheckEmptyAdjustQty(new NZDecimal(txtAdjustQty, txtAdjustQty.Decimal))); ValidateException.ThrowErrorItem(adjustmentValidator.CheckIsZeroAdjustQty(new NZDecimal(txtAdjustQty, txtAdjustQty.Decimal))); }
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); }
private void TRN020_Load(object sender, EventArgs e) { InitializeScreen(); if (m_editReceiveNo == null) { SetScreenMode(Common.eScreenMode.ADD); ClearAll(); m_model = new ReceivingEntryUIDM(); dmcReceive.LoadData(m_model); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN020.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN020.SYS_KEY.DEFAULT_DATE.ToString(); dtReceiveDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); shtView.RowCount = 0; shtView.DataSource = m_model.DATA_VIEW; try { if (rdoReceive.Checked) { cboStoredLoc.SelectedValue = m_strDefaultLocation; } } catch { } } else { InventoryBIZ bizInventory = new InventoryBIZ(); ClearAll(); m_model = m_controller.LoadData(m_editReceiveNo); List <InventoryTransactionViewDTO> dtos = DTOUtility.ConvertDataTableToList <InventoryTransactionViewDTO>(m_model.DATA_VIEW); // bizInventory.LoadTransactionViewByReceiveNo(m_editReceiveNo); if (dtos.Count > 0) { bool bCanEdit = m_transactionValidator.DateIsInCurrentPeriod(dtos[0].TRANS_DATE.StrongValue) == null; if (bCanEdit) { SetScreenMode(Common.eScreenMode.EDIT); } else { SetScreenMode(Common.eScreenMode.VIEW); } } else { SetScreenMode(Common.eScreenMode.VIEW); } dmcReceive.LoadData(m_model); shtView.RowCount = 0; shtView.DataSource = m_model.DATA_VIEW; //int row = shtView.Rows.Count; //// set amount value //if (row > 0) //{ // for (int i = 0; i < row; i++) // { // shtView.Cells[i, (int)eColView.AMOUNT].Value = Convert.ToDouble(shtView.Cells[i, (int)eColView.ORDER_QTY].Value) // * Convert.ToDouble(shtView.Cells[i, (int)eColView.PRICE].Value); // } //} } CheckCurrentInvPeriod(); }