示例#1
0
 public ActionResult UploadReport(string reportType)
 {
     var model = new MonthReportDoc { ReportType = reportType, Year = DateTime.Now.Year.ToString(),Month = DateTime.Now.Month.ToString(),UploadBy = CurrentUser.UserName};
        // ViewBag.UserName = CurrentUser.UserName;
     return PartialView("_ReportdocForm",model);
 }
示例#2
0
        public ActionResult SaveMonthReport(string reporttype,string year,string month,string username)
        {
            var newreport = new MonthReportDoc();
             HttpPostedFileBase uploadfile = Request.Files[0];
             try
             {
                 newreport.Year = year;
                 newreport.Month = month;
                 newreport.ReportType = reporttype;
                 newreport.UploadBy = username;
                 newreport.DocName = Path.GetFileNameWithoutExtension(uploadfile.FileName);
                 newreport.Filepath = _fileStore.SaveUploadedFile(uploadfile, "MonthReportFiles/" + newreport.Year + newreport.Month);
                 _montReportDocRepository.Add(newreport);
                 UnitOfWork.Commit();
             }
             catch (Exception)
             {

                 return Content("不能上传文件");
             }
             return Content("上传成功");
        }