using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.PaymentManage; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.ViewModel.PaymentManage; namespace EMIS.Web.Controllers.PaymentManage { [Authorization] public class WorktimeRateController : Controller { public IWorktimeRateServices WorktimeRateServices { get; set; } public ActionResult List() { return View(); } public ActionResult Edit(Guid? WorktimeRateID, Guid? SourceID) { WorktimeRateView worktimeRateView = new WorktimeRateView(); if (WorktimeRateID.HasValue) { worktimeRateView = WorktimeRateServices.GetWorktimeRateView(WorktimeRateID); } else if (SourceID.HasValue) { worktimeRateView = WorktimeRateServices.GetWorktimeRateView(SourceID); worktimeRateView.WorktimeRateID = Guid.Empty; } return View(worktimeRateView); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var collegeID = pararms.getExtraGuid("cgbCollege"); var teachingModeID = pararms.getExtraInt("ddlTeachingMode") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlTeachingMode"); var teachingMethodID = pararms.getExtraInt("ddlTeachingMethod") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlTeachingMethod"); var paymentLevelID = pararms.getExtraInt("ddlPaymentLevel") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlPaymentLevel"); if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = ""; return base.Json(WorktimeRateServices.GetWorktimeRateViewList(configuretView, collegeID, teachingModeID, teachingMethodID, paymentLevelID, (int)pararms.page, (int)pararms.rows)); } [HttpPost] public ActionResult Edit(WorktimeRateView worktimeRateView) { try { if (worktimeRateView.TeachingMethodID == DropdownList.PLEASE_SELECT) { worktimeRateView.TeachingMethodID = null; } WorktimeRateServices.Save(worktimeRateView); return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message }); } } [HttpPost] public ActionResult Delete(string worktimeRateIDs) { try { List list = worktimeRateIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); WorktimeRateServices.Delete(list); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message }); } } } }