Example #1
0
 public UserInfo Select(String name)
 {
     UserInfo returns = null;
     var dt = SqlDbAccess.GetInstance().GetTable("SELECT * FROM TRightuser WHERE Name = '" + name + "'");
     foreach (DataRow dr in dt.Rows)
     {
         returns = new UserInfo();
         returns.FromDataRow(dr);
         break;
     }
     return returns;
 }
Example #2
0
 public UserInfo Select(Int32 idx)
 {
     UserInfo returns = null;
     var dt = SqlDbAccess.GetInstance().GetTable("SELECT * FROM TRightuser WHERE Idx = " + idx);
     foreach (DataRow dr in dt.Rows)
     {
         returns = new UserInfo();
         returns.FromDataRow(dr);
         break;
     }
     return returns;
 }
Example #3
0
 public IList<UserInfo> SelectAll()
 {
     var returns = new List<UserInfo>();
     var dt = SqlDbAccess.GetInstance().GetTable("SELECT * FROM TRightuser");
     foreach (DataRow dr in dt.Rows)
     {
         var tUser = new UserInfo();
         tUser.FromDataRow(dr);
         returns.Add(tUser);
     }
     return returns;
 }
Example #4
0
 public static Boolean AuthUserNoEncy(UserInfo user, String pwd)
 {          
     if (String.IsNullOrEmpty(user.LPassword))
     {
         PageLogger.RecordDebugLog(user.LoginName + pwd + "||" + user.LPassword);
         return true;
     }
     else
     {
         if (pwd.ToLower() == user.LPassword.ToLower())
             return true;
         return false;
     }
 }
Example #5
0
 public static Boolean AuthUser(UserInfo user, String pwd)
 {
     if (String.IsNullOrEmpty(user.LPassword))
     {
         return true;
     }
     else
     {
         pwd = EncyPassword(pwd);
         if (pwd.ToLower() == user.LPassword.ToLower())
             return true;
         return false;
     }
 }
Example #6
0
 public Node GetCameraNodes(UserInfo user)
 {
     var node = new Node();
     if (m_LogicCameraNodes.ContainsKey(user.LoginName))
     {
         m_LogicCameraNodes.TryGetValue(user.LoginName, out node);
     }
     else
     {
         var rights = RightMaintenance.Instance.FilterUserNodeRight(user);
         rights = rights.Where(r => r.SysFlag != UNSYSFLAG).ToList();
         node = CreateTree(rights, MultilingualUtility.GetString("Camera"), SYSFLAG);
     }
     return node;
 }
Example #7
0
        public IList<int> SelectUserStationRight(UserInfo user)
        {
            var returns = new List<int>();

            string idx = GetIdx(user);
            int idxInt = int.Parse(idx);
            string stationTableNameSuffix = (idxInt / 10000).ToString();
            string stationTableName = string.Format("TDeviceRightDetail" + stationTableNameSuffix.PadLeft(5, '0'));

            var dt = SqlDbAccess.GetInstance().GetTable(string.Format("select EntityIdx from {0} where EntityType =1 and UserIdx = {1} ",stationTableName,idx));
        
            foreach (DataRow dr in dt.Rows)
            {
                returns.Add(int.Parse(dr["EntityIdx"].ToString()));
            }

            return returns;
        }
Example #8
0
 private void CreateInputTree()
 {
     var user = new UserInfo();
     user.Id = "InputUserName1";
     user.Name = MultilingualUtility.GetString("User");
     CreateNode(user, null);
     var host = new TDBHost();
     host.Name = MultilingualUtility.GetString("Host");
     host.Id = "InputHost1";
     CreateNode(host, null);
     var group = new Group();
     group.Id = "InputGroup1";
     group.Name = MultilingualUtility.GetString("Region");
     CreateNode(group, null);
     var site = new Site();
     site.Id = "InputSite1";
     site.Name = MultilingualUtility.GetString("Site");
     CreateNode(site, null);
     var equip = new Equipment();
     equip.Id = "InputEquipment1";
     equip.Name = MultilingualUtility.GetString("Equipment");
     CreateNode(equip, null);
     var signal = new Signal();
     signal.Id = "InputSignal1";
     signal.Name = MultilingualUtility.GetString("Signal");
     CreateNode(signal, null);
     var com = new Command();
     com.Id = "InputCommand1";
     com.Name = MultilingualUtility.GetString("Command");
     CreateNode(com, null);
     var comdo = new CommandDO();
     comdo.Id = "InputCommandDO1";
     comdo.Name = MultilingualUtility.GetString("CommandDO");
     CreateNode(comdo, null);
     var affair = new Affair();
     affair.Id = "InputAffair1";
     affair.Name = MultilingualUtility.GetString("Event");
     CreateNode(affair, null);
     var node = new Node();
     node.Id = "InputNode1";
     node.Name = MultilingualUtility.GetString("Node");
     CreateNode(node, null);
 }
Example #9
0
        public IList<Node> SelectUserNodeRight(UserInfo user)
        {
            var returns = new List<Node>();

            string idx = GetIdx(user);
            int idxInt = int.Parse(idx);
            string nodeTableNameSuffix = (idxInt / 10000).ToString();
            string nodeTableName = string.Format("TUserNodes" + nodeTableNameSuffix.PadLeft(5, '0'));

            var dt = SqlDbAccess.GetInstance().GetTable(string.Format("select Idx,Name,Layer,ParentIdx from {0} where Name like 'username' ", nodeTableName, idx));

            foreach (DataRow dr in dt.Rows)
            {
                Node node = new Node();
                node.FromDataRow(dr);
                returns.Add(node);
            }

            return returns;
        }
Example #10
0
 public void Save(UserInfo user)
 {
     DALFacade.GetUserInfoDAL(StorageTypeEnum.MongoDB).SaveAll(new List<UserInfo>() { user });
 }
Example #11
0
 private string GetIdx(UserInfo user)
 {
     return SqlDbAccess.GetInstance().GetOne(string.Format("select Idx from TRightuser where Name like '{0}' ", user.Name));
 }
Example #12
0
 public IList<UserNodeRight> FilterUserNodeRight(UserInfo user)
 {
     var rights = new List<UserNodeRight>();
     if (user.IsChildrenUser)
     {
         var arearights = DALFacade.GetUserAreaRightDAL(StorageTypeEnum.MongoDB).SelectAll()
             .Where(r => r.UserIdx == user.AdminIdx && r.EntityType == 0)
             .ToList();
         rights = DALFacade.GetUserNodeRightDAL(StorageTypeEnum.MongoDB).SelectAll()
             .ToList();
         rights = rights.Where(r => arearights.Exists(s => s.EntityIdx == r.Idx.ToString())).ToList();
     }
     else
     {
         rights = DALFacade.GetUserNodeRightDAL(StorageTypeEnum.MongoDB).SelectAll()
             .Where(r => r.UserIdx == user.Idx)
             .ToList();
     }
     return rights;
 }
Example #13
0
 public IList<DeviceRight> FilterUserDeviceRight(UserInfo user)
 {
     var rights = DALFacade.GetDeviceRightDAL(StorageTypeEnum.MongoDB).SelectAll();
     if (user.IsChildrenUser)
     {
         rights = rights.Where(r => r.UserIdx == user.AdminIdx).ToList();
     }
     else
     {
         rights = rights.Where(r => r.UserIdx == user.Idx).ToList();
     }
     return rights;
 }