示例#1
0
        public List <ServiceRequest> Read()
        {
            DataHandler dh = new DataHandler();

            List <ServiceRequest> serviceRequests = new List <ServiceRequest>();


            string query = "SELECT S.ServiceRequestID, S.description, S.jobStarted, R.ClientID, R.contactNum, R.dateCreated, R.dateResolved, R.status, CL.CallID, CL.timeStarted, CL.timeEnded, CL.AgentID, CL.incoming " +
                           "FROM dbo.ServiceRequest AS S " +
                           "LEFT JOIN dbo.Request AS R ON R.RequestID = S.ServiceRequestID " +
                           "LEFT JOIN dbo.CallLog AS CL ON CL.CallID = R.CallID";


            SqlDataReader     read = dh.Select(query);
            ServiceRequest    serviceRequest;
            CallLogController callLogController = new CallLogController();

            if (read.HasRows)
            {
                while (read.Read())
                {
                    CallLog callLog = new CallLog(
                        read.GetDateTime(9),
                        read.GetDateTime(10),
                        // 11 is CallLog.AgentID
                        read.GetBoolean(12)
                        );

                    callLog.Id = read.GetInt32(8);

                    serviceRequest = new ServiceRequest(
                        read.GetDateTime(5),
                        read.GetDateTime(6),
                        callLog,
                        read.GetString(1)
                        );

                    serviceRequest.JobStarted = read.GetDateTime(2);


                    serviceRequest.Id         = read.GetInt32(0);
                    serviceRequest.ContactNum = read.GetString(4);
                    serviceRequest.Status     = read.GetString(7);

                    serviceRequests.Add(serviceRequest);
                }
            }
            dh.Dispose();

            return(serviceRequests);
        }
示例#2
0
        public List <ComplaintRequest> Read()
        {
            DataHandler dh = new DataHandler();

            List <ComplaintRequest> complaintRequests = new List <ComplaintRequest>();

            string query = "SELECT C.ComplaintRequestID, C.description, R.ClientID, R.contactNum, R.dateCreated, R.dateResolved, R.status, CL.CallID, CL.timeStarted, CL.timeEnded, CL.AgentID, CL.incoming " +
                           "FROM dbo.ComplaintRequest AS C " +
                           "LEFT JOIN dbo.Request AS R ON R.RequestID = C.ComplaintRequestID " +
                           "LEFT JOIN dbo.CallLog AS CL ON CL.CallID = R.CallID";

            SqlDataReader     read = dh.Select(query);
            ComplaintRequest  complaintRequest;
            CallLogController callLogController = new CallLogController();

            if (read.HasRows)
            {
                while (read.Read())
                {
                    CallLog callLog = new CallLog(
                        read.GetDateTime(8),
                        read.GetDateTime(9),
                        //read agent ID(10)???
                        read.GetBoolean(11)
                        );

                    callLog.Id = read.GetInt32(7);

                    complaintRequest = new ComplaintRequest(
                        read.GetDateTime(4),
                        read.GetDateTime(5),
                        callLog,
                        read.GetString(1)
                        );


                    complaintRequest.Id = read.GetInt32(0);
                    // newClientRequest.client = ClientController.ReadSpecific(read.GetInt32(1));
                    complaintRequest.ContactNum = read.GetString(3);
                    complaintRequest.Status     = read.GetString(6);

                    complaintRequests.Add(complaintRequest);
                }
            }
            dh.Dispose();
            return(complaintRequests);
        }
示例#3
0
        public List <NewClientRequest> Read()
        {
            DataHandler dh = new DataHandler();

            List <NewClientRequest> clientRequests = new List <NewClientRequest>();
            SqlDataReader           read           = dh.Select("SELECT C.NewClientRequestID, R.ClientID, R.contactNum, R.dateCreated, R.dateResolved, R.status, CL.CallID, CL.timeStarted, CL.timeEnded, CL.AgentID, CL.incoming FROM dbo.NewClientRequest AS C LEFT JOIN dbo.Request AS R ON R.RequestID = C.NewClientRequestID LEFT JOIN dbo.CallLog AS CL ON CL.CallID = R.CallID");
            NewClientRequest        newClientRequest;
            CallLogController       callLogController = new CallLogController();

            if (read.HasRows)
            {
                while (read.Read())
                {
                    CallLog callLog = new CallLog(
                        read.GetDateTime(7),
                        read.GetDateTime(8),
                        //read agent ID(9)???
                        read.GetBoolean(10)
                        );

                    callLog.Id = read.GetInt32(6);

                    newClientRequest = new NewClientRequest(
                        read.GetDateTime(3),
                        read.GetDateTime(4),
                        callLog
                        );


                    newClientRequest.Id = read.GetInt32(0);
                    // newClientRequest.client = ClientController.ReadSpecific(read.GetInt32(1));
                    newClientRequest.ContactNum = read.GetString(2);
                    newClientRequest.Status     = read.GetString(5);

                    clientRequests.Add(newClientRequest);
                }
            }

            dh.Dispose();

            return(clientRequests);
        }