Skip to content

Instantly share code, notes, and snippets.

View YuriyZaletskyy's full-sized avatar

Yuriy Zaletskyy YuriyZaletskyy

View GitHub Profile
@YuriyZaletskyy
YuriyZaletskyy / APInvoiceEntryExt.cs
Created May 4, 2021 19:46
Dynamic Selector Functionality
namespace MyProject
{
public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry>
{
public PXSelect<MyCommand> Commands;
public PXSelect<GLTran> GLTrans;
public PXSelect<FixedAsset> FixedAssets;
amespace MyProject
{
public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry>
{
public PXSelect<MyCommand> Commands;
public PXSelect<GLTran> GLTrans;
public PXSelect<FixedAsset> FixedAssets;
protected void MyCommand_CommandData_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
public partial class Form1 : Form
{
private HubConnection connection;
public Form1()
{
InitializeComponent();
}
private void button_start_Click(object sender, EventArgs e)
myHub.On<NotificationResult>("ReceiveNotification", nr =>
{
if (nr.Inserted.Length > 0 && nr.Deleted.Length > 0)
{
MessageBox.Show("Before update " + JsonConvert.DeserializeObject(nr.Deleted[0].ToString()));
MessageBox.Show("After update " + JsonConvert.DeserializeObject(nr.Inserted[0].ToString()));
}
else
{
if (nr.Inserted.Length > 0)
var myHub = connection.CreateHubProxy("PushNotificationsHub");
connection.Start().ContinueWith(task =>
{
try
{
if (task.IsFaulted)
{
MessageBox.Show("There was an error during open of the connection: " +
task.Exception.GetBaseException());
}
var connection = new HubConnection("http://localhost/YourInstance/");
connection.Headers.Add("Authorization", "Basic "+basicAuthToken);
var login = "admin";
var company = "Company";
var password = "123";
var basicAuthToken = Convert.ToBase64String(
Encoding.UTF8.GetBytes(login+"@"+company+":"+password));
public partial class Form1 : Form
{
private HubConnection connection;
public Form1()
{
InitializeComponent();
}
private void button_start_Click(object sender, EventArgs e)
public class NotificationResult
{
public object[] Inserted { get; set; }
public object[] Deleted { get; set; }
public string Query { get; set; }
public string CompanyId { get; set; }
public Guid Id { get; set; }
public long TimeStamp { get; set; }
public Dictionary<string, object> AdditionalInfo { get; set; }
}
@YuriyZaletskyy
YuriyZaletskyy / SV201000.aspx
Last active April 14, 2020 08:36
Gist that demonstrates Pop up functionality with aspx markup
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
TypeName="PX.Survey.Ext.SurveyMaint" PrimaryView="SurveyCurrent">
<CallbackCommands>
<px:PXDSCallbackCommand Name="AddRecipients" Visible="False" />
</CallbackCommands>
</px:PXDataSource>
<px:PXSmartPanel ID="PanelAddRecipients" runat="server" Key="UsersForAddition" LoadOnDemand="true" Width="1100px" Height="500px"
Caption="Select Recipients" CaptionVisible="true" AutoRepaint="true" DesignView="Content" ShowAfterLoad="true">
<px:PXGrid ID="grdRecipientContacts" runat="server" DataSourceID="ds" Height="150px" Width="100%" ActionsPosition="Top" SkinID="Inquire"