Ejemplo n.º 1
0
        public HttpResponseMessage SaveUpdates([FromBody] string ClaimUpdateDTO)
        {
            HttpResponseMessage message     = new HttpResponseMessage();
            Claim_Update        claimUpdate = new Claim_Update();

            try
            {
                dynamic claimupdateDto = JObject.Parse(ClaimUpdateDTO);

                claimUpdate = ((JObject)claimupdateDto.claimUpdate).ToObject <Claim_Update>();
                Claim_Updates_Billing updatesBilling = ((JObject)claimupdateDto.claimUpdatesBilling).ToObject <Claim_Updates_Billing>();
                claimUpdate.DateTimeSubmitted_ = DateTime.UtcNow;
                context.Claim_Updates.InsertOnSubmit(claimUpdate);
                context.SubmitChanges(); //submit because the claim update id is needed for foreign key

                //set billing update foreign key to claim updateID
                updatesBilling.UpdateID = claimUpdate.UpdateID;
                context.Claim_Updates_Billings.InsertOnSubmit(updatesBilling);
                context.SubmitChanges();
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message));
            }
            message.StatusCode = HttpStatusCode.Created;
            message.Content    = new StringContent(claimUpdate.UpdateID.ToString());
            return(message);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage ArchiveClaimUpdateAndBilling([FromBody] string UpdatesBilling, int updateID, string Token)
        {
            //insert into archive table
            Claim_Update          claimUpdate    = _ctx.Claim_Updates.Single(i => i.UpdateID == updateID);
            Claim_Updates_Billing updatesBilling = _ctx.Claim_Updates_Billings.Single(i => i.UpdateID == updateID);
            Session session = _ctx.Sessions.FirstOrDefault(i => i.SessionToken == Token);


            Claim_Updates_Billing_PR_Archive archive = new Claim_Updates_Billing_PR_Archive()
            {
                UserID           = claimUpdate.UserID,
                ClaimRefNu       = claimUpdate.ClaimRefNu,
                ActionType       = claimUpdate.ActionType,
                Archived_By      = Convert.ToInt32(session.UserID),
                BillID           = updatesBilling.BillID,
                Billable         = claimUpdate.Billable,
                Comments         = updatesBilling.Comments,
                Completed        = updatesBilling.Completed,
                CompletionDate   = updatesBilling.CompletionDate,
                Courier          = updatesBilling.Courier,
                Date_Archived    = DateTime.Now,
                DirectContact    = updatesBilling.DirectContact,
                Duration         = updatesBilling.Duration,
                EmployeeComments = claimUpdate.EmployeeComments,
                InternalComments = claimUpdate.InternalComments,
                IsArchived       = claimUpdate.IsArchived,
                IsInReview       = true,
                Method           = updatesBilling.Method,
                Postage          = updatesBilling.Postage,
                Reason           = updatesBilling.Reason,
                ReportedComments = claimUpdate.ReportedComments,
                UpdateBy         = Convert.ToInt32(session.UserID),
                UpdateId         = claimUpdate.UpdateID,
                UpdatesDate      = claimUpdate.UpdatesDate,
                SeniorConsulting = updatesBilling.SeniorConsulting
            };

            _ctx.Claim_Updates_Billing_PR_Archives.InsertOnSubmit(archive);
            _ctx.SubmitChanges();



            dynamic updates = JsonConvert.DeserializeObject(UpdatesBilling);

            claimUpdate.InternalComments = updates.InternalComments;
            claimUpdate.ReportedComments = updates.ReportedComments;
            claimUpdate.EmployeeComments = updates.EmployeeComments;
            claimUpdate.Billable         = updates.Billable;

            updatesBilling.CompletionDate   = Convert.ToDateTime(updates.CompletionDate);
            updatesBilling.DirectContact    = Convert.ToBoolean(updates.DirectContact);
            updatesBilling.Postage          = Convert.ToBoolean(updates.Postage);
            updatesBilling.Courier          = Convert.ToBoolean(updates.Courier);
            updatesBilling.Method           = updates.Method;
            updatesBilling.Reason           = updates.Reason;
            updatesBilling.Duration         = updates.Duration;
            updatesBilling.Comments         = updates.Comments;
            updatesBilling.SeniorConsulting = updates.SeniorConsulting;

            _ctx.SubmitChanges();


            return(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content = new StringContent("")
            });
        }
