コード例 #1
0
        public ActionResult Export()
        {
            string tempFilePath = string.Empty;
            try
            {
                string exportTemplateDirectory = Server.MapPath(NMBConfig.ExportTemplateDirectory);
                string exportTemplateFilePath = Path.Combine(exportTemplateDirectory, "EmptyTemplate.xls");

                tempFilePath = Path.Combine(exportTemplateDirectory, Guid.NewGuid() + ".xls");
                System.IO.File.Copy(exportTemplateFilePath, tempFilePath, true);

                BLL_NoMaster bll_NoMaster = new BLL_NoMaster();
                bll_NoMaster.NotInFeeClassExport(tempFilePath);

                return File(Tools.FileToByte(tempFilePath), "application/unknown", "费项分类表.xls");
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                return Content(ex.Message);
            }
            finally
            {
               System.IO.File.Delete(tempFilePath);
            }
        }
コード例 #2
0
        public ActionResult GetNoMasterNoInFeeClass()
        {
            try
            {
                BLL_NoMaster bll_NoMaster = new BLL_NoMaster();
                DataTable dt = bll_NoMaster.GetNotInFeeClass();

                resultJSON = JsonConvert.SerializeObject(dt, new DataTableToJosnConverter());

                return Content(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                resultJSON = Tools.ExecResultToJSON(false, ex.Message);
                return Content(resultJSON);
            }
        }