/// <summary> /// /// </summary> /// <param name="data"></param> /// <exception cref="ValidateException"><c>ValidateException</c>.</exception> /// <exception cref="BusinessException"><c>BusinessException</c>.</exception> public void ValidateBeforeSaveNew(DealingDTO data) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; #region mandatory check errorItem = CheckEmptyLocationCode(data.LOC_CD); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckEmptyLocationName(data.LOC_DESC); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckEmptyLocationType(data.LOC_CLS); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); #endregion DealingDAO dao = new DealingDAO(CommonLib.Common.CurrentDatabase); if (dao.Exist(null, data.LOC_CD)) { errorItem = new ErrorItem(data.LOC_CD.Owner, TKPMessages.eValidate.VLM0005.ToString()); BusinessException businessException = new BusinessException(errorItem); throw businessException; } }
public bool ValidateBeforeUpdate(UserDTO userDTO) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; //errorItem = CheckPassword(userDTO.PASS); //if (errorItem != null) //{ // validateException.AddError(errorItem); // throw validateException; //} errorItem = CheckDefaultDateFormat(userDTO.DATE_FORMAT); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckDefaultLang(userDTO.LANG_CD); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckGroupCD(userDTO.GROUP_CD); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } return(true); }
/// <summary> /// /// </summary> /// <param name="userCD"></param> /// <param name="username"></param> /// <param name="oldPassword"></param> /// <param name="newPassword"></param> /// <param name="confirmNewPassword"></param> /// <param name="dateFormat"></param> /// <param name="langCD"></param> /// <returns></returns> /// <exception cref="EVOFramework.ValidationException"><c>ValidateException</c>.</exception> /// <exception cref="EVOFramework.BusinessException"><c>BusinessException</c>.</exception> public bool ValidateChangeUserProfile(NZString userCD, NZString username, NZString oldPassword, NZString newPassword, NZString confirmNewPassword, NZInt dateFormat, NZInt langCD) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckRequireUsername(username); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckRequireDefaultDateFormat(dateFormat); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckRequireDefaultLanguage(langCD); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); //==== Business Checker BizCheckChangePassword(userCD, oldPassword, newPassword, confirmNewPassword); return(true); }
/// <summary> /// Check data before save add. /// </summary> /// <param name="menuSubCD"></param> /// <param name="menuSubName"></param> /// <exception cref="EVOFramework.ValidateException"><c>ValidateException</c>.</exception> /// <exception cref="BusinessException"><c>BusinessException</c>.</exception> public void ValidateBeforeSaveAdd(NZString menuSubCD, NZString menuSubName) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckMenuSubCode(menuSubCD); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckMenuSubName(menuSubName); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); //~~~~~~~~~~~~~~~ MenuSubMaintenanceBIZ biz = new MenuSubMaintenanceBIZ(); if (biz.ExistMenuSub(menuSubCD)) { errorItem = new ErrorItem(menuSubCD.Owner, Messages.eValidate.VLM9016.ToString()); throw new BusinessException(errorItem); } }
//public ErrorItem CheckShipDate(NZDateTime ShipDate) //{ // if (ShipDate.IsNull) // return new ErrorItem(ShipDate.Owner, TKPMessages.eValidate.VLM0031.ToString()); // InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); // NZString YearMonth = new NZString(ShipDate.Owner, ShipDate.StrongValue.ToString("yyyyMM")); // InventoryPeriodDTO dto = biz.LoadByPK(YearMonth); // if (dto == null) // return new ErrorItem(ShipDate.Owner, TKPMessages.eValidate.VLM0032.ToString()); // if (dto.PERIOD_BEGIN_DATE.StrongValue > ShipDate.StrongValue // || dto.PERIOD_END_DATE.StrongValue < ShipDate.StrongValue) // return new ErrorItem(ShipDate.Owner, TKPMessages.eValidate.VLM0032.ToString()); // return null; //} #endregion public void ValidateBeforeSaveNew(InventoryTransactionDTO dto, NZDecimal OnhandQty) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; #region mandatory check errorItem = CheckEmptyItemCode(dto.ITEM_CD); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckShipQTY(dto.ITEM_CD, dto.LOC_CD, dto.LOT_NO, dto.QTY); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckShipDate(dto.TRANS_DATE); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); #endregion }
/// <summary> /// /// </summary> /// <param name="menuSubCD"></param> /// <param name="menuSubName"></param> /// <exception cref="EVOFramework.ValidateException"><c>ValidateException</c>.</exception> public void ValidateBeforeSaveEdit(NZString menuSubCD, NZString menuSubName) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckMenuSubCode(menuSubCD); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckMenuSubName(menuSubName); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); }
/// <summary> /// Update old data. /// </summary> /// <param name="oldTransactionID"></param> /// <param name="newDataModel"></param> public void SaveEdit(NZString oldTransactionID, AdjustmentEntryUIDM newDataModel) { try { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(System.Data.IsolationLevel.Serializable); ValidateException validateException = new ValidateException(); AdjustmentValidator adjustmentValidator = new AdjustmentValidator(); TransactionValidator valTran = new TransactionValidator(); ItemValidator itemValidator = new ItemValidator(); DealingValidator locationValidator = new DealingValidator(); //validateException.AddError(adjustmentValidator.CheckEmptyAdjustDate(newDataModel.AdjustDate)); //validateException.AddError(adjustmentValidator.CheckEmptyReasonCode(newDataModel.ReasonCode)); //validateException.AddError(valTran.DateIsInCurrentPeriod(newDataModel.AdjustDate)); //validateException.AddError(itemValidator.CheckEmptyItemCode(newDataModel.ItemCode)); BusinessException businessException = itemValidator.CheckItemNotExist(newDataModel.ItemCode); if (businessException != null) { validateException.AddError(businessException.Error); } //validateException.AddError(locationValidator.CheckEmptyLocationCode(newDataModel.StoredLoc)); validateException.AddError(locationValidator.CheckNotExistsLocationCode(newDataModel.StoredLoc)); //validateException.AddError(adjustmentValidator.CheckEmptyAdjustQty(newDataModel.AdjustQty)); //validateException.AddError(adjustmentValidator.CheckIsZeroAdjustQty(newDataModel.AdjustQty)); validateException.ThrowIfHasError(); InventoryBIZ inventoryBIZ = new InventoryBIZ(); InventoryTransactionDTO dto = ConvertUIDMToDTO(newDataModel); inventoryBIZ.UpdateInventoryTransaction(CommonLib.Common.CurrentDatabase, oldTransactionID, dto); CommonLib.Common.CurrentDatabase.Commit(); } catch (System.Exception) { CommonLib.Common.CurrentDatabase.Rollback(); throw; } }
public void ValidateBeforeSaveUpdate(InventoryPeriodDTO dtoInven) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; #region mandatory check errorItem = CheckEmptyYearMonth(dtoInven.YEAR_MONTH); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckEmptyPeriodBeginDate(dtoInven.PERIOD_BEGIN_DATE); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckEmptyPeriodEndDate(dtoInven.PERIOD_END_DATE); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckPeriodBeginToEndDate(dtoInven.PERIOD_BEGIN_DATE, dtoInven.PERIOD_END_DATE); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); //BusinessException businessException = CheckInventPeriod(dtoInven.YEAR_MONTH); //if (businessException != null) //{ // throw businessException; //} #endregion }
public bool ValidateBeforeAdd(UserGroupDTO usergroupDTO) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckExistGroupCD(usergroupDTO.GROUP_CD); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckUserName(usergroupDTO.GROUP_NAME); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } return(true); }
/// <summary> /// /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> /// <exception cref="BusinessException"><c>BusinessException</c>.</exception> /// <exception cref="ValidateException"><c>ValidateException</c>.</exception> public bool ValidateLogin(NZString username, NZString password) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckUsername(username); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckPassword(username, password); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } validateException.ThrowIfHasError(); UserBIZ userBiz = new UserBIZ(); UserDTO userDTO = userBiz.LoadUser(username); if (userDTO.FLG_ACTIVE.StrongValue != 1) { errorItem = new ErrorItem(null, "ERR00001", "Account doesn't activate."); throw new BusinessException(errorItem); } if (userDTO.FLG_RESIGN.StrongValue == 1) { errorItem = new ErrorItem(null, "ERR00002", "Account has resigned."); throw new BusinessException(errorItem); } return(true); }
internal bool ValidateBeforeAdd(SystemMaintenance.DTO.MenuSetDTO dto) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckExistMenuSet(dto.MENU_SET_CD); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } return(true); }
/// <summary> /// /// </summary> /// <param name="menuSubCD"></param> /// <exception cref="ValidateException"><c>ValidateException</c>.</exception> public void DeleteMenuSub(NZString menuSubCD) { MenuSubValidator validator = new MenuSubValidator(); ErrorItem item = validator.CheckMenuSubCode(menuSubCD); if (item != null) { ValidateException validateException = new ValidateException(); validateException.AddError(item); validateException.ThrowIfHasError(); } m_bizMenuSub.DeleteMenuSub(menuSubCD); }
/// <summary> /// Create user /// </summary> /// <param name="data"></param> /// <returns></returns> public int CreateUser(UserDTO data) { // Validate data ValidateException validator = new ValidateException(); if (data.USER_ACCOUNT.IsNull) { validator.AddError(data.USER_ACCOUNT.Owner, "VLD001"); } //data.ValidateFieldNotNull() validator.ThrowIfHasError(); // Business Check IUserDAO dao = DAOFactory.CreateUserDAO(CommonLib.Common.CurrentDatabase); dao.AddNew(null, data); return(0); }
public bool ValidateBeforeAdd(UserDTO userDTO) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; errorItem = CheckExistUserAccount(userDTO.USER_ACCOUNT); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckUserName(userDTO.FULL_NAME); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckPassword(userDTO.PASS); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckDefaultDateFormat(userDTO.DATE_FORMAT); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckDefaultLang(userDTO.LANG_CD); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } errorItem = CheckGroupCD(userDTO.GROUP_CD); if (errorItem != null) { validateException.AddError(errorItem); throw validateException; } return(true); }
/// <exception cref="BusinessException"><c>BusinessException</c>.</exception> public void ValidateBeforeSaveUpdate(ItemDTO dtoItem, ItemProcessDTO dtoItemProcess) { ValidateException validateException = new ValidateException(); ErrorItem errorItem = null; #region mandatory check errorItem = CheckEmptyItemCode(dtoItem.ITEM_CD); if (errorItem != null) { validateException.AddError(errorItem); } //errorItem = CheckEmptyItemDesc(dtoItem.ITEM_DESC); //if (errorItem != null) // validateException.AddError(errorItem); //errorItem = CheckEmptyItemType(dtoItem.ITEM_CLS); //if (errorItem != null) // validateException.AddError(errorItem); //errorItem = CheckEmptyLotControlType(dtoItem.LOT_CONTROL_CLS); //if (errorItem != null) // validateException.AddError(errorItem); //errorItem = CheckEmptyOrderProcess(dtoItemProcess.ORDER_PROCESS_CLS); //if (errorItem != null) // validateException.AddError(errorItem); //errorItem = CheckEmptyStoreLoc(dtoItemProcess.STORE_LOC_CD); //if (errorItem != null) // validateException.AddError(errorItem); validateException.ThrowIfHasError(); #endregion BusinessException businessException = CheckItemNotExist(dtoItem.ITEM_CD); if (businessException != null) { throw businessException; } }
//public ErrorItem CheckLotNo(NZString ItemCD, NZString FromLoc, NZString LotNo) { // ItemBIZ biz = new ItemBIZ(); // ItemDTO dto = biz.LoadItem(ItemCD); // switch (DataDefine.ConvertValue2Enum<DataDefine.eLOT_CONTROL_CLS>(dto.LOT_CONTROL_CLS.StrongValue)) { // case DataDefine.eLOT_CONTROL_CLS.No: // if (!LotNo.IsNull || LotNo.StrongValue != string.Empty) { // return new ErrorItem(LotNo.Owner, TKPMessages.eValidate.VLM0065.ToString()); // } // break; // case DataDefine.eLOT_CONTROL_CLS.Yes: // if (LotNo.IsNull) { // return new ErrorItem(LotNo.Owner, TKPMessages.eValidate.VLM0050.ToString(), new[] { ItemCD.StrongValue }); // } // InventoryBIZ bizInv = new InventoryBIZ(); // List<InventoryOnhandDTO> dtolist = new List<InventoryOnhandDTO>(); // dtolist = bizInv.LoadLotNoByKey(ItemCD, FromLoc, LotNo); // if (dtolist == null || dtolist.Count == 0) { // return new ErrorItem(LotNo.Owner, TKPMessages.eValidate.VLM0054.ToString(), new[] { LotNo.StrongValue }); // } // break; // } // return null; //} //public ErrorItem CheckOnhandQtyForEditMode(NZDecimal QTY, NZDecimal OnhandQTY, NZString ItemCD, NZString FromLoc) //{ // if (OnhandQTY.IsNull || OnhandQTY.StrongValue == 0) // return new ErrorItem(QTY.Owner, TKPMessages.eValidate.VLM0029.ToString()); // if (QTY.StrongValue > OnhandQTY.StrongValue) // { // return new ErrorItem(QTY.Owner, TKPMessages.eValidate.VLM0063.ToString(), new[] { ItemCD, FromLoc } // ); // } // return null; //} #endregion public void ValidateBeforeSaveNew(InventoryTransactionDTO dto, NZDecimal OnhandQty) { ValidateException validateException = new ValidateException(); CommonBizValidator commonVal = new CommonBizValidator(); ErrorItem errorItem = null; #region mandatory check errorItem = CheckEmptyItemCode(dto.ITEM_CD); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckEmptyLocFrom(dto.LOC_CD); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckEmptySubType(dto.TRAN_SUB_CLS); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckIssueQTY(dto.QTY); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = CheckIssueDate(dto.TRANS_DATE); if (errorItem != null) { validateException.AddError(errorItem); } errorItem = commonVal.CheckInputLot(dto.ITEM_CD, dto.LOC_CD, dto.LOT_NO, true); if (errorItem != null) { validateException.AddError(errorItem); } validateException.ThrowIfHasError(); #endregion }