示例#1
0
        public ActionResult ICS150_ExportExcelData(doMatchRReport dtIncome)
        {
            ICS150_ScreenParameter param = GetScreenObject <ICS150_ScreenParameter>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;


            try
            {
                ValidatorUtil validator = new ValidatorUtil();

                ICS150_ValidateBusiness(validator, dtIncome);
                ValidatorUtil.BuildErrorMessage(res, validator, null);
                if (res.IsError)
                {
                    return(Json(res));
                }

                if (dtIncome == null || CommonUtil.IsNullAllField(dtIncome))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }
                else
                {
                    IIncomeHandler handler  = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler;
                    ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                    if (string.IsNullOrEmpty(dtIncome.CreateBy) && CommonUtil.dsTransData != null)
                    {
                        dtIncome.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo;
                    }
                    var lst = handler.GetListIRC050(dtIncome);

                    if (lst.Count != 0)
                    {
                        IIncomeDocumentHandler docService = ServiceContainer.GetService <IIncomeDocumentHandler>() as IIncomeDocumentHandler;
                        param.PendingDownloadFilePath = docService.GenerateICR050Report(lst, dtIncome);
                        param.PendingDownloadFileName = "ICR050Report.xlsx";
                        res.ResultData = true;
                    }
                    else
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001);
                    }
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
示例#2
0
        private void ICS150_ValidateBusiness(ValidatorUtil validator, doMatchRReport paramsearch)
        {
            ICS150_ScreenParameter screenObject = GetScreenObject <ICS150_ScreenParameter>();



            if (paramsearch.PaymentDate == null)
            {
                validator.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS150"
                                          , MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007
                                          , "PaymentDate", "lblPaymentDate", "PaymentDate");
            }


            if (CommonUtil.IsNullOrEmpty(paramsearch.GroupName))
            {
                validator.AddErrorMessage(MessageUtil.MODULE_INCOME, "ICS150"
                                          , MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007
                                          , "GroupName", "lblGroupname", "GroupName");
            }
        }