Exemple #1
0
        /// <summary>
        /// Retrieve money collection management info information list of specific screen mode and search criteria information
        /// </summary>
        /// <param name="data">Search criteria</param>
        /// <returns></returns>
        public ActionResult ICS101_SearchData(ICS101_RegisterData data)
        {
            ICS101_ScreenParameter param        = GetScreenObject <ICS101_ScreenParameter>();
            ICS101_RegisterData    RegisterData = new ICS101_RegisterData();
            CommonUtil             comUtil      = new CommonUtil();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            List <doGetMoneyCollectionManagementInfo> _doGetMoneyCollectionManagementInfoList = new List <doGetMoneyCollectionManagementInfo>();

            try
            {
                // Common Check Sequence

                // System Suspend
                ICommonHandler handlerCommon  = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler;

                bool bolInput1 = false;
                bool bolInput2 = false;
                bool bolInput3 = false;

                if (handlerCommon.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                ICS101_ScreenParameter sParam = GetScreenObject <ICS101_ScreenParameter>();

                if (data == null)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INCOME,
                                        "ICS101",
                                        MessageUtil.MODULE_COMMON,
                                        MessageUtil.MessageList.MSG0006);

                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }
                if (data.Header == null)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INCOME,
                                        "ICS101",
                                        MessageUtil.MODULE_COMMON,
                                        MessageUtil.MessageList.MSG0006);

                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }

                if (data.Header.dtpExpectedCollectDateFrom == Convert.ToDateTime("01-01-0001"))
                {
                    bolInput1 = true;
                    data.Header.dtpExpectedCollectDateFrom = null;
                }
                if (data.Header.dtpExpectedCollectDateFrom == null)
                {
                    bolInput1 = true;
                }
                if (data.Header.dtpExpectedCollectDateTo == Convert.ToDateTime("01-01-0001"))
                {
                    bolInput2 = true;
                    data.Header.dtpExpectedCollectDateTo = null;
                }
                if (data.Header.dtpExpectedCollectDateTo == null)
                {
                    bolInput2 = true;
                }

                string strDummyCollectionArea = string.Empty;

                if (data.Header.chklCollectionArea != null)
                {
                    strDummyCollectionArea = ",";
                    foreach (string _string in data.Header.chklCollectionArea)
                    {
                        strDummyCollectionArea = strDummyCollectionArea + _string + ",";
                    }
                }
                else
                {
                    bolInput3 = true;
                }

                if (bolInput1 && bolInput2 && bolInput3)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INCOME,
                                        "ICS101",
                                        MessageUtil.MODULE_COMMON,
                                        MessageUtil.MessageList.MSG0006);

                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }

                _doGetMoneyCollectionManagementInfoList =
                    iincomeHandler.GetMoneyCollectionManagementInfoList(data.Header.dtpExpectedCollectDateFrom
                                                                        , data.Header.dtpExpectedCollectDateTo
                                                                        , strDummyCollectionArea);

                //if (_doGetMoneyCollectionManagementInfoList != null)
                //{
                //    if (_doGetMoneyCollectionManagementInfoList.Count > CommonValue.MAX_GRID_ROWS)
                //    {
                //        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0052
                //            , new string[] { CommonValue.MAX_GRID_ROWS.ToString("#,##0") });

                //        return Json(res);
                //    }
                //}
                param.RegisterData = data;
                param.doGetMoneyCollectionManagementInfo = _doGetMoneyCollectionManagementInfoList;

                // return "1" to js is every thing OK
                if (res.MessageList == null || res.MessageList.Count == 0)
                {
                    List <ICS101_doGetMoneyCollectionManagementInfo> lst = CommonUtil.ClonsObjectList <doGetMoneyCollectionManagementInfo, ICS101_doGetMoneyCollectionManagementInfo>(_doGetMoneyCollectionManagementInfoList);
                    //res.ResultData = param;
                    res.ResultData = CommonUtil.ConvertToXml <ICS101_doGetMoneyCollectionManagementInfo>(
                        lst,
                        "Income\\ICS101_MoneyCollectionManagementInformation",
                        CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                }
                else
                {
                    res.ResultData = null;
                }

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }