Пример #1
0
        private DropBoxLink getDropBoxLinkObj(string target, string UID, string CID, string SID, string UserRole)
        {
            DropBoxLink dropBoxLink = new DropBoxLink {Cid = CID, Uid = UID, Sid = SID, UserRole = UserRole};
            //dropBoxLink.Target = target;

            return dropBoxLink;
        }
Пример #2
0
 private void PushDropBoxLinkToCookie(DropBoxLink dropBoxLinkObj)
 {
     var linkObj = new { DROPBOXLINK = dropBoxLinkObj };
     if (Request.Cookies["DROPBOXLINK"] != null)
     {
         Request.Cookies.Remove("DROPBOXLINK");
     }
     Response.Cookies["DROPBOXLINK"].Value = JsonSerializer.SerializeObject(linkObj);
 }
Пример #3
0
        private async Task Initialize(FolderSettings folderSettings)
        {
            try
            {
                var sourceFolder = folderSettings.SourceFolder.FolderPath;

                var error = !Directory.Exists(sourceFolder);
                error = error || folderSettings.TargetFolders.Any(it => !Directory.Exists(it.FolderPath));

                if (error)
                {
                    this.eventAggregator.Publish(new ErrorMessage("Some folders are not present", "Error"));
                    return;
                }

                foreach (var encryptedFolder in folderSettings.TargetFolders)
                {
                    var folderLink = new LocalFolderLink(
                        encryptedFolder.FolderPath,
                        sourceFolder,
                        this.applicationState.CurrentCard,
                        this.applicationState.PrivateKeyPassword);

                    this.links.Add(folderLink);
                }

                var dropBoxLinkParams = new DropBoxLinkParams(
                    folderSettings.DropboxCredentials.AccessToken,
                    folderSettings.SourceFolder.FolderPath,
                    this.applicationState.CurrentCard,
                    this.applicationState.PrivateKeyPassword);

                this.dropBoxLink = new DropBoxLink(dropBoxLinkParams, this.eventAggregator);

                foreach (var folderLink in this.links)
                {
                    folderLink.Launch();
                }

                await this.dropBoxLink.Launch();

                this.eventAggregator.Publish(new DropBoxLinkChanged {
                    Instance = this.dropBoxLink
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw;
            }
        }
Пример #4
0
 /// <summary>
 /// To set client audit fields for document
 /// </summary>
 /// <param name="abstractChartData"></param>
 /// <param name="isEditMode"></param>
 /// <param name="drpLinkFromCookie"></param>
 public void SetClientAuditFields(AbstractChartData abstractChartData, bool isEditMode, DropBoxLink drpLinkFromCookie)
 {
     string loginUserId = GetLoginUserId(drpLinkFromCookie);
     SetAuditFields(abstractChartData, isEditMode,drpLinkFromCookie);
     if (!abstractChartData.IsActive)
     {
         abstractChartData.InactivatedBy = loginUserId;
         abstractChartData.InactiveTimeStamp = DateTime.Now.ToString("");
     }
     else
     {
         if (isEditMode)
         {
             abstractChartData.ChartModifiedBy = loginUserId;
             abstractChartData.ChartModifiedTimeStamp = DateTime.Now.ToString("");
         }
         else
         {
             abstractChartData.Signature = loginUserId;
             abstractChartData.ChartTimeStamp = DateTime.Now.ToString("");
         }
     }
 }
Пример #5
0
 ///// <summary>
 ///// To set audit fields for document
 ///// </summary>
 ///// <param name="documentEntity"></param>
 ///// <param name="isEditMode"></param>
 ///// <param name="drpLinkFromCookie"> </param>
 //public void SetAuditFields(DocumentEntity documentEntity, bool isEditMode,DropBoxLink drpLinkFromCookie)
 //{
 //    if (!documentEntity.IsActive)
 //    {
 //        documentEntity.DeletedBy = GetLoginUserId(drpLinkFromCookie);
 //        documentEntity.DeletedTimeStamp = DateTime.Now;
 //    }
 //    else
 //    {
 //        if (isEditMode)
 //        {
 //            documentEntity.ModifiedBy = GetLoginUserId(drpLinkFromCookie);
 //            documentEntity.ModifiedTimeStamp = DateTime.Now;
 //        }
 //        else
 //        {
 //            documentEntity.CreatedBy = GetLoginUserId(drpLinkFromCookie);
 //            documentEntity.CreatedTimeStamp = DateTime.Now;
 //        }
 //    }
 //}
 /// <summary>
 /// To set audit fields for document
 /// </summary>
 /// <param name="documentEntity"></param>
 /// <param name="isEditMode"></param>
 /// <param name="drpLinkFromCookie"></param>
 public void SetAuditFields(DocumentEntity documentEntity, bool isEditMode, DropBoxLink drpLinkFromCookie)
 {
     string loginUserId = GetLoginUserId(drpLinkFromCookie);
     DateTime currentServerTime = DateTime.Now;
     if (!documentEntity.IsActive)
     {
         documentEntity.DeletedBy = loginUserId;
         documentEntity.DeletedTimeStamp = currentServerTime;
     }
     else
     {
         if (isEditMode)
         {
             documentEntity.ModifiedBy = loginUserId;
             documentEntity.ModifiedTimeStamp = currentServerTime;
         }
         else
         {
             documentEntity.CreatedBy = loginUserId;
             documentEntity.CreatedTimeStamp = currentServerTime;
         }
     }
 }
Пример #6
0
        private void SaveActualAppointmentRecurrence(string appointmentGuidUrl, Appointment appointmentToSave, DropBoxLink dropBoxLink)
        {
            appointmentToSave.RecurrenceGroup = SaveRecurrenceGroup(dropBoxLink, appointmentToSave.Recurrence, appointmentToSave.RecurrenceGroup);
            IList<Appointment> appointmentsListToSchedule = new List<Appointment>();
            if (appointmentToSave is PatientVisit)
            {
                IList<PatientVisit> patientVisitAppointmentsListToSchedule = JsonSerializer.DeserializeObject<IList<PatientVisit>>(GetAppointments(appointmentToSave, AppEnum.AppointmentTypes.PatientVisit));
                appointmentsListToSchedule = patientVisitAppointmentsListToSchedule.ToList<Appointment>();
            }

            else if (appointmentToSave is BlockAppointment)
            {
                IList<BlockAppointment> blockAppointmentsListToSchedule = JsonSerializer.DeserializeObject<IList<BlockAppointment>>(GetAppointments(appointmentToSave, AppEnum.AppointmentTypes.Block));
                appointmentsListToSchedule = blockAppointmentsListToSchedule.ToList<Appointment>();
            }
            else if (appointmentToSave is OtherAppointment)
            {
                IList<OtherAppointment> otherAppointmentsListToSchedule = JsonSerializer.DeserializeObject<IList<OtherAppointment>>(GetAppointments(appointmentToSave, AppEnum.AppointmentTypes.Other));
                appointmentsListToSchedule = otherAppointmentsListToSchedule.ToList<Appointment>();
            }
            List<string> patientVisitSavedUrl = new List<string>();
            if (appointmentsListToSchedule.Count > 0)
            {
                foreach (Appointment appointmentItem in appointmentsListToSchedule)
                {
                    ClearAppointmentRecurrenceGroup(appointmentItem);
                    patientVisitSavedUrl.Add(SaveActualAppointment(appointmentGuidUrl, appointmentItem, dropBoxLink));
                }
            }
            SaveAppointmentUrlRecurrenceGroup(patientVisitSavedUrl, dropBoxLink, appointmentToSave.RecurrenceGroup);
        }
Пример #7
0
 /// <summary>
 /// delete Recurrence Appointment 
 /// </summary>
 /// <param name="appointmentExist"></param>
 /// <param name="dropBoxLink"></param>
 /// <param name="recurrenceEditStatus"></param>
 /// <returns></returns>
 private Appointment DeleteRecurrenceAppointment(Appointment appointmentExist, DropBoxLink dropBoxLink, AppEnum.EditStatus recurrenceEditStatus)
 {
     // get the Url of Recurrence Appointment
     if (appointmentExist.Recurrence.RecurrenceList != null && appointmentExist.Recurrence.RecurrenceList.Count > 0)
     {
         string recurrenceGroupUrl = FormatRecurrenceGroupUrl(_recurrenceDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.RecurrenceGroup), appointmentExist.RecurrenceGroup);
         recurrenceGroupUrl = string.Format(recurrenceGroupUrl, appointmentExist.RecurrenceGroup);
         switch (recurrenceEditStatus)
         {
             case AppEnum.EditStatus.All:
                 DeleteAppointmentList(appointmentExist);
                 string deleteRecurrenceGroup;
                 _recurrenceDocument.Delete(recurrenceGroupUrl, out deleteRecurrenceGroup);
                 break;
             case AppEnum.EditStatus.Current:
                 DeleteAnAppointment(appointmentExist.Url);
                 List<string> appointmentSavedUrl = appointmentExist.Recurrence.RecurrenceList.Where(app => !(app.Equals(appointmentExist.Url))).ToList();
                 SaveAppointmentUrlRecurrenceGroup(appointmentSavedUrl, dropBoxLink, appointmentExist.RecurrenceGroup);
                 break;
         }
     }
     return appointmentExist;
 }
Пример #8
0
        private void DeleteAndCreateNewAppointment(Appointment toSaveAppointment, DropBoxLink dropBoxLink, Appointment appointmentAlreadyExist)
        {
            Appointment deletedAppointmentExist = DeleteAppointmentType(toSaveAppointment, dropBoxLink, AppEnum.EditStatus.All, appointmentAlreadyExist);
            //SetAuditFields(toSaveAppointment, true, dropBoxLink); //  set audit fields for modify...
            SetClientAuditFields(toSaveAppointment, true, dropBoxLink);
            //toSaveAppointment.CreatedBy = deletedAppointmentExist.CreatedBy;
            //toSaveAppointment.CreatedTimeStamp = deletedAppointmentExist.CreatedTimeStamp;
            //toSaveAppointment.ChartTimeStamp = deletedAppointmentExist.ChartTimeStamp;
            //toSaveAppointment.Signature = deletedAppointmentExist.Signature;
            SetAppointmentAduitFieldsValues(toSaveAppointment, appointmentAlreadyExist);
            if (toSaveAppointment.Recurrence == null)
            {// set audit fields for create ...
                SaveActualAppointment("", toSaveAppointment, dropBoxLink);
            }
            else
            {   // set audit fields for create ...
                if (deletedAppointmentExist.Recurrence != null)
                {// set audit fields for P.V  recurrence create ...
                    toSaveAppointment.Recurrence.CreatedBy = deletedAppointmentExist.Recurrence.CreatedBy;
                    toSaveAppointment.Recurrence.CreatedTimeStamp = deletedAppointmentExist.Recurrence.CreatedTimeStamp;
                    toSaveAppointment.Recurrence.ChartTimeStamp = deletedAppointmentExist.Recurrence.ChartTimeStamp;
                    toSaveAppointment.Recurrence.Signature = deletedAppointmentExist.Recurrence.Signature;
                    //toSaveAppointment.StartDateTime = deletedAppointmentExist.Recurrence.StartDateTime;
                    //toSaveAppointment.EndDateTime = deletedAppointmentExist.Recurrence.EndDateTime;
                }
                else
                {// set audit fields for P.V  recurrence create .. for new
                    //SetAuditFields(toSaveAppointment.Recurrence, false, dropBoxLink);
                    SetClientAuditFields(toSaveAppointment.Recurrence, false, dropBoxLink);

                }
                SaveActualAppointmentRecurrence("", toSaveAppointment, dropBoxLink);
            }
        }
Пример #9
0
 private bool CancelAppointment(string appointmentUrl, Appointment appointmentToCancel, DropBoxLink dropBoxLink, AppEnum.EditStatus occurrenceStatus)
 {
     switch (occurrenceStatus)
     {
         case AppEnum.EditStatus.All:
             CancelRecurringAppointment(appointmentUrl, appointmentToCancel, dropBoxLink);
             break;
         case AppEnum.EditStatus.None:
         case AppEnum.EditStatus.Current:
             CancelActualAppointment(appointmentUrl, appointmentToCancel, dropBoxLink);
             break;
     }
     return true;
 }
Пример #10
0
 /// <summary>
 /// This method is used to save patient in assignment for a New Appointment
 /// </summary>
 /// <param name="assignmentUniqueIdentifier"></param>
 /// <param name="patientItem"></param>
 /// <param name="dropBox"> </param>
 /// <returns></returns>
 public Patient SaveNewAppointmentPatient(string assignmentUniqueIdentifier, Patient patientItem, DropBoxLink dropBox)
 {
     string patientAssignmentUrl = _patientDocument.GetAssignmentUrl(dropBox, DocumentPath.Module.Patients, AppConstants.Create);
     patientAssignmentUrl = _patientDocument.SaveOrUpdate(patientAssignmentUrl, patientItem);
     //patientItem = _patientDocument.Get(patientAssignmentUrl);
     string patientUniqueIdentifier = patientAssignmentUrl.Split('/').Last();
     patientItem.UniqueIdentifier = patientUniqueIdentifier;
     return patientItem;
 }
Пример #11
0
 public bool IsPatientValid(DropBoxLink assignmentCredentials, Patient patientItem)
 {
     bool isPatientValid = true;
     IList<Patient> duplicatePatientList = new List<Patient>();
     IList<Patient> patientList = _patientDocument.GetAllPatientForAssignment(assignmentCredentials);
     if (patientList != null && patientList.Count > 0)
     {
         duplicatePatientList =
             patientList.Where(x => ((x.LastName.ToLower() == patientItem.LastName.ToLower()) && (x.FirstName.ToLower() == patientItem.FirstName.ToLower()) && (x.MiddleInitial.ToLower() == patientItem.MiddleInitial.ToLower()) &&
                 (x.DateOfBirth.ToLower() == patientItem.DateOfBirth.ToLower()))).ToList();
     }
     if (duplicatePatientList.Count() != 0)
     {
         isPatientValid = false;
     }
     return isPatientValid;
 }
Пример #12
0
 public PatientVisit GetPatientVisitAppointment(string appointmentUrl, DropBoxLink dropBoxLink)
 {
     PatientVisit patientVisitEdit = _patientVisitAppointmentDocument.Get(appointmentUrl);
     if (!AppCommon.CheckIfStringIsEmptyOrNull(patientVisitEdit.RecurrenceGroup))
     {
         RecurrenceGroup patientVisitRecurrenceExist = _recurrenceDocument.Get(FormatRecurrenceGroupUrl(_recurrenceDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.RecurrenceGroup), patientVisitEdit.RecurrenceGroup));
         patientVisitEdit.Recurrence = patientVisitRecurrenceExist;
     }
     return patientVisitEdit;
 }