Ejemplo n.º 3
0
        public HttpResponseMessage ArchiveUpdate(string token, int updateID)
        {
            Claim_Update claimUpdate = context.Claim_Updates.Single(i => i.UpdateID == updateID);
            Session      session     = context.Sessions.FirstOrDefault(i => i.SessionToken == token);

            if (claimUpdate.DateTimeSubmitted_ < DateTime.UtcNow.AddHours(-2))
            {
                return(new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.BadRequest,
                    Content = new StringContent("Claim update exceeded 2 hours old, cannot be archived.")
                });
            }

            if (claimUpdate.UserID != Convert.ToInt32(session.UserID))
            {
                return(new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.BadRequest,
                    Content = new StringContent("You did not create this claim update. you cannot delete it")
                });
            }
            Claim_Updates_Billing            updatesBilling   = context.Claim_Updates_Billings.Single(i => i.UpdateID == updateID);
            Claim_Update_Cmr                 oldCMR           = context.Claim_Update_Cmrs.SingleOrDefault(i => i.UpdateID == updateID);
            List <Claim_Updates_Document>    updatesDocuments = context.Claim_Updates_Documents.Where(i => i.UpdateID == updateID).ToList();
            Claim_Peer_Review                peerReview       = context.Claim_Peer_Reviews.SingleOrDefault(i => i.Update_ID == updateID);
            Claim_Updates_Billing_PR_Archive archive          = new Claim_Updates_Billing_PR_Archive()
            {
                UserID           = claimUpdate.UserID,
                ClaimRefNu       = claimUpdate.ClaimRefNu,
                ActionType       = claimUpdate.ActionType,
                Archived_By      = Convert.ToInt32(session.UserID),
                BillID           = updatesBilling.BillID,
                Billable         = claimUpdate.Billable,
                Comments         = updatesBilling.Comments,
                Completed        = updatesBilling.Completed,
                CompletionDate   = updatesBilling.CompletionDate,
                Courier          = updatesBilling.Courier,
                Date_Archived    = DateTime.Now,
                DirectContact    = updatesBilling.DirectContact,
                Duration         = updatesBilling.Duration,
                EmployeeComments = claimUpdate.EmployeeComments,
                InternalComments = claimUpdate.InternalComments,
                IsArchived       = claimUpdate.IsArchived,
                IsInReview       = false,
                Method           = updatesBilling.Method,
                Postage          = updatesBilling.Postage,
                Reason           = updatesBilling.Reason,
                ReportedComments = claimUpdate.ReportedComments,
                UpdateBy         = Convert.ToInt32(session.UserID),
                UpdateId         = claimUpdate.UpdateID,
                UpdatesDate      = claimUpdate.UpdatesDate,
                SeniorConsulting = updatesBilling.SeniorConsulting
            };

            if (oldCMR != null)
            {
                Claim_Update_Cmr_Archive cmrarchive = new Claim_Update_Cmr_Archive()
                {
                    UserID                      = oldCMR.UserID,
                    UpdateID                    = oldCMR.UpdateID,
                    AbsenceAuthorization        = oldCMR.AbsenceAuthorization,
                    ArchiveDate                 = DateTime.Now,
                    ArchivedBy                  = Convert.ToInt32(session.UserID),
                    ClaimHistoryInformation     = oldCMR.ClaimHistoryInformation,
                    ClaimStatusID               = oldCMR.ClaimStatusID,
                    DateOfAbsence               = oldCMR.DateOfAbsence,
                    DateOfReferal               = oldCMR.DateOfReferal,
                    DateOfReport                = oldCMR.DateOfReport,
                    EmployeeID                  = oldCMR.EmployeeID,
                    EmployeeName                = oldCMR.EmployeeName,
                    EmployerContactID           = oldCMR.EmployerContactID,
                    Location                    = oldCMR.Location,
                    NextSteps                   = oldCMR.NextSteps,
                    OSIContactID                = oldCMR.OSIContactID,
                    ReturntoWorkRecommendations = oldCMR.ReturntoWorkRecommendations,
                    TreatmentPlan               = oldCMR.TreatmentPlan
                };
                context.Claim_Update_Cmr_Archives.InsertOnSubmit(cmrarchive);
            }
            foreach (Claim_Updates_Document doc in updatesDocuments)
            {
                Claim_Updates_Documents_Archive docarchive = new Claim_Updates_Documents_Archive()
                {
                    UserID         = doc.UserID,
                    UpdateID       = doc.UpdateID,
                    ArchivedBy     = Convert.ToInt32(session.UserID),
                    ClaimReference = doc.ClaimReference,
                    DateArchived   = DateTime.Now,
                    DocumentID     = doc.DocumentID,
                    FileExt        = doc.FileExt,
                    FileName       = doc.FileName,
                    Timestamp      = doc.Timestamp,
                    VersionNumber  = doc.VersionNumber
                };
                context.Claim_Updates_Documents_Archives.InsertOnSubmit(docarchive);
            }
            if (peerReview != null)
            {
                context.Claim_Peer_Reviews.DeleteOnSubmit(peerReview);
            }
            context.Claim_Updates_Billing_PR_Archives.InsertOnSubmit(archive);
            context.SubmitChanges();
            context.Claim_Updates.DeleteOnSubmit(claimUpdate);
            context.Claim_Updates_Billings.DeleteOnSubmit(updatesBilling);
            if (oldCMR != null)
            {
                context.Claim_Update_Cmrs.DeleteOnSubmit(oldCMR);
            }
            foreach (Claim_Updates_Document doc in updatesDocuments)
            {
                context.Claim_Updates_Documents.DeleteOnSubmit(doc);
            }
            context.SubmitChanges();

            return(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content = new StringContent("Claim update and child records successfuly archived")
            });
        }