Beispiel #1
0
        public ActionResult Detail(string PID)
        {
            Model.Content.Builds          builds = BDs.GetModelByValue("select top 1* from Builds  where isdel=0 and  pid='" + PID + "'", null);
            List <Model.Content.BDetails> bdt    = Details.GetModelsByValue("SELECT * FROM BDetails where isdel=0 and pid='" + PID + "'", null);

            ViewBag.Details = bdt;
            return(View(builds));
        }
Beispiel #2
0
        public JsonResult UploadSave(string ID, int Type, string Stract)
        {
            string pathForSaving = Server.MapPath("~/");
            string sqlcount      = "select top 1* from builds where isdel=0 and  PID='" + ID + "'";

            Model.Content.Builds builds = BD.GetModelByValue(sqlcount, null);
            try
            {
                foreach (string strfile in Request.Files)
                {
                    try
                    {
                        HttpPostedFileBase uploadFile = Request.Files[strfile] as HttpPostedFileBase;
                        if (uploadFile != null && uploadFile.ContentLength > 0)
                        {
                            var paths = DateTime.Now.ToString("yyMMdd_hhmmss") + "_" + uploadFile.FileName;
                            uploadFile.SaveAs(Server.MapPath("/UploadFiles/") + paths);
                            //添加附件信息
                            Model.Content.BDetails bDetails = new Model.Content.BDetails();
                            bDetails.Person  = uploadFile.FileName;
                            bDetails.PID     = ID;
                            bDetails.Urls    = "/UploadFiles/" + paths;
                            bDetails.Time    = DateTime.Now;
                            bDetails.Explain = Stract;
                            bDetails.Type    = Type;
                            Detail.Insert(bDetails);
                        }
                    }
                    catch (Exception ee)
                    {
                        //邮件通知
                    }
                }
            }
            catch (Exception ee)
            {
                return(Json(new { code = 1 }, JsonRequestBehavior.DenyGet));
            }
            return(Json(new { code = 0 }, JsonRequestBehavior.DenyGet));
        }