예제 #1
0
 private void AutoDeleteCommitInventoryMaster()
 {
     try
     {
         SO_CommitInventoryMasterDS dsCommitInventory = new SO_CommitInventoryMasterDS();
         dsCommitInventory.AutoDeleteCommitMaster();
     }
     catch (PCSDBException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public void UpdateRelease(ArrayList parrMaster, DataSet pdstCommitDetail, DataSet pdstMasLocCache,
                                  DataSet pdstLocCache, DataSet pdstBinCache, DataSet pdstTransaction)
        {
            const string METHOD_NAME = THIS + ".UpdateRelease()";

            SO_CommitInventoryMasterDS dsMaster = new SO_CommitInventoryMasterDS();
            DataSet dstCopyOfDetail             = pdstCommitDetail.Clone();
            DataSet dstCopyOfTransaction        = pdstTransaction.Clone();
            UtilsBO boUtils = new UtilsBO();

            foreach (SO_CommitInventoryMasterVO voMaster in parrMaster)
            {
                int intOldID = voMaster.CommitInventoryMasterID;
                voMaster.CommitmentNo = boUtils.GetNoByMask(SO_CommitInventoryMasterTable.TABLE_NAME,
                                                            SO_CommitInventoryMasterTable.COMMITMENTNO_FLD, voMaster.CommitDate, Constants.YYYYMMDD0000);
                // add new master object and get new id
                voMaster.CommitInventoryMasterID = dsMaster.AddAndReturnID(voMaster);

                #region find all detail object to assign new master id

                DataRow[] drowDetails = pdstCommitDetail.Tables[0].Select(SO_CommitInventoryDetailTable.COMMITINVENTORYMASTERID_FLD + "=" + intOldID);
                foreach (DataRow drowDetail in drowDetails)
                {
                    if (drowDetail.RowState != DataRowState.Deleted)
                    {
                        DataRow drowCommitDetail = dstCopyOfDetail.Tables[0].NewRow();
                        foreach (DataColumn dcol in dstCopyOfDetail.Tables[0].Columns)
                        {
                            drowCommitDetail[dcol.ColumnName] = drowDetail[dcol.ColumnName];
                        }
                        drowCommitDetail[SO_CommitInventoryDetailTable.COMMITINVENTORYMASTERID_FLD] = voMaster.CommitInventoryMasterID;
                        dstCopyOfDetail.Tables[0].Rows.Add(drowCommitDetail);
                    }
                }

                #endregion

                #region find all transaction history object to assign new master id

                DataRow[] drowTransaction = pdstTransaction.Tables[0].Select(MST_TransactionHistoryTable.REFMASTERID_FLD + "=" + intOldID);
                foreach (DataRow drowDetail in drowTransaction)
                {
                    if (drowDetail.RowState != DataRowState.Deleted)
                    {
                        DataRow drowNewTransaction = dstCopyOfTransaction.Tables[0].NewRow();
                        foreach (DataColumn dcol in dstCopyOfTransaction.Tables[0].Columns)
                        {
                            drowNewTransaction[dcol.ColumnName] = drowDetail[dcol.ColumnName];
                        }
                        drowNewTransaction[MST_TransactionHistoryTable.REFMASTERID_FLD] = voMaster.CommitInventoryMasterID;
                        dstCopyOfTransaction.Tables[0].Rows.Add(drowNewTransaction);
                    }
                }

                #endregion
            }

            // update detail dataset
            SO_CommitInventoryDetailDS dsCommitDetail = new SO_CommitInventoryDetailDS();
            dsCommitDetail.UpdateDataSet(dstCopyOfDetail);
            // update transaction history
            MST_TransactionHistoryDS dsTransaction = new MST_TransactionHistoryDS();
            dsTransaction.UpdateDataSet(dstCopyOfTransaction);
            // update bin cache
            IV_BinCacheDS dsBinCache = new IV_BinCacheDS();
            dsBinCache.UpdateDataSet(pdstBinCache);
            // update location cache
            IV_LocationCacheDS dsLocCache = new IV_LocationCacheDS();
            dsLocCache.UpdateDataSet(pdstLocCache);
            // update master location cache
            IV_MasLocCacheDS dsMasLocCache = new IV_MasLocCacheDS();
            dsMasLocCache.UpdateDataSet(pdstMasLocCache);
        }