Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <summary>
        /// GetAllProducts
        /// </summary>

        public DataSet GetAllCostElements()
        {
            try
            {
                CST_ActCostAllocationDetailDS deDetail = new CST_ActCostAllocationDetailDS();
                return(deDetail.GetAllCostElements());
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// GetDetailByMaster into Database
        /// </summary>

        public DataTable GetDetailByMaster(int pintMasterId)
        {
            try
            {
                CST_ActCostAllocationDetailDS deDetail = new CST_ActCostAllocationDetailDS();

                return(deDetail.GetDetailByMaster(pintMasterId));
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        /// <summary>
        /// GetAllProducts
        /// </summary>

        public DataSet GetAllProductionLine()
        {
            CST_ActCostAllocationDetailDS deDetail = new CST_ActCostAllocationDetailDS();

            return(deDetail.GetAllProductionLine());
        }
Exemple #7
0
        /// <summary>
        /// GetAllProducts
        /// </summary>

        public DataSet GetAllGroup()
        {
            CST_ActCostAllocationDetailDS deDetail = new CST_ActCostAllocationDetailDS();

            return(deDetail.GetAllGroup());
        }