public ActionResult AddClass(int id) { Classes c = new Classes(); TrainAddClassViewData viewData = new TrainAddClassViewData(); viewData.PlanID = id; if (Request.RequestType == "POST") { Plan plan = (from p in CQGJ.Plan where p.PlanID == id select p).First(); c.Plan = plan; c.ClassName = GetString("className"); c.TrainSubject = GetString("TrainSubject"); c.SubClassName = GetString("subClassName"); c.ClassTerm = GetString("ClassTerm"); c.BeginDate = GetDate("BeginDate"); c.EndDate = GetDate("EndDate"); c.TrainObject = GetString("TrainObject"); c.TrainContent = GetString("TrainContent"); c.TrainNumber = GetInt("TrainNumber"); c.TrainType = GetString("TrainType"); c.Status = (int)ClassStatus.MakePlan; CQGJ.AddToClasses(c); //选择施教机构 int orgID = GetInt("OrgID"); Org org = (from o in CQGJ.Org where o.OrgID == orgID select o).First(); c.Org = org; CQGJ.SaveChanges(); //return RedirectToAction("PlanClassList/" + id); return RedirectToAction("AssignQuota/" + c.ClassID); } viewData.Schools = (from o in CQGJ.Org where o.OrgType == 3 select o).ToList(); return View("AddClass", viewData); }
public void AddClass(int id) { Classes c = new Classes(); TrainAddClassViewData viewData = new TrainAddClassViewData(); viewData.PlanID = id; if (GetString("className") != "") { Plan plan = (from p in CQGJ.Plan where p.PlanID == id select p).First(); c.Plan = plan; //pc.SchoolID = shcoolID; c.ClassName = GetString("className"); c.SubClassName = GetString("subClassName"); c.ClassTerm = GetString("ClassTerm"); c.TrainObject = GetString("subClassName"); c.TrainPlace = GetString("TrainPlace"); c.TrainSubject = GetString("TrainSubject"); c.BeginDate = GetDate("BeginDate"); c.EndDate = GetDate("EndDate"); c.TrainSubject = GetString("TrainSubject"); c.TrainContent = GetString("dntb"); c.Status = (int)ClassStatus.MakePlan; CQGJ.AddToClasses(c); //选择施教机构 string orgCode = GetString("orgcode"); Org org = (from o in CQGJ.Org where o.OrgCode == orgCode select o).First(); c.Org = org; CQGJ.SaveChanges(); //RedirectToAction("PlanClassList/" + id); RedirectToAction("AssignQuota/" + c.ClassID); } viewData.Schools = cqgjPassport.GetSchoolOrglist().ToList(); RenderView("AddClass", viewData); }