public ActionResult FieldScheduleAdd(T_GW_FieldSchedule fs)
 {
     fs.InputMan  = user.EmployeeName;
     fs.InputTime = DateTime.Now;
     DB.T_GW_FieldSchedule.Attach(fs);
     DB.Entry(fs).State = EntityState.Modified;
     DB.SaveChanges();
     return(this.Direct());
 }
        public ActionResult FieldInfoAdd(T_GW_FieldInfoManagement fim)
        {
            var list = DB.T_GM_Warehouse.Where(w => w.WarehouseID == fim.WarehouseID).ToList().FirstOrDefault();

            if (list == null)
            {
                X.Msg.Alert("提示", "输入的仓库有误").Show();
                return(this.Direct());
            }
            fim.InputMan  = user.EmployeeName;
            fim.InputTime = DateTime.Now;

            var    uploadfile  = this.GetCmp <FileUploadField>("AttachmentPath");
            int    filesize    = uploadfile.PostedFile.ContentLength;
            string fileoldname = uploadfile.FileName;

            if (filesize > 20 * 1024 * 1024)
            {
                X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show();
                return(this.Direct());
            }
            if (uploadfile.HasFile)
            {
                string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname);
                string logicpath   = "~/AttachFile/WorkYard/FieldInfo/" + filenewname;
                string filepath    = Server.MapPath(logicpath);
                fim.FieldMapPath = logicpath;
                uploadfile.PostedFile.SaveAs(filepath);
            }
            DB.T_GW_FieldInfoManagement.Add(fim);

            T_GW_FieldSchedule fs = new T_GW_FieldSchedule();

            fs.ProjectNo = fim.ProjectNo;
            DB.T_GW_FieldSchedule.Add(fs);

            var project = DB.V_GM_DetailProject.FirstOrDefault(w => w.ProjectNo == fim.ProjectNo);

            fim.ProjectName = project.ProjectName;
            DB.SaveChanges();
            DirectResult result = new DirectResult();

            result.IsUpload = true;
            return(result);
        }