ChannelController.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using PMS.BusinessModels.Account;
  2. using PMS.EntityModels.Channel;
  3. using PMS.Interface;
  4. using PMS.Interface.Channel;
  5. using QWPlatform.SystemLibrary.Utils;
  6. using QWPlatform.SystemLibrary.Web;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Linq;
  11. using System.Web;
  12. using System.Web.Mvc;
  13. namespace PMS.WebUI.Controllers
  14. {
  15. /// <summary>
  16. /// 创建者:冉利
  17. /// 创建日期:2018/12/10
  18. /// 功能描述:渠道信息的新增
  19. /// </summary>
  20. public class ChannelController : BaseController
  21. {
  22. IChannel Channel = InterfaceFactory.CreateBusinessInstance<IChannel>();
  23. #region 查询获取所有渠道信息
  24. public ActionResult ChannelManage()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 获取所有渠道信息(不分页)
  30. /// </summary>
  31. /// <returns></returns>
  32. public ActionResult ModuleInfos(string search, string CurrrentID, int page, int rows)
  33. {//todo:需要获取用户信息
  34. AuthDatsInfo AuthDatas = this.GetAuthDats();
  35. string result= Channel.ChannelDataGridsM(AuthDatas.Channel, page,rows);
  36. return Content(result, "application/json");
  37. }
  38. #endregion
  39. #region 新增修改渠道信息
  40. public ActionResult ModulePopWindows(string id)
  41. {
  42. ViewBag.id = id;
  43. return View();
  44. }
  45. [HttpPost]
  46. public ActionResult SaveModulePopWindows(ChannelModel model)
  47. {
  48. /// <summary>
  49. /// 编辑类型 0新增 1修改
  50. /// </summary>
  51. int EditType = 0;
  52. string s;
  53. //修改
  54. if (model.ID != null)
  55. {
  56. EditType = 1;
  57. s = Channel.EditChannel(model, EditType);
  58. }
  59. else {
  60. //调用接口处理数据(新增)
  61. model.ID = "";
  62. s = Channel.AddChannel(model, EditType);
  63. }
  64. string[] str = s.Split('|');
  65. foreach (string i in str)
  66. {
  67. if (i == "1")
  68. {
  69. return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
  70. }
  71. }
  72. //保存失败
  73. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "违反完整性约束");
  74. }
  75. #endregion
  76. #region 查询渠道信息
  77. public ActionResult GetChannelInfo(string id)
  78. {
  79. DataTable dt = Channel.GetChannelInfo(id);
  80. return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  81. }
  82. #endregion
  83. #region 查询渠道性质
  84. public ActionResult GetChannelnature()
  85. {
  86. string nature = Channel.GetChannelnature();
  87. return Content(nature, "application/json");
  88. }
  89. #endregion
  90. //删除渠道信息
  91. public ActionResult DelChannelInfo(string id,int type)
  92. {
  93. // Id_In In 渠道信息.Id % Type,
  94. // 标记类型_In In Number, --0、删除 1、终止 2、撤消
  95. //Resultstr_Out Out Varchar2
  96. string result = Channel.DelChannelInfo(id,type);
  97. string[] str = result.Split('|');
  98. if (str[1]== "成功")
  99. {
  100. return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
  101. }
  102. //保存失败
  103. return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
  104. }
  105. //查询渠道信息
  106. public ActionResult SearchModuleInfos(string search, int page, int rows)
  107. {
  108. var user = GetCurrentUser();
  109. string dt = Channel.SearchModuleInfos(search, user.PersonID,page,rows);
  110. return Content(dt, "application/json");
  111. }
  112. public ActionResult GetChannelIdName()
  113. {
  114. string json = Channel.GetChannelIdName();
  115. return Content(json, "application/json");
  116. }
  117. /// <summary>
  118. /// 获取渠道项目combotree :valueField: 'id', textField: '名称'
  119. /// </summary>
  120. /// <returns></returns>
  121. public ActionResult GetChannelProjectTree()
  122. {
  123. string json = Channel.GetChannelProjectTree();
  124. return Content(json, "application/json");
  125. }
  126. /// <summary>
  127. /// 查询渠道编码
  128. /// </summary>
  129. /// <returns></returns>
  130. //string ChannelCode();
  131. public ActionResult ChannelCode()
  132. {
  133. return Content(Channel.ChannelCode(), "application/json");
  134. }
  135. /// <summary>
  136. /// 查询渠道名称
  137. /// </summary>
  138. /// <returns></returns>
  139. public string ChannelName(string Name)
  140. {
  141. string para= Channel.ChannelName(Name);
  142. string [] result= para.Split('|');
  143. if (result[0]!="1")
  144. {
  145. return "true";
  146. }
  147. return "false";
  148. }
  149. /// <summary>
  150. /// 根据渠道id查询人员信息
  151. /// </summary>
  152. /// <param name="channelid"></param>
  153. /// <returns></returns>
  154. public ActionResult Channelbusiness(string channelid)
  155. {
  156. string bussinessinfo = Channel.Channelbusiness(channelid);
  157. return Content(bussinessinfo, "application/json");
  158. }
  159. }
  160. }