public ActionResult _SetPoInfo(string id) { T_GW_FieldInfoManagement data = entities.T_GW_FieldInfoManagement.Find(Convert.ToDecimal(id)); if (data != null) { var t1 = X.GetCmp <TextField>("ProjectName"); var t2 = X.GetCmp <TextField>("ProjectSite"); var t3 = X.GetCmp <TextField>("ProjectNo"); t1.Text = data.ProjectName; t2.Text = data.FieldName; t3.Text = data.ProjectNo; } 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); }