using ICSharpCode.TextEditor.Actions; using PMS.BusinessModels.ExternalManage; using PMS.EntityModels.ExternalManage; using PMS.Interface; using PMS.Interface.ExternalManage; using System; using System.Collections.Generic; using System.Configuration; using System.Drawing.Printing; using System.Linq; using System.Runtime.InteropServices; using System.Web; using System.Web.Mvc; using System.Web.Razor.Tokenizer.Symbols; namespace PMS.WebUI.Controllers { [CheckLogin(true)] public class ExternalManageController : BaseController { private string url = ConfigurationManager.AppSettings["External"].ToStringEx(); IExternalManage externalManage = InterfaceFactory.CreateBusinessInstance(); // GET: ExternalManage public ActionResult ExternalManage() { ViewBag.RYXZ = GetCurrentUser().PersonProperty; return View(); } public ActionResult ExternalAccredit() { ViewBag.baseUrl = url; ViewBag.userName = GetCurrentUser().Name; return View(); } public ActionResult ExternalRecords() { ViewBag.baseUrl = url; ViewBag.userName = GetCurrentUser().Name; return View(); } /// /// 关键字查询外部服务分类 /// /// 关键字 /// [HttpPost] public ActionResult GetMenu(string keyword, string productId, int type) { var json = externalManage.GetMenu(keyword, productId, type); return Content(json, "application/json"); } /// /// 产品ID查询分类 /// /// 关键字 /// [HttpPost] public ActionResult GetMenuByProduct(List productIds) { var json = externalManage.GetMenuByProduct(productIds); return Content(json, "application/json"); } /// /// 获取编码 /// /// 表名 /// [HttpPost] public ActionResult GetMaxClassCode(string parent_id, int type, string productId) { var json = externalManage.GetMaxClassCode( parent_id, type, productId); return Content(json); } /// /// 保存服务分类 /// /// /// [HttpPost] public ActionResult SaveExternalClass(ExternalClass model) { var json = externalManage.SaveExternalClass(model); if (json) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败"); } } /// /// 删除服务分类 /// /// /// [HttpPost] public ActionResult DeleteClass(string id) { var res = externalManage.DeleteClass(id); if (res) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "删除成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "删除失败"); } } /// /// 获取服务目录 /// /// 分类id /// 关键字 /// [HttpPost] public ActionResult GetExternal(string class_id, string keyword, int pageSize, int pageNum) { var json = externalManage.GetExternal(class_id, keyword, pageSize, pageNum); return Content(json, "application/json"); } /// /// 保存服务 /// /// /// [HttpPost] public ActionResult SaveExternal(External model) { var json = externalManage.SaveExternal(model); if(json) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功"); }else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败"); } } /// /// 获取参数 /// /// /// /// [HttpPost] public ActionResult GetParameter(string type, string id) { var json = externalManage.GetParameter(type, id); return Content(json, "application/json"); } /// /// 参数设置 /// /// /// [HttpPost] public ActionResult GetExternalParameter(string id) { var json = externalManage.GetExternalParameter(id); return Content(json, "application/json"); } /// /// 保存参数设置 /// /// /// [HttpPost] public ActionResult SavaExternalSet(v_parameter model) { var json = externalManage.SavaExternalSet(model); if (json) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败"); } } /// /// 删除服务和出入参信息 /// /// /// [HttpPost] public ActionResult deleteExternal(string id) { var res = externalManage.deleteExternal(id); if (res) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "删除成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "删除失败"); } } /// /// 复制 /// /// /// [HttpPost] public ActionResult CopyExternalByClass(dto_copy_class model) { var res = externalManage.CopyExternalByClass(model); if (res) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "失败"); } } /// /// 复制 /// /// /// [HttpPost] public ActionResult CopyExternal(dto_copy_external model) { var res = externalManage.CopyExternal(model); if (res) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "失败"); } } /// /// 查询授权接口 /// /// /// /// /// [HttpPost] public ActionResult GetAccredit(string keyword, int pageSize, int pageNum, int is_stop) { var json = externalManage.GetAccredit(keyword, pageSize, pageNum, is_stop); return Content(json, "application/json"); } /// /// 保存授权信息 /// /// /// [HttpPost] public ActionResult SavaAccredit(ExternalAccredit model) { var res = externalManage.SavaAccredit(model); if (res) { return this.ResponseJson(System.Net.HttpStatusCode.OK, "成功"); } else { return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "失败"); } } /// /// 授权信息 /// /// /// /// /// /// /// [HttpPost] public ActionResult GetAccredView(string id, string channel_id, string project_id, int pageSize, int pageNum, int is_stop) { var json = externalManage.GetAccredView(id, channel_id, project_id, pageSize, pageNum, is_stop); return Content(json, "application/json"); } [HttpPost] public ActionResult GetRecords(dto_records_in model) { var json = externalManage.GetRecords(model); return Content(json, "application/json"); } } }