コード例 #1
0
 public bool CreateDevices(string name, string nameShow, string branchOrProtocol)
 {
     try
     {
         Device device = new Device()
         {
             Name             = name,
             NameShow         = nameShow,
             BranchOrProtocol = branchOrProtocol
         };
         _context.Add(device);
         _context.SaveChangesAsync();
     }
     catch
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
 public bool CreateCatalog(string TagName, string deviceName, string Address, string Unit, string WarningMin, string WarningMax)
 {
     try
     {
         Catalog_Data cld = new Catalog_Data()
         {
             TagName     = TagName,
             DeviceName  = deviceName,
             Address     = Address,
             Unit        = Unit,
             WarnningMin = double.Parse(WarningMin),
             WarnningMax = double.Parse(WarningMax)
         };
         _context.Add(cld);
         _context.SaveChanges();
     }
     catch
     {
         return(false);
     }
     return(true);
 }