content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
//
// RemoveDir.cs: Removes a directory.
//
// Author:
// Marek Sieradzki (marek.sieradzki@gmail.com)
//
// (C) 2005 Marek Sieradzki
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Build.Framework;
using Xamarin.Android.Tools;
namespace Xamarin.Android.Tasks
{
public class RemoveDirFixed : AndroidTask
{
public override string TaskPrefix => "RDF";
public override bool RunTask ()
{
var temporaryRemovedDirectories = new List<ITaskItem> (Directories.Length);
foreach (var directory in Directories) {
var fullPath = directory.GetMetadata ("FullPath");
if (!Directory.Exists (fullPath)) {
Log.LogDebugMessage ($"Directory did not exist: {fullPath}");
continue;
}
try {
// try to do a normal "fast" delete of the directory.
Directory.Delete (fullPath, true);
temporaryRemovedDirectories.Add (directory);
} catch (UnauthorizedAccessException ex) {
// if that fails we probably have readonly files (or locked files)
// so try to make them writable and try again.
try {
MonoAndroidHelper.SetDirectoryWriteable (fullPath);
Directory.Delete (fullPath, true);
temporaryRemovedDirectories.Add (directory);
} catch (Exception inner) {
Log.LogUnhandledException (TaskPrefix, ex);
Log.LogUnhandledException (TaskPrefix, inner);
}
} catch (DirectoryNotFoundException ex) {
// This could be a file inside the directory over MAX_PATH.
// We can attempt using the \\?\ syntax.
if (OS.IsWindows) {
try {
fullPath = Files.ToLongPath (fullPath);
Log.LogDebugMessage ("Trying long path: " + fullPath);
Directory.Delete (fullPath, true);
temporaryRemovedDirectories.Add (directory);
} catch (Exception inner) {
Log.LogUnhandledException (TaskPrefix, ex);
Log.LogUnhandledException (TaskPrefix, inner);
}
} else {
Log.LogUnhandledException (TaskPrefix, ex);
}
} catch (Exception ex) {
Log.LogUnhandledException (TaskPrefix, ex);
}
}
RemovedDirectories = temporaryRemovedDirectories.ToArray ();
Log.LogDebugTaskItems (" RemovedDirectories: ", RemovedDirectories);
return !Log.HasLoggedErrors;
}
[Required]
public ITaskItem [] Directories { get; set; }
[Output]
public ITaskItem [] RemovedDirectories { get; set; }
}
}
| 34.969697 | 78 | 0.707972 | [
"MIT"
] | AArnott/xamarin-android | src/Xamarin.Android.Build.Tasks/Tasks/RemoveDirFixed.cs | 3,462 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Moq;
using Microsoft.VisualStudio.ProjectSystem.LanguageServices;
namespace Microsoft.VisualStudio.ProjectSystem.VS
{
internal static class IRoslynServicesFactory
{
public static IRoslynServices Implement(ISyntaxFactsService syntaxFactsService)
{
var mock = new Mock<IRoslynServices>();
mock.Setup(h => h.IsValidIdentifier(It.IsAny<string>()))
.Returns<string>(name => syntaxFactsService.IsValidIdentifier(name));
return mock.Object;
}
}
}
| 30.521739 | 161 | 0.695157 | [
"Apache-2.0"
] | 333fred/roslyn-project-system | src/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/Mocks/IRoslynServicesFactory.cs | 704 | C# |
// Copyright 2019 Windup Button
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using WindupButton.GraphQL.Schema;
namespace WindupButton.GraphQL.Data
{
internal sealed class NullValueAccessor : IValueAccessor
{
public IGraphQLType GraphQLType => throw new InvalidOperationException();
public object GetValue(DataReference value)
{
return null;
}
}
}
| 31.233333 | 81 | 0.719317 | [
"Apache-2.0"
] | windupbutton/graphql | src/WindupButton.GraphQL/Data/NullValueAccessor.cs | 939 | C# |
// This file was generated by a tool; you should avoid making direct changes.
// Consider using 'partial classes' to extend these types
// Input: location_refiner.proto
#pragma warning disable 0612, 1591, 3021
namespace apollo.perception.camera.location_refiner
{
[global::ProtoBuf.ProtoContract()]
public partial class LocationRefinerParam : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{
return global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
}
public LocationRefinerParam()
{
OnConstructor();
}
partial void OnConstructor();
[global::ProtoBuf.ProtoMember(1)]
[global::System.ComponentModel.DefaultValue(30f)]
public float min_dist_to_camera
{
get { return __pbn__min_dist_to_camera ?? 30f; }
set { __pbn__min_dist_to_camera = value; }
}
public bool ShouldSerializemin_dist_to_camera()
{
return __pbn__min_dist_to_camera != null;
}
public void Resetmin_dist_to_camera()
{
__pbn__min_dist_to_camera = null;
}
private float? __pbn__min_dist_to_camera;
[global::ProtoBuf.ProtoMember(2)]
[global::System.ComponentModel.DefaultValue(0.5f)]
public float roi_h2bottom_scale
{
get { return __pbn__roi_h2bottom_scale ?? 0.5f; }
set { __pbn__roi_h2bottom_scale = value; }
}
public bool ShouldSerializeroi_h2bottom_scale()
{
return __pbn__roi_h2bottom_scale != null;
}
public void Resetroi_h2bottom_scale()
{
__pbn__roi_h2bottom_scale = null;
}
private float? __pbn__roi_h2bottom_scale;
}
}
#pragma warning restore 0612, 1591, 3021
| 31.873016 | 109 | 0.649402 | [
"Apache-2.0",
"BSD-3-Clause"
] | 0x8BADFOOD/simulator | Assets/Scripts/Bridge/Cyber/Protobuf/perception/camera/lib/obstacle/postprocessor/location_refiner/location_refiner.cs | 2,008 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace BWMS.Controllers
{
public class HomeController : Controller
{
[HttpGet]
public IActionResult Index()
{
return View();
}
[HttpGet]
public IActionResult About()
{
return View();
}
[HttpGet]
public IActionResult Error()
{
return View();
}
}
}
| 17.566667 | 44 | 0.548387 | [
"Apache-2.0"
] | TropinAlexey/lifecycle | src/WebApp/Controllers/HomeController.cs | 529 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using puck.core.Abstract;
using System.ComponentModel.DataAnnotations;
using puck.core.Attributes;
using Microsoft.AspNetCore.Mvc;
using puck.core.Abstract.EditorSettings;
namespace puck.core.Models.EditorSettings
{
public enum PuckPickerSelectionType { node, variant, both };
[Display(Name = "Puck Picker Editor Settings")]
public class PuckPickerEditorSettings:I_Puck_Editor_Settings, I_Puck_Picker_Settings
{
public PuckPickerEditorSettings() {
if (MaxPick == 0) MaxPick = 1;
}
[Display(Name ="Max Pick")]
public int MaxPick { get; set; }
//[Display(Name ="Selection Type")]
//[UIHint("PuckPickerSelectionType")]
//public string SelectionType { get; set; }
[Display(Name ="Allow Unpublished")]
public bool AllowUnpublished { get; set; }
//public bool AllowDuplicates { get; set; }
[UIHint("PuckPicker")]
[Display(Name="Start Path")]
[Attributes.PuckPickerEditorSettings(MaxPick =1)]
public List<PuckPicker> StartPath { get; set; }
[HiddenInput(DisplayValue =false)]
[Display(Name = "Start Path Id")]
public string StartPathId { get; set; }
}
}
| 32.463415 | 88 | 0.652893 | [
"MIT"
] | AmilkarDev/puck-core | core/Models/EditorSettings/PuckPickerEditorSettings.cs | 1,333 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the mediaconnect-2018-11-14.normal.json service model.
*/
using System;
using Amazon.Runtime;
using Amazon.Util.Internal;
namespace Amazon.MediaConnect
{
/// <summary>
/// Configuration for accessing Amazon MediaConnect service
/// </summary>
public partial class AmazonMediaConnectConfig : ClientConfig
{
private static readonly string UserAgentString =
InternalSDKUtils.BuildUserAgentString("3.7.3.52");
private string _userAgent = UserAgentString;
/// <summary>
/// Default constructor
/// </summary>
public AmazonMediaConnectConfig()
{
this.AuthenticationServiceName = "mediaconnect";
}
/// <summary>
/// The constant used to lookup in the region hash the endpoint.
/// </summary>
public override string RegionEndpointServiceName
{
get
{
return "mediaconnect";
}
}
/// <summary>
/// Gets the ServiceVersion property.
/// </summary>
public override string ServiceVersion
{
get
{
return "2018-11-14";
}
}
/// <summary>
/// Gets the value of UserAgent property.
/// </summary>
public override string UserAgent
{
get
{
return _userAgent;
}
}
}
} | 26.325 | 110 | 0.591168 | [
"Apache-2.0"
] | bgrainger/aws-sdk-net | sdk/src/Services/MediaConnect/Generated/AmazonMediaConnectConfig.cs | 2,106 | C# |
// CodeContracts
//
// Copyright (c) Microsoft Corporation
//
// All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// File System.Reflection.AssemblyName.cs
// Automatically generated contract file.
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
using System;
// Disable the "this variable is not used" warning as every field would imply it.
#pragma warning disable 0414
// Disable the "this variable is never assigned to".
#pragma warning disable 0067
// Disable the "this event is never assigned to".
#pragma warning disable 0649
// Disable the "this variable is never used".
#pragma warning disable 0169
// Disable the "new keyword not required" warning.
#pragma warning disable 0109
// Disable the "extern without DllImport" warning.
#pragma warning disable 0626
// Disable the "could hide other member" warning, can happen on certain properties.
#pragma warning disable 0108
namespace System.Reflection
{
sealed public partial class AssemblyName : System.Runtime.InteropServices._AssemblyName, ICloneable, System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback
{
#region Methods and constructors
public AssemblyName(string assemblyName)
{
}
public AssemblyName()
{
}
public Object Clone()
{
return default(Object);
}
public static System.Reflection.AssemblyName GetAssemblyName(string assemblyFile)
{
return default(System.Reflection.AssemblyName);
}
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
}
public byte[] GetPublicKey()
{
return default(byte[]);
}
public byte[] GetPublicKeyToken()
{
return default(byte[]);
}
public void OnDeserialization(Object sender)
{
}
public static bool ReferenceMatchesDefinition(System.Reflection.AssemblyName reference, System.Reflection.AssemblyName definition)
{
return default(bool);
}
public void SetPublicKey(byte[] publicKey)
{
}
public void SetPublicKeyToken(byte[] publicKeyToken)
{
}
void System.Runtime.InteropServices._AssemblyName.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
}
void System.Runtime.InteropServices._AssemblyName.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
{
}
void System.Runtime.InteropServices._AssemblyName.GetTypeInfoCount(out uint pcTInfo)
{
pcTInfo = default(uint);
}
void System.Runtime.InteropServices._AssemblyName.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
{
}
public override string ToString()
{
return default(string);
}
#endregion
#region Properties and indexers
public string CodeBase
{
get
{
return default(string);
}
set
{
}
}
public System.Globalization.CultureInfo CultureInfo
{
get
{
return default(System.Globalization.CultureInfo);
}
set
{
}
}
public string EscapedCodeBase
{
get
{
return default(string);
}
}
public AssemblyNameFlags Flags
{
get
{
return default(AssemblyNameFlags);
}
set
{
}
}
public string FullName
{
get
{
return default(string);
}
}
public System.Configuration.Assemblies.AssemblyHashAlgorithm HashAlgorithm
{
get
{
return default(System.Configuration.Assemblies.AssemblyHashAlgorithm);
}
set
{
}
}
public StrongNameKeyPair KeyPair
{
get
{
return default(StrongNameKeyPair);
}
set
{
}
}
public string Name
{
get
{
return default(string);
}
set
{
}
}
public ProcessorArchitecture ProcessorArchitecture
{
get
{
Contract.Ensures(((System.Reflection.ProcessorArchitecture)(0)) <= Contract.Result<System.Reflection.ProcessorArchitecture>());
Contract.Ensures(Contract.Result<System.Reflection.ProcessorArchitecture>() <= ((System.Reflection.ProcessorArchitecture)(4)));
return default(ProcessorArchitecture);
}
set
{
}
}
public Version Version
{
get
{
return default(Version);
}
set
{
}
}
public System.Configuration.Assemblies.AssemblyVersionCompatibility VersionCompatibility
{
get
{
return default(System.Configuration.Assemblies.AssemblyVersionCompatibility);
}
set
{
}
}
#endregion
}
}
| 25.139241 | 463 | 0.674891 | [
"MIT"
] | Acidburn0zzz/CodeContracts | Microsoft.Research/Contracts/MsCorlib/Sources/System.Reflection.AssemblyName.cs | 5,958 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace NoiseBakery.RequestLogger
{
/// <summary>
/// Module handling logging requests and responses.
/// </summary>
public abstract class RequestLoggerModule : IHttpModule
{
/// <summary>
/// Key used to save in HttpContext.Items.
/// </summary>
private const string FILTER_KEY = "RequestLoggerModule.Filter";
/// <summary>
/// Key used to save in HttpContext.Items.
/// </summary>
private const string EXTRA_KEY = "RequestLoggerModule.Extra";
/// <summary>
/// Saved request body.
/// </summary>
private string savedRequest;
/// <summary>
/// Indicates to capture the request body.
/// </summary>
/// <param name="request">Request.</param>
/// <returns>True to capture the request. False otherwise.</returns>
public virtual bool ShouldCaptureRequestBody(HttpRequest request)
{
return false;
}
/// <summary>
/// Indicates to capture the response body.
/// </summary>
/// <param name="request">Request.</param>
/// <returns>True to capture the response. False otherwise.</returns>
public virtual bool ShouldCaptureResponseBody(HttpRequest request)
{
return false;
}
/// <summary>
/// Initializes the class.
/// </summary>
/// <param name="context"></param>
public void Init(HttpApplication context)
{
context.BeginRequest += BeginRequest;
context.EndRequest += EndRequest;
}
/// <summary>
/// Disposes the class.
/// </summary>
public void Dispose()
{
}
/// <summary>
/// Initializes the request by setting a response filter.
/// </summary>
/// <param name="sender">Application.</param>
/// <param name="e">Event.</param>
private void BeginRequest(object sender, EventArgs e)
{
var application = (HttpApplication)sender;
savedRequest = null;
if (ShouldCaptureRequestBody(application.Request))
{
savedRequest = new StreamReader(application.Request.InputStream).ReadToEnd();
application.Request.InputStream.Seek(0, SeekOrigin.Begin);
}
if (ShouldCaptureResponseBody(application.Request))
{
var response = application.Response;
var filter = new OutputFilterStream(response.Filter);
response.Filter = filter;
application.Request.RequestContext.HttpContext.Items[FILTER_KEY] = filter;
}
}
/// <summary>
/// Finalizes the log.
/// </summary>
/// <param name="sender">Application.</param>
/// <param name="e">Event.</param>
private void EndRequest(object sender, EventArgs e)
{
var application = (HttpApplication)sender;
var request = application.Request;
var response = application.Response;
var items = request.RequestContext.HttpContext.Items;
var filter = items[FILTER_KEY] as OutputFilterStream;
var extra = items[EXTRA_KEY] as Dictionary<string, object>;
var logEntry = new LogEntry
{
Request = new Request
{
Method = request.HttpMethod,
RawUrl = request.RawUrl,
ServerProtocol = request.ServerVariables["SERVER_PROTOCOL"],
Headers = request.Headers,
Body = savedRequest,
},
Response = new Response
{
StatusCode = response.StatusCode,
StatusDescription = response.StatusDescription,
Headers = response.Headers,
Body = filter != null ? filter.ReadStream() : null
},
Extra = extra
};
SaveLogEntry(logEntry, request, response);
}
/// <summary>
/// Saves the log somewhere. To a database for instance.
/// Raw request/response is also given in case other information should be saved.
/// </summary>
/// <param name="logEntry">Curated data to save to a database.</param>
/// <param name="request">Raw request.</param>
/// <param name="response">Raw response.</param>
abstract protected void SaveLogEntry(LogEntry logEntry, HttpRequest request, HttpResponse response);
/// <summary>
/// Saves a key/value pair into the HttpContext.Items for future use by the logger.
/// </summary>
/// <param name="key">Key.</param>
/// <param name="value">Value.</param>
public static void SaveItem(string key, object value)
{
Dictionary<string, object> dictionary = null;
dictionary = HttpContext.Current.Items[EXTRA_KEY] as Dictionary<string, object>;
if (dictionary == null)
{
dictionary = new Dictionary<string, object>();
HttpContext.Current.Items[EXTRA_KEY] = dictionary;
}
dictionary[key] = value;
}
}
}
| 34.742138 | 108 | 0.5563 | [
"MIT"
] | jsgoupil/request-logger-module | src/RequestLoggerModule/RequestLoggerModule.cs | 5,526 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Website;
using Website.Controllers;
using DAL.Models;
using Domain;
using Website.ViewModels;
using Domain.Contracts;
namespace Website.Tests.Controllers
{
[TestClass]
public class HomeControllerTest
{
[TestMethod]
public void Index()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Index() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
[TestMethod]
public void About()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.About() as ViewResult;
// Assert
Assert.AreEqual("Your application description page.", result.ViewBag.Message);
}
[TestMethod]
public void Contact()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Contact() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
}
}
| 21.619048 | 90 | 0.580029 | [
"MIT"
] | Shuvayu/DevBox | ENET MVC/EnetMVC/DAL/DAL/Website.Tests/Controllers/HomeControllerTest.cs | 1,364 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace SpeedrunComSharp
{
public class Category : IElementWithID
{
public string ID { get; private set; }
public string Name { get; private set; }
public Uri WebLink { get; private set; }
public CategoryType Type { get; private set; }
public string Rules { get; private set; }
public Players Players { get; private set; }
public bool IsMiscellaneous { get; private set; }
#region Links
internal Lazy<Game> game;
private Lazy<ReadOnlyCollection<Variable>> variables;
private Lazy<Leaderboard> leaderboard;
private Lazy<Record> worldRecord;
public string GameID { get; private set; }
public Game Game { get { return game.Value; } }
public ReadOnlyCollection<Variable> Variables { get { return variables.Value; } }
public IEnumerable<Run> Runs { get; private set; }
public Leaderboard Leaderboard { get { return leaderboard.Value; } }
public Record WorldRecord { get { return worldRecord.Value; }}
#endregion
private Category() { }
public static Category Parse(SpeedrunComClient client, dynamic categoryElement)
{
if (categoryElement is ArrayList)
return null;
var category = new Category();
//Parse Attributes
category.ID = categoryElement.id as string;
category.Name = categoryElement.name as string;
category.WebLink = new Uri(categoryElement.weblink as string);
category.Type = categoryElement.type == "per-game" ? CategoryType.PerGame : CategoryType.PerLevel;
category.Rules = categoryElement.rules as string;
category.Players = Players.Parse(client, categoryElement.players);
category.IsMiscellaneous = categoryElement.miscellaneous;
//Parse Links
var properties = categoryElement as IDictionary<string, dynamic>;
var links = properties["links"] as IEnumerable<dynamic>;
var gameUri = links.First(x => x.rel == "game").uri as string;
category.GameID = gameUri.Substring(gameUri.LastIndexOf('/') + 1);
if (properties.ContainsKey("game"))
{
dynamic gameElement = properties["game"]["data"];
Game game = Game.Parse(client, gameElement);
category.game = new Lazy<Game>(() => game);
}
else
{
category.game = new Lazy<Game>(() => client.Games.GetGame(category.GameID));
}
if (properties.ContainsKey("variables"))
{
var variables = client.ParseCollection(properties["variables"].data, new Func<dynamic, Variable>(x => Variable.Parse(client, x) as Variable));
category.variables = new Lazy<ReadOnlyCollection<Variable>>(() => variables);
}
else
{
category.variables = new Lazy<ReadOnlyCollection<Variable>>(() => client.Categories.GetVariables(category.ID));
}
category.Runs = client.Runs.GetRuns(categoryId: category.ID);
if (category.Type == CategoryType.PerGame)
{
category.leaderboard = new Lazy<Leaderboard>(() =>
{
var leaderboard = client.Leaderboards
.GetLeaderboardForFullGameCategory(category.GameID, category.ID);
leaderboard.game = new Lazy<Game>(() => category.Game);
leaderboard.category = new Lazy<Category>(() => category);
foreach (var record in leaderboard.Records)
{
record.game = leaderboard.game;
record.category = leaderboard.category;
}
return leaderboard;
});
category.worldRecord = new Lazy<Record>(() =>
{
if (category.leaderboard.IsValueCreated)
return category.Leaderboard.Records.FirstOrDefault();
var leaderboard = client.Leaderboards
.GetLeaderboardForFullGameCategory(category.GameID, category.ID, top: 1);
leaderboard.game = new Lazy<Game>(() => category.Game);
leaderboard.category = new Lazy<Category>(() => category);
foreach (var record in leaderboard.Records)
{
record.game = leaderboard.game;
record.category = leaderboard.category;
}
return leaderboard.Records.FirstOrDefault();
});
}
else
{
category.leaderboard = new Lazy<Leaderboard>(() => null);
category.worldRecord = new Lazy<Record>(() => null);
}
return category;
}
public override int GetHashCode()
{
return (ID ?? string.Empty).GetHashCode();
}
public override bool Equals(object obj)
{
var other = obj as Category;
if (other == null)
return false;
return ID == other.ID;
}
public override string ToString()
{
return Name;
}
}
}
| 36.819355 | 158 | 0.539688 | [
"MIT"
] | R3FR4G/SpeedrunComSharp | SpeedrunComSharp/Categories/Category.cs | 5,709 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class SampleSceneController : MonoBehaviour
{
private static readonly string PosePrevTrigger = "Pose_Prev";
private static readonly string PoseNextTrigger = "Pose_Next";
private static readonly string FacePrevTrigger = "Face_Prev";
private static readonly string FaceNextTrigger = "Face_Next";
public Animator animator;
public Text faceLabel;
public Text poseLabel;
public Text sceneLabel;
private int _currentSceneIndex;
private SwipeController _swipeController;
// Use this for initialization
void Awake()
{
if (animator == null)
{
animator = GameObject.FindObjectOfType<Animator>();
}
if (animator == null)
{
return;
}
_swipeController = GetComponentInChildren<SwipeController>(true);
if (_swipeController != null)
{
_swipeController.OnDragEvent -= OnDragEvent;
_swipeController.OnDragEvent += OnDragEvent;
}
}
void Start()
{
if (animator == null)
{
return;
}
_currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
animator.Update(0.01f);
UpdateClipLabel("Pose: ", poseLabel, "BaseLayer");
UpdateClipLabel("Face: ", faceLabel, "FaceLayer");
UpdateSceneLabel();
}
void OnDestroy()
{
if (_swipeController != null)
{
_swipeController.OnDragEvent -= OnDragEvent;
}
}
void OnDragEvent(PointerEventData touchData, Rect rect)
{
animator.transform.Rotate(0, -180 * touchData.delta.x / rect.height, 0);
}
public void ChangeNextScene()
{
_currentSceneIndex = ++_currentSceneIndex >= SceneManager.sceneCountInBuildSettings ? 0 : _currentSceneIndex;
SceneManager.LoadScene(_currentSceneIndex);
}
public void ChangePrevScene()
{
_currentSceneIndex = --_currentSceneIndex < 0 ? SceneManager.sceneCountInBuildSettings - 1 : _currentSceneIndex;
SceneManager.LoadScene(_currentSceneIndex);
}
private void UpdateSceneLabel()
{
var activeScene = SceneManager.GetActiveScene();
var sceneName = activeScene.name;
if (sceneName.Contains("Dreamy") && activeScene.buildIndex >= 0)
{
sceneLabel.text = "Scene: " + SceneManager.GetActiveScene().name;
}
}
public void SetNextPose()
{
if (animator == null)
{
return;
}
animator.SetTrigger(PoseNextTrigger);
animator.Update(0.01f);
UpdateClipLabel("Pose: ", poseLabel, "BaseLayer");
}
public void SetPrevPose()
{
if (animator == null)
{
return;
}
animator.SetTrigger(PosePrevTrigger);
animator.Update(0.01f);
UpdateClipLabel("Pose: ", poseLabel, "BaseLayer");
}
private void UpdateClipLabel(string label, Text text, string animationLayer)
{
if (animator == null)
{
return;
}
try
{
var layer = animator.GetLayerIndex(animationLayer);
var clips = animator.GetNextAnimatorClipInfo(layer);
if (clips.Length == 0)
{
clips = animator.GetCurrentAnimatorClipInfo(layer);
}
text.text = label + (clips.Length > 0 ?clips[0].clip.name.Replace("Dreamy_Facial_", "") : "");
}
catch (System.Exception e)
{
Debug.LogException(e);
text.text = label;
}
}
public void SetNextFace()
{
if (animator == null)
{
return;
}
animator.SetTrigger(FaceNextTrigger);
animator.Update(0.01f);
UpdateClipLabel("Face: ", faceLabel, "FaceLayer");
}
public void SetPrevFace()
{
if (animator == null)
{
return;
}
animator.SetTrigger(FacePrevTrigger);
animator.Update(0.01f);
UpdateClipLabel("Face: ", faceLabel, "FaceLayer");
}
}
| 22.840491 | 115 | 0.680097 | [
"MIT"
] | Ralph-sa/kamakura-shaders | Assets/KamakuraShaders/Examples/Kamakura/Scripts/SampleSceneController.cs | 3,725 | C# |
namespace Craftsman.Builders.Tests.Fakes
{
using Craftsman.Enums;
using Craftsman.Exceptions;
using Craftsman.Helpers;
using Craftsman.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using static Helpers.ConsoleWriter;
public static class FakesBuilder
{
public static void CreateFakes(string solutionDirectory, string solutionName, Entity entity)
{
try
{
// ****this class path will have an invalid FullClassPath. just need the directory
var classPath = ClassPathHelper.TestFakesClassPath(solutionDirectory, $"", entity.Name, solutionName);
if (!Directory.Exists(classPath.ClassDirectory))
Directory.CreateDirectory(classPath.ClassDirectory);
CreateFakerFile(solutionDirectory, entity.Name, entity, solutionName);
CreateFakerFile(solutionDirectory, Utilities.GetDtoName(entity.Name,Dto.Creation), entity, solutionName);
CreateFakerFile(solutionDirectory, Utilities.GetDtoName(entity.Name, Dto.Read), entity, solutionName);
CreateFakerFile(solutionDirectory, Utilities.GetDtoName(entity.Name, Dto.Update), entity, solutionName);
}
catch (FileAlreadyExistsException e)
{
WriteError(e.Message);
throw;
}
catch (Exception e)
{
WriteError($"An unhandled exception occurred when running the API command.\nThe error details are: \n{e.Message}");
throw;
}
}
private static void CreateFakerFile(string solutionDirectory, string objectToFakeClassName, Entity entity, string solutionName)
{
var fakeFilename = $"Fake{objectToFakeClassName}.cs";
var classPath = ClassPathHelper.TestFakesClassPath(solutionDirectory, fakeFilename, entity.Name, solutionName);
if (File.Exists(classPath.FullClassPath))
throw new FileAlreadyExistsException(classPath.FullClassPath);
using (FileStream fs = File.Create(classPath.FullClassPath))
{
var data = GetFakeFileText(classPath.ClassNamespace, objectToFakeClassName, entity);
fs.Write(Encoding.UTF8.GetBytes(data));
GlobalSingleton.AddCreatedFile(classPath.FullClassPath.Replace($"{solutionDirectory}{Path.DirectorySeparatorChar}", ""));
}
}
private static string GetFakeFileText(string classNamespace, string objectToFakeClassName, Entity entity)
{
// this... is super fragile. Should really refactor this
var usingStatement = objectToFakeClassName.Contains("DTO", StringComparison.InvariantCultureIgnoreCase) ? @$" using Application.Dtos.{entity.Name};" : " using Domain.Entities;";
return @$"namespace {classNamespace}
{{
using AutoBogus;
{usingStatement}
// or replace 'AutoFaker' with 'Faker' along with your own rules if you don't want all fields to be auto faked
public class Fake{objectToFakeClassName} : AutoFaker<{objectToFakeClassName}>
{{
public Fake{objectToFakeClassName}()
{{
// if you want default values on any of your properties (e.g. an int between a certain range or a date always in the past), you can add `RuleFor` lines describing those defaults
//RuleFor({entity.Lambda} => {entity.Lambda}.ExampleIntProperty, {entity.Lambda} => {entity.Lambda}.Random.Number(50, 100000));
//RuleFor({entity.Lambda} => {entity.Lambda}.ExampleDateProperty, {entity.Lambda} => {entity.Lambda}.Date.Past());
}}
}}
}}";
}
}
}
| 46.256098 | 195 | 0.6512 | [
"MIT"
] | wi3land/craftsman | Craftsman/Builders/Tests/Fakes/FakesBuilder.cs | 3,795 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JustCalculateIt.Supplementary;
namespace JustCalculateIt.Logic
{
[Serializable()]
public class MainFunction
{
public int numberOfVariables = 0;
public List<Variable> variables = new List<Variable>();
public int dataLength = 0;
public List<List<Double>> experimentalData;
public List<Rule> rules;
public List<int> termsNumbers { get; private set; }
public List<List<MembershipFunction>> termsFunctions { get; private set; }
public Tuple<double, double> findMinMaxFor(int index) {
double min = double.MaxValue;
double max = double.MinValue;
for (int i = 0; i < experimentalData.Count; i++)
{
if (experimentalData[i][index] > max)
{
max = experimentalData[i][index];
}
if (experimentalData[i][index] < min)
{
min = experimentalData[i][index];
}
}
return Tuple.Create<double, double>(min, max);
}
public MainFunction(int dataLength, int numberOfVariables, List<int> termsNumbers, List<List<MembershipFunction>> termsFunctions, List<List<Double>> experimentalData, List<Rule> rules)
{
this.dataLength = dataLength;
this.numberOfVariables = numberOfVariables;
this.termsNumbers = termsNumbers.ConvertAll(x => x);
this.termsFunctions = termsFunctions;
for (int i = 0; i < numberOfVariables; i++)
{
variables.Add(new Variable(termsNumbers[i], termsFunctions[i]));
}
this.experimentalData = experimentalData;
this.rules = rules;
}
public static MainFunction defaultMainFunction()
{
var defaultExperimentsLength = 5;
var defaultNumberOfVariables = 3;
var defaultTermsNumberPerValue = 3;
var termsNumber = new List<int>();
for (var i = 0; i < defaultNumberOfVariables; i++) {
termsNumber.Add(defaultTermsNumberPerValue);
}
List<Rule> rules = new List<Rule>();
List<List<Double>> experimentalData = new List<List<Double>>();
for (var i = 0; i < defaultExperimentsLength; i++)
{
var newDataRecord = new List<Double>();
for (var j = 0; j < defaultNumberOfVariables; j++)
{
newDataRecord.Add(0);
}
experimentalData.Add(newDataRecord);
}
List<List<MembershipFunction>> termsFunctions = new List<List<MembershipFunction>>();
for (var i = 0; i < defaultNumberOfVariables; i++)
{
var terms = new List<MembershipFunction>();
for (var j = 0; j < defaultTermsNumberPerValue; j++)
{
var parameters = new List<double>();
parameters.Add(1);
parameters.Add(1);
var membershipFunction = new MembershipFunction(MembershipFunctionType.bell, parameters);
terms.Add(membershipFunction);
}
termsFunctions.Add(terms);
}
return new MainFunction(defaultExperimentsLength, defaultNumberOfVariables, termsNumber, termsFunctions, experimentalData, rules);
}
public Vector paramsVector()
{
var vector = new List<double>();
for (int i = 0; i < variables.Count - 1; i++)
{
for (int j = 0; j < variables[i].terms.Count; j++)
{
vector.AddRange(variables[i].terms[j].membershipFunction.parameters);
}
}
for (int i = 0; i < rules.Count; i++)
{
vector.Add(rules[i].weightKoefficient);
}
return new Vector(vector.ToArray());
}
public double resolve(List<double> variables)
{
return defazification(yMembershipFunction(variables));
}
public Dictionary<Term, double> yMembershipFunction(List<double> variables)
{
var assosiatedResults = new Dictionary<Term, double>();
for (int i = 0; i < rules.Count; i++)
{
var ruleValue = rules[i].calculateValue(variables);
if (!assosiatedResults.ContainsKey(rules[i].output))
{
assosiatedResults[rules[i].output] = ruleValue;
}
else
{
var currentValue = assosiatedResults[rules[i].output];
var newValue = Math.Min(1, currentValue + ruleValue);
assosiatedResults[rules[i].output] = newValue;
}
}
return assosiatedResults;
}
private double defazification(Dictionary<Term, double> assosiatedResults)
{
double sumValues = 0;
double weightSumValue = 0;
foreach (var key in assosiatedResults.Keys)
{
weightSumValue += assosiatedResults[key] * key.membershipFunction.typicalValue;
sumValues += assosiatedResults[key];
}
return weightSumValue / sumValues;
}
}
}
| 37.743243 | 192 | 0.537415 | [
"MIT"
] | krisanovdev/NeuroFuzzyIdentification | NeuroFuzzyIdentification/NeuroFuzzyIdentification/Logic/Src/Fuzzy/MainFunction.cs | 5,588 | C# |
using DCL.Helpers;
using DCL.Interface;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
public class ChatEntry : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{
public struct Model
{
public enum SubType
{
NONE,
PRIVATE_FROM,
PRIVATE_TO
}
public ChatMessage.Type messageType;
public string bodyText;
public string senderId;
public string senderName;
public string recipientName;
public string otherUserId;
public ulong timestamp;
public SubType subType;
}
[SerializeField] internal float timeToFade = 10f;
[SerializeField] internal float fadeDuration = 5f;
[SerializeField] internal TextMeshProUGUI username;
[SerializeField] internal TextMeshProUGUI body;
[SerializeField] internal Color worldMessageColor = Color.white;
[FormerlySerializedAs("privateMessageColor")]
[SerializeField] internal Color privateToMessageColor = Color.white;
[FormerlySerializedAs("privateMessageColor")]
[SerializeField] internal Color privateFromMessageColor = Color.white;
[SerializeField] internal Color systemColor = Color.white;
[SerializeField] internal Color playerNameColor = Color.yellow;
[SerializeField] internal Color nonPlayerNameColor = Color.white;
[SerializeField] CanvasGroup group;
[SerializeField] internal float timeToHoverPanel = 1f;
[NonSerialized] public string messageLocalDateTime;
bool fadeEnabled = false;
double fadeoutStartTime;
float hoverPanelTimer = 0;
public RectTransform hoverPanelPositionReference;
public RectTransform contextMenuPositionReference;
public Model model { get; private set; }
public event UnityAction<string> OnPress;
public event UnityAction<ChatEntry> OnPressRightButton;
public event UnityAction<ChatEntry> OnTriggerHover;
public event UnityAction OnCancelHover;
public void Populate(Model chatEntryModel)
{
this.model = chatEntryModel;
string userString = GetDefaultSenderString(chatEntryModel.senderName);
if (chatEntryModel.subType == Model.SubType.PRIVATE_FROM)
{
userString = $"<b>From {chatEntryModel.senderName}:</b>";
}
else if (chatEntryModel.subType == Model.SubType.PRIVATE_TO)
{
userString = $"<b>To {chatEntryModel.recipientName}:</b>";
}
switch (chatEntryModel.messageType)
{
case ChatMessage.Type.PUBLIC:
body.color = worldMessageColor;
if (username != null)
username.color = chatEntryModel.senderName == UserProfile.GetOwnUserProfile().userName ? playerNameColor : nonPlayerNameColor;
break;
case ChatMessage.Type.PRIVATE:
body.color = worldMessageColor;
if (username != null)
{
if (model.subType == Model.SubType.PRIVATE_TO)
username.color = privateToMessageColor;
else
username.color = privateFromMessageColor;
}
break;
case ChatMessage.Type.SYSTEM:
body.color = systemColor;
if (username != null)
username.color = systemColor;
break;
}
chatEntryModel.bodyText = RemoveTabs(chatEntryModel.bodyText);
if (username != null && !string.IsNullOrEmpty(userString))
{
if (username != null)
username.text = userString;
body.text = $"{userString} {chatEntryModel.bodyText}";
}
else
{
if (username != null)
username.text = "";
body.text = $"{chatEntryModel.bodyText}";
}
messageLocalDateTime = UnixTimeStampToLocalDateTime(chatEntryModel.timestamp).ToString();
Utils.ForceUpdateLayout(transform as RectTransform);
if (fadeEnabled)
group.alpha = 0;
if (HUDAudioHandler.i != null)
{
// Check whether or not this message is new
if (chatEntryModel.timestamp > HUDAudioHandler.i.chatLastCheckedTimestamp)
{
switch (chatEntryModel.messageType)
{
case ChatMessage.Type.PUBLIC:
// Check whether or not the message was sent by the local player
if (chatEntryModel.senderId == UserProfile.GetOwnUserProfile().userId)
AudioScriptableObjects.chatSend.Play(true);
else
AudioScriptableObjects.chatReceiveGlobal.Play(true);
break;
case ChatMessage.Type.PRIVATE:
switch (chatEntryModel.subType)
{
case Model.SubType.PRIVATE_FROM:
AudioScriptableObjects.chatReceivePrivate.Play(true);
break;
case Model.SubType.PRIVATE_TO:
AudioScriptableObjects.chatSend.Play(true);
break;
default:
break;
}
break;
case ChatMessage.Type.SYSTEM:
AudioScriptableObjects.chatReceiveGlobal.Play(true);
break;
default:
break;
}
}
HUDAudioHandler.i.RefreshChatLastCheckedTimestamp();
}
}
public void OnPointerClick(PointerEventData pointerEventData)
{
if (pointerEventData.button == PointerEventData.InputButton.Left)
{
if (model.messageType != ChatMessage.Type.PRIVATE)
return;
OnPress?.Invoke(model.otherUserId);
}
else if (pointerEventData.button == PointerEventData.InputButton.Right)
{
if ((model.messageType != ChatMessage.Type.PUBLIC && model.messageType != ChatMessage.Type.PRIVATE) ||
model.senderId == UserProfile.GetOwnUserProfile().userId)
return;
OnPressRightButton?.Invoke(this);
}
}
public void OnPointerEnter(PointerEventData pointerEventData) { hoverPanelTimer = timeToHoverPanel; }
public void OnPointerExit(PointerEventData pointerEventData)
{
hoverPanelTimer = 0f;
OnCancelHover?.Invoke();
}
void OnDisable() { OnPointerExit(null); }
public void SetFadeout(bool enabled)
{
if (!enabled)
{
group.alpha = 1;
group.blocksRaycasts = true;
group.interactable = true;
fadeEnabled = false;
return;
}
fadeoutStartTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() / 1000.0;
fadeEnabled = true;
group.blocksRaycasts = false;
group.interactable = false;
}
void Update()
{
Fade();
ProcessHoverPanelTimer();
}
void Fade()
{
if (!fadeEnabled)
return;
//NOTE(Brian): Small offset using normalized Y so we keep the cascade effect
double yOffset = (transform as RectTransform).anchoredPosition.y / (double)Screen.height * 2.0;
double fadeTime = Math.Max(model.timestamp / 1000.0, fadeoutStartTime) + timeToFade - yOffset;
double currentTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() / 1000.0;
if (currentTime > fadeTime)
{
double timeSinceFadeTime = currentTime - fadeTime;
group.alpha = Mathf.Clamp01(1 - (float)(timeSinceFadeTime / fadeDuration));
}
else
{
group.alpha += (1 - group.alpha) * 0.05f;
}
}
void ProcessHoverPanelTimer()
{
if (hoverPanelTimer <= 0f)
return;
hoverPanelTimer -= Time.deltaTime;
if (hoverPanelTimer <= 0f)
{
hoverPanelTimer = 0f;
OnTriggerHover?.Invoke(this);
}
}
string RemoveTabs(string text)
{
if (string.IsNullOrEmpty(text))
return "";
//NOTE(Brian): ContentSizeFitter doesn't fare well with tabs, so i'm replacing these
// with spaces.
return text.Replace("\t", " ");
}
string GetDefaultSenderString(string sender)
{
if (!string.IsNullOrEmpty(sender))
return $"<b>{sender}:</b>";
return "";
}
DateTime UnixTimeStampToLocalDateTime(ulong unixTimeStampMilliseconds)
{
// TODO see if we can simplify with 'DateTimeOffset.FromUnixTimeMilliseconds'
System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
dtDateTime = dtDateTime.AddMilliseconds(unixTimeStampMilliseconds).ToLocalTime();
return dtDateTime;
}
} | 31.9 | 146 | 0.58491 | [
"Apache-2.0"
] | 0xBlockchainx0/unity-renderer | unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/ChatWidgetHUD/ChatEntry.cs | 9,251 | C# |
using System.ComponentModel.DataAnnotations;
using Abp.Authorization.Users;
using Abp.AutoMapper;
using Abp.MultiTenancy;
namespace HQF.Daily.MultiTenancy.Dto
{
[AutoMapTo(typeof(Tenant))]
public class CreateTenantDto
{
[Required]
[StringLength(AbpTenantBase.MaxTenancyNameLength)]
[RegularExpression(Tenant.TenancyNameRegex)]
public string TenancyName { get; set; }
[Required]
[StringLength(Tenant.MaxNameLength)]
public string Name { get; set; }
[Required]
[StringLength(AbpUserBase.MaxEmailAddressLength)]
public string AdminEmailAddress { get; set; }
[MaxLength(AbpTenantBase.MaxConnectionStringLength)]
public string ConnectionString { get; set; }
public bool IsActive { get; set; }
}
} | 28.172414 | 60 | 0.681763 | [
"MIT"
] | huoxudong125/HQF.ABP.Daily | src/HQF.Daily.Application/MultiTenancy/Dto/CreateTenantDto.cs | 819 | C# |
//
// EnumMemberAttribute.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Serialization
{
[AttributeUsage (AttributeTargets.Field,
Inherited = false, AllowMultiple = false)]
public sealed class EnumMemberAttribute : Attribute
{
string value;
public EnumMemberAttribute ()
{
}
public string Value {
get { return value; }
set { this.value = value; }
}
}
}
| 32.770833 | 73 | 0.739987 | [
"Apache-2.0"
] | BitExodus/test01 | mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/EnumMemberAttribute.cs | 1,573 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace ATT_Shape_Hackathon.web
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
| 24.625 | 99 | 0.593909 | [
"MIT"
] | dmdinh22/ATT_Shape | ATT_Shape_Hackathon/ATT_Shape_Hackathon.web/App_Start/RouteConfig.cs | 593 | C# |
using System;
using Endscript.Core;
using Endscript.Enums;
using Endscript.Profiles;
using Endscript.Exceptions;
using Endscript.Interfaces;
using Nikki.Support.Shared.Class;
namespace Endscript.Commands
{
/// <summary>
/// Command of type 'copy_incareer [filename] [manager] [gcareer] [root] [from] [to]'.
/// </summary>
public class CopyInCareerCommand : BaseCommand, ISingleParsable
{
private string _filename;
private string _manager;
private string _gcareer;
private string _root;
private string _from;
private string _to;
public override eCommandType Type => eCommandType.copy_incareer;
public override void Prepare(string[] splits)
{
if (splits.Length != 7) throw new InvalidArgsNumberException(splits.Length, 7);
this._filename = splits[1].ToUpperInvariant();
this._manager = splits[2];
this._gcareer = splits[3];
this._root = splits[4];
this._from = splits[5];
this._to = splits[6];
}
public override void Execute(CollectionMap map)
{
var collection = map.GetCollection(this._filename, this._manager, this._gcareer);
if (collection is GCareer gcareer)
{
gcareer.CloneCollection(this._to, this._from, this._root);
}
else
{
throw new Exception($"Object {this._gcareer} is not a GCareer");
}
}
public void SingleExecution(BaseProfile profile)
{
var collection = this.GetManualCollection(this._filename, this._manager, this._gcareer, profile);
if (collection is GCareer gcareer)
{
gcareer.CloneCollection(this._to, this._from, this._root);
}
else
{
throw new Exception($"Object {this._gcareer} is not a GCareer");
}
}
}
}
| 21.881579 | 100 | 0.705953 | [
"MIT"
] | SpeedReflect/Endscript | Endscript/Commands/CopyInCareerCommand.cs | 1,665 | C# |
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Ordering.Application.Features.Orders.Commands.CheckoutOrder;
using Ordering.Application.Features.Orders.Commands.DeleteOrder;
using Ordering.Application.Features.Orders.Commands.UpdateOrder;
using Ordering.Application.Features.Orders.Queries.GetOrdersList;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
namespace Ordering.API.Controllers
{
[ApiController]
[Route("api/v1/[controller]")]
public class OrderController : ControllerBase
{
private readonly IMediator _mediator;
public OrderController(IMediator mediator)
{
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
}
[HttpGet("{userName}", Name = "GetOrder")]
[ProducesResponseType(typeof(IEnumerable<OrdersDTO>), (int)HttpStatusCode.OK)]
public async Task<ActionResult<IEnumerable<OrdersDTO>>> GetOrdersByUserName(string userName)
{
var query = new GetOrdersListQuery(userName);
var orders = await _mediator.Send(query);
return Ok(orders);
}
// testing purpose
[HttpPost(Name = "CheckoutOrder")]
[ProducesResponseType((int)HttpStatusCode.OK)]
public async Task<ActionResult<int>> CheckoutOrder([FromBody] CheckoutOrderCommand command)
{
var result = await _mediator.Send(command);
return Ok(result);
}
[HttpPut(Name = "UpdateOrder")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType]
public async Task<ActionResult> UpdateOrder([FromBody] UpdateOrderCommand command)
{
await _mediator.Send(command);
return NoContent();
}
[HttpDelete("{id}", Name = "DeleteOrder")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType]
public async Task<ActionResult> DeleteOrder(int id)
{
var command = new DeleteOrderCommand() { Id = id };
await _mediator.Send(command);
return NoContent();
}
}
} | 36.323077 | 100 | 0.676408 | [
"MIT"
] | zakeerms/ShopAspNetMicroservices | src/Services/Ordering/Ordering.API/Controllers/OrderController.cs | 2,363 | C# |
using Kros.CqrsTemplate.Domain;
using Kros.Utils;
using Mapster;
using MediatR;
using System.Threading;
using System.Threading.Tasks;
namespace Kros.CqrsTemplate.Application.Commands
{
/// <summary>
/// Update RRREntityNameRRR_ Command Handler.
/// </summary>
public class UpdateRRREntityNameRRR_CommandHandler : IRequestHandler<UpdateRRREntityNameRRR_Command>
{
private readonly IRRREntityNameRRR_Repository _repository;
/// <summary>
/// Ctor.
/// </summary>
/// <param name="repository">RRREntityNameRRR_ repository.</param>
public UpdateRRREntityNameRRR_CommandHandler (IRRREntityNameRRR_Repository repository)
{
_repository = Check.NotNull(repository, nameof(repository));
}
/// <inheritdoc />
public async Task<Unit> Handle(UpdateRRREntityNameRRR_Command request, CancellationToken cancellationToken)
{
var item = request.Adapt<RRREntityNameRRR_>();
await _repository.UpdateRRREntityNameRRR_Async(item);
return Unit.Value;
}
}
}
| 30.777778 | 115 | 0.68231 | [
"MIT"
] | Kros-sk/Kros.Templates | Kros.ProjectTemplates/src/Kros.CqrsTemplate/content/Application/Commands/UpdateRRREntityNameRRR_/UpdateRRREntityNameRRR_CommandHandler.cs | 1,110 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the config-2014-11-12.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.ConfigService.Model
{
/// <summary>
/// List of each of the failed delete remediation exceptions with specific reasons.
/// </summary>
public partial class FailedDeleteRemediationExceptionsBatch
{
private List<RemediationExceptionResourceKey> _failedItems = new List<RemediationExceptionResourceKey>();
private string _failureMessage;
/// <summary>
/// Gets and sets the property FailedItems.
/// <para>
/// Returns remediation exception resource key object of the failed items.
/// </para>
/// </summary>
[AWSProperty(Min=1, Max=100)]
public List<RemediationExceptionResourceKey> FailedItems
{
get { return this._failedItems; }
set { this._failedItems = value; }
}
// Check to see if FailedItems property is set
internal bool IsSetFailedItems()
{
return this._failedItems != null && this._failedItems.Count > 0;
}
/// <summary>
/// Gets and sets the property FailureMessage.
/// <para>
/// Returns a failure message for delete remediation exception. For example, AWS Config
/// creates an exception due to an internal error.
/// </para>
/// </summary>
public string FailureMessage
{
get { return this._failureMessage; }
set { this._failureMessage = value; }
}
// Check to see if FailureMessage property is set
internal bool IsSetFailureMessage()
{
return this._failureMessage != null;
}
}
} | 33.448718 | 114 | 0.628593 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/ConfigService/Generated/Model/FailedDeleteRemediationExceptionsBatch.cs | 2,609 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.ML.CommandLine
{
[BestFriend]
internal static class SpecialPurpose
{
/// <summary>
/// This is used to specify a column mapping of a data transform.
/// </summary>
public const string ColumnSelector = "ColumnSelector";
/// <summary>
/// This is meant to be a large text (like a c# code block, for example).
/// </summary>
public const string MultilineText = "MultilineText";
/// <summary>
/// This is used to specify a column mapping of a data transform.
/// </summary>
public const string ColumnName = "ColumnName";
}
}
| 33.038462 | 81 | 0.634459 | [
"MIT"
] | 1Crazymoney/machinelearning | src/Microsoft.ML.Core/CommandLine/SpecialPurpose.cs | 859 | C# |
using System.Text.Json.Serialization;
namespace Nightfall.Net.Models.Requests
{
public class Proximity
{
[JsonPropertyName("windowBefore")]
public int WindowBefore { get; set; }
[JsonPropertyName("windowAfter")]
public int WindowAfter { get; set; }
public Proximity()
{
}
public Proximity(int windowBefore = 0, int windowAfter = 0)
{
WindowBefore = windowBefore;
WindowAfter = windowAfter;
}
}
} | 22.434783 | 67 | 0.585271 | [
"Apache-2.0"
] | gkyrli/Nightfall.Net | Nightfall.Net/Nightfall.Net/Models/Requests/Proximity.cs | 518 | C# |
namespace QuizEMI.Web.Infrastructure.Filters
{
using Hangfire.Dashboard;
using QuizEMI.Common;
public class HangfireAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
var httpContext = context.GetHttpContext();
return httpContext.User.Identity.IsAuthenticated
&& httpContext.User.IsInRole(GlobalConstants.AdministratorRoleName);
}
}
}
| 29.625 | 84 | 0.689873 | [
"MIT"
] | BENALIsalahEDDINE/QuizEMI | Web/QuizEMI.Web.Infrastructure/Filters/HangfireAuthorizationFilter.cs | 476 | C# |
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
namespace SignService.Utils
{
/// <summary>
/// The authentication callback delegate which is to be implemented by the client code
/// </summary>
/// <param name="authority"> Identifier of the authority, a URL. </param>
/// <param name="resource"> Identifier of the target resource that is the recipient of the requested token, a URL. </param>
/// <param name="scope"> The scope of the authentication request. </param>
/// <returns> access token </returns>
public delegate Task<string> AutoRestAuthenticationCallback(string authority, string resource, string scope);
/// <summary>
/// The credential class that implements <see cref="ServiceClientCredentials"/>
/// </summary>
public class AutoRestCredential<T> : ServiceClientCredentials where T : ServiceClient<T>
{
ServiceClient<T> client;
/// <summary>
/// The authentication callback
/// </summary>
public event AutoRestAuthenticationCallback OnAuthenticate = null;
/// <summary>
/// Bearer token
/// </summary>
public string Token { get; set; }
/// <summary>
/// Constructor.
/// </summary>
/// <param name="authenticationCallback"> the authentication callback. </param>
public AutoRestCredential(AutoRestAuthenticationCallback authenticationCallback)
{
OnAuthenticate = authenticationCallback;
}
/// <summary>
/// Clones the current AutoRestCredential object.
/// </summary>
/// <returns>A new AutoRestCredential instance using the same authentication callback as the current instance.</returns>
internal AutoRestCredential<T> Clone()
{
return new AutoRestCredential<T>(OnAuthenticate);
}
async Task<string> PreAuthenticate(Uri url)
{
if (OnAuthenticate != null)
{
var challenge = HttpBearerChallengeCache.GetInstance().GetChallengeForURL(url);
if (challenge != null)
{
return await OnAuthenticate(challenge.AuthorizationServer, challenge.Resource, challenge.Scope).ConfigureAwait(false);
}
else
{
return await OnAuthenticate(null, null, null).ConfigureAwait(false);
}
}
return null;
}
protected async Task<string> PostAuthenticate(HttpResponseMessage response)
{
// An HTTP 401 Not Authorized error; handle if an authentication callback has been supplied
if (OnAuthenticate != null)
{
// Extract the WWW-Authenticate header and determine if it represents an OAuth2 Bearer challenge
var authenticateHeader = response.Headers.WwwAuthenticate.ElementAt(0).ToString();
if (HttpBearerChallenge.IsBearerChallenge(authenticateHeader))
{
var challenge = new HttpBearerChallenge(response.RequestMessage.RequestUri, authenticateHeader);
if (challenge != null)
{
// Update challenge cache
HttpBearerChallengeCache.GetInstance().SetChallengeForURL(response.RequestMessage.RequestUri, challenge);
// We have an authentication challenge, use it to get a new authorization token
return await OnAuthenticate(challenge.AuthorizationServer, challenge.Resource, challenge.Scope).ConfigureAwait(false);
}
}
}
return null;
}
public override void InitializeServiceClient<TClient>(ServiceClient<TClient> client)
{
base.InitializeServiceClient(client);
var tClient = client as T;
this.client = tClient ?? throw new ArgumentException($"Credential is only for use with the {typeof(T).Name} service client.");
}
public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request == null)
{
throw new ArgumentNullException("request");
}
var accessToken = await PreAuthenticate(request.RequestUri).ConfigureAwait(false);
if (!string.IsNullOrEmpty(accessToken))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
}
else
{
HttpResponseMessage response;
// if this credential is tied to a specific TClient reuse it's HttpClient to send the
// initial unauthed request to get the challange, otherwise create a new HttpClient
#pragma warning disable IDE0067 // Dispose objects before losing scope
var client = this.client?.HttpClient ?? new HttpClient();
#pragma warning restore IDE0067 // Dispose objects before losing scope
using (var r = new HttpRequestMessage(request.Method, request.RequestUri))
{
response = await client.SendAsync(r).ConfigureAwait(false);
}
if (response.StatusCode == HttpStatusCode.Unauthorized)
{
accessToken = await PostAuthenticate(response).ConfigureAwait(false);
if (!string.IsNullOrEmpty(accessToken))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
}
}
}
}
}
}
| 39.4 | 142 | 0.603723 | [
"MIT"
] | AArnott/SignService | src/SignService/Utils/AutoRestCredential.cs | 5,912 | C# |
/*
Copyright (c) 2017, Nokia
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using net.nuagenetworks.bambou;
using net.nuagenetworks.vspk.v6.fetchers;
namespace net.nuagenetworks.vspk.v6
{
public class ForwardingClass: RestObject {
private const long serialVersionUID = 1L;
public enum EForwardingClass {A,B,C,D,E,F,G,H };
[JsonProperty("fecEnabled")]
protected bool _fecEnabled;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("forwardingClass")]
protected EForwardingClass? _forwardingClass;
[JsonProperty("loadBalancing")]
protected bool _loadBalancing;
public ForwardingClass() {
}
[JsonIgnore]
public bool NUFecEnabled {
get {
return _fecEnabled;
}
set {
this._fecEnabled = value;
}
}
[JsonIgnore]
public EForwardingClass? NUForwardingClass {
get {
return _forwardingClass;
}
set {
this._forwardingClass = value;
}
}
[JsonIgnore]
public bool NULoadBalancing {
get {
return _loadBalancing;
}
set {
this._loadBalancing = value;
}
}
public String toString() {
return "ForwardingClass [" + "fecEnabled=" + _fecEnabled + ", forwardingClass=" + _forwardingClass + ", loadBalancing=" + _loadBalancing + ", id=" + NUId + ", parentId=" + NUParentId + ", parentType=" + NUParentType + "]";
}
public static String getResourceName()
{
return "None";
}
public static String getRestName()
{
return "None";
}
}
} | 27.482759 | 229 | 0.695107 | [
"BSD-3-Clause"
] | nuagenetworks/vspk-csharp | vspk/vspk/ForwardingClass.cs | 3,188 | C# |
using System;
using System.Linq;
using System.Collections.Generic;
using Foundation;
using UIKit;
namespace NuGetReleaseTests
{
public class Application
{
// This is the main entry point of the application.
static void Main (string [] args)
{
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "UnitTestAppDelegate");
}
}
}
| 24 | 99 | 0.644841 | [
"Apache-2.0"
] | drungrin/realm-dotnet | Tests/NuGetReleaseTests/NuGetReleaseTests.XamarinIOS/Main.cs | 506 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using FluentValidation;
using FluentValidation.Results;
namespace src.Models
{
public class Application
{
public enum ApplicationModel
{
WEB = 1,
MOB = 2,
DES = 3
}
public int Id { get; set; }
public string Name { get; set; }
public string RealName { get; set; }
public ApplicationModel Model { get; set; }
public string Description { get; set; }
public string Details { get; set; }
public bool Active { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.Now;
public int CreatedBy { get; set; }
public DateTime UpdatedAt { get; set; } = DateTime.Now;
public int UpdatedBy { get; set; }
public IList<ApplicationUser> Users { get; set; } = new List<ApplicationUser>();
public IList<ApplicationFeature> Features { get; set; } = new List<ApplicationFeature>();
public Application()
{
}
public void GenerateName() => Name = RealName.Replace(" ", "_").Trim();
public ValidationResult Validate() => new ApplicationValidator().Validate(this);
}
public class ApplicationValidator : AbstractValidator<Application>
{
public ApplicationValidator()
{
RuleFor(x => x.RealName)
.NotNull()
.MinimumLength(3)
.MaximumLength(250)
.WithSeverity(Severity.Error)
.WithMessage("[REAL_NAME] is mandatory and must between 3 and 250 characteres");
RuleFor(x => x.Model)
.NotNull()
.WithSeverity(Severity.Error)
.WithMessage("[MODEL] is mandatory and must be 1(WEB), 2(MOB), 3(DES)");
RuleFor(x => x.Description)
.NotNull()
.MinimumLength(10)
.MaximumLength(250)
.WithSeverity(Severity.Error)
.WithMessage("[DESCRIPTION] is mandatory and must between 10 and 250 characteres");
RuleFor(x => new { x.Id, x.Users })
.Custom((model, context) => {
if(model.Id == 0 && !model.Users.Any())
context.AddFailure("[USERS] application must have one users");
});
}
}
} | 34.178082 | 100 | 0.530261 | [
"MIT"
] | LexGalante/backend | aspnet5/src/Models/Application.cs | 2,495 | C# |
namespace TraktNet.Modules.Tests.TraktEpisodesModule
{
using FluentAssertions;
using System;
using System.Net;
using System.Threading.Tasks;
using Trakt.NET.Tests.Utility;
using Trakt.NET.Tests.Utility.Traits;
using TraktNet.Exceptions;
using TraktNet.Objects.Get.Users.Lists;
using TraktNet.Requests.Parameters;
using TraktNet.Responses;
using Xunit;
[Category("Modules.Episodes")]
public partial class TraktEpisodesModule_Tests
{
private readonly string GET_EPISODE_LISTS_URI = $"shows/{SHOW_ID}/seasons/{SEASON_NR}/episodes/{EPISODE_NR}/lists";
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists()
{
TraktClient client = TestUtility.GetMockClient(GET_EPISODE_LISTS_URI, EPISODE_LISTS_JSON, 1, 10, 1, LISTS_ITEM_COUNT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}",
EPISODE_LISTS_JSON, 1, 10, 1, LISTS_ITEM_COUNT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR, LIST_TYPE);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_SortOrder_And_Without_Type()
{
TraktClient client = TestUtility.GetMockClient(GET_EPISODE_LISTS_URI,
EPISODE_LISTS_JSON, 1, 10, 1, LISTS_ITEM_COUNT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
null, LIST_SORT_ORDER);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Page()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}?page={PAGE}",
EPISODE_LISTS_JSON, PAGE, 10, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(PAGE);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
null, null, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(PAGE);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Limit()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}?limit={LIMIT}",
EPISODE_LISTS_JSON, 1, LIMIT, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(null, LIMIT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
null, null, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(LIMIT);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Page_And_Limit()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}?page={PAGE}&limit={LIMIT}",
EPISODE_LISTS_JSON, PAGE, LIMIT, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
null, null, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(LIMIT);
response.Page.Should().Be(PAGE);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type_And_SortOrder()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}/{LIST_SORT_ORDER.UriName}",
EPISODE_LISTS_JSON, 1, 10, 1, LISTS_ITEM_COUNT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
LIST_TYPE, LIST_SORT_ORDER);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type_And_Page()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}?page={PAGE}",
EPISODE_LISTS_JSON, PAGE, 10, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(PAGE);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
LIST_TYPE, null, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(PAGE);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type_And_Limit()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}?limit={LIMIT}",
EPISODE_LISTS_JSON, 1, LIMIT, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(null, LIMIT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
LIST_TYPE, null, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(LIMIT);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type_And_Page_And_Limit()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}?page={PAGE}&limit={LIMIT}",
EPISODE_LISTS_JSON, PAGE, LIMIT, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR,
LIST_TYPE, null, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(LIMIT);
response.Page.Should().Be(PAGE);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type_And_SortOrder_And_Page()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}/{LIST_SORT_ORDER.UriName}?page={PAGE}",
EPISODE_LISTS_JSON, PAGE, 10, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(PAGE);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR, LIST_TYPE,
LIST_SORT_ORDER, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(10u);
response.Page.Should().Be(PAGE);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_With_Type_And_SortOrder_And_Limit()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}/{LIST_SORT_ORDER.UriName}?limit={LIMIT}",
EPISODE_LISTS_JSON, 1, LIMIT, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(null, LIMIT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR, LIST_TYPE,
LIST_SORT_ORDER, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(LIMIT);
response.Page.Should().Be(1u);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_Complete()
{
TraktClient client = TestUtility.GetMockClient($"{GET_EPISODE_LISTS_URI}/{LIST_TYPE.UriName}/{LIST_SORT_ORDER.UriName}?page={PAGE}&limit={LIMIT}",
EPISODE_LISTS_JSON, PAGE, LIMIT, 1, LISTS_ITEM_COUNT);
var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);
TraktPagedResponse<ITraktList> response = await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR, LIST_TYPE,
LIST_SORT_ORDER, pagedParameters);
response.Should().NotBeNull();
response.IsSuccess.Should().BeTrue();
response.HasValue.Should().BeTrue();
response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
response.Limit.Should().Be(LIMIT);
response.Page.Should().Be(PAGE);
response.PageCount.Should().HaveValue().And.Be(1);
}
[Theory]
[InlineData(HttpStatusCode.NotFound, typeof(TraktEpisodeNotFoundException))]
[InlineData(HttpStatusCode.Unauthorized, typeof(TraktAuthorizationException))]
[InlineData(HttpStatusCode.BadRequest, typeof(TraktBadRequestException))]
[InlineData(HttpStatusCode.Forbidden, typeof(TraktForbiddenException))]
[InlineData(HttpStatusCode.MethodNotAllowed, typeof(TraktMethodNotFoundException))]
[InlineData(HttpStatusCode.Conflict, typeof(TraktConflictException))]
[InlineData(HttpStatusCode.InternalServerError, typeof(TraktServerException))]
[InlineData(HttpStatusCode.BadGateway, typeof(TraktBadGatewayException))]
[InlineData(HttpStatusCode.PreconditionFailed, typeof(TraktPreconditionFailedException))]
[InlineData(HttpStatusCode.UnprocessableEntity, typeof(TraktValidationException))]
[InlineData(HttpStatusCode.TooManyRequests, typeof(TraktRateLimitException))]
[InlineData(HttpStatusCode.ServiceUnavailable, typeof(TraktServerUnavailableException))]
[InlineData(HttpStatusCode.GatewayTimeout, typeof(TraktServerUnavailableException))]
[InlineData((HttpStatusCode)520, typeof(TraktServerUnavailableException))]
[InlineData((HttpStatusCode)521, typeof(TraktServerUnavailableException))]
[InlineData((HttpStatusCode)522, typeof(TraktServerUnavailableException))]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_Throws_API_Exception(HttpStatusCode statusCode, Type exceptionType)
{
TraktClient client = TestUtility.GetMockClient(GET_EPISODE_LISTS_URI, statusCode);
try
{
await client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, EPISODE_NR);
Assert.False(true);
}
catch (Exception exception)
{
(exception.GetType() == exceptionType).Should().BeTrue();
}
}
[Fact]
public async Task Test_TraktEpisodesModule_GetEpisodeLists_ArgumentExceptions()
{
TraktClient client = TestUtility.GetMockClient(GET_EPISODE_LISTS_URI, EPISODE_LISTS_JSON, 1, 10, 1, LISTS_ITEM_COUNT);
Func<Task<TraktPagedResponse<ITraktList>>> act = () => client.Episodes.GetEpisodeListsAsync(null, SEASON_NR, EPISODE_NR);
await act.Should().ThrowAsync<ArgumentException>();
act = () => client.Episodes.GetEpisodeListsAsync(string.Empty, SEASON_NR, EPISODE_NR);
await act.Should().ThrowAsync<ArgumentException>();
act = () => client.Episodes.GetEpisodeListsAsync("show id", SEASON_NR, EPISODE_NR);
await act.Should().ThrowAsync<ArgumentException>();
act = () => client.Episodes.GetEpisodeListsAsync(SHOW_ID, SEASON_NR, 0);
await act.Should().ThrowAsync<ArgumentOutOfRangeException>();
}
}
}
| 55.024768 | 158 | 0.610083 | [
"MIT"
] | henrikfroehling/Trakt.NET | Source/Tests/Trakt.NET.Modules.Tests/TraktEpisodesModule/TraktEpisodesModule_GetEpisodeLists_Tests.cs | 17,775 | C# |
using System;
using Caliburn.Micro;
namespace CShell.Framework.Results
{
public abstract class OpenResultBase<TTarget> : IOpenResult<TTarget>
{
protected Action<TTarget> SetData;
protected Action<TTarget> _onConfigure;
protected Action<TTarget> _onShutDown;
Action<TTarget> IOpenResult<TTarget>.OnConfigure
{
get { return _onConfigure; }
set { _onConfigure = value; }
}
Action<TTarget> IOpenResult<TTarget>.OnShutDown
{
get { return _onShutDown; }
set { _onShutDown = value; }
}
//void IOpenResult<TTarget>.SetData<TData>(TData data)
//{
// _setData = child =>
// {
// var dataCentric = (IDataCentric<TData>)child;
// dataCentric.LoadData(data);
// };
//}
protected virtual void OnCompleted(Exception exception)
{
if (Completed != null)
Completed(this, new ResultCompletionEventArgs { Error = exception });
}
public abstract void Execute(CoroutineExecutionContext context);
public event EventHandler<ResultCompletionEventArgs> Completed;
}
} | 24.348837 | 73 | 0.692455 | [
"Apache-2.0"
] | elcergey/CShell2 | Src/CShell.Core/Framework/Results/OpenResultBase.cs | 1,049 | C# |
using AryuwatWebApplication.Entity;
using AryuwatWebApplication.Models;
using Newtonsoft.Json;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Remoting.Messaging;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.UI.WebControls;
namespace AryuwatWebApplication.Controllers
{
public class HomeController : Controller
{
private string BaseURL()
{
HttpRequestBase request = HttpContext.Request;
string appUrl = HttpRuntime.AppDomainAppVirtualPath;
if (appUrl != "/") appUrl = "/" + appUrl;
return string.Format("{0}://{1}{2}", request.Url.Scheme, request.Url.Authority, appUrl);
}
public ActionResult Index()
{
return View();
}
private SqlParameter[] ConvertParamToArr(List<SqlParameter> parameters)
{
SqlParameter[] sqls = new SqlParameter[parameters.Count];
for (int i = 0; i < parameters.Count; i++)
{
sqls[i] = parameters[i];
}
return sqls;
}
public class TempPatientData
{
public int ID { get; set; }
public string Patient_Name { get; set; }
public string CN { get; set; }
public string Room { get; set; }
public DateTime? Start { get; set; }
public DateTime? End { get; set; }
public DateTime? Meeting { get; set; }
public string PATH { get; set; }
}
public string TableCustomer ()
{
string query = @"SELECT * from (
select
cus.PrefixCode + cus.Tname + ' ' + cus.TsurName Patient_Name,
cus.ID,
cus.CN,
MR.Room_Name Room,
RD.Start_Date Start,
case
when RD.Start_Date is not null
then DATEADD(DAY,RD.Qty_Date , RD.Start_Date)
else null
end [End],
AD.Alert_Date as Meeting,
cus.Is_Active
FROM [OPD_System].[dbo].[Customers] cus
--(select top 1 ID as MOID from [OPD_System].[dbo].MedicalOrder where CN = cus.CN order by ID desc)
Outer Apply
(
SELECT TOP 1 *
FROM [OPD_System].[dbo].MedicalOrder MO
WHERE MO.CN = cus.CN and Room_Status = 1
ORDER BY MO.ID DESC
) MO
--Left Join [OPD_System].[dbo].MedicalOrder MO on cus.CN = MO.CN
Outer Apply
(
SELECT TOP 1 *
FROM [OPD_System].[dbo].Room_Detail RD
WHERE RD.FK_MO_ID = MO.ID
ORDER BY RD.ID DESC
) RD
--Left Join [OPD_System].[dbo].Room_Detail RD on MO.ID = RD.FK_MO_ID and RD.Is_Active = 1
Left Join [OPD_System].[dbo].Master_Room MR on RD.FK_Room_ID = MR.ID and MR.Is_Active = 1
Outer Apply
(
SELECT TOP 1 *
FROM [OPD_System].[dbo].Alert_Detail AD
WHERE AD.FK_Customer_ID = CUS.ID AND AD.Is_Active = 1 and AD.Alert_Type = 2
ORDER BY AD.Alert_Date DESC
) AD
) a
WHERE Is_Active = 1 ";
return query;
}
[AllowJsonGet]
[HttpGet, ActionName("TableCustomer")]
public async Task<JsonResult> TableCustomer(string searchtxt)
{
try
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and Patient_Name like '%" + searchtxt + "%'";
var resultquery = context.Database.SqlQuery<TempPatientData>(query).ToList();
//var result = (from cus in context.Customers
// join med in context.MedicalOrders.Where(x => x.Room_Status == true) on cus.CN equals med.CN into med2
// from med3 in med2
// join rd in context.Room_Detail.Where(x => x.Is_Active == true) on med3.ID equals rd.FK_MO_ID into rd2
// from rd3 in rd2
// join mr in context.Master_Room.Where(x => x.Is_Active == true) on rd3.FK_Room_ID equals mr.ID into mr2
// from mr3 in mr2
// select new TempPatientData
// {
// Patient_Name = (cus.PrefixCode ?? "") + (cus.Tname ?? "") + " " + (cus.TsurName ?? ""),
// CN = cus.CN ?? "",
// Room = mr3.Room_Name ?? "",
// Start = rd3.Start_Date,
// End = EntityFunctions.AddDays(rd3.Start_Date, (Int32?)(rd3.Qty_Date)),
// //End = rd3.Start_Date != null ? rd3.Start_Date.Value.AddDays(0/*Convert.ToDouble(rd3.Qty_Date)*/) : DateTime.Now,
// //End = Convert.ToDateTime(rd3.Start_Date).AddDays(Convert.ToDouble(rd3 == null ? 0 : rd3.Qty_Date)),
// //Meeting = null
// }).ToList();
return Json(new { ContentEncoding = 200, data = resultquery });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[AllowJsonGet]
[HttpGet, ActionName("GetAttachfile")]
public async Task<JsonResult> GetAttachfile(string customerCN)
{
try
{
using (var context = new OPD_SystemEntities())
{
var result = context.FileOPDs.Where(x => x.CN == customerCN).ToList();
return Json(new { ContentEncoding = 200, data = result });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[AllowJsonGet]
[HttpGet, ActionName("DeleteAttachfile")]
public async Task<JsonResult> DeleteAttachfile(int? AttachId)
{
try
{
if (AttachId > 0)
{
using (var context = new OPD_SystemEntities())
{
var result = context.FileOPDs.Where(x => x.Id == AttachId).FirstOrDefault();
if(result != null)
{
context.FileOPDs.Remove(result);
context.SaveChanges();
return Json(new { ContentEncoding = 200 });
}
return Json(null);
}
}
return Json(null);
}
catch (Exception ex)
{
return Json(null);
}
}
public void ResizeStream(int imageSize, Stream filePath, string outputPath)
{
var image = System.Drawing.Image.FromStream(filePath);
int thumbnailSize = imageSize;
int newWidth, newHeight;
if (image.Width > image.Height)
{
newWidth = thumbnailSize;
newHeight = image.Height * thumbnailSize / image.Width;
}
else
{
newWidth = image.Width * thumbnailSize / image.Height;
newHeight = thumbnailSize;
}
var thumbnailBitmap = new Bitmap(newWidth, newHeight);
var thumbnailGraph = Graphics.FromImage(thumbnailBitmap);
thumbnailGraph.CompositingQuality = CompositingQuality.HighQuality;
thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
var imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
thumbnailGraph.DrawImage(image, imageRectangle);
thumbnailBitmap.Save(outputPath, image.RawFormat);
thumbnailGraph.Dispose();
thumbnailBitmap.Dispose();
image.Dispose();
}
[HttpPost, ActionName("UploadFile")]
public JsonResult UploadFile(string CN,string Detail, HttpPostedFileBase AttachFileData)
{
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
using (var context = new OPD_SystemEntities())
{
if (AttachFileData != null && AttachFileData.ContentLength > 0)
{
int ScaleIMG = Convert.ToInt32(ConfigurationManager.AppSettings["ScaleIMG"]);
var hpf = AttachFileData as HttpPostedFileBase;
var fileName = Path.GetFileName(AttachFileData.FileName);
var newFileName = "OPD_" + CN + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "." + AttachFileData.FileName.Split('.').ElementAt(1);
ResizeStream(ScaleIMG, hpf.InputStream, Path.Combine(Server.MapPath("~/AttachFile_Aryuwat"), newFileName));
//var path = Path.Combine(Server.MapPath("~/AttachFile_Aryuwat"), newFileName);
//AttachFileData.SaveAs(path);
FileOPD fopd = new FileOPD();
fopd.FileName = newFileName;
fopd.Detail = Detail;
fopd.DateScan = DateTime.Now;
fopd.CN = CN;
fopd.ENSave = username;
fopd.DateSave = DateTime.Now;
context.FileOPDs.Add(fopd);
context.SaveChanges();
}
return Json(new { ContentEncoding = 200 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("sendnoti")]
public JsonResult sendnoti()
{
try
{
string msg = "";
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
using (var context = new OPD_SystemEntities())
{
string lineToken = ConfigurationManager.AppSettings["LineToken"];
var datetomorrow = DateTime.Now.AddDays(1);
var TempData = (from AD in context.Alert_Detail.Where(x => x.Is_Active == true && x.Alert_Type == 2 && x.Publish == true && x.Alert_Date == datetomorrow.Date)
join CUS in context.Customers.Where(x => x.Is_Active == true) on AD.FK_Customer_ID equals CUS.ID
select new
{
ID = AD.ID,
PatientName = CUS.PrefixCode + CUS.Tname + " " + CUS.TsurName,
Date = AD.Alert_Date,
Description = AD.Description,
}).ToList();
foreach(var items in TempData)
{
var client = new RestClient("https://notify-api.line.me/api/notify");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer " + Convert.ToString(lineToken).Trim());
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
msg = "\r\n*Meeting*";
msg += "\r\nPatientName : ";
msg += items.PatientName + "\r\nMeeting Date : " + Convert.ToDateTime(items.Date).ToString("dd/MM/yyyy") + "\r\nDescription :\r\n" + items.Description;
request.AddParameter("application/x-www-form-urlencoded", $"message={msg}", ParameterType.RequestBody);
var dispublish = context.Alert_Detail.Where(x => x.ID == items.ID).FirstOrDefault();
if (dispublish != null)
{
dispublish.Publish = false;
dispublish.Update_By = username;
dispublish.Update_Date = DateTime.Now;
context.SaveChanges();
}
var response = client.Execute(request);
if (response.StatusCode != HttpStatusCode.OK)
{
return Json(new { ContentEncoding = 400 });
}
}
return Json(new { ContentEncoding = 200 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("GetPatientChange")]
public JsonResult GetPatientChange(int? tmpCustomerID)
{
try
{
using (var context = new OPD_SystemEntities())
{
if (tmpCustomerID != 0)
{
string query = @"SELECT distinct pt.[Count] as dataCount,
(select top 1 DateChange FROM[OPD_System].[dbo].[PatientChange] where Type = 1 and [Count] = pt.[Count] and FK_Customer_ID = " + tmpCustomerID + @") as oneNextChange,
(select top 1 DateChange FROM[OPD_System].[dbo].[PatientChange] where Type = 2 and [Count] = pt.[Count] and FK_Customer_ID = " + tmpCustomerID + @") as twoNextChange
FROM[OPD_System].[dbo].[PatientChange] pt where FK_Customer_ID = " + tmpCustomerID + @"
order by [Count] desc";
var resultquery = context.Database.SqlQuery<MedicalExpireModel>(query).ToList();
var result = context.PatientChanges.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true).ToList();
if (result.Count > 0)
{
var onelastchange = result.Where(x => x.Type == 1).OrderByDescending(x => x.ID).FirstOrDefault()?.DateChange;
var onenextchange = result.Where(x => x.Type == 1).OrderByDescending(x => x.ID).FirstOrDefault()?.NextDateChange;
var twolastchange = result.Where(x => x.Type == 2).OrderByDescending(x => x.ID).FirstOrDefault()?.DateChange;
var twonextchange = result.Where(x => x.Type == 2).OrderByDescending(x => x.ID).FirstOrDefault()?.NextDateChange;
return Json(new { ContentEncoding = 200, data = resultquery, onelastchange = onelastchange, onenextchange = onenextchange, twolastchange = twolastchange, twonextchange = twonextchange });
}
return Json(new { ContentEncoding = 201, data = result });
}
return Json(new { ContentEncoding = 400 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("GetDataRemark")]
public JsonResult GetDataRemark(int? tmpCustomerID)
{
try
{
using (var context = new OPD_SystemEntities())
{
if (tmpCustomerID != 0)
{
var result = context.Alert_Detail.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && x.Alert_Type == 1).ToList();
return Json(new { ContentEncoding = 200, data = result });
}
return Json(new { ContentEncoding = 400 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("GetDataMeeting")]
public JsonResult GetDataMeeting(int? tmpCustomerID)
{
try
{
using (var context = new OPD_SystemEntities())
{
if (tmpCustomerID != 0)
{
var result = context.Alert_Detail.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && x.Alert_Type == 2).ToList();
return Json(new { ContentEncoding = 200, data = result });
}
return Json(new { ContentEncoding = 400 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("GetPatientData")]
public JsonResult GetPatientData(int? tmpCustomerID,string ToDate,string EndDate)
{
try
{
using (var context = new OPD_SystemEntities())
{
if (tmpCustomerID != 0)
{
//var test = context.PatientDatas.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true).ToList();
var ConToDate = Convert.ToDateTime(ToDate);
var ConEndDate = Convert.ToDateTime(EndDate);
var result = context.PatientDatas.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && (x.Date >= ConToDate && x.Date <= ConEndDate)).ToList();
return Json(new { ContentEncoding = 200, data = result });
}
return Json(new { ContentEncoding = 400 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("UpdateMedical")]
public JsonResult UpdateMedical(int? type, int? tmpCustomerID)
{
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
using (var context = new OPD_SystemEntities())
{
var chkdata = context.PatientChanges.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Type == type && x.Is_Active == true).OrderByDescending(x => x.ID).FirstOrDefault()?.Count;
PatientChange PC = new PatientChange();
PC.DateChange = DateTime.Now;
//PC.NextDateChange = type == 1 ? DateTime.Now.AddMonths(1) : DateTime.Now.AddDays(15);
PC.NextDateChange = DateTime.Now.AddDays(15);
PC.Type = type;
PC.Count = chkdata == null ? 1 : chkdata + 1;
PC.FK_Customer_ID = tmpCustomerID;
PC.Publish = true;
PC.Is_Active = true;
PC.Create_By = username;
PC.Create_Date = DateTime.Now;
context.PatientChanges.Add(PC);
context.SaveChanges();
return Json(new { ContentEncoding = 200 , data = PC });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("AddAlert")]
public JsonResult AddAlert(string tmpData, int? tmpCustomerID)
{
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
dynamic jsonData = JsonConvert.DeserializeObject(tmpData);
var modelTopic = Convert.ToString(jsonData[0]["modelTopic"]);
var modelDescription = Convert.ToString(jsonData[0]["modelDescription"]);
var modelDate = Convert.ToDateTime(jsonData[0]["modelDate"]);
var modelPulish = Convert.ToBoolean(jsonData[0]["modelPulish"]);
var modelType = Convert.ToInt32(jsonData[0]["modelType"]);
using (var context = new OPD_SystemEntities())
{
Alert_Detail AD = new Alert_Detail();
AD.Alert_Type = 1;
AD.Alert_Date = modelDate;
AD.Topic = modelTopic;
AD.Description = modelDescription;
AD.Publish = modelPulish;
AD.FK_Customer_ID = tmpCustomerID;
AD.Remark_Type = modelType;
AD.Is_Active = true;
AD.Create_By = username;
AD.Create_Date = DateTime.Now;
context.Alert_Detail.Add(AD);
context.SaveChanges();
return Json(new { ContentEncoding = 200 , data = AD });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("UpdateAlert")]
public JsonResult UpdateAlert(string tmpData, int? tmpCustomerID)
{
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
dynamic jsonData = JsonConvert.DeserializeObject(tmpData);
int modelID = Convert.ToInt32(jsonData[0]["modelID"]);
var modelTopic = Convert.ToString(jsonData[0]["modelTopic"]);
var modelDescription = Convert.ToString(jsonData[0]["modelDescription"]);
var modelDate = Convert.ToDateTime(jsonData[0]["modelDate"]);
var modelActive = Convert.ToBoolean(jsonData[0]["modelPulish"]);
var modelType = Convert.ToInt32(jsonData[0]["modelType"]);
using (var context = new OPD_SystemEntities())
{
var chkdata = context.Alert_Detail.Where(x => x.FK_Customer_ID == tmpCustomerID && x.ID == modelID && x.Alert_Type == 1 && x.Is_Active == true).OrderByDescending(x => x.ID).FirstOrDefault();
if (chkdata != null)
{
chkdata.Alert_Date = modelDate;
chkdata.Topic = modelTopic;
chkdata.Description = modelDescription;
chkdata.Publish = modelActive;
chkdata.FK_Customer_ID = tmpCustomerID;
chkdata.Remark_Type = modelType;
chkdata.Update_By = username;
chkdata.Update_Date = DateTime.Now;
context.SaveChanges();
return Json(new { ContentEncoding = 200, data = chkdata });
}
return Json(new { ContentEncoding = 400 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("AddMeetingAlert")]
public JsonResult AddMeetingAlert(string tmpData, int? tmpCustomerID)
{
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
dynamic jsonData = JsonConvert.DeserializeObject(tmpData);
var modelTopic = Convert.ToString(jsonData[0]["modelTopic"]);
var modelDescription = Convert.ToString(jsonData[0]["modelDescription"]);
var modelDate = Convert.ToDateTime(jsonData[0]["modelDate"]);
var modelPulish = Convert.ToBoolean(jsonData[0]["modelPulish"]);
using (var context = new OPD_SystemEntities())
{
Alert_Detail AD = new Alert_Detail();
AD.Alert_Type = 2;
AD.Alert_Date = modelDate;
AD.Topic = modelTopic;
AD.Description = modelDescription;
AD.Publish = modelPulish;
AD.FK_Customer_ID = tmpCustomerID;
AD.Is_Active = true;
AD.Create_By = username;
AD.Create_Date = DateTime.Now;
context.Alert_Detail.Add(AD);
context.SaveChanges();
return Json(new { ContentEncoding = 200 , data = AD });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("UpdateMeetingAlert")]
public JsonResult UpdateMeeetingAlert(string tmpData, int? tmpCustomerID)
{
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
dynamic jsonData = JsonConvert.DeserializeObject(tmpData);
int modelID = Convert.ToInt32(jsonData[0]["modelID"]);
var modelTopic = Convert.ToString(jsonData[0]["modelTopic"]);
var modelDescription = Convert.ToString(jsonData[0]["modelDescription"]);
var modelDate = Convert.ToDateTime(jsonData[0]["modelDate"]);
var modelActive = Convert.ToBoolean(jsonData[0]["modelPulish"]);
using (var context = new OPD_SystemEntities())
{
var chkdata = context.Alert_Detail.Where(x => x.FK_Customer_ID == tmpCustomerID && x.ID == modelID && x.Alert_Type == 2 && x.Is_Active == true).OrderByDescending(x => x.ID).FirstOrDefault();
if (chkdata != null)
{
chkdata.Alert_Date = modelDate;
chkdata.Topic = modelTopic;
chkdata.Description = modelDescription;
chkdata.Publish = modelActive;
chkdata.FK_Customer_ID = tmpCustomerID;
chkdata.Update_By = username;
chkdata.Update_Date = DateTime.Now;
context.SaveChanges();
return Json(new { ContentEncoding = 200, data = chkdata });
}
return Json(new { ContentEncoding = 400 });
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("UpdateDataPatient")]
public JsonResult UpdateDataPatient(string tmpData, int? tmpCustomerID)
{
CultureInfo cultureinfo = new CultureInfo("en-US");
try
{
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
dynamic jsonData = JsonConvert.DeserializeObject(tmpData);
string pDate = Convert.ToString(jsonData["Date"]);
string pHour = Convert.ToString(jsonData["Hour"]);
string pMinute = Convert.ToString(jsonData["Minute"]);
string pT = Convert.ToString(jsonData["T"]);
string pR = Convert.ToString(jsonData["R"]);
string pBP = Convert.ToString(jsonData["BP"]);
string pO2 = Convert.ToString(jsonData["O2"]);
string pPulseSBP = Convert.ToString(jsonData["PulseSBP"]);
string pPulseDBP = Convert.ToString(jsonData["PulseDBP"]);
string pIn_Oral = Convert.ToString(jsonData["In_Oral"]);
string pIn_Parenteral = Convert.ToString(jsonData["In_Parenteral"]);
string pOut_Stools = Convert.ToString(jsonData["Out_Stools"]);
string pOut_Urine = Convert.ToString(jsonData["Out_Urine"]);
using (var context = new OPD_SystemEntities())
{
DateTime dateparse = DateTime.ParseExact(pDate, "MMM dd, yyyy", cultureinfo);
var chkdata = context.PatientDatas.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Date == dateparse && x.Time == pHour+":"+pMinute && x.Is_Active == true).ToList();
foreach(var items in chkdata)
{
items.Is_Active = false;
items.Update_By = username;
items.Update_Date = DateTime.Now;
context.SaveChanges();
}
PatientData PD = new PatientData();
PD.FK_Customer_ID = tmpCustomerID;
PD.Date = dateparse;//Convert.ToDateTime(pDate);
PD.Time = pHour+":"+ pMinute;
PD.T = String.IsNullOrEmpty(pT) ? null : pT;
PD.R = pR;
PD.BP = String.IsNullOrEmpty(pBP) ? null : pBP;
PD.O2 = pO2;
PD.PulseDBP = pPulseDBP;
PD.PulseSBP = pPulseSBP;
PD.In_Oral = pIn_Oral;
PD.In_Parenteral = pIn_Parenteral;
PD.Out_Stools = pOut_Stools;
PD.Out_Urine = pOut_Urine;
PD.Is_Active = true;
PD.Create_By = username;
PD.Create_Date = DateTime.Now;
context.PatientDatas.Add(PD);
context.SaveChanges();
return Json(new { ContentEncoding = 200 , data = PD });
}
}
catch (Exception ex)
{
return Json(null);
}
}
public partial class AlertRemark
{
public List<PatientChange> PatientChangeData { get; set; }
public List<Alert_Detail> RemarkData { get; set; }
}
[HttpPost, ActionName("CheckMeeting")]
public JsonResult CheckMeeting()
{
try
{
AlertRemark alertRemark = new AlertRemark();
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
using (var context = new OPD_SystemEntities())
{
string patientName = "";
var datetomorrow = DateTime.Now.AddDays(1);
var TempData = (from AD in context.Alert_Detail.Where(x => x.Is_Active == true && x.Publish == true && x.Alert_Type == 2 && x.Alert_Date == datetomorrow.Date)
join CUS in context.Customers.Where(x => x.Is_Active == true) on AD.FK_Customer_ID equals CUS.ID
select new
{
PatientName = CUS.PrefixCode + CUS.Tname + " " + CUS.TsurName
}).ToList();
foreach (var items in TempData)
{
patientName += items.PatientName + ", ";
}
if(!String.IsNullOrEmpty(patientName))
{
patientName = patientName.Substring(0, patientName.Length - 2);
return Json(new { ContentEncoding = 200 , data = patientName});
}
else
{
return Json(new { ContentEncoding = 400 });
}
}
}
catch (Exception ex)
{
return Json(null);
}
}
[HttpPost, ActionName("CheckRemark")]
public JsonResult CheckRemark(int? tmpCustomerID)
{
try
{
AlertRemark alertRemark = new AlertRemark();
string username = HttpContext.Request.Cookies.Get("OPD")["Username"];
if (tmpCustomerID != null)
{
using (var context = new OPD_SystemEntities())
{
var PatientChangeData = context.PatientChanges.Where(x => x.Is_Active == true && x.Publish == true && x.FK_Customer_ID == tmpCustomerID && (x.NextDateChange != null && DbFunctions.TruncateTime(x.NextDateChange.Value) == DbFunctions.TruncateTime(DateTime.Now))).ToList();
alertRemark.PatientChangeData = PatientChangeData;
foreach (var items in PatientChangeData)
{
items.Publish = false;
items.Update_By = username;
items.Update_Date = DateTime.Now;
context.SaveChanges();
}
var RemarkData = context.Alert_Detail.Where(x => x.Is_Active == true && x.Publish == true && x.Alert_Type == 1 && x.FK_Customer_ID == tmpCustomerID && (x.Alert_Date != null && DbFunctions.TruncateTime(x.Alert_Date.Value) == DbFunctions.TruncateTime(DateTime.Now))).ToList();
alertRemark.RemarkData = RemarkData;
foreach (var items in RemarkData)
{
items.Publish = false;
items.Update_By = username;
items.Update_Date = DateTime.Now;
context.SaveChanges();
}
if (PatientChangeData.Count > 0 || RemarkData.Count > 0)
{
return Json(new { ContentEncoding = 200, data = alertRemark });
}
else
{
return Json(null);
}
}
}
return Json(null);
}
catch (Exception ex)
{
return Json(null);
}
}
public ActionResult PatientDetail(string customerCN)
{
var result = new TempPatientData();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
public ActionResult Attachfile(string customerCN)
{
var result = new TempPatientData();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string FTPFile = ConfigurationManager.AppSettings["FTPFile"];
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
result.PATH = FTPFile;
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
public partial class ChartShow
{
public List<object> chart { get; set; }
public List<object> chart2 { get; set; }
public TempPatientData data { get; set; }
}
public ActionResult PatientData(string customerCN)
{
var result = new ChartShow();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result.data = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
result.chart = null;
result.chart2 = null;
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
#region bkPatientData 01/06/2021
//public ActionResult PatientData(string customerCN)
//{
// var result = new ChartShow();
// try
// {
// if (!String.IsNullOrEmpty(customerCN))
// {
// using (var context = new OPD_SystemEntities())
// {
// string query = TableCustomer();
// query += "and CN = '" + customerCN + "'";
// result.data = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
// List<object> TempT = new List<object>();
// var date8dayago = DateTime.Now.AddDays(-8);
// var date7dayago = DateTime.Now.AddDays(-7);
// var date6dayago = DateTime.Now.AddDays(-6);
// var date5dayago = DateTime.Now.AddDays(-5);
// var date4dayago = DateTime.Now.AddDays(-4);
// var date3dayago = DateTime.Now.AddDays(-3);
// var date2dayago = DateTime.Now.AddDays(-2);
// var date1dayago = DateTime.Now.AddDays(-1);
// var FetchData = context.PatientDatas.Where(x => x.Date >= date8dayago && x.Date <= DateTime.Now && x.FK_Customer_ID == result.data.ID && x.Is_Active == true).ToList();
// #region 7sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region 6sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region 5sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region 4sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region 3sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region 2sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region 1sbp
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// #region todaysbp
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(0)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "00:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(0.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "00:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(1)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "01:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(1.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "01:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(2)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "02:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(2.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "02:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(3)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "03:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(3.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "03:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(4)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "04:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(4.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "04:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(5)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "05:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(5.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "05:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(6)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "06:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(6.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "06:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(7)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "07:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(7.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "07:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(8)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "08:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(8.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "08:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(9)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "09:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(9.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "09:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(10)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "10:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(10.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "10:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(11)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "11:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(11.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "11:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(12)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "12:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(12.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "12:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(13)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "13:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(13.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "13:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(14)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "14:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(14.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "14:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(15)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "15:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(15.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "15:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(16)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "16:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(16.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "16:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(17)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "17:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(17.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "17:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(18)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "18:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(18.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "18:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(19)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "19:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(19.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "19:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(20)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "20:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(20.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "20:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(21)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "21:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(21.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "21:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(22)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "22:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(22.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "22:30").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(23)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "23:00").FirstOrDefault()?.T) });
// TempT.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(23.50)),
// Convert.ToDouble(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "23:30").FirstOrDefault()?.T) });
// #endregion
// List<object> TempBP = new List<object>();
// #region 7DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date7dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date7dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region 6DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date6dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date6dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region 5DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date5dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date5dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region 4DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date4dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date4dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region 3DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date3dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date3dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region 2DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date2dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date2dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region 1DBP
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(date1dayago.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == date1dayago.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// #region todayDBP
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(0)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "00:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(0.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "00:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(1)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "01:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(1.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "01:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(2)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "02:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(2.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "02:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(3)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "03:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(3.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "03:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(4)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "04:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(4.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "04:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(5)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "05:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(5.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "05:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(6)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "06:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(6.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "06:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(7)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "07:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(7.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "07:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(8)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "08:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(8.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "08:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(9)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "09:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(9.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "09:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(10)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "10:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(10.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "10:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(11)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "11:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(11.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "11:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(12)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "12:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(12.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "12:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(13)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "13:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(13.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "13:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(14)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "14:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(14.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "14:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(15)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "15:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(15.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "15:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(16)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "16:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(16.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "16:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(17)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "17:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(17.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "17:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(18)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "18:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(18.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "18:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(19)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "19:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(19.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "19:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(20)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "20:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(20.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "20:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(21)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "21:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(21.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "21:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(22)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "22:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(22.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "22:30").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(23)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "23:00").FirstOrDefault()?.BP) });
// TempBP.Add(new List<object> { Convert.ToDateTime(DateTime.Now.Date.AddHours(23.50)),
// Convert.ToInt32(FetchData.Where(x => x.Date == DateTime.Now.Date && x.Time == "23:30").FirstOrDefault()?.BP) });
// #endregion
// result.chart = TempT;
// result.chart2 = TempBP;
// return View(result);
// }
// }
// else
// {
// return View(result);
// }
// }
// catch (Exception ex)
// {
// return View(result);
// }
//}
#endregion
[HttpPost, ActionName("PatientChartData")]
public JsonResult PatientChartData(string tempData)
{
var result = new ChartShow();
try
{
if (!String.IsNullOrEmpty(tempData))
{
using (var context = new OPD_SystemEntities())
{
dynamic jsData = JsonConvert.DeserializeObject(tempData);
int? tmpCustomerID = Convert.ToInt32(jsData.tmpCustomerID);
DateTime ConToDate = Convert.ToDateTime(jsData.ToDateSearch);
DateTime ConEndDate = Convert.ToDateTime(jsData.EndDateSearch);
string search = jsData.Search;
string PatientName = jsData.PatientName;
string PatientRoom = jsData.PatientRoom;
List<object> TempT = new List<object>();
List<object> TempBP = new List<object>();
var FetchData = context.PatientDatas.Where(x => x.Date >= ConToDate && x.Date <= ConEndDate && x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true).OrderBy(x => x.Date).ThenBy(x => x.Time).ToList();
foreach (var items in FetchData)
{
TempT.Add(new List<object> { Convert.ToDateTime(items.Date.ToString().Split(' ').ElementAt(0) + " " + items.Time),
Convert.ToDouble(items.T) });
TempBP.Add(new List<object> { Convert.ToDateTime(items.Date.ToString().Split(' ').ElementAt(0) + " " + items.Time),
Convert.ToInt32(items.BP) });
}
result.chart = TempT;
result.chart2 = TempBP;
return Json(new { ContentEncoding = 200, data = result });
}
}
else
{
return Json(null);
}
}
catch (Exception ex)
{
return Json(null);
}
}
public ActionResult MedicalExpire(string customerCN)
{
var result = new TempPatientData();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
public ActionResult Remark(string customerCN)
{
var result = new TempPatientData();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
public ActionResult Meeting(string customerCN)
{
var result = new TempPatientData();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
public ActionResult Test(string customerCN)
{
var result = new TempPatientData();
try
{
if (!String.IsNullOrEmpty(customerCN))
{
using (var context = new OPD_SystemEntities())
{
string query = TableCustomer();
query += "and CN = '" + customerCN + "'";
result = context.Database.SqlQuery<TempPatientData>(query).FirstOrDefault();
return View(result);
}
}
else
{
return View(result);
}
}
catch (Exception ex)
{
return View(result);
}
}
[AllowJsonGet]
[HttpGet, ActionName("GetDataPatient")]
public async Task<JsonResult> GetDataPatient(TableSearchReceive tempData)
{
using (var context = new OPD_SystemEntities())
{
try
{
int tmpCustomerID = Convert.ToInt32(tempData.filter1);
var ConToDate = Convert.ToDateTime(tempData.filter2);
var ConEndDate = Convert.ToDateTime(tempData.filter3);
string search = tempData.filter4;
var res = new List<PatientData>();
if (!String.IsNullOrEmpty(search))
{
res = (from a in context.PatientDatas
where ((a.Time ?? "").Contains(search) || (a.BP ?? "").Contains(search) || (a.In_Oral ?? "").Contains(search) || (a.In_Parenteral ?? "").Contains(search) || (a.O2 ?? "").Contains(search) || (a.Out_Stools ?? "").Contains(search) || (a.Out_Urine ?? "").Contains(search) || (a.PulseDBP ?? "").Contains(search) || (a.PulseSBP ?? "").Contains(search) || (a.R ?? "").Contains(search) || (a.T ?? "").Contains(search))
select a
).Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && (x.Date >= ConToDate && x.Date <= ConEndDate)).ToList();
}
else
{
res = context.PatientDatas.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && (x.Date >= ConToDate && x.Date <= ConEndDate)).ToList();
}
var result = new List<PatientData>();
int? total = res.Count();
if (total.HasValue ? total.Value > 0 : false)
{
int? last_page = (int)Math.Ceiling((double)total / (double)tempData.per_page);
bool sortType = tempData.sort.Split('|')[1].Equals("asc");
string sortName = tempData.sort.Split('|')[0];
if (sortType)
{
if (sortName == "BP")
{
result = res.OrderBy(x => x.BP).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Date")
{
result = res.OrderBy(x => x.Date).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "In_Oral")
{
result = res.OrderBy(x => x.In_Oral).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "In_Parenteral")
{
result = res.OrderBy(x => x.In_Parenteral).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "O2")
{
result = res.OrderBy(x => x.O2).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Out_Stools")
{
result = res.OrderBy(x => x.Out_Stools).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Out_Urine")
{
result = res.OrderBy(x => x.Out_Urine).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "PulseDBP")
{
result = res.OrderBy(x => x.PulseDBP).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "PulseSBP")
{
result = res.OrderBy(x => x.PulseSBP).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "R")
{
result = res.OrderBy(x => x.R).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "T")
{
result = res.OrderBy(x => x.T).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Time")
{
result = res.OrderBy(x => x.Time).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else
{
result = res.OrderBy(x => x.ID).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
}
else
{
if (sortName == "BP")
{
result = res.OrderByDescending(x => x.BP).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Date")
{
result = res.OrderByDescending(x => x.Date).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "In_Oral")
{
result = res.OrderByDescending(x => x.In_Oral).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "In_Parenteral")
{
result = res.OrderByDescending(x => x.In_Parenteral).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "O2")
{
result = res.OrderByDescending(x => x.O2).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Out_Stools")
{
result = res.OrderByDescending(x => x.Out_Stools).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Out_Urine")
{
result = res.OrderByDescending(x => x.Out_Urine).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "PulseDBP")
{
result = res.OrderByDescending(x => x.PulseDBP).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "PulseSBP")
{
result = res.OrderByDescending(x => x.PulseSBP).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "R")
{
result = res.OrderByDescending(x => x.R).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "T")
{
result = res.OrderByDescending(x => x.T).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else if (sortName == "Time")
{
result = res.OrderByDescending(x => x.Time).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
else
{
result = res.OrderByDescending(x => x.ID).Skip(((int)tempData.page - 1) * (int)tempData.per_page).Take(Convert.ToInt32(tempData.per_page)).ToList();
}
}
TableSearchRespose temp = new TableSearchRespose
{
total = total,
per_page = tempData.per_page,
current_page = tempData.page,
last_page = last_page,
next_page_url = tempData.page < last_page ? string.Format("{0}?page={1}", BaseURL(), tempData.page + 1) : null,
prev_page_url = tempData.page > 1 ? string.Format("{0}?page={1}", BaseURL(), tempData.page - 1) : null,
from = tempData.page >= 1 ? ((tempData.per_page * (tempData.page - 1)) + 1) : null,
to = tempData.page >= 1 ? ((tempData.page - 1) * tempData.per_page) + result.Count : null,
data = result
};
return Json(temp);
}
else
{
return Json(null);
}
}
catch (Exception ex)
{
return Json(null);
}
}
}
public void ReportPatientDataEXCEL(string tempData)
{
using (var context = new OPD_SystemEntities())
{
try
{
if (tempData != null)
{
dynamic jsData = JsonConvert.DeserializeObject(tempData);
int? tmpCustomerID = Convert.ToInt32(jsData.tmpCustomerID);
DateTime ConToDate = Convert.ToDateTime(jsData.ToDateSearch);
DateTime ConEndDate = Convert.ToDateTime(jsData.EndDateSearch);
string search = jsData.Search;
string PatientName = jsData.PatientName;
string PatientRoom = jsData.PatientRoom;
var res = new List<PatientData>();
if (!String.IsNullOrEmpty(search))
{
res = (from a in context.PatientDatas
where ((a.Time ?? "").Contains(search) || (a.BP ?? "").Contains(search) || (a.In_Oral ?? "").Contains(search) || (a.In_Parenteral ?? "").Contains(search) || (a.O2 ?? "").Contains(search) || (a.Out_Stools ?? "").Contains(search) || (a.Out_Urine ?? "").Contains(search) || (a.PulseDBP ?? "").Contains(search) || (a.PulseSBP ?? "").Contains(search) || (a.R ?? "").Contains(search) || (a.T ?? "").Contains(search))
select a
).Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && (x.Date >= ConToDate && x.Date <= ConEndDate)).ToList();
}
else
{
res = context.PatientDatas.Where(x => x.FK_Customer_ID == tmpCustomerID && x.Is_Active == true && (x.Date >= ConToDate && x.Date <= ConEndDate)).ToList();
}
ExcelPackage pck = new ExcelPackage();
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Report");
ws.Cells["A1"].Value = "ผลการตรวจวัดข้อมูล" + PatientName + " ห้องเลขที่: " + PatientRoom + " ตั้งแต่วันที่ " + ConToDate.ToString("dd/MM/yyyy") + " ถึง " + ConEndDate.ToString("dd/MM/yyyy");
ws.Cells["A1:K1"].Merge = true;
ws.Cells["A1"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
ws.Cells["A1"].Style.Font.Size = 14;
ws.Cells["A3"].Value = "Date";
ws.Cells["B3"].Value = "Time";
ws.Cells["C3"].Value = "T";
ws.Cells["D3"].Value = "BP";
ws.Cells["E3"].Value = "R";
ws.Cells["F3"].Value = "P";
ws.Cells["G3"].Value = "O2";
ws.Cells["H3"].Value = "IN Oral";
ws.Cells["I3"].Value = "IN Parenteral";
ws.Cells["J3"].Value = "OUT Stools";
ws.Cells["K3"].Value = "OUT Urine";
ws.Cells["A1:K3"].Style.Font.Bold = true;
if (res != null)
{
var index = 4;
foreach (var item in res)
{
ws.Cells[string.Format("A{0}", index)].Value = Convert.ToDateTime(item.Date).ToString("MMM dd, yyyy");
ws.Cells[string.Format("B{0}", index)].Value = item.Time;
ws.Cells[string.Format("C{0}", index)].Value = item.T;
ws.Cells[string.Format("D{0}", index)].Value = String.IsNullOrEmpty(item.PulseSBP) ? null : item.PulseSBP + "/" + item.PulseDBP;
ws.Cells[string.Format("E{0}", index)].Value = item.R;
ws.Cells[string.Format("F{0}", index)].Value = item.BP;
ws.Cells[string.Format("G{0}", index)].Value = item.O2;
ws.Cells[string.Format("H{0}", index)].Value = item.In_Oral;
ws.Cells[string.Format("I{0}", index)].Value = item.In_Parenteral;
ws.Cells[string.Format("J{0}", index)].Value = item.Out_Stools;
ws.Cells[string.Format("K{0}", index)].Value = item.Out_Urine;
index++;
}
ws.Cells[string.Format("A3:k{0}", index - 1)].Style.Border.Top.Style = ExcelBorderStyle.Thin;
ws.Cells[string.Format("A3:k{0}", index - 1)].Style.Border.Right.Style = ExcelBorderStyle.Thin;
ws.Cells[string.Format("A3:k{0}", index - 1)].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
ws.Cells[string.Format("A3:k{0}", index - 1)].Style.Border.Left.Style = ExcelBorderStyle.Thin;
}
ws.Cells["A:AZ"].AutoFitColumns();
ws.PrinterSettings.PaperSize = ePaperSize.A4;
ws.PrinterSettings.FitToPage = true;
ws.PrinterSettings.Orientation = eOrientation.Landscape;
ws.PrinterSettings.FitToHeight = 0;
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment; filename= " + "PatientDataReport" + ".xlsx");
Response.BinaryWrite(pck.GetAsByteArray());
Response.End();
}
}
catch (Exception ex)
{
throw;
}
}
}
}
} | 87.972175 | 445 | 0.526341 | [
"Unlicense"
] | Krailit/Aryuwat_Nurse | AryuwatWebApplication/Controllers/HomeController.cs | 256,177 | C# |
using ADYC.WebUI.Exceptions;
using ADYC.WebUI.Infrastructure;
using NLog;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace ADYC.WebUI.CustomAttributes
{
public class AdycExceptionFilter : IExceptionFilter
{
public void OnException(ExceptionContext filterContext)
{
var exception = filterContext.Exception;
var controller = GetCurrentController();
var action = GetCurrentAction();
var logger = LogManager.GetCurrentClassLogger();
if (exception is UnauthorizedException)
{
SessionHelper.DestroyUserSession();
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new
{
action = "Index",
controller = "Home",
area = ""
}));
filterContext.ExceptionHandled = true;
}
else if (exception is NotFoundException)
{
filterContext.Result = new HttpNotFoundResult();
filterContext.ExceptionHandled = true;
}
else if (exception is ServerErrorException)
{
logger.Error(exception, $"Error occured in {controller} controller {action} Action");
filterContext.Result = new HttpStatusCodeResult(500);
filterContext.ExceptionHandled = true;
}
else
{
logger.Error(exception, $"Error occured in {controller} controller {action} Action");
filterContext.Result = new HttpStatusCodeResult(500);
filterContext.ExceptionHandled = true;
}
}
public static string GetCurrentController()
{
return HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
}
public static string GetCurrentAction()
{
return HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString();
}
}
} | 31.597015 | 104 | 0.581483 | [
"MIT"
] | jose2a/ADYC | WebUI/ADYC.WebUI/Filters/AdycExceptionFilter.cs | 2,119 | C# |
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Attributes;
using System;
[MemoryDiagnoser]
public class DisposeStructVsClass
{
static int i = 0;
[Benchmark(Baseline = true)]
public void struct_dispose()
{
using (new StructDisposable())
{
i++;
}
}
[Benchmark]
public void class_dispose()
{
using (new ClassDisposable())
{
i++;
}
}
struct StructDisposable : IDisposable
{
public string Name;
public long StartTicks;
public void Dispose() { }
}
class ClassDisposable : IDisposable
{
public string Name;
public long StartTicks;
public void Dispose() { }
}
} | 17.372093 | 41 | 0.563588 | [
"MIT"
] | yufeih/yufeih.github.io | slides/memory-diagnostics-and-benchmark/code/benchmark/3-dispose-struct-vs-class.cs | 749 | C# |
using System;
using System.Net.Http;
using Buddy.WebApi;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
namespace Buddy.Integration.Tests.Fixtures
{
public class TestContext : IDisposable
{
private TestServer _server;
public HttpClient Client { get; private set; }
public TestContext()
{
SetUpClient();
}
private void SetUpClient()
{
_server = new TestServer(new WebHostBuilder().UseStartup<Startup>());
Client = _server.CreateClient();
}
public void Dispose()
{
_server?.Dispose();
Client?.Dispose();
}
}
} | 22.516129 | 81 | 0.588825 | [
"MIT"
] | krovomi/IntegrationExample | Buddy.Integration.Tests/Fixtures/TestContext.cs | 700 | C# |
// <auto-generated />
namespace SmartStore.Tax.Data.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.0.2-21211")]
public sealed partial class Initial : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(Initial));
string IMigrationMetadata.Id
{
get { return "201403112350417_Initial"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
| 27.066667 | 90 | 0.615764 | [
"MIT"
] | jenmcquade/csharp-snippets | SmartStoreNET-3.x/src/Plugins/SmartStore.Tax/Data/Migrations/201403112350417_Initial.Designer.cs | 812 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPC : MonoBehaviour
{
[SerializeField]
private float speed;
private float initialSpeed;
private int index;
public List<Transform> paths = new List<Transform>();
private Animator animator;
private string isWalking = "isWalking";
private void Start()
{
animator = GetComponent<Animator>();
initialSpeed = speed;
}
// Update is called once per frame
void Update()
{
CheckIsNPCDialogue();
// Get the positions
Vector3 currentPosition = transform.position;
Vector3 targetPosition = paths[index].position;
// Move to the target position
MoveToPath(currentPosition, targetPosition);
// Check if arrived to target path and get the next one
if(Vector2.Distance(currentPosition, targetPosition) <= 0.1f)
{
// Walks randomly
index = Random.Range(0, paths.Count);
// Walks a order path
//if(index < paths.Count - 1)
//{
// index++;
//}
//else
//{
// index = 0;
//}
}
SetDirection(currentPosition, targetPosition);
}
private void CheckIsNPCDialogue()
{
if (DialogueControl.instance.isDialogueVisible)
{
speed = 0f;
animator.SetBool(isWalking, false);
}
else
{
speed = initialSpeed;
animator.SetBool(isWalking, true);
}
}
private void MoveToPath(Vector3 currentPosition, Vector3 targetPosition)
{
transform.position = Vector2.MoveTowards(currentPosition, targetPosition, speed * Time.deltaTime);
}
private void SetDirection(Vector3 currentPosition, Vector3 targetPosition)
{
// Get the NPC direction
Vector2 direction = targetPosition - currentPosition;
// Check if NPC is going to right or left direction
if (direction.x > 0)
{
transform.eulerAngles = new Vector2(0, 0);
}
if (direction.x < 0)
{
transform.eulerAngles = new Vector2(0, 180);
}
}
}
| 24.913043 | 106 | 0.571553 | [
"MIT"
] | Meirellesc/GameDev.Unity.TopDown2D | TopDownGame2D/Assets/Scripts/NPC/NPC_1/NPC.cs | 2,292 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace Web.Asp.Net.Core
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
| 22.12 | 64 | 0.571429 | [
"Apache-2.0"
] | nzkelvin/PlayCode | Web.Microsoft/Old to be deleted/src/Web.Asp.Net.Core/Program.cs | 555 | C# |
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using DotnetSpider.Common;
namespace DotnetSpider.Downloader
{
/// <summary>
/// 验证代理是否正常
/// </summary>
public class TunnelValidator : IProxyValidator
{
private readonly string _targetUrl;
public TunnelValidator(string targetUrl = "http://www.baidu.com")
{
_targetUrl = targetUrl;
if (string.IsNullOrEmpty(_targetUrl))
{
throw new SpiderException($"{nameof(targetUrl)} is empty/null.");
}
if (!Uri.TryCreate(targetUrl, UriKind.RelativeOrAbsolute, out _))
{
throw new SpiderException($"{nameof(targetUrl)} is not an uri.");
}
}
public Task<bool> IsAvailable(WebProxy proxy)
{
var timeout = TimeSpan.FromSeconds(1d);
var validator = new ProxyValidator(proxy);
var targetAddress = new Uri(_targetUrl);
return Task.FromResult(validator.Validate(targetAddress, timeout) == HttpStatusCode.OK);
}
/// <summary>
/// 代理验证器
/// 提供代理的验证
/// </summary>
private class ProxyValidator
{
/// <summary>
/// 获取代理
/// </summary>
public IWebProxy WebProxy { get; }
/// <summary>
/// 代理验证器
/// </summary>
/// <param name="proxyHost">代理服务器域名或ip</param>
/// <param name="proxyPort">代理服务器端口</param>
// ReSharper disable once UnusedMember.Local
public ProxyValidator(string proxyHost, int proxyPort)
: this(new HttpProxy(proxyHost, proxyPort))
{
}
/// <summary>
/// 代理验证器
/// </summary>
/// <param name="webProxy">代理</param>
/// <exception cref="ArgumentNullException"></exception>
public ProxyValidator(IWebProxy webProxy)
{
WebProxy = webProxy ?? throw new ArgumentNullException(nameof(webProxy));
}
/// <summary>
/// 使用http tunnel检测代理状态
/// </summary>
/// <param name="targetAddress">目标地址,可以是http或https</param>
/// <param name="timeout">发送或等待数据的超时时间</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public HttpStatusCode Validate(Uri targetAddress, TimeSpan? timeout = null)
{
if (targetAddress == null)
{
throw new ArgumentNullException(nameof(targetAddress));
}
return Validate(WebProxy, targetAddress, timeout);
}
/// <summary>
/// 转换为字符串
/// </summary>
/// <returns></returns>
public override string ToString()
{
return WebProxy.ToString();
}
/// <summary>
/// 使用http tunnel检测代理状态
/// </summary>
/// <param name="webProxy">web代理</param>
/// <param name="targetAddress">目标地址,可以是http或https</param>
/// <param name="timeout">发送或等待数据的超时时间</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public static HttpStatusCode Validate(IWebProxy webProxy, Uri targetAddress, TimeSpan? timeout = null)
{
if (webProxy == null)
{
throw new ArgumentNullException(nameof(webProxy));
}
var httpProxy = webProxy as HttpProxy;
if (httpProxy == null)
{
httpProxy = HttpProxy.FromWebProxy(webProxy, targetAddress);
}
Socket socket = null;
try
{
var ascii = Encoding.GetEncoding("ASCII");
var host = Dns.GetHostEntry(httpProxy.Host);
socket = new Socket(host.AddressList[0].AddressFamily, SocketType.Stream, ProtocolType.Tcp);
if (timeout.HasValue)
{
socket.SendTimeout = (int)timeout.Value.TotalMilliseconds;
socket.ReceiveTimeout = (int)timeout.Value.TotalMilliseconds;
}
socket.Connect(new IPEndPoint(host.AddressList[0], httpProxy.Port));
var request = httpProxy.ToTunnelRequestString(targetAddress);
var sendBuffer = ascii.GetBytes(request);
socket.Send(sendBuffer);
var recvBuffer = new byte[150];
var length = socket.Receive(recvBuffer);
var response = ascii.GetString(recvBuffer, 0, length);
var statusCode =
int.Parse(Regex.Match(response, "(?<=HTTP/1.1 )\\d+", RegexOptions.IgnoreCase).Value);
return (HttpStatusCode)statusCode;
}
catch (Exception)
{
return HttpStatusCode.ServiceUnavailable;
}
finally
{
socket?.Dispose();
}
}
}
/// <summary>
/// 表示http代理信息
/// </summary>
private class HttpProxy : IWebProxy
{
/// <summary>
/// 授权字段
/// </summary>
private ICredentials _credentials;
/// <summary>
/// 获取代理服务器域名或ip
/// </summary>
public string Host { get; }
/// <summary>
/// 获取代理服务器端口
/// </summary>
public int Port { get; }
/// <summary>
/// 获取代理服务器账号
/// </summary>
public string UserName { get; private set; }
/// <summary>
/// 获取代理服务器密码
/// </summary>
public string Password { get; private set; }
/// <summary>
/// 获取或设置授权信息
/// </summary>
ICredentials IWebProxy.Credentials
{
get => _credentials;
set => SetCredentialsByInterface(value);
}
/// <summary>
/// http代理信息
/// </summary>
/// <param name="proxyAddress">代理服务器地址</param>
// ReSharper disable once UnusedMember.Local
public HttpProxy(string proxyAddress)
: this(new Uri(proxyAddress ?? throw new ArgumentNullException(nameof(proxyAddress))))
{
}
/// <summary>
/// http代理信息
/// </summary>
/// <param name="proxyAddress">代理服务器地址</param>
/// <exception cref="ArgumentNullException"></exception>
public HttpProxy(Uri proxyAddress)
{
if (proxyAddress == null)
{
throw new ArgumentNullException(nameof(proxyAddress));
}
Host = proxyAddress.Host;
Port = proxyAddress.Port;
}
/// <summary>
/// http代理信息
/// </summary>
/// <param name="host">代理服务器域名或ip</param>
/// <param name="port">代理服务器端口</param>
/// <exception cref="ArgumentNullException"></exception>
public HttpProxy(string host, int port)
{
Host = host ?? throw new ArgumentNullException(nameof(host));
Port = port;
}
/// <summary>
/// http代理信息
/// </summary>
/// <param name="host">代理服务器域名或ip</param>
/// <param name="port">代理服务器端口</param>
/// <param name="userName">代理服务器账号</param>
/// <param name="password">代理服务器密码</param>
// ReSharper disable once UnusedMember.Local
public HttpProxy(string host, int port, string userName, string password)
: this(host, port)
{
UserName = userName;
Password = password;
if (string.IsNullOrEmpty(userName + password) == false)
{
_credentials = new NetworkCredential(userName, password);
}
}
/// <summary>
/// 通过接口设置授权信息
/// </summary>
/// <param name="value"></param>
private void SetCredentialsByInterface(ICredentials value)
{
var userName = default(string);
var password = default(string);
if (value != null)
{
var networkCredentialsd = value.GetCredential(new Uri(Host), string.Empty);
userName = networkCredentialsd?.UserName;
password = networkCredentialsd?.Password;
}
UserName = userName;
Password = password;
_credentials = value;
}
/// <summary>
/// 转换Http Tunnel请求字符串
/// </summary>
/// <param name="targetAddress">目标url地址</param>
public string ToTunnelRequestString(Uri targetAddress)
{
if (targetAddress == null)
{
throw new ArgumentNullException(nameof(targetAddress));
}
const string crlf = "\r\n";
var builder = new StringBuilder()
.Append($"CONNECT {targetAddress.Host}:{targetAddress.Port} HTTP/1.1{crlf}")
.Append($"Host: {targetAddress.Host}:{targetAddress.Port}{crlf}")
.Append($"Accept: */*{crlf}")
.Append($"Content-Type: text/html{crlf}")
.Append($"Proxy-Connection: Keep-Alive{crlf}")
.Append($"Content-length: 0{crlf}");
if (UserName != null && Password != null)
{
var bytes = Encoding.ASCII.GetBytes($"{UserName}:{Password}");
var base64 = Convert.ToBase64String(bytes);
builder.AppendLine($"Proxy-Authorization: Basic {base64}{crlf}");
}
return builder.Append(crlf).ToString();
}
/// <summary>
/// 获取代理服务器地址
/// </summary>
/// <param name="destination">目标地址</param>
/// <returns></returns>
public Uri GetProxy(Uri destination)
{
return new Uri(ToString());
}
/// <summary>
/// 是否忽略代理
/// </summary>
/// <param name="host">目标地址</param>
/// <returns></returns>
public bool IsBypassed(Uri host)
{
return false;
}
/// <summary>
/// 转换为字符串
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"http://{Host}:{Port}/";
}
/// <summary>
/// 从IWebProxy实例转换获得
/// </summary>
/// <param name="webProxy">IWebProxy</param>
/// <param name="targetAddress">目标url地址</param>
/// <exception cref="ArgumentNullException"></exception>
/// <returns></returns>
public static HttpProxy FromWebProxy(IWebProxy webProxy, Uri targetAddress)
{
if (webProxy == null)
{
throw new ArgumentNullException(nameof(webProxy));
}
if (targetAddress == null)
{
throw new ArgumentNullException(nameof(targetAddress));
}
var proxyAddress = webProxy.GetProxy(targetAddress);
var httpProxy = new HttpProxy(proxyAddress);
httpProxy.SetCredentialsByInterface(webProxy.Credentials);
return httpProxy;
}
}
}
}
| 25.631579 | 105 | 0.637955 | [
"MIT"
] | ACGSinon/DotnetSpider | src/DotnetSpider/Downloader/TunnelValidator.cs | 9,869 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the appsync-2017-07-25.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.AppSync.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.AppSync.Model.Internal.MarshallTransformations
{
/// <summary>
/// StartSchemaCreation Request Marshaller
/// </summary>
public class StartSchemaCreationRequestMarshaller : IMarshaller<IRequest, StartSchemaCreationRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((StartSchemaCreationRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(StartSchemaCreationRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.AppSync");
request.Headers["Content-Type"] = "application/json";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2017-07-25";
request.HttpMethod = "POST";
string uriResourcePath = "/v1/apis/{apiId}/schemacreation";
if (!publicRequest.IsSetApiId())
throw new AmazonAppSyncException("Request object does not have required field ApiId set");
uriResourcePath = uriResourcePath.Replace("{apiId}", StringUtils.FromStringWithSlashEncoding(publicRequest.ApiId));
request.ResourcePath = uriResourcePath;
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetDefinition())
{
context.Writer.WritePropertyName("definition");
context.Writer.Write(StringUtils.FromMemoryStream(publicRequest.Definition));
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static StartSchemaCreationRequestMarshaller _instance = new StartSchemaCreationRequestMarshaller();
internal static StartSchemaCreationRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static StartSchemaCreationRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 37.264151 | 153 | 0.643544 | [
"Apache-2.0"
] | FoxBearBear/aws-sdk-net | sdk/src/Services/AppSync/Generated/Model/Internal/MarshallTransformations/StartSchemaCreationRequestMarshaller.cs | 3,950 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Rename;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor.Xaml.Features.InlineRename
{
[ExportLanguageService(typeof(IEditorInlineRenameService), StringConstants.XamlLanguageName), Shared]
internal class XamlEditorInlineRenameService : IEditorInlineRenameService
{
private readonly IXamlRenameInfoService _renameService;
[ImportingConstructor]
public XamlEditorInlineRenameService(IXamlRenameInfoService renameService)
{
_renameService = renameService;
}
public async Task<IInlineRenameInfo> GetRenameInfoAsync(Document document, int position, CancellationToken cancellationToken)
{
var renameInfo = await _renameService.GetRenameInfoAsync(document, position, cancellationToken).ConfigureAwait(false);
return new InlineRenameInfo(_renameService, document, position, renameInfo);
}
private class InlineRenameInfo : IInlineRenameInfo
{
private readonly IXamlRenameInfoService _renameService;
private readonly Document _document;
private readonly int _position;
private readonly IXamlRenameInfo _renameInfo;
public InlineRenameInfo(IXamlRenameInfoService renameService, Document document, int position, IXamlRenameInfo renameInfo)
{
_renameService = renameService;
_document = document;
_position = position;
_renameInfo = renameInfo;
}
public bool CanRename => _renameInfo.CanRename;
public string DisplayName => _renameInfo.DisplayName;
public string FullDisplayName => _renameInfo.FullDisplayName;
public Glyph Glyph => InlineRenameInfo.FromSymbolKind(_renameInfo.Kind);
public bool HasOverloads => false;
public bool ForceRenameOverloads => false;
public string LocalizedErrorMessage => _renameInfo.LocalizedErrorMessage;
public TextSpan TriggerSpan => _renameInfo.TriggerSpan;
public async Task<IInlineRenameLocationSet> FindRenameLocationsAsync(OptionSet optionSet, CancellationToken cancellationToken)
{
var references = new List<InlineRenameLocation>();
var renameLocations = await _renameInfo.FindRenameLocationsAsync(
renameInStrings: optionSet.GetOption(RenameOptions.RenameInStrings),
renameInComments: optionSet.GetOption(RenameOptions.RenameInComments),
cancellationToken: cancellationToken).ConfigureAwait(false);
references.AddRange(renameLocations.Select(
ds => new InlineRenameLocation(ds.Document, ds.TextSpan)));
return new InlineRenameLocationSet(
_renameInfo, _document.Project.Solution,
references.ToImmutableArray());
}
public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string replacementText, CancellationToken cancellationToken)
{
return location.TextSpan;
}
public string GetFinalSymbolName(string replacementText)
{
return replacementText;
}
public TextSpan GetReferenceEditSpan(InlineRenameLocation location, CancellationToken cancellationToken)
{
return location.TextSpan;
}
public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, string replacementText)
{
return true;
}
public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, string replacementText)
{
return true;
}
private static Glyph FromSymbolKind(SymbolKind kind)
{
var glyph = Glyph.Error;
switch (kind)
{
case SymbolKind.Namespace:
glyph = Glyph.Namespace;
break;
case SymbolKind.NamedType:
glyph = Glyph.ClassPublic;
break;
case SymbolKind.Property:
glyph = Glyph.PropertyPublic;
break;
case SymbolKind.Event:
glyph = Glyph.EventPublic;
break;
}
return glyph;
}
private class InlineRenameLocationSet : IInlineRenameLocationSet
{
private readonly IXamlRenameInfo _renameInfo;
private readonly Solution _oldSolution;
public InlineRenameLocationSet(IXamlRenameInfo renameInfo, Solution solution, ImmutableArray<InlineRenameLocation> locations)
{
_renameInfo = renameInfo;
_oldSolution = solution;
Locations = locations;
}
public ImmutableArray<InlineRenameLocation> Locations { get; }
public bool IsReplacementTextValid(string replacementText)
{
return _renameInfo.IsReplacementTextValid(replacementText);
}
public async Task<IInlineRenameReplacementInfo> GetReplacementsAsync(string replacementText, OptionSet optionSet, CancellationToken cancellationToken)
{
var newSolution = _oldSolution;
foreach (var group in Locations.GroupBy(l => l.Document))
{
var document = group.Key;
var oldSource = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
var newSource = oldSource.WithChanges(group.Select(l => new TextChange(l.TextSpan, replacementText)));
newSolution = newSolution.WithDocumentText(document.Id, newSource);
}
return new InlineRenameReplacementInfo(this, newSolution, replacementText);
}
private class InlineRenameReplacementInfo : IInlineRenameReplacementInfo
{
private readonly InlineRenameLocationSet _inlineRenameLocationSet;
private readonly string _replacementText;
public InlineRenameReplacementInfo(InlineRenameLocationSet inlineRenameLocationSet, Solution newSolution, string replacementText)
{
NewSolution = newSolution;
_inlineRenameLocationSet = inlineRenameLocationSet;
_replacementText = replacementText;
}
public Solution NewSolution { get; }
public IEnumerable<DocumentId> DocumentIds => _inlineRenameLocationSet.Locations.Select(l => l.Document.Id).Distinct();
public bool ReplacementTextValid => _inlineRenameLocationSet.IsReplacementTextValid(_replacementText);
public IEnumerable<TextSpan> GetConflictSpans(DocumentId documentId)
{
yield break;
}
public IEnumerable<InlineRenameReplacement> GetReplacements(DocumentId documentId)
{
yield break;
}
}
}
}
}
}
| 41.566327 | 166 | 0.613109 | [
"Apache-2.0"
] | AArnott/roslyn | src/VisualStudio/Xaml/Impl/Features/InlineRename/XamlEditorInlineRenameService.cs | 8,149 | C# |
using MediatR;
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.JsonRpc.Generation;
// ReSharper disable once CheckNamespace
namespace OmniSharp.Extensions.DebugAdapter.Protocol
{
namespace Requests
{
[Parallel]
[Method(RequestNames.BreakpointLocations, Direction.ClientToServer)]
[
GenerateHandler,
GenerateHandlerMethods,
GenerateRequestMethods
]
public record BreakpointLocationsArguments : IRequest<BreakpointLocationsResponse>
{
/// <summary>
/// The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified.
/// </summary>
public Source Source { get; init; }
/// <summary>
/// Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line.
/// </summary>
public int Line { get; init; }
/// <summary>
/// Optional start column of range to search possible breakpoint locations in. If no start column is given, the first column in the start line is assumed.
/// </summary>
[Optional]
public int? Column { get; init; }
/// <summary>
/// Optional end line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line.
/// </summary>
[Optional]
public int? EndLine { get; init; }
/// <summary>
/// Optional end column of range to search possible breakpoint locations in. If no end column is given, then it is assumed to be in the last column of the end line.
/// </summary>
[Optional]
public int? EndColumn { get; init; }
}
public record BreakpointLocationsResponse
{
/// <summary>
/// Sorted set of possible breakpoint locations.
/// </summary>
public Container<BreakpointLocation> Breakpoints { get; init; }
}
}
namespace Models
{
public record BreakpointLocation
{
/// <summary>
/// Start line of breakpoint location.
/// </summary>
public int Line { get; init; }
/// <summary>
/// Optional start column of breakpoint location.
/// </summary>
[Optional]
public int? Column { get; init; }
/// <summary>
/// Optional end line of breakpoint location if the location covers a range.
/// </summary>
[Optional]
public int? EndLine { get; init; }
/// <summary>
/// Optional end column of breakpoint location if the location covers a range.
/// </summary>
[Optional]
public int? EndColumn { get; init; }
}
}
}
| 35.943182 | 176 | 0.574771 | [
"MIT"
] | Devils-Knight/csharp-language-server-protocol | src/Dap.Protocol/Feature/Requests/BreakpointLocationsFeature.cs | 3,165 | C# |
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FindNReplace.Models;
namespace FindNReplace.Tests
{
[TestClass]
public class ReplacementTests
{
[TestMethod]
public void ReplacementConstructor_CreatesInstanceOfReplacement_Replacement()
{
Replacement newReplacement = new Replacement();
Assert.AreEqual(typeof(Replacement), newReplacement.GetType());
}
[TestMethod]
public void ReplaceWord_ReplacesWordInString_String()
{
Replacement newReplacement = new Replacement();
string sentence = "I'm not a pokeman fan";
string wordToReplace = "pokeman";
string replacementWord = "pokemon";
string result = sentence.Replace(wordToReplace, replacementWord);
Assert.AreEqual(result, "I'm not a pokemon fan");
}
}
} | 29.142857 | 81 | 0.721814 | [
"Unlicense"
] | mikah-mathews/Find-and-Replace | FindNReplace.Tests/ModelTests/Replacement.Tests.cs | 816 | C# |
// <autogenerated>
// This file was generated by T4 code generator Equals.tt.
// Any changes made to this file manually will be lost next time the file is regenerated.
// </autogenerated>
using System;
using System.Linq;
using System.Dynamic;
using System.Collections;
using System.Threading.Tasks;
using static Ramda.NET.Currying;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Ramda.NET
{
public static partial class R
{
/// <summary>
/// Returns `true` if its arguments are equivalent, `false` otherwise. Handlescyclical data structures.Dispatches symmetrically to the `equals` methods of both arguments, ifpresent.
/// <para />
/// sig: a -> b -> Boolean
/// </summary>
/// <param name="a">first</param>
/// <param name="b">second</param>
/// <returns>Boolean</returns>
public static dynamic Equals<TTArget1, TTArget2>(TTArget1 a, TTArget2 b) {
return Currying.Equals(a, b);
}
/// <summary>
/// Returns `true` if its arguments are equivalent, `false` otherwise. Handlescyclical data structures.Dispatches symmetrically to the `equals` methods of both arguments, ifpresent.
/// <para />
/// sig: a -> b -> Boolean
/// </summary>
/// <param name="a">first</param>
/// <param name="b">second</param>
/// <returns>Boolean</returns>
public static dynamic Equals<TTArget2>(RamdaPlaceholder a, TTArget2 b) {
return Currying.Equals(a, b);
}
/// <summary>
/// Returns `true` if its arguments are equivalent, `false` otherwise. Handlescyclical data structures.Dispatches symmetrically to the `equals` methods of both arguments, ifpresent.
/// <para />
/// sig: a -> b -> Boolean
/// </summary>
/// <param name="a">first</param>
/// <param name="b">second</param>
/// <returns>Boolean</returns>
public static dynamic Equals<TTArget1>(TTArget1 a, RamdaPlaceholder b = null) {
return Currying.Equals(a, b);
}
/// <summary>
/// Returns `true` if its arguments are equivalent, `false` otherwise. Handlescyclical data structures.Dispatches symmetrically to the `equals` methods of both arguments, ifpresent.
/// <para />
/// sig: a -> b -> Boolean
/// </summary>
/// <param name="a">first</param>
/// <param name="b">second</param>
/// <returns>Boolean</returns>
public static dynamic Equals(RamdaPlaceholder a = null, RamdaPlaceholder b = null) {
return Currying.Equals(a, b);
}
}
} | 36 | 183 | 0.684494 | [
"MIT"
] | sagifogel/Ramda.NET | Ramda/Equals.cs | 2,414 | C# |
using System;
using static GLESDotNet.GLES2;
using System.Text;
using GLESDotNet.Samples;
namespace HelloTriangle
{
public class HelloTriangleSample : GLApplication
{
private static uint _program;
public static void Main(string[] args)
{
using (var sample = new HelloTriangleSample())
sample.Run();
}
public HelloTriangleSample()
: base("Hello Triangle")
{
}
protected override void Initialize()
{
string vertShader =
@"attribute vec3 vertPosition;
attribute vec3 vertColor;
varying vec3 fragColor;
void main()
{
gl_Position = vec4(vertPosition, 1.0);
fragColor = vertColor;
}";
string fragShader =
@"precision mediump float;
varying vec3 fragColor;
void main()
{
gl_FragColor = vec4(fragColor, 1.0);
}";
uint vertexShader = GLUtils.CompileShader(vertShader, GL_VERTEX_SHADER);
uint fragmentShader = GLUtils.CompileShader(fragShader, GL_FRAGMENT_SHADER);
_program = glCreateProgram();
if (_program == 0)
throw new InvalidOperationException("Failed to create program.");
glAttachShader(_program, vertexShader);
glAttachShader(_program, fragmentShader);
glBindAttribLocation(_program, 0, "vertPosition");
glBindAttribLocation(_program, 1, "vertColor");
GLUtils.LinkProgram(_program);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
}
protected override void Draw()
{
float[] vertPositions = new float[]
{
0.0f, 0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f
};
float[] vertColors = new float[]
{
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f
};
glViewport(0, 0, WindowWidth, WindowHeight);
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(_program);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, vertPositions);
glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, vertColors);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
}
}
| 25.778947 | 88 | 0.54757 | [
"MIT"
] | smack0007/GLESDotNet | samples/HelloTriangle/HelloTriangleSample.cs | 2,451 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Xunit;
namespace System.Runtime.InteropServices
{
public static class MarshalTests
{
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(100)]
public static void AllocHGlobal_Int32_ReadableWritable(int size)
{
IntPtr p = Marshal.AllocHGlobal(size);
Assert.NotEqual(IntPtr.Zero, p);
try
{
WriteBytes(p, size);
VerifyBytes(p, size);
}
finally
{
Marshal.FreeHGlobal(p);
}
}
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(100)]
public static void AllocHGlobal_IntPtr_ReadableWritable(int size)
{
IntPtr p = Marshal.AllocHGlobal((IntPtr)size);
Assert.NotEqual(IntPtr.Zero, p);
try
{
WriteBytes(p, size);
VerifyBytes(p, size);
}
finally
{
Marshal.FreeHGlobal(p);
}
}
[Fact]
public static void ReAllocHGlobal_DataCopied()
{
const int Size = 3;
IntPtr p1 = Marshal.AllocHGlobal((IntPtr)Size);
IntPtr p2 = p1;
try
{
WriteBytes(p1, Size);
int add = 1;
do
{
p2 = Marshal.ReAllocHGlobal(p2, (IntPtr)(Size + add));
VerifyBytes(p2, Size);
add++;
}
while (p2 == p1); // stop once we've validated moved case
}
finally
{
Marshal.FreeHGlobal(p2);
}
}
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(100)]
public static void AllocCoTaskMem_Int32_ReadableWritable(int size)
{
IntPtr p = Marshal.AllocCoTaskMem(size);
Assert.NotEqual(IntPtr.Zero, p);
try
{
WriteBytes(p, size);
VerifyBytes(p, size);
}
finally
{
Marshal.FreeCoTaskMem(p);
}
}
[Fact]
public static void ReAllocCoTaskMem_DataCopied()
{
const int Size = 3;
IntPtr p1 = Marshal.AllocCoTaskMem(Size);
IntPtr p2 = p1;
try
{
WriteBytes(p1, Size);
int add = 1;
do
{
p2 = Marshal.ReAllocCoTaskMem(p2, Size + add);
VerifyBytes(p2, Size);
add++;
}
while (p2 == p1); // stop once we've validated moved case
}
finally
{
Marshal.FreeCoTaskMem(p2);
}
}
private static void WriteBytes(IntPtr p, int length)
{
for (int i = 0; i < length; i++)
{
Marshal.WriteByte(p + i, (byte)i);
}
}
private static void VerifyBytes(IntPtr p, int length)
{
for (int i = 0; i < length; i++)
{
Assert.Equal((byte)i, Marshal.ReadByte(p + i));
}
}
}
}
| 26.69697 | 101 | 0.435017 | [
"MIT"
] | 690486439/corefx | src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs | 3,524 | C# |
using GameModes;
using Movement;
using RuleSets;
using Ship;
using System;
namespace Ship
{
namespace TIEDefender
{
public class CountessRyad : TIEDefender, ISecondEditionPilot
{
public CountessRyad() : base()
{
PilotName = "Countess Ryad";
PilotSkill = 5;
Cost = 34;
IsUnique = true;
PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Elite);
SkinName = "Crimson";
PilotAbilities.Add(new Abilities.CountessRyadAbility());
}
public void AdaptPilotToSecondEdition()
{
PilotSkill = 4;
Cost = 86;
PilotAbilities.RemoveAll(ability => ability is Abilities.CountessRyadAbility);
PilotAbilities.Add(new Abilities.SecondEdition.CountessRyadAbility());
}
}
}
}
namespace Abilities
{
public class CountessRyadAbility : GenericAbility
{
string maneuverKey;
MovementComplexity originalColor;
public override void ActivateAbility()
{
HostShip.OnManeuverIsRevealed += RegisterAskChangeManeuver;
}
public override void DeactivateAbility()
{
HostShip.OnManeuverIsRevealed -= RegisterAskChangeManeuver;
}
protected virtual void RegisterAskChangeManeuver(GenericShip ship)
{
if (HostShip.AssignedManeuver.Bearing == ManeuverBearing.Straight)
{
RegisterAbilityTrigger(TriggerTypes.OnManeuverIsRevealed, AskChangeManeuver);
}
}
protected virtual MovementComplexity GetNewManeuverComplexity()
{
return HostShip.AssignedManeuver.ColorComplexity;
}
protected void AskChangeManeuver(object sender, System.EventArgs e)
{
Messages.ShowInfoToHuman("Countess Ryad: You can change your maneuver to Koiogran turn");
maneuverKey = HostShip.AssignedManeuver.Speed + ".F.R";
originalColor = (HostShip.Maneuvers.ContainsKey(maneuverKey)) ? HostShip.Maneuvers[maneuverKey] : MovementComplexity.None;
HostShip.Maneuvers[maneuverKey] = GetNewManeuverComplexity();
HostShip.Owner.ChangeManeuver((maneuverCode) => {
GameMode.CurrentGameMode.AssignManeuver(maneuverCode);
HostShip.OnMovementFinish += RestoreManuvers;
}, StraightOrKoiogran);
}
private void RestoreManuvers(GenericShip ship)
{
HostShip.OnMovementFinish -= RestoreManuvers;
if (originalColor != MovementComplexity.None)
{
HostShip.Maneuvers[maneuverKey] = originalColor;
}
else
{
HostShip.Maneuvers.Remove(maneuverKey);
}
}
private bool StraightOrKoiogran(string maneuverString)
{
bool result = false;
MovementStruct movementStruct = new MovementStruct(maneuverString);
if (movementStruct.Speed == Selection.ThisShip.AssignedManeuver.ManeuverSpeed &&
(movementStruct.Bearing == ManeuverBearing.Straight ||
movementStruct.Bearing == ManeuverBearing.KoiogranTurn))
{
result = true;
}
return result;
}
}
namespace SecondEdition
{
//While you would execute a straight maneuver, you may increase difficulty of the maeuver. If you do, execute it as a koiogran turn maneuver instead.
public class CountessRyadAbility : Abilities.CountessRyadAbility
{
public override void ActivateAbility()
{
HostShip.BeforeMovementIsExecuted += RegisterAskChangeManeuver;
}
public override void DeactivateAbility()
{
HostShip.BeforeMovementIsExecuted -= RegisterAskChangeManeuver;
}
protected override void RegisterAskChangeManeuver(GenericShip ship)
{
//I have assumed that you can not use this ability if you execute a red maneuver
if (HostShip.AssignedManeuver.ColorComplexity != MovementComplexity.Complex && HostShip.AssignedManeuver.Bearing == ManeuverBearing.Straight)
{
RegisterAbilityTrigger(TriggerTypes.BeforeMovementIsExecuted, AskChangeManeuver);
}
}
protected override MovementComplexity GetNewManeuverComplexity()
{
if (HostShip.AssignedManeuver.ColorComplexity == MovementComplexity.Complex)
throw new Exception("Can't increase difficulty of red maneuvers");
return HostShip.AssignedManeuver.ColorComplexity + 1;
}
}
}
}
| 34.722222 | 157 | 0.5952 | [
"MIT"
] | rpraska/FlyCasual | Assets/Scripts/Model/Ships/TIE Defender/CountessRyad.cs | 5,002 | C# |
/*
* Copyright (c) Dominick Baier, Brock Allen. All rights reserved.
* see license
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core;
using Thinktecture.IdentityServer.Core.Connect.Services;
using Thinktecture.IdentityServer.Core.Services;
using UnitTests.Plumbing;
namespace UnitTests.Validation_Tests.TokenRequest_Validation
{
[TestClass]
public class TokenRequestValidation_AssertionFlow_Invalid
{
const string Category = "TokenRequest Validation - AssertionFlow - Invalid";
ILogger _logger = new DebugLogger();
ICoreSettings _settings = new TestSettings();
IAssertionGrantValidator _assertionValidator = new TestAssertionValidator();
[TestMethod]
[TestCategory(Category)]
public async Task Invalid_GrantType_For_Client()
{
var client = await _settings.FindClientByIdAsync("client");
var validator = ValidatorFactory.CreateTokenValidator(_settings, _logger);
var parameters = new NameValueCollection();
parameters.Add(Constants.TokenRequest.GrantType, "assertionType");
parameters.Add(Constants.TokenRequest.Assertion, "assertion");
parameters.Add(Constants.TokenRequest.Scope, "resource");
var result = await validator.ValidateRequestAsync(parameters, client);
Assert.IsTrue(result.IsError);
Assert.AreEqual(Constants.TokenErrors.UnauthorizedClient, result.Error);
}
[TestMethod]
[TestCategory(Category)]
public async Task Missing_Assertion()
{
var client = await _settings.FindClientByIdAsync("assertionclient");
var validator = ValidatorFactory.CreateTokenValidator(_settings, _logger,
assertionGrantValidator: _assertionValidator);
var parameters = new NameValueCollection();
parameters.Add(Constants.TokenRequest.GrantType, "assertionType");
parameters.Add(Constants.TokenRequest.Scope, "resource");
var result = await validator.ValidateRequestAsync(parameters, client);
Assert.IsTrue(result.IsError);
Assert.AreEqual(Constants.TokenErrors.UnsupportedGrantType, result.Error);
}
[TestMethod]
[TestCategory(Category)]
public async Task Invalid_Assertion()
{
var client = await _settings.FindClientByIdAsync("assertionclient");
var validator = ValidatorFactory.CreateTokenValidator(_settings, _logger,
assertionGrantValidator: _assertionValidator);
var parameters = new NameValueCollection();
parameters.Add(Constants.TokenRequest.GrantType, "unknownAssertionType");
parameters.Add(Constants.TokenRequest.Assertion, "unknownAssertion");
parameters.Add(Constants.TokenRequest.Scope, "resource");
var result = await validator.ValidateRequestAsync(parameters, client);
Assert.IsTrue(result.IsError);
Assert.AreEqual(Constants.TokenErrors.InvalidGrant, result.Error);
}
}
} | 39.753086 | 86 | 0.693478 | [
"BSD-3-Clause"
] | ascoro/Thinktecture.IdentityServer.v3.Fork | source/Tests/UnitTests/Validation Tests/TokenRequest Validation/TokenRequestValidation_AssertionFlow_Invalid.cs | 3,222 | C# |
using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Soap;
using System.IO;
using System.Net;
namespace lab_45_streaming
{
class Program
{
static List<Customer> customers = new List<Customer>();
//Deserialize to list
static List<Customer> customersFromXML = new List<Customer>();
static void Main(string[] args)
{
var customer01 = new Customer()
{
CustomerID = "ALFKI",
ContactName = "Fred",
CompanyName = "Sparta",
City = "Berlin"
};
var customer02 = new Customer()
{
CustomerID = "BOB22",
ContactName = "Bob",
CompanyName = "Sparta",
City = "Berlin"
};
var customer03 = new Customer()
{
CustomerID = "CHAR1",
ContactName = "Charles",
CompanyName = "Sparta",
City = "Berlin"
};
customers.Add(customer01);
customers.Add(customer02);
customers.Add(customer03);
//LIST
//Serialize to XML, JSON and BINARY
var formatter = new SoapFormatter();
//Save to FILE ('Stream' to file system)
using (var stream = new FileStream("data.xml", FileMode.Create, FileAccess.Write))
{
formatter.Serialize(stream, customers);
}
//Run code and see visually the output
Console.WriteLine(File.ReadAllText("data.xml"));
//Reverse Process ==> Tsream Back and deserialize data
//open file as a stream
using (var reader = File.OpenRead("data.xml"))
{
//Deserialize to list
customersFromXML = formatter.Deserialize(reader) as List<Customer>;
}
//Print out List
customersFromXML.ForEach(c => {
Console.WriteLine($"{c.CustomerID,-15}" +
$"{c.ContactName,-20} {c.City}");
});
//REPEAT SIMULATE STREAMING FROM INTERNET
//for the sake of time: easy version: synchronous (not async)
var getHTMLdata =
WebRequest.Create("https://raw.githubusercontent.com/philanderson888/data/master/Customers.xml");
getHTMLdata.Proxy = null;
//get web response from request to that url
using (var webresponse = getHTMLdata.GetResponse())
{
//STREAM DATA IN BECAUSE IT COULD BE LARGE FILE, NO IDEA SIZE
using (var webstream = webresponse.GetResponseStream())
{
//Get web stream above;now new stream to stream to local file system for processing
using (var filestream = File.Create("CustomersFromWeb.xml"))
{
webstream.CopyTo(filestream);
}
}
}
using (var reader2 = File.OpenRead("CustomersFromWeb.xml"))
{
//Deserialize to list
customersFromXML = formatter.Deserialize(reader2) as List<Customer>;
}
//Print out List
Console.WriteLine("CUSTOMERS FROM WEB");
customersFromXML.ForEach(c => {
Console.WriteLine($"{c.CustomerID,-15}" +
$"{c.ContactName,-20} {c.City}");
});
}
}
[Serializable]
class Customer
{
//[NonSerialized]
private string NINO;
public string CustomerID { get; set;}
public string ContactName { get; set;}
public string CompanyName { get; set;}
public string City { get; set; }
public Customer()
{
this.NINO = "ABCD";
}
}
} | 33.264463 | 113 | 0.513043 | [
"MIT"
] | TheEletricboy/2019-09-C-sharp-Labs | Labs/lab_45_streaming/Program.cs | 4,027 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LLVM
{
public class Module: ReferenceBase
{
public Module(string name, Context context): base(llvm.CreateModule(name, context))
{
}
internal Module(IntPtr moduleRef):base(moduleRef){}
public Function CreateFunction(string name, FunctionType type)
{
IntPtr func = llvm.CreateFunction(this, name, type);
return new Function(func);
}
public Function GetFunction(string name)
{
IntPtr func = llvm.GetFunction(this, name);
if (func.IsNull()) return null;
return new Function(func);
}
public GlobalValue AddGlobal(Type type, string name, Constant value = null)
{
IntPtr val;
if (value == null) {
val = llvm.AddGlobal(this, type, name);
}else {
IntPtr constant = value;
val = llvm.AddGlobal(this, type, name, constant);
}
return new GlobalValue(val);
}
public Value GetGlobal(string name)
{
IntPtr val = llvm.GetNamedGlobal(this, name);
return val.IsNull()? null: new Value(val);
}
public Context Context
{
get
{
IntPtr context = llvm.GetContext(this);
return new Context(context);
}
}
public Function GetIntrinsic(string name, FunctionType type)
{
var func = this.GetFunction(name);
if (func != null) return func;
func = CreateFunction(name, type);
return func;
}
public Function MemMove32
{
get
{
return GetFunction("llvm.memmove.p0i8.p0i8.i32");
}
}
public Function MemMove64
{
get
{
return GetFunction("llvm.memmove.p0i8.p0i8.i64");
}
}
public Type Void
{
get
{
return Type.GetVoid(Context);
}
}
public PointerType PVoid
{
get
{
return PointerType.Get(Type.GetVoid(Context));
}
}
}
}
| 19.625 | 86 | 0.625796 | [
"MIT"
] | lostmsu/LLVM.NET | LLVM/Structure/Module.cs | 1,886 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Titanium.Web.Proxy.Models;
namespace Titanium.Web.Proxy.Helpers
{
internal class ProxyInfo
{
internal ProxyInfo(bool? autoDetect, string autoConfigUrl, int? proxyEnable, string proxyServer,
string proxyOverride)
{
AutoDetect = autoDetect;
AutoConfigUrl = autoConfigUrl;
ProxyEnable = proxyEnable;
ProxyServer = proxyServer;
ProxyOverride = proxyOverride;
if (proxyServer != null)
{
Proxies = GetSystemProxyValues(proxyServer).ToDictionary(x => x.ProtocolType);
}
if (proxyOverride != null)
{
var overrides = proxyOverride.Split(';');
var overrides2 = new List<string>();
foreach (string overrideHost in overrides)
{
if (overrideHost == "<-loopback>")
{
BypassLoopback = true;
}
else if (overrideHost == "<local>")
{
BypassOnLocal = true;
}
else
{
overrides2.Add(bypassStringEscape(overrideHost));
}
}
if (overrides2.Count > 0)
{
BypassList = overrides2.ToArray();
}
Proxies = GetSystemProxyValues(proxyServer).ToDictionary(x => x.ProtocolType);
}
}
internal bool? AutoDetect { get; }
internal string AutoConfigUrl { get; }
internal int? ProxyEnable { get; }
internal string ProxyServer { get; }
internal string ProxyOverride { get; }
internal bool BypassLoopback { get; }
internal bool BypassOnLocal { get; }
internal Dictionary<ProxyProtocolType, HttpSystemProxyValue> Proxies { get; }
internal string[] BypassList { get; }
private static string bypassStringEscape(string rawString)
{
var match =
new Regex("^(?<scheme>.*://)?(?<host>[^:]*)(?<port>:[0-9]{1,5})?$",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Match(rawString);
string empty1;
string rawString1;
string empty2;
if (match.Success)
{
empty1 = match.Groups["scheme"].Value;
rawString1 = match.Groups["host"].Value;
empty2 = match.Groups["port"].Value;
}
else
{
empty1 = string.Empty;
rawString1 = rawString;
empty2 = string.Empty;
}
string str1 = convertRegexReservedChars(empty1);
string str2 = convertRegexReservedChars(rawString1);
string str3 = convertRegexReservedChars(empty2);
if (str1 == string.Empty)
{
str1 = "(?:.*://)?";
}
if (str3 == string.Empty)
{
str3 = "(?::[0-9]{1,5})?";
}
return "^" + str1 + str2 + str3 + "$";
}
private static string convertRegexReservedChars(string rawString)
{
if (rawString.Length == 0)
{
return rawString;
}
var stringBuilder = new StringBuilder();
foreach (char ch in rawString)
{
if ("#$()+.?[\\^{|".IndexOf(ch) != -1)
{
stringBuilder.Append('\\');
}
else if (ch == 42)
{
stringBuilder.Append('.');
}
stringBuilder.Append(ch);
}
return stringBuilder.ToString();
}
internal static ProxyProtocolType? ParseProtocolType(string protocolTypeStr)
{
if (protocolTypeStr == null)
{
return null;
}
ProxyProtocolType? protocolType = null;
if (protocolTypeStr.Equals(Proxy.ProxyServer.UriSchemeHttp, StringComparison.InvariantCultureIgnoreCase))
{
protocolType = ProxyProtocolType.Http;
}
else if (protocolTypeStr.Equals(Proxy.ProxyServer.UriSchemeHttps,
StringComparison.InvariantCultureIgnoreCase))
{
protocolType = ProxyProtocolType.Https;
}
return protocolType;
}
/// <summary>
/// Parse the system proxy setting values
/// </summary>
/// <param name="proxyServerValues"></param>
/// <returns></returns>
internal static List<HttpSystemProxyValue> GetSystemProxyValues(string proxyServerValues)
{
var result = new List<HttpSystemProxyValue>();
if (string.IsNullOrWhiteSpace(proxyServerValues))
{
return result;
}
var proxyValues = proxyServerValues.Split(';');
if (proxyValues.Length > 0)
{
result.AddRange(proxyValues.Select(parseProxyValue).Where(parsedValue => parsedValue != null));
}
else
{
var parsedValue = parseProxyValue(proxyServerValues);
if (parsedValue != null)
{
result.Add(parsedValue);
}
}
return result;
}
/// <summary>
/// Parses the system proxy setting string
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
private static HttpSystemProxyValue parseProxyValue(string value)
{
string tmp = Regex.Replace(value, @"\s+", " ").Trim();
int equalsIndex = tmp.IndexOf("=", StringComparison.InvariantCulture);
if (equalsIndex >= 0)
{
string protocolTypeStr = tmp.Substring(0, equalsIndex);
var protocolType = ParseProtocolType(protocolTypeStr);
if (protocolType.HasValue)
{
var endPointParts = tmp.Substring(equalsIndex + 1).Split(':');
return new HttpSystemProxyValue
{
HostName = endPointParts[0],
Port = int.Parse(endPointParts[1]),
ProtocolType = protocolType.Value
};
}
}
return null;
}
}
}
| 31.182648 | 117 | 0.487333 | [
"MIT"
] | AllenSlayz/DDD | src/Titanium.Web.Proxy/Helpers/ProxyInfo.cs | 6,831 | C# |
using Abp.AspNetCore.Mvc.Controllers;
using Abp.IdentityFramework;
using Microsoft.AspNetCore.Identity;
namespace FirstBoilerPlateApp.Controllers
{
public abstract class FirstBoilerPlateAppControllerBase: AbpController
{
protected FirstBoilerPlateAppControllerBase()
{
LocalizationSourceName = FirstBoilerPlateAppConsts.LocalizationSourceName;
}
protected void CheckErrors(IdentityResult identityResult)
{
identityResult.CheckErrors(LocalizationManager);
}
}
}
| 27.35 | 86 | 0.731261 | [
"MIT"
] | TeeGeorge/BoilerPlate | aspnet-core/src/FirstBoilerPlateApp.Web.Core/Controllers/FirstBoilerPlateAppControllerBase.cs | 547 | C# |
using System.Collections.Generic;
using AntDesign;
namespace Newcats.JobManager.Blazor.Pages.Account.Settings
{
public partial class Index
{
private readonly Dictionary<string, string> _menuMap = new Dictionary<string, string>
{
{"base", "Basic Settings"},
{"security", "Security Settings"},
{"binding", "Account Binding"},
{"notification", "New Message Notification"},
};
private string _selectKey = "base";
private void SelectKey(MenuItem item)
{
_selectKey = item.Key;
}
}
} | 26.434783 | 93 | 0.592105 | [
"MIT"
] | newcatshuang/JobManager | src/Newcats.JobManager.Blazor/Pages/Account/Settings/Index.razor.cs | 608 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace ViceCity.Models.Players
{
public class CivilPlayer : Player
{
private const int InitialLifePoint = 50;
public CivilPlayer(string name)
: base(name, InitialLifePoint)
{
}
}
}
| 18.235294 | 48 | 0.635484 | [
"MIT"
] | BorislavVladimirov/C-Software-University | C# OOP June 2019/C#OOPExam/Project-Skeleton/ViceCity/Models/Players/CivilPlayer.cs | 312 | C# |
namespace Recipes.PartialUpdate
{
public interface IEmployeeClassification
{
int EmployeeClassificationKey { get; set; }
string? EmployeeClassificationName { get; set; }
bool IsExempt { get; set; }
bool IsEmployee { get; set; }
}
}
| 25.090909 | 56 | 0.641304 | [
"Unlicense"
] | lukevp/DotNet-ORM-Cookbook | ORM Cookbook/Recipes.Core/PartialUpdate/IEmployeeClassification.cs | 276 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Models
{
public class PageModel
{
}
}
| 14.214286 | 36 | 0.738693 | [
"Apache-2.0"
] | 454313500/CC.Yi | Yi.Framework.Net5/Yi.Framework.Common/Models/PageModel.cs | 201 | C# |
using System;
namespace ShellAppWPF.Models
{
public class Item
{
public string Id { get; set; }
public string Text { get; set; }
public string Description { get; set; }
}
} | 19.090909 | 47 | 0.585714 | [
"MIT"
] | angpysha/Xamarin.Forms.Shell.WPF | ShellAppWPF/ShellAppWPF/Models/Item.cs | 212 | C# |
//******************************************************************************************************
// WelcomePage.xaml.cs - Gbtc
//
// Copyright © 2015, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/eclipse-1.0.php
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 09/07/2010 - Stephen C. Wills
// Generated original version of source code.
// 09/19/2010 - J. Ritchie Carroll
// Added code to cache 64-bit installation state when passed as a command line argument
//
//******************************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
namespace ConfigurationSetupUtility.Screens
{
/// <summary>
/// Interaction logic for WelcomePage.xaml
/// </summary>
public partial class WelcomeScreen : UserControl, IScreen
{
#region [ Members ]
// Fields
private IScreen m_nextPage;
private Dictionary<string, object> m_state;
#endregion
#region [ Constructors ]
/// <summary>
/// Creates a new instance of the <see cref="WelcomeScreen"/> class.
/// </summary>
public WelcomeScreen()
{
InitializeComponent();
m_nextPage = new ExistingConfigurationScreen();
}
#endregion
#region [ Properties ]
/// <summary>
/// Gets the screen to be displayed when the user clicks the "Next" button.
/// </summary>
public IScreen NextScreen
{
get
{
return m_nextPage;
}
}
/// <summary>
/// Gets a boolean indicating whether the user can advance to
/// the next screen from the current screen.
/// </summary>
public bool CanGoForward
{
get
{
return true;
}
}
/// <summary>
/// Gets a boolean indicating whether the user can return to
/// the previous screen from the current screen.
/// </summary>
public bool CanGoBack
{
get
{
return false;
}
}
/// <summary>
/// Gets a boolean indicating whether the user can cancel the
/// setup process from the current screen.
/// </summary>
public bool CanCancel
{
get
{
return true;
}
}
/// <summary>
/// Gets a boolean indicating whether the user input is valid on the current page.
/// </summary>
public bool UserInputIsValid
{
get
{
return true;
}
}
/// <summary>
/// Collection shared among screens that represents the state of the setup.
/// </summary>
public Dictionary<string, object> State
{
get
{
return m_state;
}
set
{
m_state = value;
InitializeWelcomeMessage();
}
}
/// <summary>
/// Allows the screen to update the navigation buttons after a change is made
/// that would affect the user's ability to navigate to other screens.
/// </summary>
public Action UpdateNavigation { get; set; }
#endregion
#region [ Methods ]
// Initializes the welcome message based on the existence of the -install flag.
private void InitializeWelcomeMessage()
{
string[] args = Environment.GetCommandLineArgs();
bool installFlag = args.Contains("-install", StringComparer.CurrentCultureIgnoreCase);
if (m_state != null)
m_state["64bit"] = args.Contains("-64bit", StringComparer.CurrentCultureIgnoreCase);
if (installFlag)
m_welcomeMessageTextBlock.Text = "You now need to set up the openMIC configuration.\r\n";
else
m_welcomeMessageTextBlock.Text = "";
m_welcomeMessageTextBlock.Text += "\r\nThis wizard will walk you through the needed steps so you can easily set up your system configuration.";
// The historian setup screen takes time to load because of DLL scanning, so we cache it at startup
if (m_state != null)
m_state["historianSetupScreen"] = new HistorianSetupScreen();
}
#endregion
}
}
| 31.549133 | 155 | 0.541957 | [
"MIT"
] | GridProtectionAlliance/MIDAS | Source/Tools/ConfigurationSetupUtility/Screens/WelcomeScreen.xaml.cs | 5,461 | C# |
using System;
using System.Xml.Serialization;
using System.ComponentModel.DataAnnotations;
using BroadWorksConnector.Ocip.Validation;
using System.Collections.Generic;
namespace BroadWorksConnector.Ocip.Models
{
/// <summary>
/// Remove a Diameter peer. A peer cannot be removed if is referenced by a Realm Routing Table entry.
/// The response is either a SuccessResponse or an ErrorResponse.
/// <see cref="SuccessResponse"/>
/// <see cref="ErrorResponse"/>
/// </summary>
[Serializable]
[XmlRoot(Namespace = "")]
[Groups(@"[{""__type"":""Sequence:#BroadWorksConnector.Ocip.Validation"",""id"":""7f663d5135470c33ca64b0eed3c3aa0c:2730""}]")]
public class SystemBwDiameterPeerDeleteRequest : BroadWorksConnector.Ocip.Models.C.OCIRequest<BroadWorksConnector.Ocip.Models.C.SuccessResponse>
{
private BroadWorksConnector.Ocip.Models.BwDiameterPeerInstance _instance;
[XmlElement(ElementName = "instance", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:2730")]
public BroadWorksConnector.Ocip.Models.BwDiameterPeerInstance Instance
{
get => _instance;
set
{
InstanceSpecified = true;
_instance = value;
}
}
[XmlIgnore]
protected bool InstanceSpecified { get; set; }
private string _identity;
[XmlElement(ElementName = "identity", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:2730")]
[MinLength(1)]
[MaxLength(80)]
public string Identity
{
get => _identity;
set
{
IdentitySpecified = true;
_identity = value;
}
}
[XmlIgnore]
protected bool IdentitySpecified { get; set; }
}
}
| 31.65 | 148 | 0.626646 | [
"MIT"
] | cwmiller/broadworks-connector-net | BroadworksConnector/Ocip/Models/SystemBwDiameterPeerDeleteRequest.cs | 1,899 | C# |
// Copyright (c) Josef Pihrt. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Roslynator.Extensions;
namespace Roslynator.CSharp.Refactorings
{
internal static class MergeLocalDeclarationsRefactoring
{
public static async Task ComputeRefactoringsAsync(RefactoringContext context, SelectedStatementCollection selectedStatements)
{
if (selectedStatements.IsMultiple)
{
SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);
if (AreLocalDeclarations(selectedStatements, semanticModel, context.CancellationToken))
{
context.RegisterRefactoring(
"Merge local declarations",
cancellationToken =>
{
return RefactorAsync(
context.Document,
selectedStatements.Container,
selectedStatements.Cast<LocalDeclarationStatementSyntax>().ToArray(),
cancellationToken);
});
}
}
}
private static bool AreLocalDeclarations(
IEnumerable<StatementSyntax> statements,
SemanticModel semanticModel,
CancellationToken cancellationToken)
{
ITypeSymbol prevTypeSymbol = null;
using (IEnumerator<StatementSyntax> en = statements.GetEnumerator())
{
while (en.MoveNext())
{
if (!en.Current.IsKind(SyntaxKind.LocalDeclarationStatement))
return false;
var localDeclaration = (LocalDeclarationStatementSyntax)en.Current;
TypeSyntax type = localDeclaration.Declaration?.Type;
if (type == null)
return false;
ITypeSymbol typeSymbol = semanticModel.GetTypeSymbol(type, cancellationToken);
if (typeSymbol == null || typeSymbol.IsErrorType())
return false;
if (prevTypeSymbol != null && prevTypeSymbol != typeSymbol)
return false;
prevTypeSymbol = typeSymbol;
}
}
return true;
}
private static async Task<Document> RefactorAsync(
Document document,
StatementContainer container,
LocalDeclarationStatementSyntax[] localDeclarations,
CancellationToken cancellationToken = default(CancellationToken))
{
LocalDeclarationStatementSyntax localDeclaration = localDeclarations[0];
SyntaxList<StatementSyntax> statements = container.Statements;
int index = statements.IndexOf(localDeclaration);
VariableDeclaratorSyntax[] variables = localDeclarations
.Skip(1)
.Select(f => f.Declaration)
.SelectMany(f => f.Variables)
.ToArray();
LocalDeclarationStatementSyntax newLocalDeclaration = localDeclaration
.AddDeclarationVariables(variables)
.WithTrailingTrivia(localDeclarations[localDeclarations.Length - 1].GetTrailingTrivia())
.WithFormatterAnnotation();
SyntaxList<StatementSyntax> newStatements = statements.Replace(
localDeclaration,
newLocalDeclaration);
for (int i = 1; i < localDeclarations.Length; i++)
newStatements = newStatements.RemoveAt(index + 1);
return await document.ReplaceNodeAsync(
container.Node,
container.NodeWithStatements(newStatements),
cancellationToken).ConfigureAwait(false);
}
}
}
| 38.144144 | 160 | 0.588333 | [
"Apache-2.0"
] | MarcosMeli/Roslynator | source/Refactorings/Refactorings/MergeLocalDeclarationsRefactoring.cs | 4,236 | C# |
namespace WorkOS
{
using Newtonsoft.Json;
/// <summary>
/// Contains information about a WorkOS Organization record.
/// </summary>
public class Organization
{
/// <summary>
/// Description of the record.
/// </summary>
[JsonProperty("object")]
public const string Object = "organization";
/// <summary>
/// The Organization's identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }
/// <summary>
/// The Organization's name.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Whether Connections within the Organization allow profiles that are
/// outside of the Organization's configured User Email Domains.
/// </summary>
[JsonProperty("allow_profiles_outside_organization")]
public bool AllowProfilesOutsideOrganization { get; set; }
/// <summary>
/// The Organization's domains.
/// </summary>
[JsonProperty("domains")]
public OrganizationDomain[] Domains { get; set; }
/// <summary>
/// The timestamp of when the Organization was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
/// <summary>
/// The timestamp of when the Organization was updated.
/// </summary>
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}
}
| 29.037037 | 79 | 0.560587 | [
"MIT"
] | workos-inc/workos-dotnet | src/WorkOS.net/Services/Organizations/Entities/Organization.cs | 1,570 | C# |
// c:\program files (x86)\windows kits\10\include\10.0.18362.0\um\dxva.h(1832,9)
using System;
namespace DirectN
{
[Flags]
public enum _DXVA_DestinationFlags
{
DXVA_DestinationFlagMask = 0x0000000F,
DXVA_DestinationFlag_Background_Changed = 0x00000001,
DXVA_DestinationFlag_TargetRect_Changed = 0x00000002,
DXVA_DestinationFlag_ColorData_Changed = 0x00000004,
DXVA_DestinationFlag_Alpha_Changed = 0x00000008,
}
}
| 29.4375 | 81 | 0.732484 | [
"MIT"
] | bbday/DirectN | DirectN/DirectN/Generated/_DXVA_DestinationFlags.cs | 473 | C# |
using Microsoft.AspNetCore.Mvc;
namespace SimpleSocial.Web.Controllers
{
public class BaseController : Controller
{
}
}
| 13.8 | 44 | 0.702899 | [
"MIT"
] | ctsmohanreddy072/socialnetwork-core | src/SimpleSocial/Web/SimpleSocial.Web/Controllers/BaseController.cs | 140 | C# |
using Lab17CreateAnAPI.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Lab17CreateAnAPI.Data
{
public class TodoDbContext : DbContext
{
public TodoDbContext(DbContextOptions<TodoDbContext> options) : base(options)
{
}
public DbSet<TodoItem> TodoItems { get; set; }
public DbSet<TodoList> TodoLists { get; set; }
}
}
| 23.047619 | 85 | 0.694215 | [
"MIT"
] | jimmychang94/Lab17CreateAnAPI | Lab17CreateAnAPI/Lab17CreateAnAPI/Data/TodoDbContext.cs | 486 | C# |
using System;
using System.Text.Json;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NHSD.GPIT.BuyingCatalogue.EntityFramework.Addresses.Models;
using NHSD.GPIT.BuyingCatalogue.EntityFramework.Organisations.Models;
namespace NHSD.GPIT.BuyingCatalogue.EntityFramework.Organisations.Configuration
{
internal sealed class OrganisationEntityTypeConfiguration : IEntityTypeConfiguration<Organisation>
{
public void Configure(EntityTypeBuilder<Organisation> builder)
{
builder.ToTable("Organisations", Schemas.Organisations);
builder.HasKey(o => o.Id);
builder.Property(o => o.Address)
.HasConversion(
a => JsonSerializer.Serialize(a, (JsonSerializerOptions)null),
a => JsonSerializer.Deserialize<Address>(a, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }));
builder.Property(o => o.Id).ValueGeneratedOnAdd();
builder.Property(o => o.LastUpdated).HasDefaultValue(DateTime.UtcNow);
builder.Property(o => o.Name)
.IsRequired()
.HasMaxLength(255);
builder.Property(o => o.OdsCode).HasMaxLength(8);
builder.Property(o => o.PrimaryRoleId).HasMaxLength(8);
builder.HasIndex(o => o.Name, "AK_Organisations_Name")
.IsUnique();
builder.HasOne(o => o.LastUpdatedByUser)
.WithMany()
.HasForeignKey(o => o.LastUpdatedBy)
.HasConstraintName("FK_Organisations_LastUpdatedBy");
}
}
}
| 39.238095 | 131 | 0.652913 | [
"MIT"
] | nhs-digital-gp-it-futures/GPITBuyingCatalogue | src/NHSD.GPIT.BuyingCatalogue.EntityFramework/Organisations/Configuration/OrganisationEntityTypeConfiguration.cs | 1,650 | C# |
/* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
*
* ***************************************************************************/
#if CLR2
using dynamic = System.Object;
#endif
using System;
using System.IO;
using System.Diagnostics;
using System.Runtime.Remoting;
using System.Dynamic;
using System.Security.Permissions;
using System.Text;
using Microsoft.Scripting.Utils;
using Microsoft.Scripting.Runtime;
namespace Microsoft.Scripting.Hosting {
/// <summary>
/// Hosting counterpart for <see cref="SourceUnit"/>.
/// </summary>
[DebuggerDisplay("{Path ?? \"<anonymous>\"}")]
public sealed class ScriptSource
#if !SILVERLIGHT
: MarshalByRefObject
#endif
{
private readonly ScriptEngine _engine;
private readonly SourceUnit _unit;
internal SourceUnit SourceUnit {
get { return _unit; }
}
/// <summary>
/// Identification of the source unit. Assigned by the host.
/// The format and semantics is host dependent (could be a path on file system or URL).
/// <c>null</c> for anonymous script source.
/// Cannot be an empty string.
/// </summary>
public string Path {
get { return _unit.Path; }
}
public SourceCodeKind Kind {
get { return _unit.Kind; }
}
public ScriptEngine Engine {
get { return _engine; }
}
internal ScriptSource(ScriptEngine engine, SourceUnit sourceUnit) {
Assert.NotNull(engine, sourceUnit);
_unit = sourceUnit;
_engine = engine;
}
#region Compilation and Execution
/// <summary>
/// Compile the ScriptSource into CompileCode object that can be executed
/// repeatedly in its default scope or in other scopes without having to recompile the code.
/// </summary>
/// <exception cref="SyntaxErrorException">Code cannot be compiled.</exception>
public CompiledCode Compile() {
return CompileInternal(null, null);
}
/// <remarks>
/// Errors are reported to the specified listener.
/// Returns <c>null</c> if the parser cannot compile the code due to errors.
/// </remarks>
public CompiledCode Compile(ErrorListener errorListener) {
ContractUtils.RequiresNotNull(errorListener, "errorListener");
return CompileInternal(null, errorListener);
}
/// <remarks>
/// Errors are reported to the specified listener.
/// Returns <c>null</c> if the parser cannot compile the code due to error(s).
/// </remarks>
public CompiledCode Compile(CompilerOptions compilerOptions) {
ContractUtils.RequiresNotNull(compilerOptions, "compilerOptions");
return CompileInternal(compilerOptions, null);
}
/// <remarks>
/// Errors are reported to the specified listener.
/// Returns <c>null</c> if the parser cannot compile the code due to error(s).
/// </remarks>
public CompiledCode Compile(CompilerOptions compilerOptions, ErrorListener errorListener) {
ContractUtils.RequiresNotNull(errorListener, "errorListener");
ContractUtils.RequiresNotNull(compilerOptions, "compilerOptions");
return CompileInternal(compilerOptions, errorListener);
}
private CompiledCode CompileInternal(CompilerOptions compilerOptions, ErrorListener errorListener) {
ErrorSink errorSink = new ErrorListenerProxySink(this, errorListener);
ScriptCode code = compilerOptions != null ? _unit.Compile(compilerOptions, errorSink) : _unit.Compile(errorSink);
return (code != null) ? new CompiledCode(_engine, code) : null;
}
/// <summary>
/// Executes the code in the specified scope.
/// Returns an object that is the resulting value of running the code.
///
/// When the ScriptSource is a file or statement, the engine decides what is
/// an appropriate value to return. Some languages return the value produced
/// by the last expression or statement, but languages that are not expression
/// based may return null.
/// </summary>
/// <exception cref="SyntaxErrorException">Code cannot be compiled.</exception>
public dynamic Execute(ScriptScope scope) {
ContractUtils.RequiresNotNull(scope, "scope");
return _unit.Execute(scope.Scope);
}
/// <summary>
/// Executes the source code. The execution is not bound to any particular scope.
/// </summary>
public dynamic Execute() {
// The host doesn't need the scope so do not create it here.
// The language can treat the code as not bound to a DLR scope and change global lookup semantics accordingly.
return _unit.Execute();
}
/// <summary>
/// Executes the code in a specified scope and converts the result to the specified type.
/// The conversion is language specific.
/// </summary>
public T Execute<T>(ScriptScope scope) {
return _engine.Operations.ConvertTo<T>((object)Execute(scope));
}
/// <summary>
/// Executes the code in an empty scope and converts the result to the specified type.
/// The conversion is language specific.
/// </summary>
public T Execute<T>() {
return _engine.Operations.ConvertTo<T>((object)Execute());
}
#if !SILVERLIGHT
/// <summary>
/// Executes the code in an empty scope.
/// Returns an ObjectHandle wrapping the resulting value of running the code.
/// </summary>
public ObjectHandle ExecuteAndWrap() {
return new ObjectHandle((object)Execute());
}
/// <summary>
/// Executes the code in the specified scope.
/// Returns an ObjectHandle wrapping the resulting value of running the code.
/// </summary>
public ObjectHandle ExecuteAndWrap(ScriptScope scope) {
return new ObjectHandle((object)Execute(scope));
}
/// <summary>
/// Executes the code in an empty scope.
/// Returns an ObjectHandle wrapping the resulting value of running the code.
///
/// If an exception is thrown the exception is caught and an ObjectHandle to
/// the exception is provided.
/// </summary>
/// <remarks>
/// Use this API to handle non-serializable exceptions (exceptions might not be serializable due to security restrictions)
/// or if an exception serialization loses information.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public ObjectHandle ExecuteAndWrap(out ObjectHandle exception) {
exception = null;
try {
return new ObjectHandle((object)Execute());
} catch (Exception e) {
exception = new ObjectHandle(e);
return null;
}
}
/// <summary>
/// Executes the expression in the specified scope and return a result.
/// Returns an ObjectHandle wrapping the resulting value of running the code.
///
/// If an exception is thrown the exception is caught and an ObjectHandle to
/// the exception is provided.
/// </summary>
/// <remarks>
/// Use this API to handle non-serializable exceptions (exceptions might not be serializable due to security restrictions)
/// or if an exception serialization loses information.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public ObjectHandle ExecuteAndWrap(ScriptScope scope, out ObjectHandle exception) {
exception = null;
try {
return new ObjectHandle((object)Execute(scope));
} catch (Exception e) {
exception = new ObjectHandle(e);
return null;
}
}
#endif
/// <summary>
/// Runs a specified code as if it was a program launched from OS command shell.
/// and returns a process exit code indicating the success or error condition
/// of executing the code.
///
/// Exact behavior depends on the language. Some languages have a dedicated "exit" exception that
/// carries the exit code, in which case the exception is cought and the exit code is returned.
/// The default behavior returns the result of program's execution converted to an integer
/// using a language specific conversion.
/// </summary>
/// <exception cref="SyntaxErrorException">Code cannot be compiled.</exception>
public int ExecuteProgram() {
return _unit.LanguageContext.ExecuteProgram(_unit);
}
#endregion
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public ScriptCodeParseResult GetCodeProperties() {
return _unit.GetCodeProperties();
}
public ScriptCodeParseResult GetCodeProperties(CompilerOptions options) {
return _unit.GetCodeProperties(options);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public SourceCodeReader GetReader() {
return _unit.GetReader();
}
/// <summary>
/// Detects the encoding of the content.
/// </summary>
/// <returns>
/// An encoding that is used by the reader of the script source to transcode its content to Unicode text.
/// <c>Null</c> if the content is already textual and no transcoding is performed.
/// </returns>
/// <remarks>
/// Note that the default encoding specified when the script source is created could be overridden by
/// an encoding that is found in the content preamble (Unicode BOM or a language specific encoding preamble).
/// In that case the preamble encoding is returned. Otherwise, the default encoding is returned.
/// </remarks>
/// <exception cref="IOException">An I/O error occurs.</exception>
public Encoding DetectEncoding() {
using (var reader = _unit.GetReader()) {
return reader.Encoding;
}
}
/// <summary>
/// Reads specified range of lines (or less) from the source unit.
/// </summary>
/// <param name="start">1-based number of the first line to fetch.</param>
/// <param name="count">The number of lines to fetch.</param>
/// <remarks>
/// Which character sequences are considered line separators is language specific.
/// If language doesn't specify otherwise "\r", "\n", "\r\n" are recognized line separators.
/// </remarks>
/// <exception cref="IOException">An I/O error occurs.</exception>
public string[] GetCodeLines(int start, int count) {
return _unit.GetCodeLines(start, count);
}
/// <summary>
/// Reads a specified line.
/// </summary>
/// <param name="line">1-based line number.</param>
/// <returns>Line content. Line separator is not included.</returns>
/// <exception cref="IOException">An I/O error occurs.</exception>
/// <remarks>
/// Which character sequences are considered line separators is language specific.
/// If language doesn't specify otherwise "\r", "\n", "\r\n" are recognized line separators.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public string GetCodeLine(int line) {
return _unit.GetCodeLine(line);
}
/// <summary>
/// Gets script source content.
/// </summary>
/// <returns>Entire content.</returns>
/// <exception cref="IOException">An I/O error occurs.</exception>
/// <remarks>
/// The result includes language specific preambles (e.g. "#coding:UTF-8" encoding preamble recognized by Ruby),
/// but not the preamble defined by the content encoding (e.g. BOM).
/// The entire content of the source unit is encoded by single encoding (if it is read from binary stream).
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public string GetCode() {
return _unit.GetCode();
}
// TODO: can this be removed? no one uses it
#region line number mapping
public int MapLine(int line) {
return _unit.MapLine(line);
}
public SourceSpan MapLine(SourceSpan span) {
return new SourceSpan(_unit.MakeLocation(span.Start), _unit.MakeLocation(span.End));
}
public SourceLocation MapLine(SourceLocation location) {
return _unit.MakeLocation(location);
}
// TODO: remove this? we don't support file mapping
// (but it's still in the hosting spec)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "line")]
public string MapLinetoFile(int line) {
return _unit.Path;
}
#endregion
#if !SILVERLIGHT
// TODO: Figure out what is the right lifetime
public override object InitializeLifetimeService() {
return null;
}
#endif
}
}
| 41.598854 | 131 | 0.618474 | [
"MIT"
] | rifraf/IronRuby_Framework_4.7.2 | Runtime/Microsoft.Scripting/Hosting/ScriptSource.cs | 14,518 | C# |
namespace masz.Models
{
public enum CacheBehavior
{
OnlyCache,
Default,
IgnoreCache,
IgnoreButCacheOnError
}
} | 15.4 | 29 | 0.584416 | [
"MIT"
] | BSscripter/discord-masz | backend/masz/Models/CacheBehaviorEnum.cs | 154 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace lm.Comol.Modules.EduPath.Domain
{
public enum EduPathTranslations
{
None=-1,
Path=0,
Unit=1,
Activity=2,
SubActivity=3,
SurnameAndName=4,
Completion=5,
MinCompletion=6,
Mark=7,
MinMark=8,
Status=9,
Name=10,
CompletedPassed=11,
Completed=12,
Passed=13,
Started=14,
NotStarted=15,
ContentType=16,
Quiz=17,
Forum=18,
File=19,
Wiki=20,
Mandatory=21,
Type=22,
LevelType=23,
ParticipantNumber=24,
Weight=25,
Time = 26,
MinTime = 27,
Certification = 28,
FileCreationError = 29,
YesOption = 30,
NoOption = 31,
CellTitleViewedOn = 32,
CellTitleCompletedOn = 33,
CellTitleLastActionOn = 34,
CellTitlePathName = 35,
CellTitleCommunityName = 36,
CellTitlePathAvailableFrom = 37,
CellTitlePathAvailableTo = 38,
CellTitleQuizName = 39,
CellTitleQuizType = 40,
CellTitleQuizAttemptsNumber = 41,
CellTitleQuizAttemptDate = 42,
CellTitleQuizAttemptNumber = 43,
CellTitleQuizQuestionsSkipped = 44,
CellTitleQuizQuestionsCount = 45,
CellTitleQuizCorrectAnswers = 46,
CellTitleQuizWrongAnswers = 47,
CellTitleQuizUngradedAnswers = 48,
CellTitleQuizSemiCorrectAnswers = 49,
CellTitleMinScore = 50,
CellTitleMaxScore = 51,
CellTitleAttemptScore = 62,
CellTitleQuizAnswersCount = 52,
QuestionnaireAttemptsNoLimits = 53,
DeletedCommunity = 54,
DeletedUser = 55,
DisplayUserInfo =56,
DisplayPathsInfos = 57,
DisplayStartedPathsInfos = 58,
DisplayCompletedPathsInfos = 59,
DisplayNotStartedPathsInfos = 60,
AnonymousUser = 61,
StatisticsInfo = 63,
CellTitleStartAgencyName = 64,
CellTitleEndAgencyName = 65,
CellTitleCurrentAgencyName = 66,
DisplayUserAgencyInfo = 67,
CellTitleIdUser = 68,
CellTitleIdCommunity = 69,
CellTitleIdPath = 70,
CellTitleIdStartAgency = 71,
CellTitleIdEndAgency = 72,
CellTitleIdCurrentAgency = 73,
DisplayCurrentUserAgencyInfo = 74,
CellTitleTaxCode = 75,
DisplayPathNameInfo = 76,
DisplayPathMinCompletionInfo = 77,
DisplayPathMinMarkInfo = 78,
DisplayPathTimeInfo = 79,
DisplayPathStatisticInfos = 80,
DisplayPathUsersCompleted = 81,
DisplayPathUsersStarted = 82,
DisplayPathUsersNotStarted = 83,
GenericTextAction = 84,
CellTitleActivityNumber = 85,
CellTitleSubActivityNumber = 86,
CompletedPassedChar = 87,
CompletedChar = 88,
PassedChar = 89,
StartedChar = 90,
NotStartedChar = 91,
CellTitleCompletion = 92,
CellTitleMinCompletion = 93,
CellTitleTotalMark = 94,
CellTitleTotalTime = 95,
TitleUserInfo = 96,
TitleUserInfoTaxCode = 97,
TitleStatisticsDate = 98,
CellTitleIdRole = 99,
CellTitleIdUnit = 100,
CellTitleIdActivity = 101,
CellTitleIdSubActivity = 102,
CellTitleRole = 103,
TitleUserInfoRole = 104,
CellTitleIdOrganization = 105,
CellTitleOrganizationName = 106,
CellTitleStartedOn = 107,
CellTitleName = 108,
CellTitleSurname = 109,
StrictCompletedPassed = 110,
StrictCompleted = 111,
StrictPassed = 112,
StrictStarted = 113,
StrictNotStarted = 114,
StrictUnitName = 115,
StrictActivityName = 116,
StrictSubactivityName = 117,
CellTitlePathStartOn = 118,
CellTitlePathEndOn = 119,
CellTitlePathDeadline = 120,
CellTitlePathTime = 121,
CellTitleUserPercentageCompletion = 122,
CellTitleMail = 123,
}
} | 30.367647 | 48 | 0.608232 | [
"MIT"
] | EdutechSRL/Adevico | 3-Business/3-Modules/lm.Comol.Modules.EduPath/Domain/Enum/EduPathTranslations.cs | 4,132 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Caf.Midden.Core.Services.Metadata
{
public class MetadataReader
{
private readonly IMetadataParser parser;
public MetadataReader(
IMetadataParser parser)
{
this.parser = parser;
}
public Models.v0_2.Metadata Read(
string fileString)
{
if (fileString.Length == 0)
throw new ArgumentNullException("No data in string");
var result = this.parser.Parse(fileString);
return result;
}
public async Task<Models.v0_2.Metadata> ReadAsync(
System.IO.Stream stream)
{
using (var reader = new StreamReader(stream, Encoding.UTF8))
{
string fileString = await reader.ReadToEndAsync();
var result = this.Read(fileString);
return result;
}
}
}
}
| 23.488889 | 72 | 0.572375 | [
"CC0-1.0"
] | GSWRL-USDA-ARS/Midden | Caf.Midden.Core/Services/Metadata/MetadataReader.cs | 1,059 | C# |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Jint.Native;
using Jint.Native.Array;
using Jint.Native.Function;
using Microsoft.Scripting.Ast;
namespace Jint.Runtime.Interop
{
public sealed class MethodInfoFunctionInstance : FunctionInstance
{
private readonly MethodInfo[] _methods;
public MethodInfoFunctionInstance(Engine engine, MethodInfo[] methods)
: base(engine, null, null, false)
{
_methods = methods;
Prototype = engine.Function.PrototypeObject;
}
public override JsValue Call(JsValue thisObject, JsValue[] arguments)
{
return Invoke(_methods, thisObject, arguments);
}
public JsValue Invoke(MethodInfo[] methodInfos, JsValue thisObject, JsValue[] jsArguments)
{
var arguments = ProcessParamsArrays(jsArguments, methodInfos);
var methods = TypeConverter.FindBestMatch(Engine, methodInfos, arguments).ToList();
var converter = Engine.ClrTypeConverter;
foreach (var method in methods)
{
var parameters = new object[arguments.Length];
var argumentsMatch = true;
for (var i = 0; i < arguments.Length; i++)
{
var parameterType = method.GetParameters()[i].ParameterType;
if (parameterType == typeof(JsValue))
{
parameters[i] = arguments[i];
}
else if (parameterType == typeof(JsValue[]) && arguments[i].IsArray())
{
// Handle specific case of F(params JsValue[])
var arrayInstance = arguments[i].AsArray();
var len = TypeConverter.ToInt32(arrayInstance.Get("length"));
var result = new JsValue[len];
for (var k = 0; k < len; k++)
{
var pk = k.ToString();
result[k] = arrayInstance.HasProperty(pk)
? arrayInstance.Get(pk)
: JsValue.Undefined;
}
parameters[i] = result;
}
else
{
if (!converter.TryConvert(arguments[i].ToObject(), parameterType, CultureInfo.InvariantCulture, out parameters[i]))
{
argumentsMatch = false;
break;
}
var lambdaExpression = parameters[i] as LambdaExpression;
if (lambdaExpression != null)
{
parameters[i] = lambdaExpression.Compile();
}
}
}
if (!argumentsMatch)
{
continue;
}
// todo: cache method info
try
{
return JsValue.FromObject(Engine, method.Invoke(thisObject.ToObject(), parameters.ToArray()));
}
catch (TargetInvocationException exception)
{
var meaningfulException = exception.InnerException ?? exception;
var handler = Engine.Options._ClrExceptionsHandler;
if (handler != null && handler(meaningfulException))
{
throw new JavaScriptException(Engine.Error, meaningfulException.Message);
}
throw meaningfulException;
}
}
throw new JavaScriptException(Engine.TypeError, "No public methods with the specified arguments were found.");
}
/// <summary>
/// Reduces a flat list of parameters to a params array
/// </summary>
private JsValue[] ProcessParamsArrays(JsValue[] jsArguments, IEnumerable<MethodInfo> methodInfos)
{
foreach (var methodInfo in methodInfos)
{
var parameters = methodInfo.GetParameters();
if (!parameters.Any(p => p.HasAttribute<ParamArrayAttribute>()))
continue;
var nonParamsArgumentsCount = parameters.Length - 1;
if (jsArguments.Length < nonParamsArgumentsCount)
continue;
var newArgumentsCollection = jsArguments.Take(nonParamsArgumentsCount).ToList();
var argsToTransform = jsArguments.Skip(nonParamsArgumentsCount).ToList();
if (argsToTransform.Count == 1 && argsToTransform.FirstOrDefault().IsArray())
continue;
var jsArray = Engine.Array.Construct(Arguments.Empty);
Engine.Array.PrototypeObject.Push(jsArray, argsToTransform.ToArray());
newArgumentsCollection.Add(new JsValue(jsArray));
return newArgumentsCollection.ToArray();
}
return jsArguments;
}
}
}
| 37.553191 | 139 | 0.514448 | [
"BSD-2-Clause"
] | djkrose/jint-unity | Jint/Runtime/Interop/MethodInfoFunctionInstance.cs | 5,297 | C# |
using System;
using UnityEngine;
using UnityEngine.Video;
using UnityEngine.SceneManagement;
namespace SpaceCandy
{
public class SplashVideoAdvance : MonoBehaviour
{
// Variables
public VideoPlayer videoPlayer;
public string targetScene;
private bool isLoadingScene;
// Startup Checks
private void Start()
{
if (videoPlayer == null)
GlobalLog.Error("A video player should be defined or this won't work!");
isLoadingScene = false;
}
// See if we're done
private void Update()
{
if(!videoPlayer.isPlaying && videoPlayer.frame > (long)videoPlayer.frameCount / 2)
{
if (!isLoadingScene)
{
isLoadingScene = true;
SceneManager.LoadScene(targetScene);
}
}
}
}
}
| 24.526316 | 94 | 0.541845 | [
"BSD-3-Clause"
] | AlexStewartCode/StarCandy | StarCandy/Assets/Scripts/Utility/SplashVideoAdvance.cs | 934 | C# |
using System;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
namespace AwsAspCore.DDB.Caching
{
// https://stackoverflow.com/a/52752984/3159342
public static class DynamoDBCacheServiceCollectionExtensions
{
/// <summary>
/// Adds Amazon DynamoDB caching services to the specified <see cref="IServiceCollection" />.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param>
/// <param name="setupAction">An <see cref="Action{DynamoDbCacheOptions}"/> to configure the provided
/// <see cref="DynamoDBCacheOptions"/>.</param>
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddDistributedDynamoDbCache(this IServiceCollection services, Action<DynamoDBCacheOptions> setupAction)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (setupAction == null)
{
throw new ArgumentNullException(nameof(setupAction));
}
services.AddOptions();
services.Configure(setupAction);
services.Add(ServiceDescriptor.Singleton<IDistributedCache, DynamoDBCache>());
return services;
}
}
} | 39.777778 | 144 | 0.64595 | [
"MIT"
] | Soren025/AwsAspCore | DDB/Caching/DynamoDBCacheServiceCollectionExtensions.cs | 1,434 | C# |
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Mtd.Cpq.Manager.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Mtd.Cpq.Manager
{
public class MigrationService : IHostedService
{
private readonly IServiceScopeFactory serviceScopeFactory;
private readonly ILogger logger;
public MigrationService(IServiceScopeFactory serviceScopeFactory,
ILogger<MigrationService> logger)
{
this.serviceScopeFactory = serviceScopeFactory;
this.logger = logger;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
using var scope = serviceScopeFactory.CreateScope();
var dbContext = scope.ServiceProvider
.GetRequiredService<CpqContext>();
bool dbMigration = false;
try
{
IEnumerable<string> pm = await dbContext.Database
.GetPendingMigrationsAsync(cancellationToken);
dbMigration = pm.Any();
if (dbMigration)
{
await dbContext.Database.MigrateAsync(cancellationToken);
}
}
catch (Exception ex)
{
logger.LogError(ex.Message);
}
}
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}
}
| 27.45 | 77 | 0.616879 | [
"MIT"
] | olegbruev/Mtd.Cpq.Manager | MigrationService.cs | 1,649 | C# |
using System.ComponentModel;
using JetBrains.Annotations;
using Newtonsoft.Json;
namespace Crowdin.Api.ProjectsGroups
{
[PublicAPI]
public class GroupPatch : PatchEntry
{
[JsonProperty("path")]
public GroupPatchPath Path { get; set; }
}
[PublicAPI]
public enum GroupPatchPath
{
[Description("/name")]
Name,
[Description("/description")]
Description,
[Description("/parentId")]
ParentId
}
} | 18.777778 | 48 | 0.591716 | [
"MIT"
] | crowdin/crowdin-api-client-dotnet | src/Crowdin.Api/ProjectsGroups/GroupPatch.cs | 509 | C# |
using Photon.Realtime;
using Photon.Pun;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using static Niwatori.Utility;
namespace Niwatori
{
public class TitleManager : MonoBehaviourPunCallbacks
{
[SerializeField] private InputField nameField;
private int startTimeStamp;
[SerializeField] private AudioClip kokekokko;
private void Start()
{
Application.targetFrameRate = 30;
PhotonNetwork.SendRate = 30;
PhotonNetwork.SerializationRate = 2;
PhotonNetwork.OfflineMode = true;
PhotonNetwork.NickName = "";
PhotonNetwork.LocalPlayer.SetPlayerNumber(0);
PhotonNetwork.LocalPlayer.SetTeamNumber(0);
PhotonNetwork.ConnectUsingSettings();
Delay(6.0f, () =>
{
AudioManager.PlayOneShot(kokekokko);
});
}
public override void OnConnectedToMaster()
{
PhotonNetwork.JoinOrCreateRoom(Random.Range(0, int.MaxValue).ToString(), new RoomOptions(), TypedLobby.Default);
}
public override void OnJoinedRoom()
{
GetComponent<RandomSpawnChicken>().Spawn();
}
public void OnSinglePlay()
{
PhotonNetwork.NickName = nameField.text;
PhotonNetwork.CurrentRoom.SetNumberOfPlayers(1);
PhotonNetwork.CurrentRoom.InitTeamDeath();
PhotonNetwork.CurrentRoom.SetStartTime(PhotonNetwork.ServerTimestamp);
Fader.StartFadeOutAndLoadScene(0.5f, 1.0f, "MainSmall");
}
public void OnOnlinePlay()
{
Fader.StartFadeOut(0.5f, 1.0f, () =>
{
PhotonNetwork.NickName = nameField.text;
PhotonNetwork.DestroyAll();
PhotonNetwork.Disconnect();
});
}
public override void OnDisconnected(DisconnectCause cause)
{
if (cause == DisconnectCause.DisconnectByClientLogic)
{
PhotonNetwork.OfflineMode = false;
SceneManager.LoadScene("OnlineLobby");
}
}
}
}
| 30.164384 | 124 | 0.594914 | [
"MIT"
] | Geatnium/NiwaNiwaNiwa | Assets/Gito/CSScripts/TitleManager.cs | 2,202 | C# |
// ReSharper disable CheckNamespace
// ReSharper disable IdentifierTypo
// ReSharper disable StringLiteralTypo
using ManagedIrbis.Pft.Infrastructure;
using ManagedIrbis.Pft.Infrastructure.Ast;
using ManagedIrbis.Pft.Infrastructure.Compiler;
using ManagedIrbis.Pft.Infrastructure.Diagnostics;
using ManagedIrbis.Pft.Infrastructure.Text;
using ManagedIrbis.Providers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
#nullable enable
namespace UnitTests.ManagedIrbis.Pft.Infrastructure.Ast
{
[TestClass]
public class PftBangTest
{
private void _Execute
(
PftBang node
)
{
var flag = false;
var context = new PftContext(null);
var mock = new Mock<PftDebugger>(context);
var debugger = mock.Object;
mock.Setup(d => d.Activate(It.IsAny<PftDebugEventArgs>()))
.Callback(() => { flag = true; });
context.Debugger = debugger;
node.Execute(context);
Assert.IsTrue(flag);
}
[TestMethod]
public void PftBang_Construction_1()
{
var node = new PftBang();
Assert.IsTrue(node.ConstantExpression);
Assert.IsFalse(node.RequiresConnection);
Assert.IsTrue(node.ExtendedSyntax);
}
[TestMethod]
public void PftBang_Construction_2()
{
var token = new PftToken(PftTokenKind.Bang, 1, 1, "!");
var node = new PftBang(token);
Assert.IsTrue(node.ConstantExpression);
Assert.IsFalse(node.RequiresConnection);
Assert.IsTrue(node.ExtendedSyntax);
Assert.AreEqual(token.Column, node.Column);
Assert.AreEqual(token.Line, node.LineNumber);
Assert.AreEqual(token.Text, node.Text);
}
[TestMethod]
public void PftBang_Compile_1()
{
var node = new PftBang();
var provider = new NullProvider();
var compiler = new PftCompiler();
compiler.SetProvider(provider);
var program = new PftProgram();
program.Children.Add(node);
compiler.CompileProgram(program);
}
[TestMethod]
public void PftBang_Execute_1()
{
var node = new PftBang();
_Execute(node);
}
[TestMethod]
public void PftBang_PrettyPrint_1()
{
var node = new PftBang();
var printer = new PftPrettyPrinter();
node.PrettyPrint(printer);
Assert.AreEqual("! ", printer.ToString());
}
[TestMethod]
public void PftBang_ToString_1()
{
var node = new PftBang();
Assert.AreEqual("!", node.ToString());
}
}
}
| 28.808081 | 70 | 0.579944 | [
"MIT"
] | amironov73/ManagedIrbis5 | Source/Tests/UnitTests/Source/ManagedIrbis/Pft/Infrastructure/Ast/PftBangTest.cs | 2,854 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
namespace Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301
{
using static Microsoft.Azure.PowerShell.Cmdlets.Confluent.Runtime.Extensions;
/// <summary>Organization resource properties</summary>
public partial class OrganizationResourcePropertiesAutoGenerated :
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesAutoGenerated,
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesAutoGeneratedInternal,
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Runtime.IValidates
{
/// <summary>
/// Backing field for Inherited model <see cref= "Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourceProperties"
/// />
/// </summary>
private Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourceProperties __organizationResourceProperties = new Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.OrganizationResourceProperties();
/// <summary>The creation time of the resource.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public global::System.DateTime? CreatedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).CreatedTime; }
/// <summary>Internal Acessors for CreatedTime</summary>
global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal.CreatedTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).CreatedTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).CreatedTime = value; }
/// <summary>Internal Acessors for OfferDetailStatus</summary>
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Support.SaaSOfferStatus? Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal.OfferDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailStatus = value; }
/// <summary>Internal Acessors for OrganizationId</summary>
string Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal.OrganizationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OrganizationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OrganizationId = value; }
/// <summary>Internal Acessors for ProvisioningState</summary>
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Support.ProvisionState? Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).ProvisioningState = value; }
/// <summary>Internal Acessors for SsoUrl</summary>
string Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal.SsoUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).SsoUrl; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).SsoUrl = value; }
/// <summary>Confluent offer detail</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOfferDetail OfferDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetail = value ?? null /* model class */; }
/// <summary>Offer Id</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string OfferDetailId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailId = value ?? null; }
/// <summary>Offer Plan Id</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string OfferDetailPlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailPlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailPlanId = value ?? null; }
/// <summary>Offer Plan Name</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string OfferDetailPlanName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailPlanName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailPlanName = value ?? null; }
/// <summary>Publisher Id</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string OfferDetailPublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailPublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailPublisherId = value ?? null; }
/// <summary>SaaS Offer Status</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public Microsoft.Azure.PowerShell.Cmdlets.Confluent.Support.SaaSOfferStatus? OfferDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailStatus; }
/// <summary>Offer Plan Term unit</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string OfferDetailTermUnit { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailTermUnit; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OfferDetailTermUnit = value ?? null; }
/// <summary>Id of the Confluent organization.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string OrganizationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).OrganizationId; }
/// <summary>Provision states for confluent RP</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public Microsoft.Azure.PowerShell.Cmdlets.Confluent.Support.ProvisionState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).ProvisioningState; }
/// <summary>SSO url for the Confluent organization.</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string SsoUrl { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).SsoUrl; }
/// <summary>Subscriber detail</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IUserDetail UserDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetail = value ?? null /* model class */; }
/// <summary>Email address</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string UserDetailEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetailEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetailEmailAddress = value ?? null; }
/// <summary>First name</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string UserDetailFirstName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetailFirstName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetailFirstName = value ?? null; }
/// <summary>Last name</summary>
[Microsoft.Azure.PowerShell.Cmdlets.Confluent.Origin(Microsoft.Azure.PowerShell.Cmdlets.Confluent.PropertyOrigin.Inherited)]
public string UserDetailLastName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetailLastName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal)__organizationResourceProperties).UserDetailLastName = value ?? null; }
/// <summary>
/// Creates an new <see cref="OrganizationResourcePropertiesAutoGenerated" /> instance.
/// </summary>
public OrganizationResourcePropertiesAutoGenerated()
{
}
/// <summary>Validates that this object meets the validation criteria.</summary>
/// <param name="eventListener">an <see cref="Microsoft.Azure.PowerShell.Cmdlets.Confluent.Runtime.IEventListener" /> instance that will receive validation
/// events.</param>
/// <returns>
/// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed.
/// </returns>
public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Confluent.Runtime.IEventListener eventListener)
{
await eventListener.AssertNotNull(nameof(__organizationResourceProperties), __organizationResourceProperties);
await eventListener.AssertObjectIsValid(nameof(__organizationResourceProperties), __organizationResourceProperties);
}
}
/// Organization resource properties
public partial interface IOrganizationResourcePropertiesAutoGenerated :
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Runtime.IJsonSerializable,
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourceProperties
{
}
/// Organization resource properties
internal partial interface IOrganizationResourcePropertiesAutoGeneratedInternal :
Microsoft.Azure.PowerShell.Cmdlets.Confluent.Models.Api20200301.IOrganizationResourcePropertiesInternal
{
}
} | 107.953846 | 544 | 0.802123 | [
"MIT"
] | Agazoth/azure-powershell | src/Confluent/generated/api/Models/Api20200301/OrganizationResourcePropertiesAutoGenerated.cs | 13,905 | C# |
/* ***************************************************************************
* This file is part of SharpNEAT - Evolution of Neural Networks.
*
* Copyright 2004-2006, 2009-2010 Colin Green (sharpneat@gmail.com)
*
* SharpNEAT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SharpNEAT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SharpNEAT. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using SharpNeat.Core;
using SharpNeat.Utility;
namespace SharpNeat.SpeciationStrategies
{
/// <summary>
/// A speciation strategy that allocates genomes to species randomly.
/// Although allocation is random the strategy does maintain evenly sized species.
/// Primarily used for testing/debugging and demonstrating comparative effectiveness of random
/// allocation compared to other strategies.
/// </summary>
/// <typeparam name="TGenome">The genome type to apply clustering to.</typeparam>
public class RandomClusteringStrategy<TGenome> : ISpeciationStrategy<TGenome>
where TGenome : class, IGenome<TGenome>
{
readonly FastRandom _rng = new FastRandom();
/// <summary>
/// Speciates the genomes in genomeList into the number of species specified by specieCount
/// and returns a newly constructed list of Specie objects containing the speciated genomes.
/// </summary>
public IList<Specie<TGenome>> InitializeSpeciation(IList<TGenome> genomeList, int specieCount)
{
// Craete the empty specie objects.
List<Specie<TGenome>> specieList = new List<Specie<TGenome>>(specieCount);
int capacity = (int)Math.Ceiling((double)genomeList.Count/(double)specieCount);
for(int i=0; i<specieCount; i++) {
specieList.Add(new Specie<TGenome>((uint)i, i, capacity));
}
// Speciate the genomes.
SpeciateGenomes(genomeList, specieList);
return specieList;
}
/// <summary>
/// Speciates the genomes in genomeList into the provided species. It is assumed that
/// the genomeList represents all of the required genomes and that the species are currently empty.
///
/// This method can be used for initialization or completely respeciating an existing genome population.
/// </summary>
public void SpeciateGenomes(IList<TGenome> genomeList, IList<Specie<TGenome>> specieList)
{
Debug.Assert(SpeciationUtils.TestEmptySpecies(specieList), "SpeciateGenomes(IList<TGenome>,IList<Species<TGenome>>) called with non-empty species");
Debug.Assert(genomeList.Count >= specieList.Count, string.Format("SpeciateGenomes(IList<TGenome>,IList<Species<TGenome>>). Species count [{0}] is greater than genome count [{1}].", specieList.Count, genomeList.Count));
// Make a copy of genomeList and shuffle the items.
List<TGenome> gList = new List<TGenome>(genomeList);
Utilities.Shuffle(gList, _rng);
// We evenly distribute genomes between species.
// Calc how many genomes per specie. Baseline number given by integer division rounding down (by truncating fractional part).
// This is guaranteed to be at least 1 because genomeCount >= specieCount.
int genomeCount = genomeList.Count;
int specieCount = specieList.Count;
int genomesPerSpecie = genomeCount / specieCount;
// Allocate genomes to species.
int genomeIdx = 0;
for(int i=0; i<specieCount; i++)
{
Specie<TGenome> specie = specieList[i];
for(int j=0; j<genomesPerSpecie; j++, genomeIdx++)
{
gList[genomeIdx].SpecieIdx = specie.Idx;
specie.GenomeList.Add(gList[genomeIdx]);
}
}
// Evenly allocate any remaining genomes.
int[] specieIdxArr = new int[specieCount];
for(int i=0; i<specieCount; i++) {
specieIdxArr[i] = i;
}
Utilities.Shuffle(specieIdxArr, _rng);
for(int i=0; i<specieCount && genomeIdx < genomeCount; i++, genomeIdx++)
{
int specieIdx = specieIdxArr[i];
gList[genomeIdx].SpecieIdx = specieIdx;
specieList[specieIdx].GenomeList.Add(gList[genomeIdx]);
}
Debug.Assert(SpeciationUtils.PerformIntegrityCheck(specieList));
}
/// <summary>
/// Speciates the offspring genomes in genomeList into the provided species. In contrast to
/// SpeciateGenomes() genomeList is taken to be a list of new genomes (e.g. offspring) that should be
/// added to existing species. That is, the species contain genomes that are not in genomeList
/// that we wish to keep; typically these would be elite genomes that are the parents of the
/// offspring.
/// </summary>
public void SpeciateOffspring(IList<TGenome> genomeList, IList<Specie<TGenome>> specieList)
{
// Each specie should contain at least one genome. We need at least one existing genome per specie to act
// as a specie centroid in order to define where the specie is within the encoding space.
Debug.Assert(SpeciationUtils.TestPopulatedSpecies(specieList), "SpeciateOffspring(IList<TGenome>,IList<Species<TGenome>>) called with an empty specie.");
// Make a copy of genomeList and shuffle the items.
List<TGenome> gList = new List<TGenome>(genomeList);
Utilities.Shuffle(gList, _rng);
// Count how many genomes we have in total.
int genomeCount = gList.Count;
int totalGenomeCount = genomeCount;
foreach(Specie<TGenome> specie in specieList) {
totalGenomeCount += specie.GenomeList.Count;
}
// We attempt to evenly distribute genomes between species.
// Calc how many genomes per specie. Baseline number given by integer division rounding down (by truncating fractional part).
// This is guaranteed to be at least 1 because genomeCount >= specieCount.
int specieCount = specieList.Count;
int genomesPerSpecie = totalGenomeCount / specieCount;
// Sort species, smallest first. We must make a copy of specieList to do this; Species must remain at
// the correct index in the main specieList. The principle here is that we wish to ensure that genomes are
// allocated to smaller species in preference to larger species, this is motivated by the desire to create
// evenly sized species.
List<Specie<TGenome>> sList = new List<Specie<TGenome>>(specieList);
sList.Sort(delegate(Specie<TGenome> x, Specie<TGenome> y)
{ // We use the difference in size where we aren't expecting that diff value to overflow the range of an int.
return x.GenomeList.Count - y.GenomeList.Count;
});
// Add genomes into each specie in turn until they each reach genomesPerSpecie in size.
int genomeIdx = 0;
for(int i=0; i<specieCount && genomeIdx<genomeCount; i++)
{
Specie<TGenome> specie = sList[i];
int fillcount = genomesPerSpecie - specie.GenomeList.Count;
if(fillcount <= 0)
{ // We may encounter species with more than genomesPerSpecie genomes. Since we have
// ordered the species by size we break out of this loop and allocate the remaining
// genomes randomly.
break;
}
// Don't allocate more genomes than there are remaining in genomeList.
fillcount = Math.Min(fillcount, genomeCount - genomeIdx);
// Allocate memory for the genomes we are about to allocate;
// This eliminates potentially having to dynamically resize the list one or more times.
if(specie.GenomeList.Capacity < specie.GenomeList.Count + fillcount) {
specie.GenomeList.Capacity = specie.GenomeList.Count + fillcount;
}
// genomeIdx test not required. Already taken into account by fillCount.
for(int j=0; j<fillcount; j++)
{
gList[genomeIdx].SpecieIdx = specie.Idx;
specie.GenomeList.Add(gList[genomeIdx++]);
}
}
// Evenly allocate any remaining genomes.
int[] specieIdxArr = new int[specieCount];
for(int i=0; i<specieCount; i++) {
specieIdxArr[i] = i;
}
Utilities.Shuffle(specieIdxArr, _rng);
for(int i=0; i<specieCount && genomeIdx < genomeCount; i++, genomeIdx++)
{
int specieIdx = specieIdxArr[i];
gList[genomeIdx].SpecieIdx = specieIdx;
specieList[specieIdx].GenomeList.Add(gList[genomeIdx]);
}
Debug.Assert(SpeciationUtils.PerformIntegrityCheck(specieList));
}
}
}
| 50.111675 | 230 | 0.619631 | [
"MIT"
] | FrozenSonar/Fencing3DNEAT | Assets/UnitySharpNEAT/SharpNEAT/SpeciationStrategies/RandomClusteringStrategy.cs | 9,872 | C# |
// Copyright (c) Gurmit Teotia. Please see the LICENSE file in the project root for license information.
using System;
using System.Threading;
using System.Threading.Tasks;
using Guflow.Properties;
namespace Guflow.Worker
{
/// <summary>
/// Represent activity concurrent execution strategy
/// </summary>
public class ActivityExecution
{
private readonly uint _maximumLimit;
private readonly Func<WorkerTask, Task> _executeFunc;
private ActivityHost _activityHost;
private readonly AsyncAutoResetEvent _completedEvent = new AsyncAutoResetEvent();
private readonly object _syncObject= new object();
private volatile int _totalRunningTasks = 0;
private volatile bool _reachedLimit = false;
private ActivityExecution(uint maximumLimit)
{
if (maximumLimit > 1)
_executeFunc = ExecuteConcurrentlyAsync;
else
_executeFunc = ExecuteInSequenceAsync;
_maximumLimit = maximumLimit;
}
/// <summary>
/// Allow only one activity task to be executed.
/// </summary>
public static readonly ActivityExecution Sequencial = new ActivityExecution(1);
/// <summary>
/// Allow configured number of activity task to executed in parallel.
/// </summary>
/// <param name="maximumLimit"></param>
/// <returns></returns>
public static ActivityExecution Concurrent(uint maximumLimit)
{
Ensure.That(maximumLimit != 0, () => new ArgumentException(Resources.Concurrent_execution_limit_should_be_more_than_zero, "maximumLimit"));
return new ActivityExecution(maximumLimit);
}
internal async Task ExecuteAsync(WorkerTask workerTask)
{
await _executeFunc(workerTask);
}
internal void Set(ActivityHost activityHost)
{
_activityHost = activityHost;
}
private async Task ExecuteConcurrentlyAsync(WorkerTask workerTask)
{
_reachedLimit = false;
var task = Task.Run(async () =>
{
await ExecuteInSequenceAsync(workerTask);
ExecutionCompleted();
});
await WaitIfLimitHasReached();
}
private async Task WaitIfLimitHasReached()
{
lock (_syncObject)
{
_totalRunningTasks++;
if (_totalRunningTasks >= _maximumLimit)
{
_reachedLimit = true;
}
}
if (_reachedLimit)
await _completedEvent.WaitAsync();
}
private void ExecutionCompleted()
{
lock (_syncObject)
{
_totalRunningTasks--;
if(_reachedLimit)
_completedEvent.Set();
}
}
private async Task ExecuteInSequenceAsync(WorkerTask workerTask)
{
try
{
IHostedActivities hostedActivities = _activityHost;
var response = await workerTask.ExecuteFor(hostedActivities);
await _activityHost.SendAsync(workerTask.Token, response);
}
catch (Exception exception)
{
_activityHost.Fault(exception);
}
}
}
} | 33.377358 | 152 | 0.561334 | [
"Apache-2.0"
] | Seekatar/guflow | Guflow/Worker/ActivityExecution.cs | 3,540 | C# |
using System;
using System.Collections.Generic;
using GovUk.Education.ExploreEducationStatistics.Data.Model.Database;
using GovUk.Education.ExploreEducationStatistics.Data.Model.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;
using static GovUk.Education.ExploreEducationStatistics.Common.Model.TimeIdentifier;
namespace GovUk.Education.ExploreEducationStatistics.Data.Model.Tests
{
public class ReleaseRepositoryTests
{
[Fact]
public void GetLatestPublishedRelease()
{
var builder = new DbContextOptionsBuilder<StatisticsDbContext>();
builder.UseInMemoryDatabase(Guid.NewGuid().ToString());
var options = builder.Options;
using (var context = new StatisticsDbContext(options, null))
{
var publicationA = new Publication
{
Id = Guid.NewGuid(),
Slug = "publication-a",
Title = "Publication A"
};
var publicationB = new Publication
{
Id = Guid.NewGuid(),
Slug = "publication-b",
Title = "Publication B"
};
var publicationARelease1 = new Release
{
Id = Guid.NewGuid(),
PublicationId = publicationA.Id,
Published = DateTime.UtcNow,
Slug = "publication-a-release-1",
TimeIdentifier = AcademicYearQ1,
Year = 2018
};
var publicationARelease2 = new Release
{
Id = Guid.NewGuid(),
PublicationId = publicationA.Id,
Published = DateTime.UtcNow,
Slug = "publication-a-release-2",
TimeIdentifier = AcademicYearQ4,
Year = 2017
};
var publicationARelease3 = new Release
{
Id = Guid.NewGuid(),
PublicationId = publicationA.Id,
Published = null,
Slug = "publication-a-release-3",
TimeIdentifier = AcademicYearQ2,
Year = 2018
};
var publicationBRelease1 = new Release
{
Id = Guid.NewGuid(),
PublicationId = publicationB.Id,
Published = DateTime.UtcNow,
Slug = "publication-b-release-1",
TimeIdentifier = AcademicYearQ1,
Year = 2018
};
context.AddRange(new List<Publication>
{
publicationA, publicationB
});
context.AddRange(new List<Release>
{
publicationARelease1, publicationARelease2, publicationARelease3, publicationBRelease1
});
context.SaveChanges();
var repository = new ReleaseRepository(context, new Mock<ILogger<ReleaseRepository>>().Object);
var result = repository.GetLatestPublishedRelease(publicationA.Id);
Assert.Equal(publicationARelease1, result);
}
}
[Fact]
public void GetLatestPublishedRelease_PublicationIdNotFound()
{
var builder = new DbContextOptionsBuilder<StatisticsDbContext>();
builder.UseInMemoryDatabase(Guid.NewGuid().ToString());
var options = builder.Options;
using (var context = new StatisticsDbContext(options, null))
{
var repository = new ReleaseRepository(context, new Mock<ILogger<ReleaseRepository>>().Object);
var result = repository.GetLatestPublishedRelease(Guid.NewGuid());
Assert.Null(result);
}
}
}
} | 35.938053 | 111 | 0.524501 | [
"MIT"
] | benoutram/explore-education-statistics | src/GovUk.Education.ExploreEducationStatistics.Data.Model.Tests/ReleaseRepositoryTests.cs | 4,063 | C# |
/********************************************************************************************
Copyright (c) Microsoft Corporation
All rights reserved.
Microsoft Public License:
This license governs use of the accompanying software. If you use the software, you
accept this license. If you do not accept the license, do not use the software.
1. Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions
and limitations in section 3, each contributor grants you a non-exclusive, worldwide,
royalty-free copyright license to reproduce its contribution, prepare derivative works of
its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions
and limitations in section 3, each contributor grants you a non-exclusive, worldwide,
royalty-free license under its licensed patents to make, have made, use, sell, offer for
sale, import, and/or otherwise dispose of its contribution in the software or derivative
works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors'
name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are
infringed by the software, your patent license from such contributor to the software ends
automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent,
trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only
under this license by including a complete copy of this license with your distribution.
If you distribute any portion of the software in compiled or object code form, you may only
do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give
no express warranties, guarantees or conditions. You may have additional consumer rights
under your local laws which this license cannot change. To the extent permitted under your
local laws, the contributors exclude the implied warranties of merchantability, fitness for
a particular purpose and non-infringement.
********************************************************************************************/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using MSBuild = Microsoft.Build.Evaluation;
using Microsoft.Build.Construction;
/* This file provides a basefunctionallity for IVsCfgProvider2.
Instead of using the IVsProjectCfgEventsHelper object we have our own little sink and call our own helper methods
similiar to the interface. But there is no real benefit in inheriting from the interface in the first place.
Using the helper object seems to be:
a) undocumented
b) not really wise in the managed world
*/
namespace Microsoft.VisualStudio.Project
{
[CLSCompliant(false)]
[ComVisible(true)]
public class ConfigProvider : IVsCfgProvider2, IVsProjectCfgProvider, IVsExtensibleObject
{
#region fields
internal const string configString = " '$(Configuration)' == '{0}' ";
internal const string AnyCPUPlatform = "Any CPU";
internal const string x86Platform = "x86";
private ProjectNode project;
private EventSinkCollection cfgEventSinks = new EventSinkCollection();
private List<KeyValuePair<KeyValuePair<string, string>, string>> newCfgProps = new List<KeyValuePair<KeyValuePair<string, string>, string>>();
private Dictionary<string, ProjectConfig> configurationsList = new Dictionary<string, ProjectConfig>();
#endregion
#region Properties
/// <summary>
/// The associated project.
/// </summary>
protected ProjectNode ProjectMgr
{
get
{
return this.project;
}
}
/// <summary>
/// If the project system wants to add custom properties to the property group then
/// they provide us with this data.
/// Returns/sets the [(<propName, propCondition>) <propValue>] collection
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual List<KeyValuePair<KeyValuePair<string, string>, string>> NewConfigProperties
{
get
{
return newCfgProps;
}
set
{
newCfgProps = value;
}
}
#endregion
#region ctors
public ConfigProvider(ProjectNode manager)
{
this.project = manager;
}
#endregion
#region methods
/// <summary>
/// Creates new Project Configuartion objects based on the configuration name.
/// </summary>
/// <param name="configName">The name of the configuration</param>
/// <returns>An instance of a ProjectConfig object.</returns>
protected ProjectConfig GetProjectConfiguration(string configName)
{
// if we already created it, return the cached one
if(configurationsList.ContainsKey(configName))
{
return configurationsList[configName];
}
ProjectConfig requestedConfiguration = CreateProjectConfiguration(configName);
configurationsList.Add(configName, requestedConfiguration);
return requestedConfiguration;
}
protected virtual ProjectConfig CreateProjectConfiguration(string configName)
{
return new ProjectConfig(this.project, configName);
}
#endregion
#region IVsProjectCfgProvider methods
/// <summary>
/// Provides access to the IVsProjectCfg interface implemented on a project's configuration object.
/// </summary>
/// <param name="projectCfgCanonicalName">The canonical name of the configuration to access.</param>
/// <param name="projectCfg">The IVsProjectCfg interface of the configuration identified by szProjectCfgCanonicalName.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
public virtual int OpenProjectCfg(string projectCfgCanonicalName, out IVsProjectCfg projectCfg)
{
if(projectCfgCanonicalName == null)
{
throw new ArgumentNullException("projectCfgCanonicalName");
}
projectCfg = null;
// Be robust in release
if(projectCfgCanonicalName == null)
{
return VSConstants.E_INVALIDARG;
}
Debug.Assert(this.project != null && this.project.BuildProject != null);
string[] configs = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
foreach(string config in configs)
{
if(String.Compare(config, projectCfgCanonicalName, StringComparison.OrdinalIgnoreCase) == 0)
{
projectCfg = this.GetProjectConfiguration(config);
if(projectCfg != null)
{
return VSConstants.S_OK;
}
else
{
return VSConstants.E_FAIL;
}
}
}
return VSConstants.E_INVALIDARG;
}
/// <summary>
/// Checks whether or not this configuration provider uses independent configurations.
/// </summary>
/// <param name="usesIndependentConfigurations">true if independent configurations are used, false if they are not used. By default returns true.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int get_UsesIndependentConfigurations(out int usesIndependentConfigurations)
{
usesIndependentConfigurations = 1;
return VSConstants.S_OK;
}
#endregion
#region IVsCfgProvider2 methods
/// <summary>
/// Copies an existing configuration name or creates a new one.
/// </summary>
/// <param name="name">The name of the new configuration.</param>
/// <param name="cloneName">the name of the configuration to copy, or a null reference, indicating that AddCfgsOfCfgName should create a new configuration.</param>
/// <param name="fPrivate">Flag indicating whether or not the new configuration is private. If fPrivate is set to true, the configuration is private. If set to false, the configuration is public. This flag can be ignored.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
public virtual int AddCfgsOfCfgName(string name, string cloneName, int fPrivate)
{
// We need to QE/QS the project file
if(!this.ProjectMgr.QueryEditProjectFile(false))
{
throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
}
// First create the condition that represent the configuration we want to clone
string condition = (cloneName == null ? String.Empty : String.Format(CultureInfo.InvariantCulture, configString, cloneName).Trim());
// Get all configs
List<ProjectPropertyGroupElement> configGroup = new List<ProjectPropertyGroupElement>(this.project.BuildProject.Xml.PropertyGroups);
ProjectPropertyGroupElement configToClone = null;
if(cloneName != null)
{
// Find the configuration to clone
foreach (ProjectPropertyGroupElement currentConfig in configGroup)
{
// Only care about conditional property groups
if(currentConfig.Condition == null || currentConfig.Condition.Length == 0)
continue;
// Skip if it isn't the group we want
if(String.Compare(currentConfig.Condition.Trim(), condition, StringComparison.OrdinalIgnoreCase) != 0)
continue;
configToClone = currentConfig;
}
}
ProjectPropertyGroupElement newConfig = null;
if(configToClone != null)
{
// Clone the configuration settings
newConfig = this.project.ClonePropertyGroup(configToClone);
//Will be added later with the new values to the path
foreach (ProjectPropertyElement property in newConfig.Properties)
{
if (property.Name.Equals("OutputPath", StringComparison.OrdinalIgnoreCase))
{
property.Parent.RemoveChild(property);
}
}
}
else
{
// no source to clone from, lets just create a new empty config
newConfig = this.project.BuildProject.Xml.AddPropertyGroup();
// Get the list of property name, condition value from the config provider
IList<KeyValuePair<KeyValuePair<string, string>, string>> propVals = this.NewConfigProperties;
foreach(KeyValuePair<KeyValuePair<string, string>, string> data in propVals)
{
KeyValuePair<string, string> propData = data.Key;
string value = data.Value;
ProjectPropertyElement newProperty = newConfig.AddProperty(propData.Key, value);
if(!String.IsNullOrEmpty(propData.Value))
newProperty.Condition = propData.Value;
}
}
//add the output path
string outputBasePath = this.ProjectMgr.OutputBaseRelativePath;
if(outputBasePath.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
outputBasePath = Path.GetDirectoryName(outputBasePath);
newConfig.AddProperty("OutputPath", Path.Combine(outputBasePath, name) + Path.DirectorySeparatorChar.ToString());
// Set the condition that will define the new configuration
string newCondition = String.Format(CultureInfo.InvariantCulture, configString, name);
newConfig.Condition = newCondition;
NotifyOnCfgNameAdded(name);
return VSConstants.S_OK;
}
/// <summary>
/// Copies an existing platform name or creates a new one.
/// </summary>
/// <param name="platformName">The name of the new platform.</param>
/// <param name="clonePlatformName">The name of the platform to copy, or a null reference, indicating that AddCfgsOfPlatformName should create a new platform.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int AddCfgsOfPlatformName(string platformName, string clonePlatformName)
{
return VSConstants.E_NOTIMPL;
}
/// <summary>
/// Deletes a specified configuration name.
/// </summary>
/// <param name="name">The name of the configuration to be deleted.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
public virtual int DeleteCfgsOfCfgName(string name)
{
// We need to QE/QS the project file
if(!this.ProjectMgr.QueryEditProjectFile(false))
{
throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
}
if(name == null)
{
Debug.Fail(String.Format(CultureInfo.CurrentCulture, "Name of the configuration should not be null if you want to delete it from project: {0}", this.project.BuildProject.FullPath));
// The configuration " '$(Configuration)' == " does not exist, so technically the goal
// is achieved so return S_OK
return VSConstants.S_OK;
}
// Verify that this config exist
string[] configs = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
foreach(string config in configs)
{
if(String.Compare(config, name, StringComparison.OrdinalIgnoreCase) == 0)
{
// Create condition of config to remove
string condition = String.Format(CultureInfo.InvariantCulture, configString, config);
foreach (ProjectPropertyGroupElement element in this.project.BuildProject.Xml.PropertyGroups)
{
if(String.Equals(element.Condition, condition, StringComparison.OrdinalIgnoreCase))
{
element.Parent.RemoveChild(element);
}
}
NotifyOnCfgNameDeleted(name);
}
}
return VSConstants.S_OK;
}
/// <summary>
/// Deletes a specified platform name.
/// </summary>
/// <param name="platName">The platform name to delet.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int DeleteCfgsOfPlatformName(string platName)
{
return VSConstants.E_NOTIMPL;
}
/// <summary>
/// Returns the existing configurations stored in the project file.
/// </summary>
/// <param name="celt">Specifies the requested number of property names. If this number is unknown, celt can be zero.</param>
/// <param name="names">On input, an allocated array to hold the number of configuration property names specified by celt. This parameter can also be a null reference if the celt parameter is zero.
/// On output, names contains configuration property names.</param>
/// <param name="actual">The actual number of property names returned.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int GetCfgNames(uint celt, string[] names, uint[] actual)
{
// get's called twice, once for allocation, then for retrieval
int i = 0;
string[] configList = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
if(names != null)
{
foreach(string config in configList)
{
names[i++] = config;
if(i == celt)
break;
}
}
else
i = configList.Length;
if(actual != null)
{
actual[0] = (uint)i;
}
return VSConstants.S_OK;
}
/// <summary>
/// Returns the configuration associated with a specified configuration or platform name.
/// </summary>
/// <param name="name">The name of the configuration to be returned.</param>
/// <param name="platName">The name of the platform for the configuration to be returned.</param>
/// <param name="cfg">The implementation of the IVsCfg interface.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int GetCfgOfName(string name, string platName, out IVsCfg cfg)
{
cfg = null;
cfg = this.GetProjectConfiguration(name);
return VSConstants.S_OK;
}
/// <summary>
/// Returns a specified configuration property.
/// </summary>
/// <param name="propid">Specifies the property identifier for the property to return. For valid propid values, see __VSCFGPROPID.</param>
/// <param name="var">The value of the property.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int GetCfgProviderProperty(int propid, out object var)
{
var = false;
switch((__VSCFGPROPID)propid)
{
case __VSCFGPROPID.VSCFGPROPID_SupportsCfgAdd:
var = true;
break;
case __VSCFGPROPID.VSCFGPROPID_SupportsCfgDelete:
var = true;
break;
case __VSCFGPROPID.VSCFGPROPID_SupportsCfgRename:
var = true;
break;
case __VSCFGPROPID.VSCFGPROPID_SupportsPlatformAdd:
var = false;
break;
case __VSCFGPROPID.VSCFGPROPID_SupportsPlatformDelete:
var = false;
break;
}
return VSConstants.S_OK;
}
/// <summary>
/// Returns the per-configuration objects for this object.
/// </summary>
/// <param name="celt">Number of configuration objects to be returned or zero, indicating a request for an unknown number of objects.</param>
/// <param name="a">On input, pointer to an interface array or a null reference. On output, this parameter points to an array of IVsCfg interfaces belonging to the requested configuration objects.</param>
/// <param name="actual">The number of configuration objects actually returned or a null reference, if this information is not necessary.</param>
/// <param name="flags">Flags that specify settings for project configurations, or a null reference (Nothing in Visual Basic) if no additional flag settings are required. For valid prgrFlags values, see __VSCFGFLAGS.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int GetCfgs(uint celt, IVsCfg[] a, uint[] actual, uint[] flags)
{
if(flags != null)
flags[0] = 0;
int i = 0;
string[] configList = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
if(a != null)
{
foreach(string configName in configList)
{
a[i] = this.GetProjectConfiguration(configName);
i++;
if(i == celt)
break;
}
}
else
i = configList.Length;
if(actual != null)
actual[0] = (uint)i;
return VSConstants.S_OK;
}
/// <summary>
/// Returns one or more platform names.
/// </summary>
/// <param name="celt">Specifies the requested number of platform names. If this number is unknown, celt can be zero.</param>
/// <param name="names">On input, an allocated array to hold the number of platform names specified by celt. This parameter can also be a null reference if the celt parameter is zero. On output, names contains platform names.</param>
/// <param name="actual">The actual number of platform names returned.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int GetPlatformNames(uint celt, string[] names, uint[] actual)
{
string[] platforms = this.GetPlatformsFromProject();
return GetPlatforms(celt, names, actual, platforms);
}
/// <summary>
/// Returns the set of platforms that are installed on the user's machine.
/// </summary>
/// <param name="celt">Specifies the requested number of supported platform names. If this number is unknown, celt can be zero.</param>
/// <param name="names">On input, an allocated array to hold the number of names specified by celt. This parameter can also be a null reference (Nothing in Visual Basic)if the celt parameter is zero. On output, names contains the names of supported platforms</param>
/// <param name="actual">The actual number of platform names returned.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int GetSupportedPlatformNames(uint celt, string[] names, uint[] actual)
{
string[] platforms = this.GetSupportedPlatformsFromProject();
return GetPlatforms(celt, names, actual, platforms);
}
/// <summary>
/// Assigns a new name to a configuration.
/// </summary>
/// <param name="old">The old name of the target configuration.</param>
/// <param name="newname">The new name of the target configuration.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int RenameCfgsOfCfgName(string old, string newname)
{
// First create the condition that represent the configuration we want to rename
string condition = String.Format(CultureInfo.InvariantCulture, configString, old).Trim();
foreach (ProjectPropertyGroupElement config in this.project.BuildProject.Xml.PropertyGroups)
{
// Only care about conditional property groups
if(config.Condition == null || config.Condition.Length == 0)
continue;
// Skip if it isn't the group we want
if(String.Compare(config.Condition.Trim(), condition, StringComparison.OrdinalIgnoreCase) != 0)
continue;
// Change the name
config.Condition = String.Format(CultureInfo.InvariantCulture, configString, newname);
// Update the name in our config list
if(configurationsList.ContainsKey(old))
{
ProjectConfig configuration = configurationsList[old];
configurationsList.Remove(old);
configurationsList.Add(newname, configuration);
// notify the configuration of its new name
configuration.ConfigName = newname;
}
NotifyOnCfgNameRenamed(old, newname);
}
return VSConstants.S_OK;
}
/// <summary>
/// Cancels a registration for configuration event notification.
/// </summary>
/// <param name="cookie">The cookie used for registration.</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int UnadviseCfgProviderEvents(uint cookie)
{
this.cfgEventSinks.RemoveAt(cookie);
return VSConstants.S_OK;
}
/// <summary>
/// Registers the caller for configuration event notification.
/// </summary>
/// <param name="sink">Reference to the IVsCfgProviderEvents interface to be called to provide notification of configuration events.</param>
/// <param name="cookie">Reference to a token representing the completed registration</param>
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public virtual int AdviseCfgProviderEvents(IVsCfgProviderEvents sink, out uint cookie)
{
cookie = this.cfgEventSinks.Add(sink);
return VSConstants.S_OK;
}
#endregion
#region IVsExtensibleObject Members
/// <summary>
/// Proved access to an IDispatchable object being a list of configuration properties
/// </summary>
/// <param name="configurationName">Combined Name and Platform for the configuration requested</param>
/// <param name="configurationProperties">The IDispatchcable object</param>
/// <returns>S_OK if successful</returns>
public virtual int GetAutomationObject(string configurationName, out object configurationProperties)
{
//Init out param
configurationProperties = null;
string name, platform;
if(!ProjectConfig.TrySplitConfigurationCanonicalName(configurationName, out name, out platform))
{
return VSConstants.E_INVALIDARG;
}
// Get the configuration
IVsCfg cfg;
ErrorHandler.ThrowOnFailure(this.GetCfgOfName(name, platform, out cfg));
// Get the properties of the configuration
configurationProperties = ((ProjectConfig)cfg).ConfigurationProperties;
return VSConstants.S_OK;
}
#endregion
#region helper methods
/// <summary>
/// Called when a new configuration name was added.
/// </summary>
/// <param name="name">The name of configuration just added.</param>
private void NotifyOnCfgNameAdded(string name)
{
foreach(IVsCfgProviderEvents sink in this.cfgEventSinks)
{
ErrorHandler.ThrowOnFailure(sink.OnCfgNameAdded(name));
}
}
/// <summary>
/// Called when a config name was deleted.
/// </summary>
/// <param name="name">The name of the configuration.</param>
private void NotifyOnCfgNameDeleted(string name)
{
foreach(IVsCfgProviderEvents sink in this.cfgEventSinks)
{
ErrorHandler.ThrowOnFailure(sink.OnCfgNameDeleted(name));
}
}
/// <summary>
/// Called when a config name was renamed
/// </summary>
/// <param name="oldName">Old configuration name</param>
/// <param name="newName">New configuration name</param>
private void NotifyOnCfgNameRenamed(string oldName, string newName)
{
foreach(IVsCfgProviderEvents sink in this.cfgEventSinks)
{
ErrorHandler.ThrowOnFailure(sink.OnCfgNameRenamed(oldName, newName));
}
}
/// <summary>
/// Called when a platform name was added
/// </summary>
/// <param name="platformName">The name of the platform.</param>
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
private void NotifyOnPlatformNameAdded(string platformName)
{
foreach(IVsCfgProviderEvents sink in this.cfgEventSinks)
{
ErrorHandler.ThrowOnFailure(sink.OnPlatformNameAdded(platformName));
}
}
/// <summary>
/// Called when a platform name was deleted
/// </summary>
/// <param name="platformName">The name of the platform.</param>
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
private void NotifyOnPlatformNameDeleted(string platformName)
{
foreach(IVsCfgProviderEvents sink in this.cfgEventSinks)
{
ErrorHandler.ThrowOnFailure(sink.OnPlatformNameDeleted(platformName));
}
}
/// <summary>
/// Gets all the platforms defined in the project
/// </summary>
/// <returns>An array of platform names.</returns>
private string[] GetPlatformsFromProject()
{
string[] platforms = GetPropertiesConditionedOn(ProjectFileConstants.Platform);
if(platforms == null || platforms.Length == 0)
{
return new string[] { x86Platform, AnyCPUPlatform };
}
for(int i = 0; i < platforms.Length; i++)
{
platforms[i] = ConvertPlatformToVsProject(platforms[i]);
}
return platforms;
}
/// <summary>
/// Return the supported platform names.
/// </summary>
/// <returns>An array of supported platform names.</returns>
private string[] GetSupportedPlatformsFromProject()
{
string platforms = this.ProjectMgr.BuildProject.GetPropertyValue(ProjectFileConstants.AvailablePlatforms);
if(platforms == null)
{
return new string[] { };
}
if(platforms.Contains(","))
{
return platforms.Split(',');
}
return new string[] { platforms };
}
/// <summary>
/// Helper function to convert AnyCPU to Any CPU.
/// </summary>
/// <param name="oldName">The oldname.</param>
/// <returns>The new name.</returns>
private static string ConvertPlatformToVsProject(string oldPlatformName)
{
if(String.Compare(oldPlatformName, ProjectFileValues.AnyCPU, StringComparison.OrdinalIgnoreCase) == 0)
{
return AnyCPUPlatform;
}
return oldPlatformName;
}
/// <summary>
/// Common method for handling platform names.
/// </summary>
/// <param name="celt">Specifies the requested number of platform names. If this number is unknown, celt can be zero.</param>
/// <param name="names">On input, an allocated array to hold the number of platform names specified by celt. This parameter can also be null if the celt parameter is zero. On output, names contains platform names</param>
/// <param name="actual">A count of the actual number of platform names returned.</param>
/// <param name="platforms">An array of available platform names</param>
/// <returns>A count of the actual number of platform names returned.</returns>
/// <devremark>The platforms array is never null. It is assured by the callers.</devremark>
private static int GetPlatforms(uint celt, string[] names, uint[] actual, string[] platforms)
{
Debug.Assert(platforms != null, "The plaforms array should never be null");
if(names == null)
{
if(actual == null || actual.Length == 0)
{
throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "actual");
}
actual[0] = (uint)platforms.Length;
return VSConstants.S_OK;
}
//Degenarate case
if(celt == 0)
{
if(actual != null && actual.Length != 0)
{
actual[0] = (uint)platforms.Length;
}
return VSConstants.S_OK;
}
uint returned = 0;
for(int i = 0; i < platforms.Length && names.Length > returned; i++)
{
names[returned] = platforms[i];
returned++;
}
if(actual != null && actual.Length != 0)
{
actual[0] = returned;
}
if(celt > returned)
{
return VSConstants.S_FALSE;
}
return VSConstants.S_OK;
}
#endregion
/// <summary>
/// Get all the configurations in the project.
/// </summary>
private string[] GetPropertiesConditionedOn(string constant)
{
List<string> configurations = null;
this.project.BuildProject.ReevaluateIfNecessary();
this.project.BuildProject.ConditionedProperties.TryGetValue(constant, out configurations);
return (configurations == null) ? new string[] { } : configurations.ToArray();
}
}
}
| 45.345133 | 275 | 0.595294 | [
"Apache-2.0"
] | MSOpenTech/Visual-Studio-Puppet-plugin | VSPuppet/ProjectBase/ConfigProvider.cs | 35,868 | C# |
using System;
using System.Threading.Tasks;
using ElmSharp;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Platform;
using ERect = ElmSharp.Rect;
using XStackLayout = Microsoft.Maui.Controls.StackLayout;
namespace Microsoft.Maui.Controls.Compatibility.Platform.Tizen
{
enum SwipeDrawerState
{
Opend,
Closed
}
public class SwipeViewRenderer : LayoutRenderer
{
static readonly double SwipeItemWidth = Forms.ConvertToScaledDP(100);
static readonly double SwipeItemHeight = Forms.ConvertToScaledDP(40);
static readonly int MovementThreshold = 1000;
static readonly uint SwipeAnimationDuration = 120;
GestureLayer _gestureLayer;
IVisualElementRenderer _itemsRenderer;
SwipeView SwipeView => Element as SwipeView;
bool HasLeftItems => SwipeView.LeftItems?.Count > 0;
bool HasRightItems => SwipeView.RightItems?.Count > 0;
bool HasTopItems => SwipeView.TopItems?.Count > 0;
bool HasBottomItems => SwipeView.BottomItems?.Count > 0;
SwipeDirection SwipeDirection { get; set; }
SwipeDrawerState DrawerState { get; set; }
int MaximumSwipeSize { get; set; }
bool IsHorizontalSwipe => SwipeDirection == SwipeDirection.Left || SwipeDirection == SwipeDirection.Right;
bool IsNegativeDirection => SwipeDirection == SwipeDirection.Left || SwipeDirection == SwipeDirection.Up;
SwipeItems CurrentItems { get; set; }
protected override void OnElementChanged(ElementChangedEventArgs<Layout> e)
{
base.OnElementChanged(e);
Initialize();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_gestureLayer?.Unrealize();
_gestureLayer = null;
_itemsRenderer?.Dispose();
_itemsRenderer = null;
}
base.Dispose(disposing);
}
void Initialize()
{
_gestureLayer?.Unrealize();
_gestureLayer = new GestureLayer(NativeView);
_gestureLayer.Attach(NativeView);
_gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Move, OnMoved);
_gestureLayer.SetMomentumCallback(GestureLayer.GestureState.End, OnEnd);
_gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Abort, OnEnd);
SwipeDirection = 0;
DrawerState = SwipeDrawerState.Closed;
Control.AllowFocus(true);
Control.Unfocused += (s, e) =>
{
_ = SwipeCloseAsync();
};
}
void OnMoved(GestureLayer.MomentumData moment)
{
if (SwipeDirection == 0)
{
var direction = SwipeDirectionHelper.GetSwipeDirection(new Graphics.Point(moment.X1, moment.Y1), new Graphics.Point(moment.X2, moment.Y2));
if (HasRightItems && direction == SwipeDirection.Left)
{
SwipeDirection = SwipeDirection.Left;
}
else if (HasLeftItems && direction == SwipeDirection.Right)
{
SwipeDirection = SwipeDirection.Right;
}
else if (HasTopItems && direction == SwipeDirection.Down)
{
SwipeDirection = SwipeDirection.Down;
}
else if (HasBottomItems && direction == SwipeDirection.Up)
{
SwipeDirection = SwipeDirection.Up;
}
else
{
return;
}
UpdateItems();
((ISwipeViewController)Element).SendSwipeStarted(new SwipeStartedEventArgs(SwipeDirection));
}
var offset = GetSwipeOffset(moment);
if (IsNegativeDirection)
{
if (offset > 0)
offset = 0;
}
else
{
if (offset < 0)
offset = 0;
}
if (Math.Abs(offset) > MaximumSwipeSize)
{
offset = MaximumSwipeSize * (offset < 0 ? -1 : 1);
}
var toDragBound = NativeView.Geometry;
if (IsHorizontalSwipe)
{
toDragBound.X += offset;
}
else
{
toDragBound.Y += offset;
}
Platform.GetRenderer(SwipeView.Content).NativeView.Geometry = toDragBound;
((ISwipeViewController)Element).SendSwipeChanging(new SwipeChangingEventArgs(SwipeDirection, Forms.ConvertToScaledDP(offset)));
}
async void OnEnd(GestureLayer.MomentumData moment)
{
if (SwipeDirection == 0)
return;
if (ShouldBeOpen(moment))
{
await SwipeOpenAsync();
if (CurrentItems.Mode == SwipeMode.Execute)
{
ExecuteItems(CurrentItems);
_ = SwipeCloseAsync();
}
}
else
{
await SwipeCloseAsync();
}
}
async Task SwipeOpenAsync()
{
var opendBound = NativeView.Geometry;
if (IsHorizontalSwipe)
{
opendBound.X += MaximumSwipeSize * (IsNegativeDirection ? -1 : 1);
}
else
{
opendBound.Y += MaximumSwipeSize * (IsNegativeDirection ? -1 : 1);
}
await AnimatedMove(SwipeView.Content, Platform.GetRenderer(SwipeView.Content).NativeView, opendBound, length: SwipeAnimationDuration);
DrawerState = SwipeDrawerState.Opend;
}
async Task SwipeCloseAsync()
{
if (SwipeDirection == 0)
return;
await AnimatedMove(SwipeView.Content, Platform.GetRenderer(SwipeView.Content).NativeView, NativeView.Geometry, length: SwipeAnimationDuration);
if (_itemsRenderer != null)
{
Control.Children.Remove(_itemsRenderer.NativeView);
_itemsRenderer.Dispose();
_itemsRenderer = null;
}
((ISwipeViewController)Element).SendSwipeEnded(new SwipeEndedEventArgs(SwipeDirection, DrawerState == SwipeDrawerState.Opend));
DrawerState = SwipeDrawerState.Closed;
SwipeDirection = 0;
}
bool ShouldBeOpen(GestureLayer.MomentumData data)
{
var momentum = IsHorizontalSwipe ? data.HorizontalMomentum : data.VerticalMomentum;
if (Math.Abs(momentum) > MovementThreshold)
{
return IsNegativeDirection ? momentum < 0 : momentum > 0;
}
return Math.Abs(GetSwipeOffset(data)) > MaximumSwipeSize / 2.0;
}
int GetSwipeOffset(GestureLayer.MomentumData data)
{
if (IsHorizontalSwipe)
{
return DrawerState == SwipeDrawerState.Closed ? (data.X2 - data.X1) :
(((IsNegativeDirection ? -1 : 1) * MaximumSwipeSize) - (data.X1 - data.X2));
}
else
{
return DrawerState == SwipeDrawerState.Closed ? (data.Y2 - data.Y1) :
(((IsNegativeDirection ? -1 : 1) * MaximumSwipeSize) - (data.Y1 - data.Y2));
}
}
SwipeItems GetSwipedItems()
{
SwipeItems items = SwipeView.LeftItems;
switch (SwipeDirection)
{
case SwipeDirection.Right:
items = SwipeView.LeftItems;
break;
case SwipeDirection.Left:
items = SwipeView.RightItems;
break;
case SwipeDirection.Up:
items = SwipeView.BottomItems;
break;
case SwipeDirection.Down:
items = SwipeView.TopItems;
break;
}
return items;
}
void UpdateItems()
{
CurrentItems = GetSwipedItems();
var itemsLayout = new XStackLayout
{
Spacing = 0,
Orientation = IsHorizontalSwipe ? StackOrientation.Horizontal : StackOrientation.Vertical,
FlowDirection = SwipeDirection == SwipeDirection.Left ? FlowDirection.RightToLeft : FlowDirection.LeftToRight
};
foreach (var item in CurrentItems)
{
View itemView = null;
if (item is SwipeItem switem)
{
itemView = CreateItemView(switem, !IsHorizontalSwipe);
}
else if (item is SwipeItemView customItem)
{
itemView = CreateItemView(customItem);
}
else
{
continue;
}
var tap = new TapGestureRecognizer();
tap.Command = item.Command;
tap.CommandParameter = item.CommandParameter;
tap.Tapped += (s, e) =>
{
if (item is SwipeItem swipeItem)
swipeItem.OnInvoked();
if (item is SwipeItemView customSwipeItem)
customSwipeItem.OnInvoked();
if (CurrentItems.SwipeBehaviorOnInvoked != SwipeBehaviorOnInvoked.RemainOpen)
{
Device.BeginInvokeOnMainThread(() =>
{
_ = SwipeCloseAsync();
});
}
};
itemView.GestureRecognizers.Add(tap);
if (IsHorizontalSwipe)
{
itemView.HorizontalOptions = LayoutOptions.Start;
itemView.VerticalOptions = LayoutOptions.FillAndExpand;
}
else
{
itemView.VerticalOptions = LayoutOptions.Start;
itemView.HorizontalOptions = LayoutOptions.FillAndExpand;
}
itemsLayout.Children.Add(itemView);
}
var itemsRenderer = Platform.GetOrCreateRenderer(itemsLayout);
(itemsRenderer as ILayoutRenderer)?.RegisterOnLayoutUpdated();
var measured = itemsLayout.Measure(Element.Width, Element.Height);
MaximumSwipeSize = Forms.ConvertToScaledPixel(
IsHorizontalSwipe ?
Math.Min(measured.Request.Width, Element.Width) :
Math.Min(measured.Request.Height, Element.Height));
Control.Children.Add(itemsRenderer.NativeView);
var itemsGeometry = NativeView.Geometry;
if (SwipeDirection == SwipeDirection.Up)
{
itemsGeometry.Y += (itemsGeometry.Height - MaximumSwipeSize);
}
itemsRenderer.NativeView.Geometry = itemsGeometry;
itemsRenderer.NativeView.StackBelow(Platform.GetRenderer(SwipeView.Content).NativeView);
_itemsRenderer = itemsRenderer;
}
static Task AnimatedMove(IAnimatable animatable, EvasObject target, ERect dest, Easing easing = null, uint length = 120)
{
var tcs = new TaskCompletionSource<bool>();
var dx = target.Geometry.X - dest.X;
var dy = target.Geometry.Y - dest.Y;
new Animation((progress) =>
{
ERect toMove = dest;
toMove.X += (int)(dx * (1 - progress));
toMove.Y += (int)(dy * (1 - progress));
target.Geometry = toMove;
}).Commit(animatable, "Move", rate: 60, length: length, easing: easing, finished: (p, e) =>
{
tcs.SetResult(true);
});
return tcs.Task;
}
static View CreateItemView(SwipeItemView item)
{
return new XStackLayout
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Children =
{
item.Content
}
};
}
static View CreateItemView(SwipeItem item, bool horizontal)
{
var image = new Image
{
Source = item.IconImageSource
};
var label = new Label
{
Text = item.Text,
HorizontalTextAlignment = TextAlignment.Center,
FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)),
};
if (horizontal)
{
image.VerticalOptions = LayoutOptions.FillAndExpand;
image.HorizontalOptions = LayoutOptions.Start;
label.VerticalOptions = LayoutOptions.CenterAndExpand;
label.HorizontalOptions = LayoutOptions.CenterAndExpand;
label.VerticalTextAlignment = TextAlignment.Center;
label.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));
}
else
{
image.VerticalOptions = LayoutOptions.FillAndExpand;
image.HorizontalOptions = LayoutOptions.FillAndExpand;
label.VerticalOptions = LayoutOptions.EndAndExpand;
label.HorizontalOptions = LayoutOptions.CenterAndExpand;
label.VerticalTextAlignment = TextAlignment.End;
}
var layout = new XStackLayout
{
Padding = 5,
BackgroundColor = item.BackgroundColor,
VerticalOptions = LayoutOptions.FillAndExpand,
Orientation = horizontal ? StackOrientation.Horizontal : StackOrientation.Vertical,
Children =
{
image,
label
}
};
if (horizontal)
{
layout.HeightRequest = SwipeItemHeight;
}
else
{
layout.WidthRequest = SwipeItemWidth;
}
return layout;
}
static void ExecuteItems(SwipeItems items)
{
foreach (var item in items)
{
if (item is SwipeItem swipeItem && swipeItem.IsEnabled)
item.OnInvoked();
else if (item is SwipeItemView customSwipeItem && customSwipeItem.IsEnabled)
item.OnInvoked();
}
}
}
}
| 26.314685 | 146 | 0.69581 | [
"MIT"
] | JoonghyunCho/TestBed | src/Compatibility/Core/src/Tizen/Renderers/SwipeViewRenderer.cs | 11,289 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using AillieoUtils;
using UnityEngine;
using UnityEngine.Assertions;
public class MatrixTest : MonoBehaviour
{
void Start()
{
TestFlat();
TestLoad();
Debug.Log("MatrixTest Pass");
}
public void TestFlat()
{
Matrix m = new Matrix(2, 3);
for (int i = 0; i < m.column; ++i)
{
for (int j = 0; j < m.row; ++j)
{
m[j, i] = i * 10 + j;
}
}
Vector v = m.Flat();
Assert.AreEqual(v[0], m[0,0]);
Assert.AreEqual(v[1], m[0,1]);
Assert.AreEqual(v[2], m[0,2]);
Assert.AreEqual(v[3], m[1,0]);
Assert.AreEqual(v[4], m[1,1]);
Assert.AreEqual(v[5], m[1,2]);
}
public void TestLoad()
{
Vector v = new Vector(new double[]{1,2,3,4,5,6,});
Matrix m = new Matrix(2, 3);
m.Load(v);
Assert.AreEqual(v[0], m[0,0]);
Assert.AreEqual(v[1], m[0,1]);
Assert.AreEqual(v[2], m[0,2]);
Assert.AreEqual(v[3], m[1,0]);
Assert.AreEqual(v[4], m[1,1]);
Assert.AreEqual(v[5], m[1,2]);
}
}
| 23.557692 | 58 | 0.480816 | [
"MIT"
] | aillieo/EasyGeneticAlgorithm | Assets/EasyGA/Tests/MatrixTest.cs | 1,227 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoftwareBlogsMVP.Models
{
public interface IModel
{
string getName();
}
}
| 15.857143 | 33 | 0.720721 | [
"MIT"
] | Iqrahaq/CSharp | kf7014/week5/SoftwareBlogsMVP/SoftwareBlogsMVP/Models/IModel.cs | 224 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: Templates\CSharp\Requests\MethodRequestBuilder.cs.tt
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.IO;
/// <summary>
/// The type WorkbookFunctionsPriceRequestBuilder.
/// </summary>
public partial class WorkbookFunctionsPriceRequestBuilder : BaseActionMethodRequestBuilder<IWorkbookFunctionsPriceRequest>, IWorkbookFunctionsPriceRequestBuilder
{
/// <summary>
/// Constructs a new <see cref="WorkbookFunctionsPriceRequestBuilder"/>.
/// </summary>
/// <param name="requestUrl">The URL for the request.</param>
/// <param name="client">The <see cref="IBaseClient"/> for handling requests.</param>
/// <param name="settlement">A settlement parameter for the OData method call.</param>
/// <param name="maturity">A maturity parameter for the OData method call.</param>
/// <param name="rate">A rate parameter for the OData method call.</param>
/// <param name="yld">A yld parameter for the OData method call.</param>
/// <param name="redemption">A redemption parameter for the OData method call.</param>
/// <param name="frequency">A frequency parameter for the OData method call.</param>
/// <param name="basis">A basis parameter for the OData method call.</param>
public WorkbookFunctionsPriceRequestBuilder(
string requestUrl,
IBaseClient client,
Newtonsoft.Json.Linq.JToken settlement,
Newtonsoft.Json.Linq.JToken maturity,
Newtonsoft.Json.Linq.JToken rate,
Newtonsoft.Json.Linq.JToken yld,
Newtonsoft.Json.Linq.JToken redemption,
Newtonsoft.Json.Linq.JToken frequency,
Newtonsoft.Json.Linq.JToken basis)
: base(requestUrl, client)
{
this.SetParameter("settlement", settlement, true);
this.SetParameter("maturity", maturity, true);
this.SetParameter("rate", rate, true);
this.SetParameter("yld", yld, true);
this.SetParameter("redemption", redemption, true);
this.SetParameter("frequency", frequency, true);
this.SetParameter("basis", basis, true);
}
/// <summary>
/// A method used by the base class to construct a request class instance.
/// </summary>
/// <param name="functionUrl">The request URL to </param>
/// <param name="options">The query and header options for the request.</param>
/// <returns>An instance of a specific request class.</returns>
protected override IWorkbookFunctionsPriceRequest CreateRequest(string functionUrl, IEnumerable<Option> options)
{
var request = new WorkbookFunctionsPriceRequest(functionUrl, this.Client, options);
if (this.HasParameter("settlement"))
{
request.RequestBody.Settlement = this.GetParameter<Newtonsoft.Json.Linq.JToken>("settlement");
}
if (this.HasParameter("maturity"))
{
request.RequestBody.Maturity = this.GetParameter<Newtonsoft.Json.Linq.JToken>("maturity");
}
if (this.HasParameter("rate"))
{
request.RequestBody.Rate = this.GetParameter<Newtonsoft.Json.Linq.JToken>("rate");
}
if (this.HasParameter("yld"))
{
request.RequestBody.Yld = this.GetParameter<Newtonsoft.Json.Linq.JToken>("yld");
}
if (this.HasParameter("redemption"))
{
request.RequestBody.Redemption = this.GetParameter<Newtonsoft.Json.Linq.JToken>("redemption");
}
if (this.HasParameter("frequency"))
{
request.RequestBody.Frequency = this.GetParameter<Newtonsoft.Json.Linq.JToken>("frequency");
}
if (this.HasParameter("basis"))
{
request.RequestBody.Basis = this.GetParameter<Newtonsoft.Json.Linq.JToken>("basis");
}
return request;
}
}
}
| 44.533981 | 165 | 0.60061 | [
"MIT"
] | OfficeGlobal/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Requests/Generated/WorkbookFunctionsPriceRequestBuilder.cs | 4,587 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using PDFium.NET.Native;
namespace PDFium.NET
{
/// <summary>
/// A class to work with document destinations.
/// </summary>
public class DestinationsCollection : IEnumerable<Destination>, IDisposable
{
/// <summary>
/// Document instance.
/// </summary>
[NotNull] private readonly DocumentHandle _documentHandle;
/// <summary>
/// Document destinations.
/// </summary>
[NotNull] private readonly List<Destination> _destinations;
internal DestinationsCollection([NotNull] DocumentHandle documentHandle)
{
_documentHandle = documentHandle;
var destinationsCount = Bindings.CountNamedDestinations(_documentHandle);
_destinations = new List<Destination>(destinationsCount);
for (var destinationIndex = 0; destinationIndex < destinationsCount; ++destinationIndex)
{
_destinations.Add(new Destination(_documentHandle, destinationIndex));
}
}
/// <summary>
/// Page indexer with lazy initialization.
/// </summary>
/// <param name="index">Page index.</param>
/// <returns>The page,</returns>
public Destination this[int index] => _destinations[index] ?? (_destinations[index] = new Destination(_documentHandle, index));
/// <summary>
/// Returns pages count.
/// </summary>
public int Count => _destinations.Capacity;
public IEnumerator<Destination> GetEnumerator()
{
return _destinations.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Dispose()
{
}
}
}
| 29.578125 | 135 | 0.60803 | [
"Apache-2.0"
] | crabn3bula/PDFium.NET | PDFium.NET/DestinationsCollection.cs | 1,895 | C# |
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Linq;
using System.Reactive.Linq;
using System.Reflection;
using Avalonia.Controls;
using Avalonia.Reactive;
namespace Avalonia.LogicalTree
{
/// <summary>
/// Locates controls relative to other controls.
/// </summary>
public static class ControlLocator
{
public static IObservable<ILogical> Track(ILogical relativeTo, int ancestorLevel, Type ancestorType = null)
{
return new ControlTracker(relativeTo, ancestorLevel, ancestorType);
}
private class ControlTracker : LightweightObservableBase<ILogical>
{
private readonly ILogical _relativeTo;
private readonly int _ancestorLevel;
private readonly Type _ancestorType;
ILogical _value;
public ControlTracker(ILogical relativeTo, int ancestorLevel, Type ancestorType)
{
_relativeTo = relativeTo;
_ancestorLevel = ancestorLevel;
_ancestorType = ancestorType;
}
protected override void Initialize()
{
Update();
_relativeTo.AttachedToLogicalTree += Attached;
_relativeTo.DetachedFromLogicalTree += Detached;
}
protected override void Deinitialize()
{
_relativeTo.AttachedToLogicalTree -= Attached;
_relativeTo.DetachedFromLogicalTree -= Detached;
_value = null;
}
protected override void Subscribed(IObserver<ILogical> observer, bool first)
{
observer.OnNext(_value);
}
private void Attached(object sender, LogicalTreeAttachmentEventArgs e)
{
Update();
PublishNext(_value);
}
private void Detached(object sender, LogicalTreeAttachmentEventArgs e)
{
_value = null;
PublishNext(null);
}
private void Update()
{
_value = _relativeTo.GetLogicalAncestors()
.Where(x => _ancestorType?.GetTypeInfo().IsAssignableFrom(x.GetType().GetTypeInfo()) ?? true)
.ElementAtOrDefault(_ancestorLevel);
}
}
}
}
| 32.102564 | 115 | 0.586262 | [
"MIT"
] | HendrikMennen/Avalonia | src/Avalonia.Styling/LogicalTree/ControlLocator.cs | 2,504 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace Bridge.Test.NUnit {
/// <summary>
/// This attribute is used inside a <c>TestFixture</c> to provide a common set of functions that are performed after each test method.
/// <c>TearDown</c> methods may be either static or instance methods and you may define more than one of them in a fixture.
/// The <c>TearDown</c> method is guaranteed to run. It will not run if a <c>SetUp</c> method fails or throws an exception.
/// </summary>
public sealed class TearDownAttribute : Attribute {
}
}
| 41.428571 | 136 | 0.725862 | [
"Apache-2.0"
] | Cheatoid/CSharp.lua | test/BridgeNetTests/BridgeTestNUnit/src/TearDownAttribute.cs | 580 | C# |
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
namespace Npoi.Core.SS.Util
{
using Npoi.Core.Util;
using System;
public class MutableFPNumber
{
// TODO - what about values between (10<sup>14</sup>-0.5) and (10<sup>14</sup>-0.05) ?
/**
* The minimum value in 'Base-10 normalised form'.<br/>
* When {@link #_binaryExponent} == 46 this is the the minimum {@link #_frac} value
* (10<sup>14</sup>-0.05) * 2^17
* <br/>
* Values between (10<sup>14</sup>-0.05) and 10<sup>14</sup> will be represented as '1'
* followed by 14 zeros.
* Values less than (10<sup>14</sup>-0.05) will get Shifted by one more power of 10
*
* This frac value rounds to '1' followed by fourteen zeros with an incremented decimal exponent
*/
//private static BigInteger BI_MIN_BASE = new BigInteger("0B5E620F47FFFE666", 16);
private static readonly BigInteger BI_MIN_BASE = new BigInteger(new int[] { -1243209484, 2147477094 }, 1);
/**
* For 'Base-10 normalised form'<br/>
* The maximum {@link #_frac} value when {@link #_binaryExponent} == 49
* (10^15-0.5) * 2^14
*/
//private static BigInteger BI_MAX_BASE = new BigInteger("0E35FA9319FFFE000", 16);
private static readonly BigInteger BI_MAX_BASE = new BigInteger(new int[] { -480270031, -1610620928 }, 1);
/**
* Width of a long
*/
private const int C_64 = 64;
/**
* Minimum precision after discarding whole 32-bit words from the significand
*/
private const int MIN_PRECISION = 72;
private BigInteger _significand;
private int _binaryExponent;
public MutableFPNumber(BigInteger frac, int binaryExponent)
{
_significand = frac;
_binaryExponent = binaryExponent;
}
public MutableFPNumber Copy()
{
return new MutableFPNumber(_significand, _binaryExponent);
}
public void Normalise64bit()
{
int oldBitLen = _significand.BitLength();
int sc = oldBitLen - C_64;
if (sc == 0)
{
return;
}
if (sc < 0)
{
throw new InvalidOperationException("Not enough precision");
}
_binaryExponent += sc;
if (sc > 32)
{
int highShift = (sc - 1) & 0xFFFFE0;
_significand = _significand >> (highShift);
sc -= highShift;
oldBitLen -= highShift;
}
if (sc < 1)
{
throw new InvalidOperationException();
}
_significand = Rounder.Round(_significand, sc);
if (_significand.BitLength() > oldBitLen)
{
sc++;
_binaryExponent++;
}
_significand = _significand >> (sc);
}
public int Get64BitNormalisedExponent()
{
//return _binaryExponent + _significand.BitCount() - C_64;
return _binaryExponent + _significand.BitLength() - C_64;
}
public bool IsBelowMaxRep()
{
int sc = _significand.BitLength() - C_64;
//return _significand<(BI_MAX_BASE<<(sc));
return _significand.CompareTo(BI_MAX_BASE.ShiftLeft(sc)) < 0;
}
public bool IsAboveMinRep()
{
int sc = _significand.BitLength() - C_64;
return _significand.CompareTo(BI_MIN_BASE.ShiftLeft(sc)) > 0;
//return _significand>(BI_MIN_BASE<<(sc));
}
public NormalisedDecimal CreateNormalisedDecimal(int pow10)
{
// missingUnderBits is (0..3)
int missingUnderBits = _binaryExponent - 39;
int fracPart = (_significand.IntValue() << missingUnderBits) & 0xFFFF80;
long wholePart = (_significand >> (C_64 - _binaryExponent - 1)).LongValue();
return new NormalisedDecimal(wholePart, fracPart, pow10);
}
public void multiplyByPowerOfTen(int pow10)
{
TenPower tp = TenPower.GetInstance(Math.Abs(pow10));
if (pow10 < 0)
{
mulShift(tp._divisor, tp._divisorShift);
}
else
{
mulShift(tp._multiplicand, tp._multiplierShift);
}
}
private void mulShift(BigInteger multiplicand, int multiplierShift)
{
_significand = _significand * multiplicand;
_binaryExponent += multiplierShift;
// check for too much precision
int sc = (_significand.BitLength() - MIN_PRECISION) & unchecked((int)0xFFFFFFE0);
// mask Makes multiples of 32 which optimises BigInt32.ShiftRight
if (sc > 0)
{
// no need to round because we have at least 8 bits of extra precision
_significand = _significand >> (sc);
_binaryExponent += sc;
}
}
private class Rounder
{
private static BigInteger[] HALF_BITS;
static Rounder()
{
BigInteger[] bis = new BigInteger[33];
long acc = 1;
for (int i = 1; i < bis.Length; i++)
{
bis[i] = new BigInteger(acc);
acc <<= 1;
}
HALF_BITS = bis;
}
/**
* @param nBits number of bits to shift right
*/
public static BigInteger Round(BigInteger bi, int nBits)
{
if (nBits < 1)
{
return bi;
}
return bi + (HALF_BITS[nBits]);
}
}
/**
* Holds values for quick multiplication and division by 10
*/
private class TenPower
{
private static readonly BigInteger FIVE = new BigInteger(5L);// new BigInteger("5",10);
private static TenPower[] _cache = new TenPower[350];
public BigInteger _multiplicand;
public BigInteger _divisor;
public int _divisorShift;
public int _multiplierShift;
private TenPower(int index)
{
//BigInteger fivePowIndex = FIVE.ModPow(new BigInteger(index),FIVE);
BigInteger fivePowIndex = FIVE.Pow(index);
int bitsDueToFiveFactors = fivePowIndex.BitLength();
int px = 80 + bitsDueToFiveFactors;
BigInteger fx = (BigInteger.One << px) / (fivePowIndex);
int adj = fx.BitLength() - 80;
_divisor = fx >> (adj);
bitsDueToFiveFactors -= adj;
_divisorShift = -(bitsDueToFiveFactors + index + 80);
int sc = fivePowIndex.BitLength() - 68;
if (sc > 0)
{
_multiplierShift = index + sc;
_multiplicand = fivePowIndex >> (sc);
}
else
{
_multiplierShift = index;
_multiplicand = fivePowIndex;
}
}
public static TenPower GetInstance(int index)
{
TenPower result = _cache[index];
if (result == null)
{
result = new TenPower(index);
_cache[index] = result;
}
return result;
}
}
public ExpandedDouble CreateExpandedDouble()
{
return new ExpandedDouble(_significand, _binaryExponent);
}
}
} | 35.317269 | 114 | 0.523652 | [
"Apache-2.0"
] | Arch/Npoi.Core | src/Npoi.Core/SS/Util/MutableFPNumber.cs | 8,794 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("IsPrime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IsPrime")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5063909c-e516-4dff-95e2-672349f99173")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.416667 | 84 | 0.746845 | [
"MIT"
] | DJBuro/Telerik | JavaScriptFund/OperatorsAndExpressions/IsPrime/Properties/AssemblyInfo.cs | 1,350 | C# |
using System.Diagnostics;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace IUSystem.Areas.Identity.Pages
{
[AllowAnonymous]
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
| 27.045455 | 88 | 0.694118 | [
"MIT"
] | Jordan3900/IUSystem | IUSystem/Areas/Identity/Pages/Error.cshtml.cs | 597 | C# |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Dolittle. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
* --------------------------------------------------------------------------------------------*/
using Dolittle.Tenancy;
using Machine.Specifications;
namespace Infrastructure.Services.Github.Webhooks.Handling.for_TenantMapper.when_getting_a_tenant_for_an_installation
{
[Subject(typeof(IInstallationToTenantMapper), "GetTenantFor")]
public class and_that_tenant_is_associated_with_a_single_installation : given.a_tenant_mapper
{
static TenantId mapped_tenant;
Because of = () => mapped_tenant = mapper.GetTenantFor(installation_one);
It should_return_the_correct_tenant = () => mapped_tenant.ShouldEqual((TenantId)tenant_with_single_installation);
}
} | 44.952381 | 129 | 0.617585 | [
"MIT"
] | dolittle-platform/ContinuousImprovement | Specifications/Infrastructure/Services/Github/Webhooks/Handling/for_TenantMapper/when_getting_a_tenant_for_an_installation/and_that_tenant_is_associated_with_a_single_installation.cs | 944 | C# |
using System;
using System.Security.Authentication;
using System.Text;
using System.Threading.Tasks;
using CryptoExchange.Net.Interfaces;
using CryptoExchange.Net.Objects;
using Newtonsoft.Json;
namespace Binance.Net.UnitTests.TestImplementations
{
public class TestSocket: IWebsocket
{
public bool CanConnect { get; set; }
public bool Connected { get; set; }
#pragma warning disable 8618
public event Action OnClose;
public event Action<string> OnMessage;
public event Action<Exception> OnError;
public event Action OnOpen;
#pragma warning restore 8618
public int Id { get; }
public bool ShouldReconnect { get; set; }
public Func<string, string> DataInterpreterString { get; set; }
public Func<byte[], string> DataInterpreterBytes { get; set; }
public DateTime? DisconnectTime { get; set; }
public string Url { get; set; }
public bool IsClosed => !Connected;
public bool IsOpen => Connected;
public bool PingConnection { get; set; }
public TimeSpan PingInterval { get; set; }
public SslProtocols SSLProtocols { get; set; }
public TimeSpan Timeout { get; set; }
public string Origin { get; set; }
public bool Reconnecting { get; set; }
public Encoding Encoding { get; set; }
public TimeSpan CloseTime { get; set; }
public TimeSpan OpenTime { get; set; }
public int? RatelimitPerSecond { get; set; }
public double IncomingKbps => 0;
public async Task<bool> ConnectAsync()
{
await Task.Delay(OpenTime);
Connected = CanConnect;
OnOpen?.Invoke();
return true;
}
public void Send(string data)
{
if(!Connected)
throw new Exception("Socket not connected");
}
public void Reset()
{
}
public async Task CloseAsync()
{
await Task.Delay(CloseTime);
Connected = false;
DisconnectTime = DateTime.UtcNow;
OnClose?.Invoke();
}
public void SetProxy(ApiProxy proxy)
{
throw new NotImplementedException();
}
public void Dispose()
{
}
public void InvokeClose()
{
Connected = false;
DisconnectTime = DateTime.UtcNow;
OnClose?.Invoke();
}
public void InvokeOpen()
{
OnOpen?.Invoke();
}
public void InvokeMessage(string data)
{
OnMessage?.Invoke(data);
}
public void InvokeMessage<T>(T data)
{
OnMessage?.Invoke(JsonConvert.SerializeObject(data));
}
public void InvokeError(Exception error)
{
OnError?.Invoke(error);
}
}
}
| 27.092593 | 71 | 0.570062 | [
"MIT"
] | GetoXs/Bitfinex.Net | Bitfinex.Net.UnitTests/TestImplementations/TestSocket.cs | 2,928 | C# |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Apache.Ignite.ExamplesDll.Compute
{
using System;
using System.Collections;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.ExamplesDll.Binary;
/// <summary>
/// Average salary job.
/// </summary>
public class AverageSalaryJob : ComputeJobAdapter<Tuple<long, int>>
{
/// <summary> Employees. </summary>
private readonly ArrayList _employees = new ArrayList();
/// <summary>
/// Adds employee.
/// </summary>
/// <param name="employee">Employee.</param>
public void Add(Employee employee)
{
_employees.Add(employee);
}
/// <summary>
/// Execute the job.
/// </summary>
/// <returns>Job result: tuple with total salary in the first item and employees count in the second.</returns>
public override Tuple<long, int> Execute()
{
long sum = 0;
int count = 0;
Console.WriteLine();
Console.WriteLine(">>> Executing salary job for " + _employees.Count + " employee(s) ...");
Console.WriteLine();
foreach (Employee emp in _employees)
{
sum += emp.Salary;
count++;
}
return new Tuple<long, int>(sum, count);
}
}
}
| 33.138462 | 119 | 0.618849 | [
"Apache-2.0"
] | Aleksei-Litsov/ignite | modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs | 2,154 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using StarryEyes.Anomaly.TwitterApi.DataModels;
namespace StarryEyes.Filters.Expressions.Operators
{
public sealed class FilterOperatorPlus : FilterTwoValueOperator
{
protected override string OperatorString
{
get { return "+"; }
}
public override IEnumerable<FilterExpressionType> SupportedTypes
{
get
{
return new[] { FilterExpressionType.Numeric, FilterExpressionType.Set, FilterExpressionType.String }
.Intersect(LeftValue.SupportedTypes)
.Intersect(RightValue.SupportedTypes);
}
}
public override Func<TwitterStatus, string> GetStringValueProvider()
{
var lsp = LeftValue.GetStringValueProvider();
var rsp = RightValue.GetStringValueProvider();
return _ => lsp(_) + rsp(_);
}
public override string GetStringSqlQuery()
{
return LeftValue.GetStringSqlQuery() + " || " + RightValue.GetStringSqlQuery();
}
public override Func<TwitterStatus, IReadOnlyCollection<long>> GetSetValueProvider()
{
var lsp = LeftValue.GetSetValueProvider();
var rsp = RightValue.GetSetValueProvider();
return _ => lsp(_).Union(rsp(_)).ToList();
}
public override string GetSetSqlQuery()
{
return LeftValue.GetSetSqlQuery() + " union " + RightValue.GetSetSqlQuery();
}
public override Func<TwitterStatus, long> GetNumericValueProvider()
{
var lnp = LeftValue.GetNumericValueProvider();
var rnp = RightValue.GetNumericValueProvider();
return _ => lnp(_) + rnp(_);
}
public override string GetNumericSqlQuery()
{
return LeftValue.GetNumericSqlQuery() + " + " + RightValue.GetNumericSqlQuery();
}
}
public sealed class FilterOperatorMinus : FilterTwoValueOperator
{
protected override string OperatorString
{
get { return "-"; }
}
public override IEnumerable<FilterExpressionType> SupportedTypes
{
get
{
return new[] { FilterExpressionType.Numeric, FilterExpressionType.Set }
.Intersect(LeftValue.SupportedTypes)
.Intersect(RightValue.SupportedTypes);
}
}
public override Func<TwitterStatus, IReadOnlyCollection<long>> GetSetValueProvider()
{
var lsp = LeftValue.GetSetValueProvider();
var rsp = RightValue.GetSetValueProvider();
return _ => lsp(_).Except(rsp(_)).ToList();
}
public override string GetSetSqlQuery()
{
return LeftValue.GetSetSqlQuery() + " except " + RightValue.GetSetSqlQuery();
}
public override Func<TwitterStatus, long> GetNumericValueProvider()
{
var lnp = LeftValue.GetNumericValueProvider();
var rnp = RightValue.GetNumericValueProvider();
return _ => lnp(_) - rnp(_);
}
public override string GetNumericSqlQuery()
{
return LeftValue.GetNumericSqlQuery() + " - " + RightValue.GetNumericSqlQuery();
}
}
public sealed class FilterOperatorProduct : FilterTwoValueOperator
{
protected override string OperatorString
{
get { return "*"; }
}
public override IEnumerable<FilterExpressionType> SupportedTypes
{
get
{
return new[] { FilterExpressionType.Numeric, FilterExpressionType.Set }
.Intersect(LeftValue.SupportedTypes)
.Intersect(RightValue.SupportedTypes);
}
}
public override Func<TwitterStatus, IReadOnlyCollection<long>> GetSetValueProvider()
{
var lsp = LeftValue.GetSetValueProvider();
var rsp = RightValue.GetSetValueProvider();
return _ => lsp(_).Intersect(rsp(_)).ToList();
}
public override string GetSetSqlQuery()
{
return LeftValue.GetSetSqlQuery() + " intersect " + RightValue.GetSetSqlQuery();
}
public override Func<TwitterStatus, long> GetNumericValueProvider()
{
var lnp = LeftValue.GetNumericValueProvider();
var rnp = RightValue.GetNumericValueProvider();
return _ => lnp(_) * rnp(_);
}
public override string GetNumericSqlQuery()
{
return LeftValue.GetNumericSqlQuery() + " * " + RightValue.GetNumericSqlQuery();
}
}
public sealed class FilterOperatorDivide : FilterTwoValueOperator
{
protected override string OperatorString
{
get { return "/"; }
}
public override IEnumerable<FilterExpressionType> SupportedTypes
{
get
{
yield return FilterExpressionType.Numeric;
}
}
public override Func<TwitterStatus, long> GetNumericValueProvider()
{
var lnp = LeftValue.GetNumericValueProvider();
var rnp = RightValue.GetNumericValueProvider();
return _ =>
{
var divider = rnp(_);
return divider == 0 ? 0 : lnp(_) / divider;
};
}
public override string GetNumericSqlQuery()
{
return LeftValue.GetNumericSqlQuery() + " / " + RightValue.GetNumericSqlQuery();
}
}
}
| 32.039326 | 116 | 0.580046 | [
"MIT"
] | Grabacr07/StarryEyes | StarryEyes/Filters/Expressions/Operators/OperatorArithmetics.cs | 5,705 | C# |
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
public class TC_LevelWithTerrain : MonoBehaviour {
public bool levelChildren;
void Update()
{
if (levelChildren)
{
levelChildren = false;
LevelChildren();
}
}
void LevelChildren()
{
Transform child;
RaycastHit hit;
Ray ray = new Ray();
ray.direction = new Vector3(0, -1, 0);
int layer = LayerMask.NameToLayer("Terrain");
layer = ~layer;
int childCount = transform.childCount;
for (int i = 0; i < childCount; i++)
{
child = transform.GetChild(i);
ray.origin = child.position;
if (Physics.Raycast(ray, out hit))
{
child.position = new Vector3(child.position.x, hit.point.y, child.position.z);
}
}
}
}
| 20.391304 | 94 | 0.547974 | [
"MIT"
] | MelDv/DistributedShooter | Assets/TerrainComposer2/Scripts/Terrain/TC_LevelWithTerrain.cs | 940 | C# |
using System.Collections.ObjectModel;
namespace EZOper.TechTester.CSharpWebSI.Areas.ZApi
{
public class ComplexTypeModelDescription : ModelDescription
{
public ComplexTypeModelDescription()
{
Properties = new Collection<ParameterDescription>();
}
public Collection<ParameterDescription> Properties { get; private set; }
}
} | 27.214286 | 80 | 0.700787 | [
"MIT"
] | erikzhouxin/CSharpSolution | TechTester/CSharpWebSI/Areas/ZApi/ModelDescriptions/ComplexTypeModelDescription.cs | 381 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("06. Foreign Languages")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("06. Foreign Languages")]
[assembly: System.Reflection.AssemblyTitleAttribute("06. Foreign Languages")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
| 43.166667 | 81 | 0.635135 | [
"MIT"
] | dradoslavov/Technology-Fundamentals | 01.Intro and Basic Syntax - Lab/06. Foreign Languages/obj/Debug/netcoreapp2.1/06. Foreign Languages.AssemblyInfo.cs | 1,036 | C# |
/*
* LUSID API
*
* # Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages and frameworks: * [C#](https://github.com/finbourne/lusid-sdk-csharp) * [Java](https://github.com/finbourne/lusid-sdk-java) * [JavaScript](https://github.com/finbourne/lusid-sdk-js) * [Python](https://github.com/finbourne/lusid-sdk-python) * [Angular](https://github.com/finbourne/lusid-sdk-angular) # Data Model The LUSID API has a relatively lightweight but extremely powerful data model. One of the goals of LUSID was not to enforce on clients a single rigid data model but rather to provide a flexible foundation onto which clients can map their own data models. The core entities in LUSID provide a minimal structure and set of relationships, and the data model can be extended using Properties. The LUSID data model is exposed through the LUSID APIs. The APIs provide access to both business objects and the meta data used to configure the systems behaviours. The key business entities are: - * **Portfolios** A portfolio is a container for transactions and holdings (a **Transaction Portfolio**) or constituents (a **Reference Portfolio**). * **Derived Portfolios**. Derived Portfolios allow Portfolios to be created based on other Portfolios, by overriding or adding specific items. * **Holdings** A Holding is a quantity of an Instrument or a balance of cash within a Portfolio. Holdings can only be adjusted via Transactions. * **Transactions** A Transaction is an economic event that occurs in a Portfolio, causing its holdings to change. * **Corporate Actions** A corporate action is a market event which occurs to an Instrument and thus applies to all portfolios which holding the instrument. Examples are stock splits or mergers. * **Constituents** A constituent is a record in a Reference Portfolio containing an Instrument and an associated weight. * **Instruments** An instrument represents a currency, tradable instrument or OTC contract that is attached to a transaction and a holding. * **Properties** All major entities allow additional user defined properties to be associated with them. For example, a Portfolio manager may be associated with a portfolio. Meta data includes: - * **Transaction Types** Transactions are booked with a specific transaction type. The types are client defined and are used to map the Transaction to a series of movements which update the portfolio holdings. * **Properties Types** Types of user defined properties used within the system. ## Scope All data in LUSID is segregated at the client level. Entities in LUSID are identifiable by a unique code. Every entity lives within a logical data partition known as a Scope. Scope is an identity namespace allowing two entities with the same unique code to co-exist within individual address spaces. For example, prices for equities from different vendors may be uploaded into different scopes such as `client/vendor1` and `client/vendor2`. A portfolio may then be valued using either of the price sources by referencing the appropriate scope. LUSID Clients cannot access scopes of other clients. ## Instruments LUSID has its own built-in instrument master which you can use to master your own instrument universe. Every instrument must be created with one or more unique market identifiers, such as [FIGI](https://openfigi.com/). For any non-listed instruments (eg OTCs), you can upload an instrument against a custom ID of your choosing. In addition, LUSID will allocate each instrument a unique 'LUSID instrument identifier'. The LUSID instrument identifier is what is used when uploading transactions, holdings, prices, etc. The API exposes an `instrument/lookup` endpoint which can be used to lookup these LUSID identifiers using their market identifiers. Cash can be referenced using the ISO currency code prefixed with \"`CCY_`\" e.g. `CCY_GBP` ## Instrument Data Instrument data can be uploaded to the system using the [Instrument Properties](#tag/InstrumentProperties) endpoint. | Field|Type|Description | | - --|- --|- -- | | Key|propertykey|The key of the property. This takes the format {domain}/{scope}/{code} e.g. 'Instrument/system/Name' or 'Transaction/strategy/quantsignal'. | | Value|string|The value of the property. | | EffectiveFrom|datetimeoffset|The effective datetime from which the property is valid. | | EffectiveUntil|datetimeoffset|The effective datetime until which the property is valid. If not supplied this will be valid indefinitely, potentially overwriting values with EffectiveFrom's in the future. | ## Transaction Portfolios Portfolios are the top-level entity containers within LUSID, containing transactions, corporate actions and holdings. The transactions build up the portfolio holdings on which valuations, analytics profit & loss and risk can be calculated. Properties can be associated with Portfolios to add in additional data. Portfolio properties can be changed over time, for example to allow a Portfolio Manager to be linked with a Portfolio. Additionally, portfolios can be securitised and held by other portfolios, allowing LUSID to perform \"drill-through\" into underlying fund holdings ### Derived Portfolios LUSID also allows for a portfolio to be composed of another portfolio via derived portfolios. A derived portfolio can contain its own transactions and also inherits any transactions from its parent portfolio. Any changes made to the parent portfolio are automatically reflected in derived portfolio. Derived portfolios in conjunction with scopes are a powerful construct. For example, to do pre-trade what-if analysis, a derived portfolio could be created a new namespace linked to the underlying live (parent) portfolio. Analysis can then be undertaken on the derived portfolio without affecting the live portfolio. ### Transactions A transaction represents an economic activity against a Portfolio. Transactions are processed according to a configuration. This will tell the LUSID engine how to interpret the transaction and correctly update the holdings. LUSID comes with a set of transaction types you can use out of the box, or you can configure your own set(s) of transactions. For more details see the [LUSID Getting Started Guide for transaction configuration.](https://support.lusid.com/configuring-transaction-types) | Field|Type|Description | | - --|- --|- -- | | TransactionId|string|The unique identifier for the transaction. | | Type|string|The type of the transaction e.g. 'Buy', 'Sell'. The transaction type should have been pre-configured via the System Configuration API endpoint. If it hasn't been pre-configured the transaction will still be updated or inserted however you will be unable to generate the resultant holdings for the portfolio that contains this transaction as LUSID does not know how to process it. | | InstrumentIdentifiers|map|A set of instrument identifiers to use to resolve the transaction to a unique instrument. | | TransactionDate|dateorcutlabel|The date of the transaction. | | SettlementDate|dateorcutlabel|The settlement date of the transaction. | | Units|decimal|The number of units transacted in the associated instrument. | | TransactionPrice|transactionprice|The price for each unit of the transacted instrument in the transaction currency. | | TotalConsideration|currencyandamount|The total value of the transaction in the settlement currency. | | ExchangeRate|decimal|The exchange rate between the transaction and settlement currency. For example if the transaction currency is in USD and the settlement currency is in GBP this this the USD/GBP rate. | | TransactionCurrency|currency|The transaction currency. | | Properties|map|Set of unique transaction properties and associated values to store with the transaction. Each property must be from the 'Transaction' domain. | | CounterpartyId|string|The identifier for the counterparty of the transaction. | | Source|string|The source of the transaction. This is used to look up the appropriate transaction group set in the transaction type configuration. | From these fields, the following values can be calculated * **Transaction value in Transaction currency**: TotalConsideration / ExchangeRate * **Transaction value in Portfolio currency**: Transaction value in Transaction currency * TradeToPortfolioRate #### Example Transactions ##### A Common Purchase Example Three example transactions are shown in the table below. They represent a purchase of USD denominated IBM shares within a Sterling denominated portfolio. * The first two transactions are for separate buy and fx trades * Buying 500 IBM shares for $71,480.00 * A spot foreign exchange conversion to fund the IBM purchase. (Buy $71,480.00 for £54,846.60) * The third transaction is an alternate version of the above trades. Buying 500 IBM shares and settling directly in Sterling. | Column | Buy Trade | Fx Trade | Buy Trade with foreign Settlement | | - -- -- | - -- -- | - -- -- | - -- -- | | TransactionId | FBN00001 | FBN00002 | FBN00003 | | Type | Buy | FxBuy | Buy | | InstrumentIdentifiers | { \"figi\", \"BBG000BLNNH6\" } | { \"CCY\", \"CCY_USD\" } | { \"figi\", \"BBG000BLNNH6\" } | | TransactionDate | 2018-08-02 | 2018-08-02 | 2018-08-02 | | SettlementDate | 2018-08-06 | 2018-08-06 | 2018-08-06 | | Units | 500 | 71480 | 500 | | TransactionPrice | 142.96 | 1 | 142.96 | | TradeCurrency | USD | USD | USD | | ExchangeRate | 1 | 0.7673 | 0.7673 | | TotalConsideration.Amount | 71480.00 | 54846.60 | 54846.60 | | TotalConsideration.Currency | USD | GBP | GBP | | Trade/default/TradeToPortfolioRate* | 0.7673 | 0.7673 | 0.7673 | [* This is a property field] ##### A Forward FX Example LUSID has a flexible transaction modelling system, meaning there are a number of different ways of modelling forward fx trades. The default LUSID transaction types are FwdFxBuy and FwdFxSell. Using these transaction types, LUSID will generate two holdings for each Forward FX trade, one for each currency in the trade. An example Forward Fx trade to sell GBP for USD in a JPY-denominated portfolio is shown below: | Column | Forward 'Sell' Trade | Notes | | - -- -- | - -- -- | - -- - | | TransactionId | FBN00004 | | | Type | FwdFxSell | | | InstrumentIdentifiers | { \"Instrument/default/Currency\", \"GBP\" } | | | TransactionDate | 2018-08-02 | | | SettlementDate | 2019-02-06 | Six month forward | | Units | 10000.00 | Units of GBP | | TransactionPrice | 1 | | | TradeCurrency | GBP | Currency being sold | | ExchangeRate | 1.3142 | Agreed rate between GBP and USD | | TotalConsideration.Amount | 13142.00 | Amount in the settlement currency, USD | | TotalConsideration.Currency | USD | Settlement currency | | Trade/default/TradeToPortfolioRate | 142.88 | Rate between trade currency, GBP and portfolio base currency, JPY | Please note that exactly the same economic behaviour could be modelled using the FwdFxBuy Transaction Type with the amounts and rates reversed. ### Holdings A holding represents a position in an instrument or cash on a given date. | Field|Type|Description | | - --|- --|- -- | | InstrumentUid|string|The unqiue Lusid Instrument Id (LUID) of the instrument that the holding is in. | | SubHoldingKeys|map|The sub-holding properties which identify the holding. Each property will be from the 'Transaction' domain. These are configured when a transaction portfolio is created. | | Properties|map|The properties which have been requested to be decorated onto the holding. These will be from the 'Instrument' or 'Holding' domain. | | HoldingType|string|The type of the holding e.g. Position, Balance, CashCommitment, Receivable, ForwardFX etc. | | Units|decimal|The total number of units of the holding. | | SettledUnits|decimal|The total number of settled units of the holding. | | Cost|currencyandamount|The total cost of the holding in the transaction currency. | | CostPortfolioCcy|currencyandamount|The total cost of the holding in the portfolio currency. | | Transaction|transaction|The transaction associated with an unsettled holding. | ## Corporate Actions Corporate actions are represented within LUSID in terms of a set of instrument-specific 'transitions'. These transitions are used to specify the participants of the corporate action, and the effect that the corporate action will have on holdings in those participants. ### Corporate Action | Field|Type|Description | | - --|- --|- -- | | CorporateActionCode|code|The unique identifier of this corporate action | | Description|string| | | AnnouncementDate|datetimeoffset|The announcement date of the corporate action | | ExDate|datetimeoffset|The ex date of the corporate action | | RecordDate|datetimeoffset|The record date of the corporate action | | PaymentDate|datetimeoffset|The payment date of the corporate action | | Transitions|corporateactiontransition[]|The transitions that result from this corporate action | ### Transition | Field|Type|Description | | - --|- --|- -- | | InputTransition|corporateactiontransitioncomponent|Indicating the basis of the corporate action - which security and how many units | | OutputTransitions|corporateactiontransitioncomponent[]|What will be generated relative to the input transition | ### Example Corporate Action Transitions #### A Dividend Action Transition In this example, for each share of IBM, 0.20 units (or 20 pence) of GBP are generated. | Column | Input Transition | Output Transition | | - -- -- | - -- -- | - -- -- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"ccy\" : \"CCY_GBP\" } | | Units Factor | 1 | 0.20 | | Cost Factor | 1 | 0 | #### A Split Action Transition In this example, for each share of IBM, we end up with 2 units (2 shares) of IBM, with total value unchanged. | Column | Input Transition | Output Transition | | - -- -- | - -- -- | - -- -- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000BLNNH6\" } | | Units Factor | 1 | 2 | | Cost Factor | 1 | 1 | #### A Spinoff Action Transition In this example, for each share of IBM, we end up with 1 unit (1 share) of IBM and 3 units (3 shares) of Celestica, with 85% of the value remaining on the IBM share, and 5% in each Celestica share (15% total). | Column | Input Transition | Output Transition 1 | Output Transition 2 | | - -- -- | - -- -- | - -- -- | - -- -- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000HBGRF3\" } | | Units Factor | 1 | 1 | 3 | | Cost Factor | 1 | 0.85 | 0.15 | ## Reference Portfolios Reference portfolios are portfolios that contain constituents with weights. They are designed to represent entities such as indices and benchmarks. ### Constituents | Field|Type|Description | | - --|- --|- -- | | InstrumentIdentifiers|map|Unique instrument identifiers | | InstrumentUid|string|LUSID's internal unique instrument identifier, resolved from the instrument identifiers | | Currency|decimal| | | Weight|decimal| | | FloatingWeight|decimal| | ## Portfolio Groups Portfolio groups allow the construction of a hierarchy from portfolios and groups. Portfolio operations on the group are executed on an aggregated set of portfolios in the hierarchy. For example: * Global Portfolios _(group)_ * APAC _(group)_ * Hong Kong _(portfolio)_ * Japan _(portfolio)_ * Europe _(group)_ * France _(portfolio)_ * Germany _(portfolio)_ * UK _(portfolio)_ In this example **Global Portfolios** is a group that consists of an aggregate of **Hong Kong**, **Japan**, **France**, **Germany** and **UK** portfolios. ## Properties Properties are key-value pairs that can be applied to any entity within a domain (where a domain is `trade`, `portfolio`, `security` etc). Properties must be defined before use with a `PropertyDefinition` and can then subsequently be added to entities. ## Schema A detailed description of the entities used by the API and parameters for endpoints which take a JSON document can be retrieved via the `schema` endpoint. ## Meta data The following headers are returned on all responses from LUSID | Name | Purpose | | - -- | - -- | | lusid-meta-duration | Duration of the request | | lusid-meta-success | Whether or not LUSID considered the request to be successful | | lusid-meta-requestId | The unique identifier for the request | | lusid-schema-url | Url of the schema for the data being returned | | lusid-property-schema-url | Url of the schema for any properties | # Error Codes | Code|Name|Description | | - --|- --|- -- | | <a name=\"-10\">-10</a>|Server Configuration Error| | | <a name=\"-1\">-1</a>|Unknown error|An unexpected error was encountered on our side. | | <a name=\"102\">102</a>|Version Not Found| | | <a name=\"103\">103</a>|Api Rate Limit Violation| | | <a name=\"104\">104</a>|Instrument Not Found| | | <a name=\"105\">105</a>|Property Not Found| | | <a name=\"106\">106</a>|Portfolio Recursion Depth| | | <a name=\"108\">108</a>|Group Not Found| | | <a name=\"109\">109</a>|Portfolio Not Found| | | <a name=\"110\">110</a>|Property Schema Not Found| | | <a name=\"111\">111</a>|Portfolio Ancestry Not Found| | | <a name=\"112\">112</a>|Portfolio With Id Already Exists| | | <a name=\"113\">113</a>|Orphaned Portfolio| | | <a name=\"119\">119</a>|Missing Base Claims| | | <a name=\"121\">121</a>|Property Not Defined| | | <a name=\"122\">122</a>|Cannot Delete System Property| | | <a name=\"123\">123</a>|Cannot Modify Immutable Property Field| | | <a name=\"124\">124</a>|Property Already Exists| | | <a name=\"125\">125</a>|Invalid Property Life Time| | | <a name=\"126\">126</a>|Property Constraint Style Excludes Properties| | | <a name=\"127\">127</a>|Cannot Modify Default Data Type| | | <a name=\"128\">128</a>|Group Already Exists| | | <a name=\"129\">129</a>|No Such Data Type| | | <a name=\"130\">130</a>|Undefined Value For Data Type| | | <a name=\"131\">131</a>|Unsupported Value Type Defined On Data Type| | | <a name=\"132\">132</a>|Validation Error| | | <a name=\"133\">133</a>|Loop Detected In Group Hierarchy| | | <a name=\"134\">134</a>|Undefined Acceptable Values| | | <a name=\"135\">135</a>|Sub Group Already Exists| | | <a name=\"138\">138</a>|Price Source Not Found| | | <a name=\"139\">139</a>|Analytic Store Not Found| | | <a name=\"141\">141</a>|Analytic Store Already Exists| | | <a name=\"143\">143</a>|Client Instrument Already Exists| | | <a name=\"144\">144</a>|Duplicate In Parameter Set| | | <a name=\"147\">147</a>|Results Not Found| | | <a name=\"148\">148</a>|Order Field Not In Result Set| | | <a name=\"149\">149</a>|Operation Failed| | | <a name=\"150\">150</a>|Elastic Search Error| | | <a name=\"151\">151</a>|Invalid Parameter Value| | | <a name=\"153\">153</a>|Command Processing Failure| | | <a name=\"154\">154</a>|Entity State Construction Failure| | | <a name=\"155\">155</a>|Entity Timeline Does Not Exist| | | <a name=\"156\">156</a>|Concurrency Conflict Failure| | | <a name=\"157\">157</a>|Invalid Request| | | <a name=\"158\">158</a>|Event Publish Unknown| | | <a name=\"159\">159</a>|Event Query Failure| | | <a name=\"160\">160</a>|Blob Did Not Exist| | | <a name=\"162\">162</a>|Sub System Request Failure| | | <a name=\"163\">163</a>|Sub System Configuration Failure| | | <a name=\"165\">165</a>|Failed To Delete| | | <a name=\"166\">166</a>|Upsert Client Instrument Failure| | | <a name=\"167\">167</a>|Illegal As At Interval| | | <a name=\"168\">168</a>|Illegal Bitemporal Query| | | <a name=\"169\">169</a>|Invalid Alternate Id| | | <a name=\"170\">170</a>|Cannot Add Source Portfolio Property Explicitly| | | <a name=\"171\">171</a>|Entity Already Exists In Group| | | <a name=\"173\">173</a>|Entity With Id Already Exists| | | <a name=\"174\">174</a>|Derived Portfolio Details Do Not Exist| | | <a name=\"176\">176</a>|Portfolio With Name Already Exists| | | <a name=\"177\">177</a>|Invalid Transactions| | | <a name=\"178\">178</a>|Reference Portfolio Not Found| | | <a name=\"179\">179</a>|Duplicate Id| | | <a name=\"180\">180</a>|Command Retrieval Failure| | | <a name=\"181\">181</a>|Data Filter Application Failure| | | <a name=\"182\">182</a>|Search Failed| | | <a name=\"183\">183</a>|Movements Engine Configuration Key Failure| | | <a name=\"184\">184</a>|Fx Rate Source Not Found| | | <a name=\"185\">185</a>|Accrual Source Not Found| | | <a name=\"186\">186</a>|Access Denied| | | <a name=\"187\">187</a>|Invalid Identity Token| | | <a name=\"188\">188</a>|Invalid Request Headers| | | <a name=\"189\">189</a>|Price Not Found| | | <a name=\"190\">190</a>|Invalid Sub Holding Keys Provided| | | <a name=\"191\">191</a>|Duplicate Sub Holding Keys Provided| | | <a name=\"192\">192</a>|Cut Definition Not Found| | | <a name=\"193\">193</a>|Cut Definition Invalid| | | <a name=\"194\">194</a>|Time Variant Property Deletion Date Unspecified| | | <a name=\"195\">195</a>|Perpetual Property Deletion Date Specified| | | <a name=\"196\">196</a>|Time Variant Property Upsert Date Unspecified| | | <a name=\"197\">197</a>|Perpetual Property Upsert Date Specified| | | <a name=\"200\">200</a>|Invalid Unit For Data Type| | | <a name=\"201\">201</a>|Invalid Type For Data Type| | | <a name=\"202\">202</a>|Invalid Value For Data Type| | | <a name=\"203\">203</a>|Unit Not Defined For Data Type| | | <a name=\"204\">204</a>|Units Not Supported On Data Type| | | <a name=\"205\">205</a>|Cannot Specify Units On Data Type| | | <a name=\"206\">206</a>|Unit Schema Inconsistent With Data Type| | | <a name=\"207\">207</a>|Unit Definition Not Specified| | | <a name=\"208\">208</a>|Duplicate Unit Definitions Specified| | | <a name=\"209\">209</a>|Invalid Units Definition| | | <a name=\"210\">210</a>|Invalid Instrument Identifier Unit| | | <a name=\"211\">211</a>|Holdings Adjustment Does Not Exist| | | <a name=\"212\">212</a>|Could Not Build Excel Url| | | <a name=\"213\">213</a>|Could Not Get Excel Version| | | <a name=\"214\">214</a>|Instrument By Code Not Found| | | <a name=\"215\">215</a>|Entity Schema Does Not Exist| | | <a name=\"216\">216</a>|Feature Not Supported On Portfolio Type| | | <a name=\"217\">217</a>|Quote Not Found| | | <a name=\"218\">218</a>|Invalid Quote Identifier| | | <a name=\"219\">219</a>|Invalid Metric For Data Type| | | <a name=\"220\">220</a>|Invalid Instrument Definition| | | <a name=\"221\">221</a>|Instrument Upsert Failure| | | <a name=\"222\">222</a>|Reference Portfolio Request Not Supported| | | <a name=\"223\">223</a>|Transaction Portfolio Request Not Supported| | | <a name=\"224\">224</a>|Invalid Property Value Assignment| | | <a name=\"230\">230</a>|Transaction Type Not Found| | | <a name=\"231\">231</a>|Transaction Type Duplication| | | <a name=\"232\">232</a>|Portfolio Does Not Exist At Given Date| | | <a name=\"233\">233</a>|Query Parser Failure| | | <a name=\"234\">234</a>|Duplicate Constituent| | | <a name=\"235\">235</a>|Unresolved Instrument Constituent| | | <a name=\"236\">236</a>|Unresolved Instrument In Transition| | | <a name=\"237\">237</a>|Missing Side Definitions| | | <a name=\"299\">299</a>|Invalid Recipe| | | <a name=\"300\">300</a>|Missing Recipe| | | <a name=\"301\">301</a>|Dependencies| | | <a name=\"304\">304</a>|Portfolio Preprocess Failure| | | <a name=\"310\">310</a>|Valuation Engine Failure| | | <a name=\"311\">311</a>|Task Factory Failure| | | <a name=\"312\">312</a>|Task Evaluation Failure| | | <a name=\"313\">313</a>|Task Generation Failure| | | <a name=\"314\">314</a>|Engine Configuration Failure| | | <a name=\"315\">315</a>|Model Specification Failure| | | <a name=\"320\">320</a>|Market Data Key Failure| | | <a name=\"321\">321</a>|Market Resolver Failure| | | <a name=\"322\">322</a>|Market Data Failure| | | <a name=\"330\">330</a>|Curve Failure| | | <a name=\"331\">331</a>|Volatility Surface Failure| | | <a name=\"332\">332</a>|Volatility Cube Failure| | | <a name=\"350\">350</a>|Instrument Failure| | | <a name=\"351\">351</a>|Cash Flows Failure| | | <a name=\"352\">352</a>|Reference Data Failure| | | <a name=\"360\">360</a>|Aggregation Failure| | | <a name=\"361\">361</a>|Aggregation Measure Failure| | | <a name=\"370\">370</a>|Result Retrieval Failure| | | <a name=\"371\">371</a>|Result Processing Failure| | | <a name=\"372\">372</a>|Vendor Result Processing Failure| | | <a name=\"373\">373</a>|Vendor Result Mapping Failure| | | <a name=\"374\">374</a>|Vendor Library Unauthorised| | | <a name=\"375\">375</a>|Vendor Connectivity Error| | | <a name=\"376\">376</a>|Vendor Interface Error| | | <a name=\"377\">377</a>|Vendor Pricing Failure| | | <a name=\"378\">378</a>|Vendor Translation Failure| | | <a name=\"379\">379</a>|Vendor Key Mapping Failure| | | <a name=\"380\">380</a>|Vendor Reflection Failure| | | <a name=\"390\">390</a>|Attempt To Upsert Duplicate Quotes| | | <a name=\"391\">391</a>|Corporate Action Source Does Not Exist| | | <a name=\"392\">392</a>|Corporate Action Source Already Exists| | | <a name=\"393\">393</a>|Instrument Identifier Already In Use| | | <a name=\"394\">394</a>|Properties Not Found| | | <a name=\"395\">395</a>|Batch Operation Aborted| | | <a name=\"400\">400</a>|Invalid Iso4217 Currency Code| | | <a name=\"401\">401</a>|Cannot Assign Instrument Identifier To Currency| | | <a name=\"402\">402</a>|Cannot Assign Currency Identifier To Non Currency| | | <a name=\"403\">403</a>|Currency Instrument Cannot Be Deleted| | | <a name=\"404\">404</a>|Currency Instrument Cannot Have Economic Definition| | | <a name=\"405\">405</a>|Currency Instrument Cannot Have Lookthrough Portfolio| | | <a name=\"406\">406</a>|Cannot Create Currency Instrument With Multiple Identifiers| | | <a name=\"407\">407</a>|Specified Currency Is Undefined| | | <a name=\"410\">410</a>|Index Does Not Exist| | | <a name=\"411\">411</a>|Sort Field Does Not Exist| | | <a name=\"413\">413</a>|Negative Pagination Parameters| | | <a name=\"414\">414</a>|Invalid Search Syntax| | | <a name=\"415\">415</a>|Filter Execution Timeout| | | <a name=\"420\">420</a>|Side Definition Inconsistent| | | <a name=\"450\">450</a>|Invalid Quote Access Metadata Rule| | | <a name=\"451\">451</a>|Access Metadata Not Found| | | <a name=\"452\">452</a>|Invalid Access Metadata Identifier| | | <a name=\"460\">460</a>|Standard Resource Not Found| | | <a name=\"461\">461</a>|Standard Resource Conflict| | | <a name=\"462\">462</a>|Calendar Not Found| | | <a name=\"463\">463</a>|Date In A Calendar Not Found| | | <a name=\"464\">464</a>|Invalid Date Source Data| | | <a name=\"465\">465</a>|Invalid Timezone| | | <a name=\"601\">601</a>|Person Identifier Already In Use| | | <a name=\"602\">602</a>|Person Not Found| | | <a name=\"603\">603</a>|Cannot Set Identifier| | | <a name=\"617\">617</a>|Invalid Recipe Specification In Request| | | <a name=\"618\">618</a>|Inline Recipe Deserialisation Failure| | | <a name=\"619\">619</a>|Identifier Types Not Set For Entity| | | <a name=\"620\">620</a>|Cannot Delete All Client Defined Identifiers| | | <a name=\"650\">650</a>|The Order requested was not found.| | | <a name=\"654\">654</a>|The Allocation requested was not found.| | | <a name=\"655\">655</a>|Cannot build the fx forward target with the given holdings.| | | <a name=\"656\">656</a>|Group does not contain expected entities.| | | <a name=\"667\">667</a>|Relation definition already exists| | | <a name=\"673\">673</a>|Missing entitlements for entities in Group| | | <a name=\"674\">674</a>|Next Best Action not found| | | <a name=\"676\">676</a>|Relation definition not defined| | | <a name=\"677\">677</a>|Invalid entity identifier for relation| | | <a name=\"681\">681</a>|Sorting by specified field not supported|One or more of the provided fields to order by were either invalid or not supported. | | <a name=\"682\">682</a>|Too many fields to sort by|The number of fields to sort the data by exceeds the number allowed by the endpoint | | <a name=\"684\">684</a>|Sequence Not Found| | | <a name=\"685\">685</a>|Sequence Already Exists| | | <a name=\"686\">686</a>|Non-cycling sequence has been exhausted| | | <a name=\"687\">687</a>|Legal Entity Identifier Already In Use| | | <a name=\"688\">688</a>|Legal Entity Not Found| | | <a name=\"689\">689</a>|The supplied pagination token is invalid| | | <a name=\"690\">690</a>|Property Type Is Not Supported| | | <a name=\"691\">691</a>|Multiple Tax-lots For Currency Type Is Not Supported| | | <a name=\"692\">692</a>|This endpoint does not support impersonation| |
*
* The version of the OpenAPI document: 0.11.2321
* Contact: info@finbourne.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp.Portable;
using Lusid.Sdk.Client;
using Lusid.Sdk.Model;
namespace Lusid.Sdk.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IPropertyDefinitionsApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
/// Create property definition
/// </summary>
/// <remarks>
/// Define a new property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>PropertyDefinition</returns>
PropertyDefinition CreatePropertyDefinition (CreatePropertyDefinitionRequest createPropertyDefinitionRequest);
/// <summary>
/// Create property definition
/// </summary>
/// <remarks>
/// Define a new property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>ApiResponse of PropertyDefinition</returns>
ApiResponse<PropertyDefinition> CreatePropertyDefinitionWithHttpInfo (CreatePropertyDefinitionRequest createPropertyDefinitionRequest);
/// <summary>
/// Delete property definition
/// </summary>
/// <remarks>
/// Delete the definition of the specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>DeletedEntityResponse</returns>
DeletedEntityResponse DeletePropertyDefinition (string domain, string scope, string code);
/// <summary>
/// Delete property definition
/// </summary>
/// <remarks>
/// Delete the definition of the specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>ApiResponse of DeletedEntityResponse</returns>
ApiResponse<DeletedEntityResponse> DeletePropertyDefinitionWithHttpInfo (string domain, string scope, string code);
/// <summary>
/// Get multiple property definitions
/// </summary>
/// <remarks>
/// Retrieve the definition of one or more specified properties.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>ResourceListOfPropertyDefinition</returns>
ResourceListOfPropertyDefinition GetMultiplePropertyDefinitions (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null);
/// <summary>
/// Get multiple property definitions
/// </summary>
/// <remarks>
/// Retrieve the definition of one or more specified properties.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>ApiResponse of ResourceListOfPropertyDefinition</returns>
ApiResponse<ResourceListOfPropertyDefinition> GetMultiplePropertyDefinitionsWithHttpInfo (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null);
/// <summary>
/// Get property definition
/// </summary>
/// <remarks>
/// Retrieve the definition of a specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>PropertyDefinition</returns>
PropertyDefinition GetPropertyDefinition (string domain, string scope, string code, DateTimeOffset? asAt = null);
/// <summary>
/// Get property definition
/// </summary>
/// <remarks>
/// Retrieve the definition of a specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>ApiResponse of PropertyDefinition</returns>
ApiResponse<PropertyDefinition> GetPropertyDefinitionWithHttpInfo (string domain, string scope, string code, DateTimeOffset? asAt = null);
/// <summary>
/// Update property definition
/// </summary>
/// <remarks>
/// Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>PropertyDefinition</returns>
PropertyDefinition UpdatePropertyDefinition (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest);
/// <summary>
/// Update property definition
/// </summary>
/// <remarks>
/// Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>ApiResponse of PropertyDefinition</returns>
ApiResponse<PropertyDefinition> UpdatePropertyDefinitionWithHttpInfo (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// Create property definition
/// </summary>
/// <remarks>
/// Define a new property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>Task of PropertyDefinition</returns>
System.Threading.Tasks.Task<PropertyDefinition> CreatePropertyDefinitionAsync (CreatePropertyDefinitionRequest createPropertyDefinitionRequest);
/// <summary>
/// Create property definition
/// </summary>
/// <remarks>
/// Define a new property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>Task of ApiResponse (PropertyDefinition)</returns>
System.Threading.Tasks.Task<ApiResponse<PropertyDefinition>> CreatePropertyDefinitionAsyncWithHttpInfo (CreatePropertyDefinitionRequest createPropertyDefinitionRequest);
/// <summary>
/// Delete property definition
/// </summary>
/// <remarks>
/// Delete the definition of the specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>Task of DeletedEntityResponse</returns>
System.Threading.Tasks.Task<DeletedEntityResponse> DeletePropertyDefinitionAsync (string domain, string scope, string code);
/// <summary>
/// Delete property definition
/// </summary>
/// <remarks>
/// Delete the definition of the specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>Task of ApiResponse (DeletedEntityResponse)</returns>
System.Threading.Tasks.Task<ApiResponse<DeletedEntityResponse>> DeletePropertyDefinitionAsyncWithHttpInfo (string domain, string scope, string code);
/// <summary>
/// Get multiple property definitions
/// </summary>
/// <remarks>
/// Retrieve the definition of one or more specified properties.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>Task of ResourceListOfPropertyDefinition</returns>
System.Threading.Tasks.Task<ResourceListOfPropertyDefinition> GetMultiplePropertyDefinitionsAsync (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null);
/// <summary>
/// Get multiple property definitions
/// </summary>
/// <remarks>
/// Retrieve the definition of one or more specified properties.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>Task of ApiResponse (ResourceListOfPropertyDefinition)</returns>
System.Threading.Tasks.Task<ApiResponse<ResourceListOfPropertyDefinition>> GetMultiplePropertyDefinitionsAsyncWithHttpInfo (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null);
/// <summary>
/// Get property definition
/// </summary>
/// <remarks>
/// Retrieve the definition of a specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>Task of PropertyDefinition</returns>
System.Threading.Tasks.Task<PropertyDefinition> GetPropertyDefinitionAsync (string domain, string scope, string code, DateTimeOffset? asAt = null);
/// <summary>
/// Get property definition
/// </summary>
/// <remarks>
/// Retrieve the definition of a specified property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>Task of ApiResponse (PropertyDefinition)</returns>
System.Threading.Tasks.Task<ApiResponse<PropertyDefinition>> GetPropertyDefinitionAsyncWithHttpInfo (string domain, string scope, string code, DateTimeOffset? asAt = null);
/// <summary>
/// Update property definition
/// </summary>
/// <remarks>
/// Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>Task of PropertyDefinition</returns>
System.Threading.Tasks.Task<PropertyDefinition> UpdatePropertyDefinitionAsync (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest);
/// <summary>
/// Update property definition
/// </summary>
/// <remarks>
/// Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </remarks>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>Task of ApiResponse (PropertyDefinition)</returns>
System.Threading.Tasks.Task<ApiResponse<PropertyDefinition>> UpdatePropertyDefinitionAsyncWithHttpInfo (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest);
#endregion Asynchronous Operations
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class PropertyDefinitionsApi : IPropertyDefinitionsApi
{
private Lusid.Sdk.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
/// <summary>
/// Initializes a new instance of the <see cref="PropertyDefinitionsApi"/> class.
/// </summary>
/// <returns></returns>
public PropertyDefinitionsApi(String basePath)
{
this.Configuration = new Lusid.Sdk.Client.Configuration { BasePath = basePath };
ExceptionFactory = Lusid.Sdk.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="PropertyDefinitionsApi"/> class
/// </summary>
/// <returns></returns>
public PropertyDefinitionsApi()
{
this.Configuration = Lusid.Sdk.Client.Configuration.Default;
ExceptionFactory = Lusid.Sdk.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="PropertyDefinitionsApi"/> class
/// using Configuration object
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <returns></returns>
public PropertyDefinitionsApi(Lusid.Sdk.Client.Configuration configuration = null)
{
if (configuration == null) // use the default one in Configuration
this.Configuration = Lusid.Sdk.Client.Configuration.Default;
else
this.Configuration = configuration;
ExceptionFactory = Lusid.Sdk.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
public String GetBasePath()
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath)
{
// do nothing
}
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
public Lusid.Sdk.Client.Configuration Configuration {get; set;}
/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
public Lusid.Sdk.Client.ExceptionFactory ExceptionFactory
{
get
{
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
{
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
}
return _exceptionFactory;
}
set { _exceptionFactory = value; }
}
/// <summary>
/// Gets the default header.
/// </summary>
/// <returns>Dictionary of HTTP header</returns>
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
public IDictionary<String, String> DefaultHeader()
{
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
}
/// <summary>
/// Add default header.
/// </summary>
/// <param name="key">Header field name.</param>
/// <param name="value">Header field value.</param>
/// <returns></returns>
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
this.Configuration.AddDefaultHeader(key, value);
}
/// <summary>
/// Create property definition Define a new property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>PropertyDefinition</returns>
public PropertyDefinition CreatePropertyDefinition (CreatePropertyDefinitionRequest createPropertyDefinitionRequest)
{
ApiResponse<PropertyDefinition> localVarResponse = CreatePropertyDefinitionWithHttpInfo(createPropertyDefinitionRequest);
return localVarResponse.Data;
}
/// <summary>
/// Create property definition Define a new property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>ApiResponse of PropertyDefinition</returns>
public ApiResponse< PropertyDefinition > CreatePropertyDefinitionWithHttpInfo (CreatePropertyDefinitionRequest createPropertyDefinitionRequest)
{
// verify the required parameter 'createPropertyDefinitionRequest' is set
if (createPropertyDefinitionRequest == null)
throw new ApiException(400, "Missing required parameter 'createPropertyDefinitionRequest' when calling PropertyDefinitionsApi->CreatePropertyDefinition");
var localVarPath = "./api/propertydefinitions";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json-patch+json",
"application/json",
"text/json",
"application/_*+json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (createPropertyDefinitionRequest != null && createPropertyDefinitionRequest.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(createPropertyDefinitionRequest); // http body (model) parameter
}
else
{
localVarPostBody = createPropertyDefinitionRequest; // byte array
}
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-SDK-Language"] = "C#";
localVarHeaderParams["X-LUSID-SDK-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("CreatePropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<PropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(PropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PropertyDefinition)));
}
/// <summary>
/// Create property definition Define a new property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>Task of PropertyDefinition</returns>
public async System.Threading.Tasks.Task<PropertyDefinition> CreatePropertyDefinitionAsync (CreatePropertyDefinitionRequest createPropertyDefinitionRequest)
{
ApiResponse<PropertyDefinition> localVarResponse = await CreatePropertyDefinitionAsyncWithHttpInfo(createPropertyDefinitionRequest);
return localVarResponse.Data;
}
/// <summary>
/// Create property definition Define a new property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="createPropertyDefinitionRequest">The definition of the new property.</param>
/// <returns>Task of ApiResponse (PropertyDefinition)</returns>
public async System.Threading.Tasks.Task<ApiResponse<PropertyDefinition>> CreatePropertyDefinitionAsyncWithHttpInfo (CreatePropertyDefinitionRequest createPropertyDefinitionRequest)
{
// verify the required parameter 'createPropertyDefinitionRequest' is set
if (createPropertyDefinitionRequest == null)
throw new ApiException(400, "Missing required parameter 'createPropertyDefinitionRequest' when calling PropertyDefinitionsApi->CreatePropertyDefinition");
var localVarPath = "./api/propertydefinitions";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json-patch+json",
"application/json",
"text/json",
"application/_*+json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (createPropertyDefinitionRequest != null && createPropertyDefinitionRequest.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(createPropertyDefinitionRequest); // http body (model) parameter
}
else
{
localVarPostBody = createPropertyDefinitionRequest; // byte array
}
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-Sdk-Language"] = "C#";
localVarHeaderParams["X-LUSID-Sdk-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("CreatePropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<PropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(PropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PropertyDefinition)));
}
/// <summary>
/// Delete property definition Delete the definition of the specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>DeletedEntityResponse</returns>
public DeletedEntityResponse DeletePropertyDefinition (string domain, string scope, string code)
{
ApiResponse<DeletedEntityResponse> localVarResponse = DeletePropertyDefinitionWithHttpInfo(domain, scope, code);
return localVarResponse.Data;
}
/// <summary>
/// Delete property definition Delete the definition of the specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>ApiResponse of DeletedEntityResponse</returns>
public ApiResponse< DeletedEntityResponse > DeletePropertyDefinitionWithHttpInfo (string domain, string scope, string code)
{
// verify the required parameter 'domain' is set
if (domain == null)
throw new ApiException(400, "Missing required parameter 'domain' when calling PropertyDefinitionsApi->DeletePropertyDefinition");
// verify the required parameter 'scope' is set
if (scope == null)
throw new ApiException(400, "Missing required parameter 'scope' when calling PropertyDefinitionsApi->DeletePropertyDefinition");
// verify the required parameter 'code' is set
if (code == null)
throw new ApiException(400, "Missing required parameter 'code' when calling PropertyDefinitionsApi->DeletePropertyDefinition");
var localVarPath = "./api/propertydefinitions/{domain}/{scope}/{code}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (domain != null) localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain)); // path parameter
if (scope != null) localVarPathParams.Add("scope", this.Configuration.ApiClient.ParameterToString(scope)); // path parameter
if (code != null) localVarPathParams.Add("code", this.Configuration.ApiClient.ParameterToString(code)); // path parameter
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-SDK-Language"] = "C#";
localVarHeaderParams["X-LUSID-SDK-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("DeletePropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<DeletedEntityResponse>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(DeletedEntityResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DeletedEntityResponse)));
}
/// <summary>
/// Delete property definition Delete the definition of the specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>Task of DeletedEntityResponse</returns>
public async System.Threading.Tasks.Task<DeletedEntityResponse> DeletePropertyDefinitionAsync (string domain, string scope, string code)
{
ApiResponse<DeletedEntityResponse> localVarResponse = await DeletePropertyDefinitionAsyncWithHttpInfo(domain, scope, code);
return localVarResponse.Data;
}
/// <summary>
/// Delete property definition Delete the definition of the specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property to be deleted.</param>
/// <param name="scope">The scope of the property to be deleted.</param>
/// <param name="code">The code of the property to be deleted. Together with the domain and scope this uniquely identifies the property.</param>
/// <returns>Task of ApiResponse (DeletedEntityResponse)</returns>
public async System.Threading.Tasks.Task<ApiResponse<DeletedEntityResponse>> DeletePropertyDefinitionAsyncWithHttpInfo (string domain, string scope, string code)
{
// verify the required parameter 'domain' is set
if (domain == null)
throw new ApiException(400, "Missing required parameter 'domain' when calling PropertyDefinitionsApi->DeletePropertyDefinition");
// verify the required parameter 'scope' is set
if (scope == null)
throw new ApiException(400, "Missing required parameter 'scope' when calling PropertyDefinitionsApi->DeletePropertyDefinition");
// verify the required parameter 'code' is set
if (code == null)
throw new ApiException(400, "Missing required parameter 'code' when calling PropertyDefinitionsApi->DeletePropertyDefinition");
var localVarPath = "./api/propertydefinitions/{domain}/{scope}/{code}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (domain != null) localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain)); // path parameter
if (scope != null) localVarPathParams.Add("scope", this.Configuration.ApiClient.ParameterToString(scope)); // path parameter
if (code != null) localVarPathParams.Add("code", this.Configuration.ApiClient.ParameterToString(code)); // path parameter
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-Sdk-Language"] = "C#";
localVarHeaderParams["X-LUSID-Sdk-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("DeletePropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<DeletedEntityResponse>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(DeletedEntityResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(DeletedEntityResponse)));
}
/// <summary>
/// Get multiple property definitions Retrieve the definition of one or more specified properties.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>ResourceListOfPropertyDefinition</returns>
public ResourceListOfPropertyDefinition GetMultiplePropertyDefinitions (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null)
{
ApiResponse<ResourceListOfPropertyDefinition> localVarResponse = GetMultiplePropertyDefinitionsWithHttpInfo(propertyKeys, asAt, filter);
return localVarResponse.Data;
}
/// <summary>
/// Get multiple property definitions Retrieve the definition of one or more specified properties.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>ApiResponse of ResourceListOfPropertyDefinition</returns>
public ApiResponse< ResourceListOfPropertyDefinition > GetMultiplePropertyDefinitionsWithHttpInfo (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null)
{
// verify the required parameter 'propertyKeys' is set
if (propertyKeys == null)
throw new ApiException(400, "Missing required parameter 'propertyKeys' when calling PropertyDefinitionsApi->GetMultiplePropertyDefinitions");
var localVarPath = "./api/propertydefinitions";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (asAt != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "asAt", asAt)); // query parameter
if (filter != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "filter", filter)); // query parameter
if (propertyKeys != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("multi", "propertyKeys", propertyKeys)); // query parameter
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-SDK-Language"] = "C#";
localVarHeaderParams["X-LUSID-SDK-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetMultiplePropertyDefinitions", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<ResourceListOfPropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(ResourceListOfPropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ResourceListOfPropertyDefinition)));
}
/// <summary>
/// Get multiple property definitions Retrieve the definition of one or more specified properties.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>Task of ResourceListOfPropertyDefinition</returns>
public async System.Threading.Tasks.Task<ResourceListOfPropertyDefinition> GetMultiplePropertyDefinitionsAsync (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null)
{
ApiResponse<ResourceListOfPropertyDefinition> localVarResponse = await GetMultiplePropertyDefinitionsAsyncWithHttpInfo(propertyKeys, asAt, filter);
return localVarResponse.Data;
}
/// <summary>
/// Get multiple property definitions Retrieve the definition of one or more specified properties.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="propertyKeys">One or more property keys which identify each property that a definition should be retrieved for. The format for each property key is {domain}/{scope}/{code}, e.g. 'Portfolio/Manager/Id'.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definitions. Defaults to return the latest version of each definition if not specified. (optional)</param>
/// <param name="filter">Expression to filter the result set. For example, to filter on the Lifetime, use \"lifeTime eq 'Perpetual'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid. (optional)</param>
/// <returns>Task of ApiResponse (ResourceListOfPropertyDefinition)</returns>
public async System.Threading.Tasks.Task<ApiResponse<ResourceListOfPropertyDefinition>> GetMultiplePropertyDefinitionsAsyncWithHttpInfo (List<string> propertyKeys, DateTimeOffset? asAt = null, string filter = null)
{
// verify the required parameter 'propertyKeys' is set
if (propertyKeys == null)
throw new ApiException(400, "Missing required parameter 'propertyKeys' when calling PropertyDefinitionsApi->GetMultiplePropertyDefinitions");
var localVarPath = "./api/propertydefinitions";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (asAt != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "asAt", asAt)); // query parameter
if (filter != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "filter", filter)); // query parameter
if (propertyKeys != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("multi", "propertyKeys", propertyKeys)); // query parameter
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-Sdk-Language"] = "C#";
localVarHeaderParams["X-LUSID-Sdk-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetMultiplePropertyDefinitions", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<ResourceListOfPropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(ResourceListOfPropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ResourceListOfPropertyDefinition)));
}
/// <summary>
/// Get property definition Retrieve the definition of a specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>PropertyDefinition</returns>
public PropertyDefinition GetPropertyDefinition (string domain, string scope, string code, DateTimeOffset? asAt = null)
{
ApiResponse<PropertyDefinition> localVarResponse = GetPropertyDefinitionWithHttpInfo(domain, scope, code, asAt);
return localVarResponse.Data;
}
/// <summary>
/// Get property definition Retrieve the definition of a specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>ApiResponse of PropertyDefinition</returns>
public ApiResponse< PropertyDefinition > GetPropertyDefinitionWithHttpInfo (string domain, string scope, string code, DateTimeOffset? asAt = null)
{
// verify the required parameter 'domain' is set
if (domain == null)
throw new ApiException(400, "Missing required parameter 'domain' when calling PropertyDefinitionsApi->GetPropertyDefinition");
// verify the required parameter 'scope' is set
if (scope == null)
throw new ApiException(400, "Missing required parameter 'scope' when calling PropertyDefinitionsApi->GetPropertyDefinition");
// verify the required parameter 'code' is set
if (code == null)
throw new ApiException(400, "Missing required parameter 'code' when calling PropertyDefinitionsApi->GetPropertyDefinition");
var localVarPath = "./api/propertydefinitions/{domain}/{scope}/{code}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (domain != null) localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain)); // path parameter
if (scope != null) localVarPathParams.Add("scope", this.Configuration.ApiClient.ParameterToString(scope)); // path parameter
if (code != null) localVarPathParams.Add("code", this.Configuration.ApiClient.ParameterToString(code)); // path parameter
if (asAt != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "asAt", asAt)); // query parameter
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-SDK-Language"] = "C#";
localVarHeaderParams["X-LUSID-SDK-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetPropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<PropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(PropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PropertyDefinition)));
}
/// <summary>
/// Get property definition Retrieve the definition of a specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>Task of PropertyDefinition</returns>
public async System.Threading.Tasks.Task<PropertyDefinition> GetPropertyDefinitionAsync (string domain, string scope, string code, DateTimeOffset? asAt = null)
{
ApiResponse<PropertyDefinition> localVarResponse = await GetPropertyDefinitionAsyncWithHttpInfo(domain, scope, code, asAt);
return localVarResponse.Data;
}
/// <summary>
/// Get property definition Retrieve the definition of a specified property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the specified property.</param>
/// <param name="scope">The scope of the specified property.</param>
/// <param name="code">The code of the specified property. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="asAt">The asAt datetime at which to retrieve the property definition. Defaults to return the latest version of the definition if not specified. (optional)</param>
/// <returns>Task of ApiResponse (PropertyDefinition)</returns>
public async System.Threading.Tasks.Task<ApiResponse<PropertyDefinition>> GetPropertyDefinitionAsyncWithHttpInfo (string domain, string scope, string code, DateTimeOffset? asAt = null)
{
// verify the required parameter 'domain' is set
if (domain == null)
throw new ApiException(400, "Missing required parameter 'domain' when calling PropertyDefinitionsApi->GetPropertyDefinition");
// verify the required parameter 'scope' is set
if (scope == null)
throw new ApiException(400, "Missing required parameter 'scope' when calling PropertyDefinitionsApi->GetPropertyDefinition");
// verify the required parameter 'code' is set
if (code == null)
throw new ApiException(400, "Missing required parameter 'code' when calling PropertyDefinitionsApi->GetPropertyDefinition");
var localVarPath = "./api/propertydefinitions/{domain}/{scope}/{code}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (domain != null) localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain)); // path parameter
if (scope != null) localVarPathParams.Add("scope", this.Configuration.ApiClient.ParameterToString(scope)); // path parameter
if (code != null) localVarPathParams.Add("code", this.Configuration.ApiClient.ParameterToString(code)); // path parameter
if (asAt != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "asAt", asAt)); // query parameter
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-Sdk-Language"] = "C#";
localVarHeaderParams["X-LUSID-Sdk-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetPropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<PropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(PropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PropertyDefinition)));
}
/// <summary>
/// Update property definition Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>PropertyDefinition</returns>
public PropertyDefinition UpdatePropertyDefinition (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest)
{
ApiResponse<PropertyDefinition> localVarResponse = UpdatePropertyDefinitionWithHttpInfo(domain, scope, code, updatePropertyDefinitionRequest);
return localVarResponse.Data;
}
/// <summary>
/// Update property definition Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>ApiResponse of PropertyDefinition</returns>
public ApiResponse< PropertyDefinition > UpdatePropertyDefinitionWithHttpInfo (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest)
{
// verify the required parameter 'domain' is set
if (domain == null)
throw new ApiException(400, "Missing required parameter 'domain' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
// verify the required parameter 'scope' is set
if (scope == null)
throw new ApiException(400, "Missing required parameter 'scope' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
// verify the required parameter 'code' is set
if (code == null)
throw new ApiException(400, "Missing required parameter 'code' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
// verify the required parameter 'updatePropertyDefinitionRequest' is set
if (updatePropertyDefinitionRequest == null)
throw new ApiException(400, "Missing required parameter 'updatePropertyDefinitionRequest' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
var localVarPath = "./api/propertydefinitions/{domain}/{scope}/{code}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json-patch+json",
"application/json",
"text/json",
"application/_*+json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (domain != null) localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain)); // path parameter
if (scope != null) localVarPathParams.Add("scope", this.Configuration.ApiClient.ParameterToString(scope)); // path parameter
if (code != null) localVarPathParams.Add("code", this.Configuration.ApiClient.ParameterToString(code)); // path parameter
if (updatePropertyDefinitionRequest != null && updatePropertyDefinitionRequest.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(updatePropertyDefinitionRequest); // http body (model) parameter
}
else
{
localVarPostBody = updatePropertyDefinitionRequest; // byte array
}
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-SDK-Language"] = "C#";
localVarHeaderParams["X-LUSID-SDK-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("UpdatePropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<PropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(PropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PropertyDefinition)));
}
/// <summary>
/// Update property definition Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>Task of PropertyDefinition</returns>
public async System.Threading.Tasks.Task<PropertyDefinition> UpdatePropertyDefinitionAsync (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest)
{
ApiResponse<PropertyDefinition> localVarResponse = await UpdatePropertyDefinitionAsyncWithHttpInfo(domain, scope, code, updatePropertyDefinitionRequest);
return localVarResponse.Data;
}
/// <summary>
/// Update property definition Update the definition of a specified existing property. Not all elements within a property definition are modifiable due to the potential implications for values already stored against the property.
/// </summary>
/// <exception cref="Lusid.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="domain">The domain of the property being updated.</param>
/// <param name="scope">The scope of the property being updated.</param>
/// <param name="code">The code of the property being updated. Together with the domain and scope this uniquely identifies the property.</param>
/// <param name="updatePropertyDefinitionRequest">The updated definition of the property.</param>
/// <returns>Task of ApiResponse (PropertyDefinition)</returns>
public async System.Threading.Tasks.Task<ApiResponse<PropertyDefinition>> UpdatePropertyDefinitionAsyncWithHttpInfo (string domain, string scope, string code, UpdatePropertyDefinitionRequest updatePropertyDefinitionRequest)
{
// verify the required parameter 'domain' is set
if (domain == null)
throw new ApiException(400, "Missing required parameter 'domain' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
// verify the required parameter 'scope' is set
if (scope == null)
throw new ApiException(400, "Missing required parameter 'scope' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
// verify the required parameter 'code' is set
if (code == null)
throw new ApiException(400, "Missing required parameter 'code' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
// verify the required parameter 'updatePropertyDefinitionRequest' is set
if (updatePropertyDefinitionRequest == null)
throw new ApiException(400, "Missing required parameter 'updatePropertyDefinitionRequest' when calling PropertyDefinitionsApi->UpdatePropertyDefinition");
var localVarPath = "./api/propertydefinitions/{domain}/{scope}/{code}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json-patch+json",
"application/json",
"text/json",
"application/_*+json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"text/plain",
"application/json",
"text/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (domain != null) localVarPathParams.Add("domain", this.Configuration.ApiClient.ParameterToString(domain)); // path parameter
if (scope != null) localVarPathParams.Add("scope", this.Configuration.ApiClient.ParameterToString(scope)); // path parameter
if (code != null) localVarPathParams.Add("code", this.Configuration.ApiClient.ParameterToString(code)); // path parameter
if (updatePropertyDefinitionRequest != null && updatePropertyDefinitionRequest.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(updatePropertyDefinitionRequest); // http body (model) parameter
}
else
{
localVarPostBody = updatePropertyDefinitionRequest; // byte array
}
// authentication (oauth2) required
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
}
// set the LUSID header
localVarHeaderParams["X-LUSID-Sdk-Language"] = "C#";
localVarHeaderParams["X-LUSID-Sdk-Version"] = "0.11.2321";
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("UpdatePropertyDefinition", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<PropertyDefinition>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
(PropertyDefinition) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PropertyDefinition)));
}
}
} | 85.502269 | 28,838 | 0.673567 | [
"MIT"
] | fossabot/lusid-sdk-csharp | sdk/Lusid.Sdk/Api/PropertyDefinitionsApi.cs | 113,034 | C# |
using MediatR;
using System;
namespace PresenceLight.Core.WorkingHoursServices
{
public class UseWorkingHoursCommand : IRequest<bool>
{
}
}
| 15.4 | 56 | 0.74026 | [
"MIT"
] | JMilthaler/presencelight | src/PresenceLight.Core/Lights/WorkingHoursServices/UseWorkingHours/UseWorkingHoursCommand.cs | 156 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.