Common/Helper.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TeamTask.Model;

namespace TeamTask.Common
{
    public class Helper
    {
        public static int UserID
        {
            get
            {
                if (HttpContext.Current.Session["UserID"] != null)
                {
                    return int.Parse(HttpContext.Current.Session["UserID"].ToString());
                }
                throw new Exception("不应该被调用,你完全没判断好");
            }
        }

        public static List<KeyValuePair<int, string>> TaskType = new List<KeyValuePair<int, string>>() 
        { 
            new KeyValuePair<int, string>(1, "新需求"),
            new KeyValuePair<int, string>(2, "缺陷"),
            new KeyValuePair<int, string>(3, "改进")
        };

        public static List<KeyValuePair<int, string>> TaskStatus = new List<KeyValuePair<int, string>>() 
        { 
            new KeyValuePair<int, string>(1, "未开始"),
            new KeyValuePair<int, string>(2, "开始执行"),
            new KeyValuePair<int, string>(3, "已解决"),
            new KeyValuePair<int, string>(4, "不存在"),
            new KeyValuePair<int, string>(5, "无法修复"),
            new KeyValuePair<int, string>(6, "无此需求")
        };

        public static void Validate(HttpContext Context) 
        {
            var code = Context.Request.Url.LocalPath.ToLower().Replace("/server/_", "").Replace(".asmx", "").Replace("/", "_");
            if (Context.Session["UserID"] != null)
            {
                if (code.Contains("add") || code.Contains("edit") || code.Contains("delete") || code.Contains("modify"))
                {
                    using (var db = new DBContext())
                    {
                        if (db.User_Function.Count(m => m.Function.Code == code && m.UserID == UserID) == 0) 
                        {
                            //没权限怎么进来的
                            Context.Response.StatusCode = 888;
                            Context.Response.Clear();
                            Context.Response.Flush();
                            Context.Response.End();
                        }
                    }
                }
            }
            else
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。