Пример #13
0
 /// <summary>
 /// to set and get dynamic url for skill
 /// </summary>
 /// <param name="skillSetObjFromUi"></param>
 /// <param name="dropBox"> </param>
 /// <param name="skillSetUrl"></param>
 /// <param name="isEditMode"></param>
 /// <param name="folderIdentifier"></param>
 /// <returns></returns>
 private string FormAndSetUrlForSkillSet(SkillSet skillSetObjFromUi, DropBoxLink dropBox, string skillSetUrl, bool isEditMode, string folderIdentifier)
 {
     if (isEditMode)
     {
         return skillSetUrl;
     }
     if (String.IsNullOrEmpty(skillSetUrl) && String.IsNullOrEmpty(folderIdentifier))
     {
             return string.Format(_skillSetDocument.GetAssignmentUrl(dropBox,DocumentPath.Module.SkillSets,AppConstants.Create), skillSetUrl, skillSetObjFromUi.GetNewGuidValue());
     }
     if (String.IsNullOrEmpty(skillSetUrl) && !String.IsNullOrEmpty(folderIdentifier))
     {
                     return folderIdentifier + "/"+Respository.Skillsets + "/" + skillSetObjFromUi.GetNewGuidValue();
     }
     return String.Empty;
 }
Пример #14
0
        public bool SaveSkillSet(SkillSet skillSetObjectFromUi, DropBoxLink dropBox, string skillSetUrl, string folderIdentifier, bool isEditMode, out string skillSetIdentifier)
        {
            try
            {
                // Set Guid referncce and Correct Url
                string strUrlToSave = FormAndSetUrlForSkillSet(skillSetObjectFromUi, dropBox, skillSetUrl, isEditMode,
                                                               folderIdentifier);
                skillSetIdentifier = strUrlToSave;

                if (isEditMode)
                {
                    SkillSet skillSetObj = _skillSetDocument.GetSkillSet(strUrlToSave);
                    skillSetObj.Competencies = skillSetObjectFromUi.Competencies;
                    skillSetObj.Focus = skillSetObjectFromUi.Focus;
                    skillSetObj.SkillSetTitle = skillSetObjectFromUi.SkillSetTitle;
                    skillSetObj.SequenceNumber = skillSetObjectFromUi.SequenceNumber;
                    skillSetObj.Url = strUrlToSave;
                    List<string> lstOfGuidsForQuestions = new List<string>();
                    if (skillSetObj.Questions != null && skillSetObj.Questions.Count > 0)
                    {
                        lstOfGuidsForQuestions.AddRange(from item in skillSetObj.Questions let questionObj = item.Value where !String.IsNullOrEmpty(questionObj.CompetencyReferenceGuid) where !skillSetObj.Competencies.Contains(questionObj.CompetencyReferenceGuid) select item.Key);
                        foreach (var itemGuids in lstOfGuidsForQuestions)
                        {
                            skillSetObj.Questions.Remove(itemGuids);
                        }
                    }

                    _skillSetDocument.SaveOrUpdate(strUrlToSave, skillSetObj);
                }
                else
                {
                    skillSetObjectFromUi.Url = strUrlToSave;
                    _skillSetDocument.SaveOrUpdate(strUrlToSave, skillSetObjectFromUi);
                }
            }
            catch
            {
                skillSetIdentifier = String.Empty;
                return false;
            }
            return true;
        }
