/// <summary>
        /// Update sale basic
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private bool CTS190_UpdateSaleBasic(List <tbt_ContractDocument> dt)
        {
            try
            {
                if (dt == null || dt.Count == 0)
                {
                    return(false);
                }

                ISaleContractHandler handlerRC = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;

                // Get SaleBasic (SB)
                List <tbt_SaleBasic> dtSB = handlerRC.GetTbt_SaleBasic(dt[0].ContractCode, dt[0].OCC, null);

                if (dtSB.Count == 0)
                {
                    return(false);
                }

                dtSB[0].DocReceiveDate = dt[0].CollectDocDate;
                dtSB[0].DocAuditResult = dt[0].DocAuditResult;
                dtSB[0].DocumentCode   = dt[0].DocumentCode;


                handlerRC.UpdateTbt_SaleBasic(dtSB[0]);


                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public void UpdateOperationOffice(string contractCode, string operationOfficeCode)
        {
            try
            {
                if (string.IsNullOrEmpty(contractCode) || string.IsNullOrEmpty(operationOfficeCode))
                {
                    return;
                }

                ISaleContractHandler saleHandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;
                var lstSales = saleHandler.GetTbt_SaleBasic(contractCode, null, null);
                if (lstSales != null && lstSales.Count > 0)
                {
                    foreach (var sale in lstSales)
                    {
                        sale.OperationOfficeCode = operationOfficeCode;
                        saleHandler.UpdateTbt_SaleBasic(sale);
                    }
                }

                IQuotationHandler quotationHandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler;

                var lstQuotationTarget = quotationHandler.GetTbt_QuotationTargetByContractCode(contractCode);
                if (lstQuotationTarget != null && lstQuotationTarget.Count > 0)
                {
                    foreach (var q in lstQuotationTarget)
                    {
                        quotationHandler.UpdateQuotationTarget(new doUpdateQuotationTargetData()
                        {
                            QuotationTargetCode    = q.QuotationTargetCode,
                            ContractTransferStatus = q.ContractTransferStatus,
                            ContractCode           = q.ContractCode,
                            TransferDate           = q.TransferDate,
                            TransferAlphabet       = q.TransferAlphabet,
                            LastAlphabet           = q.LastAlphabet,
                            QuotationOfficeCode    = q.QuotationTargetCode,
                            OperationOfficeCode    = operationOfficeCode,
                        });
                    }
                }

                IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler;

                var lstInstallationBasic = installHandler.GetTbt_InstallationBasicData(contractCode);
                if (lstInstallationBasic != null && lstInstallationBasic.Count > 0)
                {
                    foreach (var ib in lstInstallationBasic)
                    {
                        ib.OperationOfficeCode = operationOfficeCode;
                        installHandler.UpdateTbt_InstallationBasic(ib);
                    }
                }

                var lstInstallationHistory = installHandler.GetTbt_InstallationHistory(contractCode, null, null);
                if (lstInstallationHistory != null && lstInstallationHistory.Count > 0)
                {
                    foreach (var ih in lstInstallationHistory)
                    {
                        ih.OperationOfficeCode = operationOfficeCode;
                    }

                    installHandler.UpdateTbt_InstallationHistory(lstInstallationHistory);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }