コード例 #1
0
ファイル: TDBHostDAL.cs プロジェクト: dalinhuang/tdcodes
 public IList<TDBHost> SelectAll()
 {
     var returns = new List<TDBHost>();
     var dt = SqlDbAccess.GetInstance().GetTable("select * from TDBHost");
     foreach (DataRow dr in dt.Rows)
     {
         var tDBHost = new TDBHost();
         tDBHost.FromDataRow(dr);
         returns.Add(tDBHost);
     }
     return returns;
 }
コード例 #2
0
ファイル: HostMaintenance.cs プロジェクト: dalinhuang/tdcodes
 public TDBHost this[String id]
 {
     get
     {
         var entity = DALFacade.GetHostDAL(StorageTypeEnum.MongoDB).Select(id);
         if (entity == null)
         {
             entity = new TDBHost();
             PageLogger.RecordInfoLog(String.Format("We cann't find TDBHost {0} in MongoDB", id));
         }
         return entity;
     }
 }
コード例 #3
0
ファイル: PhyTree.cs プロジェクト: dalinhuang/tdcodes
 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);
 }
コード例 #4
0
ファイル: PhyTree.cs プロジェクト: dalinhuang/tdcodes
 private void AddSiteNode(TDBHost host, TreeNode parentNode)
 {
     var sites = DALFacade.GetSiteDAL(StorageTypeEnum.MongoDB).SelectAll(host.Code);
     sites = sites.Where(h => Rights.FirstOrDefault(r =>
         r.EntityType == 1 && r.EntityIdx == h.Idx.ToString()
         && r.UserIdx == ConfigToolContext.Instance.CurrentUser.Idx) != null).ToList();
     foreach (var site in sites)
     {
         CreateNode(site, parentNode);
     }
 }
コード例 #5
0
ファイル: CommandList.cs プロジェクト: dalinhuang/tdcodes
 private void ParseScript()
 {
     var commands = CommandParseUtility.Parse(Script);
     if (commands.Count > 0)
     {
         ConfigToolContext.Instance.LastSelectedCommand = commands[0];
     }
     if(ConfigToolContext.Instance.LastSelectedCommand != null)
     {
         InputCommand = new CommandInfo();
         if (ConfigToolContext.Instance.LastSelectedCommand is Command)
         {
             var command = DALFacade.GetCommandDAL(StorageTypeEnum.MongoDB).Select(ConfigToolContext.Instance.LastSelectedCommand.Id);
             
             InputSignal = DALFacade.GetSignalDAL(StorageTypeEnum.MongoDB).Select(command.Code, command.TagID);
             InputCommand.CommandId = command.Id;
             InputCommand.CommandName = command.Name;
         }
         else
         {
             var commanddo = DALFacade.GetCommandDODAL(StorageTypeEnum.MongoDB).Select(ConfigToolContext.Instance.LastSelectedCommand.Id);
             
             InputSignal = DALFacade.GetSignalDAL(StorageTypeEnum.MongoDB).Select(commanddo.Code, commanddo.TagID);
             InputCommand.CommandId = commanddo.Id;
             InputCommand.CommandName = commanddo.Name;
         }
         InputHost = DALFacade.GetHostDAL(StorageTypeEnum.MongoDB).Select(InputSignal.DBHostIndex.ToString());
         InputCommand.CommandType = MultilingualUtility.GetString("Command");
         InputCommand.CommandAddress = InputSignal.Address;
         InputCommand.Tag = InputSignal.IdxStr;
         InputCommand.EquipAddress = InputSignal.Address;
         InputCommand.IsSwitch = false;
         if (InputSignal.IOMIdx != 0)
         {
             InputEquipment = DALFacade.GetEquipmentDAL(StorageTypeEnum.MongoDB).Select(InputSignal.IOMIdx);
         }
         if (InputSignal.DACIdx != 0)
         {
             InputSite = DALFacade.GetSiteDAL(StorageTypeEnum.MongoDB).Select(InputSignal.DACIdx.HasValue ?
                 InputSignal.DACIdx.Value : 0);
         }
     }
 }
コード例 #6
0
ファイル: CommandList.cs プロジェクト: dalinhuang/tdcodes
 private List<TreeNode> AddSiteNode(TDBHost host, TreeNode parentNode)
 {
     var nodes = new List<TreeNode>();
     var sites = DALFacade.GetSiteDAL(StorageTypeEnum.MongoDB).SelectAll(host.Code);
     sites = sites.Where(h => Rights.FirstOrDefault(r =>
         r.EntityType == 1 && r.EntityIdx == h.Idx.ToString()) != null).ToList();
     foreach (var site in sites)
     {
         nodes.Add(CreateNode(site, parentNode));
     }
     return nodes;
 }