Пример #15
0
 /// <summary>
 /// To get user id from cookie
 /// </summary>
 /// <returns>UID</returns>
 protected string GetLoginUserId(DropBoxLink drpLinkFromCookie)
 {
     return (drpLinkFromCookie != null ? "LN" + drpLinkFromCookie.Uid + ", FN" + drpLinkFromCookie.Uid : String.Empty);
 }
Пример #16
0
 public OtherAppointment GetOtherAppointment(string appointmentUrl, DropBoxLink dropBoxLink)
 {
     //return _blockAppointmentDocument.Get(appointmentUrl);
     OtherAppointment otherAppointmentEdit = _otherAppointmentDocument.Get(appointmentUrl);
     if (!AppCommon.CheckIfStringIsEmptyOrNull(otherAppointmentEdit.RecurrenceGroup))
     {
         RecurrenceGroup otherRecurrenceExist = _recurrenceDocument.Get(FormatRecurrenceGroupUrl(_recurrenceDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.RecurrenceGroup), otherAppointmentEdit.RecurrenceGroup));
         otherAppointmentEdit.Recurrence = otherRecurrenceExist;
     }
     return otherAppointmentEdit;
 }
Пример #17
0
 private void SaveAppointmentUrlRecurrenceGroup(List<string> appointmentSavedUrl, DropBoxLink dropBoxLink, string recurrenceGroupGuid)
 {
     if (appointmentSavedUrl != null && appointmentSavedUrl.Count > 0)
     {
         string appointmentUrlRecurrenceGroupUrl = _recurrenceDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.RecurrenceGroup);
         appointmentUrlRecurrenceGroupUrl = string.Format(appointmentUrlRecurrenceGroupUrl, recurrenceGroupGuid);
         _recurrenceDocument.SaveOrUpdate(appointmentUrlRecurrenceGroupUrl + "/RecurrenceList", JsonSerializer.SerializeObject(appointmentSavedUrl));
     }
 }
