123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.SchedulingManage.SchedulingSettings;
- using EMIS.ViewModel.SchedulingManage.SchedulingSettings;
- using Bowin.Common.Exceptions;
- namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings
- {
- [Authorization]
- public class CourseTimeHoursController : Controller
- {
- public ICourseTimeHoursServices ICourseTimeHoursServices { get; set; }
- /// <summary>
- /// 学时转换页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var year = pararms.getExtraInt("SchoolyearDictionaryDropDown");
- var CoursesTimeID = pararms.getExtraGuid("TimeComboGrid");
- return base.Json(ICourseTimeHoursServices.GetCoursesTimeViewGrid(configuretView, year, CoursesTimeID, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult Edit(Guid? CoursesTimeID)
- {
- CourseTimeHoursView CourseTimeHoursView = new CourseTimeHoursView();
- if (CoursesTimeID.HasValue)
- {
- CourseTimeHoursView = ICourseTimeHoursServices.GetCourseTimeHoursView(CoursesTimeID);
- }
- return View(CourseTimeHoursView);
- }
- [HttpPost]
- public ActionResult Edit(CourseTimeHoursView CourseTimeHoursView)
- {
- try
- {
- ICourseTimeHoursServices.save(CourseTimeHoursView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult Delete(string ids)
- {
- try
- {
- var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
- ICourseTimeHoursServices.Delete(list);
- return base.Json("删除成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- mge = "请先删除所有关联的数据!";
- }
- return base.Json("删除失败,原因:" + mge);
- }
- }
- }
- }
|