初始化

This commit is contained in:
2025-11-25 17:41:24 +08:00
commit 4cdf0f0f85
3383 changed files with 1050962 additions and 0 deletions

View File

@@ -0,0 +1,174 @@
using Face.Domain.Entities;
using Face.Services;
using Face.Services.DBUtility.Common;
using Face.Services.Enums;
using Face.Services.Extensions;
using Face.Services.Manager;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Face.Web.Areas.App.Models;
namespace Face.Web.Areas.App.Controllers
{
public class BaseController : Controller
{
public Accountentity Umodel { get; set; }
public object ActPacket { get; set; }
public string ActMessage { get; set; }
public string ActType { get; set; }
public int ActLevel { get; set; }
/// <summary>
/// 在Action方法调用前使用使用场景如何验证登录等。
/// </summary>
/// <param name="filterContext"></param>
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
practical practical = new practical();
try
{
base.OnActionExecuting(filterContext);
if (Session["username"] == null)
{
Logs.WriteLog("Sessionkeys:" + JsonConvert.SerializeObject(Session.Keys));
filterContext.Result = new RedirectResult("/App/Login/Index");
}
else
{
Logs.WriteLog("username:" + JsonConvert.SerializeObject(Session["username"]));
}
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
//throw;
}
//校验用户是否已经登录
//var model = UserLoginHelper.CurrentUser();
//if (model != null)
//{
// //var db = new Uts_ManageEntities();
// //Umodel = db.TBL_UTS_Manage_UserList.SingleOrDefault(x => x.ID == model.ID);
// Umodel = model;
// if ((Umodel.IsValid)==1)
// //if (Umodel.IsActivation!=true)
// {
// Response.Redirect("/App/Login/Index");
// filterContext.Result = new EmptyResult();
// }
// if (!string.IsNullOrEmpty(ActType))
// {
// }
//}
//else
//{
// ContentResult Cr = new ContentResult
// {
// Content = string.Format("<script type='text/javascript'>top.location.hre f='{0}';</script>", "/App/Login/Index")
// };
// filterContext.Result = Cr;
// //Response.Redirect("/App/Login/Index");
// //filterContext.Result = new EmptyResult();
}
/// <summary>
/// 在Action方法调用后result方法调用前执行使用场景异常处理。
/// </summary>
/// <param name="filterContext"></param>
//protected override void OnActionExecuted(ActionExecutedContext filterContext)
//{
// base.OnActionExecuted(filterContext);
// ViewBag.Title = ActMessage;
// var model = UserLoginHelper.CurrentUser();
// if (model != null)
// {
// Umodel = model;
// if (!string.IsNullOrEmpty(ActMessage))
// {
// string controllerName = filterContext.RouteData.Values["controller"].ToString().ToLower();
// string actionName = filterContext.RouteData.Values["action"].ToString().ToLower();
// if (ViewBag.mFormUrl != null)
// ViewBag.FormUrl = ViewBag.mFormUrl;
// else
// {
// if (Request.UrlReferrer != null)
// ViewBag.FormUrl = Request.UrlReferrer.ToString();
// }
// }
// }
// else
// {
// Response.Redirect("/App/Login/Index");
// filterContext.Result = new EmptyResult();
// }
//}
//protected NameValueCollection FormatQueryString(NameValueCollection nameValues)
//{
// NameValueCollection nvcollection = new NameValueCollection();
// foreach (var item in nameValues.AllKeys)
// {
// if (item.Equals("datefiled"))
// {
// if (!String.IsNullOrEmpty(nameValues["dateform"]) && !String.IsNullOrEmpty(nameValues["dateto"]))
// {
// string[] sd = nameValues["dateform"].Split('/');
// string[] ed = nameValues["dateto"].Split('/');
// string sd2 = sd[2] + "-" + sd[0] + "-" + sd[1];
// string ed2 = ed[2] + "-" + ed[0] + "-" + ed[1];
// //DateTime startDate = DateTime.Parse(sd2).AddSeconds(-1);
// //DateTime endDate = DateTime.Parse(ed2).ToDateTime();
// //nvcollection.Add(nameValues[item] + ">", startDate.ToString());
// //nvcollection.Add(nameValues[item] + "<", endDate.ToString());
// DateTime startDate = DateTime.Parse(sd2).ToDateTime();
// DateTime endDate = DateTime.Parse(ed2).ToDateTime();
// nvcollection.Add(nameValues[item] + ">=", startDate.ToString());
// nvcollection.Add(nameValues[item] + "<=", endDate.ToString());
// }
// }
// else if (item.Equals("numberfiled"))
// {
// if (!String.IsNullOrEmpty(nameValues["numberform"]) && !String.IsNullOrEmpty(nameValues["numberto"]))
// {
// //double startNumber = nameValues["numberform"].ToDouble() - 0.0001;
// //double endNumber = nameValues["numberto"].ToDouble() + 0.0001;
// //nvcollection.Add(nameValues[item] + ">", startNumber.ToString());
// //nvcollection.Add(nameValues[item] + "<", endNumber.ToString());
// double startNumber = nameValues["numberform"].ToDouble();
// double endNumber = nameValues["numberto"].ToDouble();
// nvcollection.Add(nameValues[item] + ">=", startNumber.ToString());
// nvcollection.Add(nameValues[item] + "<=", endNumber.ToString());
// }
// }
// else if (item.Equals("keyfiled"))
// {
// if (!string.IsNullOrEmpty(nameValues["keyword"]))
// nvcollection.Add(nameValues[item], nameValues["keyword"]);
// }
// }
// return nvcollection;
//}
}
}