Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
 private void Aplication_CreateDefault()
 {
     //Create new document if there are now documents at this time
     if (Globals.ThisAddIn.Application.Documents.Count <= 0)
     {
         Globals.ThisAddIn.Application.Documents.Add();
     }
     WordProcessingHelper.CreateDefaultDocumentStyle(Globals.ThisAddIn.Application.ActiveDocument);
 }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        private void Btn_ListSession_Click(object sender, RibbonControlEventArgs e)
        {
            if (AppsSettings.GetInstance().isLogin == false)
            {
                MessageBox.Show("Bạn phải đăng nhập trước khi sử dụng", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (AppsSettings.GetInstance().Session != null)
                {
                    DialogResult dialogResult = CreateInformationDialog.CreateConfirmBoxWithTwoButton(
                        "Bạn đang mở phiên họp. Bạn có muốn lưu lại nội dung phiên họp hiện tại không?",
                        "Cảnh bảo");
                    if (dialogResult == DialogResult.Yes)
                    {
                        SaveDocumentToRemoteServer(false);
                    }
                }

                DialogResult result = DialogResult.OK;
                result = this.mSessionListForm.CustomDialogShow();
                if (result == DialogResult.OK)
                {
                    ///Create new document and save as new file
                    Word.Document document = Globals.ThisAddIn.Application.ActiveDocument;
                    AppsSettings.GetInstance().DocumentName = null; //To prevent save unknow document
                    WordProcessingHelper.SaveNewSessionDocument(AppsSettings.GetInstance().Session, document);
                    ///Create default document
                    WordProcessingHelper.CreateDocumentTitle(document,
                                                             AppsSettings.GetInstance().Session);
                    AppsSettings.GetInstance().DocumentName = document.FullName;
                    //Get document Entity
                    DocumentEntity documentEntity = Request.getMergedDocument(AppsSettings.GetInstance().Session.idSession);
                    WordProcessingHelper.InsertDataToMergedDocument(document, documentEntity);
                    ///Load predefine data
                    mRepresentativeForm.FillingData();
                    AppsSettings.GetInstance().IsRepresentativeSplit = false;
                    this.FocusMainDocument();
                    this.ActiveControl();
                }
            }
        }
Exemplo n.º 5
0
        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 On_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Debug.WriteLine("On_CellDoubleClick");
            if (e.RowIndex >= this.DGV_SplitRepresentative.Rows.Count ||
                e.RowIndex < 0)
            {
                return;
            }
            string representative_name = (string)this.DGV_SplitRepresentative.Rows[e.RowIndex].Cells["Representative_Name"].Value;
            string representative_duty = (string)this.DGV_SplitRepresentative.Rows[e.RowIndex].Cells["Representative_Duty"].Value;
            List <DocumentParagraph> representativeDocumentParagraphs = new List <DocumentParagraph>();

            foreach (DocumentParagraph para in this.mDocumentEntity.paragraphs)
            {
                if (para.belongTo != null &&
                    Utils.FormatRepresentative(para.belongTo.name, para.belongTo.duty).Equals(
                        Utils.FormatRepresentative(representative_name, representative_duty)))
                {
                    ///Generate document here
                    representativeDocumentParagraphs.Add(para);
                }
            }
            if (representativeDocumentParagraphs.Count > 0)
            {
                Word.Document newDocument = Globals.ThisAddIn.Application.Documents.Add();
                WordProcessingHelper.SaveRepresentativeDocument(AppsSettings.GetInstance().Session, newDocument, representativeDocumentParagraphs[0].belongTo.name);
                WordProcessingHelper.CreateDefaultDocumentStyle(newDocument);
                WordProcessingHelper.CreateDocumentTitle(newDocument, AppsSettings.GetInstance().Session);
                WordProcessingHelper.GenerateRepresentativeDocument(representativeDocumentParagraphs, newDocument);
                newDocument.Save();
            }
            else
            {
            }

            DialogResult = DialogResult.OK;
        }
Exemplo n.º 7
0
        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;
        }