Exemplo n.º 1
0
        protected override ValidationResult ValidateEnblocData <T>(IEnumerable <T> lstEnblocSnapshot)
        {
            EmptyEnblocValidatorCollectionValidator validator = new EmptyEnblocValidatorCollectionValidator();
            ValidationResult results = validator.Validate((List <EmptyEnblocSnapshot>)lstEnblocSnapshot);

            return(results);
        }
Exemplo n.º 2
0
        private static BaseReturn <Dictionary <string, string> > ValidateEnbloc(List <EmptyEnblocSnapshot> lstEnblocSnapshot)
        {
            BaseReturn <Dictionary <string, string> > baseObject = new BaseReturn <Dictionary <string, string> >();
            Dictionary <string, string> obj = new Dictionary <string, string>();

            try
            {
                EmptyEnblocValidatorCollectionValidator validator = new EmptyEnblocValidatorCollectionValidator();

                if (lstEnblocSnapshot.Count > 1000)
                {
                    baseObject.Success = false;
                    baseObject.Code    = (int)TemplateCodes.NoRowsLimitReached;
                    baseObject.Data    = obj;
                    return(baseObject);
                }

                // if vessel voyage no already exists and enbloc in progress then no processing

                if (IsVesselVoyageExists(lstEnblocSnapshot.First().Vessel, lstEnblocSnapshot.First().Voyage))
                {
                    baseObject.Success = false;
                    baseObject.Code    = (int)TemplateCodes.ErrorOccured;
                    baseObject.Data    = obj;
                    return(baseObject);
                }

                ValidationResult results = validator.Validate(lstEnblocSnapshot);
                if (!results.IsValid)
                {
                    baseObject.Success = false;
                    baseObject.Code    = (int)TemplateCodes.ErrorOccured;
                    baseObject.Data    = obj;
                    return(baseObject);
                }

                baseObject.Success = true;
            }
            catch (Exception ex)
            {
                baseObject.Success = false;
                baseObject.Code    = (int)TemplateCodes.ErrorOccured;
                baseObject.Data    = obj;
            }
            return(baseObject);
        }