public static JobReferenceCollection Populate(DataTable collectionMembers)
        {
            JobReferenceCollection colReferences = new JobReferenceCollection();

            foreach (DataRow drMember in collectionMembers.Rows)
            {
                colReferences.Add(JobReference.Create(drMember));
            }
            return colReferences;
        }
        public static JobReferenceCollection GetJobReferences(Customer customer)
        {
            JobReferenceCollection references = new JobReferenceCollection();
            DataTable dtResults = null;
            FinalBuild.DataAccess objADO = Domain.GetADOInstance();
            System.Data.SqlClient.SqlParameter[] arrParameters;
            System.Collections.ArrayList colParameters = new System.Collections.ArrayList();
            string strStoredProcedure = "selJobReferencesByCustomer";

            // Assemble Parameters
            colParameters.Add(new SqlParameter("@CustomerID", customer.ID));
            // colParameters.Add(new SqlParameter("@ParentCustomerID", customer.ParentCustomerID));
            arrParameters = (SqlParameter[])colParameters.ToArray(typeof(SqlParameter));

            dtResults = objADO.GetDataTable(strStoredProcedure, "JobReferences", arrParameters);
            for (int index = 0; index < dtResults.Rows.Count; index++)
            {
                references.Add(new JobReference());
                references[index].SourceID = dtResults.Rows[index]["WMSourceID"].ToString();
                references[index].ID = int.Parse(references[index].SourceID);
                references[index].Region = dtResults.Rows[index]["PostCode"].ToString();
            }

            return references;
        }
Example #3
0
        public void Populate(DataSet jobReferences)
        {
            // Note. Ordering of return sets to match FieldData SP selUserWork

            if (jobReferences != null && jobReferences.Tables.Count > 0)
            {
                // New
                if (jobReferences.Tables[0].Rows.Count > 0)
                {
                    mColNew = new JobReferenceCollection();
                    foreach (DataRow drJob in jobReferences.Tables[0].Rows)
                    {
                        mColNew.Add(JobReference.Create(drJob,true));
                    }
                }
                // Removed
                if (jobReferences.Tables.Count > 1 && jobReferences.Tables[1].Rows.Count > 0)
                {
                    mColRemoved = new JobReferenceCollection();
                    foreach (DataRow drJob in jobReferences.Tables[1].Rows)
                    {
                        mColRemoved.Add(JobReference.Create(drJob, true)); 
                    }
                }
                // Modified
                if (jobReferences.Tables.Count > 2 && jobReferences.Tables[2].Rows.Count > 0)
                {
                    mColModified = new JobReferenceCollection();
                    foreach (DataRow drJob in jobReferences.Tables[2].Rows)
                    {
                        mColModified.Add(JobReference.Create(drJob, true));
                    }
				}
				// Supporing Data
				if (jobReferences.Tables.Count > 3 && jobReferences.Tables[3].Rows.Count > 0)
				{
					mColSupportingDataRequests = SupportingDataRequestCollection.Populate(jobReferences.Tables[3]);
				}
				
            }
        }