Пример #1
0
        private void ProcessTaskVersion(HttpRequestBase req, Ruanal.WebDomain.Model.TaskVersion model)
        {
            if (string.IsNullOrWhiteSpace(model.VersionNO))
            {
                model.VersionNO = DateTime.Now.ToString("vyyyy.MM.dd_HH.mm");
            }
            HttpPostedFileBase downloadfile = null;

            if (req.Files.Count > 0)
            {
                downloadfile = req.Files[0];
            }
            if (downloadfile == null || downloadfile.ContentLength == 0)
            {
                throw new Ruanal.WebDomain.MException("请上传文件");
            }

            string filename = model.TaskId + "_" + DateTime.Now.ToString("yyMMddHHmmss") + ".zip";
            string pathname = Pub.GetConfig("taskDllFile", "~/taskDllFile");
            string path     = Server.MapPath(pathname);

            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            string filefullname = System.IO.Path.Combine(path, filename);

            downloadfile.SaveAs(filefullname);
            model.FilePath = System.IO.Path.Combine(pathname.TrimStart('~'), filename).Replace("\\", "/");
            model.FileSize = downloadfile.ContentLength / 1024m;
        }
Пример #2
0
        public ActionResult BatchVersion(Ruanal.WebDomain.Model.TaskVersion model, int tag)
        {
            var tags = tasktagbll.GetAll();

            ViewBag.tags = tags;
            if (tag <= 0)
            {
                throw new Ruanal.WebDomain.MException("请选择标签!");
            }
            ProcessTaskVersion(Request, model);
            taskbll.BatchTaskVersion(model, tag);
            ViewBag.msg = "上传并设置为当前版本!";
            return(View());
        }
Пример #3
0
 public ActionResult TaskVersion(Ruanal.WebDomain.Model.TaskVersion model)
 {
     ProcessTaskVersion(Request, model);
     model = taskbll.AddTaskVersion(model);
     return(RedirectToAction("taskversion", new { taskid = model.TaskId }));
 }