public List <tbm_InstrumentExpansion> DeleteInstrumentExpansion(tbm_InstrumentExpansion doDelete)
        {
            try
            {
                //Check whether this record is the most updated data
                List <tbm_InstrumentExpansion> rList = this.GetTbm_InstrumentExpansion(doDelete.InstrumentCode, doDelete.ChildInstrumentCode);
                if (rList == null || rList.Count == 0 || rList[0] == null ||
                    rList[0].UpdateDate == null || !rList[0].UpdateDate.HasValue ||
                    doDelete.UpdateDate == null || !doDelete.UpdateDate.HasValue)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "UpdateDate" });
                }
                if (DateTime.Compare(rList[0].UpdateDate.Value, doDelete.UpdateDate.Value) != 0)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0019, new string[] { doDelete.InstrumentCode });
                }

                //set updateDate and updateBy
                //doDelete.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                //doDelete.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo;

                List <tbm_InstrumentExpansion> deletedList = base.DeleteInstrumentExpansion(doDelete.ChildInstrumentCode
                                                                                            , doDelete.InstrumentCode);

                //Insert Log
                if (deletedList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Delete;
                    logData.TableName       = TableName.C_TBL_NAME_INSTRUMENT_EXPANSION;
                    logData.TableData       = CommonUtil.ConvertToXml(deletedList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(deletedList);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public List <tbm_InstrumentExpansion> InsertInstrumentExpansion(tbm_InstrumentExpansion doInsert)
        {
            try
            {
                //set CreateDate, CreateBy, UpdateDate and UpdateBy
                doInsert.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                doInsert.CreateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
                doInsert.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                doInsert.UpdateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;

                List <tbm_InstrumentExpansion> insertList = base.InsertInstrumentExpansion(
                    doInsert.InstrumentCode
                    , doInsert.ChildInstrumentCode
                    , doInsert.CreateDate
                    , doInsert.CreateBy
                    , doInsert.UpdateDate
                    , doInsert.UpdateBy);

                //Insert Log
                if (insertList.Count > 0)
                {
                    doTransactionLog logData = new doTransactionLog();
                    logData.TransactionType = doTransactionLog.eTransactionType.Insert;
                    logData.TableName       = TableName.C_TBL_NAME_INSTRUMENT_EXPANSION;
                    logData.TableData       = CommonUtil.ConvertToXml(insertList);
                    ILogHandler hand = ServiceContainer.GetService <ILogHandler>() as ILogHandler;
                    hand.WriteTransactionLog(logData);
                }

                return(insertList);
            }
            catch (Exception)
            {
                throw;
            }
        }