Пример #18
0
 public bool IsAppointmentExists(DateTime appointmentStartTime, IList<int> providerId, DropBoxLink dropBoxLink)
 {
     CalendarFilterProxy calendarFilterObject = new CalendarFilterProxy
                                                    {
                                                        CalendarView =
                                                            AppEnum.CalendarViewTypes.agendaDay.ToString(),
                                                        StartDate = appointmentStartTime,
                                                        EndDate = appointmentStartTime,
                                                        ScenarioId =
                                                            (dropBoxLink != null) ? dropBoxLink.Sid : "SID",
                                                        CourseId =
                                                            (dropBoxLink != null) ? dropBoxLink.Cid : "Course",
                                                        UserId = (dropBoxLink != null) ? dropBoxLink.Uid : "UID",
                                                        Role = AppEnum.ApplicationRole.Student
                                                    };
     IList<Appointment> appointmentsList = _appointmentDocument.GetAppointments(calendarFilterObject, AppEnum.CalendarFilterTypes.None);
     appointmentsList =
         (from appointment in appointmentsList
          where appointment.StartDateTime == appointmentStartTime
          select appointment).ToList();
     //appointmentsList =
     //    (from appointment in appointmentsList
     //     where appointment.ProviderId[0] == providerId[0]
     //     select appointment).ToList();
     for (int iCount = 0; iCount < providerId.Count(); iCount++)
     {
         IList<Appointment> tempAppointmentList =
             (from appointment in appointmentsList
              where appointment.ProviderId.Contains(providerId[iCount])
              select appointment).ToList();
         if (tempAppointmentList.Count > 0)
         {
             return true;
         }
     }
     return false;
 }
