/// <summary> /// Delete record by condition /// </summary> public void Delete(int pintMasterID) { //First, delete data on detail table CST_ActCostAllocationDetailDS dsDetail = new CST_ActCostAllocationDetailDS(); DataTable dtbDetail = dsDetail.GetDetailByMaster(pintMasterID); DataSet dtsDetail = dtbDetail.DataSet; if (dtsDetail == null) { dtsDetail = new DataSet(); dtsDetail.Tables.Add(dtbDetail); } foreach (DataRow drow in dtbDetail.Rows) { //delete row drow.Delete(); } dsDetail.UpdateDataSet(dtsDetail); //Then delete data on master table CST_ActCostAllocationMasterDS dsMaster = new CST_ActCostAllocationMasterDS(); dsMaster.Delete(pintMasterID); }
/// <summary> /// Get the object information by ID of VO class /// </summary> public object GetObjectVO(int pintID) { try { CST_ActCostAllocationMasterDS dsMaster = new CST_ActCostAllocationMasterDS(); return(dsMaster.GetObjectVO(pintID)); } catch (PCSDBException ex) { throw ex; } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
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); }
public void Add(object pobjMasterVO, System.Data.DataSet pdstDataSet) { try { CST_ActCostAllocationMasterDS dsMaster = new CST_ActCostAllocationMasterDS(); int intMasterId = dsMaster.AddAndReturnID(pobjMasterVO); //reset master id of voObject ((CST_ActCostAllocationMasterVO)pobjMasterVO).ActCostAllocationMasterID = intMasterId; if (pdstDataSet != null) { foreach (DataRow row in pdstDataSet.Tables[0].Rows) { if (row.RowState == DataRowState.Deleted) { continue; } row[CST_ActCostAllocationMasterTable.ACTCOSTALLOCATIONMASTERID_FLD] = intMasterId; } CST_ActCostAllocationDetailDS dsDetail = new CST_ActCostAllocationDetailDS(); //Check dataset to call UpdateDataSet method dsDetail.UpdateDataSet(pdstDataSet); } } catch (PCSDBException ex) { throw ex; } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
/// <summary> /// Check if inserted row is overlap /// </summary> /// <param name="pobjMasterVO"></param> /// <returns></returns> public bool IsPeriodOverlap(object pobjMasterVO) { CST_ActCostAllocationMasterDS dsMaster = new CST_ActCostAllocationMasterDS(); return(dsMaster.IsPeriodOverlap(pobjMasterVO)); }
/// <summary> /// DelChargeAllocation /// </summary> public void DelChargeAllocation(int actCostAllocationMasterId) { CST_ActCostAllocationMasterDS objdeDetailDS = new CST_ActCostAllocationMasterDS(); objdeDetailDS.DelChargeAllocation(actCostAllocationMasterId); }
public object GetPeriod(DateTime pdtmToDate) { CST_ActCostAllocationMasterDS dsPeriod = new CST_ActCostAllocationMasterDS(); return(dsPeriod.GetObjectVO(pdtmToDate)); }
public object GetPeriod(int pintPeriodID) { CST_ActCostAllocationMasterDS dsPeriod = new CST_ActCostAllocationMasterDS(); return(dsPeriod.GetObjectVO(pintPeriodID)); }