コード例 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SAPDataCostCenterTotals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSAPDataCostCenterTotals(SAPDataCostCenterTotal sAPDataCostCenterTotal)
 {
     base.AddObject("SAPDataCostCenterTotals", sAPDataCostCenterTotal);
 }
コード例 #2
0
 /// <summary>
 /// Create a new SAPDataCostCenterTotal object.
 /// </summary>
 /// <param name="idSAPDataCostCenterTotal">Initial value of the idSAPDataCostCenterTotal property.</param>
 /// <param name="idSAPData">Initial value of the idSAPData property.</param>
 /// <param name="idCostCenter">Initial value of the idCostCenter property.</param>
 /// <param name="total_MH">Initial value of the Total_MH property.</param>
 public static SAPDataCostCenterTotal CreateSAPDataCostCenterTotal(global::System.Int32 idSAPDataCostCenterTotal, global::System.Int32 idSAPData, global::System.Int32 idCostCenter, global::System.Decimal total_MH)
 {
     SAPDataCostCenterTotal sAPDataCostCenterTotal = new SAPDataCostCenterTotal();
     sAPDataCostCenterTotal.idSAPDataCostCenterTotal = idSAPDataCostCenterTotal;
     sAPDataCostCenterTotal.idSAPData = idSAPData;
     sAPDataCostCenterTotal.idCostCenter = idCostCenter;
     sAPDataCostCenterTotal.Total_MH = total_MH;
     return sAPDataCostCenterTotal;
 }
コード例 #3
0
        internal CallContext CalculateCostCentersTotal(int idSAPData, CallContext callContext)
        {
            SAPDataCostCenterTotalBL sapDataCostCenterTotalBL = new SAPDataCostCenterTotalBL();
            List<Expense> listGroupExpense = LoadExpenseGroupByIdSAPData(idSAPData);

            List<KeyValue> listKeyValueCostCenter = new KeyValueBL().GetAllKeyValueByKeyTypeIntCode("CostCenter");

            List<SAPDataCostCenterTotal> listTotal = new List<SAPDataCostCenterTotal>();

            List<SAPDataCostCenterTotal> listSAPDataCostCenterTotal_IDS = this.dbContext.SAPDataCostCenterTotals.Where(s => s.idSAPData == idSAPData).Select(s=>s).ToList();

            sapDataCostCenterTotalBL.EntityDelete<SAPDataCostCenterTotalBL>(listSAPDataCostCenterTotal_IDS, callContext);

            foreach (KeyValue costCenter in listKeyValueCostCenter)
            {
                SAPDataCostCenterTotal total = new SAPDataCostCenterTotal();

                total.idCostCenter = costCenter.idKeyValue;
                total.idSAPData = idSAPData;
                total.Total_MH = listGroupExpense.Where(s => s.CostCenter.idKeyValue == costCenter.idKeyValue).Sum(s => s.ExpenseValue_MH);
                listTotal.Add(total);
            }

            callContext = sapDataCostCenterTotalBL.EntitySave<SAPDataCostCenterTotal>(listTotal, callContext);

            return callContext;
        }