/// <summary> /// Register the document /// </summary> private void registerFile(string strPath, string strFileToUpload) { try { //Instancia o web service OWApi oWS = new OWApi(); oWS.Url = strUrlWebService; oWS.Credentials = System.Net.CredentialCache.DefaultCredentials; //Inicializa a estrutura com o ficheiro a registar stRegistry RegistryST = MappOfficeWorksData(strPath, strFileToUpload); //Insere o registo long lReg_ID = oWS.InsertRegistry(strUserName, "", ref RegistryST); //Abre o browser em modo de alteração OpenUpdateRegistry(lReg_ID); //Apaga o ficheiro local if (lReg_ID > 0) { DeleteRegistryFile(strPath, strFileToUpload); } oWS.Dispose(); } catch (Exception ex) { MessageBox.Show("Erro a registar o ficheiro no OW.Net: " + ex.Message, "OWScan", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Return all books for the current user. /// </summary> public void getBooks() { try { //Instancia o web service OWApi oWS = new OWApi(); oWS.Url = strUrlWebService; oWS.Credentials = System.Net.CredentialCache.DefaultCredentials; //Configura o proxy if (bUseProxy) { oWS.Proxy = GetWebProxy(); } //Obtém os livros stBook[] sB = oWS.GetBook(strUserName, 4); oWS.Dispose(); //Preenche a lista DataTable oTbl = new DataTable(); oTbl.Columns.AddRange(new DataColumn[] { new DataColumn("Id"), new DataColumn("Livro") }); foreach (stBook book in sB) { oTbl.Rows.Add(new object[] { book.BookID.ToString(), book.BookAbreviation.ToString() + " - " + book.BookDescription.ToString() }); } drpBooks.DataSource = oTbl; drpBooks.ValueMember = "Id"; drpBooks.DisplayMember = "Livro"; if (!btnRegister.Enabled) { btnRegister.Enabled = true; } } catch (Exception ex) { MessageBox.Show("Não tem permissões para registar em nenhum livro.\n\n" + ex.Message, "OWScan", MessageBoxButtons.OK, MessageBoxIcon.Error); btnRegister.Enabled = false; } }