コード例 #1
0
        public void CMW030_DownloadBLR060CsvReport(DateTime?GenerateDateFrom, DateTime?GenerateDateTo)
        {
            ObjectResultData res            = new ObjectResultData();
            IBillingHandler  billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;

            var datas = billingHandler.GetRptInvoiceIssueList(GenerateDateFrom, GenerateDateTo);

            MemoryStream csv   = CSVCreator.CreateCSVSteam <doGetRptInvoiceIssueList>(datas, "Common\\CMS030_BLR060Csv");
            string       fName = string.Format("{0}BLR060_{1}-{2}.csv"
                                               , DateTime.Now.ToString("yyyyMM"), GenerateDateFrom.Value.ToString("yyyyMMdd"), GenerateDateTo.Value.ToString("yyyyMMdd"));

            this.DownloadCSVFile(fName, csv.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// Get searach result of document data
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult CMS030_SearchResponse(doDocumentDataCondition cond)
        {
            CommonUtil       c   = new CommonUtil();
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            List <dtDocumentData> list = new List <dtDocumentData>();

            //List<dtDocumentData> vw_list = new List<dtDocumentData>();

            try
            {
                cond.QuotationTargetCode = c.ConvertQuotationTargetCode(cond.QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                //cond.ProjectCode = c.ConvertProjectCode(cond.ProjectCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                cond.ContractCode      = c.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                cond.BillingTargetCode = c.ConvertBillingTargetCode(cond.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG);

                if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_CONTRACT)
                {
                    cond.DocumentNo = ConvertDocumentNo(cond.DocumentNo, CommonUtil.CONVERT_TYPE.TO_LONG.ToString());
                }

                if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_INCOME)
                {
                    if (cond.DocumentCode == "BLR060")
                    {
                        List <string> fieldName     = new List <string>();
                        List <string> controlName   = new List <string>();
                        List <string> realFieldName = new List <string>();

                        if (CommonUtil.IsNullOrEmpty(cond.GenerateDateFrom))
                        {
                            fieldName.Add("lblGenerateDate");
                            controlName.Add("GenerateDateFrom");
                        }

                        if (CommonUtil.IsNullOrEmpty(cond.GenerateDateTo))
                        {
                            fieldName.Add("lblGenerateDate");
                            controlName.Add("GenerateDateTo");
                        }

                        foreach (var rawFieldName in fieldName.Distinct())
                        {
                            realFieldName.Add(CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS030", rawFieldName));
                        }

                        if ((realFieldName.Count > 0) || (controlName.Count > 0))
                        {
                            if ((realFieldName.Count > 0) && (controlName.Count > 0))
                            {
                                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, realFieldName.ToArray(), controlName.ToArray());
                            }

                            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                            return(Json(res));
                        }
                    }
                }



                if (cond.DocumentType == null || cond.DocumentCode == null)
                {
                    //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0098);
                }
                else
                {
                    ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

                    IDocumentHandler handler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler;
                    list = handler.GetDocumentDataList(cond);

                    //vw_list = CommonUtil.ConvertObjectbyLanguage<dtDocumentData, dtDocumentData>(list,
                    //                            "ConOfficeCodeName",
                    //                            "OperOfficeCodeName",
                    //                            "BillOfficeCodeName",
                    //                            "IssueOfficeCodeName",
                    //                            "DocumentName"
                    //                            );


                    // Misc Mapping
                    MiscTypeMappingList miscMapping = new MiscTypeMappingList();
                    miscMapping.AddMiscType(list.ToArray());
                    handlerCommon.MiscTypeMappingList(miscMapping);

                    // Language Mapping
                    CommonUtil.MappingObjectLanguage <dtDocumentData>(list);

                    if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_CONTRACT)
                    {
                        foreach (var item in list)
                        {
                            item.DocumentNo = ConvertDocumentNo(item.DocumentNo, CommonUtil.CONVERT_TYPE.TO_SHORT.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                list            = new List <dtDocumentData>();
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            if (cond.Mode == 0)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 1)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode1", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 2)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode2", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 3)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode3", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 4)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode4", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 5)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode5", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 6)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode6", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 7)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode7_CMR020", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 8)
            {
                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode8", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }
            else if (cond.Mode == 9)
            {
                IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;

                var datas = billingHandler.GetRptInvoiceIssueList(cond.GenerateDateFrom, cond.GenerateDateTo);

                List <dtDocumentData> ls = new List <dtDocumentData>();

                if (datas != null && datas.Count > 0)
                {
                    ls.Add(new dtDocumentData()
                    {
                        GenerateDateFrom = cond.GenerateDateFrom,
                        GenerateDateTo   = cond.GenerateDateTo
                    });
                }

                res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(ls, "Common\\CMS030_Mode9", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            }

            return(Json(res));
        }