예제 #1
0
        //Retrieves a list of CallViewModels based on a list of all Calls in the database
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> allVms = new List <CallViewModel>();

            try
            {
                //Get a list of all the calls and use each call in that list to create a view model and then return the list of view model objects
                List <Call> allCalls = _model.GetAll();
                foreach (Call call in allCalls)
                {
                    CallViewModel cvm = new CallViewModel();
                    cvm.Id = call.Id;
                    //Sub properties
                    cvm.EmployeeName       = call.Employee.LastName;
                    cvm.ProblemDescription = call.Problem.Description;
                    cvm.TechName           = call.Employee1.LastName;

                    cvm.EmployeeId = call.EmployeeId;
                    cvm.ProblemId  = call.ProblemId;
                    cvm.TechId     = call.TechId;
                    cvm.DateOpened = call.DateOpened;
                    cvm.DateClosed = call.DateClosed;
                    cvm.OpenStatus = call.OpenStatus;
                    cvm.Notes      = call.Notes;
                    cvm.Timer      = Convert.ToBase64String(call.Timer);
                    allVms.Add(cvm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
            return(allVms);
        }//end getAll
예제 #2
0
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> viewModels = new List <CallViewModel>();

            try
            {
                List <Call> calls = _dao.GetAll();

                foreach (Call c in calls)
                {
                    //return only fields for display, subsequent get wil other fields
                    CallViewModel viewModel = new CallViewModel();
                    viewModel.Id         = c._id.ToString();
                    viewModel.DateOpened = c.DateOpened;
                    viewModel.EmployeeId = c.EmployeeId.ToString();
                    viewModel.ProblemId  = c.ProblemId.ToString();

                    viewModels.Add(viewModel); //add to list
                }
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "CallViewModel", "GetAll");
            }
            return(viewModels);
        }
