Page 2 of 3

Re: Document History

Posted: Thu Apr 07, 2022 12:46 pm
by BobRichards
1) Server files are installed in C:\Program Files (x86)\Common Files\SoftPro\Select Server\Instances\spssvr by default. Check there for SoftPro.Select.Server.dll .

2) (not a question)

3) You need to verify the item you are passed is an IAttachmentFile. Then you will have all the information displayed on the UI.

Code: Select all

if (e.Item is IAttachmentFile)
{
    IAttachmentFile file = (IAttachmentFile)e.Item;
    file.Extension = // i.e. ".xml"
    file.ID = // Proprietary guid used for internal tracking.
    file.Name = // i.e. "hello"
    file.Path = // i.e. "\\\\XAT22000149\\Attachments\\hello.xml"
}
4) Sorry. I don't understand the question.

Re: Document History

Posted: Fri Apr 08, 2022 7:54 am
by ngillet
please provide the setup file for Softpro Select Server .Inside selectDb database I will create a table for documents
When any document is drag and drop in Attachment tab of SoftPro with in this below function inside if block I can send this these properties data to the table which I will create for document

private void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{
if (e.Item is IAttachmentFile)
{
IAttachmentFile file = (IAttachmentFile)e.Item;
string extension = file.Extension; // i.e. ".xml"
System.Guid fileID = file.ID; // Proprietary guid used for internal tracking.
string fleName = file.Name;// i.e. "hello"
string filePath = file.Path; // i.e. "\\\\XAT22000149\\Attachments\\hello.xml"
}

Re: Document History

Posted: Fri Apr 08, 2022 9:07 am
by ngillet
And how could I debug this package and see logs for that package?

Re: Document History

Posted: Fri Apr 08, 2022 10:24 am
by BobRichards
I cannot send you the SoftPro Select Server installer. You must contact your SoftPro Sales Representative.

As so far as debugging your code, you can write the server package in C# with the installed projects from the SDK and you will be able to set breakpoints and debug as you would any other C# application.

If you need more in-depth assistance, please contact to the development manager of the Custom Applications group - Elliott Potts (Elliott.Potts@softprocorp.com).

Re: Document History

Posted: Mon Apr 11, 2022 10:06 am
by ngillet
In the below code I want ordernumber of a order in which document are drag and drop in attachment folder and title of that document .I will send these two in parameter as payload in api call when attachmentadded event trigger.
And it show red line in "GetService<>()" with message that it is not in current context

I am sharing my code below please let me know if you find any mistake in this :
using SoftPro.Accounting.Client;
using SoftPro.ClientModel;
using SoftPro.EntityModel.Packaging;
using SoftPro.OrderTracking.Client;
using SoftPro.OrderTracking.Client.Orders;
using SoftPro.Select.Client;
using SoftPro.Select.Service;
using SoftPro.ServerModel;
using System;
using System.Runtime.InteropServices;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net;
using System.Diagnostics;

namespace ServerPackage1
{
[Guid("026ae76b-5489-447a-bafe-63ca269b69c6")]
partial class MyPackage : Package
{
// This method is called when the package is loaded by the server.
protected override void OnInitialize()
{
// Listen to the environment started event.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started += SelectServerEnvironment_Started;
}

// This method is called when the server is finished loading packages and services.
private void SelectServerEnvironment_Started(object sender, System.EventArgs e)
{
// Unhook this event as it is no longer needed.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started -= SelectServerEnvironment_Started;

IOrder order = GetService<IOrderStore>();
order.AttachmentAdded += Order_AttachmentAdded;

}

// This method is called when an attachment is added
private void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{
if (e.Item is IAttachmentFile)
{
IAttachmentFile file = (IAttachmentFile)e.Item;
string extension = file.Extension; // i.e. ".xml"
System.Guid fileID = file.ID; // Proprietary guid used for internal tracking.
string fleName = file.Name;// i.e. "hello"
string filePath = file.Path; // i.e. "\\\\XAT22000149\\Attachments\\hello.xml"
try
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:50722/escrowDataService.asmx/");
//HTTP GET
var responseTask = client.GetAsync("updateDocuments?orderId='" + orderNumber + "'&documents='" + documents + "'&rootId='" + rootId + "'+&officeId='" + officeid);
responseTask.Wait();

var result = responseTask.Result;
if (result.IsSuccessStatusCode)
{

Trace.TraceInformation("Email success:New document added email send");
// You must close or flush the trace to empty the output buffer.
Trace.Flush();
}
}


}
catch (Exception ex)
{
Trace.TraceError($"Exception while sending mail for new added document: {ex}");
}
}

}
}
}

