本文整理汇总了C#中CustomList.ForEach方法的典型用法代码示例。如果您正苦于以下问题:C# CustomList.ForEach方法的具体用法?C# CustomList.ForEach怎么用?C# CustomList.ForEach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomList
的用法示例。
在下文中一共展示了CustomList.ForEach方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveHKEntry
public void SaveHKEntry(ref CustomList<HouseKeepingValue> HKList, ref CustomList<HousekeepingHierarchy> lstChild)
{
ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
Boolean blnTranStarted = false;
try
{
conManager.BeginTransaction();
ReSetSPName(HKList, lstChild);
blnTranStarted = true;
Int32 HKID = HKList[0].HKID;
blnTranStarted = true;
if (HKList[0].IsAdded)
HKID = Convert.ToInt32(conManager.InsertData(blnTranStarted, HKList));
else
conManager.SaveDataCollectionThroughCollection(blnTranStarted, HKList);
lstChild.ForEach(x => x.HKID = HKID);
conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstChild);
HKList.AcceptChanges();
lstChild.AcceptChanges();
conManager.CommitTransaction();
blnTranStarted = false;
conManager.Dispose();
}
catch (Exception Ex)
{
conManager.RollBack();
throw Ex;
}
finally
{
if (conManager.IsNotNull())
{
conManager.Dispose();
}
}
}
示例2: SaveWorkFlow
public void SaveWorkFlow(ref CustomList<CmnWorkFlowMaster> CmnWorkFlowMasterList, ref CustomList<CmnWorkFlowDetail> CmnWorkFlowDetailList)
{
ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
Boolean blnTranStarted = false;
try
{
conManager.BeginTransaction();
ReSetSPName(CmnWorkFlowMasterList, CmnWorkFlowDetailList);
workFlowID = CmnWorkFlowMasterList[0].WorkFlowID;
blnTranStarted = true;
if (CmnWorkFlowMasterList[0].IsAdded)
workFlowID = Convert.ToInt32(conManager.InsertData(blnTranStarted, CmnWorkFlowMasterList));
else
conManager.SaveDataCollectionThroughCollection(blnTranStarted, CmnWorkFlowMasterList);
CmnWorkFlowDetailList.ForEach(x => x.WorkFlowID = workFlowID);
conManager.SaveDataCollectionThroughCollection(blnTranStarted, CmnWorkFlowDetailList);
CmnWorkFlowMasterList.AcceptChanges();
CmnWorkFlowDetailList.AcceptChanges();
conManager.CommitTransaction();
blnTranStarted = false;
}
catch (Exception Ex)
{
conManager.RollBack();
throw Ex;
}
finally
{
if (conManager.IsNotNull())
{
conManager.Dispose();
}
}
}
示例3: SaveStockTransaction
public void SaveStockTransaction(ref CustomList<StockTransactionMaster> lstStockTransactionMaster, ref CustomList<StockTransactionDetail> lstStockTransactionDetail)
{
ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
Boolean blnTranStarted = false;
try
{
conManager.BeginTransaction();
ReSetSPName(lstStockTransactionMaster, lstStockTransactionDetail);
GetNewStockTransaction(ref conManager, ref lstStockTransactionMaster);
Int64 StockTransID = lstStockTransactionMaster[0].StockTransID;
blnTranStarted = true;
if (lstStockTransactionMaster[0].IsAdded)
StockTransID = Convert.ToInt32(conManager.InsertData(blnTranStarted, lstStockTransactionMaster));
else
conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstStockTransactionMaster);
lstStockTransactionDetail.ForEach(x => x.StockTransID = StockTransID);
conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstStockTransactionDetail);
lstStockTransactionMaster.AcceptChanges();
lstStockTransactionDetail.AcceptChanges();
conManager.CommitTransaction();
blnTranStarted = false;
}
catch (Exception Ex)
{
conManager.RollBack();
throw Ex;
}
finally
{
if (conManager.IsNotNull())
{
conManager.Dispose();
}
}
}