예제 #3
0
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> allVms = new List <CallViewModel>();

            try
            {
                List <Call> allCalls = _model.GetAll();

                foreach (Call call in allCalls)
                {
                    CallViewModel callVm = new CallViewModel();
                    callVm.Id         = call.Id;
                    callVm.EmployeeId = call.EmployeeId;
                    callVm.ProblemId  = call.ProblemId;
                    callVm.DateOpened = call.DateOpened;
                    callVm.DateClosed = call.DateClosed;
                    callVm.OpenStatus = call.OpenStatus;
                    callVm.TechId     = call.TechId;
                    callVm.Notes      = call.Notes;
                    callVm.Timer      = Convert.ToBase64String(call.Timer);
                    callVm.Problem    = call.Problem.Description;
                    callVm.Employee   = call.Employee.FirstName + " " + call.Employee.LastName;
                    callVm.Tech       = call.Employee1.FirstName + " " + call.Employee1.LastName;
                    allVms.Add(callVm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " +
                                  MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
            return(allVms);
        }
예제 #4
0
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> viewModels = new List <CallViewModel>();

            try
            {
                List <Call> Calls = _dao.GetAll();
                foreach (Call c in Calls)
                {
                    CallViewModel viewModel = new CallViewModel();
                    viewModel.DateClosed = c.DateClosed;
                    viewModel.DateOpened = c.DateOpened;
                    viewModel.TechId     = c.GetTechIdAsString();
                    viewModel.ProblemId  = c.GetProblemIdAsString();
                    viewModel.EmployeeId = c.GetEmployeeIdAsString();
                    viewModel.Id         = c.GetIdAsString();
                    viewModel.OpenStatus = c.OpenStatus;
                    viewModel.Notes      = c.Notes;
                    viewModel.Version    = c.Version;
                    viewModel.GetEmpInfo();
                    viewModels.Add(viewModel);
                }
            }
            catch (Exception ex)
            {
                DALUtils.ErrorRoutine(ex, "CallViewModel", "GetAll");
            }
            return(viewModels);
        }
예제 #5
0
        // select all the calls
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> allVms = new List <CallViewModel>();

            try
            {
                List <Calls> allCalls = _model.GetAll();
                foreach (Calls c in allCalls)
                {
                    CallViewModel     cVm = new CallViewModel();
                    EmployeeViewModel evm = new EmployeeViewModel();
                    ProblemViewModel  pvm = new ProblemViewModel();

                    cVm.Id         = c.Id;
                    cVm.EmployeeId = c.EmployeeId;
                    cVm.ProblemId  = c.ProblemId;
                    cVm.TechId     = c.TechId;
                    cVm.DateOpened = c.DateOpened;
                    cVm.DateClosed = c.DateClosed;
                    cVm.OpenStatus = c.OpenStatus;
                    cVm.Notes      = c.Notes;
                    cVm.Timer      = Convert.ToBase64String(c.Timer);

                    evm.Id = c.EmployeeId;
                    evm.GetById();
                    cVm.EmployeeName = evm.Lastname;

                    evm.Id = c.TechId;
                    evm.GetById();
                    cVm.TechName = evm.Lastname;

                    pvm.Id = c.ProblemId;
                    pvm.GetById();
                    cVm.ProblemDescription = pvm.Description;

                    allVms.Add(cVm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }

            return(allVms);
        }
예제 #6
0
        // Retrieve all the EmployeeViewModel objects and add them to a List
        public List <CallViewModel> GetAll()
        {
            // Create a list to hold the EmployeeViewModel objects
            List <CallViewModel> allVms = new List <CallViewModel>();

            try
            {
                // Create the List to hold the Employee objects. Uses the GetAll()
                // from the EmployeeModel class to populate this List
                List <Call> allCalls = _model.GetAll();

                // For each Employee in the allEmployees List create a view model for them and
                // then add them to the List of Employee objects
                foreach (Call call in allCalls)
                {
                    CallViewModel callVm = new CallViewModel();
                    callVm.Id         = call.Id;
                    callVm.EmployeeId = call.EmployeeId;
                    callVm.ProblemId  = call.ProblemId;
                    callVm.TechId     = call.TechId;
                    callVm.DateOpened = call.DateOpened;
                    callVm.DateClosed = call.DateClosed;
                    callVm.OpenStatus = call.OpenStatus;
                    callVm.Notes      = call.Notes;
                    callVm.Timer      = Convert.ToBase64String(call.Timer);

                    callVm.EmployeeName       = call.Employee.FirstName + " " + call.Employee.LastName;
                    callVm.TechName           = call.Employee1.FirstName + " " + call.Employee1.LastName;
                    callVm.ProblemDescription = call.Problem.Description;

                    allVms.Add(callVm);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " +
                                  MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }

            // Return the List of EmployeeViewModel objects
            return(allVms);
        }
예제 #7
0
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> callViewModelList = new List <CallViewModel>();

            try
            {
                List <Call> calls = _dao.GetAll();

                foreach (var call in calls)
                {
                    CallViewModel cVM      = new CallViewModel();
                    Employee      emp      = new EmployeeDAO().GetById(call.GetEmployeeIdAsString());
                    Problem       prob     = new ProblemDAO().GetByProblemId(call.GetProblemIdAsString());
                    Employee      techName = new EmployeeDAO().GetById(call.GetTechIdAsString());
                    cVM.Id = call.GetIdAsString();
                    cVM.ProblemDescription = prob.Description;
                    cVM.EmployeeName       = emp.Lastname;
                    cVM.EmployeeId         = call.GetEmployeeIdAsString();
                    cVM.ProblemId          = call.GetProblemIdAsString();
                    cVM.TechId             = call.GetTechIdAsString();
                    cVM.TechName           = techName.Lastname;
                    cVM.DateOpened         = call.DateOpened;
                    cVM.DateClosed         = call.DateClosed;
                    cVM.OpenStatus         = call.OpenStatus;
                    cVM.Notes   = call.Notes;
                    cVM.Version = call.Version;
                    callViewModelList.Add(cVM);
                }
            }
            catch (Exception ex)
            {
                ViewModelUtils.ErrorRoutine(ex, "CallViewModel", "GetAll");
            }

            return(callViewModelList);
        }
예제 #8
0
        //Retrive all the calls
        public List <CallViewModel> GetAll()
        {
            List <CallViewModel> allCalls = new List <CallViewModel>();

            try
            {
                List <Call> allCal = _model.GetAll();
                foreach (Call ca in allCal)
                {
                    CallViewModel cal = new CallViewModel();
                    EmployeeModel emp = new EmployeeModel();
                    Employee      em  = emp.GetById(ca.EmployeeId);
                    ProblemModel  pro = new ProblemModel();
                    Problem       pr  = pro.GetById(ca.ProblemId);
                    cal.Id                 = ca.Id;
                    cal.EmployeeId         = ca.EmployeeId;
                    cal.EmployeeName       = em.LastName;
                    cal.TechId             = ca.TechId;
                    cal.ProblemId          = ca.ProblemId;
                    cal.ProblemDescription = pr.Description;
                    cal.OpenStatus         = ca.OpenStatus;
                    cal.Notes              = ca.Notes;
                    cal.DateOpened         = ca.DateOpened;
                    cal.DateClosed         = ca.DateClosed;
                    cal.Timer              = Convert.ToBase64String(ca.Timer);
                    allCalls.Add(cal);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }

            return(allCalls);
        }