Example #1
0
        /// <summary>Adds additional trailing trivia to an attribute list.</summary>
        public static VList <LNode> PlusTrailingTrivia(this VList <LNode> attrs, LNode trivia)
        {
            VList <LNode> oldTrivia;

            attrs = WithoutTrailingTrivia(attrs, out oldTrivia);
            return(attrs.Add(LNode.Call(S.TriviaTrailing, oldTrivia.Add(trivia))));
        }
Example #2
0
        //public Axon AddAxon(Nuron input, double weight)
        //{
        //    if (input.Level > this.Level)
        //    {
        //        //swaps the nurons if the level is swaped
        //        return input.AddAxon(this, weight);
        //    }

        //    //enshures that the nurons are on diffrent levels
        //    if (input.Level == this.Level) throw new
        //    InvalidOperationException();

        //    //enshures that the nurons belong to the same network
        //    if (input.network != this.network) throw new
        //    InvalidOperationException();

        //    //calls upon the internal method
        //    return AddAxonInit(input, weight);
        //}

        #endregion ////////////////////////////////////////////////////////////////////

        #region Internal Methods...

        /// <summary>
        /// Connects the given input nuron to the current nuron with the
        /// given weight. Note that it dose not check the topology of the
        /// network before adding the axon, so care must be taken to avoid
        /// redundent connections. If a connection already exists between
        /// the two nurons, it returns that axon instead.
        /// </summary>
        /// <param name="input">Nuron to conect</param>
        /// <param name="weight">Weight of the connection</param>
        /// <returns>The axon between the nurons</returns>
        internal Axon AddAxonInit(NuronOld input, double weight)
        {
            ////enshures the nurons belong to the same network
            //if (network == null || network != input.network)
            //    throw new InvalidOperationException();

            //makes shure our parent network hasn't been disposed
            if (network == null)
            {
                throw new InvalidOperationException();
            }

            //sees if we alreay contain a link to the input
            Axon ax = GetAxon(input.Index);

            if (ax == null)
            {
                //obtains an index to the sorce and target
                int source = this.Index;
                int target = input.Index;

                //creates the axon and adds it to our list
                ax = new Axon(source, target, weight);
                inputs.Add(ax);
            }
            else
            {
                //sets the axons weight to our new weight
                ax.Weight = weight;
            }

            return(ax);
        }
 LNode MaybeCreateTemporaryForLValue(LNode expr, ref VList <LNode> stmtSequence)
 {
     {
         LNode _, lhs;
         if (expr.Calls(CodeSymbols.Dot, 2) && (lhs = expr.Args[0]) != null || expr.CallsMin(CodeSymbols.Of, 1) && (lhs = expr.Args[0]) != null)
         {
             return(expr.WithArgChanged(0, MaybeCreateTemporaryForLValue(lhs, ref stmtSequence)));
         }
         else if ((_ = expr) != null && !_.IsCall)
         {
             return(expr);
         }
         else
         {
             var args = expr.Args.ToWList();
             int i    = 0;
             if (expr.CallsMin(S.IndexBracks, 1) || expr.CallsMin(S.NullIndexBracks, 1))
             {
                 i = 1;
             }
             for (; i < args.Count; i++)
             {
                 if (!args[i].IsLiteral && !args[i].Attrs.Contains(_trivia_isTmpVar))
                 {
                     LNode tmpVarName;
                     stmtSequence.Add(TempVarDecl(Context, args[i], out tmpVarName));
                     args[i] = tmpVarName.PlusAttr(_trivia_isTmpVar);
                 }
             }
             return(expr.WithArgs(args.ToVList()));
         }
     }
 }
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VAdditionalContactInfo> Convert(WsProxy.VAdditionalContactInfo[] items)
		{
			VList<VAdditionalContactInfo> outItems = new VList<VAdditionalContactInfo>();
			foreach(WsProxy.VAdditionalContactInfo item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VStateProvinceCountryRegion> Convert(WsProxy.VStateProvinceCountryRegion[] items)
		{
			VList<VStateProvinceCountryRegion> outItems = new VList<VStateProvinceCountryRegion>();
			foreach(WsProxy.VStateProvinceCountryRegion item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VProductAndDescription> Convert(WsProxy.VProductAndDescription[] items)
		{
			VList<VProductAndDescription> outItems = new VList<VProductAndDescription>();
			foreach(WsProxy.VProductAndDescription item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VEmployee> Convert(WsProxy.VEmployee[] items)
		{
			VList<VEmployee> outItems = new VList<VEmployee>();
			foreach(WsProxy.VEmployee item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
Example #8
0
			internal CodeGeneratorForMatchCase(IMacroContext context, LNode input, VList<LNode> handler)
			{
				_context = context;
				_input = input;
				_handler = handler;
				var @break = LNode.Call(CodeSymbols.Break);
				if (_handler.IsEmpty || !_handler.Last.Equals(@break))
					_handler.Add(@break);
			}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VJobCandidateEmployment> Convert(WsProxy.VJobCandidateEmployment[] items)
		{
			VList<VJobCandidateEmployment> outItems = new VList<VJobCandidateEmployment>();
			foreach(WsProxy.VJobCandidateEmployment item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VIndividualCustomer> Convert(WsProxy.VIndividualCustomer[] items)
		{
			VList<VIndividualCustomer> outItems = new VList<VIndividualCustomer>();
			foreach(WsProxy.VIndividualCustomer item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VSalesPerson> Convert(WsProxy.VSalesPerson[] items)
		{
			VList<VSalesPerson> outItems = new VList<VSalesPerson>();
			foreach(WsProxy.VSalesPerson item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VJobCandidateEducation> Convert(WsProxy.VJobCandidateEducation[] items)
		{
			VList<VJobCandidateEducation> outItems = new VList<VJobCandidateEducation>();
			foreach(WsProxy.VJobCandidateEducation item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VIndividualDemographics> Convert(WsProxy.VIndividualDemographics[] items)
		{
			VList<VIndividualDemographics> outItems = new VList<VIndividualDemographics>();
			foreach(WsProxy.VIndividualDemographics item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VSalesPersonSalesByFiscalYears> Convert(WsProxy.VSalesPersonSalesByFiscalYears[] items)
		{
			VList<VSalesPersonSalesByFiscalYears> outItems = new VList<VSalesPersonSalesByFiscalYears>();
			foreach(WsProxy.VSalesPersonSalesByFiscalYears item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VProductModelInstructions> Convert(WsProxy.VProductModelInstructions[] items)
		{
			VList<VProductModelInstructions> outItems = new VList<VProductModelInstructions>();
			foreach(WsProxy.VProductModelInstructions item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VEmployeeDepartmentHistory> Convert(WsProxy.VEmployeeDepartmentHistory[] items)
		{
			VList<VEmployeeDepartmentHistory> outItems = new VList<VEmployeeDepartmentHistory>();
			foreach(WsProxy.VEmployeeDepartmentHistory item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
		/// <summary>
		/// Convert a collection from the ws proxy to a nettiers collection.
		/// </summary>
		public static VList<VVendor> Convert(WsProxy.VVendor[] items)
		{
			VList<VVendor> outItems = new VList<VVendor>();
			foreach(WsProxy.VVendor item in items)
			{
				outItems.Add(Convert(item));
			}
			return outItems;
		}
Example #18
0
            public LNode GetWithFn(AdtParam part, bool isAbstract, Symbol virtualOverride, IEnumerable <AdtParam> allParts)
            {
                int totalParts = allParts.Count();
                var withField  = F.Id("With" + part.NameId.Name);

                var args = LNode.List();

                foreach (AdtParam otherPart in allParts)
                {
                    if (part == otherPart)
                    {
                        args.Add(F.Id("newValue"));
                    }
                    else
                    {
                        args.Add(otherPart.NameId);
                    }
                }

                var attrs = new VList <LNode>(F.Id(S.Public));

                if (isAbstract)
                {
                    attrs.Add(F.Id(S.Abstract));
                }
                if (virtualOverride != null && (!isAbstract || virtualOverride == S.Override))
                {
                    attrs.Add(F.Id(virtualOverride));
                }

                LNode method;
                LNode type    = part.Type;
                LNode retType = part.ContainingType.TypeNameWithoutAttrs;

                if (isAbstract)
                {
                    method = LNode.Call(LNode.List(attrs), CodeSymbols.Fn, LNode.List(retType, withField, LNode.Call(CodeSymbols.AltList, LNode.List(LNode.Call(LNode.List(part.OriginalDecl.Attrs), CodeSymbols.Var, LNode.List(type, LNode.Id((Symbol)"newValue")))))));
                }
                else
                {
                    method = LNode.Call(LNode.List(attrs), CodeSymbols.Fn, LNode.List(retType, withField, LNode.Call(CodeSymbols.AltList, LNode.List(LNode.Call(LNode.List(part.OriginalDecl.Attrs), CodeSymbols.Var, LNode.List(type, LNode.Id((Symbol)"newValue"))))), LNode.Call(CodeSymbols.Braces, LNode.List(LNode.Call(CodeSymbols.Return, LNode.List(LNode.Call(CodeSymbols.New, LNode.List(LNode.Call(TypeNameWithoutAttrs, LNode.List(args)))))))).SetStyle(NodeStyle.Statement)));
                }
                return(method);
            }
        /*
         * ///<summary>
         * /// Fill an VList&lt;VJobCandidateEducation&gt; From a DataSet
         * ///</summary>
         * /// <param name="dataSet">the DataSet</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList&lt;VJobCandidateEducation&gt;"/></returns>
         * protected static VList&lt;VJobCandidateEducation&gt; Fill(DataSet dataSet, VList<VJobCandidateEducation> rows, int start, int pagelen)
         * {
         *      if (dataSet.Tables.Count == 1)
         *      {
         *              return Fill(dataSet.Tables[0], rows, start, pagelen);
         *      }
         *      else
         *      {
         *              return new VList<VJobCandidateEducation>();
         *      }
         * }
         *
         *
         * ///<summary>
         * /// Fill an VList&lt;VJobCandidateEducation&gt; From a DataTable
         * ///</summary>
         * /// <param name="dataTable">the DataTable that hold the data.</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList<VJobCandidateEducation>"/></returns>
         * protected static VList&lt;VJobCandidateEducation&gt; Fill(DataTable dataTable, VList<VJobCandidateEducation> rows, int start, int pagelen)
         * {
         *      int recordnum = 0;
         *
         *      System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
         *
         *      while (dataRows.MoveNext() && (pagelen != 0))
         *      {
         *              if(recordnum >= start)
         *              {
         *                      DataRow row = (DataRow)dataRows.Current;
         *
         *                      VJobCandidateEducation c = new VJobCandidateEducation();
         *                      c.JobCandidateId = (Convert.IsDBNull(row["JobCandidateID"]))?(int)0:(System.Int32)row["JobCandidateID"];
         *                      c.SafeNameEduLevel = (Convert.IsDBNull(row["Edu.Level"]))?string.Empty:(System.String)row["Edu.Level"];
         *                      c.SafeNameEduStartDate = (Convert.IsDBNull(row["Edu.StartDate"]))?DateTime.MinValue:(System.DateTime?)row["Edu.StartDate"];
         *                      c.SafeNameEduEndDate = (Convert.IsDBNull(row["Edu.EndDate"]))?DateTime.MinValue:(System.DateTime?)row["Edu.EndDate"];
         *                      c.SafeNameEduDegree = (Convert.IsDBNull(row["Edu.Degree"]))?string.Empty:(System.String)row["Edu.Degree"];
         *                      c.SafeNameEduMajor = (Convert.IsDBNull(row["Edu.Major"]))?string.Empty:(System.String)row["Edu.Major"];
         *                      c.SafeNameEduMinor = (Convert.IsDBNull(row["Edu.Minor"]))?string.Empty:(System.String)row["Edu.Minor"];
         *                      c.SafeNameEduGpa = (Convert.IsDBNull(row["Edu.GPA"]))?string.Empty:(System.String)row["Edu.GPA"];
         *                      c.SafeNameEduGpaScale = (Convert.IsDBNull(row["Edu.GPAScale"]))?string.Empty:(System.String)row["Edu.GPAScale"];
         *                      c.SafeNameEduSchool = (Convert.IsDBNull(row["Edu.School"]))?string.Empty:(System.String)row["Edu.School"];
         *                      c.SafeNameEduLocCountryRegion = (Convert.IsDBNull(row["Edu.Loc.CountryRegion"]))?string.Empty:(System.String)row["Edu.Loc.CountryRegion"];
         *                      c.SafeNameEduLocState = (Convert.IsDBNull(row["Edu.Loc.State"]))?string.Empty:(System.String)row["Edu.Loc.State"];
         *                      c.SafeNameEduLocCity = (Convert.IsDBNull(row["Edu.Loc.City"]))?string.Empty:(System.String)row["Edu.Loc.City"];
         *                      c.AcceptChanges();
         *                      rows.Add(c);
         *                      pagelen -= 1;
         *              }
         *              recordnum += 1;
         *      }
         *      return rows;
         * }
         */

        ///<summary>
        /// Fill an <see cref="VList&lt;VJobCandidateEducation&gt;"/> From a DataReader.
        ///</summary>
        /// <param name="reader">Datareader</param>
        /// <param name="rows">The collection to fill</param>
        /// <param name="start">Start row</param>
        /// <param name="pageLength">number of row.</param>
        ///<returns>a <see cref="VList&lt;VJobCandidateEducation&gt;"/></returns>
        protected VList <VJobCandidateEducation> Fill(IDataReader reader, VList <VJobCandidateEducation> rows, int start, int pageLength)
        {
            int recordnum = 0;

            while (reader.Read() && (pageLength != 0))
            {
                if (recordnum >= start)
                {
                    VJobCandidateEducation entity = null;
                    if (DataRepository.Provider.UseEntityFactory)
                    {
                        entity = EntityManager.CreateViewEntity <VJobCandidateEducation>("VJobCandidateEducation", DataRepository.Provider.EntityCreationalFactoryType);
                    }
                    else
                    {
                        entity = new VJobCandidateEducation();
                    }

                    entity.SuppressEntityEvents = true;

                    entity.JobCandidateId = (System.Int32)reader[((int)VJobCandidateEducationColumn.JobCandidateId)];
                    //entity.JobCandidateId = (Convert.IsDBNull(reader["JobCandidateID"]))?(int)0:(System.Int32)reader["JobCandidateID"];
                    entity.SafeNameEduLevel = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduLevel)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduLevel)];
                    //entity.SafeNameEduLevel = (Convert.IsDBNull(reader["Edu.Level"]))?string.Empty:(System.String)reader["Edu.Level"];
                    entity.SafeNameEduStartDate = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduStartDate)))?null:(System.DateTime?)reader[((int)VJobCandidateEducationColumn.SafeNameEduStartDate)];
                    //entity.SafeNameEduStartDate = (Convert.IsDBNull(reader["Edu.StartDate"]))?DateTime.MinValue:(System.DateTime?)reader["Edu.StartDate"];
                    entity.SafeNameEduEndDate = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduEndDate)))?null:(System.DateTime?)reader[((int)VJobCandidateEducationColumn.SafeNameEduEndDate)];
                    //entity.SafeNameEduEndDate = (Convert.IsDBNull(reader["Edu.EndDate"]))?DateTime.MinValue:(System.DateTime?)reader["Edu.EndDate"];
                    entity.SafeNameEduDegree = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduDegree)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduDegree)];
                    //entity.SafeNameEduDegree = (Convert.IsDBNull(reader["Edu.Degree"]))?string.Empty:(System.String)reader["Edu.Degree"];
                    entity.SafeNameEduMajor = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduMajor)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduMajor)];
                    //entity.SafeNameEduMajor = (Convert.IsDBNull(reader["Edu.Major"]))?string.Empty:(System.String)reader["Edu.Major"];
                    entity.SafeNameEduMinor = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduMinor)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduMinor)];
                    //entity.SafeNameEduMinor = (Convert.IsDBNull(reader["Edu.Minor"]))?string.Empty:(System.String)reader["Edu.Minor"];
                    entity.SafeNameEduGpa = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduGpa)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduGpa)];
                    //entity.SafeNameEduGpa = (Convert.IsDBNull(reader["Edu.GPA"]))?string.Empty:(System.String)reader["Edu.GPA"];
                    entity.SafeNameEduGpaScale = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduGpaScale)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduGpaScale)];
                    //entity.SafeNameEduGpaScale = (Convert.IsDBNull(reader["Edu.GPAScale"]))?string.Empty:(System.String)reader["Edu.GPAScale"];
                    entity.SafeNameEduSchool = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduSchool)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduSchool)];
                    //entity.SafeNameEduSchool = (Convert.IsDBNull(reader["Edu.School"]))?string.Empty:(System.String)reader["Edu.School"];
                    entity.SafeNameEduLocCountryRegion = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduLocCountryRegion)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduLocCountryRegion)];
                    //entity.SafeNameEduLocCountryRegion = (Convert.IsDBNull(reader["Edu.Loc.CountryRegion"]))?string.Empty:(System.String)reader["Edu.Loc.CountryRegion"];
                    entity.SafeNameEduLocState = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduLocState)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduLocState)];
                    //entity.SafeNameEduLocState = (Convert.IsDBNull(reader["Edu.Loc.State"]))?string.Empty:(System.String)reader["Edu.Loc.State"];
                    entity.SafeNameEduLocCity = (reader.IsDBNull(((int)VJobCandidateEducationColumn.SafeNameEduLocCity)))?null:(System.String)reader[((int)VJobCandidateEducationColumn.SafeNameEduLocCity)];
                    //entity.SafeNameEduLocCity = (Convert.IsDBNull(reader["Edu.Loc.City"]))?string.Empty:(System.String)reader["Edu.Loc.City"];
                    entity.AcceptChanges();
                    entity.SuppressEntityEvents = false;

                    rows.Add(entity);
                    pageLength -= 1;
                }
                recordnum += 1;
            }
            return(rows);
        }
