0% found this document useful (0 votes)
51 views2 pages

Untitled

1. The document provides code examples for common tasks in BPM custom code such as creating pop up messages, exceptions, and selecting data using LINQ queries. 2. It shows how to call business object methods by getting a service contract and passing a dataset, and how to update data by changing values and calling update. 3. The document also demonstrates how to call a business analytics query (BAQ) by populating a query execution dataset with parameters and executing the query to retrieve results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views2 pages

Untitled

1. The document provides code examples for common tasks in BPM custom code such as creating pop up messages, exceptions, and selecting data using LINQ queries. 2. It shows how to call business object methods by getting a service contract and passing a dataset, and how to update data by changing values and calling update. 3. The document also demonstrates how to call a business analytics query (BAQ) by populating a query execution dataset with parameters and executing the query to retrieve results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

=====BPM CUSTOM CODE HELPER=====

###CREATE POP UP MESSAGE###


this.PublishInfoMessage("YOUR TEXT HERE = "+YOURVARIABLE,
Ice.Common.BusinessObjectMessageType.Information,
Ice.Bpm.InfoMessageDisplayMode.Individual, "Info", ""); //SHOW MESSAGE

###CREATE EXCEPTION###
throw new Ice.BLException("YOUR MESSAGE HERE"+YOURVARIABLE); //CREATE EXCEPTION

###SELECT Dataset, Temporary, dan Database Table Menggunakan LinQ ###


//Digunakan dalam Method Directive
var dsOrderDtl_xRow = (from dsOrderDtl_xRecs in ds.OrderDtl
where dsOrderDtl_xRecs.Company == Session.CompanyID
select dsOrderDtl_xRecs).FirstOrDefault();

//Digunakan dalam Data Directive dan Method Directive


var ttOrderDtl_xRow = (from ttOrderDtl_xRecs in ttOrderDtl
where ttOrderDtl_xRecs.Company == Session.CompanyID
select ttOrderDtl_xRecs).FirstOrDefault();

//Digunakan dalam Method Directive dan Data Directive


var PartLot_xRow = (from PartLot_xRecs in Db.PartLot
where PartLot_xRecs.Company == Session.CompanyID
&& PartLot_xRecs.PartNum == sPartNum
select PartLot_xRecs).FirstOrDefault();

//Create List
var OrderDtl_xRow = (from OrderDtl_xRecs in Db.OrderDtl
where OrderDtl_xRecs.Company == Session.CompanyID
&& OrderDtl_xRecs.OrderNum == iSONum
select OrderDtl_xRecs).ToList();

###CARA MEMANGGIL METHOD###


//Erp.Contracts.YourContractName xVariable = null;
//xVariable =
Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.YourSvcContractName>(Db);
//var yourDataset = new YourTableset();
CONTOH:
Erp.Contracts.SalesOrderSvcContract SO = null;
SO =
Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db);
var SODS = new SalesOrderTableset();

//START BO METHOD
SODS = SO.GetByID(iSONum);
if(SODS != null)
{
SODS.OrderDtl[iIndex].RowMod = "U";
SODS.OrderDtl[iIndex].DiscountPercent = 10;
SO.ChangeDiscountPercent(ref SODS);
SODS.OrderDtl[iIndex].RowMod = "U";
SO.Update(ref SODS);
this.dsHolder.Attach(SODS);

}//END BO METHOD

###CARA MEMANGGIL BAQ###


var ttUD06_Recs = (from ttUD06_Row in ttUD06
where ttUD06_Row.Company == Session.CompanyID
select ttUD06_Row).FirstOrDefault();
{
if (ttUD06_Recs != null)
{
string vCustID = ttUD06_Recs.ShortChar01;
string vGroup = "";
string vYear = Convert.ToInt32(ttUD06_Recs.Number01).ToString();
string vMonth = Convert.ToInt32(ttUD06_Recs.Number02).ToString();

Ice.Contracts.DynamicQuerySvcContract dynamicQuery =
Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.DynamicQuerySvcContract>(Db
);
Ice.Tablesets.QueryExecutionTableset dsQueryExecution = new
QueryExecutionTableset();
ExecutionParameterRow drRow = new ExecutionParameterRow();
ExecutionParameterRow paramRow3 = new ExecutionParameterRow();
ExecutionParameterRow paramRow4 = new ExecutionParameterRow();

drRow.ParameterID = "vCustID";
drRow.ParameterValue = vCustID;
drRow.ValueType = "char(8)";
drRow.IsEmpty = false;
drRow.RowMod = "A";

paramRow3.ParameterID = "vYear";
paramRow3.ParameterValue = vYear;
paramRow3.ValueType = "int";
paramRow3.IsEmpty = false;
paramRow3.RowMod = "A";

paramRow4.ParameterID = "vMonth";
paramRow4.ParameterValue = vMonth;
paramRow4.ValueType = "int";
paramRow4.IsEmpty = false;
paramRow4.RowMod = "A";

dsQueryExecution.ExecutionParameter.Add(drRow);
dsQueryExecution.ExecutionParameter.Add(paramRow3);
dsQueryExecution.ExecutionParameter.Add(paramRow4);

DataSet dsResults = dynamicQuery.ExecuteByID("IF_051119_OrdSumByProdCode",


dsQueryExecution);

if (dsResults.Tables[0].Rows.Count > 0)
{
foreach (DataRow item in dsResults.Tables["Results"].Rows)
{
TotalNilaiSOBias = Convert.ToDecimal(item["Calculated_BiasTotal"]);
TotalNilaiSORadial = Convert.ToDecimal(item["Calculated_RHPTTotal"]);
TotalNilaiSONRadial =
Convert.ToDecimal(item["Calculated_RNHPTTotal"]);
}
}
}
}

You might also like