private void GetActStr(Questionnaire_Subject model, int listCount, int i) { StringBuilder actStr = new StringBuilder(); actStr.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"250\"><tr><form name=\"upform\"><td width=\"70\">"); if (i > 0) { actStr.Append($"<select id=\"stepUp{model.Id}\" > "); for (int j = 1; j <= i; j++) { actStr.Append("<option value=\"" + j + "\">" + j + "</option>"); } actStr.Append($"</select><input type=\"button\" name=\"Submit2\" value=\"↑\" class=\"btn btn-default\" onclick=\"SetMove('{model.Id}','up')\"> "); } actStr.Append("</td></form><form name=\"downform\"><td width=\"70\">"); if (i < listCount - 1) { actStr.Append($"<select id=\"stepDown{model.Id}\" > "); for (int j = 1; j <= listCount - i - 1; j++) { actStr.Append("<option value=\"" + j + "\">" + j + "</option>"); } actStr.Append($"</select><input type=\"button\" name=\"Submit2\" value=\"↓\" class=\"btn btn-default\" onclick=\"SetMove('{model.Id}','down')\"> "); } actStr.Append("</td></form></tr></table>"); model.actStr = actStr.ToString(); }
public ActionResult Edit(int id = 0) { Questionnaire_Subject model = null; if (id > 0) { model = Bll.BllQuestionnaire_Subject.First(o => o.Id == id); } return(View(model)); }
public ActionResult Save() { int id = RequestInt("id"); string title = RequestString("title"); string remark = RequestString("remark"); int timelimit = RequestInt("timelimit"); int score = RequestInt("score"); bool isshow = RequestBool("isshow"); Questionnaire_Subject model = null; string classHtml = string.Empty; if (id > 0) { model = Bll.BllQuestionnaire_Subject.First(o => o.Id == id); if (model == null) { return(MessageBoxAndReturn("问卷不存在!")); } model.Title = title; model.Remark = remark; model.Timelimit = timelimit; model.Score = score; model.IsShow = isshow; if (Bll.BllQuestionnaire_Subject.Update(model, o => o.Id == id) > 0) { return(LayerAlertSuccessAndRefresh("修改成功")); } else { return(LayerAlertSuccessAndRefresh("修改失败")); } } else { model = new Questionnaire_Subject(); model.Title = title; model.Remark = remark; model.Timelimit = timelimit; model.Score = score; model.IsShow = isshow; model.Sequence = Bll.BllSys_Class <Questionnaire_Subject> .Instance().GetNextSequence(""); if (Bll.BllQuestionnaire_Subject.Insert(model) > 0) { return(LayerAlertSuccessAndRefresh("添加成功")); } else { return(LayerAlertSuccessAndRefresh("添加失败")); } } }