Esempio n. 1
0
        /// <summary>
        /// Get contract data for view
        /// </summary>
        /// <param name="type"></param>
        /// <param name="contractPrefix"></param>
        /// <returns></returns>
        public ActionResult CMS100_LoadContract(string type, string contractPrefix)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CMS100_ScreenParameter CMS100Param   = GetScreenObject <CMS100_ScreenParameter>();
                IViewContractHandler   hand          = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler;
                ICommonHandler         comHand       = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                List <doMiscTypeCode>  tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>()
                {
                    new doMiscTypeCode()
                    {
                        FieldName = MiscType.C_CURRENCT,
                        ValueCode = "%"
                    }
                }).ToList();

                List <dtContractListGrp> lst = new List <dtContractListGrp>();
                if (type.Contains("CT"))
                {
                    if (type.Contains("Rental"))
                    {
                        lst = hand.GetContractListForViewCustGrp_CT_Rental(CMS100Param.GroupCode, contractPrefix);
                    }
                    else
                    {
                        lst = hand.GetContractListForViewCustGrp_CT_Sale(CMS100Param.GroupCode, contractPrefix);
                    }
                }
                else
                {
                    if (type.Contains("Rental"))
                    {
                        lst = hand.GetContractListForViewCustGrp_R_Rental(CMS100Param.GroupCode, contractPrefix);
                    }
                    else
                    {
                        lst = hand.GetContractListForViewCustGrp_R_Sale(CMS100Param.GroupCode, contractPrefix);
                    }
                }
                //Add Currency
                for (int i = 0; i < lst.Count(); i++)
                {
                    lst[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies);
                }

                res.ResultData = CommonUtil.ConvertToXml <dtContractListGrp>(lst, "Common\\CMS100_ContractList", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }