123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.TeachingMaterial;
- using EMIS.CommonLogic.TeachingMaterial;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.TeachingMaterial
- {
- [Authorization]
- public class StockInSetController : Controller
- {
- public ISupplierDiscountSetServices supplierDiscountSetServices { get; set; }
- /// <summary>
- /// 供应商折扣率设置
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- bool? isDefault = null;
- if (configuretView.Attribute == DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(supplierDiscountSetServices.GetSupplierDiscountSetViewGrid(configuretView, isDefault, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="GraduationConditionPackageID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid supplierDiscountSetID)
- {
- SupplierDiscountSetView supplierDiscountSetView = new SupplierDiscountSetView();
- supplierDiscountSetView = supplierDiscountSetServices.GetSupplierDiscountSetView(supplierDiscountSetID);
- return View("Edit", supplierDiscountSetView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationConditionPackageView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(SupplierDiscountSetView supplierDiscountSetView)
- {
- supplierDiscountSetView.SupplierDiscountSetID = Guid.Empty;
- return this.Edit(supplierDiscountSetView);
- }
- /// <summary>
- /// 新增、修改
- /// </summary>
- /// <param name="GraduationConditionID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? supplierDiscountSetID)
- {
- SupplierDiscountSetView supplierDiscountSetView = new SupplierDiscountSetView();
- if (supplierDiscountSetID.HasValue && supplierDiscountSetID != Guid.Empty)
- {
- supplierDiscountSetView = supplierDiscountSetServices.GetSupplierDiscountSetView((Guid)supplierDiscountSetID);
- }
- return View(supplierDiscountSetView);
- }
- /// <summary>
- /// 新增、修改
- /// </summary>
- /// <param name="graduationConditionView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(SupplierDiscountSetView supplierDiscountSetView)
- {
- try
- {
- supplierDiscountSetServices.SupplierDiscountSetViewEdit(supplierDiscountSetView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduationCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string supplierDiscountSetIDs)
- {
- try
- {
- List<Guid?> list = supplierDiscountSetIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- supplierDiscountSetServices.SupplierDiscountSetDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message);
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="graduationCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var supplierDiscountSetID = Request.Form["SupplierDiscountSetID"];
- List<Guid?> supplierDiscountSetIDList = new List<Guid?>();
- bool? isDefault = null;
- if (supplierDiscountSetID != "")
- {
- supplierDiscountSetIDList = supplierDiscountSetID.SplitIDString();
- }
- else
- {
- supplierDiscountSetIDList = null;
- }
- //var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
- //var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
- //var yearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- //var grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
- //var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
- //var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- //var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
- //var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
- //var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- //var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
- //var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- //var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- var dt = supplierDiscountSetServices.GetSupplierDiscountSetViewList(configuretView, isDefault, supplierDiscountSetIDList).Select(x => new
- {
- x.UnitName,
- x.IsDefaultName,
- x.Discount
- }).ToTable();
- string[] liststring = { "供应商名称","是否默认","折扣率" };
- neh.Export(dt, liststring, "供应商折扣率设置信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult GetDiscountByID(Guid supplierID)
- {
- decimal? discount = supplierDiscountSetServices.GetDiscountByPublishID(supplierID);
- return base.Json(discount.ToString());
- }
- }
- }
|