Example #20
0
        /*
         * ///<summary>
         * /// Fill an VList&lt;VIndividualDemographics&gt; From a DataSet
         * ///</summary>
         * /// <param name="dataSet">the DataSet</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList&lt;VIndividualDemographics&gt;"/></returns>
         * protected static VList&lt;VIndividualDemographics&gt; Fill(DataSet dataSet, VList<VIndividualDemographics> rows, int start, int pagelen)
         * {
         *      if (dataSet.Tables.Count == 1)
         *      {
         *              return Fill(dataSet.Tables[0], rows, start, pagelen);
         *      }
         *      else
         *      {
         *              return new VList<VIndividualDemographics>();
         *      }
         * }
         *
         *
         * ///<summary>
         * /// Fill an VList&lt;VIndividualDemographics&gt; From a DataTable
         * ///</summary>
         * /// <param name="dataTable">the DataTable that hold the data.</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList<VIndividualDemographics>"/></returns>
         * protected static VList&lt;VIndividualDemographics&gt; Fill(DataTable dataTable, VList<VIndividualDemographics> rows, int start, int pagelen)
         * {
         *      int recordnum = 0;
         *
         *      System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
         *
         *      while (dataRows.MoveNext() && (pagelen != 0))
         *      {
         *              if(recordnum >= start)
         *              {
         *                      DataRow row = (DataRow)dataRows.Current;
         *
         *                      VIndividualDemographics c = new VIndividualDemographics();
         *                      c.CustomerId = (Convert.IsDBNull(row["CustomerID"]))?(int)0:(System.Int32)row["CustomerID"];
         *                      c.TotalPurchaseYtd = (Convert.IsDBNull(row["TotalPurchaseYTD"]))?0:(System.Decimal?)row["TotalPurchaseYTD"];
         *                      c.DateFirstPurchase = (Convert.IsDBNull(row["DateFirstPurchase"]))?DateTime.MinValue:(System.DateTime?)row["DateFirstPurchase"];
         *                      c.BirthDate = (Convert.IsDBNull(row["BirthDate"]))?DateTime.MinValue:(System.DateTime?)row["BirthDate"];
         *                      c.MaritalStatus = (Convert.IsDBNull(row["MaritalStatus"]))?string.Empty:(System.String)row["MaritalStatus"];
         *                      c.YearlyIncome = (Convert.IsDBNull(row["YearlyIncome"]))?string.Empty:(System.String)row["YearlyIncome"];
         *                      c.Gender = (Convert.IsDBNull(row["Gender"]))?string.Empty:(System.String)row["Gender"];
         *                      c.TotalChildren = (Convert.IsDBNull(row["TotalChildren"]))?(int)0:(System.Int32?)row["TotalChildren"];
         *                      c.NumberChildrenAtHome = (Convert.IsDBNull(row["NumberChildrenAtHome"]))?(int)0:(System.Int32?)row["NumberChildrenAtHome"];
         *                      c.Education = (Convert.IsDBNull(row["Education"]))?string.Empty:(System.String)row["Education"];
         *                      c.Occupation = (Convert.IsDBNull(row["Occupation"]))?string.Empty:(System.String)row["Occupation"];
         *                      c.HomeOwnerFlag = (Convert.IsDBNull(row["HomeOwnerFlag"]))?false:(System.Boolean?)row["HomeOwnerFlag"];
         *                      c.NumberCarsOwned = (Convert.IsDBNull(row["NumberCarsOwned"]))?(int)0:(System.Int32?)row["NumberCarsOwned"];
         *                      c.AcceptChanges();
         *                      rows.Add(c);
         *                      pagelen -= 1;
         *              }
         *              recordnum += 1;
         *      }
         *      return rows;
         * }
         */

        ///<summary>
        /// Fill an <see cref="VList&lt;VIndividualDemographics&gt;"/> From a DataReader.
        ///</summary>
        /// <param name="reader">Datareader</param>
        /// <param name="rows">The collection to fill</param>
        /// <param name="start">Start row</param>
        /// <param name="pageLength">number of row.</param>
        ///<returns>a <see cref="VList&lt;VIndividualDemographics&gt;"/></returns>
        protected VList <VIndividualDemographics> Fill(IDataReader reader, VList <VIndividualDemographics> rows, int start, int pageLength)
        {
            int recordnum = 0;

            while (reader.Read() && (pageLength != 0))
            {
                if (recordnum >= start)
                {
                    VIndividualDemographics entity = null;
                    if (DataRepository.Provider.UseEntityFactory)
                    {
                        entity = EntityManager.CreateViewEntity <VIndividualDemographics>("VIndividualDemographics", DataRepository.Provider.EntityCreationalFactoryType);
                    }
                    else
                    {
                        entity = new VIndividualDemographics();
                    }

                    entity.SuppressEntityEvents = true;

                    entity.CustomerId = (System.Int32)reader[((int)VIndividualDemographicsColumn.CustomerId)];
                    //entity.CustomerId = (Convert.IsDBNull(reader["CustomerID"]))?(int)0:(System.Int32)reader["CustomerID"];
                    entity.TotalPurchaseYtd = (reader.IsDBNull(((int)VIndividualDemographicsColumn.TotalPurchaseYtd)))?null:(System.Decimal?)reader[((int)VIndividualDemographicsColumn.TotalPurchaseYtd)];
                    //entity.TotalPurchaseYtd = (Convert.IsDBNull(reader["TotalPurchaseYTD"]))?0:(System.Decimal?)reader["TotalPurchaseYTD"];
                    entity.DateFirstPurchase = (reader.IsDBNull(((int)VIndividualDemographicsColumn.DateFirstPurchase)))?null:(System.DateTime?)reader[((int)VIndividualDemographicsColumn.DateFirstPurchase)];
                    //entity.DateFirstPurchase = (Convert.IsDBNull(reader["DateFirstPurchase"]))?DateTime.MinValue:(System.DateTime?)reader["DateFirstPurchase"];
                    entity.BirthDate = (reader.IsDBNull(((int)VIndividualDemographicsColumn.BirthDate)))?null:(System.DateTime?)reader[((int)VIndividualDemographicsColumn.BirthDate)];
                    //entity.BirthDate = (Convert.IsDBNull(reader["BirthDate"]))?DateTime.MinValue:(System.DateTime?)reader["BirthDate"];
                    entity.MaritalStatus = (reader.IsDBNull(((int)VIndividualDemographicsColumn.MaritalStatus)))?null:(System.String)reader[((int)VIndividualDemographicsColumn.MaritalStatus)];
                    //entity.MaritalStatus = (Convert.IsDBNull(reader["MaritalStatus"]))?string.Empty:(System.String)reader["MaritalStatus"];
                    entity.YearlyIncome = (reader.IsDBNull(((int)VIndividualDemographicsColumn.YearlyIncome)))?null:(System.String)reader[((int)VIndividualDemographicsColumn.YearlyIncome)];
                    //entity.YearlyIncome = (Convert.IsDBNull(reader["YearlyIncome"]))?string.Empty:(System.String)reader["YearlyIncome"];
                    entity.Gender = (reader.IsDBNull(((int)VIndividualDemographicsColumn.Gender)))?null:(System.String)reader[((int)VIndividualDemographicsColumn.Gender)];
                    //entity.Gender = (Convert.IsDBNull(reader["Gender"]))?string.Empty:(System.String)reader["Gender"];
                    entity.TotalChildren = (reader.IsDBNull(((int)VIndividualDemographicsColumn.TotalChildren)))?null:(System.Int32?)reader[((int)VIndividualDemographicsColumn.TotalChildren)];
                    //entity.TotalChildren = (Convert.IsDBNull(reader["TotalChildren"]))?(int)0:(System.Int32?)reader["TotalChildren"];
                    entity.NumberChildrenAtHome = (reader.IsDBNull(((int)VIndividualDemographicsColumn.NumberChildrenAtHome)))?null:(System.Int32?)reader[((int)VIndividualDemographicsColumn.NumberChildrenAtHome)];
                    //entity.NumberChildrenAtHome = (Convert.IsDBNull(reader["NumberChildrenAtHome"]))?(int)0:(System.Int32?)reader["NumberChildrenAtHome"];
                    entity.Education = (reader.IsDBNull(((int)VIndividualDemographicsColumn.Education)))?null:(System.String)reader[((int)VIndividualDemographicsColumn.Education)];
                    //entity.Education = (Convert.IsDBNull(reader["Education"]))?string.Empty:(System.String)reader["Education"];
                    entity.Occupation = (reader.IsDBNull(((int)VIndividualDemographicsColumn.Occupation)))?null:(System.String)reader[((int)VIndividualDemographicsColumn.Occupation)];
                    //entity.Occupation = (Convert.IsDBNull(reader["Occupation"]))?string.Empty:(System.String)reader["Occupation"];
                    entity.HomeOwnerFlag = (reader.IsDBNull(((int)VIndividualDemographicsColumn.HomeOwnerFlag)))?null:(System.Boolean?)reader[((int)VIndividualDemographicsColumn.HomeOwnerFlag)];
                    //entity.HomeOwnerFlag = (Convert.IsDBNull(reader["HomeOwnerFlag"]))?false:(System.Boolean?)reader["HomeOwnerFlag"];
                    entity.NumberCarsOwned = (reader.IsDBNull(((int)VIndividualDemographicsColumn.NumberCarsOwned)))?null:(System.Int32?)reader[((int)VIndividualDemographicsColumn.NumberCarsOwned)];
                    //entity.NumberCarsOwned = (Convert.IsDBNull(reader["NumberCarsOwned"]))?(int)0:(System.Int32?)reader["NumberCarsOwned"];
                    entity.AcceptChanges();
                    entity.SuppressEntityEvents = false;

                    rows.Add(entity);
                    pageLength -= 1;
                }
                recordnum += 1;
            }
            return(rows);
        }
