Add.cshtml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. @model EMIS.ViewModel.ScoreManage.SubmitedScoreDetailView
  2. @using EMIS.Web.Controls;
  3. @using Bowin.Web.Controls.Mvc;
  4. @{
  5. ViewBag.Title = "Edit";
  6. //string CurUserID = Convert.ToString(ViewBag.curUserID);
  7. //string CurUserName = Convert.ToString(ViewBag.curUserName);
  8. //string CurLoginID = Convert.ToString(ViewBag.curLoginID);
  9. ComboGridOptions cgop = new ComboGridOptions
  10. {
  11. TextField = "LoginID",
  12. ValueField = "UserID",
  13. OnSelect = "GetClassName",
  14. GridOptions = new DataGridOptions
  15. {
  16. Columns = new List<DataGridColumn>()
  17. {
  18. new LinkButtonColumn { FieldName="LoginID", HeaderText="学号", Width=0.1, Align=AlignStyle.Center },
  19. new BoundFieldColumn { FieldName="UserName", HeaderText="姓名", Width=0.1, Align=AlignStyle.Center },
  20. },
  21. IsCheckOnSelect = true,
  22. DataSourceUrl = Url.Content("~/Students/List"),
  23. IsPagination = true,
  24. IsShowRowNumbers = true,
  25. IsSingleSelect = false
  26. }
  27. };
  28. if (Request["atype"] != "1")
  29. {
  30. cgop = new ComboGridOptions
  31. {
  32. TextField = "LoginID",
  33. ValueField = "UserID",
  34. IsEnabled=false,
  35. GridOptions = new DataGridOptions
  36. {
  37. Columns = new List<DataGridColumn>()
  38. {
  39. new LinkButtonColumn { FieldName="LoginID", HeaderText="学号", Width=0.1, Align=AlignStyle.Center },
  40. new BoundFieldColumn { FieldName="UserName", HeaderText="姓名", Width=0.1, Align=AlignStyle.Center },
  41. },
  42. IsCheckOnSelect = true,
  43. DataSourceUrl = Url.Content("~/Students/List"),
  44. IsPagination = true,
  45. IsShowRowNumbers = true,
  46. IsSingleSelect = false
  47. }
  48. };
  49. }
  50. int row = 0;
  51. List<Dictionary<string, string>> listContorller = new List<Dictionary<string, string>>();
  52. List<Dictionary<string, string>> listDictionary = (List<Dictionary<string, string>>)ViewBag.ListDictionary;
  53. var scoreDynamicTypes = (IEnumerable<EMIS.Entities.Sys_DictionaryItem>)ViewBag.ScoreDynamicTypes;
  54. foreach (var scoreDynamicType in scoreDynamicTypes)
  55. {
  56. string name = scoreDynamicType.Name;
  57. Dictionary<string, string> dic = new Dictionary<string, string>();
  58. dic.Add(name, "Formula_" + scoreDynamicType.Value);
  59. listContorller.Add(dic);
  60. }
  61. listContorller.Add(new Dictionary<string, string> { { "总成绩", "TotalScore" } });
  62. //listContorller.Add(new Dictionary<string, string> { { "学分", "ScoreCredit" } });
  63. //listContorller.Add(new Dictionary<string, string> { { "绩点", "GradePoint" } });
  64. row = (int)Math.Ceiling(Convert.ToDouble(listContorller.Count) / 2);
  65. ComboGridOptions cgopdepartment = new ComboGridOptions
  66. {
  67. TextField = "Name",
  68. ValueField = "DepartmentID",
  69. GridOptions = new DataGridOptions
  70. {
  71. Columns = new List<DataGridColumn>()
  72. {
  73. new LinkButtonColumn { FieldName="No", HeaderText="教研室代码", Align=AlignStyle.Center },
  74. new BoundFieldColumn { FieldName="Name", HeaderText="教研室名称", Align=AlignStyle.Center }
  75. },
  76. IsCheckOnSelect = true,
  77. DataSourceUrl = Url.Content("~/Department/List"),
  78. IsPagination = true,
  79. IsShowRowNumbers = true,
  80. IsSingleSelect = false
  81. }
  82. };
  83. ComboGridOptions cgopCourse = new ComboGridOptions
  84. {
  85. TextField = "CourseName",
  86. ValueField = "CoursematerialID",
  87. //IsEnabled = false,
  88. GridOptions = new DataGridOptions
  89. {
  90. Columns = new List<DataGridColumn>()
  91. {
  92. new LinkButtonColumn { FieldName="CourseCode", HeaderText="课程代码", Width=0.1, Align=AlignStyle.Center },
  93. new BoundFieldColumn { FieldName="CourseName", HeaderText="课程名称", Width=0.3, Align=AlignStyle.Center }
  94. },
  95. IsCheckOnSelect = true,
  96. DataSourceUrl = Url.Content("~/Coursematerial/ListForDropdown"),
  97. IsPagination = true,
  98. IsShowRowNumbers = true,
  99. IsSingleSelect = false
  100. }
  101. };
  102. ComboGridOptions cgopUser = new ComboGridOptions
  103. {
  104. TextField = "Name",
  105. ValueField = "UserID",
  106. //SelectedValue = CurLoginID,
  107. GridOptions = new DataGridOptions
  108. {
  109. Columns = new List<DataGridColumn>()
  110. {
  111. new LinkButtonColumn { FieldName="StaffCode", HeaderText="教职工号", Width=0.1, Align=AlignStyle.Center },
  112. new BoundFieldColumn { FieldName="Name", HeaderText="姓名", Width=0.3, Align=AlignStyle.Center }
  113. },
  114. IsCheckOnSelect = true,
  115. DataSourceUrl = Url.Content("~/Staff/List"),
  116. IsPagination = true,
  117. IsShowRowNumbers = true,
  118. IsSingleSelect = false
  119. }
  120. };
  121. }
  122. @section scripts{
  123. <script type="text/javascript" src="~/Scripts/Business/ScoreManage/PersonalScoreAdd.js"></script>
  124. @* <script type="text/javascript">
  125. $(document).ready(function () {
  126. $("#UserID").blur(function () {
  127. alert("1");
  128. var userID = $("#UserID").val();
  129. var className;
  130. debugger;
  131. if (userID != null && userID != "") {
  132. $.ajax({
  133. type: "POST",
  134. async: true,
  135. url: "PersonalScore/GetClassNameByUserID?userID=" + userID, //必须是后台的静态方法
  136. contentType: "application/json; charset=utf-8",
  137. dataType: "json",
  138. // data: "name=John&location=Boston",
  139. data: "",
  140. success: function (msg) {
  141. className = msg;
  142. },
  143. });
  144. $("#ClassName").attr("value", className);
  145. }
  146. });
  147. });
  148. // $("#UserID").change(function () {
  149. // var userID = $("#UserID").val();
  150. // var className;
  151. // if (userID != null && userID != "") {
  152. // $.ajax({
  153. // type: "POST",
  154. // async: true,
  155. // url: "PersonalScore/GetClassNameByUserID?userID=" + userID, //必须是后台的静态方法
  156. // contentType: "application/json; charset=utf-8",
  157. // dataType: "json",
  158. // // data: "name=John&location=Boston",
  159. // data: "",
  160. // // beforeSend: function () {
  161. // // bsl_showLoadingDialog("请稍等");
  162. // // },
  163. // success: function (msg) {
  164. // className = msg;
  165. // },
  166. // // error: function (err) {
  167. // // $(loadingDialog).dialog("close");
  168. // // alert(err);
  169. // // }
  170. // });
  171. // $("#ClassName").attr("value", className);
  172. // }
  173. // });
  174. </script>*@
  175. }
  176. <style type="text/css">
  177. #submitedScoretable {
  178. width: 100%;
  179. border: 0px none;
  180. }
  181. #submitedScoretable tr {
  182. min-height: 30px;
  183. }
  184. </style>
  185. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  186. @using (Ajax.BeginForm(new AjaxOptions
  187. {
  188. OnSuccess = "EMISFunction.FormSuccess",
  189. OnBegin = "EMISFunction.FormSubmit",
  190. OnComplete = "EMISFunction.FormComplete"
  191. }))
  192. {
  193. <div class="p_title">
  194. <div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
  195. 成绩基本信息
  196. </div>
  197. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">@Html.ContextMenuBar("Edit")</div>
  198. </div>
  199. <div class="search_list">
  200. @Html.HiddenFor(x => x.SubmitedScoreID)
  201. @* @if (Request["atype"] != "1")
  202. {
  203. @Html.HiddenFor(x => x.UserID)
  204. }*@
  205. @Html.Hidden("hid_atype", Request["atype"])
  206. @Html.Hidden("hid_SaveType", Request["SaveType"])
  207. <table cellpadding="0" cellspacing="0" id="submitedScoretable">
  208. <tr>
  209. <td>@Html.LabelFor(x => x.LoginID):
  210. </td>
  211. <td>@Html.ComboGridFor(x => x.UserID, cgop)
  212. </td>
  213. <td>@Html.LabelFor(x => x.ClassName):</td>
  214. <td>@Html.TextBoxFor(x => x.ClassName)</td>
  215. </tr>
  216. <tr>
  217. <td>@Html.LabelFor(x => x.SchoolyearID):</td>
  218. <td>@Html.DropdownListFor(x => x.SchoolyearID, new DropdownListOptions { BindType = DropdownListBindType.SelectAll, ItemSourceUrl = Url.Content("~/SchoolYear/YearsDropdownListBanid") })</td>
  219. <td>@Html.LabelFor(x => x.SchoolyearNumID):</td>
  220. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_SchoolyearNum, (x => x.SchoolyearNumID))</td>
  221. </tr>
  222. <tr>
  223. <td>@Html.LabelFor(x => x.DepartmentID):</td>
  224. <td>
  225. @Html.ComboGridFor(x => x.DepartmentID, cgopdepartment)
  226. </td>
  227. <td>@Html.LabelFor(x => x.CoursematerialID):</td>
  228. <td>@Html.ComboGridFor(x => x.CoursematerialID, cgopCourse)</td>
  229. </tr>
  230. <tr>
  231. <td>@Html.LabelFor(x => x.CourseTypeID):</td>
  232. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_CourseType, (x => x.CourseTypeID))</td>
  233. <td>@Html.LabelFor(x => x.ExamsCategoryID):</td>
  234. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_ExamsCategory, (x => x.ExamsCategoryID))</td>
  235. </tr>
  236. <tr>
  237. <td>@Html.LabelFor(x => x.ExaminationModeID):</td>
  238. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_ExaminationMode, (x => x.ExaminationModeID))</td>
  239. <td>@Html.LabelFor(x => x.Credit):</td>
  240. <td>@Html.TextBoxFor(x => x.Credit)</td>
  241. </tr>
  242. <tr>
  243. <td>@Html.LabelFor(x => x.ExamsDatetime):</td>
  244. <td>@Html.TextBoxFor(x => x.ExamsDatetime, new TextBoxOptions { TextBoxType = TextBoxType.Date })</td>
  245. <td>@Html.LabelFor(x => x.CreatorUserID):</td>
  246. <td>@Html.ComboGridFor(x => x.CreatorUserID, cgopUser)</td>
  247. </tr>
  248. <tr>
  249. <td>@Html.LabelFor(x => x.ExamsStateID):</td>
  250. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_ExamsState, (x => x.ExamsStateID))</td>
  251. <td>@Html.LabelFor(x => x.StarttermID):</td>
  252. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_Startterm, (x => x.StarttermID))</td>
  253. </tr>
  254. @for (int i = 0; i < row; i++)
  255. {
  256. <tr>
  257. @for (int j = 0; j < 2; j++)
  258. {
  259. int h = i * 2 - j;
  260. if (j % 2 != 0)
  261. {
  262. h = i * 2 - j + 2;
  263. }
  264. foreach (KeyValuePair<string, string> item in listContorller[h])
  265. {
  266. string value = listDictionary[h][item.Value];
  267. <td>
  268. <label>@item.Key:</label></td>
  269. <td>
  270. @if (item.Key != "总成绩")
  271. {
  272. <input type="text" name="@item.Value" value="@value" data-value-required="必须输入@(item.Key)分数" data-val="true" data-val-regex-pattern="^\d+(\.\d{1,2})?$" data-val-regex="请输入数字分数,最多保留2位小数" /><span style="color: Red;">*</span>
  273. }
  274. else
  275. {
  276. <input type="text" name="@item.Value" value="@value" data-value-required="必须输入@(item.Key)分数" data-val="true" data-val-regex-pattern="^\d+(\.\d{1,2})?$" data-val-regex="请输整数或分数" /><span style="color: Red;">*</span>
  277. }
  278. </td>
  279. }
  280. }
  281. </tr>
  282. }
  283. <tr>
  284. <td>@Html.LabelFor(x => x.ResultTypeID):</td>
  285. <td colspan="3">@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_ResultType, (x => x.ResultTypeID))</td>
  286. </tr>
  287. <tr>
  288. <td>@Html.LabelFor(x => x.Remark):</td>
  289. <td colspan="3">@Html.TextAreaFor(x => x.Remark, new Dictionary<string, object> { { "style", "width:500px;" } })</td>
  290. </tr>
  291. </table>
  292. </div>
  293. }
  294. </div>