コード例 #1
0
        public string GetUserAuthority(ulong UserID, string UserKey)
        {
            // string id = HttpContext.Current.Session.SessionID.ToString();
//             foreach (ulong val in UserIDlst.Values)
//             {
//                 if (val == UserID) return "-1";
//             }

            DataClassesDataContext dc = new DataClassesDataContext();

            var userInfolst = from g in dc.UserInfo
                              where g.SerialNo_ == (int)UserID
                              select g;

            foreach (UserInfo userInfo in userInfolst)
            {
                HttpContext.Current.Session["__UserID"]        = UserID;
                HttpContext.Current.Session["__UserAuthority"] = userInfo.Purview;
                CEncryptionTools encryptionTools = new CEncryptionTools(UserID);
                UserKey = encryptionTools.Decode(UserKey);
                string[] vals = UserKey.Split(';');
                if (vals != null)
                {
                    if (vals.Length == 3)
                    {
                        UseRecord useRecord = new UseRecord();
                        useRecord.SerialNo_ = (int)UserID;
                        useRecord.Date      = DateTime.Now;
                        useRecord.IP1       = vals[0];
                        useRecord.MAC       = vals[1];
                        useRecord.IP2       = vals[2];
                        dc.UseRecord.InsertOnSubmit(useRecord);
                        dc.SubmitChanges();
                        if (!UserIDlst.ContainsKey(UserKey))
                        {
                            UserIDlst.Add(UserKey, UserID);
                        }
                        return(encryptionTools.Encode(userInfo.Purview.ToString()));
                    }
                }
            }
            HttpContext.Current.Session["__UserID"] = null;
            return(null);
        }
コード例 #2
0
 partial void UpdateUseRecord(UseRecord instance);
コード例 #3
0
 partial void DeleteUseRecord(UseRecord instance);
コード例 #4
0
 partial void InsertUseRecord(UseRecord instance);