Example #21
0
		public VList<LNode> ExprList(ref TokenType endMarker, VList<LNode> list = default(VList<LNode>))
		{
			TT la0;
			LNode e = default(LNode);
			Token end = default(Token);
			// line 57
			if ((LT0.Value is string)) {
				endMarker = TT.EOF;
			}
			// Line 1: ( / TopExpr)
			switch ((TT) LA0) {
			case EOF:
			case TT.Comma:
			case TT.Dedent:
			case TT.RBrace:
			case TT.RBrack:
			case TT.RParen:
			case TT.Semicolon:
				{
				}
				break;
			default:
				e = TopExpr();
				break;
			}
			// Line 59: ((TT.Comma|TT.Semicolon) ( / TopExpr))*
			for (;;) {
				la0 = (TT) LA0;
				if (la0 == TT.Comma || la0 == TT.Semicolon) {
					end = MatchAny();
					list.Add(e ?? MissingExpr());
					CheckEndMarker(ref endMarker, ref end);
					// Line 62: ( / TopExpr)
					switch ((TT) LA0) {
					case EOF:
					case TT.Comma:
					case TT.Dedent:
					case TT.RBrace:
					case TT.RBrack:
					case TT.RParen:
					case TT.Semicolon:
						// line 62
						e = null;
						break;
					default:
						e = TopExpr();
						break;
					}
				} else
					break;
			}
			if ((e != null || end.Type() == TT.Comma)) {
				list.Add(e ?? MissingExpr());
			}
			return list;
		}
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VProductModelInstructions> Convert(WsProxy.VProductModelInstructions[] items)
        {
            VList <VProductModelInstructions> outItems = new VList <VProductModelInstructions>();

            foreach (WsProxy.VProductModelInstructions item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
Example #23
0
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VVendor> Convert(WsProxy.VVendor[] items)
        {
            VList <VVendor> outItems = new VList <VVendor>();

            foreach (WsProxy.VVendor item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VJobCandidateEducation> Convert(WsProxy.VJobCandidateEducation[] items)
        {
            VList <VJobCandidateEducation> outItems = new VList <VJobCandidateEducation>();

            foreach (WsProxy.VJobCandidateEducation item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VStateProvinceCountryRegion> Convert(WsProxy.VStateProvinceCountryRegion[] items)
        {
            VList <VStateProvinceCountryRegion> outItems = new VList <VStateProvinceCountryRegion>();

            foreach (WsProxy.VStateProvinceCountryRegion item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VIndividualDemographics> Convert(WsProxy.VIndividualDemographics[] items)
        {
            VList <VIndividualDemographics> outItems = new VList <VIndividualDemographics>();

            foreach (WsProxy.VIndividualDemographics item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
Example #27
0
        /// <summary>Converts this list of <see cref="Token"/> to a list of <see cref="LNode"/>.</summary>
        /// <remarks>See <see cref="Token.ToLNode(ISourceFile)"/> for more information.</remarks>
        public VList <LNode> ToLNodes()
        {
            VList <LNode> list = VList <LNode> .Empty;

            foreach (var item in (DList <Token>) this)
            {
                list.Add(item.ToLNode(File));
            }
            return(list);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VJobCandidateEmployment> Convert(WsProxy.VJobCandidateEmployment[] items)
        {
            VList <VJobCandidateEmployment> outItems = new VList <VJobCandidateEmployment>();

            foreach (WsProxy.VJobCandidateEmployment item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
Example #29
0
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VIndividualCustomer> Convert(WsProxy.VIndividualCustomer[] items)
        {
            VList <VIndividualCustomer> outItems = new VList <VIndividualCustomer>();

            foreach (WsProxy.VIndividualCustomer item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VAdditionalContactInfo> Convert(WsProxy.VAdditionalContactInfo[] items)
        {
            VList <VAdditionalContactInfo> outItems = new VList <VAdditionalContactInfo>();

            foreach (WsProxy.VAdditionalContactInfo item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
Example #31
0
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VEmployeeDepartment> Convert(WsProxy.VEmployeeDepartment[] items)
        {
            VList <VEmployeeDepartment> outItems = new VList <VEmployeeDepartment>();

            foreach (WsProxy.VEmployeeDepartment item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VSalesPerson> Convert(WsProxy.VSalesPerson[] items)
        {
            VList <VSalesPerson> outItems = new VList <VSalesPerson>();

            foreach (WsProxy.VSalesPerson item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
Example #33
0
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VEmployee> Convert(WsProxy.VEmployee[] items)
        {
            VList <VEmployee> outItems = new VList <VEmployee>();

            foreach (WsProxy.VEmployee item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VSalesPersonSalesByFiscalYears> Convert(WsProxy.VSalesPersonSalesByFiscalYears[] items)
        {
            VList <VSalesPersonSalesByFiscalYears> outItems = new VList <VSalesPersonSalesByFiscalYears>();

            foreach (WsProxy.VSalesPersonSalesByFiscalYears item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
        /// <summary>
        /// Convert a collection from the ws proxy to a nettiers collection.
        /// </summary>
        public static VList <VProductModelCatalogDescription> Convert(WsProxy.VProductModelCatalogDescription[] items)
        {
            VList <VProductModelCatalogDescription> outItems = new VList <VProductModelCatalogDescription>();

            foreach (WsProxy.VProductModelCatalogDescription item in items)
            {
                outItems.Add(Convert(item));
            }
            return(outItems);
        }
Example #36
0
            public void GenerateOutput(ref VList <LNode> list)
            {
                bool isAbstract = _classAttrs.Any(a => a.IsIdNamed(S.Abstract));
                var  baseParts  = new List <AdtParam>();

                for (var type = ParentType; type != null; type = type.ParentType)
                {
                    baseParts.InsertRange(0, type.Parts);
                }
                var allParts       = baseParts.Concat(Parts);
                var initialization = Parts.Select(p => LNode.Call(CodeSymbols.Assign, LNode.List(LNode.Call(CodeSymbols.Dot, LNode.List(LNode.Id(CodeSymbols.This), p.NameId)), p.NameId)).SetStyle(NodeStyle.Operator)).ToList();

                if (baseParts.Count > 0)
                {
                    initialization.Insert(0, F.Call(S.Base, baseParts.Select(p => p.NameId)));
                }
                var args = new VList <LNode>(allParts.Select(p => p.OriginalDecl));

                if (!_constructorAttrs.Any(a => a.IsIdNamed(S.Public)))
                {
                    _constructorAttrs.Add(F.Id(S.Public));
                }
                LNode constructor = LNode.Call(LNode.List(_constructorAttrs), CodeSymbols.Constructor, LNode.List(LNode.Missing, _typeNameStem, LNode.Call(CodeSymbols.AltList, LNode.List(args)), LNode.Call(CodeSymbols.Braces, LNode.List().AddRange(initialization).AddRange(_extraConstrLogic)).SetStyle(NodeStyle.Statement)));
                var   outBody     = new VList <LNode>();

                outBody.Add(constructor);
                outBody.AddRange(Parts.Select(p => p.GetFieldDecl()));
                outBody.AddRange(baseParts.Select(p => GetWithFn(p, isAbstract, S.Override, allParts)));
                outBody.AddRange(Parts.Select(p => GetWithFn(p, isAbstract, _children.Count > 0 ? S.Virtual : null, allParts)));
                outBody.AddRange(Parts.WithIndexes().Where(kvp => kvp.Value.NameId.Name.Name != "Item" + (baseParts.Count + kvp.Key + 1)).Select(kvp => kvp.Value.GetItemDecl(baseParts.Count + kvp.Key + 1)));
                outBody.AddRange(_classBody);
                list.Add(LNode.Call(LNode.List(_classAttrs), CodeSymbols.Class, LNode.List(TypeName, LNode.Call(CodeSymbols.AltList, LNode.List(BaseTypes)), LNode.Call(CodeSymbols.Braces, LNode.List(outBody)).SetStyle(NodeStyle.Statement))));
                if (_genericArgs.Count > 0 && Parts.Count > 0)
                {
                    var argNames = allParts.Select(p => p.NameId);
                    list.Add(LNode.Call(LNode.List().AddRange(_classAttrs).Add(LNode.Id(CodeSymbols.Static)).Add(LNode.Id(LNode.List(LNode.Id(CodeSymbols.TriviaWordAttribute)), CodeSymbols.Partial)), CodeSymbols.Class, LNode.List(_typeNameStem, LNode.Call(CodeSymbols.AltList), LNode.Call(CodeSymbols.Braces, LNode.List(LNode.Call(LNode.List(LNode.Id(CodeSymbols.Public), LNode.Id(CodeSymbols.Static)), CodeSymbols.Fn, LNode.List(TypeNameWithoutAttrs, LNode.Call(CodeSymbols.Of, LNode.List().Add(LNode.Id((Symbol)"New")).AddRange(_genericArgs)), LNode.Call(CodeSymbols.AltList, LNode.List(args)), LNode.Call(CodeSymbols.Braces, LNode.List(LNode.Call(CodeSymbols.Return, LNode.List(LNode.Call(CodeSymbols.New, LNode.List(LNode.Call(TypeNameWithoutAttrs, LNode.List(argNames)))))))).SetStyle(NodeStyle.Statement))))).SetStyle(NodeStyle.Statement))));
                }
                foreach (var child in _children)
                {
                    child.GenerateOutput(ref list);
                }
            }
Example #37
0
        /// <summary>Adds additional trailing trivia to an attribute list. Has no effect if <c>trivia</c> is empty.</summary>
        /// <remarks>
        /// Trailing trivia is represented by a call to #trivia_trailing in a node's
        /// attribute list; each argument to #trivia_trailing represents one piece of
        /// trivia.
        /// <para/>
        /// In the current design, this method has a side-effect of recreating the #trivia_trailing
        /// node at the end of the attribute list, and if there are multiple #trivia_trailing
        /// lists, consolidating them into a single list, but only if the specified <c>trivia</c>
        /// list is not empty.</remarks>
        public static VList <LNode> PlusTrailingTrivia(this VList <LNode> attrs, VList <LNode> trivia)
        {
            if (trivia.IsEmpty)
            {
                return(attrs);
            }
            VList <LNode> oldTrivia;

            attrs = WithoutTrailingTrivia(attrs, out oldTrivia);
            return(attrs.Add(LNode.Call(S.TriviaTrailing, oldTrivia.AddRange(trivia))));
        }
Example #38
0
 private void Add(ref VList <LNode> results, LNode result)
 {
     if (result.Calls(S.Splice))
     {
         results.AddRange(result.Args);
     }
     else
     {
         results.Add(result);
     }
 }
Example #39
0
 public static VList <LNode> WithSpliced(this VList <LNode> list, LNode node, Symbol listName = null)
 {
     if (node.Calls(listName ?? CodeSymbols.Splice))
     {
         return(list.AddRange(node.Args));
     }
     else
     {
         return(list.Add(node));
     }
 }
Example #40
0
            internal CodeGeneratorForMatchCase(IMacroContext context, LNode input, VList <LNode> handler)
            {
                _context = context;
                _input   = input;
                _handler = handler;
                var @break = LNode.Call(CodeSymbols.Break);

                if (_handler.IsEmpty || !_handler.Last.Equals(@break))
                {
                    _handler.Add(@break);
                }
            }
Example #41
0
            void ProcessRequiresAttribute(VList <LNode> conditions, Symbol mode, LNode variableName)
            {
                // Create a "Contract.Requires()" check for each provided condition.
                foreach (var condition_ in conditions)
                {
                    LNode condition = condition_;                       // make it writable so we can replace `_`
                    LNode conditionStr;

                    if (ReplaceContractUnderscore(ref condition, variableName))
                    {
                        if (variableName == null)
                        {
                            Context.Sink.Error(condition, "`{0}`: underscore has no meaning in this location.", mode);
                        }
                    }
                    if (mode == sy_assert)
                    {
                        PrependStmts.Add(LNode.Call((Symbol)"assert", LNode.List(condition)));                          // relies on assert() macro
                    }
                    else if (_haveCCRewriter)
                    {
                        PrependStmts.Add(LNode.Call(LNode.Call(CodeSymbols.Dot, LNode.List(LNode.Id((Symbol)"Contract"), LNode.Id((Symbol)"Requires"))).SetStyle(NodeStyle.Operator), LNode.List(condition)));
                    }
                    else
                    {
                        conditionStr = ConditionToStringLit(condition, "Precondition failed: {1}");
                        PrependStmts.Add(LNode.Call(GetAssertMethodForRequires(), LNode.List(condition, conditionStr)));
                    }
                }
            }
Example #42
0
 void ProcessRequiresAttribute(VList <LNode> conditions, Symbol mode, LNode variableName)
 {
     foreach (var condition_ in conditions)
     {
         LNode condition = condition_;
         LNode conditionStr;
         if (ReplaceContractUnderscore(ref condition, variableName))
         {
             if (variableName == null)
             {
                 Context.Write(Severity.Error, condition, "`{0}`: underscore has no meaning in this location.", mode);
             }
         }
         if (mode == sy_assert)
         {
             PrependStmts.Add(LNode.Call((Symbol)"assert", LNode.List(condition)));
         }
         else if (_haveCCRewriter)
         {
             PrependStmts.Add(LNode.Call(LNode.Call(CodeSymbols.Dot, LNode.List(LNode.Id((Symbol)"Contract"), LNode.Id((Symbol)"Requires"))), LNode.List(condition)));
         }
         else
         {
             conditionStr = ConditionToStringLit(condition, "Precondition failed: {1}");
             PrependStmts.Add(LNode.Call(GetAssertMethodForRequires(), LNode.List(condition, conditionStr)));
         }
     }
 }
Example #43
0
        /*
         * ///<summary>
         * /// Fill an VList&lt;VJobCandidateEmployment&gt; From a DataSet
         * ///</summary>
         * /// <param name="dataSet">the DataSet</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList&lt;VJobCandidateEmployment&gt;"/></returns>
         * protected static VList&lt;VJobCandidateEmployment&gt; Fill(DataSet dataSet, VList<VJobCandidateEmployment> rows, int start, int pagelen)
         * {
         *      if (dataSet.Tables.Count == 1)
         *      {
         *              return Fill(dataSet.Tables[0], rows, start, pagelen);
         *      }
         *      else
         *      {
         *              return new VList<VJobCandidateEmployment>();
         *      }
         * }
         *
         *
         * ///<summary>
         * /// Fill an VList&lt;VJobCandidateEmployment&gt; From a DataTable
         * ///</summary>
         * /// <param name="dataTable">the DataTable that hold the data.</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList<VJobCandidateEmployment>"/></returns>
         * protected static VList&lt;VJobCandidateEmployment&gt; Fill(DataTable dataTable, VList<VJobCandidateEmployment> rows, int start, int pagelen)
         * {
         *      int recordnum = 0;
         *
         *      System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
         *
         *      while (dataRows.MoveNext() && (pagelen != 0))
         *      {
         *              if(recordnum >= start)
         *              {
         *                      DataRow row = (DataRow)dataRows.Current;
         *
         *                      VJobCandidateEmployment c = new VJobCandidateEmployment();
         *                      c.JobCandidateId = (Convert.IsDBNull(row["JobCandidateID"]))?(int)0:(System.Int32)row["JobCandidateID"];
         *                      c.SafeNameEmpStartDate = (Convert.IsDBNull(row["Emp.StartDate"]))?DateTime.MinValue:(System.DateTime?)row["Emp.StartDate"];
         *                      c.SafeNameEmpEndDate = (Convert.IsDBNull(row["Emp.EndDate"]))?DateTime.MinValue:(System.DateTime?)row["Emp.EndDate"];
         *                      c.SafeNameEmpOrgName = (Convert.IsDBNull(row["Emp.OrgName"]))?string.Empty:(System.String)row["Emp.OrgName"];
         *                      c.SafeNameEmpJobTitle = (Convert.IsDBNull(row["Emp.JobTitle"]))?string.Empty:(System.String)row["Emp.JobTitle"];
         *                      c.SafeNameEmpResponsibility = (Convert.IsDBNull(row["Emp.Responsibility"]))?string.Empty:(System.String)row["Emp.Responsibility"];
         *                      c.SafeNameEmpFunctionCategory = (Convert.IsDBNull(row["Emp.FunctionCategory"]))?string.Empty:(System.String)row["Emp.FunctionCategory"];
         *                      c.SafeNameEmpIndustryCategory = (Convert.IsDBNull(row["Emp.IndustryCategory"]))?string.Empty:(System.String)row["Emp.IndustryCategory"];
         *                      c.SafeNameEmpLocCountryRegion = (Convert.IsDBNull(row["Emp.Loc.CountryRegion"]))?string.Empty:(System.String)row["Emp.Loc.CountryRegion"];
         *                      c.SafeNameEmpLocState = (Convert.IsDBNull(row["Emp.Loc.State"]))?string.Empty:(System.String)row["Emp.Loc.State"];
         *                      c.SafeNameEmpLocCity = (Convert.IsDBNull(row["Emp.Loc.City"]))?string.Empty:(System.String)row["Emp.Loc.City"];
         *                      c.AcceptChanges();
         *                      rows.Add(c);
         *                      pagelen -= 1;
         *              }
         *              recordnum += 1;
         *      }
         *      return rows;
         * }
         */

        ///<summary>
        /// Fill an <see cref="VList&lt;VJobCandidateEmployment&gt;"/> From a DataReader.
        ///</summary>
        /// <param name="reader">Datareader</param>
        /// <param name="rows">The collection to fill</param>
        /// <param name="start">Start row</param>
        /// <param name="pageLength">number of row.</param>
        ///<returns>a <see cref="VList&lt;VJobCandidateEmployment&gt;"/></returns>
        protected VList <VJobCandidateEmployment> Fill(IDataReader reader, VList <VJobCandidateEmployment> rows, int start, int pageLength)
        {
            int recordnum = 0;

            while (reader.Read() && (pageLength != 0))
            {
                if (recordnum >= start)
                {
                    VJobCandidateEmployment entity = null;
                    if (DataRepository.Provider.UseEntityFactory)
                    {
                        entity = EntityManager.CreateViewEntity <VJobCandidateEmployment>("VJobCandidateEmployment", DataRepository.Provider.EntityCreationalFactoryType);
                    }
                    else
                    {
                        entity = new VJobCandidateEmployment();
                    }

                    entity.SuppressEntityEvents = true;

                    entity.JobCandidateId = (System.Int32)reader[((int)VJobCandidateEmploymentColumn.JobCandidateId)];
                    //entity.JobCandidateId = (Convert.IsDBNull(reader["JobCandidateID"]))?(int)0:(System.Int32)reader["JobCandidateID"];
                    entity.SafeNameEmpStartDate = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpStartDate)))?null:(System.DateTime?)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpStartDate)];
                    //entity.SafeNameEmpStartDate = (Convert.IsDBNull(reader["Emp.StartDate"]))?DateTime.MinValue:(System.DateTime?)reader["Emp.StartDate"];
                    entity.SafeNameEmpEndDate = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpEndDate)))?null:(System.DateTime?)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpEndDate)];
                    //entity.SafeNameEmpEndDate = (Convert.IsDBNull(reader["Emp.EndDate"]))?DateTime.MinValue:(System.DateTime?)reader["Emp.EndDate"];
                    entity.SafeNameEmpOrgName = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpOrgName)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpOrgName)];
                    //entity.SafeNameEmpOrgName = (Convert.IsDBNull(reader["Emp.OrgName"]))?string.Empty:(System.String)reader["Emp.OrgName"];
                    entity.SafeNameEmpJobTitle = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpJobTitle)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpJobTitle)];
                    //entity.SafeNameEmpJobTitle = (Convert.IsDBNull(reader["Emp.JobTitle"]))?string.Empty:(System.String)reader["Emp.JobTitle"];
                    entity.SafeNameEmpResponsibility = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpResponsibility)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpResponsibility)];
                    //entity.SafeNameEmpResponsibility = (Convert.IsDBNull(reader["Emp.Responsibility"]))?string.Empty:(System.String)reader["Emp.Responsibility"];
                    entity.SafeNameEmpFunctionCategory = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpFunctionCategory)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpFunctionCategory)];
                    //entity.SafeNameEmpFunctionCategory = (Convert.IsDBNull(reader["Emp.FunctionCategory"]))?string.Empty:(System.String)reader["Emp.FunctionCategory"];
                    entity.SafeNameEmpIndustryCategory = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpIndustryCategory)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpIndustryCategory)];
                    //entity.SafeNameEmpIndustryCategory = (Convert.IsDBNull(reader["Emp.IndustryCategory"]))?string.Empty:(System.String)reader["Emp.IndustryCategory"];
                    entity.SafeNameEmpLocCountryRegion = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpLocCountryRegion)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpLocCountryRegion)];
                    //entity.SafeNameEmpLocCountryRegion = (Convert.IsDBNull(reader["Emp.Loc.CountryRegion"]))?string.Empty:(System.String)reader["Emp.Loc.CountryRegion"];
                    entity.SafeNameEmpLocState = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpLocState)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpLocState)];
                    //entity.SafeNameEmpLocState = (Convert.IsDBNull(reader["Emp.Loc.State"]))?string.Empty:(System.String)reader["Emp.Loc.State"];
                    entity.SafeNameEmpLocCity = (reader.IsDBNull(((int)VJobCandidateEmploymentColumn.SafeNameEmpLocCity)))?null:(System.String)reader[((int)VJobCandidateEmploymentColumn.SafeNameEmpLocCity)];
                    //entity.SafeNameEmpLocCity = (Convert.IsDBNull(reader["Emp.Loc.City"]))?string.Empty:(System.String)reader["Emp.Loc.City"];
                    entity.AcceptChanges();
                    entity.SuppressEntityEvents = false;

                    rows.Add(entity);
                    pageLength -= 1;
                }
                recordnum += 1;
            }
            return(rows);
        }
        /*
         * ///<summary>
         * /// Fill an VList&lt;VEmployeeDepartmentHistory&gt; From a DataSet
         * ///</summary>
         * /// <param name="dataSet">the DataSet</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList&lt;VEmployeeDepartmentHistory&gt;"/></returns>
         * protected static VList&lt;VEmployeeDepartmentHistory&gt; Fill(DataSet dataSet, VList<VEmployeeDepartmentHistory> rows, int start, int pagelen)
         * {
         *      if (dataSet.Tables.Count == 1)
         *      {
         *              return Fill(dataSet.Tables[0], rows, start, pagelen);
         *      }
         *      else
         *      {
         *              return new VList<VEmployeeDepartmentHistory>();
         *      }
         * }
         *
         *
         * ///<summary>
         * /// Fill an VList&lt;VEmployeeDepartmentHistory&gt; From a DataTable
         * ///</summary>
         * /// <param name="dataTable">the DataTable that hold the data.</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList<VEmployeeDepartmentHistory>"/></returns>
         * protected static VList&lt;VEmployeeDepartmentHistory&gt; Fill(DataTable dataTable, VList<VEmployeeDepartmentHistory> rows, int start, int pagelen)
         * {
         *      int recordnum = 0;
         *
         *      System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
         *
         *      while (dataRows.MoveNext() && (pagelen != 0))
         *      {
         *              if(recordnum >= start)
         *              {
         *                      DataRow row = (DataRow)dataRows.Current;
         *
         *                      VEmployeeDepartmentHistory c = new VEmployeeDepartmentHistory();
         *                      c.EmployeeId = (Convert.IsDBNull(row["EmployeeID"]))?(int)0:(System.Int32)row["EmployeeID"];
         *                      c.Title = (Convert.IsDBNull(row["Title"]))?string.Empty:(System.String)row["Title"];
         *                      c.FirstName = (Convert.IsDBNull(row["FirstName"]))?string.Empty:(System.String)row["FirstName"];
         *                      c.MiddleName = (Convert.IsDBNull(row["MiddleName"]))?string.Empty:(System.String)row["MiddleName"];
         *                      c.LastName = (Convert.IsDBNull(row["LastName"]))?string.Empty:(System.String)row["LastName"];
         *                      c.Suffix = (Convert.IsDBNull(row["Suffix"]))?string.Empty:(System.String)row["Suffix"];
         *                      c.Shift = (Convert.IsDBNull(row["Shift"]))?string.Empty:(System.String)row["Shift"];
         *                      c.Department = (Convert.IsDBNull(row["Department"]))?string.Empty:(System.String)row["Department"];
         *                      c.GroupName = (Convert.IsDBNull(row["GroupName"]))?string.Empty:(System.String)row["GroupName"];
         *                      c.StartDate = (Convert.IsDBNull(row["StartDate"]))?DateTime.MinValue:(System.DateTime)row["StartDate"];
         *                      c.EndDate = (Convert.IsDBNull(row["EndDate"]))?DateTime.MinValue:(System.DateTime?)row["EndDate"];
         *                      c.AcceptChanges();
         *                      rows.Add(c);
         *                      pagelen -= 1;
         *              }
         *              recordnum += 1;
         *      }
         *      return rows;
         * }
         */

        ///<summary>
        /// Fill an <see cref="VList&lt;VEmployeeDepartmentHistory&gt;"/> From a DataReader.
        ///</summary>
        /// <param name="reader">Datareader</param>
        /// <param name="rows">The collection to fill</param>
        /// <param name="start">Start row</param>
        /// <param name="pageLength">number of row.</param>
        ///<returns>a <see cref="VList&lt;VEmployeeDepartmentHistory&gt;"/></returns>
        protected VList <VEmployeeDepartmentHistory> Fill(IDataReader reader, VList <VEmployeeDepartmentHistory> rows, int start, int pageLength)
        {
            int recordnum = 0;

            while (reader.Read() && (pageLength != 0))
            {
                if (recordnum >= start)
                {
                    VEmployeeDepartmentHistory entity = null;
                    if (DataRepository.Provider.UseEntityFactory)
                    {
                        entity = EntityManager.CreateViewEntity <VEmployeeDepartmentHistory>("VEmployeeDepartmentHistory", DataRepository.Provider.EntityCreationalFactoryType);
                    }
                    else
                    {
                        entity = new VEmployeeDepartmentHistory();
                    }

                    entity.SuppressEntityEvents = true;

                    entity.EmployeeId = (System.Int32)reader[((int)VEmployeeDepartmentHistoryColumn.EmployeeId)];
                    //entity.EmployeeId = (Convert.IsDBNull(reader["EmployeeID"]))?(int)0:(System.Int32)reader["EmployeeID"];
                    entity.Title = (reader.IsDBNull(((int)VEmployeeDepartmentHistoryColumn.Title)))?null:(System.String)reader[((int)VEmployeeDepartmentHistoryColumn.Title)];
                    //entity.Title = (Convert.IsDBNull(reader["Title"]))?string.Empty:(System.String)reader["Title"];
                    entity.FirstName = (System.String)reader[((int)VEmployeeDepartmentHistoryColumn.FirstName)];
                    //entity.FirstName = (Convert.IsDBNull(reader["FirstName"]))?string.Empty:(System.String)reader["FirstName"];
                    entity.MiddleName = (reader.IsDBNull(((int)VEmployeeDepartmentHistoryColumn.MiddleName)))?null:(System.String)reader[((int)VEmployeeDepartmentHistoryColumn.MiddleName)];
                    //entity.MiddleName = (Convert.IsDBNull(reader["MiddleName"]))?string.Empty:(System.String)reader["MiddleName"];
                    entity.LastName = (System.String)reader[((int)VEmployeeDepartmentHistoryColumn.LastName)];
                    //entity.LastName = (Convert.IsDBNull(reader["LastName"]))?string.Empty:(System.String)reader["LastName"];
                    entity.Suffix = (reader.IsDBNull(((int)VEmployeeDepartmentHistoryColumn.Suffix)))?null:(System.String)reader[((int)VEmployeeDepartmentHistoryColumn.Suffix)];
                    //entity.Suffix = (Convert.IsDBNull(reader["Suffix"]))?string.Empty:(System.String)reader["Suffix"];
                    entity.Shift = (System.String)reader[((int)VEmployeeDepartmentHistoryColumn.Shift)];
                    //entity.Shift = (Convert.IsDBNull(reader["Shift"]))?string.Empty:(System.String)reader["Shift"];
                    entity.Department = (System.String)reader[((int)VEmployeeDepartmentHistoryColumn.Department)];
                    //entity.Department = (Convert.IsDBNull(reader["Department"]))?string.Empty:(System.String)reader["Department"];
                    entity.GroupName = (System.String)reader[((int)VEmployeeDepartmentHistoryColumn.GroupName)];
                    //entity.GroupName = (Convert.IsDBNull(reader["GroupName"]))?string.Empty:(System.String)reader["GroupName"];
                    entity.StartDate = (System.DateTime)reader[((int)VEmployeeDepartmentHistoryColumn.StartDate)];
                    //entity.StartDate = (Convert.IsDBNull(reader["StartDate"]))?DateTime.MinValue:(System.DateTime)reader["StartDate"];
                    entity.EndDate = (reader.IsDBNull(((int)VEmployeeDepartmentHistoryColumn.EndDate)))?null:(System.DateTime?)reader[((int)VEmployeeDepartmentHistoryColumn.EndDate)];
                    //entity.EndDate = (Convert.IsDBNull(reader["EndDate"]))?DateTime.MinValue:(System.DateTime?)reader["EndDate"];
                    entity.AcceptChanges();
                    entity.SuppressEntityEvents = false;

                    rows.Add(entity);
                    pageLength -= 1;
                }
                recordnum += 1;
            }
            return(rows);
        }
        /*
         * ///<summary>
         * /// Fill an VList&lt;VProductModelInstructions&gt; From a DataSet
         * ///</summary>
         * /// <param name="dataSet">the DataSet</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList&lt;VProductModelInstructions&gt;"/></returns>
         * protected static VList&lt;VProductModelInstructions&gt; Fill(DataSet dataSet, VList<VProductModelInstructions> rows, int start, int pagelen)
         * {
         *      if (dataSet.Tables.Count == 1)
         *      {
         *              return Fill(dataSet.Tables[0], rows, start, pagelen);
         *      }
         *      else
         *      {
         *              return new VList<VProductModelInstructions>();
         *      }
         * }
         *
         *
         * ///<summary>
         * /// Fill an VList&lt;VProductModelInstructions&gt; From a DataTable
         * ///</summary>
         * /// <param name="dataTable">the DataTable that hold the data.</param>
         * /// <param name="rows">The collection to fill</param>
         * /// <param name="start">Start row</param>
         * /// <param name="pagelen">number of row.</param>
         * ///<returns><see chref="VList<VProductModelInstructions>"/></returns>
         * protected static VList&lt;VProductModelInstructions&gt; Fill(DataTable dataTable, VList<VProductModelInstructions> rows, int start, int pagelen)
         * {
         *      int recordnum = 0;
         *
         *      System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
         *
         *      while (dataRows.MoveNext() && (pagelen != 0))
         *      {
         *              if(recordnum >= start)
         *              {
         *                      DataRow row = (DataRow)dataRows.Current;
         *
         *                      VProductModelInstructions c = new VProductModelInstructions();
         *                      c.ProductModelId = (Convert.IsDBNull(row["ProductModelID"]))?(int)0:(System.Int32)row["ProductModelID"];
         *                      c.Name = (Convert.IsDBNull(row["Name"]))?string.Empty:(System.String)row["Name"];
         *                      c.Instructions = (Convert.IsDBNull(row["Instructions"]))?string.Empty:(System.String)row["Instructions"];
         *                      c.LocationId = (Convert.IsDBNull(row["LocationID"]))?(int)0:(System.Int32?)row["LocationID"];
         *                      c.SetupHours = (Convert.IsDBNull(row["SetupHours"]))?0.0m:(System.Decimal?)row["SetupHours"];
         *                      c.MachineHours = (Convert.IsDBNull(row["MachineHours"]))?0.0m:(System.Decimal?)row["MachineHours"];
         *                      c.LaborHours = (Convert.IsDBNull(row["LaborHours"]))?0.0m:(System.Decimal?)row["LaborHours"];
         *                      c.LotSize = (Convert.IsDBNull(row["LotSize"]))?(int)0:(System.Int32?)row["LotSize"];
         *                      c.Step = (Convert.IsDBNull(row["Step"]))?string.Empty:(System.String)row["Step"];
         *                      c.Rowguid = (Convert.IsDBNull(row["rowguid"]))?Guid.Empty:(System.Guid)row["rowguid"];
         *                      c.ModifiedDate = (Convert.IsDBNull(row["ModifiedDate"]))?DateTime.MinValue:(System.DateTime)row["ModifiedDate"];
         *                      c.AcceptChanges();
         *                      rows.Add(c);
         *                      pagelen -= 1;
         *              }
         *              recordnum += 1;
         *      }
         *      return rows;
         * }
         */

        ///<summary>
        /// Fill an <see cref="VList&lt;VProductModelInstructions&gt;"/> From a DataReader.
        ///</summary>
        /// <param name="reader">Datareader</param>
        /// <param name="rows">The collection to fill</param>
        /// <param name="start">Start row</param>
        /// <param name="pageLength">number of row.</param>
        ///<returns>a <see cref="VList&lt;VProductModelInstructions&gt;"/></returns>
        protected VList <VProductModelInstructions> Fill(IDataReader reader, VList <VProductModelInstructions> rows, int start, int pageLength)
        {
            int recordnum = 0;

            while (reader.Read() && (pageLength != 0))
            {
                if (recordnum >= start)
                {
                    VProductModelInstructions entity = null;
                    if (DataRepository.Provider.UseEntityFactory)
                    {
                        entity = EntityManager.CreateViewEntity <VProductModelInstructions>("VProductModelInstructions", DataRepository.Provider.EntityCreationalFactoryType);
                    }
                    else
                    {
                        entity = new VProductModelInstructions();
                    }

                    entity.SuppressEntityEvents = true;

                    entity.ProductModelId = (System.Int32)reader[((int)VProductModelInstructionsColumn.ProductModelId)];
                    //entity.ProductModelId = (Convert.IsDBNull(reader["ProductModelID"]))?(int)0:(System.Int32)reader["ProductModelID"];
                    entity.Name = (System.String)reader[((int)VProductModelInstructionsColumn.Name)];
                    //entity.Name = (Convert.IsDBNull(reader["Name"]))?string.Empty:(System.String)reader["Name"];
                    entity.Instructions = (reader.IsDBNull(((int)VProductModelInstructionsColumn.Instructions)))?null:(System.String)reader[((int)VProductModelInstructionsColumn.Instructions)];
                    //entity.Instructions = (Convert.IsDBNull(reader["Instructions"]))?string.Empty:(System.String)reader["Instructions"];
                    entity.LocationId = (reader.IsDBNull(((int)VProductModelInstructionsColumn.LocationId)))?null:(System.Int32?)reader[((int)VProductModelInstructionsColumn.LocationId)];
                    //entity.LocationId = (Convert.IsDBNull(reader["LocationID"]))?(int)0:(System.Int32?)reader["LocationID"];
                    entity.SetupHours = (reader.IsDBNull(((int)VProductModelInstructionsColumn.SetupHours)))?null:(System.Decimal?)reader[((int)VProductModelInstructionsColumn.SetupHours)];
                    //entity.SetupHours = (Convert.IsDBNull(reader["SetupHours"]))?0.0m:(System.Decimal?)reader["SetupHours"];
                    entity.MachineHours = (reader.IsDBNull(((int)VProductModelInstructionsColumn.MachineHours)))?null:(System.Decimal?)reader[((int)VProductModelInstructionsColumn.MachineHours)];
                    //entity.MachineHours = (Convert.IsDBNull(reader["MachineHours"]))?0.0m:(System.Decimal?)reader["MachineHours"];
                    entity.LaborHours = (reader.IsDBNull(((int)VProductModelInstructionsColumn.LaborHours)))?null:(System.Decimal?)reader[((int)VProductModelInstructionsColumn.LaborHours)];
                    //entity.LaborHours = (Convert.IsDBNull(reader["LaborHours"]))?0.0m:(System.Decimal?)reader["LaborHours"];
                    entity.LotSize = (reader.IsDBNull(((int)VProductModelInstructionsColumn.LotSize)))?null:(System.Int32?)reader[((int)VProductModelInstructionsColumn.LotSize)];
                    //entity.LotSize = (Convert.IsDBNull(reader["LotSize"]))?(int)0:(System.Int32?)reader["LotSize"];
                    entity.Step = (reader.IsDBNull(((int)VProductModelInstructionsColumn.Step)))?null:(System.String)reader[((int)VProductModelInstructionsColumn.Step)];
                    //entity.Step = (Convert.IsDBNull(reader["Step"]))?string.Empty:(System.String)reader["Step"];
                    entity.Rowguid = (System.Guid)reader[((int)VProductModelInstructionsColumn.Rowguid)];
                    //entity.Rowguid = (Convert.IsDBNull(reader["rowguid"]))?Guid.Empty:(System.Guid)reader["rowguid"];
                    entity.ModifiedDate = (System.DateTime)reader[((int)VProductModelInstructionsColumn.ModifiedDate)];
                    //entity.ModifiedDate = (Convert.IsDBNull(reader["ModifiedDate"]))?DateTime.MinValue:(System.DateTime)reader["ModifiedDate"];
                    entity.AcceptChanges();
                    entity.SuppressEntityEvents = false;

                    rows.Add(entity);
                    pageLength -= 1;
                }
                recordnum += 1;
            }
            return(rows);
        }
