Exemplo n.º 1
0
        /// <summary>
        /// Function for update credit note information to DB. (sp_IC_UpdateTbt_CreditNote)
        /// </summary>
        /// <param name="doTbt_CreditNote">credit note information</param>
        /// <returns></returns>
        public int UpdateTbt_CreditNote(tbt_CreditNote doTbt_CreditNote)
        {
            try
            {
                //set updateDate and updateBy
                doTbt_CreditNote.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                doTbt_CreditNote.UpdateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;

                List <tbt_CreditNote> doUpdateList = new List <tbt_CreditNote>();
                doUpdateList.Add(doTbt_CreditNote);
                List <tbt_CreditNote> updatedList = base.UpdateTbt_CreditNote(CommonUtil.ConvertToXml_Store <tbt_CreditNote>(doUpdateList));

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

                return(updatedList.Count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Function for generate credit note no. and save credit note information to DB.
        /// </summary>
        /// <param name="_dotbt_CreditNote">credit note information</param>
        /// <returns></returns>
        public tbt_CreditNote RegisterCreditNote(tbt_CreditNote _dotbt_CreditNote)
        {
            try
            {
                IBillingHandler iBillingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;
                _dotbt_CreditNote.CreditNoteNo = iBillingHandler.GetNextRunningNoByTypeMonthYear(RunningType.C_RUNNING_TYPE_CREDIT_NOTE, CommonUtil.dsTransData.dtUserData.EmpNo, _dotbt_CreditNote.CreditNoteDate == null ? CommonUtil.dsTransData.dtOperationData.ProcessDateTime : _dotbt_CreditNote.CreditNoteDate.Value);

                //set CreateDate, CreateBy, UpdateDate and UpdateBy
                _dotbt_CreditNote.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                _dotbt_CreditNote.CreateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
                _dotbt_CreditNote.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                _dotbt_CreditNote.UpdateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;

                _dotbt_CreditNote.CancelFlag = false;

                if (InsertTbt_CreditNote(_dotbt_CreditNote) == 0)
                {
                    return(null);
                }
                else
                {
                    return(_dotbt_CreditNote);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }