123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- using LeaRun.Application.Entity.CustomerManage;
- using LeaRun.Application.Busines.CustomerManage;
- using LeaRun.Util;
- using LeaRun.Util.WebControl;
- using System.Web.Mvc;
- using LeaRun.Application.Code;
- namespace LeaRun.Application.Web.Areas.CustomerManage.Controllers
- {
- /// <summary>
- /// 版 本 6.1
- /// Copyright (c) 2013-2016 上海力软信息技术有限公司
- /// 创 建:佘赐雄
- /// 日 期:2016-03-14 09:47
- /// 描 述:客户信息
- /// </summary>
- public class CustomerController : MvcControllerBase
- {
- private CustomerBLL customerbll = new CustomerBLL();
- private CustomerContactBLL customercontactbll = new CustomerContactBLL();
- #region 视图功能
- /// <summary>
- /// 客户列表页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [HandlerAuthorize(PermissionMode.Enforce)]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 客户表单页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [HandlerAuthorize(PermissionMode.Enforce)]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 客户明细页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [HandlerAuthorize(PermissionMode.Enforce)]
- public ActionResult Detail()
- {
- return View();
- }
- /// <summary>
- /// 联系人列表
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [HandlerAuthorize(PermissionMode.Enforce)]
- public ActionResult ContactIndex()
- {
- return View();
- }
- /// <summary>
- /// 联系人表单
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ContactForm()
- {
- return View();
- }
- #endregion
- #region 获取数据
- /// <summary>
- /// 获取客户列表
- /// </summary>
- /// <returns>返回列表Json</returns>
- [HttpGet]
- public ActionResult GetListJson()
- {
- var data = customerbll.GetList();
- return ToJsonResult(data);
- }
- /// <summary>
- /// 获取客户列表
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询参数</param>
- /// <returns>返回分页列表Json</returns>
- [HttpGet]
- public ActionResult GetPageListJson(Pagination pagination, string queryJson)
- {
- var watch = CommonHelper.TimerStart();
- var data = customerbll.GetPageList(pagination, queryJson);
- var jsonData = new
- {
- rows = data,
- total = pagination.total,
- page = pagination.page,
- records = pagination.records,
- costtime = CommonHelper.TimerEnd(watch)
- };
- return ToJsonResult(jsonData);
- }
- /// <summary>
- /// 获取客户实体
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <returns>返回对象Json</returns>
- [HttpGet]
- public ActionResult GetFormJson(string keyValue)
- {
- var data = customerbll.GetEntity(keyValue);
- return ToJsonResult(data);
- }
- /// <summary>
- /// 获取联系人列表
- /// </summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns>返回列表Json</returns>
- [HttpGet]
- public ActionResult GetContactListJson(string queryJson)
- {
- var data = customercontactbll.GetList(queryJson);
- return ToJsonResult(data);
- }
- /// <summary>
- /// 获取联系人实体
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <returns>返回对象Json</returns>
- [HttpGet]
- public ActionResult GetContactFormJson(string keyValue)
- {
- var data = customercontactbll.GetEntity(keyValue);
- return ToJsonResult(data);
- }
- #endregion
- #region 验证数据
- /// <summary>
- /// 客户名称不能重复
- /// </summary>
- /// <param name="FullName">名称</param>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ExistFullName(string FullName, string keyValue)
- {
- bool IsOk = customerbll.ExistFullName(FullName, keyValue);
- return Content(IsOk.ToString());
- }
- #endregion
- #region 提交数据
- /// <summary>
- /// 删除客户数据
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- [HandlerAuthorize(PermissionMode.Enforce)]
- public ActionResult RemoveForm(string keyValue)
- {
- customerbll.RemoveForm(keyValue);
- return Success("删除成功。");
- }
- /// <summary>
- /// 保存客户表单(新增、修改)
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <param name="entity">实体对象</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, CustomerEntity entity)
- {
- customerbll.SaveForm(keyValue, entity);
- return Success("操作成功。");
- }
- /// <summary>
- /// 删除联系人数据
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult RemoveContactForm(string keyValue)
- {
- customercontactbll.RemoveForm(keyValue);
- return Success("删除成功。");
- }
- /// <summary>
- /// 保存联系人表单(新增、修改)
- /// </summary>
- /// <param name="keyValue">主键值</param>
- /// <param name="entity">实体对象</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveContactForm(string keyValue, CustomerContactEntity entity)
- {
- customercontactbll.SaveForm(keyValue, entity);
- return Success("操作成功。");
- }
- #endregion
- }
- }
|