Skip to content

Instantly share code, notes, and snippets.

Sergey Marenich smarenich

Block or report user

Report or block smarenich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Profiller.sql
( SELECT TOP 1 SUBSTRING(s2.text, r.statement_start_offset / 2,
( (CASE WHEN r.statement_end_offset = -1 THEN (LEN(CONVERT(nvarchar(max),s2.text)) * 2)
ELSE r.statement_end_offset END) - r.statement_start_offset) / 2) ) AS sql_statement,
sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s2
View TopQuerries.sql
SELECT top 30 total_worker_time/execution_count AS AvgCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count AS AvgDuration
, total_elapsed_time AS TotalDuration
, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads
, (total_logical_reads+total_physical_reads) AS TotalReads
, execution_count
, SUBSTRING(st.TEXT, (qs.statement_start_offset/2)+1
, ((CASE qs.statement_end_offset WHEN -1 THEN datalength(st.TEXT)
ELSE qs.statement_end_offset
View audithistory.sql
(Select top 1 username from Users u where PKID = UserID),
REPLACE(CAST(CAST(CombinedKey AS VARCHAR(max)) AS VARBINARY(max)), 0x0, ','),
REPLACE(CAST(CAST(ModifiedFields AS VARCHAR(max)) AS VARBINARY(max)), 0x0, ',')
View PXSearchable.cs
//PXSearchable for GL Batch
"{0} {1} - {2}",
new Type[] { typeof(Batch.module), typeof(Batch.batchNbr), typeof(Batch.branchID) },
new Type[] { typeof(Batch.ledgerID), typeof(Batch.description), typeof(BatchExt.usrExternarLeference) },
NumberFields = new Type[] { typeof(Batch.batchNbr) },
Line1Format = "{0}{1}{2:d}",
Line1Fields = new Type[] { typeof(Batch.ledgerID), typeof(Batch.finPeriodID), typeof(Batch.dateEntered) },
Line2Format = "{0}", Line2Fields = new Type[] { typeof(Batch.description) }
View union.cs
public class SomeMaint : PXGraph<SomeMaint>
public PXSelect<UnionTable> UnionSelect;
protected IEnumerable unionSelect()
List<UnionTable> result = new List<UnionTable>();
foreach (SomeTable1 row in PXSelect<SomeTable1>.Select(this))
View WebDialog.cs
//Defining action DataView
public PXAction<MyDAC> MyButton;
//Defining Button Attribute with tooltip
[PXButton(Tooltip = PX.Data.Update.Messages.MyTooltip)]
//Providing title and mapping action access rights
[PXUIField(DisplayName = "MyTitle", MapEnableRights = PXCacheRights.Delete, MapViewRights = PXCacheRights.Delete)]
protected void myButton()
WebDialogResult result = Companies.Ask(ActionsMessages.Warning, PXMessages.LocalizeFormatNoPrefix("My Message"),
MessageButtons.OKCancel, MessageIcon.Warning, true);
View SmartPanel.cs
public PXAction<MyDAC> MyButton;
[PXButton(Tooltip = PX.Data.Update.Messages.MyTooltip)]
[PXUIField(DisplayName = "MyTitle", MapEnableRights = PXCacheRights.Delete, MapViewRights = PXCacheRights.Delete)]
protected void myButton()
if (MyPanel.AskExt(true) != WebDialogResult.OK) return;
//Do some useful Stuff
View SmartPanel.aspx
<px:PXSmartPanel ID="pnlCopyCompany" runat="server" CaptionVisible="True" Caption="My Command"
Style="position: static" LoadOnDemand="True" Key="MyPanel" AutoCallBack-Target="frmMyCommand"
AutoCallBack-Command="Refresh" DesignView="Content">
<px:PXFormView ID="frmMyCommand" runat="server" SkinID="Transparent" DataMember="MyPanel" DataSourceID="ds" EmailingGraph="">
<px:PXLayoutRule runat="server" ControlSize="M" LabelsWidth="M" StartColumn="True" />
<px:PXLabel ID="lblWarning" runat="server" Encode="True">
WARNING: Some Action.
<px:PXSelector ID="edMyField" runat="server" AutoRefresh="True" DataField="MyField" DataSourceID="ds" />
View ContractsDemo.cs
static void Main(string[] args)
using (DefaultSoapClient client = new DefaultSoapClient())
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("https://localhost/demo/entity/Default/5.30.001");
client.Login("admin", "123", "Demo", null, null);
Console.WriteLine("Get all Stock Items");
//retrieveAllEntities force system to retrive details and linked entities
Entity[] items = client.GetList(new StockItem(), false);
View HandleMemoryFile.cs
public const string SessionKey = "MyFileImportSessionKey";
public PXAction<GLTran> UploadFileBatch;
[PXUIField(DisplayName = "Upload File as Batches", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Visible = true)]
public virtual IEnumerable uploadFileBatch(PXAdapter adapter)
//Ask user to upload file, continue if it is OK
if (this.NewFilePanel.AskExt() == WebDialogResult.OK)
You can’t perform that action at this time.