Esempio n. 1
0
            public void Load(string Record, string RecordId)
            {
                string[] Fields = Record.Split(sep);
                try
                {
                    //DateTime dtVal = Convert.ToDateTime(Fields[44]);
                    //DateTime dtVal = Convert.ToDateTime(Record.Substring(RecordOffSet, 10));
                    StartDate = Convert.ToDateTime(Fields[143]);
                }
                catch (FormatException exFormatStartDate)
                {
                    PamProperty TotalhoursDataFormat = new PamProperty("Hours spent for presenter does not contain numeric value.", "Presenter");
                    GenerateError(this.GetType(), "StartDate");
                }


                try
                {
                    // DateTime dtVal = Convert.ToDateTime(Record.Substring(RecordOffSet, 10));
                    EndDate = Convert.ToDateTime(Fields[144]);
                }
                catch (FormatException exFormatEndDate)
                {
                    PamProperty TotalhoursDataFormat = new PamProperty("Hours spent for presenter does not contain numeric value.", "Presenter");
                    GenerateError(this.GetType(), "StartDate");
                }

                EventName = Fields[145];

                //This is not a required field so do not generate an error.
            }
Esempio n. 2
0
        protected PamProperty GenerateError(Type t, string PropertyName)
        {
            PamProperty ErrorInfo = null;

            PropertyInfo[] Properties = t.GetProperties();
            var            query      = from prop in Properties
                                        where prop.Name == PropertyName
                                        select prop;
            PropertyInfo FoundProperty = query.SingleOrDefault();

            object[] PropAttribute = FoundProperty.GetCustomAttributes(false);
            if (PropAttribute.Length > 0)
            {
                if (PropAttribute[0] is PamProperty)
                {
                    PamProperty PropInfo = (PamProperty)PropAttribute[0];
                    ErrorInfo = PropInfo;
                    ProcessError(ErrorInfo);
                }
                else
                {
                    throw (new ApplicationException("Validation Error - Property description information not found "));
                }
            }
            else
            {
                throw (new ApplicationException("Validation Error - Property description information not found "));
            }

            return(ErrorInfo);
        }
Esempio n. 3
0
            public override bool AttemptValidate()
            {
                bool PassValidation = false;

                //If the Presenter's SHIP User ID is NOT available, provide the First name  and last name of the Presenter.
                if (PresenterShipUserId == string.Empty)
                {
                    if (FirstName == string.Empty || LastName == string.Empty)
                    {
                        throw (new ApplicationException("Invalid data found missing presenter user id and first name"));
                    }
                    PassValidation = true;
                }
                else
                {
                    if (PresenterShipUserId == "\t")
                    {
                        throw (new ApplicationException("Missing presenter record."));
                    }
                    else
                    {
                        PassValidation = true;
                    }
                }

                //Hours Spent

                if (HoursSpent == null)
                {
                    PamProperty ErrorProperty = new PamProperty("Presenter Hours spent is missing", "Presenter");
                    ProcessError(ErrorProperty);
                    PassValidation = false;
                }
                else
                {
                    HoursSpent = decimal.Parse(HoursSpent.Value.ToString("##0.00"));

                    char[]   HoursSep  = { '.' };
                    string[] TimeSpent = Convert.ToString(HoursSpent.Value).Split(HoursSep);
                    if (TimeSpent[1] != "00" && TimeSpent[1] != "25" && TimeSpent[1] != "50" && TimeSpent[1] != "75")
                    {
                        PamProperty ErrorProperty = new PamProperty("Invalid format for presneter hours spent - column Hours spent", "Presenter");
                        ProcessError(ErrorProperty);
                        PassValidation = false;
                    }
                    else
                    {
                        PassValidation = true;
                    }
                }


                string[] PresenterRecord = OrginRecord.Split(sep);
                int      TabCount        = 9;
                int      BlankTabs       = 1;

                for (BlankTabs = 1; BlankTabs <= 24; BlankTabs++)
                {
                    if (PresenterRecord[TabCount] == "\t")
                    {
                        TabCount++;
                    }
                    else
                    {
                        PamProperty ErrorProperty = new PamProperty("Invalid format for incomplete presenter record.", "Presenter");
                        PassValidation = false;
                        break;
                    }
                }

                return(PassValidation);
            }