using JCSoft.WX.Framework.Api; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Common.Wechat; using Common; using System.Data; using Common.Model; using ZcPeng.PublicLibrary; using CoreEntity.Entity; using CoreEntity.DAL; using System.Collections.Concurrent; using Newtonsoft.Json.Converters; using Newtonsoft.Json; using System.Data.SqlClient; using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Caching.Memory; using Jwt; using PublicLibrary.Model; using Newtonsoft.Json.Linq; using SupplierWeb.Codes.mvc; using SupplierWeb.Codes.Auth; namespace SupplierWeb.Controllers { [Route("web/owner")] public class OwnerController : BaseController { public OwnerController(IMemoryCache cache, IApiClient client) : base(cache, client) { } /// /// /// /// OrgId /// /// [AuthPermission] [HttpPost, Route("setOrgKContact")] public JsonResult setOrgKContact(string OrgId, [FromBody]dynamic data) { string userids; string LoginAccountId = userids = getStaff("userid"); //判断参数是否合法 if (string.IsNullOrEmpty(userids)) { return Json(new { success = 0, msg = "登陆超时", timeout = 1 }); } //string K_ContactId = ""; string K_UserId = ""; if (data != null) { K_UserId = data.Id; OrgId = data.OrgId; } List list = new List(); #region 更新记录状态 string commandTextStateR = "UPDATE OrgDoc " + " SET " + " K_UserId = @K_UserId" + " WHERE OrgId = @OrgId " ; string resultStateR; //准备参数 List> parametersStateR = new List>(); parametersStateR.Add(new List(2) { "K_UserId", K_UserId }); parametersStateR.Add(new List(2) { "OrgId", OrgId }); List parametersStateR1 = DataAccess.ToParameters(parametersStateR); list.Add(new DataAccessCommand(commandTextStateR, parametersStateR1, CommandType.Text, true)); #endregion bool success = DataAccess.ExecuteBatchCommands(list, out resultStateR); return Json(new { success = success, msg = resultStateR, }); } ////删除业务员产品供应商 [AuthPermission] [HttpPost, Route("delete")] public ActionResult Delete( string OrgId) { string userids; string LoginAccountId = userids = getStaff("userid"); //判断参数是否合法 if (string.IsNullOrEmpty(userids)) { return Json(new { success = 0, msg = "登陆超时", timeout = 1 }); } string commandText = "UPDATE OrgDoc " + " SET " + " K_UserId = null " + " WHERE OrgId = @OrgId " ; //准备参数 List> parameters = new List>(); parameters.Add(new List() { "OrgId", OrgId }); string result = ""; List parameters1 = DataAccess.ToParameters(parameters); int success = DataAccess.ExecuteCommand(commandText, parameters1, out result); return Content("{" + success + "}"); } ////货主列表 [HttpGet, Route("orgs")] public ActionResult orgs() { List roles = OrgDAL.getOrg("E1WB67UEYPG", " and OrgCode like 'B%' and OrgType=5 "); IList