Ejemplo n.º 1
0
        public JsonResult GetWorklogFileExist()
        {
            int      year  = int.Parse(Request["year"]);
            int      month = int.Parse(Request["month"]);
            DateTime dt    = new DateTime(year, month, 1);

            return(Json(WorklogTimeService.GetWorklogTimesExist(dt)));
        }
Ejemplo n.º 2
0
        public ActionResult GetWorklogTimesFile()
        {
            int      year  = int.Parse(Request["year"]);
            int      month = int.Parse(Request["month"]);
            DateTime dt    = new DateTime(year, month, 1);

            using (MemoryStream ms = new MemoryStream())
            {
                var rlt = WorklogTimeService.GetWorklogTimesExcelModel(dt);
                rlt.Write(ms);
                return(File(ms.ToArray(), "application/vnd.ms-excel", string.Format("{0}-{1}-worklog统计表.xlsx", year, month)));
            }
        }
Ejemplo n.º 3
0
        public JsonResult WorklogTimeFileHandler()
        {
            HttpPostedFileBase file = Request.Files[0];
            int              year   = int.Parse(Request.Form["date"]);
            Stream           stream = file.InputStream;
            FileUploadHelper helper = new FileUploadHelper(stream, file.FileName, LoginName);
            var              result = helper.ReadWorklogFile(year);

            if (!result.hasError)
            {
                WorklogTimeService.ClearWorklogTimesRecord(result.logDates);
                WorklogTimeService.SaveWorkLogTimes(result.result);
                return(Json("上传成功"));
            }
            else
            {
                return(Json("上传失败:" + result.ErrorMsg));
            }
        }