/// <summary> /// Override Validate insert từ BaseService /// </summary> /// <param name="entity">fixedAsset</param> /// <param name="errorMsg">messenger trả về</param> /// <returns>true : dữ liệu hợp lệ - false : dữ liệu không hợp lệ</returns> protected override bool Validate(FixedAsset entity, ErrorMsg errorMsg) { // Khởi tạo biến isValid lưu trạng thái validate var isValid = true; //Validate dữ liệu(xử lý về nghiệp vụ): //1. Validate bắt buộc nhập: if (entity.fixed_asset_code == null || entity.fixed_asset_code == string.Empty) { errorMsg.UserMsg.Add(MISA.QLTS.BACKEND.COMMON.Properties.Resources.ErrorService_EmptyRefDecrementCode); isValid = false; } if (entity.fixed_asset_name == null) { errorMsg.UserMsg.Add(MISA.QLTS.BACKEND.COMMON.Properties.Resources.ErrorService_EmptyPostedDate); isValid = false; } //2. Validate dữ liệu không được phép (trùng): // kiểm tra trong database đã tồn tại đã mã kh hay chưa var isExits = _dbConnectionAsset.CheckRefDecrementCodeExits(entity.fixed_asset_code); if (isExits != null) { errorMsg.UserMsg.Add(MISA.QLTS.BACKEND.COMMON.Properties.Resources.ErrorService_DuplicateRefDecrementCode); isValid = false; } return(isValid); }