private void HandleDelete(BOL_USAGE_CHARGE_MASTER oUSAGE_CHARGE_MASTER, DataRow row) { string strMsg = ""; using (TransactionScope dbTxn = new TransactionScope()) { USAGE_CHARGE_MASTER DAL_USAGE_CHARGE_MASTER = new USAGE_CHARGE_MASTER(con); if (!DAL_USAGE_CHARGE_MASTER.IsAlreadyUpdated(oUSAGE_CHARGE_MASTER, out strMsg)) // IF updated_at is not already modified { //delete the record DAL_USAGE_CHARGE_MASTER.Delete(oUSAGE_CHARGE_MASTER, out strMsg); } else { dbTxn.Dispose(); ResponseUtility.ReturnFailMessage(row); return; } //return message and MK value if (String.IsNullOrEmpty(strMsg)) //success { dbTxn.Complete(); ResponseUtility.ReturnDeleteSuccessMessage(row); } else //failed { ResponseUtility.ReturnFailMessage(row); } } }
private void HandleModify(BOL_USAGE_CHARGE_MASTER oUSAGE_CHARGE_MASTER, string OPERATION, DataRow row) { string strMsg = ""; using (TransactionScope dbTxn = new TransactionScope()) { USAGE_CHARGE_MASTER DAL_USAGE_CHARGE_MASTER = new USAGE_CHARGE_MASTER(con); //check condition if (!DAL_USAGE_CHARGE_MASTER.IsAlreadyUpdated(oUSAGE_CHARGE_MASTER, out strMsg)) // IF updated_at is not already modified { DAL_USAGE_CHARGE_MASTER.Update(oUSAGE_CHARGE_MASTER, CURRENT_DATETIME, CURRENT_USER, out strMsg); } else { //already use in another process ResponseUtility.ReturnFailMessage(row); return; } //return message and MK value if (String.IsNullOrEmpty(strMsg)) //success { dbTxn.Complete(); ResponseUtility.ReturnSuccessMessage(row, UPDATED_AT_DATETIME, CURRENT_DATETIME, CURRENT_USER); } else //failed { ResponseUtility.ReturnFailMessage(row); } } }