Example #46
0
		public static LNode UseSymbolsCore(VList<LNode> symbolAttrs, VList<LNode> options, VList<LNode> body, IMacroContext context, bool inType)
		{
			// Decode options (TODO: invent a simpler approach)
			string prefix = "sy_";
			var inherited = new HashSet<Symbol>();
			foreach (var pair in MacroContext.GetOptions(options))
			{
				if (pair.Key.Name.Name == "prefix" && pair.Value.IsId)
					prefix = pair.Value.Name.Name;
				else if (pair.Key.Name.Name == "inherit" && pair.Value.Value is Symbol)
					inherited.Add((Symbol)pair.Value.Value);
				else if (pair.Key.Name.Name == "inherit" && (pair.Value.Calls(S.Braces) || pair.Value.Calls(S.Tuple)) && pair.Value.Args.All(n => n.Value is Symbol))
					foreach (var arg in pair.Value.Args)
						inherited.Add((Symbol)arg.Value);
				else
					context.Sink.Warning(pair.Value, "Unrecognized parameter. Expected prefix:id or inherit:{@@A; @@B; ...})");
			}

			// Replace all symbols while collecting a list of them
			var symbols = new Dictionary<Symbol, LNode>();
			VList<LNode> output = body.SmartSelect(stmt => stmt.ReplaceRecursive(n => {
				if (!inType && n.ArgCount == 3) {
					// Since we're outside any type, we must avoid creating symbol 
					// fields. When we cross into a type then we can start making
					// Symbols by calling ourself recursively with inType=true
					var kind = EcsValidators.SpaceDefinitionKind(n);
					if (kind == S.Class || kind == S.Struct || kind == S.Interface || kind == S.Alias || kind == S.Trait) {
						var body2 = n.Args[2];
						return n.WithArgChanged(2, UseSymbolsCore(symbolAttrs, options, body2.Args, context, true).WithName(body2.Name));
					}
				}
				var sym = n.Value as Symbol;
				if (n.IsLiteral && sym != null)
					return symbols[sym] = LNode.Id(prefix + sym.Name);
				return null;
			}));

			// Return updated code with variable declaration at the top for all non-inherit symbols used.
			var _Symbol = F.Id("Symbol");
			var vars = (from sym in symbols
			            where !inherited.Contains(sym.Key)
			            select F.Call(S.Assign, sym.Value, 
			                   F.Call(S.Cast, F.Literal(sym.Key.Name), _Symbol))).ToList();
			if (vars.Count > 0)
				output.Insert(0, F.Call(S.Var, ListExt.Single(_Symbol).Concat(vars))
					.WithAttrs(symbolAttrs.Add(F.Id(S.Static)).Add(F.Id(S.Readonly))));
			return F.Call(S.Splice, output);
		}
