// GET: FLOW_PRODUCT/Create public ActionResult Create() { List <SYS_USER> categories = SYS_USER.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "cname"); List <FLOW_CLIENT> categoriesclient = FLOW_CLIENT.GETALL(); ViewData["Categoriesclient"] = new SelectList(categoriesclient, "id", "company_name"); return(View()); }
public ActionResult Edit([Bind(Include = "id,code,Responserid_fx,name,clientid_fx,stratdate,deadlinedate,request_text,statuss,request_file,statuss,desc_text,remark,whocreateid_fx,createdate")] FLOW_PRODUCT fLOW_PRODUCT) { if (ModelState.IsValid) { db.Entry(fLOW_PRODUCT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } List <SYS_USER> categories = SYS_USER.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "cname"); List <FLOW_CLIENT> categoriesclient = FLOW_CLIENT.GETALL(); ViewData["Categoriesclient"] = new SelectList(categoriesclient, "id", "company_name"); return(View(fLOW_PRODUCT)); }
// GET: FLOW_PRODUCT/Edit/5 public ActionResult Edit(int?id) { List <SYS_USER> categories = SYS_USER.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "cname"); List <FLOW_CLIENT> categoriesclient = FLOW_CLIENT.GETALL(); ViewData["Categoriesclient"] = new SelectList(categoriesclient, "id", "company_name"); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FLOW_PRODUCT fLOW_PRODUCT = db.FLOW_PRODUCT.Find(id); if (fLOW_PRODUCT == null) { return(HttpNotFound()); } return(View(fLOW_PRODUCT)); }
public ActionResult Create([Bind(Include = "id,code,Responserid_fx,name,clientid_fx,stratdate,deadlinedate,request_text,request_file,statuss,desc_text,remark,whocreateid_fx,createdate")] FLOW_PRODUCT fLOW_PRODUCT) { Model1 ef = new Model1(); String username = Request.Cookies["username"].Value.ToString(); String cuuserid = ef.SYS_USER.Where(item => item.account_id == username).First <SYS_USER>().id.ToString(); var obj = ef.FLOW_PRODUCT.Where(item => item.id >= 0); int nowcode = 0, maxid = 0; if (obj.Count <FLOW_PRODUCT>() > 0) { maxid = obj.Max(item => item.id); nowcode = maxid + 1; } else { nowcode = 1; } fLOW_PRODUCT.code = "PRD" + nowcode.ToString().PadLeft(5, '0'); fLOW_PRODUCT.createdate = DateTime.Now; fLOW_PRODUCT.whocreateid_fx = int.Parse(cuuserid); fLOW_PRODUCT.statuss = "进行中"; if (ModelState.IsValid) { db.FLOW_PRODUCT.Add(fLOW_PRODUCT); db.SaveChanges(); return(RedirectToAction("Index")); } List <SYS_USER> categories = SYS_USER.GETALL(); ViewData["Categories"] = new SelectList(categories, "id", "cname"); List <FLOW_CLIENT> categoriesclient = FLOW_CLIENT.GETALL(); ViewData["Categoriesclient"] = new SelectList(categoriesclient, "id", "company_name"); return(View(fLOW_PRODUCT)); }