Пример #19
0
 private string SaveRecurrenceGroup(DropBoxLink dropBoxLink, RecurrenceGroup recurrenceGroup, string recurrenceGroupGuid)
 {
     string str = _recurrenceDocument.SaveOrUpdate(FormatRecurrenceGroupUrl(_recurrenceDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.RecurrenceGroup), recurrenceGroupGuid), recurrenceGroup);
     return GetIdentifierFromUrl(str);
 }
Пример #20
0
        /// <summary>
        /// this method will be invoked by appointment controller. Base method 
        /// </summary>
        /// <param name="appointmentGuid"></param>
        /// <param name="toSaveAppointment"></param>
        /// <param name="dropBoxLink"></param>
        /// <param name="occurrenceStatus"></param>
        public string SaveAppointmentType(string appointmentGuid, Appointment toSaveAppointment, DropBoxLink dropBoxLink, AppEnum.EditStatus occurrenceStatus)
        {
            bool isDateChanged = false;
            Appointment appointmentExist = null;
            string returnString = "";

            if (toSaveAppointment is PatientVisit)
            {
                if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuid))
                {
                    appointmentExist = GetPatientVisitAppointment(appointmentGuid, dropBoxLink);
                    isDateChanged = CheckIsDataChange(appointmentExist, toSaveAppointment);
                }

            }
            else if (toSaveAppointment is BlockAppointment)
            {
                if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuid))
                {
                    appointmentExist = GetBlockAppointment(appointmentGuid, dropBoxLink);
                    isDateChanged = CheckIsDataChange(appointmentExist, toSaveAppointment);
                }
            }
            else if (toSaveAppointment is OtherAppointment)
            {
                if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuid))
                {
                    appointmentExist = GetOtherAppointment(appointmentGuid, dropBoxLink);
                    isDateChanged = CheckIsDataChange(appointmentExist, toSaveAppointment);
                }
            }

            if (toSaveAppointment.Status == (int)AppEnum.AppointmentStatus.Canceled)
            {
                if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuid))
                {
                    if (appointmentExist != null)
                    {
                        appointmentExist.ReasonForCancellation = toSaveAppointment.ReasonForCancellation;
                        CancelAppointment(appointmentGuid, appointmentExist, dropBoxLink, occurrenceStatus);
                    }
                    returnString = AppConstants.Cancelled;
                }
            }
            else
            {
                SetAuditFieldsForAppointment(appointmentGuid, toSaveAppointment, dropBoxLink);
                SaveAppointment(appointmentGuid, toSaveAppointment, dropBoxLink, isDateChanged, appointmentExist, occurrenceStatus);
                returnString = AppConstants.AppointmentSave;
            }

            return returnString;
        }
Пример #21
0
 private void SetAuditFieldsForAppointment(string appointmentGuid, Appointment toSaveAppointment, DropBoxLink dropBoxLink)
 {
     if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuid))
     {// edit mode
         //SetAuditFields(appointmentToSave, true);
         SetClientAuditFields(toSaveAppointment, true, dropBoxLink);
         if (toSaveAppointment != null && toSaveAppointment.Recurrence != null)
         {
             //SetAuditFields(appointmentToSave.Recurrence, true);
             SetClientAuditFields(toSaveAppointment.Recurrence, true, dropBoxLink);
         }
     }
     else
     { // create mode
         //SetAuditFields(appointmentToSave, false);
         SetClientAuditFields(toSaveAppointment, false, dropBoxLink);
         if (toSaveAppointment != null && toSaveAppointment.Recurrence != null)
         {
             //SetAuditFields(appointmentToSave.Recurrence, false);
             SetClientAuditFields(toSaveAppointment.Recurrence, false, dropBoxLink);
         }
     }
 }
Пример #22
0
 private void CancelActualAppointment(string appointmentUrl, Appointment appointmentToCancel, DropBoxLink dropBoxLink)
 {
     appointmentToCancel.Status = (int)AppEnum.AppointmentStatus.Canceled;
     //SetAuditFields(appointmentToCancel, true, dropBoxLink);
     SetClientAuditFields(appointmentToCancel, true, dropBoxLink);
     SaveActualAppointment(appointmentUrl, appointmentToCancel, dropBoxLink);
 }
Пример #23
0
 /// <summary>
 /// Non Recurrence To Recurrence
 /// </summary>
 /// <param name="appointmentGuidUrl"></param>
 /// <param name="toSaveAppointment"></param>
 /// <param name="dropBoxLink"></param>
 /// <param name="appointmentAlreadyExist"> </param>
 private void UpdateSaveAppointmentNonRecurrenceToRecurrence(string appointmentGuidUrl, Appointment toSaveAppointment, DropBoxLink dropBoxLink, Appointment appointmentAlreadyExist)
 {
     if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuidUrl))
     {
         DeleteAnAppointment(appointmentGuidUrl);
         //SetAuditFields(toSaveAppointment, true, dropBoxLink);
         SetClientAuditFields(toSaveAppointment, true, dropBoxLink);
         //toSaveAppointment.CreatedBy = appointmentAlreadyExist.CreatedBy;
         //toSaveAppointment.CreatedTimeStamp = appointmentAlreadyExist.CreatedTimeStamp;
         //toSaveAppointment.ChartTimeStamp = appointmentAlreadyExist.ChartTimeStamp;
         //toSaveAppointment.Signature = appointmentAlreadyExist.Signature;
         SetAppointmentAduitFieldsValues(toSaveAppointment, appointmentAlreadyExist);
         SaveActualAppointmentRecurrence("", toSaveAppointment, dropBoxLink);
     }
 }
