Skip to content

Instantly share code, notes, and snippets.

View hasokeric's full-sized avatar
👋

Haso Keric hasokeric

👋
View GitHub Profile
@hasokeric
hasokeric / EpicorCheckSQLIndexFragmentation.sql
Last active November 5, 2019 11:46
Check SQL Index Fragmentation
SELECT dbschemas.[name] as 'Schema',
dbtables.[name] as 'Table',
dbindexes.[name] as 'Index',
indexstats.avg_fragmentation_in_percent,
indexstats.page_count
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS indexstats
INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id]
INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id]
INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_id]
AND indexstats.index_id = dbindexes.index_id
adapterPart.GetByID(row["MtlPartNum"].ToString());
adapterPart.GetNewPartPlant(row["MtlPartNum"].ToString());
int highestIndex = adapterPart.PartData.PartPlant.Count - 1;
adapterPart.PartData.PartPlant[highestIndex]["Plant"] = defaultSite;
// TODO Whse
adapterPart.PartData.PartPlant[highestIndex]["RowMod"] = "A";
adapterPart.Update();
@hasokeric
hasokeric / EpicorSessionImpersonationClient.cs
Created September 4, 2019 16:14
Epicor Session Impersonation Client Side - Haso
// Session Impersonation Vars
Ice.Core.Session newSession;
// InitCustomCode
this.newSession = this.GetNewSessionAsSysAgent();
// DestroyCustomCode
// Begin Custom Code Disposal
Ice.Proxy.Lib.SessionModImpl sMod = GetInstanceField(typeof(Ice.Core.Session), newSession, "sessionMod") as Ice.Proxy.Lib.SessionModImpl;
sMod.Logout();
@hasokeric
hasokeric / Epicor10.2.500.ButtonImage.cs
Last active June 26, 2019 12:56
setButtonImage Epicor 10.2.500
setButtonImage("Workstation", epiButtonC1);
private bool setButtonImage(string resID, EpiButton btnTarget)
{
bool flag;
if (EpiUIImages.AllImages.ContainsKey(resID))
{
btnTarget.Appearance.Image = (Image)EpiUIImages.AllImages[resID];
btnTarget.Appearance.ImageHAlign = Infragistics.Win.HAlign.Center;
btnTarget.Appearance.ImageVAlign = Infragistics.Win.VAlign.Middle;
@hasokeric
hasokeric / StringToObject.cs
Created May 25, 2019 00:18
StringToObject
/**
* Base64 Encode
*
* @var string
* @type Custom Function
* @subtype Helper
* @return string
*/
public static string Base64Encode(string plainText)
{
// Prepare Vars
string sColumns = string.Empty;
string sRecords = string.Empty;
// Build Columns
foreach (DataColumn colName in myDataSet.Table.Columns)
{
sColumns += String.Format(@"'{0}',", colName.ToString() );
}
@hasokeric
hasokeric / Epicor-BPM-VIN-Validation.cs
Last active March 20, 2019 18:22
Epicor VIN Validation BPM Example
// Erp.SelectedSerialNumbers.CreateSerialNum.PRE.ValidateVIN
//
//
//
// Part IsVehicleRefCat?
bool isVehiclePart =
(from p in Db.Part.With(LockHint.NoLock)
where p.Company == Session.CompanyID
&& p.PartNum == PartNum
@hasokeric
hasokeric / EpicorCloud.md
Last active March 8, 2019 17:58
Epicor Cloud

ST - pretty much you hire us to do anything for a data center. I don’t know the specifics but I think if the customer wanted, the EMS might cook breakfast for you as well. You get full control of everything

MT - Shared everything. The E10 app is used to isolate tenants from each other. That’s why you see limits placed on things like no C# in server widgets and limits around UD fields - least common denominator customization for a discounted price. For plenty of customers, this is all they need (Still the most popular offering btw even with the limitations).

DT - New kid on the block and fastest growing. Isolated DBs on a shared DB Server. IIS Apps are also isolated to each Tenant with separate App Pools per tenant. Multiple Tenant are on the same app server but in separate Application in IIS. Each tenant has a separate Windows Identity stamped on the App Pool and granted access to SQL via that identity (Windows Auth access to their DB and their slice of the file system). So the Windows OS is used to provide

@hasokeric
hasokeric / GetNewUBAQBase.cs
Last active February 22, 2019 20:09
UBAQ Update BASE
this.resultHolder.Attach(QueryResultDataSetUbaqTableset.FromDataSet(defaultImpl.GetNew(queryDS)));
var ttResult = ttResults.FirstOrDefault();
if(ttResult != null)
{
dynamic Constants = this.Constants;
ttResult.UD10_Company = Constants.CurrentCompany;
}
@hasokeric
hasokeric / EpicorManager.sql
Last active March 26, 2019 16:03
Unexpire manager password
UPDATE Ice.SysUserFile SET PwdExpires = NULL WHERE UserID = 'manager'
SELECT PwdExpires, PwdExpiresDays, PwdLastChanged, * FROM Ice.SysUserFile;
-- Extras
-- Set manager user to manager password
UPDATE Ice.SysUserFile SET Password = 'PdnCdntJTEbfFOoePs4QxV/nD4lndJGMFug64ojqiTYyVC75OYeQcA==' WHERE UserID = 'manager';
UPDATE Erp.UserFile SET PassWord = 'PdnCdntJTEbfFOoePs4QxV/nD4lndJGMFug64ojqiTYyVC75OYeQcA==' WHERE DcdUserID = 'manager';
UPDATE Ice.SysUserFile SET UserDisabled = 0 WHERE UserID = 'manager';