Esempio n. 1
0
        private void LoadVariable()
        {
            r = (string)privateObject.GetField("r");
            InternetConnection               = (bool)privateObject.GetField("InternetConnection");
            FormTitle                        = (string)privateObject.GetField("FormTitle");
            csspWQInputParamList             = ((List <CSSPWQInputParam>)privateObject.GetField("csspWQInputParamList"));
            csspWQInputApp                   = (CSSPWQInputApp)privateObject.GetField("csspWQInputApp");
            ButBackColor                     = (Color)privateObject.GetField("ButBackColor");
            csspWQInputTypeCurrent           = (CSSPWQInputTypeEnum)privateObject.GetField("csspWQInputTypeCurrent");
            csspWQInputSheetType             = (CSSPWQInputSheetTypeEnum)privateObject.GetField("csspWQInputSheetType");
            CurrentPath                      = (string)privateObject.GetField("CurrentPath");
            NameCurrent                      = (string)privateObject.GetField("NameCurrent");
            TVItemIDCurrent                  = (int)privateObject.GetField("TVItemIDCurrent");
            YearMonthDayCurrent              = (string)privateObject.GetField("YearMonthDayCurrent");
            CSSPWQInputParamCurrent          = (CSSPWQInputParam)privateObject.GetField("CSSPWQInputParamCurrent");
            dataGridViewCellStyleDefault     = (DataGridViewCellStyle)privateObject.GetField("dataGridViewCellStyleDefault");
            dataGridViewCellStyleEdit        = (DataGridViewCellStyle)privateObject.GetField("dataGridViewCellStyleEdit");
            dataGridViewCellStyleEditRowCell = (DataGridViewCellStyle)privateObject.GetField("dataGridViewCellStyleEditRowCell");
            dataGridViewCellStyleEditError   = (DataGridViewCellStyle)privateObject.GetField("dataGridViewCellStyleEditError");
            csspMPNTableList                 = (List <CSSPMPNTable>)privateObject.GetField("csspMPNTableList");
            InLoadingFile                    = (bool)privateObject.GetField("InLoadingFile");
            SamplingPlanName                 = (string)privateObject.GetField("SamplingPlanName");
            NoUpdate                        = (bool)privateObject.GetField("NoUpdate");
            TideToTryIndex                  = (int)privateObject.GetField("TideToTryIndex");
            panelAppInputIsVisible          = (bool)privateObject.GetField("panelAppInputIsVisible");
            ControlBackColor                = (Color)privateObject.GetField("ControlBackColor");
            TextBoxBackColor                = (Color)privateObject.GetField("TextBoxBackColor");
            DataGridViewCSSPBackgroundColor = (Color)privateObject.GetField("DataGridViewCSSPBackgroundColor");
            VersionOfSamplingPlanFile       = (int)privateObject.GetField("VersionOfSamplingPlanFile");
            VersionOfResultFile             = (int)privateObject.GetField("VersionOfResultFile");
            CurrentPanel                    = (Panel)privateObject.GetField("CurrentPanel");
            Initials                        = (string)privateObject.GetField("Initials");
            AppIsWide                       = (bool)privateObject.GetField("AppIsWide");
            AllowableTideString             = (List <string>)privateObject.GetField("AllowableTideString");

            textBoxInitials.Text = "AA";
            textBoxAccessCode.Focus();
        }
Esempio n. 2
0
 public CSSPWQInputParamTest()
 {
     cSSPWQInputParam = new CSSPWQInputParam();
 }