Пример #24
0
 private void CancelRecurringAppointment(string appointmentUrl, Appointment appointmentExist, DropBoxLink dropBoxLink)
 {
     // get the Url of Recurrence Appointment
     Appointment appointmentToCancel = null;
     if (appointmentExist.Recurrence.RecurrenceList != null && appointmentExist.Recurrence.RecurrenceList.Count > 0)
     {
         foreach (string cancelItem in appointmentExist.Recurrence.RecurrenceList)
         {
             if (appointmentExist is PatientVisit)
             {
                 appointmentToCancel = _patientVisitAppointmentDocument.Get(cancelItem);
             }
             else if (appointmentExist is BlockAppointment)
             {
                 appointmentToCancel = _blockAppointmentDocument.Get(cancelItem);
             }
             CancelActualAppointment(appointmentUrl, appointmentToCancel, dropBoxLink);
         }
     }
 }
Пример #25
0
 //private void UpdateSaveAppointmentRecurrenceToNonRecurrence(Appointment toSaveAppointment, DropBoxLink dropBoxLink, Appointment appointmentAlreadyExist)
 //{
 //    if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.RecurrenceGroup))
 //    {
 //        appointmentAlreadyExist = DeleteRecurrenceAppointment(toSaveAppointment, appointmentAlreadyExist, dropBoxLink, AppEnum.EditStatus.All);
 //    }
 //    SetAuditFields(toSaveAppointment, true, dropBoxLink);
 //    toSaveAppointment.CreatedBy = appointmentAlreadyExist.CreatedBy;
 //    toSaveAppointment.CreatedTimeStamp = appointmentAlreadyExist.CreatedTimeStamp;
 //    SaveActualAppointment("", toSaveAppointment, dropBoxLink);
 //}
 //private void UpdateSaveAppointmentRecurrenceToRecurrence(string appointmentGuidUrl, Appointment toSaveAppointment, DropBoxLink dropBoxLink, Appointment appointmentAlreadyExist)
 //{
 //    AppEnum.ApplicationRole dropBoxLinkUserRole = AppCommon.GetCurrentUserRole(dropBoxLink.UserRole);
 //    IList<string> appointmentExistRecurrenceList = new List<string>();
 //    Appointment eachRecurrenceListAppointmentDbItem = null;
 //    if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuidUrl))
 //    {
 //        DateTime startDateTime = (appointmentAlreadyExist.StartDateTime.Date).Add(toSaveAppointment.StartDateTime.TimeOfDay);
 //        DateTime endDateTime = (appointmentAlreadyExist.EndDateTime.Date).Add(toSaveAppointment.EndDateTime.TimeOfDay);
 //        toSaveAppointment.StartDateTime = startDateTime;
 //        toSaveAppointment.EndDateTime = endDateTime;
 //        IList<Appointment> appointmentsListToSchedule = new List<Appointment>();
 //        if (toSaveAppointment is PatientVisit)
 //        {
 //            IList<PatientVisit> patientVisitAppointmentsListToSchedule = JsonSerializer.DeserializeObject<IList<PatientVisit>>(GetAppointments((PatientVisit)toSaveAppointment, AppEnum.AppointmentTypes.PatientVisit));
 //            appointmentsListToSchedule = patientVisitAppointmentsListToSchedule.Cast<Appointment>().ToList<Appointment>();
 //        }
 //        else if (toSaveAppointment is BlockAppointment)
 //        {
 //            IList<BlockAppointment> blockAppointmentsListToSchedule = JsonSerializer.DeserializeObject<IList<BlockAppointment>>(GetAppointments((BlockAppointment)toSaveAppointment, AppEnum.AppointmentTypes.Block));
 //            appointmentsListToSchedule = blockAppointmentsListToSchedule.Cast<Appointment>().ToList<Appointment>();
 //        }
 //        foreach (string appointmentItem in appointmentAlreadyExist.Recurrence.RecurrenceList)
 //        {
 //            if (toSaveAppointment is PatientVisit)
 //            {
 //                eachRecurrenceListAppointmentDbItem = _patientVisitAppointmentDocument.Get(appointmentItem);
 //            }
 //            else if (toSaveAppointment is PatientVisit)
 //            {
 //                eachRecurrenceListAppointmentDbItem = _blockAppointmentDocument.Get(appointmentItem);
 //            }
 //            Appointment toSaveAppointmentType = appointmentsListToSchedule.SingleOrDefault(pv => pv.StartDateTime.Date.Equals(eachRecurrenceListAppointmentDbItem.StartDateTime.Date));
 //            if (toSaveAppointmentType != null)
 //            {
 //                toSaveAppointmentType.CreatedBy = appointmentAlreadyExist.CreatedBy;
 //                toSaveAppointmentType.CreatedTimeStamp = appointmentAlreadyExist.CreatedTimeStamp;
 //                SetAuditFields(toSaveAppointmentType, true, dropBoxLink);
 //                ClearAppointmentRecurrenceGroup(toSaveAppointmentType);
 //                toSaveAppointmentType.RecurrenceGroup = appointmentAlreadyExist.RecurrenceGroup;
 //                SaveActualAppointment(appointmentItem, toSaveAppointmentType, dropBoxLink);
 //            }
 //        }
 //    }
 //}
 /// <summary>
 /// delete  patient Visit Appointment
 /// </summary>
 /// <param name="appointmentToSave"></param>
 /// <param name="dropBoxLink"> </param>
 /// <param name="recurrenceEditStatus"></param>
 /// <param name="appointmentAlreadyExist"> </param>
 /// <returns></returns>
 public Appointment DeleteAppointmentType(Appointment appointmentToSave, DropBoxLink dropBoxLink, AppEnum.EditStatus recurrenceEditStatus, Appointment appointmentAlreadyExist)
 {
     if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.Url))
     {
         if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.RecurrenceGroup))
         {// delete the single appointment
             DeleteAnAppointment(appointmentAlreadyExist.Url);
         }
         else
         {// delete the Recurrence Appointment
             appointmentAlreadyExist = DeleteRecurrenceAppointment(appointmentAlreadyExist, dropBoxLink, recurrenceEditStatus);
         }
     }
     return appointmentAlreadyExist;
 }
