Пример #1
0
        /// <summary>
        /// Handles the Loaded event of the MainWindow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.IsValidToProcess)
            {
                //TODO: Login window
                LoginWindow loginWindow = new LoginWindow
                {
                    Owner = this,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                loginWindow.ShowDialog();

                //App.BaseUserControl.UserModel = new UserModel()
                //{
                //    UserId = 1,
                //    Name = "Patrick",
                //    UserType = 4,
                //    Username = "******"
                //};

                SetLabels();

                InitialControlSetup();
            }
            else
            {
                App.ShowMessage(false, " No internet access.\n Please check the connection.");
            }
        }
        private void DeleteConfirmaiton_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs)
        {
            if (eventArgs.Parameter.Equals("true"))
            {
                TranscriptionModel transcriptionModel = new TranscriptionModel()
                {
                    Id = TranscriptionId,
                };

                RequestModel requestModel = new RequestModel()
                {
                    TranscriptionModel = transcriptionModel,
                };

                ResponseModel response = App.BaseUserControl.InternalService.DeleteTranscription(requestModel);

                if (response.IsOperationSuccess)
                {
                    App.ShowMessageDeleteRecord(true, string.Empty);
                }
                else
                {
                    App.ShowMessage(false, response.ErrorMessage);
                }
            }
        }
        /// <summary>
        /// Populatrs the list.
        /// </summary>
        private void PopulateList()
        {
            RequestModel requestModel = new RequestModel()
            {
                FilterKeyWords = SearchList,
                SearchWord     = SearchWordTextBox.Text.Trim(),
                SearchRequest  = SearchRequest,
            };

            ResponseModel response = App.BaseUserControl.InternalService.GetTranscriptions(requestModel);

            if (response.IsOperationSuccess)
            {
                TranscriptionQueueListView.ItemsSource = response.Transcriptions;

                SetPagination(response.PaginationInfo);

                if (response.Transcriptions.Count == 0)
                {
                    SetZeroListMessage();
                }
                else
                {
                    SetPagination(response.PaginationInfo);
                }
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
Пример #4
0
        /// <summary>
        /// Handles the Click event of the FindAndReplaceButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void FindAndReplaceButton_Click(object sender, RoutedEventArgs e)
        {
            if (FormFindAndReplaceValidation())
            {
                WellKnownFindAndReplaceType field = WellKnownFindAndReplaceType.None;

                RequestModel requestModel = new RequestModel()
                {
                    FindReplaceModel = new FindReplaceModel()
                    {
                        Field       = field,
                        FindWord    = FindTextBox.Text,
                        ReplaceWord = ReplaceTextBox.Text
                    },
                };

                ResponseModel response = App.BaseUserControl.InternalService.FindReplace(requestModel);

                if (response.IsOperationSuccess)
                {
                    App.ShowMessage(true, response.ErrorMessage + " record(s) updated.");
                }
                else
                {
                    App.ShowMessage(false, response.ErrorMessage);
                }

                ClearData();
            }
            else
            {
                App.ShowMessage(false, "Fill find and replace words.");
            }
        }
        private void ProjectCodeTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            TextBox textBox = ((TextBox)sender);

            if (textBox != null && !string.IsNullOrEmpty(textBox.Text))
            {
                RequestModel requestModel = new RequestModel()
                {
                    TranscriptionModel = new TranscriptionModel()
                    {
                        ProjectCode = textBox.Text
                    },
                };

                ResponseModel response = App.BaseUserControl.InternalService.GetUniqueProjectCode(requestModel);

                if (!response.IsOperationSuccess)
                {
                    App.ShowMessage(false, response.ErrorMessage);

                    ProjectCodeTextBox.Focusable = true;
                    Keyboard.Focus(ProjectCodeTextBox);
                }
            }
        }
        /// <summary>
        /// Views the user.
        /// </summary>
        private void ViewUser()
        {
            RequestModel requestModel = new RequestModel()
            {
                UserModel = new UserModel()
                {
                    UserId = UserId
                },
            };

            ResponseModel response = App.BaseUserControl.InternalService.GetUser(requestModel);

            if (response.IsOperationSuccess)
            {
                UserModel user = response.UserModel;

                WellKnownUserType userType = (WellKnownUserType)user.UserType;

                UserTypeComboBox.SelectedIndex = user.UserType - 2;
                NameTextBox.Text     = user.Name;
                UsernameTextBox.Text = user.Username;
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
Пример #7
0
 /// <summary>
 /// Shows the message.
 /// </summary>
 /// <param name="response">The response.</param>
 private void ShowMessage(ResponseModel response)
 {
     if (response.IsOperationSuccess)
     {
         App.ShowMessage(true, string.Empty);
     }
     else
     {
         App.ShowMessage(false, response.ErrorMessage);
     }
 }
Пример #8
0
        /// <summary>
        /// Clears the database.
        /// </summary>
        private void ClearDatabase()
        {
            ResponseModel response = App.BaseUserControl.InternalService.ResetDatabase(null);

            if (response.IsOperationSuccess)
            {
                App.ShowMessage(true, "You successfully deleted \n records from database.");
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
Пример #9
0
        /// <summary>
        /// Views the user.
        /// </summary>
        private void ViewCollection()
        {
            RequestModel requestModel = new RequestModel()
            {
                CollectionId = CollectionId
            };

            ResponseModel response = App.BaseUserControl.InternalService.GetCollection(requestModel);

            if (response.IsOperationSuccess)
            {
                CollectionModel collection = response.Collection;

                ((CollectionUIModel)DataContext).SelectedRepository = collection.RepositoryId.ToString();

                CollectionNameTextBox.Text   = collection.CollectionName;
                NumberTextBox.Text           = collection.Number;
                DatesTextBox.Text            = collection.Dates;
                NotesTextBox.Text            = collection.Note;
                SubjectTextBox.Text          = collection.Subjects;
                KeywordsTextBox.Text         = collection.Keywords;
                DescriptionTextBox.Text      = collection.Description;
                ScopeAndContentTextBox.Text  = collection.ScopeAndContent;
                CustodialHistoryTextBox.Text = collection.CustodialHistory;
                SizeTextBox.Text             = collection.Size;
                AcquisitioninfoTextBox.Text  = collection.Acquisitioninfo;
                LanguageTextBox.Text         = collection.Language;

                PreservationNoteTextBox.Text   = collection.PreservationNote;
                RightsTextBox.Text             = collection.Rights;
                AccessRestrictionsTextBox.Text = collection.AccessRestrictions;
                PublicationRightsTextBox.Text  = collection.PublicationRights;

                PreferredCitationTextBox.Text = collection.PreferredCitation;
                RelatedCollectionTextBox.Text = collection.RelatedCollection;
                SeparatedMaterialTextBox.Text = collection.SeparatedMaterial;
                OriginalLocationTextBox.Text  = collection.OriginalLocation;
                CopiesLocationTextBox.Text    = collection.CopiesLocation;
                PublicationNoteTextBox.Text   = collection.PublicationNote;
                CreatorTextBox.Text           = collection.Creator;
                ContributorsTextBox.Text      = collection.Contributors;
                ProcessedByTextBox.Text       = collection.ProcessedBy;
                SponsorsTextBox.Text          = collection.Sponsors;
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
Пример #10
0
        private void ExportAllSubseries()
        {
            ResponseModel response = App.BaseUserControl.InternalService.ExportAllSubseries(null);

            ExportHelper helper = new ExportHelper();

            helper.ExportAllSubseries(response.Subseries);

            if (response.IsOperationSuccess)
            {
                App.ShowMessage(true, "You successfully exports \n records from database.");
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
Пример #11
0
        /// <summary>
        /// Handles the Click event of the FindAndReplaceFieldButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void FindAndReplaceFieldButton_Click(object sender, RoutedEventArgs e)
        {
            if (FormFindAndReplaceFieldValidation())
            {
                WellKnownFindAndReplaceType field = WellKnownFindAndReplaceType.None;

                if (!string.IsNullOrEmpty(FieldsComboBox.SelectedValue.ToString()))
                {
                    field = (WellKnownFindAndReplaceType)Enum.Parse(typeof(WellKnownFindAndReplaceType), FieldsComboBox.SelectedValue.ToString(), true);
                }

                RequestModel requestModel = new RequestModel()
                {
                    FindReplaceModel = new FindReplaceModel()
                    {
                        Field       = field,
                        FindWord    = FindFieldWordTextBox.Text,
                        ReplaceWord = ReplaceFieldWordTextBox.Text
                    },
                };

                ResponseModel response = App.BaseUserControl.InternalService.FindReplace(requestModel);

                if (response.IsOperationSuccess)
                {
                    App.ShowMessage(true, response.ErrorMessage + " record(s) updated.");
                }
                else
                {
                    App.ShowMessage(false, response.ErrorMessage);
                }

                ClearData();
            }
            else
            {
                App.ShowMessage(false, "Fill find, field and replace words.");
            }
        }
Пример #12
0
        /// <summary>
        /// Handles the Click event of the SaveUserDetails control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void SaveUserDetails_Click(object sender, RoutedEventArgs e)
        {
            if (FormValidation())
            {
                //short collectionId = short.Parse(CollectionComboBox.SelectedValue.ToString());

                if (IsAddNewRecord)
                {
                    RequestModel requestModel = new RequestModel()
                    {
                        SubseryModel = GetSubseriesModel(true),

                        WellKnownModificationType = Core.Enums.WellKnownModificationType.Add,
                    };

                    ResponseModel response = App.BaseUserControl.InternalService.ModifySubseries(requestModel);

                    ShowMessage(response);
                }
                else
                {
                    RequestModel requestModel = new RequestModel()
                    {
                        SubseryModel = GetSubseriesModel(false),

                        WellKnownModificationType = Core.Enums.WellKnownModificationType.Edit,
                    };

                    ResponseModel response = App.BaseUserControl.InternalService.ModifySubseries(requestModel);

                    ShowMessage(response);
                }
            }
            else
            {
                App.ShowMessage(false, "Fill all the fields.");
            }
        }
        /// <summary>
        /// Handles the Click event of the ResetPassword control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void ResetPassword_Click(object sender, RoutedEventArgs e)
        {
            RequestModel requestModel = new RequestModel()
            {
                UserModel = new UserModel()
                {
                    UserId = UserId
                },

                WellKnownModificationType = Core.Enums.WellKnownModificationType.Reset,
            };

            ResponseModel response = App.BaseUserControl.InternalService.ModifyUser(requestModel);

            if (response.IsOperationSuccess)
            {
                App.ShowMessage(true, string.Empty);
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
        /// <summary>
        /// Updates the transcription.
        /// </summary>
        /// <param name="transcriptionModel">The transcription model.</param>
        /// <param name="modificationType">Type of the modification.</param>
        private void UpdateTranscription(TranscriptionModel transcriptionModel, WellKnownTranscriptionModificationType modificationType)
        {
            transcriptionModel.Id          = TranscriptionId;
            transcriptionModel.UpdatedBy   = App.BaseUserControl.UserModel.UserId;
            transcriptionModel.UpdatedDate = DateTime.Now;

            RequestModel requestModel = new RequestModel()
            {
                TranscriptionModel = transcriptionModel,
                WellKnownTranscriptionModificationType = modificationType,
                WellKnownModificationType = WellKnownModificationType.Edit,
            };

            ResponseModel response = App.BaseUserControl.InternalService.ModifyTranscription(requestModel);

            if (response.IsOperationSuccess)
            {
                App.ShowMessage(true, string.Empty);
            }
            else
            {
                App.ShowMessage(false, response.ErrorMessage);
            }
        }
Пример #15
0
        /// <summary>
        /// Handles the Click event of the SaveUserDetails control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void SaveCollectionDetails_Click(object sender, RoutedEventArgs e)
        {
            if (FormValidation())
            {
                if (IsAddNewRecord)
                {
                    RequestModel requestModel = new RequestModel()
                    {
                        CollectionModel = GetCollectionModel(true),

                        WellKnownModificationType = Core.Enums.WellKnownModificationType.Add,
                    };

                    ResponseModel response = App.BaseUserControl.InternalService.ModifyCollection(requestModel);

                    ShowMessage(response);
                }
                else
                {
                    RequestModel requestModel = new RequestModel()
                    {
                        CollectionModel = GetCollectionModel(false),

                        WellKnownModificationType = Core.Enums.WellKnownModificationType.Edit,
                    };

                    ResponseModel response = App.BaseUserControl.InternalService.ModifyCollection(requestModel);

                    ShowMessage(response);
                }
            }
            else
            {
                App.ShowMessage(false, "Fill all the fields.");
            }
        }
        /// <summary>
        /// Handles the Click event of the InterviewSubmitButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void InterviewSubmitButton_Click(object sender, RoutedEventArgs e)
        {
            if (FormValidation())
            {
                bool isANewAudioEquipment = !string.IsNullOrEmpty(AudioEquipmentUsedFilteredComboBox.Text) &&
                                            !BaseUserControl.AudioEquipments.Contains(AudioEquipmentUsedFilteredComboBox.Text);

                bool isANewVideoEquipment = !string.IsNullOrEmpty(VideoEquipmentUsedFilteredComboBox.Text) &&
                                            !BaseUserControl.VideoEquipments.Contains(VideoEquipmentUsedFilteredComboBox.Text);

                Collection collectionModel = (Collection)CollectionComboBox.SelectedValue;

                KeyValuePair <int, string> subseryModel = (KeyValuePair <int, string>)SubseriesComboBox.SelectedValue;

                string interviewerName = InterviewerFilteredComboBox.Text +
                                         (!string.IsNullOrEmpty(InterviewerFilteredComboBox1.Text) ? "; " + InterviewerFilteredComboBox1.Text : string.Empty) +
                                         (!string.IsNullOrEmpty(InterviewerFilteredComboBox2.Text) ? "; " + InterviewerFilteredComboBox2.Text : string.Empty);

                RequestModel requestModel = new RequestModel()
                {
                    TranscriptionModel = new TranscriptionModel()
                    {
                        Title               = " ",
                        CollectionId        = (short)collectionModel.Id,
                        CreatedBy           = App.BaseUserControl.UserModel.UserId,
                        CreatedDate         = DateTime.Today,
                        Description         = DescriptionTextBox.Text,
                        AudioEquipmentUsed  = AudioEquipmentUsedFilteredComboBox.Text,
                        VideoEquipmentUsed  = VideoEquipmentUsedFilteredComboBox.Text,
                        InterviewDate       = ((DateTime)InterviewDateDateDatePicker.SelectedDate).ToShortDateString(),
                        InterviewDate1      = (InterviewDateDateDatePicker1.SelectedDate != null) ? ((DateTime)InterviewDateDateDatePicker1.SelectedDate).ToShortDateString() : string.Empty,
                        InterviewDate2      = (InterviewDateDateDatePicker2.SelectedDate != null) ? ((DateTime)InterviewDateDateDatePicker2.SelectedDate).ToShortDateString() : string.Empty,
                        Interviewee         = IntervieweeTextBox.Text,
                        Interviewer         = interviewerName,
                        InterviewerNote     = NoteTextBox.Text,
                        IsAudioFormat       = (bool)MediaAudioCheckBox.IsChecked,
                        IsRestriction       = (bool)RestrictionYesCheckBox.IsChecked,
                        IsVideoFormat       = (bool)MediaVideoCheckBox.IsChecked,
                        Keywords            = KeywordsTextBox.Text,
                        RestrictionNote     = RestrictionNoteTextBox.Text,
                        Place               = PlaceTextBox.Text,
                        ReleaseForm         = (bool)ReleaseFromYesCheckBox.IsChecked,
                        Subject             = SubjectTextBox.Text,
                        SubseriesId         = subseryModel.Key,
                        ProjectCode         = ProjectCodeTextBox.Text,
                        TranscriberAssigned = TranscriberAssignedTextBox.Text,
                        EquipmentNumber     = string.Empty,
                        MetadataDraft       = string.Empty,
                        UpdatedBy           = App.BaseUserControl.UserModel.UserId,
                        UpdatedDate         = DateTime.Today,

                        IsANewAudioEquipment = isANewAudioEquipment,
                        IsANewVideoEquipment = isANewVideoEquipment,
                        IsBornDigital        = (bool)BornDigitalYesCheckBox.IsChecked,
                    },

                    WellKnownModificationType = Core.Enums.WellKnownModificationType.Add,
                };

                ResponseModel response = App.BaseUserControl.InternalService.ModifyTranscription(requestModel);

                if (response.IsOperationSuccess)
                {
                    App.ShowMessage(true, string.Empty);

                    ClearAll();


                    PopulateFilterTextBox();
                }
                else
                {
                    App.ShowMessage(false, response.ErrorMessage);
                }
            }
            else
            {
                App.ShowMessage(false, "Fill all required fields.");
            }
        }
        /// <summary>
        /// Handles the Click event of the UploadButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void UploadButton_Click(object sender, RoutedEventArgs e)
        {
            ClearError();

            string filePath = fileUploadLabel.Content.ToString();

            try
            {
                if (!string.IsNullOrEmpty(filePath))
                {
                    fileUploadLabel.Content = filePath;

                    DataTable dt = ReadExcelFile(filePath);

                    if (IsColumnExists(dt))
                    {
                        List <TranscriptionModel> transcriptionModels = new List <TranscriptionModel>();

                        int recordcount = 1;


                        foreach (DataRow item in dt.Rows)
                        {
                            string interviewee = GetStringValue(item, IntervieweeColumnName);

                            try
                            {
                                recordcount++;

                                // Reading and matching the collection name
                                string collectionName = GetStringValue(item, CollectionColumnName);

                                CollectionModel collection = App.BaseUserControl.Collections.FirstOrDefault(c => c.CollectionName.Contains(collectionName));

                                short collectionId = 0;

                                if (collection != null)
                                {
                                    collectionId = (short)collection.Id;
                                }
                                else
                                {
                                    throw new Exception("collection not found '" + collectionName + "'");
                                }

                                // Reading and matching the subseries name
                                List <SubseryModel> subseriesList = App.BaseUserControl.Subseries.FindAll(s => s.CollectionId == collectionId);
                                int subseriesId = 0;
                                if (subseriesList != null)
                                {
                                    string subseriesName = GetStringValue(item, SubseriesColumnName);

                                    SubseryModel subseries = subseriesList.FirstOrDefault(c => c.SubseryName.Contains(subseriesName));

                                    SubseryModel nAsubseries = subseriesList.FirstOrDefault(s => s.SubseryName.Equals("N/A"));

                                    if (subseries != null)
                                    {
                                        subseriesId = (short)subseries.Id;
                                    }
                                    else if (nAsubseries != null)
                                    {
                                        subseriesId = (short)nAsubseries.Id;
                                    }
                                    else
                                    {
                                        throw new Exception("subseries not found '" + subseriesName + "'");
                                    }
                                }

                                TranscriptionModel transcriptionModel = new TranscriptionModel()
                                {
                                    CollectionId         = collectionId,
                                    ConvertToDigitalDate = GetDateValue(item, DateDigitalColumnName),
                                    CoverageSpatial      = GetStringValue(item, CoverageSpatialColumnName),
                                    CoverageTemporal     = GetStringValue(item, CoverageTemporalColumnName),
                                    CreatedBy            = App.BaseUserControl.UserModel.UserId,
                                    CreatedDate          = DateTime.Now,
                                    Description          = GetStringValue(item, DescriptionColumnName),
                                    TranscriptNote       = GetStringValue(item, TranscriptionNotesColumnName),
                                    EquipmentNumber      = GetStringValue(item, EquipmentNumberColumnName),
                                    MetadataDraft        = GetStringValue(item, MetadataDraftColumnName),

                                    Format = GetStringValue(item, FormatColumnName),

                                    Interviewee         = interviewee,
                                    Interviewer         = GetStringValue(item, InterviewerColumnName),
                                    InterviewerNote     = GetStringValue(item, InterviewerNotesColumnName),
                                    IsAccessMediaStatus = CheckStringContains(GetStringValue(item, AccessMediaStatusColumnName), "complete"),

                                    IsBornDigital      = GetBoolValue(item, BornDigitalColumnName),
                                    IsConvertToDigital = GetBoolValue(item, ConvertedColumnName),
                                    IsOnline           = GetBoolValue(item, OnlineColumnName),
                                    IsPriority         = false,
                                    IsRestriction      = GetBoolValue(item, RestrictionsColumnName),
                                    RestrictionNote    = GetStringValue(item, RestrictionNotesColumnName),
                                    IsDarkArchive      = false,
                                    AudioEquipmentUsed = GetStringValue(item, AudioEquipmentUsedColumnName),
                                    VideoEquipmentUsed = GetStringValue(item, VideoEquipmentUsedColumnName),

                                    IsVideoFormat = !string.IsNullOrEmpty(GetStringValue(item, VideoEquipmentUsedColumnName)) ? true : false,
                                    IsAudioFormat = !string.IsNullOrEmpty(GetStringValue(item, AudioEquipmentUsedColumnName)) ? true : false,

                                    IsRosetta     = false,
                                    IsRosettaForm = false,
                                    Keywords      = GetStringValue(item, KeywordColumnName),
                                    Language      = GetStringValue(item, LanguageColumnName),

                                    OriginalMediumType = 1,
                                    ProjectCode        = GetStringValue(item, ProjectCodeColumnName),
                                    Publisher          = GetStringValue(item, PublisherColumnName),

                                    ReleaseForm         = GetBoolValue(item, ReleaseFormColumnName),
                                    Rights              = GetStringValue(item, RightsColumnName),
                                    ScopeAndContents    = GetStringValue(item, ScopeAndContentsColumnName),
                                    Subject             = GetStringValue(item, SubjectColumnName),
                                    SubseriesId         = subseriesId,
                                    TranscriberAssigned = GetStringValue(item, TranscriberAssignedColumnName),
                                    TranscriptStatus    = true,
                                    Place = GetStringValue(item, LocationOfInterviewColumnName),
                                    Title = GetStringValue(item, TitleColumnName),
                                    Type  = GetStringValue(item, TypeColumnName),
                                    InterviewerDescription = GetStringValue(item, InterviewerDescriptionColumnName),
                                    InterviewerKeywords    = GetStringValue(item, InterviewerKeywordsColumnName),
                                    InterviewerSubjects    = GetStringValue(item, InterviewerSubjectsColumnName),

                                    RelationIsPartOf = GetStringValue(item, RelationIsPartOfColumnName),

                                    SentOut = GetBoolValue(item, SentOutColumnName),

                                    UpdatedBy   = App.BaseUserControl.UserModel.UserId,
                                    UpdatedDate = DateTime.Now,
                                };

                                SetDates(ref transcriptionModel, item);


                                transcriptionModels.Add(transcriptionModel);
                            }
                            catch (Exception ex)
                            {
                                //TextBlock tb = new TextBlock
                                //{
                                //    TextWrapping = TextWrapping.Wrap,
                                //    Margin = new Thickness(10)
                                //};

                                //tb.Inlines.Add(new Run("Row id-") { FontWeight = FontWeights.Bold });
                                //tb.Inlines.Add(recordcount.ToString());

                                //tb.Inlines.Add(new Run(" interviewee-") { FontWeight = FontWeights.Bold });
                                //tb.Inlines.Add(interviewee);

                                //tb.Inlines.Add(new Run(" error-") { FontWeight = FontWeights.Bold });
                                //tb.Inlines.Add(ex.Message + "\n");
                                //this.Content = tb;

                                StatTextBox.Text += "Row id-" + recordcount + " interviewee-" + interviewee + " error -" + ex.Message + "\n";
                            }
                        }

                        RequestModel requestModel = new RequestModel()
                        {
                            TranscriptionModels = transcriptionModels,
                        };

                        ResponseModel response = App.BaseUserControl.InternalService.ImportTranscription(requestModel);

                        if (response.IsOperationSuccess)
                        {
                            App.BaseUserControl.InitializeComponent(false);

                            App.ShowMessage(true, response.ErrorMessage);
                        }
                        else
                        {
                            App.ShowMessage(false, response.ErrorMessage);
                        }

                        ClearAll();
                    }
                }
                else
                {
                    App.ShowMessage(false, "Browse and select the file first.");
                }
            }
            catch (Exception ex)
            {
                App.ShowMessage(false, "Upload the correct formatted excel file. \n " + ex.Message);
            }
        }
        /// <summary>
        /// Handles the Click event of the SaveUserDetails control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void SaveUserDetails_Click(object sender, RoutedEventArgs e)
        {
            if (FormValidation())
            {
                ComboBoxItem ComboItem = (ComboBoxItem)UserTypeComboBox.SelectedItem;

                WellKnownUserType userType = (WellKnownUserType)Enum.Parse(typeof(WellKnownUserType), ComboItem.Name);

                if (IsAddNewRecord)
                {
                    RequestModel requestModel = new RequestModel()
                    {
                        UserModel = new UserModel()
                        {
                            UserId   = UserId,
                            Name     = NameTextBox.Text,
                            Username = UsernameTextBox.Text,
                            UserType = (byte)userType,
                            Password = PasswordTextBox.SecurePassword,
                        },

                        WellKnownModificationType = Core.Enums.WellKnownModificationType.Add,
                    };

                    ResponseModel response = App.BaseUserControl.InternalService.ModifyUser(requestModel);

                    if (response.IsOperationSuccess)
                    {
                        App.ShowMessage(true, string.Empty);
                    }
                    else
                    {
                        App.ShowMessage(false, response.ErrorMessage);
                    }
                }
                else
                {
                    RequestModel requestModel = new RequestModel()
                    {
                        UserModel = new UserModel()
                        {
                            UserId   = UserId,
                            Name     = NameTextBox.Text,
                            Username = UsernameTextBox.Text,
                            UserType = (byte)userType,
                        },

                        WellKnownModificationType = Core.Enums.WellKnownModificationType.Edit,
                    };

                    ResponseModel response = App.BaseUserControl.InternalService.ModifyUser(requestModel);

                    if (response.IsOperationSuccess)
                    {
                        App.ShowMessage(true, string.Empty);
                    }
                    else
                    {
                        App.ShowMessage(false, response.ErrorMessage);
                    }
                }
            }
            else
            {
                App.ShowMessage(false, "Fill all the fields.");
            }
        }