/// <summary> /// Download the corresponding template /// </summary> /// <param name="item">document item parameter</param> private void DownloadCertificateExcelFile(string path) { //if item null, downoad new word template var serviceUri = System.Windows.Application.Current.Host.Source.AbsoluteUri; string currentUri = serviceUri.Replace(serviceUri.Split('/').Last(), ""); currentUri = currentUri.Replace("ClientBin/", ""); string fullFilePath = string.Format("{0}DownloadFile.aspx?ExportDocument={1}", currentUri, path); Uri url = new Uri(fullFilePath); if (App.Current.IsRunningOutOfBrowser) { MyHyperlinkButton button = new MyHyperlinkButton(); button.NavigateUri = url; button.TargetName = "_blank"; button.ClickMe(); } else System.Windows.Browser.HtmlPage.Window.Navigate(url, "_newWindow", "toolbar=0,menubar=0,resizable=1,scrollbars=1,top=0,left=0"); }
/// <summary> /// Display certificate file /// </summary> /// <param name="item">Document file information</param> public void DisplayCertificateFile(Document item) { if (item == null) { AlertDisplay(Strings.CertificateNotHaveDocumentDisplay); return; } string path = string.Concat(App.CurrentUser.FilePath, item.FilePath, item.Filename).Replace("/", "\\"); //Check if it is border agent and try to open a document of different entry point, return document using a webpage bool isBorderAgent = App.CurrentUser.IsInRole(UserRoleEnum.BorderAgent, UserRoleEnum.LOAdmin); bool isFileFromServer = false; //This applies for border agents less agents of LO entrypoint. LO entry point always open files from its machine if (isBorderAgent && !App.CurrentUser.IsEntryPointLo) { if (App.CurrentUser.EntryPointId.HasValue && Certificate.EntryPointId.HasValue) { if (App.CurrentUser.EntryPointId != Certificate.EntryPointId) { path = GetUrlToOpenFileFromServer(item, path); isFileFromServer = true; } } } if (!isFileFromServer) { if (!File.Exists(@path)) { if (isBorderAgent) { path = GetUrlToOpenFileFromServer(item, path); isFileFromServer = true; } else { AlertDisplay(string.Concat(Strings.FileNotExist, item.Filename)); return; } } } if (App.Current.IsRunningOutOfBrowser) { MyHyperlinkButton button = new MyHyperlinkButton(); button.NavigateUri = new Uri(path); button.TargetName = "_blank"; button.ClickMe(); } else //this option not work for in browser System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(path), "_blank"); if (isFileFromServer) GlobalAccessor.Instance.MessageStatus = string.Format(Strings.OpeningDocumentFromServer, item.Filename); else GlobalAccessor.Instance.MessageStatus = string.Format(Strings.OpeningDocument, item.Filename); }
/// <summary> /// Display the corresponding view /// </summary> /// <param name="view">The xaml to be displayed. CrmsViews enum type</param> internal void GotoView(VocViews view) { switch (view) { case VocViews.CertificateList: if (_certificateList == null) _certificateList = new CertificateList(); MainContentControl.Content = _certificateList; GlobalAccessor.Instance.FillTopMenus(VocMenuGroup.All); break; case VocViews.UserAdministration: if (_userList == null) _userList = new UserList(); MainContentControl.Content = _userList; GlobalAccessor.Instance.FillTopMenus(VocMenuGroup.All); break; case VocViews.OfficeAdministration: if (_officeList == null) _officeList = new OfficeList(); MainContentControl.Content = _officeList; GlobalAccessor.Instance.FillTopMenus(VocMenuGroup.All); break; case VocViews.SecurityPaper: if (_securityPaperList == null) _securityPaperList = new SecurityPaperList(); MainContentControl.Content = _securityPaperList; GlobalAccessor.Instance.FillTopMenus(VocMenuGroup.All); break; case VocViews.Help: MyHyperlinkButton button = new MyHyperlinkButton(); button.NavigateUri = new Uri(Strings._UrlHelp); button.TargetName = "_blank"; button.ClickMe(); GlobalAccessor.Instance.FillTopMenus(VocMenuGroup.All); break; default: break; } }
/// <summary> /// Callback method for ViewReleaseNote /// </summary> /// <param name="operation">Operation</param> private void CompletedViewReleaseNote(InvokeOperation<Document> operation) { HandleInvokeOperation(operation, delegate { IsBusy = false; if (operation.Value != null) { Document doc = operation.Value; var serviceUri = System.Windows.Application.Current.Host.Source.AbsoluteUri; string currentUri = serviceUri.Replace(serviceUri.Split('/').Last(), ""); currentUri = currentUri.Replace("ClientBin/", ""); string fullFilePath = string.Format("{0}DownloadFile.aspx?filename={1}", currentUri, doc.Filename); Uri url = new Uri(fullFilePath); if (App.Current.IsRunningOutOfBrowser) { MyHyperlinkButton button = new MyHyperlinkButton(); button.NavigateUri = url; button.TargetName = "_blank"; button.ClickMe(); } else System.Windows.Browser.HtmlPage.Window.Navigate(url, "_newWindow", "toolbar=0,menubar=0,resizable=1,scrollbars=1,top=0,left=0"); } else { AlertDisplay(Strings.DocumentDoesNotExist); } }); }