public ActionResult Edit([Bind(Include = "productid_fx,missiontype,projmotid_fx,id,code,projectid_fx,fromwhoid_fx,towhoid_fx,fromdate,todate,dad_mission,dad_level,isbottom,request_text,request_file,iscomplete,desc_text,remark,whocreateid_fx,createdate")] FLOW_MISSION fLOW_MISSION) { if (ModelState.IsValid) { db.Entry(fLOW_MISSION).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } List <FLOW_PRODUCT> categories_prod = FLOW_PRODUCT.GETALL(); ViewData["categories_prod"] = new SelectList(categories_prod, "id", "name"); List <FLOW_PROJECT> categories_proj = FLOW_PROJECT.GETALL(); ViewData["categories_proj"] = new SelectList(categories_proj, "id", "desc_text"); List <SYS_USER> category_user = SYS_USER.GETALL(); ViewData["category_user"] = new SelectList(category_user, "id", "cname"); List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); ViewData["categories_projmo"] = new SelectList(categories_projmo, "id", "name"); List <DD_MISSIONTYPE> missiontype = DD_MISSIONTYPE.GETALL(); ViewData["missiontype"] = new SelectList(missiontype, "code", "cvalue"); return(View(fLOW_MISSION)); }
// GET: FLOW_MISSION/Edit/5 public ActionResult Edit(int?id) { List <FLOW_PRODUCT> categories_prod = FLOW_PRODUCT.GETALL(); ViewData["categories_prod"] = new SelectList(categories_prod, "id", "name"); List <FLOW_PROJECT> categories_proj = FLOW_PROJECT.GETALL(); ViewData["categories_proj"] = new SelectList(categories_proj, "id", "desc_text"); List <SYS_USER> category_user = SYS_USER.GETALL(); ViewData["category_user"] = new SelectList(category_user, "id", "cname"); List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); ViewData["categories_projmo"] = new SelectList(categories_projmo, "id", "name"); List <DD_MISSIONTYPE> missiontype = DD_MISSIONTYPE.GETALL(); ViewData["missiontype"] = new SelectList(missiontype, "code", "cvalue"); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FLOW_MISSION fLOW_MISSION = db.FLOW_MISSION.Find(id); if (fLOW_MISSION == null) { return(HttpNotFound()); } return(View(fLOW_MISSION)); }
public ActionResult micnt(int?searchProd, int?searchProj, int?searchProjmo, string searchType, int?mistatus) { List <FLOW_PRODUCT> categories_prod = FLOW_PRODUCT.GETALL(); ViewData["categories_prod"] = new SelectList(categories_prod, "id", "name"); List <FLOW_PROJECT> categories_proj = FLOW_PROJECT.GETALL(); ViewData["categories_proj"] = new SelectList(categories_proj, "id", "desc_text"); List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); ViewData["categories_projmo"] = new SelectList(categories_projmo, "id", "name"); List <DD_MISSIONTYPE> missiontype = DD_MISSIONTYPE.GETALL(); ViewData["missiontype"] = new SelectList(missiontype, "code", "cvalue"); string strCategories = ""; string strDataCol = ""; string subwhere = " "; if (searchProd != null) { subwhere += " and productid_fx =" + searchProd.ToString(); } if (searchProj != null) { subwhere += " and projectid_fx =" + searchProj.ToString(); } if (searchProjmo != null) { subwhere += " and projmotid_fx =" + searchProjmo.ToString(); } if (!String.IsNullOrEmpty(searchType)) { subwhere += " and missiontype =" + searchType.ToString(); } if (mistatus != null) { if (mistatus == 2) { } else { subwhere += " and iscomplete =" + mistatus.ToString(); } } string strSql = "select (select cname from SYS_USER where id = towhoid_fx) countItem,count(id) countVal from FLOW_MISSION where 1=1 " + subwhere + " group by towhoid_fx"; DataSet ds = SqlHelper.ExecuteDataset(strSql); ChartsBind(ds, "countItem", "countVal", ref strCategories, ref strDataCol); strDataCol = ColumnDataToPieData(strCategories, strDataCol); ViewData["hcdata"] = ObjectToJson(strDataCol); return(View()); }
public ActionResult Create([Bind(Include = "productid_fx,missiontype,projmotid_fx,id,code,projectid_fx,fromwhoid_fx,towhoid_fx,fromdate,todate,dad_mission,dad_level,isbottom,request_text,request_file,iscomplete,desc_text,remark,whocreateid_fx,createdate")] FLOW_MISSION fLOW_MISSION) { 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_MISSION.Where(item => item.id >= 0); int nowcode = 0, maxid = 0; if (obj.Count <FLOW_MISSION>() > 0) { maxid = obj.Max(item => item.id); nowcode = maxid + 1; } else { nowcode = 1; } fLOW_MISSION.code = "MIS" + nowcode.ToString().PadLeft(5, '0'); fLOW_MISSION.createdate = DateTime.Now; fLOW_MISSION.whocreateid_fx = int.Parse(cuuserid); fLOW_MISSION.fromwhoid_fx = int.Parse(cuuserid); fLOW_MISSION.iscomplete = int.Parse("0"); if (ModelState.IsValid) { db.FLOW_MISSION.Add(fLOW_MISSION); db.SaveChanges(); return(RedirectToAction("Index")); } List <FLOW_PRODUCT> categories_prod = FLOW_PRODUCT.GETALL(); ViewData["categories_prod"] = new SelectList(categories_prod, "id", "name"); List <FLOW_PROJECT> categories_proj = FLOW_PROJECT.GETALL(); ViewData["categories_proj"] = new SelectList(categories_proj, "id", "desc_text"); List <SYS_USER> category_user = SYS_USER.GETALL(); ViewData["category_user"] = new SelectList(category_user, "id", "cname"); List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); ViewData["categories_projmo"] = new SelectList(categories_projmo, "id", "name"); List <DD_MISSIONTYPE> missiontype = DD_MISSIONTYPE.GETALL(); ViewData["missiontype"] = new SelectList(missiontype, "code", "cvalue"); return(View(fLOW_MISSION)); }
/// <summary> /// 获取模块 /// </summary> /// <param name="pid"></param> /// <returns></returns> public JsonResult getprojmo(int projectid_fx) { List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); var projmo = categories_projmo.Where(m => m.projectid_fx == projectid_fx).ToList(); List <SelectListItem> item = new List <SelectListItem>(); foreach (var i in projmo) { item.Add(new SelectListItem { Text = i.name, Value = i.id.ToString() }); } return(Json(item, JsonRequestBehavior.AllowGet)); }
// GET: FLOW_MISSION/Create public ActionResult Create() { List <FLOW_PRODUCT> categories_prod = FLOW_PRODUCT.GETALL(); ViewData["categories_prod"] = new SelectList(categories_prod, "id", "name"); List <FLOW_PROJECT> categories_proj = FLOW_PROJECT.GETALL(); ViewData["categories_proj"] = new SelectList(categories_proj, "id", "desc_text"); List <SYS_USER> category_user = SYS_USER.GETALL(); ViewData["category_user"] = new SelectList(category_user, "id", "cname"); List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); ViewData["categories_projmo"] = new SelectList(categories_projmo, "id", "name"); List <DD_MISSIONTYPE> missiontype = DD_MISSIONTYPE.GETALL(); ViewData["missiontype"] = new SelectList(missiontype, "code", "cvalue"); return(View()); }
public ActionResult Index(string searchName, int?searchProj, int?searchProjmo, string searchType, string sortOrder, int?mistatus, int?pageNum, int?mistatuss) { List <FLOW_PRODUCT> categories_prod = FLOW_PRODUCT.GETALL(); ViewData["categories_prod"] = new SelectList(categories_prod, "id", "name"); List <FLOW_PROJECT> categories_proj = FLOW_PROJECT.GETALL(); ViewData["categories_proj"] = new SelectList(categories_proj, "id", "desc_text"); List <FLOW_PROJMO> categories_projmo = FLOW_PROJMO.GETALL(); ViewData["categories_projmo"] = new SelectList(categories_projmo, "id", "name"); List <DD_MISSIONTYPE> missiontype = DD_MISSIONTYPE.GETALL(); ViewData["missiontype"] = new SelectList(missiontype, "code", "cvalue"); ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = sortOrder == "name_asc" ? "name_desc" : "name_asc"; ViewBag.CodeSortParm = sortOrder == "Code_asc" ? "Code_desc" : "Code_asc"; ViewBag.CreatedateSortParm = sortOrder == "date_asc" ? "date_desc" : "date_asc"; var missions = from s in db.FLOW_MISSION select s; //######################################################### if (Request.Cookies["islogin"] == null) { Response.Redirect("/Account/Login"); } Model1 ef = new Model1(); string caid = Request.Cookies["username"].Value.ToString(); int cuid = ef.SYS_USER.Where(item => item.account_id == caid).First <SYS_USER>().id; int? ugid = int.Parse(ef.SYS_USER.Where(item => item.account_id == caid).First <SYS_USER>().usertypeid_fx.ToString()); int mod1id = ef.SYS_MODULE.Where(item => item.code == "MOD00002").First <SYS_MODULE>().id; var obj = ef.SYS_UTYPE_MODULE.Where(item => item.usertypeid_fx == ugid && item.moduleid_fx == mod1id); if (obj.First <SYS_UTYPE_MODULE>().isenable == 0) { //START:与我相关的项目 var products = from s in db.FLOW_PRODUCT select s; products = products.Where(s => s.whocreateid_fx == cuid || s.Responserid_fx == cuid); var productids = from s in products select s.id; //END:与我相关的项目 int[] pdids = productids.ToArray(); missions = from s in missions where s.whocreateid_fx == ugid || s.towhoid_fx == ugid || productids.Contains((int)s.productid_fx) select s; } if (mistatuss == 1) {//我创建的 missions = missions.Where(s => s.whocreateid_fx == cuid); } if (mistatuss == 0) {//我负责的 missions = missions.Where(s => s.towhoid_fx == cuid); } //########################################################### if (searchProj != null) {//项目筛选 missions = missions.Where(s => s.projectid_fx == searchProj); } if (searchProjmo != null) {//模块筛选 missions = missions.Where(s => s.projmotid_fx == searchProjmo); } if (!String.IsNullOrEmpty(searchName)) {//搜索名称 missions = missions.Where(s => s.request_file.Contains(searchName)); } if (!String.IsNullOrEmpty(searchType)) {//搜索类型 missions = missions.Where(s => s.missiontype.Contains(searchType)); } if (mistatus == 1) { missions = missions.Where(s => s.iscomplete == 1); } if (mistatus == 0) { missions = missions.Where(s => s.iscomplete == 0); } switch (sortOrder) { case "name_desc": missions = missions.OrderByDescending(s => s.request_file); break; case "name_asc": missions = missions.OrderBy(s => s.request_file); break; case "Code_desc": missions = missions.OrderByDescending(s => s.code); break; case "Code_asc": missions = missions.OrderBy(s => s.code); break; case "date_asc": missions = missions.OrderBy(s => s.createdate); break; case "date_desc": missions = missions.OrderByDescending(s => s.createdate); break; default: missions = missions.OrderBy(s => s.createdate); break; } ViewBag.model2 = missions.ToList(); return(View(missions.ToPagedList(pageNum ?? 1, 5))); //return View(missions.ToList()); }