コード例 #1
0
 public void Save(Database db, long themeId)
 {
     if (_rowid == 0L)
     {
         _rowid = db.Insert("location", new object[]
         {
             "theme_id", themeId,
             "path", _path,
             "type", _type.ToString(),
             "update_freq", _updateFreq,
             "update_period", _updatePeriod.ToString(),
             "disabled", _disabled ? 1 : 0,
             "last_update", _lastUpdate != DateTime.MinValue ? (object)_lastUpdate : null
         });
     }
     else
     {
         db.Update("location", "rowid = @rowid", new object[]
         {
             "theme_id", themeId,
             "path", _path,
             "type", _type.ToString(),
             "update_freq", _updateFreq,
             "update_period", _updatePeriod.ToString(),
             "disabled", _disabled ? 1 : 0,
             "last_update", _lastUpdate != DateTime.MinValue ? (object)_lastUpdate : null
         },
                   new object[] { "@rowid", _rowid });
     }
 }
コード例 #2
0
        protected override void GetSessionData(XmlElement root, XmlElement element)
        {
            XmlElement location_e = root.OwnerDocument.CreateElement("Expression");

            location_e.SetAttribute("type", LocationType.ToString());
            location_e.SetAttribute("expression", Name);
            element.AppendChild(location_e);
        }
コード例 #3
0
        public async Task <IActionResult> GetEventsByLocation(LocationType location, int?page, int?count)
        {
            LogRequestInformation(location.ToString());

            var result = await _douService.GetEventsByLocation(location, page, count);

            LogResponseInformation(result);
            return(Ok(result));
        }
コード例 #4
0
        private StockLocation GetLocation(string id, LocationType type)
        {
            var location = this._database.Locations.Where(item => item.Type == type).FirstOrDefault(item => item.Id == id);

            if (location == null)
            {
                throw new NotFoundException($"{id} {type.ToString()} Not found");
            }

            return(location);
        }
コード例 #5
0
        public IBackupLocationFactory Resolve(LocationType backupType)
        {
            switch (backupType)
            {
            case LocationType.CIFS:
            {
                return(new CIFSBackupLocationFactory());
            }

            default:
            {
                throw new ArgumentException($"Backup type {backupType.ToString()} does not exist");
            }
            }
        }
コード例 #6
0
 /// <summary>
 /// Write the device configuration to the  ASCOM  Profile store
 /// </summary>
 internal static void WriteProfile()
 {
     using (Profile driverProfile = new Profile())
     {
         driverProfile.DeviceType = "ObservingConditions";
         Log.WriteProfile(driverProfile);
         driverProfile.WriteValue(driverID, "LocationType", locationType.ToString());
         driverProfile.WriteValue(driverID, "CityName", CityName);
         driverProfile.WriteValue(driverID, "SiteElevation", SiteElevation.ToString(CultureInfo.InvariantCulture));
         driverProfile.WriteValue(driverID, "SiteLatitude", SiteLatitude.ToString(CultureInfo.InvariantCulture));
         driverProfile.WriteValue(driverID, "SiteLongitude", SiteLongitude.ToString(CultureInfo.InvariantCulture));
         driverProfile.WriteValue(driverID, "ApiKey", apiKey);
         driverProfile.WriteValue(driverID, "ApiUrl", apiUrl);
     }
 }
コード例 #7
0
        public static string LocationTypeToString(LocationType type)
        {
            switch (type)
            {
            case LocationType._Unknown:
                return("Unknown");

            case LocationType.AllegianceHall:
                return("Allegiance Hall");

            case LocationType.Bindstone:
                return("Allegiance Bindstone");

            case LocationType.PortalHub:
                return("Portal Hub");

            case LocationType.SettlementPortal:
                return("Settlement Portal");

            case LocationType.Village:
                return("Settlement");

            case LocationType.TownPortal:
                return("Town Portal");

            case LocationType.UndergroundPortal:
                return("Underground Portal");

            case LocationType.WildernessPortal:
                return("Wilderness Portal");

            case LocationType._StartPoint:
                return("Start Point");

            case LocationType._EndPoint:
                return("End Point");

            case LocationType.Custom:
                return("Custom");

            case LocationType.AnyPortal:
                return("Any Portal");

            default:
                return(type.ToString());
            }
        }
コード例 #8
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(Binding.DoNothing);
            }

            if (value is LocationType == false)
            {
                return(Binding.DoNothing);
            }

            LocationType typeOfLocation   = (LocationType)value;
            string       locationIconName = string.Empty;

            try
            {
                switch (typeOfLocation)
                {
                case LocationType.Country:
                    locationIconName = "CountryImage";
                    break;

                case LocationType.Region:
                    locationIconName = "RegionImage";
                    break;

                case LocationType.City:
                    locationIconName = "CityImage";
                    break;

                case LocationType.Unknown:
                    return(Binding.DoNothing);

                default:
                    throw new ArgumentOutOfRangeException(typeOfLocation.ToString());
                }

                return(Application.Current.Resources[locationIconName]);
            }
            catch
            {
            }

            return(Binding.DoNothing);
        }
コード例 #9
0
        public bool CmdCheckConnection(IWin32Window owner, String server, LocationType locType, String dbLocation)
        {
            var builder = new System.Data.SqlClient.SqlConnectionStringBuilder();

            builder.DataSource             = server;
            builder.IntegratedSecurity     = true;
            builder.AsynchronousProcessing = true;
            switch (locType)
            {
            case LocationType.Name:
                builder.InitialCatalog = dbLocation;
                break;

            case LocationType.Path:
                builder.AttachDBFilename = dbLocation;
                break;

            default:
                Debug.Fail("Invalid case: " + locType.ToString());
                break;
            }
            return(CheckConnectionString(owner, builder.ToString()));
        }
コード例 #10
0
        public override string ToString()
        {
            var name = LocationType == LocationType.SpecificLocation ? KnownLocation.ToString() : LocationType.ToString();

            return($"{Variable}: {GeneralLocation} {name}");
        }
コード例 #11
0
 public static string Path(this IStreamProvider streamProvider, LocationType type, string tableName, CrawlType crawlType, DateTime version)
 {
     return(System.IO.Path.Combine(type.ToString(), tableName, crawlType.ToString(), version.ToUniversalTime().ToString(DateTimeFolderFormat)));
 }
コード例 #12
0
 public static string Path(this IStreamProvider streamProvider, LocationType type, string tableName, CrawlType crawlType)
 {
     return(System.IO.Path.Combine(type.ToString(), tableName, crawlType.ToString()));
 }
コード例 #13
0
 public static string Path(this IStreamProvider streamProvider, LocationType type, string tableName, string extension)
 {
     return(System.IO.Path.Combine(type.ToString(), tableName + extension));
 }
コード例 #14
0
ファイル: DBManager.cs プロジェクト: boussaffawalid/CutOptima
 public bool CmdCheckConnection(IWin32Window owner, String server, LocationType locType, String dbLocation)
 {
     var builder = new System.Data.SqlClient.SqlConnectionStringBuilder();
     builder.DataSource = server;
     builder.IntegratedSecurity = true;
     builder.AsynchronousProcessing = true;
     switch (locType)
     {
         case LocationType.Name:
             builder.InitialCatalog = dbLocation;
             break;
         case LocationType.Path:
             builder.AttachDBFilename = dbLocation;
             break;
         default:
             Debug.Fail("Invalid case: " + locType.ToString());
             break;
     }
     return CheckConnectionString(owner, builder.ToString());
 }