From adfe53d56273a21dccfc20401c1c1059d5ce5beb Mon Sep 17 00:00:00 2001 From: LR-20210131IOQH\Administrator <jackcold@163.com> Date: 星期二, 08 六月 2021 15:08:50 +0800 Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/zhengcaioa --- zhengcaioa/zhengcaioa/Controllers/Expert/ExpertsApplyController.cs | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 160 insertions(+), 0 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertsApplyController.cs b/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertsApplyController.cs new file mode 100644 index 0000000..2473722 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Controllers/Expert/ExpertsApplyController.cs @@ -0,0 +1,160 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.Logging; +using IServices; +using DTO; +using Newtonsoft.Json; +using zhengcaioa.Models; +using Microsoft.AspNetCore.Http; +using zhengcaioa.IService; +using System.IO; +using Microsoft.Extensions.Configuration; + +namespace zhengcaioa.Controllers.Expert +{ + public class ExpertsApplyController : Controller + { + private readonly ILogger<ExpertsApplyController> _logger; + private readonly IExpertService _expertService; + private readonly ILiaotianService _liaotianService; + private readonly IProjectService _projectService; + private readonly IUserService _userService; + public ExpertsApplyController(ILogger<ExpertsApplyController> logger, IExpertService expertService, IProjectService projectService, ILiaotianService liaotianService, IUserService userService) + { + _logger = logger; + _expertService = expertService; + _projectService = projectService; + _liaotianService = liaotianService; + _userService = userService; + } + + #region 涓撳鐢宠锛岃瘎瀹� + + public ActionResult ExpertsApply(string id = null) + { + + //var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + //ViewData["curentuser"] = curentuser; + List<ActionEntity> actionlist = new List<ActionEntity>(); + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Save"; + actionEntity.PageIco = "glyphicon glyphicon-ok"; + actionEntity.ActionName = "淇濆瓨"; + actionlist.Add(actionEntity); + + ViewData["ActionInfo"] = actionlist; + + ExpertDTO expertDTO = new ExpertDTO(); + if (!string.IsNullOrEmpty(id)) + { + expertDTO = _expertService.Get(id); + } + else + { + expertDTO.Province = "510000"; + expertDTO.City = "510100"; + } + // var sheng = _projectService.Getsheng(); + + + // ViewBag.InfoSource = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly");//.Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.sex = _liaotianService.GetSYScode("plt_user", "sex");//.Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + // ViewBag.expertType = _liaotianService.GetSYScode("experts", "expertType");//.Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + // ViewBag.level = _liaotianService.GetSYScode("experts", "level");//.Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.ReviewItem = _liaotianService.GetSYScode("experts", "ReviewItem");//.Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + + ViewBag.Province = _projectService.Getsheng();//.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); + ViewBag.City = _projectService.Getshi(expertDTO.Province);//.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); + ViewData.Model = expertDTO; + return View(); + } + + + + + + //public string Get(string id = null) + //{ + // ExpertDTO expertDTO = new ExpertDTO(); + // if (!String.IsNullOrEmpty(id)) + // { + // expertDTO = _expertService.Get(id); + // } + + // return JsonConvert.SerializeObject(expertDTO); + //} + + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + [HttpPost] + + public string ExpertsApplySave(ExpertDTO data) + { + //var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + //ViewData["curentuser"] = curentuser; + data.ReviewItem = data.ReviewItemSelect; + data.InfoSource = "00"; + data.ExpertType = "0"; + data.Level = "0"; + data.RecStatus = "A"; + data.ShenheStatus = "D"; + if (String.IsNullOrEmpty(data.Id)) + { + data.Creater = "1"; + data.Createtime = DateTime.Now; + } + data.Modifier = "1"; + data.Modifytime = DateTime.Now; + + ResultEntity resultEntity = _expertService.save(data); + + return JsonConvert.SerializeObject(resultEntity); + } + #endregion + + + + public IActionResult Index() + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + List<ActionEntity> actionlist = new List<ActionEntity>(); + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Search"; + actionEntity.PageIco = "fa fa-search"; + actionEntity.ActionName = "鏌ヨ"; + actionlist.Add(actionEntity); + + ViewData["ActionInfo"] = actionlist; + + ViewBag.expertType = _liaotianService.GetSYScode("experts", "expertType").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.level = _liaotianService.GetSYScode("experts", "level").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.Province = _projectService.Getsheng().Select(x => new { code = x.CodeId, label = x.Name }).ToList(); + // ViewBag.City = _projectService.Getshi( ).Select(x => new { code = x.CodeId, label = x.Name }).ToList(); + ViewBag.ReviewItem = _liaotianService.GetSYScode("experts", "ReviewItem").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + return View(); + } + + #region 鏌ヨ + [CheckLogin] + public string GetList(ExpertDTOSearch search) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + search.ShenheStatus = "D"; + ViewData["curentuser"] = curentuser; + return JsonConvert.SerializeObject(_expertService.SearchByPaging(search)); + } + #endregion + } +} -- Gitblit v1.9.1