Esempio n. 3
0
        /// <summary>
        /// Validate function for all CSSPWQInputParamService 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);
            CSSPWQInputParam cSSPWQInputParam = validationContext.ObjectInstance as CSSPWQInputParam;

            cSSPWQInputParam.HasErrors = false;

            retStr = enums.EnumTypeOK(typeof(CSSPWQInputTypeEnum), (int?)cSSPWQInputParam.CSSPWQInputType);
            if (!string.IsNullOrWhiteSpace(retStr))
            {
                cSSPWQInputParam.HasErrors = true;
                yield return(new ValidationResult(string.Format(CSSPServicesRes._IsRequired, "CSSPWQInputType"), new[] { "CSSPWQInputType" }));
            }

            if (string.IsNullOrWhiteSpace(cSSPWQInputParam.Name))
            {
                cSSPWQInputParam.HasErrors = true;
                yield return(new ValidationResult(string.Format(CSSPServicesRes._IsRequired, "Name"), new[] { "Name" }));
            }

            if (!string.IsNullOrWhiteSpace(cSSPWQInputParam.Name) && (cSSPWQInputParam.Name.Length < 1 || cSSPWQInputParam.Name.Length > 200))
            {
                cSSPWQInputParam.HasErrors = true;
                yield return(new ValidationResult(string.Format(CSSPServicesRes._LengthShouldBeBetween_And_, "Name", "1", "200"), new[] { "Name" }));
            }

            if (cSSPWQInputParam.TVItemID < 1)
            {
                cSSPWQInputParam.HasErrors = true;
                yield return(new ValidationResult(string.Format(CSSPServicesRes._MinValueIs_, "TVItemID", "1"), new[] { "TVItemID" }));
            }

            if (!string.IsNullOrWhiteSpace(cSSPWQInputParam.CSSPWQInputTypeText) && cSSPWQInputParam.CSSPWQInputTypeText.Length > 100)
            {
                cSSPWQInputParam.HasErrors = true;
                yield return(new ValidationResult(string.Format(CSSPServicesRes._MaxLengthIs_, "CSSPWQInputTypeText", "100"), new[] { "CSSPWQInputTypeText" }));
            }

            //CSSPError: Type not implemented [sidList] of type [List`1]

            //sidList has no StringLength Attribute

            //CSSPError: Type not implemented [MWQMSiteList] of type [List`1]

            //MWQMSiteList has no StringLength Attribute

            //CSSPError: Type not implemented [MWQMSiteTVItemIDList] of type [List`1]

            //MWQMSiteTVItemIDList has no Range Attribute

            //CSSPError: Type not implemented [DailyDuplicateMWQMSiteList] of type [List`1]

            //DailyDuplicateMWQMSiteList has no StringLength Attribute

            //CSSPError: Type not implemented [DailyDuplicateMWQMSiteTVItemIDList] of type [List`1]

            //DailyDuplicateMWQMSiteTVItemIDList has no Range Attribute

            //CSSPError: Type not implemented [InfrastructureList] of type [List`1]

            //InfrastructureList has no StringLength Attribute

            //CSSPError: Type not implemented [InfrastructureTVItemIDList] of type [List`1]

            //InfrastructureTVItemIDList has no Range Attribute

            retStr = "";      // added to stop compiling CSSPError
            if (retStr != "") // will never be true
            {
                cSSPWQInputParam.HasErrors = true;
                yield return(new ValidationResult("AAA", new[] { "AAA" }));
            }
        }
Esempio n. 4
0
        private CSSPWQInputParam GetFilledRandomCSSPWQInputParam(string OmitPropName)
        {
            CSSPWQInputParam cSSPWQInputParam = new CSSPWQInputParam();

            if (OmitPropName != "CSSPWQInputType")
            {
                cSSPWQInputParam.CSSPWQInputType = (CSSPWQInputTypeEnum)GetRandomEnumType(typeof(CSSPWQInputTypeEnum));
            }
            if (OmitPropName != "Name")
            {
                cSSPWQInputParam.Name = GetRandomString("", 6);
            }
            if (OmitPropName != "TVItemID")
            {
                cSSPWQInputParam.TVItemID = GetRandomInt(1, 11);
            }
            if (OmitPropName != "CSSPWQInputTypeText")
            {
                cSSPWQInputParam.CSSPWQInputTypeText = GetRandomString("", 5);
            }
            if (OmitPropName != "sidList")
            {
                cSSPWQInputParam.sidList = new List <string>()
                {
                    GetRandomString("", 20), GetRandomString("", 20)
                }
            }
            ;
            if (OmitPropName != "MWQMSiteList")
            {
                cSSPWQInputParam.MWQMSiteList = new List <string>()
                {
                    GetRandomString("", 20), GetRandomString("", 20)
                }
            }
            ;
            // should implement a Range for the property MWQMSiteTVItemIDList and type CSSPWQInputParam
            if (OmitPropName != "DailyDuplicateMWQMSiteList")
            {
                cSSPWQInputParam.DailyDuplicateMWQMSiteList = new List <string>()
                {
                    GetRandomString("", 20), GetRandomString("", 20)
                }
            }
            ;
            // should implement a Range for the property DailyDuplicateMWQMSiteTVItemIDList and type CSSPWQInputParam
            if (OmitPropName != "InfrastructureList")
            {
                cSSPWQInputParam.InfrastructureList = new List <string>()
                {
                    GetRandomString("", 20), GetRandomString("", 20)
                }
            }
            ;
            // should implement a Range for the property InfrastructureTVItemIDList and type CSSPWQInputParam

            return(cSSPWQInputParam);
        }

        #endregion Functions private
    }
}