/// <summary>
        /// Load search result to grid
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult CTS040_Search(CTS040_Search cond)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
            try
            {
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { cond }); //AtLeast1FieldNotNullOrEmptyAttribute
                if (res.IsError)
                {
                    return(Json(res));
                }


                CommonUtil c = new CommonUtil();
                cond.QuotationCode = c.ConvertQuotationTargetCode(cond.QuotationCode, CommonUtil.CONVERT_TYPE.TO_LONG);

                setContractOfficeCode(cond);
                setOperationOfficeCode(cond);

                IDraftContractHandler hand = ServiceContainer.GetService <IDraftContractHandler>() as IDraftContractHandler;
                List <dtSearchDraftContractResult> list = hand.SearchDraftContractList(cond);

                res.ResultData = CommonUtil.ConvertToXml <dtSearchDraftContractResult>(list, "Contract\\CTS040", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Exemple #2
0
        /// <summary>
        /// Load search result to grid
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult CTS030_Search(CTS030_Search cond)
        {
            List <dtSearchDraftContractResult> list = new List <dtSearchDraftContractResult>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { cond }); //AtLeast1FieldNotNullOrEmptyAttribute
                if (res.IsError)
                {
                    return(Json(res));
                }

                CTS030_ScreenParameter CTS030Param = GetScreenObject <CTS030_ScreenParameter>();
                if (CTS030Param == null)
                {
                    CTS030Param = new CTS030_ScreenParameter();
                }

                dsCTS030Data data = CTS030Param.data;
                if (data == null)
                {
                    //Save search condition value
                    dsCTS030Data dsData = new dsCTS030Data();
                    dsData.doSearchCondition = cond;

                    //Set default to some search condition
                    CommonUtil c = new CommonUtil();
                    cond.QuotationCode         = c.ConvertQuotationTargetCode(cond.QuotationCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                    cond.ApproveContractStatus = ApprovalStatus.C_APPROVE_STATUS_WAITFORAPPROVE;

                    //Query for draft contract
                    IDraftContractHandler hand = ServiceContainer.GetService <IDraftContractHandler>() as IDraftContractHandler;
                    list = hand.SearchDraftContractList(cond);

                    //Save search result list
                    dsData.dtSearchResult = list;

                    //Save condition and result into session
                    CTS030Param.data = dsData;
                    UpdateScreenObject(CTS030Param);
                }
                else
                {
                    list = data.dtSearchResult;
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            res.ResultData = CommonUtil.ConvertToXml <dtSearchDraftContractResult>(list, "Contract\\CTS030", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            return(Json(res));
        }