//添加 public async Task <int> ADD(config_file_third_kindModel1 cftkm) { config_file_third_kind cffsk = new config_file_third_kind() { first_kind_id = cftkm.first_kind_id, first_kind_name = cftkm.first_kind_name, ftk_id = cftkm.ftk_id, second_kind_id = cftkm.second_kind_id, second_kind_name = cftkm.second_kind_name, third_kind_id = cftkm.third_kind_id, third_kind_is_retail = cftkm.third_kind_is_retail, third_kind_name = cftkm.third_kind_name, third_kind_sale_id = cftkm.third_kind_sale_id }; tescDbContext.third.Add(cffsk); return(await tescDbContext.SaveChangesAsync()); }
//修改查询 public async Task <config_file_third_kindModel1> UpSelect(int id) { config_file_third_kind cffsk = await tescDbContext.third.FindAsync(id); config_file_third_kindModel1 cffskm = new config_file_third_kindModel1() { first_kind_id = cffsk.first_kind_id, first_kind_name = cffsk.first_kind_name, ftk_id = cffsk.ftk_id, second_kind_id = cffsk.second_kind_id, second_kind_name = cffsk.second_kind_name, third_kind_id = cffsk.third_kind_id, third_kind_is_retail = cffsk.third_kind_is_retail, third_kind_name = cffsk.third_kind_name, third_kind_sale_id = cffsk.third_kind_sale_id }; return(cffskm); }
//修改 public async Task <int> Update(config_file_third_kindModel1 cftkm) { config_file_third_kind cftk = new config_file_third_kind() { first_kind_id = cftkm.first_kind_id, first_kind_name = cftkm.first_kind_name, ftk_id = cftkm.ftk_id, second_kind_id = cftkm.second_kind_id, second_kind_name = cftkm.second_kind_name, third_kind_id = cftkm.third_kind_id, third_kind_is_retail = cftkm.third_kind_is_retail, third_kind_name = cftkm.third_kind_name, third_kind_sale_id = cftkm.third_kind_sale_id }; tescDbContext.third.Attach(cftk); tescDbContext.Entry(cftk).State = Microsoft.EntityFrameworkCore.EntityState.Modified; return(await tescDbContext.SaveChangesAsync()); }
public IActionResult register_locate(config_file_third_kindModel1 a) { HttpContext.Session.SetString("yiji", Request.Form["emajorRelease.firstKindId"]); HttpContext.Session.SetString("erji", Request.Form["emajorRelease.secondKindId"]); HttpContext.Session.SetString("sanji", Request.Form["emajorRelease.thirdKindId"]); HttpContext.Session.SetString("sj1", Request.Form["utilbean.startDate"]); HttpContext.Session.SetString("sj2", Request.Form["utilbean.endDate"]); return(Redirect("/Transfer/register_list")); //if (a.third_kind_name == null) //{ // a.third_kind_name = HttpContext.Session.GetString("aabb"); // return Content("<script>alert('请选择三级机构');window.location.href='/Transfer/register_locate'</script>"); //} //else //{ // return Content("<script>window.location.href='/Transfer/register_list'</script>"); //} }
public async Task <IActionResult> change(config_file_third_kindModel1 cftkm) { if (ModelState.IsValid) { int result = await icftkb.Update(cftkm); if (result > 0) { return(RedirectToAction("Index")); } else { return(View(cftkm)); } } else { return(View(cftkm)); } }
//查询 public List <config_file_third_kindModel1> Select() { var list = tescDbContext.third.ToList(); List <config_file_third_kindModel1> list2 = new List <config_file_third_kindModel1>(); foreach (var item in list) { config_file_third_kindModel1 cftkm = new config_file_third_kindModel1() { first_kind_id = item.first_kind_id, first_kind_name = item.first_kind_name, ftk_id = item.ftk_id, second_kind_id = item.second_kind_id, second_kind_name = item.second_kind_name, third_kind_id = item.third_kind_id, third_kind_is_retail = item.third_kind_is_retail, third_kind_name = item.third_kind_name, third_kind_sale_id = item.third_kind_sale_id }; list2.Add(cftkm); } return(list2); }
//修改 public Task <int> Update(config_file_third_kindModel1 cftkm) { return(icftkd.Update(cftkm)); }
public Task <int> ADD(config_file_third_kindModel1 cftkm) { return(icftkd.ADD(cftkm)); }
public async Task <IActionResult> register(config_file_third_kindModel1 cftkm) { if (ModelState.IsValid) { string[] z = cftkm.first_kind_id.Split(','); cftkm.first_kind_id = z[0]; cftkm.first_kind_name = z[1]; string[] z2 = cftkm.second_kind_id.Split(','); cftkm.second_kind_id = z2[0]; cftkm.second_kind_name = z2[1]; int result = await icftkb.ADD(cftkm); if (result > 0) { return(RedirectToAction("Index")); } else { List <config_file_first_kindModel1> list = icftkb.SelectYiJiJG(); List <SelectListItem> list2 = new List <SelectListItem>(); foreach (var item in list) { list2.Add(new SelectListItem { Text = item.first_kind_name, Value = item.first_kind_id.ToString() + "," + item.first_kind_name }); } ViewBag.a = list2; List <config_file_second_kindModel1> list3 = icftkb.SelectErJiJG(); List <SelectListItem> list4 = new List <SelectListItem>(); foreach (var item in list3) { list4.Add(new SelectListItem { Text = item.second_kind_name, Value = item.second_kind_id.ToString() + "," + item.second_kind_name }); } ViewBag.b = list4; return(View(cftkm)); } } else { List <config_file_first_kindModel1> list = icftkb.SelectYiJiJG(); List <SelectListItem> list2 = new List <SelectListItem>(); foreach (var item in list) { list2.Add(new SelectListItem { Text = item.first_kind_name, Value = item.first_kind_id.ToString() + "," + item.first_kind_name }); } ViewBag.a = list2; List <config_file_second_kindModel1> list3 = icftkb.SelectErJiJG(); List <SelectListItem> list4 = new List <SelectListItem>(); foreach (var item in list3) { list4.Add(new SelectListItem { Text = item.second_kind_name, Value = item.second_kind_id.ToString() + "," + item.second_kind_name }); } ViewBag.b = list4; return(View(cftkm)); } }