public void SaveData(DataSet pdstData, object pobjPeriod) { CST_ActCostAllocationMasterVO voPeriod = (CST_ActCostAllocationMasterVO)pobjPeriod; // delete old cost first CST_ActualCostHistoryDS dsActualCost = new CST_ActualCostHistoryDS(); try { dsActualCost.Delete(voPeriod.ActCostAllocationMasterID); } catch { throw new PCSBOException(ErrorCode.MESSAGE_CAN_NOT_DELETE, "SaveData", null); } // update actual cost dsActualCost.UpdateDataSet(pdstData); // update period rollupdate CST_ActCostAllocationMasterDS dsPeriod = new CST_ActCostAllocationMasterDS(); dsPeriod.Update(pobjPeriod); }
/// <summary> /// Update into Database /// </summary> /// <param name="pobjMaster"></param> /// <param name="pdtbDetail"></param> public void Update(object pobjMaster, DataSet pdtsDetail) { CST_ActCostAllocationMasterDS dsMaster = new CST_ActCostAllocationMasterDS(); dsMaster.Update(pobjMaster); //check and update master id for new added rows if (pdtsDetail != null) { foreach (DataRow row in pdtsDetail.Tables[0].Rows) { if (row.RowState == DataRowState.Deleted) { continue; } row[CST_ActCostAllocationMasterTable.ACTCOSTALLOCATIONMASTERID_FLD] = ((CST_ActCostAllocationMasterVO)pobjMaster).ActCostAllocationMasterID; } } CST_ActCostAllocationDetailDS dsDetail = new CST_ActCostAllocationDetailDS(); //Check dataset to call UpdateDataSet method dsDetail.UpdateDataSet(pdtsDetail); }