Exemple #1
0
        /// <summary>
        /// Get Sale digest by type, contract code and OCC.
        /// </summary>
        /// <param name="sType"></param>
        /// <param name="strLongContractCode"></param>
        /// <param name="OCC"></param>
        /// <returns></returns>
        public ActionResult getSaleDigestCMS150(string sType, string strLongContractCode, string OCC)
        {
            if (OCC.Trim() == "")
            {
                OCC = null;
            }
            if (strLongContractCode.Trim() == "")
            {
                strLongContractCode = null;
            }
            if (sType.Trim() == "")
            {
                sType = null;
            }

            List <View_dtSaleHistoryDigestList> vSaleHist = null;
            ObjectResultData res = new ObjectResultData();

            try
            {
                ISaleContractHandler  handSale      = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;
                ICommonHandler        comHand       = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>()
                {
                    new doMiscTypeCode()
                    {
                        FieldName = MiscType.C_CURRENCT,
                        ValueCode = "%"
                    }
                }).ToList();
                List <dtTbt_SaleBasicForView> dtTbt_SaleBasicForView = handSale.GetTbt_SaleBasicForView(strLongContractCode, OCC, FlagType.C_FLAG_ON);
                //Add Currency to List
                for (int i = 0; i < dtTbt_SaleBasicForView.Count(); i++)
                {
                    dtTbt_SaleBasicForView[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                }

                if (dtTbt_SaleBasicForView.Count <= 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                    // return Json(res);
                }
                else
                {
                    IViewContractHandler       handView            = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler;
                    List <dtSaleHistoryDigest> dtSaleHistoryDigest = handView.GetSaleHistoryDigestList(dtTbt_SaleBasicForView[0].ContractCode, null, null);
                    //Add Currency to List
                    for (int i = 0; i < dtSaleHistoryDigest.Count(); i++)
                    {
                        dtSaleHistoryDigest[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                    }
                    vSaleHist = CommonUtil.ConvertObjectbyLanguage <dtSaleHistoryDigest, View_dtSaleHistoryDigestList>(dtSaleHistoryDigest, "ChangeTypeName", "IncidentARTypeName");
                }

                string XmlSaleHist = CommonUtil.ConvertToXml <View_dtSaleHistoryDigestList>(vSaleHist, "Common\\CMS150_sale", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(XmlSaleHist));
            }
            catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); }
        }
Exemple #2
0
        /// <summary>
        /// Get Sale Basic information from tbt_SaleBasic
        /// </summary>
        /// <param name="strLongContractCode"></param>
        /// <param name="OCC"></param>
        /// <returns></returns>
        public dsSaleBasicForHistDigestView GetSaleBasicForHistoryDigestView(string strLongContractCode, string OCC)
        {
            try
            {
                dsSaleBasicForHistDigestView dsSaleBasicForHDView = new dsSaleBasicForHistDigestView();
                ISaleContractHandler         handSale             = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;
                ICommonHandler        comHand       = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>()
                {
                    new doMiscTypeCode()
                    {
                        FieldName = MiscType.C_CURRENCT,
                        ValueCode = "%"
                    }
                }).ToList();

                List <dtTbt_SaleBasicForView> dtTbt_SaleBasicForView = handSale.GetTbt_SaleBasicForView(strLongContractCode, OCC, FlagType.C_FLAG_ON);
                //Check Currency
                if (dtTbt_SaleBasicForView[0].NormalInstallFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].NormalInstallFee = dtTbt_SaleBasicForView[0].NormalInstallFeeUsd;
                }
                if (dtTbt_SaleBasicForView[0].OrderInstallFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].OrderInstallFee = dtTbt_SaleBasicForView[0].OrderInstallFeeUsd;
                }
                if (dtTbt_SaleBasicForView[0].InstallFeePaidBySECOMCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].InstallFeePaidBySECOM = dtTbt_SaleBasicForView[0].InstallFeePaidBySECOMUsd;
                }
                if (dtTbt_SaleBasicForView[0].InstallFeeRevenueBySECOMCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].InstallFeeRevenueBySECOM = dtTbt_SaleBasicForView[0].InstallFeeRevenueBySECOMUsd;
                }
                if (dtTbt_SaleBasicForView[0].OrderProductPriceCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].OrderProductPrice = dtTbt_SaleBasicForView[0].OrderProductPriceUsd;
                }
                if (dtTbt_SaleBasicForView[0].NormalProductPriceCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].NormalProductPrice = dtTbt_SaleBasicForView[0].NormalProductPriceUsd;
                }
                if (dtTbt_SaleBasicForView[0].BidGuaranteeAmount1CurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].BidGuaranteeAmount1 = dtTbt_SaleBasicForView[0].BidGuaranteeAmount1Usd;
                }
                if (dtTbt_SaleBasicForView[0].BidGuaranteeAmount2CurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].BidGuaranteeAmount2 = dtTbt_SaleBasicForView[0].BidGuaranteeAmount2Usd;
                }
                if (dtTbt_SaleBasicForView[0].NewBldMgmtCostCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US)
                {
                    dtTbt_SaleBasicForView[0].NewBldMgmtCost = dtTbt_SaleBasicForView[0].NewBldMgmtCostUsd;
                }

                //Add Currency to List
                for (int i = 0; i < dtTbt_SaleBasicForView.Count(); i++)
                {
                    dtTbt_SaleBasicForView[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                }

                if (dtTbt_SaleBasicForView.Count <= 0)
                {
                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                }
                dsSaleBasicForHDView.dtTbt_SaleBasicForView = dtTbt_SaleBasicForView;


                //3.3
                //List<doMiscTypeCode> dtGetMiscTypeCode = new List<doMiscTypeCode>();
                //for (int i = 0; i < 3; i++)
                //    dtGetMiscTypeCode.Add(new doMiscTypeCode());
                //dtGetMiscTypeCode[0].FieldName = MiscType.C_SALE_CHANGE_TYPE;
                //dtGetMiscTypeCode[0].ValueCode = "%";
                //dtGetMiscTypeCode[1].FieldName = MiscType.C_INCIDENT_TYPE;
                //dtGetMiscTypeCode[1].ValueCode = "%";
                //dtGetMiscTypeCode[2].FieldName = MiscType.C_AR_TYPE;
                //dtGetMiscTypeCode[2].ValueCode = "%";
                //ICommonHandler handCom = ServiceContainer.GetService<ICommonHandler>() as ICommonHandler;

                //List<doMiscTypeCode> MiscTypeResult = handCom.GetMiscTypeCodeList(dtGetMiscTypeCode);
                //dsSaleBasicForHDView.dtMiscellaneousType = MiscTypeResult;
                //3.4
                IViewContractHandler       handView = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler;
                List <dtSaleHistoryDigest> dtSaleHistoryDigestList = handView.GetSaleHistoryDigestList(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContractCode, null, null);

                //Add Currency to List
                for (int i = 0; i < dtSaleHistoryDigestList.Count(); i++)
                {
                    dtSaleHistoryDigestList[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                }

                dsSaleBasicForHDView.dtSaleHistoryDigestList = dtSaleHistoryDigestList;

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