Example #47
0
		// Used for new int[][] { ... } or int[][] x = { ... }
		void InitializerList(ref VList<LNode> list)
		{
			TokenType la0, la1;
			// Line 2114: nongreedy(InitializerExpr (TT.Comma EOF / TT.Comma InitializerExpr)*)?
			la0 = LA0;
			if (la0 == EOF)
				;
			else {
				list.Add(InitializerExpr());
				// Line 2115: (TT.Comma EOF / TT.Comma InitializerExpr)*
				for (;;) {
					la0 = LA0;
					if (la0 == TT.Comma) {
						la1 = LA(1);
						if (la1 == EOF) {
							Skip();
							Skip();
						} else if (InitializerList_set0.Contains((int) la1)) {
							Skip();
							list.Add(InitializerExpr());
						} else
							goto error;
					} else if (la0 == EOF)
						break;
					else
						goto error;
					continue;
				error:
					{
						// line 2117
						Error("Syntax error in initializer list");
						// Line 2117: (~(EOF|TT.Comma))*
						for (;;) {
							la0 = LA0;
							if (!(la0 == (TokenType) EOF || la0 == TT.Comma))
								Skip();
							else
								break;
						}
					}
				}
			}
			Skip();
		}
        /// <summary>
        /// Serialize a ProductsAboveAveragePrice collection into a temporary file.
        /// </summary>
        private void Step_8_SerializeCollection_Generated()
        {
            string fileName = "temp_ProductsAboveAveragePriceCollection.xml";

            VList<ProductsAboveAveragePrice> mockCollection = new VList<ProductsAboveAveragePrice>();
            mockCollection.Add(mock);

            XmlSerializer mySerializer = new XmlSerializer(typeof(VList<ProductsAboveAveragePrice>));
            System.IO.StreamWriter myWriter = new System.IO.StreamWriter(fileName);
            mySerializer.Serialize(myWriter, mockCollection);
            myWriter.Close();

            System.Console.WriteLine("VList<ProductsAboveAveragePrice> correctly serialized to a temporary file.");
        }
