Beispiel #1
0
        private MWQMSiteSampleFC GetFilledRandomMWQMSiteSampleFC(string OmitPropName)
        {
            MWQMSiteSampleFC mwqmSiteSampleFC = new MWQMSiteSampleFC();

            if (OmitPropName != "SampleDate")
            {
                mwqmSiteSampleFC.SampleDate = new DateTime(2005, 3, 6);
            }
            if (OmitPropName != "FC")
            {
                mwqmSiteSampleFC.FC = GetRandomInt(1, 100000000);
            }
            // should implement a Range for the property Sal and type MWQMSiteSampleFC
            // should implement a Range for the property Temp and type MWQMSiteSampleFC
            // should implement a Range for the property PH and type MWQMSiteSampleFC
            // should implement a Range for the property DO and type MWQMSiteSampleFC
            // should implement a Range for the property Depth and type MWQMSiteSampleFC
            // should implement a Range for the property SampCount and type MWQMSiteSampleFC
            // should implement a Range for the property MinFC and type MWQMSiteSampleFC
            // should implement a Range for the property MaxFC and type MWQMSiteSampleFC
            // should implement a Range for the property GeoMean and type MWQMSiteSampleFC
            // should implement a Range for the property Median and type MWQMSiteSampleFC
            // should implement a Range for the property P90 and type MWQMSiteSampleFC
            // should implement a Range for the property PercOver43 and type MWQMSiteSampleFC
            // should implement a Range for the property PercOver260 and type MWQMSiteSampleFC

            return(mwqmSiteSampleFC);
        }
Beispiel #2
0
 public MWQMSiteSampleFCTest()
 {
     mWQMSiteSampleFC = new MWQMSiteSampleFC();
 }
        /// <summary>
        /// Validate function for all MWQMSiteSampleFCService commands
        /// </summary>
        /// <param name="validationContext">System.ComponentModel.DataAnnotations.ValidationContext (Describes the context in which a validation check is performed.)</param>
        /// <param name="actionDBType">[ActionDBTypeEnum] (CSSPEnums.ActionDBTypeEnum.html) action type to validate</param>
        /// <returns>IEnumerable of ValidationResult (Where ValidationResult is a container for the results of a validation request.)</returns>
        private IEnumerable <ValidationResult> Validate(ValidationContext validationContext, ActionDBTypeEnum actionDBType)
        {
            string           retStr           = "";
            Enums            enums            = new Enums(LanguageRequest);
            MWQMSiteSampleFC mwqmSiteSampleFC = validationContext.ObjectInstance as MWQMSiteSampleFC;

            mwqmSiteSampleFC.HasErrors = false;

            if (mwqmSiteSampleFC.SampleDate.Year == 1)
            {
                mwqmSiteSampleFC.HasErrors = true;
                yield return(new ValidationResult(string.Format(CSSPServicesRes._IsRequired, "SampleDate"), new[] { "SampleDate" }));
            }
            else
            {
                if (mwqmSiteSampleFC.SampleDate.Year < 1980)
                {
                    mwqmSiteSampleFC.HasErrors = true;
                    yield return(new ValidationResult(string.Format(CSSPServicesRes._YearShouldBeBiggerThan_, "SampleDate", "1980"), new[] { "SampleDate" }));
                }
            }

            if (mwqmSiteSampleFC.FC != null)
            {
                if (mwqmSiteSampleFC.FC < 1 || mwqmSiteSampleFC.FC > 100000000)
                {
                    mwqmSiteSampleFC.HasErrors = true;
                    yield return(new ValidationResult(string.Format(CSSPServicesRes._ValueShouldBeBetween_And_, "FC", "1", "100000000"), new[] { "FC" }));
                }
            }

            //Sal has no Range Attribute

            //Temp has no Range Attribute

            //PH has no Range Attribute

            //DO has no Range Attribute

            //Depth has no Range Attribute

            //SampCount has no Range Attribute

            //MinFC has no Range Attribute

            //MaxFC has no Range Attribute

            //GeoMean has no Range Attribute

            //Median has no Range Attribute

            //P90 has no Range Attribute

            //PercOver43 has no Range Attribute

            //PercOver260 has no Range Attribute

            retStr = "";      // added to stop compiling CSSPError
            if (retStr != "") // will never be true
            {
                mwqmSiteSampleFC.HasErrors = true;
                yield return(new ValidationResult("AAA", new[] { "AAA" }));
            }
        }