示例#1
0
        public async Task <ActionResult> GetRequestPDF(RequestDetails requestInfo)
        {
            try
            {
                //Assign UI synch request details to SynchRequestDTO model
                SynchRequestDTO syncRequest = requestInfo.syncRequest;
                //Assign user id to SynchRequestDTO model
                syncRequest.userId = userid;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //Get pdf uri details from Synch API
                string strpdfuri = await apiControllerObj.GetPDFUri(syncRequest, requestInfo.requestID);

                if (!string.IsNullOrEmpty(strpdfuri))
                {
                    string pdfuri = JsonConvert.DeserializeObject <string>(strpdfuri);
                    // Return Json formate object and pass to UI
                    return(Json(new Uri(pdfuri), JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(string.Empty, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#2
0
        public async Task <ActionResult> ForceUpdate(SynchRequestDTO syncRequest)
        {
            try
            {
                //Assign user id to SynchRequestDTO model
                syncRequest.userId = userid;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //string stApprovalrequestcount = await apiControllerObj.GetApprovalrequestcount(syncRequest, userid);
                //do force update from Synch API
                string forceUpdateResponse = await apiControllerObj.ForceUpdate(syncRequest, userid);

                //Deseralize the result returned by the API;
                //  UserTaskcountJsonData userTaskPendingResponse = JsonConvert.DeserializeObject<UserTaskcountJsonData>(stApprovalPendingCount);
                SynchTimeResponseDTO syncResponse = JsonConvert.DeserializeObject <SynchTimeResponseDTO>(forceUpdateResponse);

                ////creates list Backend model object
                //List<string> userBackends = new List<string>();
                //userBackends = syncRequest.parameters.filters.backends;
                //List<string> userBackendName = syncRequest.parameters.filters.backendName;
                ////creates lists for Pending/Approval/Reject Count for json object result
                //List<UserTaskcountJsonResult> userTaskPendingCount = userTaskPendingResponse.userTaskcountJsonResult;

                //List<ApprovalCountDTO> approvalCountobj = new List<ApprovalCountDTO>();

                // Return Json formate object and pass to UI
                return(Json(syncResponse, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#3
0
        public async Task <ActionResult> UpdateUser(UserDTO userinfo)
        {
            try
            {
                //Api Controller object initialization
                PersonalizationRequsetDTO Personalization = new PersonalizationRequsetDTO();
                userinfo.UserID = userid;
                //creates list user backend dto object
                List <UserBackendDTO> lstuserbackend        = new List <UserBackendDTO>(userinfo.userbackends);
                List <UserBackendDTO> lstupdateduserbackend = new List <Models.UserBackendDTO>();
                //Iterate user Backend json format result and add UserID
                foreach (UserBackendDTO Objuserbackend in lstuserbackend)
                {
                    Objuserbackend.UserID = userid;
                    lstupdateduserbackend.Add(Objuserbackend);
                }
                //creates list user Devices dto object
                List <UserDeviceDTO> lstuserdevices        = new List <UserDeviceDTO>(userinfo.userdevices);
                List <UserDeviceDTO> lstupdateduserdevices = new List <Models.UserDeviceDTO>();
                //Iterate user Backend json format result and add UserID
                foreach (UserDeviceDTO Objuserdevices in lstuserdevices)
                {
                    Objuserdevices.UserID = userid;
                    lstupdateduserdevices.Add(Objuserdevices);
                }
                //Get user info details
                userinfo.userbackends        = lstupdateduserbackend;
                userinfo.userdevices         = lstupdateduserdevices;
                Personalization.user         = userinfo;
                Personalization.userbackends = null;
                Personalization.userdevices  = null;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //Seralize the  User details result into json
                //string ModelSerialize = JsonConvert.SerializeObject(userinfo);
                var updateResponse = await apiControllerObj.SaveUserinfo(Personalization, userid);

                if (updateResponse != "OK")
                {
                    LoggerHelper.WriteToLog(" Error while creating client context in UpdateUser method");
                    return(View("Error"));
                }
                // Return Json Formate object and pass to UI
                return(Json(updateResponse, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#4
0
        //Gets the Avaliable backend deatils returned by Personalization API
        public async Task <List <UserBackendDTO> > BackEndInfo()
        {
            //creates list Backend model object
            List <UserBackendDTO> backends = new List <UserBackendDTO>();

            try
            {
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //Gets the List of backends returned by the Personalization API
                string strbackEndApp = await apiControllerObj.Getbackendapplications();

                if (!string.IsNullOrEmpty(strbackEndApp))
                {
                    //Deseralize the result returned by the API
                    BackendJsonData backendjsonResponse = JsonConvert.DeserializeObject <BackendJsonData>(strbackEndApp);
                    //Checks whether the JSON response is not null
                    if (backendjsonResponse != null)
                    {
                        //Iterate backend json format result and bind to Model
                        foreach (BackendJsonResult backendid in backendjsonResponse.Results)
                        {
                            //Create  UserBackendDTO Model object
                            UserBackendDTO BackendObj = new UserBackendDTO();
                            BackendObj.backend = new BackendDTO();
                            //Get Backend id
                            BackendObj.backend.BackendID   = backendid.BackendID;
                            BackendObj.backend.BackendName = backendid.BackendName;
                            //Adding the Model object to the list
                            backends.Add(BackendObj);
                        }
                    }
                }
                //Return list of backends
                return(backends);
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new DataAccessException("Error in BackEndInfo");
            }
        }
示例#5
0
        public async Task <ActionResult> SendApprovalstatus(ApprovalQuery approvalInfo)
        {
            try
            {
                approvalInfo.UserID = userid;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //Send approval details to Approval API
                string stApprovalrequeststatus = await apiControllerObj.SendApprovalInfo(approvalInfo, approvalInfo.ApprovalRequestID);

                //creates list request details object
                List <ApprovalRequestDTO> requestsDetails = new List <ApprovalRequestDTO>();
                // Return Json Formate object and pass to UI
                return(Json(requestsDetails, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#6
0
        public async Task <ActionResult> GetRequestDetails(RequestDetails requestInfo)
        {
            try
            {
                //Assign UI synch request details to SynchRequestDTO model
                SynchRequestDTO syncRequest = requestInfo.syncRequest;
                //Assign user id to SynchRequestDTO model
                syncRequest.userId = userid;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //Get request details from Synch API
                string stApprovalrequest = await apiControllerObj.GetRequestInfo(syncRequest, requestInfo.requestID);

                //Get Approval List details from Synch API
                string strApproverList = await apiControllerObj.GetApprovers(syncRequest, requestInfo.requestID);

                //Deseralize the result returned by the API
                UserRequestJsonData  userBackendjsonResponse  = JsonConvert.DeserializeObject <UserRequestJsonData>(stApprovalrequest);
                UserApprovalJsonData userApprovaljsonResponse = JsonConvert.DeserializeObject <UserApprovalJsonData>(strApproverList);
                //creates list request details object
                List <ApprovalRequestDTO> requestsDetails = new List <ApprovalRequestDTO>();
                //Checks whether the JSON response is not null
                if (userBackendjsonResponse != null && userApprovaljsonResponse != null)
                {
                    //Create ApprovalRequestDTO Model object
                    ApprovalRequestDTO requestObj = new ApprovalRequestDTO();
                    //Iterate json format result and bind to Model
                    foreach (userBackendRequest userbackendRequestdetails in userBackendjsonResponse.userBackendRequestinfo)
                    {
                        //Create ApprovalDTO Model object
                        requestObj.approval = new ApprovalDTO();
                        //Create RequestDTO Model object
                        requestObj.request = new RequestDTO();
                        if (userbackendRequestdetails.requestDetails != null)
                        {
                            //Get Request ID from Json reuslt
                            requestObj.request.ID = userbackendRequestdetails.requestDetails.ID;
                            //Get Request Title from Json reuslt
                            requestObj.request.Title = userbackendRequestdetails.requestDetails.Title;
                            //Get Request Status from Json reuslt
                            requestObj.request.Status = userbackendRequestdetails.requestDetails.Status;
                            //Get Request Created from Json reuslt
                            DateTime?created = userbackendRequestdetails.requestDetails.Created;
                            if (created != null)
                            {
                                requestObj.request.Created = created.Value;
                            }
                            //Get Request Requester details from Json reuslt
                            requestObj.request.Requester = new RequesterDTO();
                            //Get Requester UserID from Json reuslt
                            if (requestObj.request.Requester.UserID == null)
                            {
                                requestObj.request.Requester.UserID = userbackendRequestdetails.requestDetails.Requester.UserID;
                            }
                            //Get Requester UserID from Json reuslt
                            if (requestObj.request.Requester.Name == null)
                            {
                                requestObj.request.Requester.Name = userbackendRequestdetails.requestDetails.Requester.Name;
                            }
                            //Creates list request fields object
                            List <FieldDTO> requestFields = new List <FieldDTO>();
                            //Checks whether the JSON response is not null
                            if (userbackendRequestdetails.requestDetails.Fields.Overview != null && userbackendRequestdetails.requestDetails.Fields.Overview.Count > 0)
                            {
                                //Iterate json format result and bind to Model
                                foreach (FieldDTO field in userbackendRequestdetails.requestDetails.Fields.Overview)
                                {
                                    //Create FieldDTO Model object for Overview fields
                                    FieldDTO overviewFields = new FieldDTO();
                                    //Get Overview fields Name from Json reuslt
                                    overviewFields.Name = field.Name;
                                    //Get Overview fields Value from Json reuslt
                                    overviewFields.Value = field.Value;
                                    //Get Overview fields Group from Json reuslt
                                    overviewFields.Group = field.Group;
                                    //Add to FieldDTO Model object
                                    requestFields.Add(overviewFields);
                                }
                            }
                            //Checks whether the JSON response is not null
                            if (userbackendRequestdetails.requestDetails.Fields.GenericInfo != null && userbackendRequestdetails.requestDetails.Fields.Overview.Count > 0)
                            {
                                //Iterate json format result and bind to Model
                                foreach (FieldDTO field in userbackendRequestdetails.requestDetails.Fields.GenericInfo)
                                {
                                    //Create FieldDTO Model object for Generic fields
                                    FieldDTO genericInfoFields = new FieldDTO();
                                    //Get Generic fields Name/Value pair from Json reuslt
                                    genericInfoFields.Name  = field.Name;
                                    genericInfoFields.Value = field.Value;
                                    //Get Generic fields Group from Json reuslt
                                    genericInfoFields.Group = field.Group;
                                    //Add to FieldDTO Model object
                                    requestFields.Add(genericInfoFields);
                                }
                            }
                            //Creates list approval list object
                            List <Approvers> approverList = new List <Approvers>();
                            //Iterate json format result and bind to Model
                            foreach (ApproversJson userApprovalJsondetails in userApprovaljsonResponse.userApprovalinfo)
                            {
                                //Create Approvers Model object for Approval details
                                Approvers userApprovaldetails = new Approvers();
                                //Get Approval Order info
                                userApprovaldetails.Order = userApprovalJsondetails.Order;
                                //Get Approval Order UserID
                                userApprovaldetails.UserID = userApprovalJsondetails.UserID;
                                //Get Approval Order UserName
                                userApprovaldetails.UserName = userApprovalJsondetails.UserName;
                                //Get Approval Order Status
                                userApprovaldetails.Status = userApprovalJsondetails.Status;
                                //Get Approval Order Created
                                userApprovaldetails.Created = userApprovalJsondetails.Created;
                                //Get Approval Order DueDate
                                userApprovaldetails.DueDate = userApprovalJsondetails.DueDate;
                                //Get Approval Order DecisionDate
                                userApprovaldetails.DecisionDate = userApprovalJsondetails.DecisionDate;
                                //getting Approver Comment
                                userApprovaldetails.Comment = userApprovalJsondetails.Comment;
                                //Add to Approvers Model object for Approval details
                                approverList.Add(userApprovaldetails);
                            }
                            //Add approval list to ApprovalRequestDTO Model object
                            requestObj.request.Approvers = approverList;
                            //Add Overview /Generic fields to ApprovalRequestDTO Model object
                            requestObj.request.Fields = requestFields;
                        }
                        else
                        {
                            requestObj.request    = null;
                            requestObj.approval   = null;
                            requestObj.retryAfter = userbackendRequestdetails.retryAfter;
                        }
                        //Add all info to ApprovalRequestDTO Model object List
                        requestsDetails.Add(requestObj);
                    }
                }
                // Return Json formate object and pass to UI
                return(Json(requestsDetails, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#7
0
        public async Task <ActionResult> GetBackendApprovalrequestcount(SynchRequestDTO syncRequest)
        {
            try
            {
                //SynchRequestDTO syncRequest = new SynchRequestDTO();
                //Assign user id to SynchRequestDTO model
                syncRequest.userId = userid;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //Get Pending approval count from Synch API
                string stApprovalPendingCount = await apiControllerObj.GetApprovalcompletedcount(syncRequest, userid);

                //Get approved count details from API
                syncRequest.parameters.filters.apprStatus = "Approved";
                string stApprovalApprovedCount = await apiControllerObj.GetApprovalcompletedcount(syncRequest, userid);

                // Get Rejected count details from API
                syncRequest.parameters.filters.apprStatus = "Rejected";
                string stApprovalRejectedCount = await apiControllerObj.GetApprovalcompletedcount(syncRequest, userid);

                //Deseralize the result returned by the API
                UserBackendrequestJsonData userTaskPendingResponse  = JsonConvert.DeserializeObject <UserBackendrequestJsonData>(stApprovalPendingCount);
                UserBackendrequestJsonData userTaskApprovedResponse = JsonConvert.DeserializeObject <UserBackendrequestJsonData>(stApprovalApprovedCount);
                UserBackendrequestJsonData userTaskRejectedResponse = JsonConvert.DeserializeObject <UserBackendrequestJsonData>(stApprovalRejectedCount);
                //creates list Backend model object
                List <string> userBackends = new List <string>();
                userBackends = syncRequest.parameters.filters.backends;
                List <string> userBackendName = syncRequest.parameters.filters.backendName;
                //creates lists for Pending/Approval/Reject Count for json object result
                UserBackendRequestJsonResult[] userBackendwithTaskPendingCount  = userTaskPendingResponse.userBackendRequestResults;
                UserBackendRequestJsonResult[] userBackendwithTaskApprovedCount = userTaskApprovedResponse.userBackendRequestResults;
                UserBackendRequestJsonResult[] userBackendwithTaskRejectedCount = userTaskRejectedResponse.userBackendRequestResults;
                List <ApprovalCountDTO>        approvalCountobj = new List <ApprovalCountDTO>();
                //Checks whether the JSON response is not null
                if (userTaskPendingResponse != null && userBackends != null)
                {
                    int i = 0;
                    //Iterate json format result and bind to Model
                    foreach (string backendID in userBackends)
                    {
                        //Create ApprovalCountDTO Model object
                        ApprovalCountDTO approvalCount = new ApprovalCountDTO();
                        //Get approval backend Id
                        approvalCount.BackendID = backendID;
                        //Get approval backend Name
                        approvalCount.BackendName = userBackendName[i];
                        //Get Pending approval count
                        if (userBackendwithTaskPendingCount != null)
                        {
                            UserBackendRequestJsonResult taskcountlist = userBackendwithTaskPendingCount.ToList().Find(x => x.userBackend.BackendID == backendID);
                            if (taskcountlist != null)
                            {
                                approvalCount.WaitingCount = taskcountlist.userTaskcountJsonResult.Count;
                            }
                        }
                        //Get Approved approval count
                        if (userBackendwithTaskApprovedCount != null)
                        {
                            UserBackendRequestJsonResult taskcountlist = userBackendwithTaskApprovedCount.ToList().Find(x => x.userBackend.BackendID == backendID);
                            if (taskcountlist != null)
                            {
                                approvalCount.ApprovedCount = taskcountlist.userTaskcountJsonResult.Count;
                            }
                        }
                        //Get Rejected approval count
                        if (userBackendwithTaskRejectedCount != null)
                        {
                            UserBackendRequestJsonResult taskcountlist = userBackendwithTaskRejectedCount.ToList().Find(x => x.userBackend.BackendID == backendID);
                            if (taskcountlist != null)
                            {
                                approvalCount.RejectedCount = taskcountlist.userTaskcountJsonResult.Count;
                            }
                        }
                        //Add ApprovalCountDTO Model object
                        approvalCountobj.Add(approvalCount);
                        i++;
                    }
                }
                // Return Json formate object and pass to UI
                return(Json(approvalCountobj, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#8
0
        public async Task <ActionResult> GetApprovalDetails(SynchRequestDTO syncRequest)
        {
            string userbackend = string.Empty;

            try
            {
                //Assign UI synch request backends to list
                List <string> backendId = syncRequest.parameters.filters.backends;
                //Iterate backends and assign the each backend to userbackend string
                foreach (string backend in backendId)
                {
                    userbackend = backend;
                }
                //SynchRequestDTO syncRequest = new SynchRequestDTO();
                syncRequest.userId = userid;
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //creates list request details object for waiting
                List <ApprovalRequestDTO> requestsDetails = new List <ApprovalRequestDTO>();
                // Get the waiting approval status details
                if (syncRequest.parameters.filters.apprStatus == "Waiting")
                {
                    //Get request details from Synch API
                    string stApprovalPendingDetails = await apiControllerObj.GetUserBackendTasks(syncRequest, userid, userbackend);

                    //Deseralize the result returned by the API
                    UserBackendrequestJsonData userBackendjsonResponse = JsonConvert.DeserializeObject <UserBackendrequestJsonData>(stApprovalPendingDetails);
                    //Bind the Json result data to list
                    requestsDetails = ApprovalTasks(userBackendjsonResponse);
                }
                else
                {
                    //creates list request details object for approval and reject
                    List <ApprovalRequestDTO> requestsRejectedDetails = new List <ApprovalRequestDTO>();
                    // Get the Approved approval status details
                    syncRequest.parameters.filters.apprStatus = "Approved";
                    //Get request details from Synch API
                    string stApprovalApprovedDetails = await apiControllerObj.GetUserBackendTasks(syncRequest, userid, userbackend);

                    //Deseralize the result returned by the API
                    UserBackendrequestJsonData userBackendjsonResponse = JsonConvert.DeserializeObject <UserBackendrequestJsonData>(stApprovalApprovedDetails);
                    //Bind the Json result data to list
                    requestsDetails = ApprovalTasks(userBackendjsonResponse);
                    // Get the Rejected approval status details
                    syncRequest.parameters.filters.apprStatus = "Rejected";
                    //Get request details from Synch API
                    string stApprovalRejectedDetails = await apiControllerObj.GetUserBackendTasks(syncRequest, userid, userbackend);

                    //Deseralize the result returned by the API
                    UserBackendrequestJsonData userBackendjsonRejectResponse = JsonConvert.DeserializeObject <UserBackendrequestJsonData>(stApprovalRejectedDetails);
                    //Bind the Json result data to list
                    requestsRejectedDetails = ApprovalTasks(userBackendjsonRejectResponse);
                    //Add approval and rejected details tasks
                    requestsDetails.AddRange(requestsRejectedDetails);
                }
                //sorting data for completed tasks based on decision date
                if (syncRequest.parameters.filters.apprStatus != "Waiting")
                {
                    List <ApprovalRequestDTO> sortedrequestsDetails = requestsDetails.OrderBy(o => o.approval.DecisionDate).ToList();
                    requestsDetails = sortedrequestsDetails;
                }
                // Return Json formate object and pass to UI
                return(Json(requestsDetails, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                return(View("Error"));
            }
        }
示例#9
0
        //Gets the user backend deatils returned by Personalization API
        public async Task <UserDTO> Getuserdetails()
        {
            //creates list Backend model object
            List <UserBackendDTO> userBackend = new List <UserBackendDTO>();
            //creates list Device model object
            List <UserDeviceDTO> UserDevicedetails = new List <UserDeviceDTO>();

            try
            {
                //Api Controller object initialization
                APIController apiControllerObj = new APIController();
                //NewUser model object initialization
                UserDTO userdetails = new UserDTO();
                //Gets the user details returned by Personalization API
                string strUserExisits = await apiControllerObj.Getuserinfo(userid);

                if (!string.IsNullOrEmpty(strUserExisits))
                {
                    //Deseralize the result returned by the API
                    NewuserJsonData newuserjsonResponse = JsonConvert.DeserializeObject <NewuserJsonData>(strUserExisits);
                    //Checks whether the JSON response is not null
                    if (newuserjsonResponse.userResults != null)
                    {
                        UserBackendJsonData userBackendjsonResponse = JsonConvert.DeserializeObject <UserBackendJsonData>(strUserExisits);
                        UserDeviceJsonData  userDevicejsonResponse  = JsonConvert.DeserializeObject <UserDeviceJsonData>(strUserExisits);
                        //Checks whether the JSON response is not null
                        if (newuserjsonResponse != null)
                        {
                            //Getting All updated user info
                            userdetails.UserID     = newuserjsonResponse.userResults.UserID;
                            userdetails.FirstName  = newuserjsonResponse.userResults.FirstName;
                            userdetails.LastName   = newuserjsonResponse.userResults.LastName;
                            userdetails.Fullname   = newuserjsonResponse.userResults.Fullname;
                            userdetails.Email      = newuserjsonResponse.userResults.Email;
                            userdetails.Domain     = newuserjsonResponse.userResults.Domain;
                            userdetails.DeviceName = newuserjsonResponse.userResults.DeviceName;
                            userdetails.DeviceOS   = newuserjsonResponse.userResults.DeviceOS;
                        }
                        //Checks whether the JSON response is not null
                        if (userBackendjsonResponse != null && userBackendjsonResponse.userBackendResults.userBackenddetails != null)
                        {
                            //Iterate user backend json format result and bind to Model
                            foreach (userBackenddetails UserbackendInfo in userBackendjsonResponse.userBackendResults.userBackenddetails)
                            {
                                //Create Model object
                                UserBackendDTO BackendObj = new UserBackendDTO();
                                BackendObj.UserID  = UserbackendInfo.UserID;
                                BackendObj.backend = new BackendDTO();
                                //setting the properties of Model
                                BackendObj.backend.BackendID                 = UserbackendInfo.userBackend.BackendID;
                                BackendObj.backend.BackendName               = UserbackendInfo.userBackend.BackendName;
                                BackendObj.backend.DefaultUpdateFrequency    = UserbackendInfo.userBackend.DefaultUpdateFrequency;
                                BackendObj.backend.AverageAllRequestsLatency = UserbackendInfo.userBackend.AverageAllRequestsLatency;
                                BackendObj.backend.AverageAllRequestsSize    = UserbackendInfo.userBackend.AverageAllRequestsSize;
                                BackendObj.backend.AverageRequestLatency     = UserbackendInfo.userBackend.AverageRequestLatency;
                                BackendObj.backend.AverageRequestSize        = UserbackendInfo.userBackend.AverageRequestSize;
                                BackendObj.backend.ExpectedLatency           = UserbackendInfo.userBackend.ExpectedLatency;
                                DateTime?expdate = UserbackendInfo.userBackend.ExpectedUpdate;
                                if (expdate != null)
                                {
                                    BackendObj.backend.ExpectedUpdate = expdate.Value;
                                }
                                BackendObj.backend.LastAllRequestsLatency = UserbackendInfo.userBackend.LastAllRequestsLatency;
                                BackendObj.backend.LastAllRequestsSize    = UserbackendInfo.userBackend.LastAllRequestsSize;
                                BackendObj.backend.LastRequestLatency     = UserbackendInfo.userBackend.LastRequestLatency;
                                BackendObj.backend.LastRequestSize        = UserbackendInfo.userBackend.LastRequestSize;
                                DateTime?lstdate = UserbackendInfo.userBackend.LastUpdate;
                                if (lstdate != null)
                                {
                                    BackendObj.backend.LastUpdate = lstdate.Value;
                                }
                                BackendObj.backend.OpenApprovals           = UserbackendInfo.userBackend.OpenApprovals;
                                BackendObj.backend.OpenRequests            = UserbackendInfo.userBackend.OpenRequests;
                                BackendObj.backend.TotalBatchRequestsCount = UserbackendInfo.userBackend.TotalBatchRequestsCount;
                                BackendObj.backend.TotalRequestsCount      = UserbackendInfo.userBackend.TotalRequestsCount;
                                BackendObj.backend.UpdateTriggered         = UserbackendInfo.userBackend.UpdateTriggered;
                                BackendObj.backend.UrgentApprovals         = UserbackendInfo.userBackend.UrgentApprovals;

                                // BackendObj.backend.MissingConfirmationsLimit = UserbackendInfo.userBackend.MissingConfirmationsLimit;
                                //Adding the Model object to the list
                                userBackend.Add(BackendObj);
                                userdetails.userbackends = userBackend;
                            }
                        }
                        //Checks whether the JSON response is not null
                        if (userDevicejsonResponse != null && userDevicejsonResponse.userDevicesResults.userDevicedetails != null)
                        {
                            //Iterate user devices json format result and bind to Model
                            foreach (userDevicedetails userDeviceInfo in userDevicejsonResponse.userDevicesResults.userDevicedetails)
                            {
                                //Create Model object
                                UserDeviceDTO deviceObj = new UserDeviceDTO();
                                // Get user device details
                                deviceObj.UserID                   = userDeviceInfo.UserID;
                                deviceObj.device                   = new DeviceDTO();
                                deviceObj.device.DeviceID          = userDeviceInfo.userDevices.DeviceID;
                                deviceObj.device.DeviceName        = userDeviceInfo.userDevices.DeviceName;
                                deviceObj.device.DeviceBrand       = userDeviceInfo.userDevices.DeviceBrand;
                                deviceObj.device.DeviceModel       = userDeviceInfo.userDevices.DeviceModel;
                                deviceObj.device.maxSynchReplySize = userDeviceInfo.userDevices.maxSynchReplySize;
                                // Add details to new model
                                UserDevicedetails.Add(deviceObj);
                                userdetails.userdevices = UserDevicedetails;
                            }
                        }
                    }
                }
                //Return user details as list object
                return(userdetails);
            }
            catch (Exception exception)
            {
                LoggerHelper.WriteToLog(exception + " - Error while creating client context : "
                                        + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new DataAccessException("Error in Getuserdetails");
            }
        }