private void Btn_Undo_Click(object sender, RibbonControlEventArgs e) { DialogResult dialogResult = CreateInformationDialog.CreateConfirmBoxWithTwoButton( "Bạn có chắc chắn muốn thu hồi phiên họp từ hệ thống 3G?", "Xác nhận"); if (dialogResult == DialogResult.Yes) { if (AppsSettings.GetInstance().Session != null) { Boolean deleteResult = Request.RemoteGGGSession(AppsSettings.GetInstance().Session.idSession); if (deleteResult == true) { NotificationFactor.InfoNotification("Thu hồi phiên thành công"); } else { NotificationFactor.ErrorNotification("Thu hồi phiên thất bại"); } } else { NotificationFactor.ErrorNotification("Thu hồi phiên thất bại"); } } }
private void btn_ResetAll_Click(object sender, RibbonControlEventArgs e) { DialogResult dialogResult = CreateInformationDialog.CreateConfirmBoxWithTwoButton("" + "Tổng hợp lại toàn bộ sẽ xóa toàn bộ thay đổi trên tệp tổng hợp và ghép lại các băng đã được kiểm duyệt. Bạn có muốn tiếp tục?", "Cảnh báo"); try { if (dialogResult == DialogResult.Yes && AppsSettings.GetInstance().Session != null) { Debug.WriteLine("Xoa toan bo"); ///1. Reset merged request bool resetMergedStatus = Request.ResetMergeDocument(AppsSettings.GetInstance().Session.idSession); if (resetMergedStatus == true) { ///Call remerged document //2. Goi ham merge doc AudioEntity entity = Request.GetParentAudioByIdSession(AppsSettings.GetInstance().Session.idSession); if (entity == null) { CreateInformationDialog.CreateWarningBox("Không tồn tại tệp âm thanh tổng hợp", "cảnh báo"); } else { Boolean isRequestSuccessful = Request.RequestMerge(entity.idAudio); if (isRequestSuccessful == true) { NotificationFactor.InfoNotification("Tổng hợp biên bản thành công"); } else { NotificationFactor.ErrorNotification("Tổng hợp biên bản thất bại"); } } //3.Goi ham lay lai du lieu //Get document Entity DocumentEntity documentEntity = Request.getMergedDocument(AppsSettings.GetInstance().Session.idSession); //4.Clear current document AppsSettings.GetInstance().DocumentName = null; // To avoid save document when call the saveAs method Word.Document document = Globals.ThisAddIn.Application.ActiveDocument; WordProcessingHelper.SaveNewSessionDocument(AppsSettings.GetInstance().Session, document); WordProcessingHelper.CreateDocumentTitle(document, AppsSettings.GetInstance().Session); //4. day du lieu ra ma hinh WordProcessingHelper.InsertDataToMergedDocument(Globals.ThisAddIn.Application.ActiveDocument, documentEntity); AppsSettings.GetInstance().IsRepresentativeSplit = false; AppsSettings.GetInstance().DocumentName = document.FullName; } else { NotificationFactor.ErrorNotification("Không thể tổng hợp lại biên bản"); } } } catch (Exception ex) { NotificationFactor.ErrorNotification("Không thể tổng hợp lại biên bản"); } }
private void SaveDocumentToRemoteServer(bool isNotify = true) { try { //1. Luu lai cac thay doi ///Kiem tra xem co thay doi nao khoong, neu co, luu lai thay doi if (AppsSettings.GetInstance().isLogin == true) { Word.Document document = Globals.ThisAddIn.Application.ActiveDocument; /*string missingName; * if (WordProcessingHelper.CheckRepresentativeList(document, * mRepresentativeForm.GetRepresentativeList(), out missingName) == false) * { * //Tai lai danh sach * mRepresentativeForm.FillingData(); * if (WordProcessingHelper.CheckRepresentativeList(document, * mRepresentativeForm.GetRepresentativeList(), out missingName) == false) * { * ///Notify nguoi dung tao moi * DialogResult result = CreateInformationDialog.CreateConfirmBoxWithTwoButton("Không tìm thấy đại biểu: " + missingName + " Bạn có muốn thêm mới?", "Cảnh báo"); * if (result == DialogResult.Yes) * { * System.Diagnostics.Process.Start(AppsSettings.GetInstance().ApiUrl + "/quan-ly-dai-bieu"); * } * } * }*/ DocumentEntity documentEntity = WordProcessingHelper.ParsingDocument( document, mRepresentativeForm.GetRepresentativeList()); documentEntity.sessionId = AppsSettings.GetInstance().Session.idSession; Request.SaveDocument(documentEntity); if (isNotify) { NotificationFactor.InfoNotification("Lưu nội dung thành công"); } } else { if (isNotify) { NotificationFactor.WarningNotification("Không thể lưu văn bản do chưa đăng nhập"); } } } catch (Exception e) { if (isNotify) { NotificationFactor.ErrorNotification("Lưu nội dung thất bại"); } } this.FocusMainDocument(); }
private void Btn_Spit_Click(object sender, RibbonControlEventArgs e) { try { Word.Document document = Globals.ThisAddIn.Application.ActiveDocument; string missingName; if (WordProcessingHelper.CheckRepresentativeList(document, mRepresentativeForm.GetRepresentativeList(), out missingName) == false) { //Tai lai danh sach mRepresentativeForm.FillingData(); if (WordProcessingHelper.CheckRepresentativeList(document, mRepresentativeForm.GetRepresentativeList(), out missingName) == false) { ///Notify nguoi dung tao moi DialogResult result = CreateInformationDialog.CreateConfirmBoxWithTwoButton("Không tìm thấy đại biểu: " + missingName + " Bạn có muốn thêm mới?", "Cảnh báo"); if (result == DialogResult.Yes) { System.Diagnostics.Process.Start(AppsSettings.GetInstance().ApiUrl + "/quan-ly-dai-bieu"); } return; } } DocumentEntity documentEntity = WordProcessingHelper.ParsingDocument( document, mRepresentativeForm.GetRepresentativeList()); ///Save document to server documentEntity.sessionId = AppsSettings.GetInstance().Session.idSession; Request.SaveDocument(documentEntity); ///Call API to split representative Request.RequestSplitRepresentative(AppsSettings.GetInstance().Session.idSession); mRepresentativeSplitForm.InitDataFormIntoForm(documentEntity); mRepresentativeSplitForm.ShowDialog(); AppsSettings.GetInstance().IsRepresentativeSplit = true; } catch (Exception ee) { NotificationFactor.ErrorNotification("Không thể tách lời đại biểu"); } }
private void Btn_Export_Click(object sender, RibbonControlEventArgs e) { if (AppsSettings.GetInstance().IsRepresentativeSplit == true) { mExportForm.LoadingData(); DialogResult dialogResult = mExportForm.ShowDialog(); if (dialogResult == DialogResult.OK) { NotificationFactor.InfoNotification("Xuất bản thành công"); } else if (dialogResult == DialogResult.No) { NotificationFactor.ErrorNotification("Xuất bản thất bại"); } } else { CreateInformationDialog.CreateWarningBox("Bạn chưa tách lời đại biểu. Tách lời đại biểu trước khi xuất bản.", "cảnh báo"); } }
private void Btn_Merge_Click(object sender, RibbonControlEventArgs e) { Cursor.Current = Cursors.WaitCursor; try { Word.Document document = Globals.ThisAddIn.Application.ActiveDocument; //0. Kiem tra danh sach dai bieu /*string missingName; * if (WordProcessingHelper.CheckRepresentativeList(document, * mRepresentativeForm.GetRepresentativeList(), out missingName) == false) * { * //Tai lai danh sach * mRepresentativeForm.FillingData(); * if (WordProcessingHelper.CheckRepresentativeList(document, * mRepresentativeForm.GetRepresentativeList(), out missingName) == false) * { * ///Notify nguoi dung tao moi * DialogResult result = CreateInformationDialog.CreateConfirmBoxWithTwoButton("Không tìm thấy đại biểu: " + missingName + " Bạn có muốn thêm mới?", "Cảnh báo"); * if (result == DialogResult.Yes) * { * System.Diagnostics.Process.Start(AppsSettings.GetInstance().ApiUrl + "/quan-ly-dai-bieu"); * } * } * }*/ //1. Luu lai cac thay doi ///Kiem tra xem co thay doi nao khoong, neu co, luu lai thay doi /*DocumentEntity documentEntity = WordProcessingHelper.ParsingDocument( * document, mRepresentativeForm.GetRepresentativeList()); * documentEntity.sessionId = AppsSettings.GetInstance().Session.idSession; * Request.SaveDocument(documentEntity);*/ //2. Goi ham merge doc AudioEntity entity = Request.GetParentAudioByIdSession(AppsSettings.GetInstance().Session.idSession); if (entity == null) { CreateInformationDialog.CreateWarningBox("Không tồn tại tệp âm thanh tổng hợp", "cảnh báo"); } else { DocumentEntity mergedDocument = Request.RequestMergeAndGetResult(entity.idAudio); if (mergedDocument == null) { NotificationFactor.ErrorNotification("Tổng hợp biên bản thất bại"); return; } //3.Goi ham lay lai du lieu //Get document Entity //documentEntity = Request.getMergedDocument(AppsSettings.GetInstance().Session.idSession); //4.Clear current document //TextHelpers.RemoveContent(document); //4. day du lieu ra ma hinh WordProcessingHelper.InsertDataToEndDocument(Globals.ThisAddIn.Application.ActiveDocument, mergedDocument); AppsSettings.GetInstance().IsRepresentativeSplit = false; NotificationFactor.InfoNotification("Tổng hợp biên bản thành công"); } } catch (Exception ee) { NotificationFactor.ErrorNotification("Tổng hợp biên bản thất bại"); } Cursor.Current = Cursors.Default; }