Example #49
0
		// ---------------------------------------------------------------------
		// methods, properties, variable/field declarations, operators ---------
		// ---------------------------------------------------------------------
		LNode MethodOrPropertyOrVar(int startIndex, VList<LNode> attrs)
		{
			TokenType la0;
			LNode name = default(LNode);
			LNode result = default(LNode);
			// line 1610
			bool isExtensionMethod = false;
			bool isNamedThis;
			// Line 1611: (TT.This)?
			la0 = LA0;
			if (la0 == TT.This) {
				var t = MatchAny();
				// line 1611
				attrs.Add(F.Id(t));
				isExtensionMethod = true;
			}
			var type = DataType();
			name = ComplexNameDecl(!isExtensionMethod, out isNamedThis);
			// Line 1615: ( &{!isNamedThis} VarInitializerOpt (TT.Comma ComplexNameDecl VarInitializerOpt)* TT.Semicolon / &{!isNamedThis} MethodArgListAndBody | RestOfPropertyDefinition )
			switch (LA0) {
			case TT.Comma: case TT.QuickBindSet: case TT.Semicolon: case TT.Set:
				{
					Check(!isNamedThis, "Expected !isNamedThis");
					MaybeRecognizeVarAsKeyword(ref type);
					var parts = LNode.List(type);
					var isArray = IsArrayType(type);
					parts.Add(VarInitializerOpt(name, isArray));
					// Line 1620: (TT.Comma ComplexNameDecl VarInitializerOpt)*
					for (;;) {
						la0 = LA0;
						if (la0 == TT.Comma) {
							Skip();
							name = ComplexNameDecl();
							parts.Add(VarInitializerOpt(name, isArray));
						} else
							break;
					}
					var end = Match((int) TT.Semicolon);
					var typeStart = type.Range.StartIndex;
					result = F.Call(S.Var, parts, typeStart, end.EndIndex, typeStart, typeStart);
				}
				break;
			case TT.LParen:
				{
					Check(!isNamedThis, "Expected !isNamedThis");
					result = MethodArgListAndBody(startIndex, type.Range.StartIndex, attrs, S.Fn, type, name);
					// line 1628
					return result;
				}
				break;
			case TT.At: case TT.ContextualKeyword: case TT.Forward: case TT.LambdaArrow:
			case TT.LBrace: case TT.LBrack:
				result = RestOfPropertyDefinition(startIndex, type, name, false);
				break;
			default:
				{
					// line 1631
					Error("Syntax error in what appears to be a method, property, or variable declaration");
					ScanToEndOfStmt();
					// line 1633
					result = F.Call(S.Var, type, name, type.Range.StartIndex, name.Range.EndIndex);
				}
				break;
			}
			result = result.PlusAttrs(attrs);
			return result;
		}