Re: Document History

Posted: Tue Apr 12, 2022 10:36 am
by ngillet
Please provide solution for above post also

Normally in .net we put database connection strings and urls in web.config file and gets its value by using "ConfigurationManager.AppSettings["BaseAddress"];" how could I achieve this in package also because I have added config file but when I added "ConfigurationManager.AppSettings["BaseAddress"];" this line in package its showing error

Re: Document History

Posted: Tue Apr 12, 2022 2:55 pm
by BobRichards
If the method is "not in current context" then you probably have not added a project reference to the library DLL.

The Select database connection string can be found in the Server package by referencing the ISelectServerEnvironment.ConnectionString object.

It is beyond the scope of this forum to provide the extensive help you are requesting. If you need more in-depth assistance, please contact to the development manager of the Custom Applications group - Elliott Potts (Elliott.Potts@softprocorp.com).

Re: Document History

Posted: Wed Apr 13, 2022 10:03 am
by ngillet
In the below code I want ordernumber of a order in which document are drag and drop in attachment folder and title of that document

using SoftPro.Accounting.Client;
using SoftPro.ClientModel;
using SoftPro.EntityModel.Packaging;
using SoftPro.OrderTracking.Client;
using SoftPro.OrderTracking.Client.Orders;
using SoftPro.Select.Client;
using SoftPro.Select.Service;
using SoftPro.ServerModel;
using System;
using System.Runtime.InteropServices;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net;
using System.Diagnostics;

namespace ServerPackage1
{
[Guid("026ae76b-5489-447a-bafe-63ca269b69c6")]
partial class MyPackage : Package
{
// This method is called when the package is loaded by the server.
protected override void OnInitialize()
{
// Listen to the environment started event.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started += SelectServerEnvironment_Started;
}

// This method is called when the server is finished loading packages and services.
private void SelectServerEnvironment_Started(object sender, System.EventArgs e)
{
// Unhook this event as it is no longer needed.
ISelectServerEnvironment environment = GetService<ISelectServerEnvironment>();
environment.Started -= SelectServerEnvironment_Started;

IOrder order = GetService<IOrderStore>();
order.AttachmentAdded += Order_AttachmentAdded;

}

// This method is called when an attachment is added
private void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{
if (e.Item is IAttachmentFile)
{
IAttachmentFile file = (IAttachmentFile)e.Item;
string extension = file.Extension; // i.e. ".xml"
System.Guid fileID = file.ID; // Proprietary guid used for internal tracking.
string fleName = file.Name;// i.e. "hello"
string filePath = file.Path; // i.e. "\\\\XAT22000149\\Attachments\\hello.xml"
try
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:50722/escrowDataService.asmx/");
//HTTP GET
var responseTask = client.GetAsync("updateDocuments?orderId='" + orderNumber + "'&documents='" + documents + "'&rootId='" + rootId + "'+&officeId='" + officeid);
responseTask.Wait();

var result = responseTask.Result;
if (result.IsSuccessStatusCode)
{

Trace.TraceInformation("Email success:New document added email send");
// You must close or flush the trace to empty the output buffer.
Trace.Flush();
}
}


}
catch (Exception ex)
{
Trace.TraceError($"Exception while sending mail for new added document: {ex}");
}
}

}
}
}

Re: Document History

Posted: Wed Apr 13, 2022 10:14 am
by BobRichards
The order number and title of the document are in the AttachmentItemEventArgs that is passed to your event. You have already determined the document name (file.Name). The IOrder object for the order is "e.Order". From there you can get the value of the "Number" property.

Re: Document History

Posted: Thu Apr 14, 2022 11:14 am
by ngillet
Please review the below code to verfiy that I write correct code for ordernumber :

private void Order_AttachmentAdded(object sender, AttachmentItemEventArgs e)
{

if (e.Item is IAttachmentFile)
{
IAttachmentFile file = (IAttachmentFile)e.Item;
string extension = file.Extension; // i.e. ".xml"
System.Guid fileID = file.ID; // Proprietary guid used for internal tracking.
string fileName = file.Name;// i.e. "hello"
string filePath = file.Path; // i.e. "\\\\XAT22000149\\Attachments\\hello.xml"
IOrder order = file.Order;
OrderIdentifier ordernumber = order.Identifier; //ordernumber in which document added
}

I have written many emails to Potts to connect with me but I do not get any reply from their side. Can you please ask him to connect with me.