internal LinuxNetworkInterface(string name) : base(name) { _operationalStatus = GetOperationalStatus(name); _supportsMulticast = GetSupportsMulticast(name); _speed = GetSpeed(name); _ipProperties = new LinuxIPInterfaceProperties(this); }
public void Setup() { //Instance Fields Setup BooleanField = null; ByteField = null; SByteField = null; IntField = null; LongField = null; Int16Field = null; UInt16Field = null; Int32Field = null; UInt32Field = null; Int64Field = null; UInt64Field = null; CharField = null; DoubleField = null; FloatField = null; //Static Fields Setup BooleanFieldStatic = null; ByteFieldStatic = null; SByteFieldStatic = null; IntFieldStatic = null; LongFieldStatic = null; Int16FieldStatic = null; UInt16FieldStatic = null; Int32FieldStatic = null; UInt32FieldStatic = null; Int64FieldStatic = null; UInt64FieldStatic = null; CharFieldStatic = null; DoubleFieldStatic = null; FloatFieldStatic = null; }
/// <summary> /// Initializes a new instance of the Asn1Integer class with a given value. /// </summary> /// <param name="val"></param> public Asn1Integer(long? val) { Value = val; Min = null; Max = null; //Gets the upper and lower bound for the structure. object[] allAttributes = GetType().GetCustomAttributes(true); foreach (object o in allAttributes) { if (o is Asn1IntegerBound) { Asn1IntegerBound aib = o as Asn1IntegerBound; if (aib.HasMin) { Min = aib.Min; } if (aib.HasMax) { Max = aib.Max; } break; } } }
public CurrentUserDataResponse(string body) : base(body) { JSONObject ob = (JSONObject) this.ReturnData; this.currency = (string)ob["currency"]; this.leverage = (long?) ob["leverage"]; }
private VideoFile(SerializationInfo info, DeserializeInfo di) : this(di.Server, di.Info, di.Type) { actors = info.GetValue("a", typeof(string[])) as string[]; description = info.GetString("de"); director = info.GetString("di"); genre = info.GetString("g"); title = info.GetString("t"); try { width = info.GetInt32("w"); height = info.GetInt32("h"); } catch (Exception) { } var ts = info.GetInt64("du"); if (ts > 0) { duration = new TimeSpan(ts); } try { bookmark = info.GetInt64("b"); } catch (Exception) { bookmark = 0; } try { subTitle = info.GetValue("st", typeof(Subtitle)) as Subtitle; } catch (Exception) { subTitle = null; } initialized = true; }
private void textBoxSideA_TextChanged(object sender, TextChangedEventArgs e) { long content; try { content = Convert.ToInt64(textBoxSideA.Text); if (content > 0) { a = content; if (b != null && c != null) { Calculate(); } else { labelResult.Content = string.Empty; } } else { a = null; labelResult.Content = "The sides must be positive!"; image.Source = null; } } catch (FormatException) { a = null; labelResult.Content = "The sides must be a positive integer"; image.Source = null; } }
public ClientSpace(IDataReader reader) { clientSpaceID = (long)reader["ClientSpaceID"]; primaryUserID = reader["PrimaryUserID"] == DBNull.Value ? null : (long?)reader["ClientSpaceID"]; enabled = (bool)reader["Enabled"]; name = (string)reader["Name"]; }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { MInt = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I64) { MLong = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
private RangeItemHeaderValue(RangeItemHeaderValue source) { Contract.Requires(source != null); _from = source._from; _to = source._to; }
protected BaseFile(FileServer server, FileInfo aFile, DlnaMime aType, DlnaMediaTypes aMediaType) { if (server == null) { throw new ArgumentNullException("server"); } this.server = server; Item = aFile; length = Item.Length; lastModified = Item.LastWriteTimeUtc; Type = aType; MediaType = aMediaType; title = System.IO.Path.GetFileNameWithoutExtension(Item.Name); if (string.IsNullOrEmpty(title)) { title = Item.Name; } if (!string.IsNullOrWhiteSpace(title)) { try { title = Uri.UnescapeDataString(title); } catch (UriFormatException) { // no op } } title = title.StemNameBase(); }
public long? this[string key] { get { long? ReturnValue = null; switch (key) { case "FinishedGoodIDX" : {ReturnValue = this.FinishedGoodIDX; break; } case "PartIDX" : {ReturnValue = this.PartIDX; break; } case "amount" : { ReturnValue = this.amount; break; } default: break; } return ReturnValue; } set { switch (key) { case "FinishedGoodIDX" : { this.FinishedGoodIDX = value; break; } case "PartIDX" : { this.PartIDX = value; break; } case "amount" : { this.amount = value; break; } default: break; } } }
public void LogNetworkStats() { if (MySession.Static == null || MySession.Static.SyncLayer == null || MyMultiplayer.Static == null) return; if ((DateTime.UtcNow - m_lastStatMeasurePerUpdateTime).TotalMilliseconds > NETGRAPH_UPDATE_TIME_MS) { m_lastStatMeasurePerUpdateTime = DateTime.UtcNow; CopyStats(MySession.Static.SyncLayer.TransportLayer.SendStats, m_sendStatsCopy); CopyStats(MySession.Static.SyncLayer.TransportLayer.ReceiveStats, m_receivedStatsCopy); if (MyFakes.ENABLE_NETGRAPH && !MySandboxGame.IsDedicated) { MyHud.Netgraph.UpdateNextBar( MySession.Static.SyncLayer.TransportLayer.ByteCountReceived, MySession.Static.SyncLayer.TransportLayer.ByteCountSent, m_receivedStatsCopy); if (!Sync.IsServer && (DateTime.UtcNow - m_lastPingSent).TotalSeconds > NETGRAPH_PING_TIME_S) { m_lastPingSent = DateTime.UtcNow; if (Sync.Layer != null && m_lastSentPingInTicks == null) { m_lastSentPingInTicks = DateTime.UtcNow.Ticks; MyMultiplayer.Static.SendPingToServer(); } } } } WriteStats(m_sendStatsCopy, "Total size - sent"); WriteStats(m_receivedStatsCopy, "Total size - received"); }
public void ClearStats() { m_lastSentPingInTicks = null; m_lastPingSent = m_lastStatMeasurePerUpdateTime = DateTime.UtcNow; m_receivedStatsCopy.Clear(); m_sendStatsCopy.Clear(); }
private RangeItemHeaderValue(RangeItemHeaderValue source) { Debug.Assert(source != null); _from = source._from; _to = source._to; }
public Task(Action action, int? expiration = null) { if(expiration != null) _expiration = DateTime.Now.AddMilliseconds(expiration.Value).Ticks; _action = action; }
public void Calculate() { if (_done) return; Sum = null; Min = null; Max = null; DateSum = null; DateMin = null; DateMax = null; foreach (var cell in Cells) { if (Element.IsNumeric) { if (cell.DoubleValue != null) { if (Sum == null) Sum = 0; if (Min == null) Min = cell.DoubleValue; if (Max == null) Max = cell.DoubleValue; Sum += cell.DoubleValue; if (cell.DoubleValue < Min) Min = cell.DoubleValue; if (cell.DoubleValue > Max) Max = cell.DoubleValue; } } if (Element.IsDateTime) { if (cell.DateTimeValue != null) { //Uses ticks/kTickDivider = seconds for calculations if (DateSum == null) DateSum = cell.DateTimeValue.Value.Ticks / kTickDivider; else DateSum += cell.DateTimeValue.Value.Ticks / kTickDivider; if (DateMin == null) DateMin = cell.DateTimeValue; if (DateMax == null) DateMax = cell.DateTimeValue; if (cell.DateTimeValue < DateMin) DateMin = cell.DateTimeValue; if (cell.DateTimeValue > DateMax) DateMax = cell.DateTimeValue; } } } //Total of totals for a count -> we make the sum if (!IsSerie && Element.TotalAggregateFunction == AggregateFunction.Count) Value = IsTotalTotal ? Sum : Cells.Count; if (Cells.Count > 0) { AggregateFunction aggregatFunction = IsSerie ? Element.AggregateFunction : Element.TotalAggregateFunction; if (IsSerie && aggregatFunction == AggregateFunction.Count) Value = Sum; //Count aggregat for a serie -> we make the sum else if (IsTotalTotal && Element.AggregateFunction == AggregateFunction.Count && Element.TotalAggregateFunction == AggregateFunction.Sum) Value = Sum; //Count aggregat for totals -> we use the sum else if (Sum != null && Element.IsNumeric && aggregatFunction == AggregateFunction.Sum) Value = Sum; else if (Min != null && Element.IsNumeric && aggregatFunction == AggregateFunction.Min) Value = Min; else if (Max != null && Element.IsNumeric && aggregatFunction == AggregateFunction.Max) Value = Max; else if (Sum != null && Element.IsNumeric && aggregatFunction == AggregateFunction.Avg) Value = Sum / Cells.Count; else if (DateMin != null && Element.IsDateTime && aggregatFunction == AggregateFunction.Min) Value = DateMin; else if (DateMax != null && Element.IsDateTime && aggregatFunction == AggregateFunction.Max) Value = DateMax; else if (DateSum != null && Element.IsDateTime && aggregatFunction == AggregateFunction.Avg) Value = new DateTime((long)(DateSum.Value * kTickDivider / Cells.Count)); } _done = true; }
public async Task TestReadItem() { using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream)) { var keys = new[] { "9CADB4CA-64C4-4724-84E8-1B4602D54F0C", "aasodfiawea_)(*&^%$#@!", "foobar" }; var values = new[] { "test value", "Hello, world!", string.Join(string.Empty, Enumerable.Range(0, 10000).Select(i => (i % 10))) }; var flags = new uint[] { 12345, 0, 123917070 }; var casUnique = new long?[] { 0L, long.MaxValue, null }; for (int i = 0; i < keys.Length; ++i) { WriteItem(writer, keys[i], values[i], flags[i], casUnique[i]); } writer.Write("END\r\n"); writer.Flush(); stream.Position = 0; var reader = new MemcachedResponseReader(stream, writer.Encoding, TimeSpan.FromSeconds(1)); for (int i = 0; i < keys.Length; ++i) { var item = await reader.ReadItem(); Assert.AreEqual(keys[i], item.Key); using (var sr = new StreamReader(item.Data, writer.Encoding)) { Assert.AreEqual(values[i], sr.ReadToEnd()); } Assert.AreEqual(flags[i], item.Flags); Assert.AreEqual(casUnique[i], item.CasUnique); } Assert.AreEqual(null, await reader.ReadItem()); } }
protected ReaderSubscriptionBase( IPublisher publisher, Guid subscriptionId, CheckpointTag @from, IReaderStrategy readerStrategy, ITimeProvider timeProvider, long? checkpointUnhandledBytesThreshold, int? checkpointProcessedEventsThreshold, bool stopOnEof, int? stopAfterNEvents) { if (publisher == null) throw new ArgumentNullException("publisher"); if (readerStrategy == null) throw new ArgumentNullException("readerStrategy"); if (timeProvider == null) throw new ArgumentNullException("timeProvider"); if (checkpointProcessedEventsThreshold > 0 && stopAfterNEvents > 0) throw new ArgumentException("checkpointProcessedEventsThreshold > 0 && stopAfterNEvents > 0"); _publisher = publisher; _readerStrategy = readerStrategy; _timeProvider = timeProvider; _checkpointUnhandledBytesThreshold = checkpointUnhandledBytesThreshold; _checkpointProcessedEventsThreshold = checkpointProcessedEventsThreshold; _stopOnEof = stopOnEof; _stopAfterNEvents = stopAfterNEvents; _subscriptionId = subscriptionId; _lastPassedOrCheckpointedEventPosition = null; _eventFilter = readerStrategy.EventFilter; _positionTagger = readerStrategy.PositionTagger; _positionTracker = new PositionTracker(_positionTagger); _positionTracker.UpdateByCheckpointTagInitial(@from); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (set != null) return; setID = this.GetQueryParameter<long>("id"); ; }
public void TrainSet(EncogOCR_SketchData[] sketches, bool shouldGenerateGarbage = true) { // Assign a token so that only the latest result will be used long token = TokenGenerator.NextToken(); _currentToken = token; _parent.lblTraining.Content = "training..."; // Kill existing tasks //NOTE: Removing from the list is done in the continue foreach (var runningTask in _currentTasks) { runningTask.Item2.Cancel(); } // Group the sketches by name var groupedSketches = sketches.ToLookup(o => o.Name). Select(o => Tuple.Create(o.Key, o.Select(p => p).ToArray())). ToArray(); if (groupedSketches.Length == 0) { _parent._network = null; _parent.lblTraining.Content = ""; return; } TrainNetwork(groupedSketches, token, shouldGenerateGarbage); }
public SegmentReader(ISegment segment, IWebReader webReader, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices) { if (null == segment) throw new ArgumentNullException(nameof(segment)); if (null == webReader) throw new ArgumentNullException(nameof(webReader)); if (null == webMetadataFactory) throw new ArgumentNullException(nameof(webMetadataFactory)); if (null == retryManager) throw new ArgumentNullException(nameof(retryManager)); if (null == platformServices) throw new ArgumentNullException(nameof(platformServices)); _segment = segment; _webReader = webReader; _webMetadataFactory = webMetadataFactory; _retryManager = retryManager; _platformServices = platformServices; if ((segment.Offset >= 0) && (segment.Length > 0)) { _startOffset = segment.Offset; _endOffset = segment.Offset + segment.Length - 1; } }
private void btnCreate_Click(object sender, EventArgs e) { try { byte[] imageArray = null; try { imageArray = getImageByteArray(); } catch (Exception) { MessageBox.Show(Language.GetLocalizedText(-1, "Error with selected image")); return; } CloudCommunitiesUsersAPI.apiUsers uApi = new CloudCommunitiesUsersAPI.apiUsers(); string logoUrl = uApi.UploadFile(CloudCommunities.GetTokenFromId(), imageArray, txtImage.Text, "image/jpeg", false); apiCommunities api = new apiCommunities(); long newCommunityId = api.Create(CloudCommunities.GetTokenFromId(), txtName.Text, logoUrl, (OrderContentMethods)cmbOrder.SelectedItem, (PublicPermission)cmbAccess.SelectedItem, txtDescription.Text); createdCommunityId = newCommunityId; this.Close(); } catch (SoapException ex) { CloudCommunities.ProcessSoapException(ex); } }
public D2LPrincipal( IAccessToken accessToken ) { m_accessToken = accessToken; m_tenantId = new Lazy<Guid>( GetTenantId ); m_scopes = new Lazy<List<Scope>>( () => m_accessToken.GetScopes().ToList() ); long userId; if ( !m_accessToken.TryGetUserId( out userId ) ) { m_principalType = PrincipalType.Service; return; } m_userId = userId; long actualUserId; if ( !m_accessToken.TryGetActualUserId( out actualUserId ) ) { // Doing this means that code that wants to ignore // impersonation can do so with less branching. m_actualUserId = userId; return; } m_actualUserId = actualUserId; }
public static void Verify() { if (!threadId.HasValue) threadId = Thread.CurrentThread.ManagedThreadId; else if (threadId != Thread.CurrentThread.ManagedThreadId) throw new InvalidOperationException("This code can only be used from the UI thread."); }
private RangeItemHeaderValue(RangeItemHeaderValue source) { Contract.Requires(source != null); this.from = source.from; this.to = source.to; }
public void Go() { int count = 0; byte[] buffer = new byte[4096]; long length = 0; DateTime lastChangeNotification = DateTime.MinValue; if (totalBytes == null && from.CanSeek) { totalBytes = (long)from.Length; } while ((count = from.Read(buffer, 0, 4096)) != 0) { length += count; to.Write(buffer, 0, count); if (DateTime.Now.AddSeconds(-1) > lastChangeNotification) { lastChangeNotification = DateTime.Now; this.OnProgressChange(length, totalBytes); } } this.OnCompleted(length); }
protected override void Add(string key) { string path = Path.Combine(m_StoragePath, GetFileName(key, true)); File.WriteAllText(path, key); m_DictionaryCache.Remove(key); m_Count = null; }
private ContentRangeHeaderValue(ContentRangeHeaderValue source) { this.from = source.from; this.to = source.to; this.length = source.length; this.unit = source.unit; }
public void Refresh() { _isAvailable = null; _totalSpace = null; _freeSpace = null; LastRefresh = Platform.Time; }
public long? this[string key] { get { long? returnValue = null; switch (key) { case "SellerIDX": { returnValue = this.SellerIDX; break; } case "GoodIDX" : { returnValue = this.GoodIDX; break; } default: break; } return returnValue; } set { switch (key) { case "SellerIDX": { this.SellerIDX = value; break; } case "GoodIDX" : { this.GoodIDX = value; break; } default: break; } } }
public ActionResult Edit(string spaceKey, long? threadId, long? ownerId) { BlogThreadEditModel model = null; BlogThread blogThread = null; //日志用户分类下拉列表 IEnumerable<Category> ownerCategories = null; //写日志 if (!threadId.HasValue) { string errorMessage = string.Empty; if (!authorizer.BlogThread_Create(spaceKey, out errorMessage)) { return Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Title = "没有权限", Body = errorMessage, StatusMessageType = StatusMessageType.Hint })); } model = new BlogThreadEditModel() { PrivacyStatus = PrivacyStatus.Public }; if (ownerId.HasValue) { model.OwnerId = ownerId; } //获取所有者分类 if (ownerId.HasValue) { ownerCategories = categoryService.GetOwnerCategories(ownerId.Value, TenantTypeIds.Instance().BlogThread()); } else { ownerCategories = categoryService.GetOwnerCategories(UserContext.CurrentUser.UserId, TenantTypeIds.Instance().BlogThread()); } pageResourceManager.InsertTitlePart("写日志"); } //编辑日志 else { blogThread = blogService.Get(threadId.Value); if (blogThread == null) { return HttpNotFound(); } if (!authorizer.BlogThread_Edit(blogThread)) { return Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Title = "没有权限", Body = "没有权限编辑" + blogThread.Subject + "!", StatusMessageType = StatusMessageType.Hint })); } Dictionary<int, IEnumerable<ContentPrivacySpecifyObject>> privacySpecifyObjects = contentPrivacyService.GetPrivacySpecifyObjects(TenantTypeIds.Instance().BlogThread(), blogThread.ThreadId); if (privacySpecifyObjects.ContainsKey(SpecifyObjectTypeIds.Instance().User())) { IEnumerable<ContentPrivacySpecifyObject> userPrivacySpecifyObjects = privacySpecifyObjects[SpecifyObjectTypeIds.Instance().User()]; ViewData["userPrivacySpecifyObjects"] = string.Join(",", userPrivacySpecifyObjects.Select(n => n.SpecifyObjectId)); } if (privacySpecifyObjects.ContainsKey(SpecifyObjectTypeIds.Instance().UserGroup())) { IEnumerable<ContentPrivacySpecifyObject> userGroupPrivacySpecifyObjects = privacySpecifyObjects[SpecifyObjectTypeIds.Instance().UserGroup()]; ViewData["userGroupPrivacySpecifyObjects"] = string.Join(",", userGroupPrivacySpecifyObjects.Select(n => n.SpecifyObjectId)); } model = blogThread.AsEditModel(); //获取所有者分类 ownerCategories = categoryService.GetOwnerCategories(blogThread.OwnerId, TenantTypeIds.Instance().BlogThread()); IEnumerable<Category> selectedOwnerCategories = blogThread.OwnerCategories; Dictionary<long, Category> ownerCategoryDic = new Dictionary<long, Category>(); if (selectedOwnerCategories != null && selectedOwnerCategories.Count() > 0) { ownerCategoryDic = selectedOwnerCategories.ToDictionary(n => n.CategoryId, n => n); } ViewData["ownerCategoryDic"] = ownerCategoryDic; pageResourceManager.InsertTitlePart("编辑日志"); } ViewData["ownerCategories"] = ownerCategories; //日志站点分类下拉列表(投稿到) if (blogSettings.AllowSetSiteCategory) { IEnumerable<Category> siteCategories = categoryService.GetOwnerCategories(0, TenantTypeIds.Instance().BlogThread()); ViewData["siteCategories"] = new SelectList(siteCategories, "CategoryId", "CategoryName", blogThread == null ? null : blogThread.SiteCategoryId); } return View(model); }
/// <inheritdoc cref="ElectricChargeDensity.FromCoulombsPerCubicMeter(UnitsNet.QuantityValue)" /> public static ElectricChargeDensity?CoulombsPerCubicMeter(this long?value) => ElectricChargeDensity.FromCoulombsPerCubicMeter(value);
public async Task <GroupCommentResponse> GetCommentsForPostAsync(long?postId) { return(await GenericGetAsync <GroupCommentResponse>($"community/posts/{postId}/comments.json")); }
public async Task <GroupCommentResponse> GetCommentsForUserAsync(long?userId) { return(await GenericGetAsync <GroupCommentResponse>($"help_center/users/{userId}/comments.json")); }
public async Task <GroupCommentResponse> GetCommentsForArticleAsync(long?articleId) { return(await GenericGetAsync <GroupCommentResponse>($"help_center/articles/{articleId}/comments.json")); }
/// <summary> /// Initializes a new instance of the <see cref="Card" /> class. /// </summary> /// <param name="Id">The card's unique ID, if any..</param> /// <param name="CardBrand">The card's brand (such as `VISA`). See [CardBrand](#type-cardbrand) for all possible values..</param> /// <param name="Last4">The last 4 digits of the card's number..</param> /// <param name="ExpMonth">The month of the card's expiration date. This value is always between `1` and `12`, inclusive..</param> /// <param name="ExpYear">The four-digit year of the card's expiration date..</param> /// <param name="CardholderName">The cardholder name. This value is present only if this object represents a customer's card on file..</param> /// <param name="BillingAddress">The card's billing address. This value is present only if this object represents a customer's card on file..</param> /// <param name="Fingerprint">The unique string fingerprint for the card. The fingerprint is based on the credit card number and is unique to the merchant. If a card is used at multiple locations for the same merchant, it will have the same fingerprint in each case. Note: Fingerprint may not exist on old transactions..</param> public Card(string Id = default(string), CardBrandEnum?CardBrand = default(CardBrandEnum?), string Last4 = default(string), long?ExpMonth = default(long?), long?ExpYear = default(long?), string CardholderName = default(string), Address BillingAddress = default(Address), string Fingerprint = default(string)) { this.Id = Id; this.CardBrand = CardBrand; this.Last4 = Last4; this.ExpMonth = ExpMonth; this.ExpYear = ExpYear; this.CardholderName = CardholderName; this.BillingAddress = BillingAddress; this.Fingerprint = Fingerprint; }
//public IEnumerable<InLine.Model.Data.ObrazacIP2011A> GetGridData(string filter, string sort, long? start, long? count, bool customsearch = false) //{ // IEnumerable<InLine.Model.Data.ObrazacIP2011A> rezultat; // rezultat = _service.GetGridData(filter, sort, start, count, customsearch); // return rezultat; //} public IEnumerable<InLine.Model.Data.ObrazacIP2011A> GetGridData(string filter, string key, string value, string sort, long? start, long? count, bool customsearch = false) { IEnumerable<InLine.Model.Data.ObrazacIP2011A> rezultat; rezultat = _service.GetGridData(filter, key, value, sort, start, count, customsearch); return rezultat; }
public ActionResult GetGrid(JqGridRequest request, string key, string value, string viewModel, string field, long? id_master) { string fieldMain = String.Empty; long ID_master; bool result = Int64.TryParse(id_master.ToString(), out ID_master); if (String.IsNullOrEmpty(field)) { fieldMain = "ID_ObrazacIP2011A"; } else { fieldMain = field; } viewModel = gridModelNamespace + viewModel; string filterExpression = String.Empty; if (request.Searching) { if (request.SearchingFilter != null) filterExpression = GetFilter(request.SearchingFilter.SearchingName, request.SearchingFilter.SearchingOperator, request.SearchingFilter.SearchingValue); else if (request.SearchingFilters != null) { StringBuilder filterExpressionBuilder = new StringBuilder(); string groupingOperatorToString = request.SearchingFilters.GroupingOperator.ToString(); foreach (JqGridRequestSearchingFilter searchingFilter in request.SearchingFilters.Filters) { filterExpressionBuilder.Append(GetFilter(searchingFilter.SearchingName, searchingFilter.SearchingOperator, searchingFilter.SearchingValue)); filterExpressionBuilder.Append(String.Format(KeyWord.FormaterRazno.StringFormat.Prvi, groupingOperatorToString)); } if (filterExpressionBuilder.Length > 0) filterExpressionBuilder.Remove(filterExpressionBuilder.Length - groupingOperatorToString.Length - 2, groupingOperatorToString.Length + 2); filterExpression = filterExpressionBuilder.ToString(); } } string sortingName = request.SortingName; long totalRecordsCount = GetCount(filterExpression, key, value); JqGridResponse response = new JqGridResponse() { TotalPagesCount = (int)Math.Ceiling((float)totalRecordsCount / (float)request.RecordsCount), PageIndex = request.PageIndex, TotalRecordsCount = totalRecordsCount, }; response.Records.AddRange ( from item in GetGridData(filterExpression, key, value, String.Format(KeyWord.FormaterRazno.StringFormat.PrviDrugi, sortingName, request.SortingOrder), request.PageIndex * request.RecordsCount, (request.PagesCount.HasValue ? request.PagesCount.Value : 1) * request.RecordsCount) select new JqGridRecord(Convert.ToString(item.GetType().GetProperty(fieldMain).GetValue(item, null)), Activator.CreateInstance(Type.GetType(viewModel), new[] { item })) ); return new JqGridJsonResult() { Data = response }; }
private IThreadSafeTimeEntry runningTimeEntry(IThreadSafeTimeEntry timeEntry) { timeEntry = timeEntry != null && timeEntry.IsRunning() ? timeEntry : null; currentlyRunningTimeEntryId = timeEntry?.Id; return(timeEntry); }
/// <summary> /// Single put file and get file. /// </summary> /// <param name="fileSize">The file size.</param> /// <param name="bufferSize">The output buffer size.</param> /// <param name="bufferOffset">The output buffer offset.</param> /// <param name="fileOffset">The file offset.</param> /// <param name="length">Length of the data range to download.</param> /// <param name="isOverload">True when the overloaded method for DownloadRangeToByteArrayAsync is called. False when the basic method is called.</param> private async Task DoDownloadRangeToByteArrayAsyncTest(CloudFile file, int fileSize, int bufferSize, int bufferOffset, long?fileOffset, long?length, bool isOverload) { int downloadLength; byte[] buffer = GetRandomBuffer(fileSize); byte[] resultBuffer = new byte[bufferSize]; byte[] resultBuffer2 = new byte[bufferSize]; using (MemoryStream originalFile = new MemoryStream(buffer)) { if (!isOverload) { await file.UploadFromStreamAsync(originalFile); downloadLength = await file.DownloadRangeToByteArrayAsync(resultBuffer, bufferOffset, fileOffset, length); } else { await file.UploadFromStreamAsync(originalFile); OperationContext context = new OperationContext(); downloadLength = await file.DownloadRangeToByteArrayAsync(resultBuffer, bufferOffset, fileOffset, length, null, null, context); } int downloadSize = Math.Min(fileSize - (int)(fileOffset.HasValue ? fileOffset.Value : 0), bufferSize - bufferOffset); if (length.HasValue && (length.Value < downloadSize)) { downloadSize = (int)length.Value; } Assert.AreEqual(downloadSize, downloadLength); for (int i = 0; i < bufferOffset; i++) { Assert.AreEqual(0, resultBuffer[i]); } for (int j = 0; j < downloadLength; j++) { Assert.AreEqual(buffer[(fileOffset.HasValue ? fileOffset.Value : 0) + j], resultBuffer[bufferOffset + j]); } for (int k = bufferOffset + downloadLength; k < bufferSize; k++) { Assert.AreEqual(0, resultBuffer[k]); } } }
public IEnumerable <Model.Data.View.UgovorStanOtkupNalogDetalj> GetGridDataEF(string filter, string sort, long?start, long?count) { if (!String.IsNullOrEmpty(filter)) { return(_context.VIEW_UgovorStanOtkupNalogDetalj .Where(filter) .OrderBy(sort) .Skip((int)start) .Take((int)count)); } else { return(_context.VIEW_UgovorStanOtkupNalogDetalj .OrderBy(sort) .Skip((int)start) .Take((int)count)); } }
private Stream OpenReadStream(Cloud cloud, long?start, long?end) { Stream stream = cloud.GetFileDownloadStream(_fileInfo, start, end).Result; return(stream); }
public ActionResult EditDef_Nationality(long?ID) { ViewBag.Def_NationalityViewBag = JsonConvert.SerializeObject(db.Def_Nationality.Where(a => a.ID == ID).Select(g => new { ID = g.ID, Name = g.Name }).FirstOrDefault()); return(View()); }
public IEnumerable <Model.Data.View.UgovorStanOtkupNalogDetalj> GetGridData(string filter, string key, string value, string sort, long?start, long?count, bool customserach = false) { string query = String.Empty; string entity = "ots" + "." + "VIEW_UgovorStanOtkupNalogDetalj"; string model = "InLine.Model.Data.View.UgovorStanOtkupNalogDetalj"; if (!String.IsNullOrEmpty(filter) && String.IsNullOrEmpty(key) && String.IsNullOrEmpty(value)) { if (customserach == false) { filter = Repository.Data.Helper.QueryBulider.CreateWhere(model, filter); } } else if (String.IsNullOrEmpty(filter) && !String.IsNullOrEmpty(key) && !String.IsNullOrEmpty(value)) { filter = Repository.Data.Helper.QueryBulider.CreateWhereKeyValue(key, value); } else if (!String.IsNullOrEmpty(filter) && !String.IsNullOrEmpty(key) && !String.IsNullOrEmpty(value)) { string filterF = Repository.Data.Helper.QueryBulider.CreateWhere(model, filter); string filterKV = Repository.Data.Helper.QueryBulider.CreateWhereKeyValue(key, value); filter = filterF + " AND " + filterKV; } query = Repository.Data.Helper.QueryBulider.CreateQuerySelect(entity, filter, sort, start, count); return(_context.Database.SqlQuery <Model.Data.View.UgovorStanOtkupNalogDetalj>(query)); }
/// <summary> /// Constructs a web request to set a page blob's sequence number. /// </summary> /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param> /// <param name="timeout">An integer specifying the server timeout interval.</param> /// <param name="sequenceNumberAction">A value of type <see cref="SequenceNumberAction"/>, indicating the operation to perform on the sequence number.</param> /// <param name="sequenceNumber">The sequence number. Set this parameter to <c>null</c> if this operation is an increment action.</param> /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns> public static HttpWebRequest SetSequenceNumber(Uri uri, int?timeout, SequenceNumberAction sequenceNumberAction, long?sequenceNumber, AccessCondition accessCondition, OperationContext operationContext) { CommonUtility.AssertInBounds("sequenceNumberAction", sequenceNumberAction, SequenceNumberAction.Max, SequenceNumberAction.Increment); if (sequenceNumberAction == SequenceNumberAction.Increment) { if (sequenceNumber.HasValue) { throw new ArgumentException(SR.BlobInvalidSequenceNumber, "sequenceNumber"); } } else { CommonUtility.AssertNotNull("sequenceNumber", sequenceNumber); CommonUtility.AssertInBounds("sequenceNumber", sequenceNumber.Value, 0); } UriQueryBuilder builder = new UriQueryBuilder(); builder.Add(Constants.QueryConstants.Component, "properties"); HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Put, uri, timeout, builder, operationContext); request.ContentLength = 0; request.Headers.Add(Constants.HeaderConstants.SequenceNumberAction, sequenceNumberAction.ToString()); if (sequenceNumberAction != SequenceNumberAction.Increment) { request.Headers.Add(Constants.HeaderConstants.BlobSequenceNumber, sequenceNumber.Value.ToString(CultureInfo.InvariantCulture)); } request.ApplyAccessCondition(accessCondition); return(request); }
public IEnumerable <Model.Data.View.UgovorStanOtkupNalogDetalj> GetData(List <Model.Data.Field.View.UgovorStanOtkupNalogDetalj> fields, List <Model.Data.Filter.View.UgovorStanOtkupNalogDetalj> filter, List <Model.Data.Sort.View.UgovorStanOtkupNalogDetalj> sort, long?start = null, long?count = null) { string query = String.Empty; string entity = "ots" + "." + "VIEW_UgovorStanOtkupNalogDetalj"; query = Repository.Data.Helper.QueryBulider.CreateQuery(entity, fields, filter, sort, start, count); return(_context.Database.SqlQuery <Model.Data.View.UgovorStanOtkupNalogDetalj>(query)); }
/// <summary> /// Retrieve a list of recordings belonging to the account used to make the request /// </summary> /// /// <param name="pathAccountSid"> The account_sid </param> /// <param name="dateCreatedBefore"> Filter by date created </param> /// <param name="dateCreated"> Filter by date created </param> /// <param name="dateCreatedAfter"> Filter by date created </param> /// <param name="callSid"> Filter by call_sid </param> /// <param name="pageSize"> Page size </param> /// <param name="limit"> Record limit </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Recording </returns> public static async System.Threading.Tasks.Task <ResourceSet <RecordingResource> > ReadAsync(string pathAccountSid = null, DateTime?dateCreatedBefore = null, DateTime?dateCreated = null, DateTime?dateCreatedAfter = null, string callSid = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null) { var options = new ReadRecordingOptions { PathAccountSid = pathAccountSid, DateCreatedBefore = dateCreatedBefore, DateCreated = dateCreated, DateCreatedAfter = dateCreatedAfter, CallSid = callSid, PageSize = pageSize, Limit = limit }; return(await ReadAsync(options, client)); }
/// <summary> /// Constructs a web request to return a specified range of the blob's content, together with its properties and metadata. /// </summary> /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param> /// <param name="timeout">An integer specifying the server timeout interval.</param> /// <param name="snapshot">A <see cref="DateTimeOffset"/> specifying the snapshot version, if the blob is a snapshot.</param> /// <param name="offset">The byte offset at which to begin returning content.</param> /// <param name="count">The number of bytes to return, or <c>null</c> to return all bytes through the end of the blob.</param> /// <param name="rangeContentMD5">If set to <c>true</c>, an MD5 header is requested for the specified range.</param> /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns> /// A web request to use to perform the operation. /// </returns> public static HttpWebRequest Get(Uri uri, int?timeout, DateTimeOffset?snapshot, long?offset, long?count, bool rangeContentMD5, AccessCondition accessCondition, OperationContext operationContext) { if (offset.HasValue && offset.Value < 0) { CommonUtility.ArgumentOutOfRange("offset", offset); } if (offset.HasValue && rangeContentMD5) { CommonUtility.AssertNotNull("count", count); CommonUtility.AssertInBounds("count", count.Value, 1, Constants.MaxBlockSize); } HttpWebRequest request = Get(uri, timeout, snapshot, accessCondition, operationContext); AddRange(request, offset, count); if (offset.HasValue && rangeContentMD5) { request.Headers.Add(Constants.HeaderConstants.RangeContentMD5Header, Constants.HeaderConstants.TrueHeader); } return(request); }
internal void OnChangingCompositeRole(long association, IRoleType roleType, long?previousRole, long?newRole) { this.associations.Add(association); if (previousRole != null) { this.roles.Add(previousRole.Value); this.AssociationTypes(previousRole.Value).Add(roleType.AssociationType); } if (newRole != null) { this.roles.Add(newRole.Value); this.AssociationTypes(newRole.Value).Add(roleType.AssociationType); } this.RoleTypes(association).Add(roleType); }
/// <summary> /// Constructs a web request to return the list of valid page ranges for a page blob. /// </summary> /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the blob.</param> /// <param name="timeout">An integer specifying the server timeout interval.</param> /// <param name="snapshot">A <see cref="DateTimeOffset"/> specifying the snapshot timestamp, if the blob is a snapshot.</param> /// <param name="offset">The starting offset of the data range over which to list page ranges, in bytes. Must be a multiple of 512.</param> /// <param name="count">The length of the data range over which to list page ranges, in bytes. Must be a multiple of 512.</param> /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns> public static HttpWebRequest GetPageRanges(Uri uri, int?timeout, DateTimeOffset?snapshot, long?offset, long?count, AccessCondition accessCondition, OperationContext operationContext) { if (offset.HasValue) { CommonUtility.AssertNotNull("count", count); } UriQueryBuilder builder = new UriQueryBuilder(); builder.Add(Constants.QueryConstants.Component, "pagelist"); BlobHttpWebRequestFactory.AddSnapshot(builder, snapshot); HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, operationContext); AddRange(request, offset, count); request.ApplyAccessCondition(accessCondition); return(request); }
/// <summary> /// Initializes a new instance of the <see cref="OrganizationPresenceEntityListing" /> class. /// </summary> /// <param name="Entities">Entities.</param> /// <param name="PageSize">PageSize.</param> /// <param name="PageNumber">PageNumber.</param> /// <param name="Total">Total.</param> /// <param name="SelfUri">SelfUri.</param> /// <param name="NextUri">NextUri.</param> /// <param name="PreviousUri">PreviousUri.</param> /// <param name="LastUri">LastUri.</param> /// <param name="FirstUri">FirstUri.</param> /// <param name="PageCount">PageCount.</param> public OrganizationPresenceEntityListing(List <OrganizationPresence> Entities = null, int?PageSize = null, int?PageNumber = null, long?Total = null, string SelfUri = null, string NextUri = null, string PreviousUri = null, string LastUri = null, string FirstUri = null, int?PageCount = null) { this.Entities = Entities; this.PageSize = PageSize; this.PageNumber = PageNumber; this.Total = Total; this.SelfUri = SelfUri; this.NextUri = NextUri; this.PreviousUri = PreviousUri; this.LastUri = LastUri; this.FirstUri = FirstUri; this.PageCount = PageCount; }
/// <summary> /// Initializes a new instance of the V1beta2DaemonSetStatus class. /// </summary> /// <param name="currentNumberScheduled">The number of nodes that are /// running at least 1 daemon pod and are supposed to run the daemon /// pod. More info: /// https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/</param> /// <param name="desiredNumberScheduled">The total number of nodes that /// should be running the daemon pod (including nodes correctly running /// the daemon pod). More info: /// https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/</param> /// <param name="numberMisscheduled">The number of nodes that are /// running the daemon pod, but are not supposed to run the daemon pod. /// More info: /// https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/</param> /// <param name="numberReady">The number of nodes that should be /// running the daemon pod and have one or more of the daemon pod /// running and ready.</param> /// <param name="collisionCount">Count of hash collisions for the /// DaemonSet. The DaemonSet controller uses this field as a collision /// avoidance mechanism when it needs to create the name for the newest /// ControllerRevision.</param> /// <param name="conditions">Represents the latest available /// observations of a DaemonSet's current state.</param> /// <param name="numberAvailable">The number of nodes that should be /// running the daemon pod and have one or more of the daemon pod /// running and available (ready for at least /// spec.minReadySeconds)</param> /// <param name="numberUnavailable">The number of nodes that should be /// running the daemon pod and have none of the daemon pod running and /// available (ready for at least spec.minReadySeconds)</param> /// <param name="observedGeneration">The most recent generation /// observed by the daemon set controller.</param> /// <param name="updatedNumberScheduled">The total number of nodes that /// are running updated daemon pod</param> public V1beta2DaemonSetStatus(int currentNumberScheduled, int desiredNumberScheduled, int numberMisscheduled, int numberReady, int?collisionCount = default(int?), IList <V1beta2DaemonSetCondition> conditions = default(IList <V1beta2DaemonSetCondition>), int?numberAvailable = default(int?), int?numberUnavailable = default(int?), long?observedGeneration = default(long?), int?updatedNumberScheduled = default(int?)) { CollisionCount = collisionCount; Conditions = conditions; CurrentNumberScheduled = currentNumberScheduled; DesiredNumberScheduled = desiredNumberScheduled; NumberAvailable = numberAvailable; NumberMisscheduled = numberMisscheduled; NumberReady = numberReady; NumberUnavailable = numberUnavailable; ObservedGeneration = observedGeneration; UpdatedNumberScheduled = updatedNumberScheduled; CustomInit(); }
/// <summary> /// Initializes a new instance of the /// MicrosoftDynamicsCRMbookableresource class. /// </summary> public MicrosoftDynamicsCRMbookableresource(string _owneridValue = default(string), string _calendaridValue = default(string), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), string _modifiedonbehalfbyValue = default(string), string _owninguserValue = default(string), string _modifiedbyValue = default(string), int?statuscode = default(int?), int?utcconversiontimezonecode = default(int?), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), string _createdonbehalfbyValue = default(string), int?timezoneruleversionnumber = default(int?), string _accountidValue = default(string), int?resourcetype = default(int?), string _transactioncurrencyidValue = default(string), int?importsequencenumber = default(int?), string _owningbusinessunitValue = default(string), string _useridValue = default(string), string _contactidValue = default(string), string bookableresourceid = default(string), string processid = default(string), string _createdbyValue = default(string), int?timezone = default(int?), int?statecode = default(int?), string stageid = default(string), string traversedpath = default(string), long?versionnumber = default(long?), string _owningteamValue = default(string), string name = default(string), object exchangerate = default(object), MicrosoftDynamicsCRMsystemuser createdbyname = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfbyname = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedbyname = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedonbehalfbyname = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMduplicaterecord> bookableresourceDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMduplicaterecord> bookableresourceDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMannotation> bookableresourceAnnotations = default(IList <MicrosoftDynamicsCRMannotation>), IList <MicrosoftDynamicsCRMasyncoperation> bookableresourceAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMbulkdeletefailure> bookableresourceBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), MicrosoftDynamicsCRMaccount accountId = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMcontact contactId = default(MicrosoftDynamicsCRMcontact), IList <MicrosoftDynamicsCRMbookableresourcebooking> bookableresourceBookableresourcebookingResource = default(IList <MicrosoftDynamicsCRMbookableresourcebooking>), IList <MicrosoftDynamicsCRMbookableresourcecategoryassn> bookableresourceBookableresourcecategoryassnResource = default(IList <MicrosoftDynamicsCRMbookableresourcecategoryassn>), IList <MicrosoftDynamicsCRMbookableresourcecharacteristic> bookableresourceBookableresourcecharacteristicResource = default(IList <MicrosoftDynamicsCRMbookableresourcecharacteristic>), IList <MicrosoftDynamicsCRMbookableresourcegroup> bookableresourceBookableresourcegroupChildResource = default(IList <MicrosoftDynamicsCRMbookableresourcegroup>), IList <MicrosoftDynamicsCRMbookableresourcegroup> bookableresourceBookableresourcegroupParentResource = default(IList <MicrosoftDynamicsCRMbookableresourcegroup>), MicrosoftDynamicsCRMsystemuser userId = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMcalendar calendarid = default(MicrosoftDynamicsCRMcalendar), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyid = default(MicrosoftDynamicsCRMtransactioncurrency), IList <MicrosoftDynamicsCRMsyncerror> bookableResourceSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>)) { this._owneridValue = _owneridValue; this._calendaridValue = _calendaridValue; Overriddencreatedon = overriddencreatedon; Modifiedon = modifiedon; this._modifiedonbehalfbyValue = _modifiedonbehalfbyValue; this._owninguserValue = _owninguserValue; this._modifiedbyValue = _modifiedbyValue; Statuscode = statuscode; Utcconversiontimezonecode = utcconversiontimezonecode; Createdon = createdon; this._createdonbehalfbyValue = _createdonbehalfbyValue; Timezoneruleversionnumber = timezoneruleversionnumber; this._accountidValue = _accountidValue; Resourcetype = resourcetype; this._transactioncurrencyidValue = _transactioncurrencyidValue; Importsequencenumber = importsequencenumber; this._owningbusinessunitValue = _owningbusinessunitValue; this._useridValue = _useridValue; this._contactidValue = _contactidValue; Bookableresourceid = bookableresourceid; Processid = processid; this._createdbyValue = _createdbyValue; Timezone = timezone; Statecode = statecode; Stageid = stageid; Traversedpath = traversedpath; Versionnumber = versionnumber; this._owningteamValue = _owningteamValue; Name = name; Exchangerate = exchangerate; Createdbyname = createdbyname; Createdonbehalfbyname = createdonbehalfbyname; Modifiedbyname = modifiedbyname; Modifiedonbehalfbyname = modifiedonbehalfbyname; Owninguser = owninguser; Owningteam = owningteam; Ownerid = ownerid; Owningbusinessunit = owningbusinessunit; BookableresourceDuplicateMatchingRecord = bookableresourceDuplicateMatchingRecord; BookableresourceDuplicateBaseRecord = bookableresourceDuplicateBaseRecord; BookableresourceAnnotations = bookableresourceAnnotations; BookableresourceAsyncOperations = bookableresourceAsyncOperations; BookableresourceBulkDeleteFailures = bookableresourceBulkDeleteFailures; AccountId = accountId; ContactId = contactId; BookableresourceBookableresourcebookingResource = bookableresourceBookableresourcebookingResource; BookableresourceBookableresourcecategoryassnResource = bookableresourceBookableresourcecategoryassnResource; BookableresourceBookableresourcecharacteristicResource = bookableresourceBookableresourcecharacteristicResource; BookableresourceBookableresourcegroupChildResource = bookableresourceBookableresourcegroupChildResource; BookableresourceBookableresourcegroupParentResource = bookableresourceBookableresourcegroupParentResource; UserId = userId; Calendarid = calendarid; Transactioncurrencyid = transactioncurrencyid; BookableResourceSyncErrors = bookableResourceSyncErrors; CustomInit(); }
public NumericDocValuesUpdate(Term term, string field, long?value) : base(DocValuesFieldUpdatesType.NUMERIC, term, field, value == null ? MISSING : value) { }
/// <summary> /// Erzeugt einen neuen Ausführungskontext auf Basis dieser Liste und einer Action, /// die für jedes Element ausgeführt wird. /// </summary> /// <typeparam name="S">Der Typ von <paramref name="actionState" />.</typeparam> /// <param name="action">Die Logik, die für ein Element ausgeführt werden soll.</param> /// <param name="actionState">Das zusätzliche Objekt für <paramref name="action" />.</param> /// <param name="runAsync">Den Kontext synchron ausführen oder nicht.</param> /// <param name="autoStart">Kontext automatisch starten oder nicht.</param> /// <param name="taskCreationOptions">Die Optionen mit denen der zugrundeliegende Task erstellt werden soll.</param> /// <param name="taskScheduler">Der optionale <see cref="TaskScheduler" /> der für die Ausführung verwendet werden soll.</param> /// <returns>Der erzeugte Kontext-</returns> /// <exception cref="ArgumentNullException"> /// <paramref name="action" /> ist <see langword="null" />. /// </exception> public IItemListExecutionContext <T, S> Execute <S>(Action <IItemExecutionContext <T, S> > action, S actionState, bool runAsync = true, bool autoStart = false, TaskCreationOptions taskCreationOptions = TaskCreationOptions.LongRunning, TaskScheduler taskScheduler = null) { if (action == null) { throw new ArgumentNullException("action"); } // versuchen die Länge der Liste zu ermitteln long?count = null; { var array = this.Items as T[]; if (array != null) { count = array.LongLength; } else { var genericColl = this.Items as ICollection <T>; if (genericColl != null) { count = genericColl.Count; } else { var coll = this.Items as ICollection; if (coll != null) { count = coll.Count; } } } } var result = new SimpleItemListExecutionContext <S>() { Action = action, CanceledCallback = null, CancellationContext = null, CancellationSource = new CancellationTokenSource(), CompletedCallback = null, CreationOptions = taskCreationOptions, Errors = null, FaultedCallback = null, ItemCount = count, Items = this.Items, IsFaulted = false, IsRunning = false, LastResult = null, RunAsyn = runAsync, State = actionState, Scheduler = taskScheduler ?? TaskScheduler.Current, SucceededCallback = null, }; var task = new Task(action: (state) => { var listCtx = (SimpleItemListExecutionContext <S>)state; try { var exceptions = new List <Exception>(); try { long i = -1; AggregateException lastErr = null; foreach (var item in listCtx.Items) { var cancelToken = listCtx.CancellationSource.Token; ++i; var itemCtx = new SimpleIItemExecutionContext <S>() { Cancel = false, CancelToken = cancelToken, Index = i, Item = item, ItemCount = listCtx.ItemCount, LastErrors = lastErr, Result = null, State = listCtx.State, }; if (cancelToken.IsCancellationRequested) { listCtx.CancellationContext = CreateCancellationContext <S>(i, listCtx, item, itemCtx.State, ItemCancellationSource.CancellationToken); break; } try { lastErr = null; listCtx.Action(itemCtx); listCtx.LastResult = itemCtx.Result; if (itemCtx.Cancel) { listCtx.CancellationContext = CreateCancellationContext <S>(i, listCtx, item, itemCtx.State, ItemCancellationSource.ItemContext); break; } } catch (Exception ex) { lastErr = ex as AggregateException; if (lastErr == null) { lastErr = new AggregateException(ex); } exceptions.Add(new ItemExecutionException <T, S>(index: i, item: item, innerException: lastErr, message: ex.Message, state: itemCtx.State)); } } } catch (Exception ex) { listCtx.IsFaulted = true; exceptions.Add(ex); } if (exceptions.Count > 0) { listCtx.Errors = new AggregateException(exceptions); } } finally { listCtx.IsRunning = false; // Callback für "Vorgang beendet" var cb = listCtx.CompletedCallback; if (cb != null) { cb(listCtx); } if (listCtx.IsFaulted) { // Callback für "Vorgang fehlerhaft" var fcb = listCtx.FaultedCallback; if (fcb != null) { fcb(listCtx); } } else if (listCtx.IsCanceled) { // Callback für "Vorgang abgebrochen" var ccb = listCtx.CanceledCallback; if (ccb != null) { ccb(listCtx); } } else { // Callback für "Vorgang erfolgreich" var scb = listCtx.SucceededCallback; if (scb != null) { scb(listCtx); } } } }, state: result , creationOptions: result.CreationOptions); result.Task = task; if (autoStart) { result.Start(); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="WebMessagingMessageEntityList" /> class. /// </summary> /// <param name="Entities">Entities.</param> /// <param name="PageSize">PageSize.</param> /// <param name="PageNumber">PageNumber.</param> /// <param name="Total">Total.</param> /// <param name="PageCount">PageCount.</param> public WebMessagingMessageEntityList(List <WebMessagingMessage> Entities = null, int?PageSize = null, int?PageNumber = null, long?Total = null, int?PageCount = null) { this.Entities = Entities; this.PageSize = PageSize; this.PageNumber = PageNumber; this.Total = Total; this.PageCount = PageCount; }
public GroupCommentResponse GetCommentsForArticle(long?articleId, int?perPage = null, int?page = null) { return(GenericPagedGet <GroupCommentResponse>($"help_center/articles/{articleId}/comments.json", perPage, page)); }
private long CreateLocalBackupOrSnapshot( PeriodicBackupStatus status, string backupFilePath, long?startDocumentEtag, DocumentsOperationContext context, DocumentsTransaction tx, Action <IOperationProgress> onProgress) { long lastEtag; using (status.LocalBackup.UpdateStats(_isFullBackup)) { try { // will rename the file after the backup is finished var tempBackupFilePath = backupFilePath + InProgressExtension; if (_configuration.BackupType == BackupType.Backup || _configuration.BackupType == BackupType.Snapshot && _isFullBackup == false) { var backupType = _configuration.BackupType == BackupType.Snapshot ? "snapshot " : string.Empty; AddInfo($"Started an incremental {backupType}backup", onProgress); // smuggler backup var options = new DatabaseSmugglerOptionsServerSide { AuthorizationStatus = AuthorizationStatus.DatabaseAdmin, }; if (_isFullBackup == false) { options.OperateOnTypes |= DatabaseItemType.Tombstones; } CreateBackup(options, tempBackupFilePath, startDocumentEtag, context, onProgress); lastEtag = _isFullBackup ? DocumentsStorage.ReadLastEtag(tx.InnerTransaction) : _backupResult.GetLastEtag(); } else { // snapshot backup AddInfo("Started a snapshot backup", onProgress); lastEtag = DocumentsStorage.ReadLastEtag(tx.InnerTransaction); var indexesCount = _database.IndexStore.Count; var totalSw = Stopwatch.StartNew(); var sw = Stopwatch.StartNew(); var smugglerResult = _database.FullBackupTo(tempBackupFilePath, info => { AddInfo(info.Message, onProgress); _backupResult.SnapshotBackup.ReadCount += info.FilesCount; if (sw.ElapsedMilliseconds > 0 && info.FilesCount > 0) { AddInfo($"Backed up {_backupResult.SnapshotBackup.ReadCount} " + $"file{(_backupResult.SnapshotBackup.ReadCount > 1 ? "s" : string.Empty)}", onProgress); sw.Restart(); } }, TaskCancelToken.Token); EnsureSnapshotProcessed(context, smugglerResult, indexesCount); AddInfo($"Backed up {_backupResult.SnapshotBackup.ReadCount} files, " + $"took: {totalSw.ElapsedMilliseconds:#,#;;0}ms", onProgress); } IOExtensions.RenameFile(tempBackupFilePath, backupFilePath); } catch (Exception e) { status.LocalBackup.Exception = e.ToString(); throw; } } return(lastEtag); }
public GroupCommentResponse GetCommentsForUser(long?userId) { return(GenericGet <GroupCommentResponse>($"help_center/users/{userId}/comments.json")); }
/// <summary> /// Initializes a new instance of the HostLicensePerTenantDto class. /// </summary> /// <param name="additionalProperties">Unmatched properties from the /// message are deserialized this collection</param> /// <param name="tenantId">The tenant's Id</param> /// <param name="hostLicenseId">The host license's Id</param> public HostLicensePerTenantDto(IDictionary <string, object> additionalProperties = default(IDictionary <string, object>), int?tenantId = default(int?), long?hostLicenseId = default(long?)) { AdditionalProperties = additionalProperties; TenantId = tenantId; HostLicenseId = hostLicenseId; CustomInit(); }