Example #50
0
		LNode EventDecl(int startIndex)
		{
			TokenType la0;
			Token eventkw = default(Token);
			Token lit_semi = default(Token);
			LNode result = default(LNode);
			eventkw = MatchAny();
			var type = DataType();
			var name = ComplexNameDecl();
			// Line 1820: (TT.Comma ComplexNameDecl (TT.Comma ComplexNameDecl)*)?
			la0 = LA0;
			if (la0 == TT.Comma) {
				// line 1820
				var parts = new VList<LNode>(name);
				Skip();
				parts.Add(ComplexNameDecl());
				// Line 1821: (TT.Comma ComplexNameDecl)*
				for (;;) {
					la0 = LA0;
					if (la0 == TT.Comma) {
						Skip();
						parts.Add(ComplexNameDecl());
					} else
						break;
				}
				// line 1822
				name = F.List(parts, name.Range.StartIndex, parts.Last.Range.EndIndex);
			}
			// Line 1824: (TT.Semicolon | BracedBlock)
			la0 = LA0;
			if (la0 == TT.Semicolon) {
				lit_semi = MatchAny();
				// line 1825
				result = F.Call(eventkw, type, name, startIndex, lit_semi.EndIndex);
			} else {
				var body = BracedBlock(S.Fn);
				if (name.Calls(S.AltList)) {
					Error("A body is not allowed when defining multiple events.");
				}
				result = F.Call(eventkw, LNode.List(type, name, body), startIndex, body.Range.EndIndex);
			}
			return result;
		}
Example #51
0
		LNode RestOfPropertyDefinition(int startIndex, LNode type, LNode name, bool isExpression)
		{
			TokenType la0;
			Token lb = default(Token);
			Token rb = default(Token);
			LNode result = default(LNode);
			// line 1662
			LNode args = F.Missing;
			// Line 1663: (TT.LBrack TT.RBrack)?
			la0 = LA0;
			if (la0 == TT.LBrack) {
				lb = MatchAny();
				rb = Match((int) TT.RBrack);
				// line 1663
				args = ArgList(lb, rb);
			}
			WhereClausesOpt(ref name);
			// line 1665
			LNode initializer;
			var body = MethodBodyOrForward(true, out initializer, isExpression);
			// line 1668
			var parts = new VList<LNode> { 
				type, name, args, body
			};
			if (initializer != null) {
				parts.Add(initializer);
			}
			int targetIndex = type.Range.StartIndex;
			result = F.Call(S.Property, parts, startIndex, body.Range.EndIndex, targetIndex, targetIndex);
			return result;
		}
Example #52
0
		// List of type parameters. `declContext` specifies that type parameters can 
		// have [normal attributes] and in/out variance attrbutes.
		void TParams(bool declContext, ref LNode r)
		{
			TokenType la0, la1;
			Token op = default(Token);
			VList<LNode> list = new VList<LNode>(r);
			int endIndex;
			// Line 203: ( TT.LT (TParamDeclOrDataType (TT.Comma TParamDeclOrDataType)*)? TT.GT | TT.Dot TT.LBrack TT.RBrack | TT.Not TT.LParen TT.RParen | TT.Not IdWithOptionalTypeParams )
			la0 = LA0;
			if (la0 == TT.LT) {
				op = MatchAny();
				// Line 203: (TParamDeclOrDataType (TT.Comma TParamDeclOrDataType)*)?
				switch (LA0) {
				case TT.AttrKeyword: case TT.ContextualKeyword: case TT.Id: case TT.In:
				case TT.LBrack: case TT.Operator: case TT.Substitute: case TT.TypeKeyword:
					{
						list.Add(TParamDeclOrDataType(declContext));
						// Line 204: (TT.Comma TParamDeclOrDataType)*
						for (;;) {
							la0 = LA0;
							if (la0 == TT.Comma) {
								Skip();
								list.Add(TParamDeclOrDataType(declContext));
							} else
								break;
						}
					}
					break;
				}
				var end = Match((int) TT.GT);
				// line 204
				endIndex = end.EndIndex;
			} else if (la0 == TT.Dot) {
				op = MatchAny();
				var t = Match((int) TT.LBrack);
				var end = Match((int) TT.RBrack);
				// line 205
				list = AppendExprsInside(t, list);
				endIndex = end.EndIndex;
			} else {
				la1 = LA(1);
				if (la1 == TT.LParen) {
					op = Match((int) TT.Not);
					var t = MatchAny();
					var end = Match((int) TT.RParen);
					// line 206
					list = AppendExprsInside(t, list);
					endIndex = end.EndIndex;
				} else {
					op = Match((int) TT.Not);
					list.Add(IdWithOptionalTypeParams(declContext));
					// line 207
					endIndex = list.Last.Range.EndIndex;
				}
			}
			// line 210
			int start = r.Range.StartIndex;
			r = F.Call(S.Of, list, start, endIndex, op.StartIndex, op.EndIndex, NodeStyle.Operator);
		}
