示例#1
0
        public ActionResult DataAdd(ww_Re modelRe, ww_Case modelCase, ww_Suspect modelSuspect, string Num, AnyModel model, List<HttpPostedFileBase> fileUpload)
        {
            int Resid=  BllBuilder.BuilRes().DataAdd(modelRe, Num, modelCase, modelSuspect);

            foreach (HttpPostedFileBase item in fileUpload)
            {

                if (item != null && Array.Exists(model.FilesToBeUploaded.Split(','), s => s.Equals(item.FileName)))
                {
                    // string path = AppDomain.CurrentDomain.BaseDirectory + "Picture/";
                    // string filename = Path.GetFileName(Request.Files[upload].FileName);
                    string dt = DateTime.Now.Millisecond.ToString();
                    item.SaveAs(Server.MapPath(Path.Combine("~/Picture/", dt + item.FileName)));
                    ww_Photo myPhoto = new ww_Photo()
                    {
                        BoolDel = false,
                        ResID = Resid,
                        PhotoURL = "/Picture/" + dt + item.FileName,
                    };
                    BllBuilder.BuilPhoto().Upload(myPhoto);
                    // item.SaveAs(Server.MapPath("~/Picture/NewFolder1"));
                    //Save or do your action -  Each Attachment ( HttpPostedFileBase item )
                }
            }

            //ViewBag.Resid = Resid;
            return RedirectToAction("Alert", "Login", new { alert = "录入成功!!!" });
        }
示例#2
0
        /// <summary>
        /// 上传
        /// </summary>
        /// <param name="ResID"></param>
        /// <returns></returns>
        public dynamic Upload(ww_Photo model)
        {
            //using (var scope = db.GetTransaction())
            //{
            //    // Do transacted updates here

            //    // Commit
            //    scope.Complete();
            //}
            db.BeginTransaction();
            db.Insert(model);
            db.CompleteTransaction();
            ////List<ww_Re>  i= list.ToList();
            return true;
        }
示例#3
0
        public ActionResult UploadAction(AnyModel model, List<HttpPostedFileBase> fileUpload, int ResId)
        {
            // Your Code - / Save Model Details to DB

            // Handling Attachments -
            foreach (HttpPostedFileBase item in fileUpload)
            {

                if (item != null && Array.Exists(model.FilesToBeUploaded.Split(','), s => s.Equals(item.FileName)))
                {
                   // string path = AppDomain.CurrentDomain.BaseDirectory + "Picture/";
                   // string filename = Path.GetFileName(Request.Files[upload].FileName);
                    string dt = DateTime.Now.Millisecond.ToString();
                    item.SaveAs(Server.MapPath(Path.Combine("~/Picture/", dt + item.FileName)));
                    ww_Photo myPhoto=new ww_Photo(){
                        BoolDel=false,
                        ResID = ResId,
                        PhotoURL = "/Picture/" + dt + item.FileName,
                        };
                    BllBuilder.BuilPhoto().Upload(myPhoto);
                    // item.SaveAs(Server.MapPath("~/Picture/NewFolder1"));
                    //Save or do your action -  Each Attachment ( HttpPostedFileBase item )
                }
            }
            //var file = Request.Files["fileUpload"];
            //file.SaveAs(Server.MapPath("~/Picture/NewFolder1"));
            return RedirectToAction("Alert", "Login", new { alert = "上传成功!!!" });
        }