Пример #26
0
 private void DeleteFromRecurrenceCreateNewNonRecurrenceAppointment(Appointment toSaveAppointment, DropBoxLink dropBoxLink, Appointment appointmentAlreadyExist, AppEnum.EditStatus occurenceStatus)
 {
     //Appointment deletedAppointmentExist = DeleteAppointmentType(toSaveAppointment, dropBoxLink, occurenceStatus, appointmentAlreadyExist);
     DeleteAppointmentType(toSaveAppointment, dropBoxLink, occurenceStatus, appointmentAlreadyExist);
     //toSaveAppointment.CreatedBy = appointmentAlreadyExist.CreatedBy;
     //toSaveAppointment.CreatedTimeStamp = appointmentAlreadyExist.CreatedTimeStamp;
     //toSaveAppointment.ChartTimeStamp = appointmentAlreadyExist.ChartTimeStamp;
     //toSaveAppointment.Signature = appointmentAlreadyExist.Signature;
     SetAppointmentAduitFieldsValues(toSaveAppointment, appointmentAlreadyExist);
     toSaveAppointment.Recurrence = null;
     SaveActualAppointment("", toSaveAppointment, dropBoxLink);
 }
Пример #27
0
        /// <summary>
        /// Method to fetch the Appointment based on Dropbox and url
        /// </summary>
        /// <param name="appointmentUrl"></param>
        /// <param name="appointmentToGet"></param>
        /// <param name="dropBoxLink"></param>
        /// <returns></returns>
        public Appointment GetAppointment(string appointmentUrl, Appointment appointmentToGet, DropBoxLink dropBoxLink)
        {
            Appointment appointmentExist = null;
            if (appointmentToGet is PatientVisit)
            {
                if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentUrl))
                {
                    appointmentExist = GetPatientVisitAppointment(appointmentUrl, dropBoxLink);
                }

            }
            else if (appointmentToGet is BlockAppointment)
            {
                if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentUrl))
                {
                    appointmentExist = GetBlockAppointment(appointmentUrl, dropBoxLink);
                }
            }
            return appointmentExist;
        }
Пример #28
0
        private string SaveActualAppointment(string appointmentGuidUrl, Appointment appointmentToSave, DropBoxLink dropBoxLink)
        {
            AppEnum.ProviderType providerType = GetProviderType(appointmentToSave);
            string providerIntId = "";
            if (providerType == AppEnum.ProviderType.SingleProvider)
            {
                providerIntId = appointmentToSave.ProviderId[0].ToString();
            }
            if (appointmentToSave is PatientVisit)
            {
                if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuidUrl))
                {

                    return _patientVisitAppointmentDocument.SaveOrUpdate(FormatAppointmentUrl(_patientVisitAppointmentDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.PatientVisitAppointment, providerType.ToString()),
                                appointmentToSave.StartDateTime, providerIntId, appointmentGuidUrl, providerType), (PatientVisit)appointmentToSave);
                }
                return _patientVisitAppointmentDocument.SaveOrUpdate(appointmentGuidUrl, (PatientVisit)appointmentToSave);
            }
            if (appointmentToSave is BlockAppointment)
            {
                if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuidUrl))
                {
                    return _blockAppointmentDocument.SaveOrUpdate(FormatAppointmentUrl(_blockAppointmentDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.BlockAppointment, providerType.ToString()), appointmentToSave.StartDateTime, providerIntId, appointmentGuidUrl, providerType), (BlockAppointment)appointmentToSave);
                }
                return _blockAppointmentDocument.SaveOrUpdate(appointmentGuidUrl, (BlockAppointment)appointmentToSave);
            }
            if (appointmentToSave is OtherAppointment)
            {
                if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuidUrl))
                {
                    return _otherAppointmentDocument.SaveOrUpdate(FormatAppointmentUrl(_otherAppointmentDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.OtherAppointment, providerType.ToString()), appointmentToSave.StartDateTime, providerIntId, appointmentGuidUrl, providerType), (OtherAppointment)appointmentToSave);
                }
                return _otherAppointmentDocument.SaveOrUpdate(appointmentGuidUrl, (OtherAppointment)appointmentToSave);
            }
            return "";
        }
Пример #29
0
 /// <summary>
 /// Get all the patients in Patient Repository and given Assignment
 /// </summary>
 /// <returns></returns>
 public IList<Patient> GetAppointmentPatientList(DropBoxLink dropBoxlink)
 {
     return _patientDocument.GetAllPatientForAssignment(dropBoxlink);
 }
