public void ExechangeChannelUSED(string lineCode, string sourceChannel, string targetChannel) { using (PersistentManager pm = new PersistentManager()) { ChannelDao channelDao = new ChannelDao(); SupplyDao supplyDao = new SupplyDao(); try { pm.BeginTransaction(); DataTable channelTableSource = channelDao.FindChannelUSED(lineCode, sourceChannel); DataTable channelTableTarget = channelDao.FindChannelUSED(lineCode, targetChannel); channelDao.UpdateChannelUSED(lineCode, targetChannel, channelTableSource.Rows[0]["CIGARETTECODE"].ToString(), channelTableSource.Rows[0]["CIGARETTENAME"].ToString(), Convert.ToInt32(channelTableSource.Rows[0]["QUANTITY"]), channelTableSource.Rows[0]["SORTNO"].ToString()); channelDao.UpdateChannelUSED(lineCode, sourceChannel, channelTableTarget.Rows[0]["CIGARETTECODE"].ToString(), channelTableTarget.Rows[0]["CIGARETTENAME"].ToString(), Convert.ToInt32(channelTableTarget.Rows[0]["QUANTITY"]), channelTableTarget.Rows[0]["SORTNO"].ToString()); supplyDao.UpdateChannelUSED(lineCode, sourceChannel, "0000", channelTableTarget.Rows[0]["GROUPNO"].ToString()); supplyDao.UpdateChannelUSED(lineCode, targetChannel, sourceChannel, channelTableSource.Rows[0]["GROUPNO"].ToString()); supplyDao.UpdateChannelUSED(lineCode, "0000", targetChannel, channelTableTarget.Rows[0]["GROUPNO"].ToString()); pm.Commit(); } catch { pm.Rollback(); } } }