Ejemplo n.º 1
0
        public Response<Application> GetApplication(int appID)
        {
            var response = new Response<Application>();

            try
            {
                var application = _repo.LoadApplication(appID);

                if(application == null)
                {
                    response.Success = false;
                    response.Message = "Application was not found...";
                }
                else
                {
                    response.Success = true;
                    response.Data = application;
                }
            }
            catch(Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 2
0
        public Response<Policy> CreatePolicy(Policy newPolicy)
        {
            var response = new Response<Policy>();

            try
            {
                var allPolicies = _repo.GetAllPolicies(newPolicy);

                int LatestPolicyNumber = allPolicies.Select(a => a.PolicyID).LastOrDefault();
                newPolicy.PolicyID = LatestPolicyNumber + 1;

                response.Data = new Policy();
                response.Data.Category = newPolicy.Category;
                response.Data.PolicyTitle = newPolicy.PolicyTitle;
                response.Data.PolicyDescription = newPolicy.PolicyDescription;
                response.Data.PolicyID = newPolicy.PolicyID;

                response.Success = true;
                _repo.CreatePolicy(newPolicy);
                response.Message = "Application was created.";
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 3
0
        public Response<Application> CreateApplication(Application newApplication)
        {
            var response = new Response<Application>();

            try
            {
                var allApplications = _repo.GetAllApplications();

                int LatestAppNumber = allApplications.Select(a => a.AppID).LastOrDefault();
                newApplication.AppID = LatestAppNumber + 1;

                response.Data = new Application();
                response.Data.FirstName = newApplication.FirstName;
                response.Data.LastName = newApplication.LastName;
                response.Data.Address = newApplication.Address;
                response.Data.PhoneNumber = newApplication.PhoneNumber;
                response.Data.City = newApplication.City;
                response.Data.State = newApplication.State;
                response.Data.Zip = newApplication.Zip;
                response.Data.AppID = newApplication.AppID;
                response.Data.JobHistory = newApplication.JobHistory;

                response.Success = true;
                _repo.CreateApplication(newApplication);
                response.Message = "Application was created.";
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 4
0
        public Response<Time> GetTimes(int EmpID)
        {
            var response = new Response<Time>();

            try
            {
                var time = _repo.LoadTimes(EmpID);

                if (time == null)
                {
                    response.Success = false;
                    response.Message = "Time was not found...";
                }
                else
                {
                    response.Success = true;
                    response.Data = time;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 5
0
        public Response<Time> CreateTime(Time newTime)
        {
            var response = new Response<Time>();

            try
            {
                var allTimes = _repo.GetAllTimes();

                int LastestTimeNumber = allTimes.Select(a => a.EmpID).LastOrDefault();
                newTime.EmpID = LastestTimeNumber + 1;

                response.Data = new Time();
                response.Data.EmpID = newTime.EmpID;
                response.Data.FirstName = newTime.FirstName;
                response.Data.LastName = newTime.LastName;
                response.Data.Date = newTime.Date;
                response.Data.HoursWorked = newTime.HoursWorked;

                response.Success = true;
                _repo.CreateTime(newTime);
                response.Message = "Time was created.";
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 6
0
        public Response<Policy> DeletePolicy(Policy PolicyToDelete)
        {
            var response = new Response<Policy>();

            try
            {
                _repo.DeletePolicy(PolicyToDelete);

                response.Success = true;
                response.Message = "You have successfully deleted the policy";

            }
            catch(Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;

            }
            return response;
        }
Ejemplo n.º 7
0
 public RepoOperations()
 {
     //_repo = Factory.CreateRepository();
     _response = new Response();
 }
Ejemplo n.º 8
0
        public Response<List<Application>> LoadAllApplications()
        {
            var response = new Response<List<Application>>();

            try
            {
                response.Data = _repo.GetAllApplications();
                response.Message = "Success";
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 9
0
        public Response<Policy> GetPolicies(Policy p)
        {
            var response = new Response<Policy>();

            try
            {
                var policy = _repo.LoadPolicies(p);

                if (policy == null)
                {
                    response.Success = false;
                    response.Message = "Policy was not found...";
                }
                else
                {
                    response.Success = true;
                    response.Data = policy;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 10
0
        public Response<List<Policy>> LoadAllPolicies(Policy p)
        {
            var response = new Response<List<Policy>>();

            try
            {
                response.Data = _repo.GetAllPolicies(p);
                response.Message = "Success";
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 11
0
        public Response<Policy> GetPolicy(Policy policy)
        {
            var response = new Response<Policy>();

            try
            {
                response.Data = _repo.GetPolicy(policy);

                response.Success = true;
                response.Message = "you have successfully gotten the policy.";
            }
            catch(Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }
Ejemplo n.º 12
0
        public Response<Time> UpdateTime(Time time)
        {
            var response = new Response<Time>();

            try
            {
                _repo.UpdateTime(time);

                response.Success = true;
                response.Message = "Successfully updated your account!";
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return response;
        }