Пример #30
0
        private void SaveAppointment(string appointmentGuidUrl, Appointment toSaveAppointment, DropBoxLink dropBoxLink, bool isDateChanged, Appointment appointmentAlreadyExist, AppEnum.EditStatus occurenceStatus)
        {
            //  appointmentGuidUrl null
            if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentGuidUrl))
            { // create mode
                if (toSaveAppointment.Recurrence == null)
                { // save non Recurrence patient Visit Appointment
                    SaveActualAppointment("", toSaveAppointment, dropBoxLink);
                }
                else
                {// save Recurrence patient Visit Appointment
                    SaveActualAppointmentRecurrence("", toSaveAppointment, dropBoxLink);
                }
            }
            else
            {    // edit mode

                switch (occurenceStatus)
                {
                    case AppEnum.EditStatus.All:
                        DeleteAndCreateNewAppointment(toSaveAppointment, dropBoxLink, appointmentAlreadyExist);
                        break;
                    case AppEnum.EditStatus.Current:
                        if (isDateChanged)
                        {
                            // delete current appoint from reccurence & create new non recurring appointment
                            // from recurrence to new appointment (non-recurrence)
                            DeleteFromRecurrenceCreateNewNonRecurrenceAppointment(toSaveAppointment, dropBoxLink, appointmentAlreadyExist, occurenceStatus);
                        }
                        else
                        { // Update an appointment  from recurrence list
                            //toSaveAppointment.CreatedBy = appointmentAlreadyExist.CreatedBy;
                            //toSaveAppointment.CreatedTimeStamp = appointmentAlreadyExist.CreatedTimeStamp;
                            //toSaveAppointment.ChartTimeStamp = appointmentAlreadyExist.ChartTimeStamp;
                            //toSaveAppointment.Signature = appointmentAlreadyExist.Signature;
                            SetAppointmentAduitFieldsValues(toSaveAppointment, appointmentAlreadyExist);
                            toSaveAppointment.Recurrence = null;
                            toSaveAppointment.RecurrenceGroup = appointmentAlreadyExist.RecurrenceGroup;
                            SaveActualAppointment(appointmentGuidUrl, toSaveAppointment, dropBoxLink);
                        }
                        break;
                    case AppEnum.EditStatus.None:
                        //  Appointment from DB has no recurrence  but  Appointment  from edited has recurrence then  change is for Non Recurrence To Recurrence
                        if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.RecurrenceGroup) && (toSaveAppointment.Recurrence != null))
                        {
                            UpdateSaveAppointmentNonRecurrenceToRecurrence(appointmentGuidUrl, toSaveAppointment, dropBoxLink, appointmentAlreadyExist);
                        }
                        //  Patient Visit from DB has no recurrence  but Patient Visit from edited has no recurrence then  change is for Non Recurrence To non Recurrence
                        else if (AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.RecurrenceGroup) && (toSaveAppointment.Recurrence == null))
                        {
                            //toSaveAppointment.CreatedBy = appointmentAlreadyExist.CreatedBy;
                            //toSaveAppointment.CreatedTimeStamp = appointmentAlreadyExist.CreatedTimeStamp;
                            //toSaveAppointment.ChartTimeStamp = appointmentAlreadyExist.ChartTimeStamp;
                            //toSaveAppointment.Signature = appointmentAlreadyExist.Signature;

                            SetAppointmentAduitFieldsValues(toSaveAppointment, appointmentAlreadyExist);

                            if (isDateChanged)
                            {
                                DeleteAndCreateNewAppointment(toSaveAppointment, dropBoxLink, appointmentAlreadyExist);
                            }
                            else
                            {
                                SaveActualAppointment(appointmentGuidUrl, toSaveAppointment, dropBoxLink);
                            }
                        }
                        break;
                }

                //if (isDateChanged)
                //{ // if date changed in edit mode delete  all Recurrence and patient Visit Appointment list  and create new appointment
                //    DeleteAndCreateNewAppointment(appointmentGuidUrl, toSaveAppointment, dropBoxLink, appointmentAlreadyExist);
                //}
                //else
                //{ // if date not change then change need to be done only on current & fucutre date appointmnet.

                //    // Patient Visit from DB and Patient Visit from edited  both has Recurrence then  chnage is for Recurrence To Recurrence
                //    if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.RecurrenceGroup) && (toSaveAppointment.Recurrence != null))
                //    {
                //        UpdateSaveAppointmentRecurrenceToRecurrence(appointmentGuidUrl, toSaveAppointment, dropBoxLink, appointmentAlreadyExist);
                //    }
                //    //  Patient Visit from DB has recurrence  but Patient Visit from edited has no recurrence then  chnage is for Recurrence To non Recurrence
                //    else if (!AppCommon.CheckIfStringIsEmptyOrNull(appointmentAlreadyExist.RecurrenceGroup) && (toSaveAppointment.Recurrence == null))
                //    {
                //        UpdateSaveAppointmentRecurrenceToNonRecurrence(toSaveAppointment, dropBoxLink, appointmentAlreadyExist);
                //    }

                //}
            }
        }
Пример #31
0
 public BlockAppointment GetBlockAppointment(string appointmentUrl, DropBoxLink dropBoxLink)
 {
     //return _blockAppointmentDocument.Get(appointmentUrl);
     BlockAppointment blockAppointmentEdit = _blockAppointmentDocument.Get(appointmentUrl);
     if (!AppCommon.CheckIfStringIsEmptyOrNull(blockAppointmentEdit.RecurrenceGroup))
     {
         RecurrenceGroup blockRecurrenceExist = _recurrenceDocument.Get(FormatRecurrenceGroupUrl(_recurrenceDocument.GetAssignmentUrl(dropBoxLink, DocumentPath.Module.RecurrenceGroup), blockAppointmentEdit.RecurrenceGroup));
         blockAppointmentEdit.Recurrence = blockRecurrenceExist;
     }
     return blockAppointmentEdit;
 }