private static AssignmentDetailsCollection Populate(DataTable collectionMembers) { AssignmentDetailsCollection colMembers = new AssignmentDetailsCollection(); AssignmentDetails obj = null; foreach (DataRow drMember in collectionMembers.Rows) { obj = new AssignmentDetails(); obj.ID = (int)drMember["WMSourceID"]; obj.InstanceNumber = (int)drMember["JobInstanceNumber"]; obj.Workers = new WorkerCollection(); Worker objWorker = new Worker(); objWorker.UserID = drMember["UserID"].ToString(); obj.Workers.Add(objWorker); obj.DueDate = (DateTime)drMember["DateChangeDetected"]; colMembers.Add(obj); } return colMembers; }
public static WorkerCollection GetSiteContacts() { DataTable dtResults = null; FinalBuild.DataAccess objADO = Domain.GetADOInstance(Domain.eConnectionName.Metadata); string strStoredProcedure = "selHansenSiteContacts"; dtResults = objADO.GetDataTable(strStoredProcedure, "SiteContacts"); Worker objWorker; WorkerCollection colMembers = new WorkerCollection(); foreach (DataRow drMember in dtResults.Rows) { objWorker = new Worker(); objWorker.LoginName = drMember["NTLoginID"].ToString(); if (drMember["EmpSurname"] != System.DBNull.Value) { objWorker.Surname = drMember["EmpSurname"].ToString(); } if (drMember["EmpForenames"] != System.DBNull.Value) { objWorker.Forenames = drMember["EmpForenames"].ToString(); } if (drMember["EmpNo"] != System.DBNull.Value) { objWorker.EmpNo = drMember["EmpNo"].ToString(); } colMembers.Add(objWorker); } return colMembers; }
public static WorkerCollection Populate(DataTable collectionMembers) { WorkerCollection colMembers = new WorkerCollection(); Worker objWorker = null; foreach (DataRow drMember in collectionMembers.Rows) { objWorker = new Worker(); objWorker.LoginName = drMember["ADLoginID"].ToString(); objWorker.UserID = objWorker.LoginName; objWorker.EmpNo = drMember["EmployeeNo"].ToString(); if (drMember["Surname"] != System.DBNull.Value) { objWorker.Surname = drMember["Surname"].ToString(); } if (drMember["Forenames"] != System.DBNull.Value) { objWorker.Forenames = drMember["Forenames"].ToString(); } if (drMember["PreferredName"] != System.DBNull.Value) { objWorker.EmpPrefname = drMember["PreferredName"].ToString(); } else { objWorker.EmpPrefname = objWorker.Forenames; } /* if (drMember["EmpAddress"] != System.DBNull.Value) { objWorker.EmpAddress = drMember["EmpAddress"].ToString(); } else { */ objWorker.EmpAddress = string.Empty; /* } */ if (!drMember["EmailAddress"].Equals(DBNull.Value)) { objWorker.Email = drMember["EmailAddress"].ToString(); } if (!drMember["MobileNumber"].Equals(DBNull.Value)) { objWorker.MobileNo = drMember["MobileNumber"].ToString(); } // Add to Collection colMembers.Add(objWorker); } return colMembers; }