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); }
partial void UpdateUseRecord(UseRecord instance);
partial void DeleteUseRecord(UseRecord instance);
partial void InsertUseRecord(UseRecord instance);