| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*
- * 创客账户
- */
- using System;
- using System.Web;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Data;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using MySystem.Models;
- using Library;
- using LitJson;
- using MySystemLib;
- namespace MySystem.Areas.Admin.Controllers
- {
- [Area("Admin")]
- [Route("Admin/[controller]/[action]")]
- public class SettlementCardChangeRecordController : BaseController
- {
- public SettlementCardChangeRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
- }
- #region 结算卡变更记录
- /// <summary>
- /// 根据条件查询结算卡变更记录
- /// </summary>
- /// <returns></returns>
- public IActionResult Index(SettlementCardChangeRecord data, string right)
- {
- ViewBag.RightInfo = RightInfo;
- ViewBag.right = right;
- return View();
- }
- #endregion
- #region 根据条件查询结算卡变更记录
- /// <summary>
- /// 结算卡变更记录
- /// </summary>
- /// <returns></returns>
- public JsonResult IndexData(SettlementCardChangeRecord data, string CreateDateData, string MakerCode, string RealName, string BeforeCardNo, string AfterCardNo, int page = 1, int limit = 30)
- {
- Dictionary<string, string> Fields = new Dictionary<string, string>();
- string condition = " and Status>-1";
- //创建时间
- if (!string.IsNullOrEmpty(CreateDateData))
- {
- string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
- string start = datelist[0];
- string end = datelist[1];
- condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
- }
- //创客编号
- if (!string.IsNullOrEmpty(MakerCode))
- {
- condition += " and Id in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
- }
- //创客名称
- if (!string.IsNullOrEmpty(RealName))
- {
- condition += " and Id in (select Id from Users where RealName='" + RealName + "')";
- }
- //变更前卡号
- if (!string.IsNullOrEmpty(BeforeCardNo))
- {
- condition += " and BeforeCardNo=" + BeforeCardNo;
- }
- //变更后卡号
- if (!string.IsNullOrEmpty(AfterCardNo))
- {
- condition += " and AfterCardNo=" + AfterCardNo;
- }
- Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SettlementCardChangeRecord", Fields, "Id desc", "0", page, limit, condition);
- List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
- foreach (Dictionary<string, object> dic in diclist)
- {
- int UserId = int.Parse(dic["UserId"].ToString());
- Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
- dic["MakerCode"] = user.MakerCode;
- dic["RealName"] = user.RealName;
- }
- return Json(obj);
- }
- #endregion
- }
- }
|