Example #53
0
		// Block-call statement (e.g. get {...}, unroll(...) {...}) ----------------
		// Block-call statements help support properties (get/set), events (add/
		// remove) and macros. No semicolon is required at the end, and the 
		// statement cannot continue afterward (at statement level, foo {y} = z; 
		// is a syntax error since '}' marks the end of the statement.)
		// The expressions in "foo(exprs) {...}" are parsed subtly differently than
		// for "foo(exprs);" : unassigned variable declarations are allowed only in
		// the former. This enables macro syntax like "on_throw(Exception e) {...}";
		// in contrast we MUST NOT parse "Foo(Bar<T> x);" as a variable declaration.
		LNode BlockCallStmt(int startIndex)
		{
			TokenType la0;
			var id = MatchAny();
			Check(Try_BlockCallStmt_Test0(0), "Expected ( TT.LParen TT.RParen (TT.LBrace TT.RBrace | TT.Id) | TT.LBrace TT.RBrace | TT.Forward )");
			var args = new VList<LNode>();
			LNode block;
			// Line 1865: ( TT.LParen TT.RParen (BracedBlock | TT.Id => Stmt) | TT.Forward ExprStart TT.Semicolon | BracedBlock )
			la0 = LA0;
			if (la0 == TT.LParen) {
				var lp = MatchAny();
				var rp = Match((int) TT.RParen);
				// line 1865
				args = AppendExprsInside(lp, args, false, true);
				// Line 1866: (BracedBlock | TT.Id => Stmt)
				la0 = LA0;
				if (la0 == TT.LBrace)
					block = BracedBlock();
				else {
					block = Stmt();
					// line 1869
					ErrorSink.Write(Severity.Error, block, ColumnOf(block.Range.StartIndex) <= ColumnOf(id.StartIndex) ? "Probable missing semicolon before this statement." : "Probable missing braces around body of '{0}' statement.", id.Value);
				}
			} else if (la0 == TT.Forward) {
				var fwd = MatchAny();
				var e = ExprStart(true);
				Match((int) TT.Semicolon);
				// line 1876
				block = SetOperatorStyle(F.Call(fwd, e, fwd.StartIndex, e.Range.EndIndex));
			} else
				block = BracedBlock();
			// line 1880
			args.Add(block);
			var result = F.Call((Symbol) id.Value, args, id.StartIndex, block.Range.EndIndex, id.StartIndex, id.EndIndex, NodeStyle.Special);
			if (block.Calls(S.Forward, 1)) {
				result = F.Attr(_triviaForwardedProperty, result);
			}
			return result;
		}
Example #54
0
		LNode BaseListOpt()
		{
			TokenType la0;
			// Line 1525: (TT.Colon DataType (TT.Comma DataType)* | )
			la0 = LA0;
			if (la0 == TT.Colon) {
				// line 1525
				var bases = new VList<LNode>();
				Skip();
				bases.Add(DataType());
				// Line 1527: (TT.Comma DataType)*
				for (;;) {
					la0 = LA0;
					if (la0 == TT.Comma) {
						Skip();
						bases.Add(DataType());
					} else
						break;
				}
				// line 1528
				return F.List(bases);
			} else
				// line 1529
				return F.List();
		}
        /// <summary>
        /// Serialize a CustomerAndSuppliersByCity collection into a temporary file.
        /// </summary>
        private void Step_8_SerializeCollection_Generated()
        {
            string fileName = "temp_CustomerAndSuppliersByCityCollection.xml";

            VList<CustomerAndSuppliersByCity> mockCollection = new VList<CustomerAndSuppliersByCity>();
            mockCollection.Add(mock);

            XmlSerializer mySerializer = new XmlSerializer(typeof(VList<CustomerAndSuppliersByCity>));
            System.IO.StreamWriter myWriter = new System.IO.StreamWriter(fileName);
            mySerializer.Serialize(myWriter, mockCollection);
            myWriter.Close();

            System.Console.WriteLine("VList<CustomerAndSuppliersByCity> correctly serialized to a temporary file.");
        }
Example #56
0
		void ArgList(ref VList<LNode> list)
		{
			TokenType la0;
			// Line 2092: nongreedy(ExprOpt (TT.Comma ExprOpt)*)?
			la0 = LA0;
			if (la0 == EOF)
				;
			else {
				list.Add(ExprOpt(true));
				// Line 2093: (TT.Comma ExprOpt)*
				for (;;) {
					la0 = LA0;
					if (la0 == TT.Comma) {
						Skip();
						list.Add(ExprOpt(true));
					} else if (la0 == EOF)
						break;
					else {
						// line 2094
						Error("Syntax error in argument list");
						// Line 2094: (~(EOF|TT.Comma))*
						for (;;) {
							la0 = LA0;
							if (!(la0 == (TokenType) EOF || la0 == TT.Comma))
								Skip();
							else
								break;
						}
					}
				}
			}
			Skip();
		}
Example #57
0
		void ExprList(ref VList<LNode> list, bool allowTrailingComma = false, bool allowUnassignedVarDecl = false)
		{
			TokenType la0, la1;
			// Line 2082: nongreedy(ExprOpt (TT.Comma &{allowTrailingComma} EOF / TT.Comma ExprOpt)*)?
			la0 = LA0;
			if (la0 == EOF || la0 == TT.Semicolon)
				;
			else {
				list.Add(ExprOpt(allowUnassignedVarDecl));
				// Line 2083: (TT.Comma &{allowTrailingComma} EOF / TT.Comma ExprOpt)*
				for (;;) {
					la0 = LA0;
					if (la0 == TT.Comma) {
						la1 = LA(1);
						if (la1 == EOF) {
							if (allowTrailingComma) {
								Skip();
								Skip();
							} else
								goto match2;
						} else if (ExprList_set0.Contains((int) la1))
							goto match2;
						else
							goto error;
					} else if (la0 == EOF || la0 == TT.Semicolon)
						break;
					else
						goto error;
					continue;
				match2:
					{
						Skip();
						list.Add(ExprOpt(allowUnassignedVarDecl));
					}
					continue;
				error:
					{
						// line 2085
						Error("'{0}': Syntax error in expression list", CurrentTokenText());
						// Line 2085: (~(EOF|TT.Comma))*
						for (;;) {
							la0 = LA0;
							if (!(la0 == (TokenType) EOF || la0 == TT.Comma))
								Skip();
							else
								break;
						}
					}
				}
			}
		}
Example #58
0
		// try -----------------------------------------------------------------
		LNode TryStmt(int startIndex)
		{
			TokenType la0, la1;
			LNode handler = default(LNode);
			var trykw = MatchAny();
			var header = Stmt();
			// line 2039
			var parts = new VList<LNode> { 
				header
			};
			LNode varExpr;
			LNode whenExpr;
			// Line 2042: greedy(TT.Catch (TT.LParen TT.RParen / ) (&{Is($LI, _when)} TT.ContextualKeyword TT.LParen TT.RParen / ) Stmt)*
			for (;;) {
				la0 = LA0;
				if (la0 == TT.Catch) {
					var kw = MatchAny();
					// Line 2043: (TT.LParen TT.RParen / )
					la0 = LA0;
					if (la0 == TT.LParen) {
						la1 = LA(1);
						if (la1 == TT.RParen) {
							var p = MatchAny();
							Skip();
							// line 2043
							varExpr = SingleExprInside(p, "catch (...)", true);
						} else
							// line 2044
							varExpr = MissingHere();
					} else
						// line 2044
						varExpr = MissingHere();
					// Line 2045: (&{Is($LI, _when)} TT.ContextualKeyword TT.LParen TT.RParen / )
					la0 = LA0;
					if (la0 == TT.ContextualKeyword) {
						if (Is(0, _when)) {
							la1 = LA(1);
							if (la1 == TT.LParen) {
								Skip();
								var c = MatchAny();
								Match((int) TT.RParen);
								// line 2046
								whenExpr = SingleExprInside(c, "when (...)");
							} else
								// line 2047
								whenExpr = MissingHere();
						} else
							// line 2047
							whenExpr = MissingHere();
					} else
						// line 2047
						whenExpr = MissingHere();
					handler = Stmt();
					// line 2049
					parts.Add(F.Call(kw, LNode.List(varExpr, whenExpr, handler), kw.StartIndex, handler.Range.EndIndex));
				} else
					break;
			}
			// Line 2052: greedy(TT.Finally Stmt)*
			for (;;) {
				la0 = LA0;
				if (la0 == TT.Finally) {
					var kw = MatchAny();
					handler = Stmt();
					// line 2053
					parts.Add(F.Call(kw, handler, kw.StartIndex, handler.Range.EndIndex));
				} else
					break;
			}
			// line 2056
			var result = F.Call(trykw, parts, startIndex, parts.Last.Range.EndIndex);
			if (parts.Count == 1) {
				Error(result, "'try': At least one 'catch' or 'finally' clause is required");
			}
			return result;
		}
Example #59
0
		void StmtList(ref VList<LNode> list)
		{
			TokenType la0;
			// Line 2122: (~(EOF) => Stmt)*
			for (;;) {
				la0 = LA0;
				if (la0 != (TokenType) EOF)
					list.Add(Stmt());
				else
					break;
			}
			Skip();
		}
Example #60
0
		LNode UsingDirective(int startIndex, VList<LNode> attrs)
		{
			TokenType la0;
			Token end = default(Token);
			LNode nsName = default(LNode);
			Token static_ = default(Token);
			Token t = default(Token);
			t = Match((int) TT.Using);
			// Line 1480: (&{Is($LI, S.Static)} TT.AttrKeyword ExprStart TT.Semicolon / ExprStart (&{nsName.Calls(S.Assign, 2)} RestOfAlias / TT.Semicolon))
			do {
				la0 = LA0;
				if (la0 == TT.AttrKeyword) {
					if (Is(0, S.Static)) {
						static_ = MatchAny();
						nsName = ExprStart(true);
						end = Match((int) TT.Semicolon);
						// line 1482
						attrs.Add(F.Id(static_));
					} else
						goto matchExprStart;
				} else
					goto matchExprStart;
				break;
			matchExprStart:
				{
					nsName = ExprStart(true);
					// Line 1485: (&{nsName.Calls(S.Assign, 2)} RestOfAlias / TT.Semicolon)
					do {
						switch (LA0) {
						case TT.Semicolon:
							{
								if (nsName.Calls(S.Assign, 2))
									goto matchRestOfAlias;
								else
									end = MatchAny();
							}
							break;
						case TT.Colon: case TT.ContextualKeyword: case TT.LBrace:
							goto matchRestOfAlias;
						default:
							{
								// line 1491
								Error("Expected ';'");
							}
							break;
						}
						break;
					matchRestOfAlias:
						{
							Check(nsName.Calls(S.Assign, 2), "Expected nsName.Calls(S.Assign, 2)");
							LNode aliasedType = nsName.Args[1, F.Missing];
							nsName = nsName.Args[0, F.Missing];
							var r = RestOfAlias(startIndex, t, aliasedType, nsName);
							// line 1489
							return r.WithAttrs(attrs).PlusAttr(_filePrivate);
						}
					} while (false);
				}
			} while (false);
			// line 1494
			return F.Call(S.Import, nsName, t.StartIndex, end.EndIndex, t.StartIndex, t.EndIndex).WithAttrs(attrs);
		}