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 |
|---|---|---|---|---|---|---|---|---|
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
namespace Senai.Ekips.WebApi.Domains
{
public partial class EkipsContext : DbContext
{
public EkipsContext()
{
}
public EkipsContext(DbContextOptions<EkipsContext> options)
: base(options)
{
}
public virtual DbSet<Cargos> Cargos { get; set; }
public virtual DbSet<Departamentos> Departamentos { get; set; }
public virtual DbSet<Funcionarios> Funcionarios { get; set; }
public virtual DbSet<Permissoes> Permissoes { get; set; }
public virtual DbSet<Usuarios> Usuarios { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlServer("Data Source=.\\SqlExpress; Initial Catalog=M_Ekips;User Id=sa;Pwd=132");
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Cargos>(entity =>
{
entity.HasKey(e => e.IdCargo);
entity.Property(e => e.Ativo)
.IsRequired()
.HasMaxLength(200)
.IsUnicode(false);
entity.Property(e => e.Nome)
.IsRequired()
.HasMaxLength(200)
.IsUnicode(false);
});
modelBuilder.Entity<Departamentos>(entity =>
{
entity.HasKey(e => e.IdDepartamento);
entity.Property(e => e.Nome)
.IsRequired()
.HasMaxLength(200)
.IsUnicode(false);
});
modelBuilder.Entity<Funcionarios>(entity =>
{
entity.HasKey(e => e.IdFuncionario);
entity.HasIndex(e => e.Cpf)
.HasName("UQ__Funciona__C1F89731B56CD029")
.IsUnique();
entity.HasIndex(e => e.Funcionario)
.HasName("UQ__Funciona__8040ADB39C106FD6")
.IsUnique();
entity.Property(e => e.Cpf)
.IsRequired()
.HasColumnName("CPF")
.HasMaxLength(255)
.IsUnicode(false);
entity.Property(e => e.DataNascimento).HasColumnType("date");
entity.Property(e => e.Funcionario)
.IsRequired()
.HasMaxLength(255)
.IsUnicode(false);
entity.HasOne(d => d.IdCargoNavigation)
.WithMany(p => p.Funcionarios)
.HasForeignKey(d => d.IdCargo)
.HasConstraintName("FK__Funcionar__IdCar__571DF1D5");
entity.HasOne(d => d.IdDepartamentoNavigation)
.WithMany(p => p.Funcionarios)
.HasForeignKey(d => d.IdDepartamento)
.HasConstraintName("FK__Funcionar__IdDep__5629CD9C");
entity.HasOne(d => d.IdUsuarioNavigation)
.WithMany(p => p.Funcionarios)
.HasForeignKey(d => d.IdUsuario)
.HasConstraintName("FK__Funcionar__IdUsu__5812160E");
});
modelBuilder.Entity<Permissoes>(entity =>
{
entity.HasKey(e => e.IdPermissao);
entity.HasIndex(e => e.Permissao)
.HasName("UQ__Permisso__82021A3B0B7FE446")
.IsUnique();
entity.Property(e => e.Permissao)
.IsRequired()
.HasMaxLength(200)
.IsUnicode(false);
});
modelBuilder.Entity<Usuarios>(entity =>
{
entity.HasKey(e => e.IdUsuario);
entity.HasIndex(e => e.Senha)
.HasName("UQ__Usuarios__7ABB973134038D50")
.IsUnique();
entity.Property(e => e.Email)
.IsRequired()
.HasMaxLength(200)
.IsUnicode(false);
entity.Property(e => e.Senha)
.IsRequired()
.HasMaxLength(200)
.IsUnicode(false);
entity.HasOne(d => d.PermissaoNavigation)
.WithMany(p => p.Usuarios)
.HasForeignKey(d => d.Permissao)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK__Usuarios__Permis__4D94879B");
});
}
}
}
| 35.021127 | 213 | 0.507943 | [
"MIT"
] | leozitop/2s2019-sprint-2-backend | Ekips/Senai.Ekips.WebApi/Senai.Ekips.WebApi/Contexts/EkipsContext.cs | 4,975 | C# |
using J2N.Numerics;
using Lucene.Net.Diagnostics;
using Lucene.Net.Support;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
namespace Lucene.Net.Util
{
/*
* 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.
*/
/// <summary>
/// Represents <see cref="T:long[]"/>, as a slice (offset + length) into an
/// existing <see cref="T:long[]"/>. The <see cref="Int64s"/> member should never be <c>null</c>; use
/// <see cref="EMPTY_INT64S"/> if necessary.
/// <para/>
/// NOTE: This was LongsRef in Lucene
/// <para/>
/// @lucene.internal
/// </summary>
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public sealed class Int64sRef : IComparable<Int64sRef> // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
{
/// <summary>
/// An empty <see cref="long"/> array for convenience
/// <para/>
/// NOTE: This was EMPTY_LONGS in Lucene
/// </summary>
public static readonly long[] EMPTY_INT64S = Arrays.Empty<long>();
/// <summary>
/// The contents of the <see cref="Int64sRef"/>. Should never be <c>null</c>.
/// <para/>
/// NOTE: This was longs (field) in Lucene
/// </summary>
[WritableArray]
[SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
public long[] Int64s
{
get => longs;
set => longs = value ?? throw new ArgumentNullException(nameof(Int64s)); // LUCENENET specific - changed from IllegalArgumentException to ArgumentNullException (.NET convention)
}
private long[] longs;
/// <summary>
/// Offset of first valid long. </summary>
public int Offset { get; set; }
/// <summary>
/// Length of used longs. </summary>
public int Length { get; set; }
/// <summary>
/// Create a <see cref="Int64sRef"/> with <see cref="EMPTY_INT64S"/> </summary>
public Int64sRef()
{
longs = EMPTY_INT64S;
}
/// <summary>
/// Create a <see cref="Int64sRef"/> pointing to a new array of size <paramref name="capacity"/>.
/// Offset and length will both be zero.
/// </summary>
public Int64sRef(int capacity)
{
longs = new long[capacity];
}
/// <summary>
/// This instance will directly reference <paramref name="longs"/> w/o making a copy.
/// <paramref name="longs"/> should not be <c>null</c>.
/// </summary>
public Int64sRef(long[] longs, int offset, int length)
{
this.longs = longs;
this.Offset = offset;
this.Length = length;
if (Debugging.AssertsEnabled) Debugging.Assert(IsValid());
}
/// <summary>
/// Returns a shallow clone of this instance (the underlying <see cref="long"/>s are
/// <b>not</b> copied and will be shared by both the returned object and this
/// object.
/// </summary>
/// <seealso cref="DeepCopyOf(Int64sRef)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public object Clone()
{
return new Int64sRef(longs, Offset, Length);
}
public override int GetHashCode()
{
const int prime = 31;
int result = 0;
long end = Offset + Length;
for (int i = Offset; i < end; i++)
{
result = prime * result + (int)(longs[i] ^ (longs[i].TripleShift(32)));
}
return result;
}
public override bool Equals(object obj)
{
if (obj is null)
{
return false;
}
if (obj is Int64sRef other)
{
return Int64sEquals(other);
}
return false;
}
/// <summary>
/// NOTE: This was longsEquals() in Lucene
/// </summary>
public bool Int64sEquals(Int64sRef other)
{
if (Length == other.Length)
{
int otherUpto = other.Offset;
long[] otherInts = other.longs;
long end = Offset + Length;
for (int upto = Offset; upto < end; upto++, otherUpto++)
{
if (longs[upto] != otherInts[otherUpto])
{
return false;
}
}
return true;
}
else
{
return false;
}
}
/// <summary>
/// Signed <see cref="int"/> order comparison </summary>
public int CompareTo(Int64sRef other)
{
if (this == other)
{
return 0;
}
long[] aInts = this.longs;
int aUpto = this.Offset;
long[] bInts = other.longs;
int bUpto = other.Offset;
long aStop = aUpto + Math.Min(this.Length, other.Length);
while (aUpto < aStop)
{
long aInt = aInts[aUpto++];
long bInt = bInts[bUpto++];
if (aInt > bInt)
{
return 1;
}
else if (aInt < bInt)
{
return -1;
}
}
// One is a prefix of the other, or, they are equal:
return this.Length - other.Length;
}
/// <summary>
/// NOTE: This was copyLongs() in Lucene
/// </summary>
public void CopyInt64s(Int64sRef other)
{
if (longs.Length - Offset < other.Length)
{
longs = new long[other.Length];
Offset = 0;
}
Array.Copy(other.longs, other.Offset, longs, Offset, other.Length);
Length = other.Length;
}
/// <summary>
/// Used to grow the reference array.
/// <para/>
/// In general this should not be used as it does not take the offset into account.
/// <para/>
/// @lucene.internal
/// </summary>
public void Grow(int newLength)
{
if (Debugging.AssertsEnabled) Debugging.Assert(Offset == 0);
if (longs.Length < newLength)
{
longs = ArrayUtil.Grow(longs, newLength);
}
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append('[');
long end = Offset + Length;
for (int i = Offset; i < end; i++)
{
if (i > Offset)
{
sb.Append(' ');
}
sb.Append(longs[i].ToString("x"));
}
sb.Append(']');
return sb.ToString();
}
/// <summary>
/// Creates a new <see cref="Int64sRef"/> that points to a copy of the <see cref="long"/>s from
/// <paramref name="other"/>.
/// <para/>
/// The returned <see cref="Int64sRef"/> will have a length of <c>other.Length</c>
/// and an offset of zero.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Int64sRef DeepCopyOf(Int64sRef other)
{
Int64sRef clone = new Int64sRef();
clone.CopyInt64s(other);
return clone;
}
/// <summary>
/// Performs internal consistency checks.
/// Always returns <c>true</c> (or throws <see cref="InvalidOperationException"/>)
/// </summary>
public bool IsValid()
{
if (longs is null)
{
throw IllegalStateException.Create("longs is null");
}
if (Length < 0)
{
throw IllegalStateException.Create("length is negative: " + Length);
}
if (Length > longs.Length)
{
throw IllegalStateException.Create("length is out of bounds: " + Length + ",longs.length=" + longs.Length);
}
if (Offset < 0)
{
throw IllegalStateException.Create("offset is negative: " + Offset);
}
if (Offset > longs.Length)
{
throw IllegalStateException.Create("offset out of bounds: " + Offset + ",longs.length=" + longs.Length);
}
if (Offset + Length < 0)
{
throw IllegalStateException.Create("offset+length is negative: offset=" + Offset + ",length=" + Length);
}
if (Offset + Length > longs.Length)
{
throw IllegalStateException.Create("offset+length out of bounds: offset=" + Offset + ",length=" + Length + ",longs.length=" + longs.Length);
}
return true;
}
}
} | 34.993197 | 190 | 0.496112 | [
"Apache-2.0"
] | 10088/lucenenet | src/Lucene.Net/Util/LongsRef.cs | 9,997 | C# |
using FanaticFirefly.Data;
using FanaticFirefly.Helpers;
using FanaticFirefly.ViewModels;
using FanaticFirefly.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace FanaticFirefly.Services
{
public static class NavigationService
{
public static async void OpenProfile(Profile SelectedProfile, NavigationPage nav)
{
if (ApplicationSettings.Contains("SelectedProfile"))
{
ApplicationSettings.Edit("SelectedProfile", SelectedProfile);
}
else
{
ApplicationSettings.AddItem("SelectedProfile", SelectedProfile);
}
if (SelectedProfile != null)
{
await nav.PushAsync(new ProfilePage());
}
}
public static async void OpenUser(User SelectedUser, NavigationPage nav)
{
if (ApplicationSettings.Contains("SelectedUser"))
{
ApplicationSettings.Edit("SelectedUser", SelectedUser);
}
else
{
ApplicationSettings.AddItem("SelectedUser", SelectedUser);
}
await nav.PushAsync(new TabbedUserPage());
}
}
}
| 28.695652 | 89 | 0.603788 | [
"MIT"
] | pxlit-projects/entmob2016_9 | FanaticFirefly/FanaticFirefly/FanaticFirefly/Services/NavigationService.cs | 1,322 | C# |
namespace Domain.MainBoundedContext.BatchModule.Aggregates.NodePools
{
using System;
public sealed class NodeOperatingSystem
{
public string NodeAgentSkuId { get; internal set; }
public ImageReference ImageReference { get; internal set; }
internal NodeOperatingSystem(string nodeAgentSkuId, ImageReference imageReference)
{
this.NodeAgentSkuId = nodeAgentSkuId;
this.ImageReference = imageReference;
}
}
}
| 25.842105 | 90 | 0.686354 | [
"Apache-2.0"
] | iddelacruz/studious-pancake | src/HPC.Batch/Domain.MainBoundedContext/BatchModule/Aggregates/NodePools/NodeOperatingSystem.cs | 493 | C# |
namespace Lazy.UI.ValueConveters
{
using Lazy.Core.Enums;
using Lazy.UI.Pages;
using System;
using System.Diagnostics;
using System.Globalization;
public class ApplicationPageValueConverter : BaseValueConverter<ApplicationPageValueConverter>
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
switch ((ApplicationPage)value)
{
case ApplicationPage.Workspace:
return new MainPage();
default:
return null;
}
}
public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
| 29.107143 | 112 | 0.613497 | [
"Apache-2.0"
] | MarioZisov/Lazy | Lazy.UI/ValueConveters/ApplicationPageValueConverter.cs | 817 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UniRx;
using UnityEngine.Events;
using System;
public class DrumGameLineEditor : MonoBehaviour {
/* TODO List
* Maybe add click-grab click-release mode instead of drag and drop
* Refactor to pass 'editing' responsibilities of LineEditor into this class
*/
public Vector2 gridSnapVector = new Vector3(5f, 5f, 0f);
public BoolReactiveProperty isEditing;
public bool gridSnapping;
public bool autoRedrawSegments;
public DrumSequence currentSequence;
public GraphicRaycaster raycaster;
public EventSystem eventSystem;
public KeyCode toggleSnapToGrid = KeyCode.S;
public KeyCode toggleAutoRedraw = KeyCode.R;
public KeyCode addNewPrompt = KeyCode.N;
public KeyCode delLastPrompt = KeyCode.D;
[Header("Hotkeys with Left Shift")]
public KeyCode saveZoomoutPositionKey = KeyCode.C;
public KeyCode undoKey = KeyCode.Z;
public KeyCode redoKey = KeyCode.Y;
public delegate void OnMovePrompt();
private OnMovePrompt onMovePrompt;
private Camera mainCamera;
private DrumGamePrompt selectedPrompt;
private Coroutine draggingPrompt;
private List<DrumGamePrompt> prompts; //ref from DrumGameManagerLine
private Stack<int> undoIndexStack;
private Stack<int> redoIndexStack;
private Stack<Vector3> undoCoordStack;
private Stack<Vector3> redoCoordStack;
private void Awake()
{
mainCamera = Camera.main;
undoIndexStack = new Stack<int>();
redoIndexStack = new Stack<int>();
undoCoordStack = new Stack<Vector3>();
redoCoordStack = new Stack<Vector3>();
isEditing = new BoolReactiveProperty();
isEditing.Subscribe(DropPromptWhenEditEnds);
}
public void SetSequence(DrumSequence next)
{
if (next == null)
return;
currentSequence = next;
if (currentSequence.showLine == null || currentSequence.showLine.Count != currentSequence.coords.Count)
{
currentSequence.showLine = new List<bool>(currentSequence.coords.Count);
while (currentSequence.showLine.Count < currentSequence.coords.Count)
currentSequence.showLine.Add(true);
}
//Debug.Log($"currentSequence name = {currentSequence.name}");
//Debug.Log($"currentSequence coords count = {currentSequence.coords.Count}");
//Debug.Log($"currentSequence showLine count = {currentSequence.showLine.Count}");
}
public void SetPromptsRef(List<DrumGamePrompt> promptList)
{
prompts = promptList;
}
public void SetRefreshDelegate(OnMovePrompt action)
{
onMovePrompt = action;
}
void Update ()
{
if (isEditing.Value)
{
if (Input.GetKeyDown(KeyCode.Mouse0))
{
DrumGamePrompt selectedPrompt = TryRaycastToPrompt();
if (selectedPrompt != null && !Input.GetKey(KeyCode.LeftShift))
StartDragPrompt(selectedPrompt);
else if (selectedPrompt != null && Input.GetKey(KeyCode.LeftShift))
ToggleShowLine(selectedPrompt.GetIndex());
}
if (selectedPrompt != null && Input.GetKeyUp(KeyCode.Mouse0))
{
DropDraggedPrompt();
}
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
ChangeCameraZoom(25);
}
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
ChangeCameraZoom(-25);
}
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(saveZoomoutPositionKey))
SaveZoomoutPosition();
//TODO: add these to the undo/redo history... might require changing the model
if (Input.GetKeyDown(addNewPrompt))
AddPromptUnderCursor(DrumSequence.DrumKey.One);
if (Input.GetKeyDown(KeyCode.Alpha1))
AddPromptUnderCursor(DrumSequence.DrumKey.One);
if (Input.GetKeyDown(KeyCode.Alpha2))
AddPromptUnderCursor(DrumSequence.DrumKey.Two);
if (Input.GetKeyDown(KeyCode.Alpha3))
AddPromptUnderCursor(DrumSequence.DrumKey.Three);
if (Input.GetKeyDown(KeyCode.Alpha4))
AddPromptUnderCursor(DrumSequence.DrumKey.Four);
if (Input.GetKeyDown(KeyCode.Alpha5))
AddPromptUnderCursor(DrumSequence.DrumKey.Five);
if (Input.GetKeyDown(KeyCode.Alpha6))
AddPromptUnderCursor(DrumSequence.DrumKey.Six);
if (Input.GetKeyDown(KeyCode.Alpha7))
AddPromptUnderCursor(DrumSequence.DrumKey.Seven);
if (Input.GetKeyDown(delLastPrompt))
DeleteLastPrompt();
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(undoKey))
Undo();
if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(redoKey))
Redo();
}
if (Input.GetKeyDown(toggleSnapToGrid))
gridSnapping = !gridSnapping;
if (Input.GetKeyDown(toggleAutoRedraw))
autoRedrawSegments = !autoRedrawSegments;
}
private void ChangeCameraZoom(int zChange)
{
Vector3 zoomDistance = mainCamera.transform.localPosition;
zoomDistance.z += zChange;
mainCamera.transform.localPosition = zoomDistance;
}
/// <summary>
/// Returns the first prompt hit by a raycast, or null if none available
/// </summary>
private DrumGamePrompt TryRaycastToPrompt()
{
//Raycast into scene
var pointerEventData = new PointerEventData(eventSystem);
pointerEventData.position = Input.mousePosition;
List<RaycastResult> results = new List<RaycastResult>();
raycaster.Raycast(pointerEventData, results);
if (results.Count > 0)
{
//Check for collisions with objects holding a Prompt
DrumGamePrompt prompt = results[0].gameObject.GetComponentInParent<DrumGamePrompt>();
return prompt;
}
else return null;
}
private void StartDragPrompt(DrumGamePrompt prompt)
{
//If successful, cache a ref to scene Prompt obj
selectedPrompt = prompt;
//Save its current position to our undo history
AddToUndoHistory(prompt.GetIndex(), prompt.transform.localPosition);
ClearRedoHistory();
//Start dragging!
if (draggingPrompt != null)
StopCoroutine(draggingPrompt);
draggingPrompt = StartCoroutine(DraggingPrompt());
}
private void ToggleShowLine(int promptIndex)
{
currentSequence.showLine[promptIndex] = !currentSequence.showLine[promptIndex];
#if UNITY_EDITOR
UnityEditor.EditorUtility.SetDirty(currentSequence);
#endif
//Trigger redraw event whether or not auto redraw is on,
//or else we won't know we just did something!
onMovePrompt.Invoke();
}
private void DropPromptWhenEditEnds(bool editing)
{
if (!editing && selectedPrompt != null)
DropDraggedPrompt();
}
private void DropDraggedPrompt()
{
if (gridSnapping)
{
Vector3 droppedPosition = selectedPrompt.transform.localPosition;
Vector3 gridPosition = GetGridSnappedPosition(droppedPosition);
StopCoroutine(draggingPrompt);
selectedPrompt.transform.localPosition = gridPosition;
}
SavePromptLocationToAsset(selectedPrompt.GetIndex(), selectedPrompt.transform.localPosition);
//clear the cached reference
selectedPrompt = null;
}
private Vector3 GetGridSnappedPosition(Vector3 input)
{
int gridX = Mathf.RoundToInt(input.x / gridSnapVector.x) * (int)gridSnapVector.x;
int gridY = Mathf.RoundToInt(input.y / gridSnapVector.y) * (int)gridSnapVector.y;
return new Vector3 { x = gridX, y = gridY, z = 0 };
}
private void SavePromptLocationToAsset(int index, Vector3 position)
{
#if UNITY_EDITOR
currentSequence.coords[index] = position;
UnityEditor.EditorUtility.SetDirty(currentSequence);
#endif
if (autoRedrawSegments)
onMovePrompt.Invoke();
}
private void SaveZoomoutPosition()
{
#if UNITY_EDITOR
currentSequence.zoomoutPosition = Camera.main.transform.localPosition;
UnityEditor.EditorUtility.SetDirty(currentSequence);
#endif
}
IEnumerator DraggingPrompt()
{
while (selectedPrompt != null)
{
//Transform mouse position into world position -- drag the prompt to that world position
Vector3 mouseWorldPos = UnityHelper.GetWorldSpaceMousePosition();
mouseWorldPos.z = 0;
selectedPrompt.transform.localPosition = mouseWorldPos;
yield return null;
}
}
private void DeleteLastPrompt()
{
currentSequence.keys.RemoveAt(currentSequence.keys.Count - 1);
currentSequence.coords.RemoveAt(currentSequence.coords.Count - 1);
currentSequence.showLine.RemoveAt(currentSequence.showLine.Count - 1);
onMovePrompt.Invoke();
}
private void AddPromptUnderCursor(DrumSequence.DrumKey keyNum)
{
Vector3 mouseWorldPos = UnityHelper.GetWorldSpaceMousePosition();
mouseWorldPos.z = 0;
if (gridSnapping)
{
Vector3 gridPosition = GetGridSnappedPosition(mouseWorldPos);
mouseWorldPos = gridPosition;
}
currentSequence.keys.Add(keyNum);
currentSequence.coords.Add(mouseWorldPos);
currentSequence.showLine.Add(true);
onMovePrompt.Invoke();
}
private void AddToUndoHistory(int index, Vector3 position)
{
undoIndexStack.Push(index);
undoCoordStack.Push(position);
}
private void AddToRedoHistory(int index, Vector3 position)
{
redoIndexStack.Push(index);
redoCoordStack.Push(position);
}
private void ClearRedoHistory()
{
redoIndexStack.Clear();
redoCoordStack.Clear();
}
private void Undo()
{
if (undoIndexStack.Count <= 0)
return;
//pop an index and a vector off their respective stacks
int promptIndex = undoIndexStack.Pop();
Vector3 lastPosition = undoCoordStack.Pop();
//Save the current position of that prompt to the Redo history
AddToRedoHistory(promptIndex, prompts[promptIndex].transform.localPosition);
//Move the prompt and save its location
prompts[promptIndex].transform.localPosition = lastPosition;
SavePromptLocationToAsset(promptIndex, lastPosition);
}
private void Redo()
{
if (redoIndexStack.Count <= 0)
return;
//pop an index and a vector
int promptIndex = redoIndexStack.Pop();
Vector3 lastPosition = redoCoordStack.Pop();
//Save the current position back to the Undo history
AddToUndoHistory(promptIndex, prompts[promptIndex].transform.localPosition);
//Move the prompt and save its location
prompts[promptIndex].transform.localPosition = lastPosition;
SavePromptLocationToAsset(promptIndex, lastPosition);
}
}
| 30.975676 | 111 | 0.647675 | [
"MIT"
] | Kionius/DacronDuvet | Assets/ScenicAssets/DrumGame/DrumGameLineEditor.cs | 11,463 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace GaugeSilverlightDemoApp
{
public partial class ExamplePressure : UserControl
{
private Color c1 = Color.FromArgb(255, 251, 10, 10);
private Color c2 = Color.FromArgb(255, 255, 255, 0);
private Color c3 = Color.FromArgb(255, 116, 255, 0);
private Color c;
private double m_dpumpLimit;
//DispatcherTimer timer;
private Storyboard myStoryboard1;
private DoubleAnimation pumpAnim;
public ExamplePressure()
{
InitializeComponent();
IndicatorCheck(slider.Value);
pumpLimit.Text = "3,5";
//timer = new DispatcherTimer();
//timer.Interval = new TimeSpan(200000);
}
private void IndicatorCheck(double value)
{
if (value >= PresureGauge.SecondaryScales[2].RangeBegin && value <= PresureGauge.SecondaryScales[2].RangeEnd)
c = c1;
else if (value >= PresureGauge.SecondaryScales[1].RangeBegin && value <= PresureGauge.SecondaryScales[1].RangeEnd)
c = c2;
else
c = c3;
alarm.Fill = new SolidColorBrush(c);
}
private void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
IndicatorCheck(e.NewValue);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
myStoryboard2.Begin();
bool parsed = double.TryParse(pumpLimit.Text, out m_dpumpLimit);
m_dpumpLimit = Math.Round(m_dpumpLimit, 2);
if (parsed)
{
//timer.Tick += timer_Tick;
//timer.Start();
PumpThePresure(slider.Value, m_dpumpLimit);
}
}
private void PumpThePresure(double curValue, double toValue)
{
myStoryboard1 = new Storyboard();
if (m_dpumpLimit > PresureGauge.PrimaryScale.Value)
{
if (PresureGauge.PrimaryScale.Value <= PresureGauge.PrimaryScale.RangeEnd && m_dpumpLimit <= PresureGauge.PrimaryScale.RangeEnd)
{
//slider.Value += 0.01;
pumpAnim = new DoubleAnimation();
}
}
else if (m_dpumpLimit < PresureGauge.PrimaryScale.Value)
{
if (PresureGauge.PrimaryScale.Value >= PresureGauge.PrimaryScale.RangeBegin && m_dpumpLimit >= PresureGauge.PrimaryScale.RangeBegin)
{
//slider.Value -= 0.01;
pumpAnim = new DoubleAnimation();
}
}
else
{
//pumpLimit.Clear();
}
pumpAnim.From = curValue;
pumpAnim.To = toValue;
pumpAnim.Duration = TimeSpan.FromSeconds(5);
myStoryboard1.Children.Add(pumpAnim);
Storyboard.SetTargetName(pumpAnim, "slider");
Storyboard.SetTargetProperty(pumpAnim, new PropertyPath("Value"));
myStoryboard1.Begin();
}
private void Animation(object sender, RoutedEventArgs e)
{
myStoryboard2.Begin();
}
}
} | 33.280374 | 148 | 0.569784 | [
"MIT"
] | MIGU-1/csharp_samples_events_fastclock-template | source/FastClock/v.1.0.1_20160405/DemoGauges/GaugeSilverlightDemoApp/ExamplePressure.xaml.cs | 3,563 | C# |
using System;
using System.Linq;
using System.Collections.Generic;
namespace Lib.AspNetCore.Security.Http.Headers
{
/// <summary>
/// Represents value of Feature-Policy header.
/// </summary>
[Obsolete("Feature Policy has been replaced with Permissions Policy.")]
public class MultipleFeaturePolicyHeaderValue : FeaturePolicyHeaderValue
{
#region Fields
private readonly List<FeaturePolicy> _policies = new List<FeaturePolicy>();
#endregion
#region Properties
/// <summary>
/// Gets or sets the policies to selectively enable and disable use of various browser features and APIs.
/// </summary>
public IList<FeaturePolicy> Policies => _policies;
#endregion
#region Constructors
/// <summary>
/// Instantiates a new <see cref="MultipleFeaturePolicyHeaderValue"/> with single default <see cref="FeaturePolicy"/>.
/// </summary>
public MultipleFeaturePolicyHeaderValue()
{
Policies.Add(new FeaturePolicy());
}
/// <summary>
/// Instantiates a new <see cref="MultipleFeaturePolicyHeaderValue"/>.
/// </summary>
/// <param name="policies">The policies to selectively enable and disable use of various browser features and APIs.</param>
public MultipleFeaturePolicyHeaderValue(params FeaturePolicy[] policies)
{
_policies.AddRange(policies);
}
#endregion
#region Methods
/// <summary>
/// Gets the string representation of header value.
/// </summary>
/// <returns>The string representation of header value.</returns>
public override string ToString()
{
return String.Join(",", _policies.Select(policy => policy.ToPolicyDirectiveJson(true)));
}
#endregion
}
}
| 34.327273 | 131 | 0.630826 | [
"MIT"
] | tpeczek/Lib.AspNetCore.Security | Lib.AspNetCore.Security/Http/Headers/MultipleFeaturePolicyHeaderValue.cs | 1,890 | C# |
using System;
using System.Collections.Generic;
using GildedRose;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace GildedRoseTests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
public void MainTest()
{
Program.Output = Checker.WriteLine;
Program.OutputEnd = Checker.ReadLine;
Program.Main(null);
var expected = GetExpectedResult();
CollectionAssert.AreEqual(expected, Checker.Record);
}
private List<string> GetExpectedResult()
{
return new List<string>{"OMGHAI!",
"-------- day 0 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 10, 20",
"Aged Brie, 2, 0",
"Elixir of the Mongoose, 5, 7",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 15, 20",
"Backstage passes to a TAFKAL80ETC concert, 10, 49",
"Backstage passes to a TAFKAL80ETC concert, 5, 49",
"Conjured Mana Cake, 3, 6",
"",
"-------- day 1 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 9, 19",
"Aged Brie, 1, 1",
"Elixir of the Mongoose, 4, 6",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 14, 21",
"Backstage passes to a TAFKAL80ETC concert, 9, 50",
"Backstage passes to a TAFKAL80ETC concert, 4, 50",
"Conjured Mana Cake, 2, 5",
"",
"-------- day 2 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 8, 18",
"Aged Brie, 0, 2",
"Elixir of the Mongoose, 3, 5",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 13, 22",
"Backstage passes to a TAFKAL80ETC concert, 8, 50",
"Backstage passes to a TAFKAL80ETC concert, 3, 50",
"Conjured Mana Cake, 1, 4",
"",
"-------- day 3 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 7, 17",
"Aged Brie, -1, 4",
"Elixir of the Mongoose, 2, 4",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 12, 23",
"Backstage passes to a TAFKAL80ETC concert, 7, 50",
"Backstage passes to a TAFKAL80ETC concert, 2, 50",
"Conjured Mana Cake, 0, 3",
"",
"-------- day 4 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 6, 16",
"Aged Brie, -2, 6",
"Elixir of the Mongoose, 1, 3",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 11, 24",
"Backstage passes to a TAFKAL80ETC concert, 6, 50",
"Backstage passes to a TAFKAL80ETC concert, 1, 50",
"Conjured Mana Cake, -1, 1",
"",
"-------- day 5 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 5, 15",
"Aged Brie, -3, 8",
"Elixir of the Mongoose, 0, 2",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 10, 25",
"Backstage passes to a TAFKAL80ETC concert, 5, 50",
"Backstage passes to a TAFKAL80ETC concert, 0, 50",
"Conjured Mana Cake, -2, 0",
"",
"-------- day 6 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 4, 14",
"Aged Brie, -4, 10",
"Elixir of the Mongoose, -1, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 9, 27",
"Backstage passes to a TAFKAL80ETC concert, 4, 50",
"Backstage passes to a TAFKAL80ETC concert, -1, 0",
"Conjured Mana Cake, -3, 0",
"",
"-------- day 7 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 3, 13",
"Aged Brie, -5, 12",
"Elixir of the Mongoose, -2, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 8, 29",
"Backstage passes to a TAFKAL80ETC concert, 3, 50",
"Backstage passes to a TAFKAL80ETC concert, -2, 0",
"Conjured Mana Cake, -4, 0",
"",
"-------- day 8 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 2, 12",
"Aged Brie, -6, 14",
"Elixir of the Mongoose, -3, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 7, 31",
"Backstage passes to a TAFKAL80ETC concert, 2, 50",
"Backstage passes to a TAFKAL80ETC concert, -3, 0",
"Conjured Mana Cake, -5, 0",
"",
"-------- day 9 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 1, 11",
"Aged Brie, -7, 16",
"Elixir of the Mongoose, -4, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 6, 33",
"Backstage passes to a TAFKAL80ETC concert, 1, 50",
"Backstage passes to a TAFKAL80ETC concert, -4, 0",
"Conjured Mana Cake, -6, 0",
"",
"-------- day 10 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, 0, 10",
"Aged Brie, -8, 18",
"Elixir of the Mongoose, -5, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 5, 35",
"Backstage passes to a TAFKAL80ETC concert, 0, 50",
"Backstage passes to a TAFKAL80ETC concert, -5, 0",
"Conjured Mana Cake, -7, 0",
"",
"-------- day 11 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -1, 8",
"Aged Brie, -9, 20",
"Elixir of the Mongoose, -6, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 4, 38",
"Backstage passes to a TAFKAL80ETC concert, -1, 0",
"Backstage passes to a TAFKAL80ETC concert, -6, 0",
"Conjured Mana Cake, -8, 0",
"",
"-------- day 12 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -2, 6",
"Aged Brie, -10, 22",
"Elixir of the Mongoose, -7, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 3, 41",
"Backstage passes to a TAFKAL80ETC concert, -2, 0",
"Backstage passes to a TAFKAL80ETC concert, -7, 0",
"Conjured Mana Cake, -9, 0",
"",
"-------- day 13 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -3, 4",
"Aged Brie, -11, 24",
"Elixir of the Mongoose, -8, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 2, 44",
"Backstage passes to a TAFKAL80ETC concert, -3, 0",
"Backstage passes to a TAFKAL80ETC concert, -8, 0",
"Conjured Mana Cake, -10, 0",
"",
"-------- day 14 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -4, 2",
"Aged Brie, -12, 26",
"Elixir of the Mongoose, -9, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 1, 47",
"Backstage passes to a TAFKAL80ETC concert, -4, 0",
"Backstage passes to a TAFKAL80ETC concert, -9, 0",
"Conjured Mana Cake, -11, 0",
"",
"-------- day 15 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -5, 0",
"Aged Brie, -13, 28",
"Elixir of the Mongoose, -10, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, 0, 50",
"Backstage passes to a TAFKAL80ETC concert, -5, 0",
"Backstage passes to a TAFKAL80ETC concert, -10, 0",
"Conjured Mana Cake, -12, 0",
"",
"-------- day 16 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -6, 0",
"Aged Brie, -14, 30",
"Elixir of the Mongoose, -11, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -1, 0",
"Backstage passes to a TAFKAL80ETC concert, -6, 0",
"Backstage passes to a TAFKAL80ETC concert, -11, 0",
"Conjured Mana Cake, -13, 0",
"",
"-------- day 17 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -7, 0",
"Aged Brie, -15, 32",
"Elixir of the Mongoose, -12, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -2, 0",
"Backstage passes to a TAFKAL80ETC concert, -7, 0",
"Backstage passes to a TAFKAL80ETC concert, -12, 0",
"Conjured Mana Cake, -14, 0",
"",
"-------- day 18 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -8, 0",
"Aged Brie, -16, 34",
"Elixir of the Mongoose, -13, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -3, 0",
"Backstage passes to a TAFKAL80ETC concert, -8, 0",
"Backstage passes to a TAFKAL80ETC concert, -13, 0",
"Conjured Mana Cake, -15, 0",
"",
"-------- day 19 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -9, 0",
"Aged Brie, -17, 36",
"Elixir of the Mongoose, -14, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -4, 0",
"Backstage passes to a TAFKAL80ETC concert, -9, 0",
"Backstage passes to a TAFKAL80ETC concert, -14, 0",
"Conjured Mana Cake, -16, 0",
"",
"-------- day 20 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -10, 0",
"Aged Brie, -18, 38",
"Elixir of the Mongoose, -15, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -5, 0",
"Backstage passes to a TAFKAL80ETC concert, -10, 0",
"Backstage passes to a TAFKAL80ETC concert, -15, 0",
"Conjured Mana Cake, -17, 0",
"",
"-------- day 21 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -11, 0",
"Aged Brie, -19, 40",
"Elixir of the Mongoose, -16, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -6, 0",
"Backstage passes to a TAFKAL80ETC concert, -11, 0",
"Backstage passes to a TAFKAL80ETC concert, -16, 0",
"Conjured Mana Cake, -18, 0",
"",
"-------- day 22 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -12, 0",
"Aged Brie, -20, 42",
"Elixir of the Mongoose, -17, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -7, 0",
"Backstage passes to a TAFKAL80ETC concert, -12, 0",
"Backstage passes to a TAFKAL80ETC concert, -17, 0",
"Conjured Mana Cake, -19, 0",
"",
"-------- day 23 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -13, 0",
"Aged Brie, -21, 44",
"Elixir of the Mongoose, -18, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -8, 0",
"Backstage passes to a TAFKAL80ETC concert, -13, 0",
"Backstage passes to a TAFKAL80ETC concert, -18, 0",
"Conjured Mana Cake, -20, 0",
"",
"-------- day 24 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -14, 0",
"Aged Brie, -22, 46",
"Elixir of the Mongoose, -19, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -9, 0",
"Backstage passes to a TAFKAL80ETC concert, -14, 0",
"Backstage passes to a TAFKAL80ETC concert, -19, 0",
"Conjured Mana Cake, -21, 0",
"",
"-------- day 25 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -15, 0",
"Aged Brie, -23, 48",
"Elixir of the Mongoose, -20, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -10, 0",
"Backstage passes to a TAFKAL80ETC concert, -15, 0",
"Backstage passes to a TAFKAL80ETC concert, -20, 0",
"Conjured Mana Cake, -22, 0",
"",
"-------- day 26 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -16, 0",
"Aged Brie, -24, 50",
"Elixir of the Mongoose, -21, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -11, 0",
"Backstage passes to a TAFKAL80ETC concert, -16, 0",
"Backstage passes to a TAFKAL80ETC concert, -21, 0",
"Conjured Mana Cake, -23, 0",
"",
"-------- day 27 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -17, 0",
"Aged Brie, -25, 50",
"Elixir of the Mongoose, -22, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -12, 0",
"Backstage passes to a TAFKAL80ETC concert, -17, 0",
"Backstage passes to a TAFKAL80ETC concert, -22, 0",
"Conjured Mana Cake, -24, 0",
"",
"-------- day 28 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -18, 0",
"Aged Brie, -26, 50",
"Elixir of the Mongoose, -23, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -13, 0",
"Backstage passes to a TAFKAL80ETC concert, -18, 0",
"Backstage passes to a TAFKAL80ETC concert, -23, 0",
"Conjured Mana Cake, -25, 0",
"",
"-------- day 29 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -19, 0",
"Aged Brie, -27, 50",
"Elixir of the Mongoose, -24, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -14, 0",
"Backstage passes to a TAFKAL80ETC concert, -19, 0",
"Backstage passes to a TAFKAL80ETC concert, -24, 0",
"Conjured Mana Cake, -26, 0",
"",
"-------- day 30 --------",
"name, sellIn, quality",
"+5 Dexterity Vest, -20, 0",
"Aged Brie, -28, 50",
"Elixir of the Mongoose, -25, 0",
"Sulfuras, Hand of Ragnaros, 0, 80",
"Sulfuras, Hand of Ragnaros, -1, 80",
"Backstage passes to a TAFKAL80ETC concert, -15, 0",
"Backstage passes to a TAFKAL80ETC concert, -20, 0",
"Backstage passes to a TAFKAL80ETC concert, -25, 0",
"Conjured Mana Cake, -27, 0",
""};
}
}
public class Checker
{
public static List<string> Record { get; } = new List<string>();
public static void WriteLine(string message)
{
Record.Add(message);
Console.WriteLine("ooo" + message);
}
public static string ReadLine()
{
return string.Empty;
}
}
} | 32.324519 | 72 | 0.633747 | [
"MIT"
] | mystic01/GildedRose | GildedRoseTests/ProgramTests.cs | 13,449 | C# |
using Lachain.Proto;
namespace Lachain.Core.Blockchain.VM
{
public class InvocationMessage
{
public UInt160 Sender { get; set; }
public UInt256 Value { get; set; }
public InvocationType Type { get; set; }
public UInt160? Delegate { get; set; }
}
}
| 21.071429 | 48 | 0.620339 | [
"Apache-2.0"
] | LATOKEN/lachain | src/Lachain.Core/Blockchain/VM/InvocationMessage.cs | 297 | C# |
namespace Axinom.Toolkit
{
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// A generic interface for validatable objects. Used to avoid having to re-implement an IValidatable
/// interface in every project or - even worse - in every component. There also exist convenient
/// extensions methods for the IValidatable interface, provided by <see cref="ExtensionsForIValidatable"/>.
/// </summary>
/// <seealso cref="ExtensionsForIValidatable"/>
public interface IValidatable
{
/// <summary>
/// Validates the state of the object. Throws exception on failure.
/// </summary>
/// <exception cref="ValidationException">Thrown if the state of the object is not valid.</exception>
void Validate();
}
} | 35.857143 | 108 | 0.733068 | [
"MIT"
] | Axinom/Toolkit | Toolkit/IValidatable.cs | 755 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IHermiteInterpolation
{
/// <summary>
/// 两点三次埃尔米特插值
/// </summary>
/// <param name="start">第一个已知点</param>
/// <param name="end">第二个已知点</param>
/// <param name="forecast">需要预测的点</param>
/// <returns>预测点的 Vector3</returns>
float Hermite(float x0, float y0, float derivative0, float x1, float y1, float derivative1, float forecastX);
}
| 25.888889 | 113 | 0.67382 | [
"Apache-2.0"
] | 1170300302/IEC-Project | Assets/Scripts/Network/IHermiteInterpolation.cs | 532 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Analyzer.Utilities;
using Analyzer.Utilities.PooledObjects;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Analyzers.MetaAnalyzers.Fixers
{
public sealed partial class DefineDiagnosticDescriptorArgumentsCorrectlyFix : CodeFixProvider
{
private sealed class CustomFixAllProvider : FixAllProvider
{
public static CustomFixAllProvider Instance = new();
private CustomFixAllProvider()
{
}
public override async Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
{
// FixAll for source document fixes are handled fine by the batch fixer.
if (fixAllContext.CodeActionEquivalenceKey.EndsWith(SourceDocumentEquivalenceKeySuffix, StringComparison.Ordinal))
{
return await WellKnownFixAllProviders.BatchFixer.GetFixAsync(fixAllContext).ConfigureAwait(false);
}
// We need custom FixAll handling for additional document fixes.
Debug.Assert(fixAllContext.CodeActionEquivalenceKey.EndsWith(AdditionalDocumentEquivalenceKeySuffix, StringComparison.Ordinal));
var diagnosticsToFix = new List<KeyValuePair<Project, ImmutableArray<Diagnostic>>>();
switch (fixAllContext.Scope)
{
case FixAllScope.Document:
{
ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetDocumentDiagnosticsAsync(fixAllContext.Document).ConfigureAwait(false);
diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(fixAllContext.Project, diagnostics));
break;
}
case FixAllScope.Project:
{
Project project = fixAllContext.Project;
ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetAllDiagnosticsAsync(project).ConfigureAwait(false);
diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(fixAllContext.Project, diagnostics));
break;
}
case FixAllScope.Solution:
{
foreach (Project project in fixAllContext.Solution.Projects)
{
ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetAllDiagnosticsAsync(project).ConfigureAwait(false);
diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(project, diagnostics));
}
break;
}
case FixAllScope.Custom:
return null;
default:
Debug.Fail($"Unknown FixAllScope '{fixAllContext.Scope}'");
return null;
}
return new FixAllAdditionalDocumentChangeAction(fixAllContext.Scope, fixAllContext.Solution, diagnosticsToFix, fixAllContext.CodeActionEquivalenceKey);
}
private sealed class FixAllAdditionalDocumentChangeAction : CodeAction
{
private readonly List<KeyValuePair<Project, ImmutableArray<Diagnostic>>> _diagnosticsToFix;
private readonly Solution _solution;
public FixAllAdditionalDocumentChangeAction(FixAllScope fixAllScope, Solution solution, List<KeyValuePair<Project, ImmutableArray<Diagnostic>>> diagnosticsToFix, string equivalenceKey)
{
this.Title = fixAllScope.ToString();
_solution = solution;
_diagnosticsToFix = diagnosticsToFix;
this.EquivalenceKey = equivalenceKey;
}
public override string Title { get; }
public override string EquivalenceKey { get; }
protected override async Task<Solution> GetChangedSolutionAsync(CancellationToken cancellationToken)
{
// Group fixes by additional documents.
var fixInfoMap = new Dictionary<TextDocument, List<FixInfo>>();
foreach (var kvp in _diagnosticsToFix)
{
var project = kvp.Key;
var diagnostics = kvp.Value;
var additionalDocuments = project.AdditionalDocuments.ToImmutableArray();
foreach (var diagnostic in diagnostics)
{
if (TryGetFixValue(diagnostic, out var fixValue) &&
TryGetAdditionalDocumentFixInfo(diagnostic, fixValue, additionalDocuments, out var fixInfo))
{
var additionalDocument = fixInfo.Value.AdditionalDocumentToFix;
RoslynDebug.Assert(additionalDocument != null);
if (!fixInfoMap.TryGetValue(additionalDocument, out var fixInfos))
{
fixInfos = new List<FixInfo>();
fixInfoMap.Add(additionalDocument, fixInfos);
}
fixInfos.Add(fixInfo.Value);
}
}
}
var newSolution = _solution;
foreach (var kvp in fixInfoMap)
{
var additionalDocument = kvp.Key;
var fixInfos = kvp.Value;
var text = await additionalDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
using var textChanges = ArrayBuilder<TextChange>.GetInstance(fixInfos.Count);
using var seenInputSpansToFix = PooledHashSet<TextSpan>.GetInstance();
foreach (var fixInfo in fixInfos)
{
var inputSpanToFix = fixInfo.AdditionalDocumentSpanToFix!.Value;
if (seenInputSpansToFix.Add(inputSpanToFix))
{
textChanges.Add(new TextChange(inputSpanToFix, fixInfo.FixValue));
}
}
var newText = text.WithChanges(textChanges);
newSolution = newSolution.WithAdditionalDocumentText(additionalDocument.Id, newText);
}
return newSolution;
}
}
}
}
}
| 48.68 | 200 | 0.555875 | [
"MIT"
] | AndreasVolkmann/roslyn-analyzers | src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Fixers/DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs | 7,304 | 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.
namespace StarkPlatform.CodeAnalysis.Operations
{
/// <summary>
/// Represents a base interface for assignments.
/// <para>
/// Current usage:
/// (1) C# simple, compound and deconstruction assignment expressions.
/// (2) VB simple and compound assignment expressions.
/// </para>
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IAssignmentOperation : IOperation
{
/// <summary>
/// Target of the assignment.
/// </summary>
IOperation Target { get; }
/// <summary>
/// Value to be assigned to the target of the assignment.
/// </summary>
IOperation Value { get; }
}
}
| 33.266667 | 161 | 0.621242 | [
"Apache-2.0"
] | stark-lang/stark-roslyn | src/Compilers/Core/Portable/Operations/IAssignmentOperation.cs | 1,000 | C# |
namespace ErosionFinder.Data.Models
{
/// <summary>
/// A generic class to represent the way
/// the namespaces can be grouped
/// </summary>
public abstract class NamespacesGroupingMethod { }
} | 26.875 | 54 | 0.669767 | [
"MIT"
] | rafaatsouza/erosion-finder | Source/ErosionFinder.Data/Models/NamespacesGroupingMethod.cs | 217 | C# |
namespace Pharmacy.Services.Admin.Implementations
{
using Pharmacy.Data;
using Pharmacy.Models;
using Pharmacy.Services.Admin.Models;
using System.Linq;
using System.Collections.Generic;
using AutoMapper.QueryableExtensions;
using System;
using Pharmacy.Common;
public class CategoriesAdminService : ICategoriesAdminService, IService
{
private readonly PharmacyDbContext db;
public CategoriesAdminService(PharmacyDbContext db)
{
this.db = db;
}
public IEnumerable<CategoriesAdminServiceModel> Top()
=> this.db
.Categories
.Where(c => c.ParentCategory == null)
.ProjectTo<CategoriesAdminServiceModel>()
.OrderBy(csm => csm.Name)
.ToList();
public IEnumerable<CategoriesAdminServiceModel> Children(int id)
=> this.db
.Categories
.Where(c => c.Id == id)
.Select(c => c.ChiledCategories
.Select(cc => new CategoriesAdminServiceModel
{
Id = cc.Id,
Name = cc.Name
}))
.FirstOrDefault();
//Returns only categories without children
public IEnumerable<CategoriesDropDownModel> GetCategoriesDropDown()
=> this.db
.Categories
.Where(c => c.ChiledCategories.Count() == 0)
.Select(c => new CategoriesDropDownModel
{
Text = c.Name,
Value = c.Id
})
.OrderBy(c => c.Text)
.ToList();
public bool Add(string name)
{
if (name == null || name == String.Empty)
{
return false;
}
this.db
.Categories
.Add(new Category
{
Name = name
});
this.db.SaveChanges();
return true;
}
public bool AddChiled(int parentId, int chiledId)
{
var parentCategory = this.db.Categories.Where(pc => pc.Id == parentId).FirstOrDefault();
var chiledCategory = this.db.Categories.Where(cc => cc.Id == chiledId).FirstOrDefault();
if (CustomValidator.CheckIfObjectNull(parentCategory) || CustomValidator.CheckIfObjectNull(chiledCategory))
{
return false;
};
parentCategory.ChiledCategories.Add(chiledCategory);
this.db.SaveChanges();
return true;
}
}
}
| 30.511111 | 119 | 0.504006 | [
"MIT"
] | Zhelyazko777/OnlinePharmacy | Pharmacy/Pharmacy.Services/Admin/Implementations/CategoriesAdminService.cs | 2,748 | C# |
using Celeste.Mod.Entities;
namespace FrostHelper;
[CustomEntity("FrostHelper/CassetteTempoTrigger")]
public class CassetteTempoTrigger : Trigger {
float Tempo;
bool ResetOnLeave;
float prevTempo;
public CassetteTempoTrigger(EntityData data, Vector2 offset) : base(data, offset) {
Tempo = data.Float("Tempo", 1f);
ResetOnLeave = data.Bool("ResetOnLeave", false);
}
public override void OnEnter(Player player) {
prevTempo = SceneAs<Level>().CassetteBlockTempo;
SceneAs<Level>().CassetteBlockTempo = Tempo;
SetManagerTempo(Tempo);
}
public override void OnLeave(Player player) {
if (ResetOnLeave) {
SceneAs<Level>().CassetteBlockTempo = prevTempo;
SetManagerTempo(prevTempo);
}
}
public void SetManagerTempo(float Tempo) {
// let me speak to your manager... to change the tempo
CassetteBlockManager manager = Scene.Tracker.GetEntity<CassetteBlockManager>();
if (manager != null) {
DynData<CassetteBlockManager> data = new DynData<CassetteBlockManager>(manager);
data.Set("tempoMult", Tempo);
}
}
}
| 31.945946 | 92 | 0.658206 | [
"MIT"
] | JaThePlayer/FrostHelper | Code/FrostHelper/Triggers/CassetteTempoTrigger.cs | 1,184 | C# |
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using CryptoKitties.Net.Api;
using CryptoKitties.Net.Blockchain.RestClient;
using Microsoft.ServiceFabric.Services.Runtime;
namespace CryptoKitties.Net.Fabric.KittyContractDataService
{
internal static class Program
{
/// <summary>
/// This is the entry point of the service host process.
/// </summary>
private static void Main()
{
var httpFactory = new HttpClientRequestFactory();
try
{
// The ServiceManifest.XML file defines one or more service type names.
// Registering a service maps a service type name to a .NET type.
// When Service Fabric creates an instance of this service type,
// an instance of the class is created in this host process.
ServiceRuntime.RegisterServiceAsync("CryptoKitties.Net.Fabric.KittyContractDataServiceType",
context => new KittyContractDataService(context, new EtherscanApiClient(httpFactory))).GetAwaiter().GetResult();
ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(KittyContractDataService).Name);
// Prevents this host process from terminating so services keep running.
Thread.Sleep(Timeout.Infinite);
}
catch (Exception e)
{
ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
throw;
}
}
}
}
| 38.595238 | 136 | 0.642813 | [
"MIT"
] | seanmobrien/CryptoKitty.TraderServices | src/CryptoKitties.Net.Fabric.KittyContractDataService/Program.cs | 1,623 | C# |
// c:\program files (x86)\windows kits\10\include\10.0.22000.0\shared\ks.h(107,5)
using System;
using System.Runtime.InteropServices;
namespace DirectN
{
[StructLayout(LayoutKind.Sequential)]
public partial struct __struct_ks_2__union_0
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public byte[] __bits;
public __struct_ks_2__union_0__struct_0 __field_0 { get => InteropRuntime.Get<__struct_ks_2__union_0__struct_0>(__bits, 0, 192); set { if (__bits == null) __bits = new byte[24]; InteropRuntime.Set<__struct_ks_2__union_0__struct_0>(value, __bits, 0, 192); } }
public long Alignment { get => InteropRuntime.GetInt64(__bits, 0, 64); set { if (__bits == null) __bits = new byte[24]; InteropRuntime.SetInt64(value, __bits, 0, 64); } }
}
}
| 53.705882 | 267 | 0.714129 | [
"MIT"
] | Steph55/DirectN | DirectN/DirectN/Generated/__struct_ks_2__union_0.cs | 915 | C# |
/***********************************************************************************************\
* (C) KAL ATM Software GmbH, 2021
* KAL ATM Software GmbH licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*
* This file was created automatically as part of the XFS4IoT CashAcceptor interface.
* PresentMedia_g.cs uses automatically generated parts.
\***********************************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using XFS4IoT.Commands;
namespace XFS4IoT.CashAcceptor.Commands
{
//Original name = PresentMedia
[DataContract]
[Command(Name = "CashAcceptor.PresentMedia")]
public sealed class PresentMediaCommand : Command<PresentMediaCommand.PayloadData>
{
public PresentMediaCommand(int RequestId, PresentMediaCommand.PayloadData Payload)
: base(RequestId, Payload)
{ }
[DataContract]
public sealed class PayloadData : MessagePayload
{
public PayloadData(int Timeout, CashManagement.PositionEnum? Position = null)
: base(Timeout)
{
this.Position = Position;
}
[DataMember(Name = "position")]
public CashManagement.PositionEnum? Position { get; init; }
}
}
}
| 34 | 97 | 0.582633 | [
"MIT"
] | KAL-ATM-Software/KAL_XFS4IoT_SP-Dev | Framework/Core/CashAcceptor/Commands/PresentMedia_g.cs | 1,428 | C# |
using System.Reflection;
using System.Timers;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
{
[Reference ("System.dll")]
[SetupLinkerCoreAction ("link")]
[SetupLinkerArgument ("--used-attrs-only", "true")]
[KeptAttributeInAssembly (PlatformAssemblies.CoreLib, typeof (AssemblyDescriptionAttribute))]
#if !NETCOREAPP
[KeptAttributeInAssembly ("System.dll", typeof (AssemblyDescriptionAttribute))]
#endif
[SkipPeVerify]
public class CoreLibraryUsedAssemblyAttributesAreKept
{
public static void Main ()
{
// Use something from System so that the entire reference isn't linked away
var system = new Timer ();
// use one of the attribute types so that it is marked
var tmp = typeof (AssemblyDescriptionAttribute).ToString ();
}
}
} | 32.444444 | 94 | 0.769406 | [
"MIT"
] | Youssef1313/linker | test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUsedAssemblyAttributesAreKept.cs | 876 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
namespace DotSpatial.Symbology
{
/// <summary>
/// Jenks natural breaks optimization used for symbolizing based on minimizing variance within categories.
/// </summary>
/// <remarks>
/// This code replaces the JenksBreaks code which was based on MapWinGIS and was buggy.
/// This version is based on (http://en.wikipedia.org/wiki/Jenks_natural_breaks_optimization)
/// Implementations: [1](http://danieljlewis.org/files/2010/06/Jenks.pdf) (python),
/// [2](https://github.com/vvoovv/djeo-jenks/blob/master/main.js) (buggy),
/// [3](https://github.com/simogeo/geostats/blob/master/lib/geostats.js#L407) (works)
/// Adapted by Dan Ames from "literate" version created by Tom MacWright
/// presented here: https://macwright.org/2013/02/18/literate-jenks.html and here https://gist.github.com/tmcw/4977508
/// </remarks>
internal class NaturalBreaks
{
#region Fields
int[,] _lowerClassLimits = null;
double[,] _varianceCombinations = null;
double[] _values = null;
int _numClasses;
int _numValues;
List<double> _resultClasses = null;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="NaturalBreaks"/> class.
/// </summary>
/// <param name="values">data values used for calculation.</param>
/// <param name="numClasses">Number of breaks that should be calculated.</param>
public NaturalBreaks (List<double> values, int numClasses)
{
_numClasses = numClasses;
_numValues = values.Count;
_values = values.ToArray();
// the number of classes must be greater than one and less than the number of data elements.
if (_numClasses > _values.Length) return;
if (_numClasses < 2) return;
// sort data in numerical order, since this is expected by the matrices function
Array.Sort(_values);
// get our basic matrices
GetMatrices();
// extract n_classes out of the computed matrices
GetBreaks();
}
#endregion
#region Methods
/// <summary>
/// Compute the matrices required for Jenks breaks. These matrices
/// can be used for any classing of data with `classes <= n_classes`
/// </summary>
private void GetMatrices()
{
// in the original implementation, these matrices are referred to as `LC` and `OP`
//
// * lower_class_limits (LC): optimal lower class limits
// * variance_combinations (OP): optimal variance combinations for all classes - declared at class level now
// loop counters
int i, j;
// the variance, as computed at each step in the calculation
double variance = 0;
// Initialize and fill each matrix with zeroes
_lowerClassLimits = new int[_values.Length +1, _numClasses+1];
_varianceCombinations = new double[_values.Length +1, _numClasses+1];
for (i = 1; i < _numClasses + 1; i++)
{
_lowerClassLimits[1, i] = 1;
_varianceCombinations[1, i] = 0;
// in the original implementation, 9999999 is used but
// since Javascript has `Infinity`, we use that.
for (j = 2; j < _values.Length + 1; j++)
{
_varianceCombinations[j, i] = double.PositiveInfinity;
}
}
for (var l = 2; l < _values.Length + 1; l++)
{
// `SZ` originally. this is the sum of the values seen thus far when calculating variance.
double sum = 0;
// `ZSQ` originally. the sum of squares of values seen thus far
double sum_squares = 0;
// `WT` originally. This is the number of
int w = 0;
// `IV` originally
int i4 = 0;
// in several instances, you could say `Math.pow(x, 2)` instead of `x * x`, but this is slower in some browsers introduces an unnecessary concept.
for (var m = 1; m < l + 1; m++)
{
// `III` originally
var lower_class_limit = l - m + 1;
var val = _values[lower_class_limit - 1];
// here we're estimating variance for each potential classing
// of the data, for each potential number of classes. `w`
// is the number of data points considered so far.
w++;
// increase the current sum and sum-of-squares
sum += val;
sum_squares += val * val;
// the variance at this point in the sequence is the difference
// between the sum of squares and the total x 2, over the number
// of samples.
variance = sum_squares - (sum * sum) / w;
i4 = lower_class_limit - 1;
if (i4 != 0)
{
for (j = 2; j < _numClasses + 1; j++)
{
// if adding this element to an existing class
// will increase its variance beyond the limit, break
// the class at this point, setting the lower_class_limit
// at this point.
if (_varianceCombinations[l, j] >=
(variance + _varianceCombinations[i4, j - 1]))
{
_lowerClassLimits[l, j] = lower_class_limit;
_varianceCombinations[l, j] = variance +
_varianceCombinations[i4, j - 1];
}
}
}
}
_lowerClassLimits[l, 1] = 1;
_varianceCombinations[l, 1] = variance;
}
}
/// <summary>
/// the second part of the jenks recipe: take the calculated matrices and derive an array of n breaks.
/// </summary>
private void GetBreaks()
{
int k = _values.Length - 1;
double [] kclass = new double[_numClasses+1];
int countNum = _numClasses;
// the calculation of classes will never include the upper and
// lower bounds, so we need to explicitly set them
kclass[_numClasses] = _values[_values.Length - 1];
kclass[0] = _values[0];
// the lower_class_limits matrix is used as indexes into itself
// here: the `k` variable is reused in each iteration.
while (countNum > 1)
{
kclass[countNum - 1] = _values[_lowerClassLimits[k, countNum] - 2];
k = _lowerClassLimits[k, countNum] - 1;
countNum--;
}
_resultClasses = kclass.ToList();
}
/// <summary>
/// Convert the _resultClasses which is a list of doubles into a list of integer IDs of the corresponding range values.
/// </summary>
/// <returns></returns>
public List<double> GetResults()
{
return(_resultClasses);
}
#endregion
}
}
| 40.052356 | 162 | 0.52719 | [
"MIT"
] | rhythmsosad/DotSpatial | Source/DotSpatial.Symbology/NaturalBreaks.cs | 7,652 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectPokemon.Pokedex.Models.PSMD
{
public class AbilityDetailsViewModel
{
public AbilityDetailsViewModel(Ability ability, PsmdDataCollection data)
{
ID = ability.ID;
Name = ability.Name;
var hex = ID.ToString("X").PadLeft(4, '0');
IDHexBigEndian = $"0x{hex}";
IDHexLittleEndian = $"{hex.Substring(2, 2)} {hex.Substring(0, 2)}";
PokemonWithAbility1 = new List<BasicPokemonListItem>();
PokemonWithAbility2 = new List<BasicPokemonListItem>();
PokemonWithAbilityHidden = new List<BasicPokemonListItem>();
foreach (var item in from p in data.Pokemon
where p.Ability1 == ID || p.Ability2 == ID || p.AbilityHidden == ID
select new { p.ID, p.Name, p.Ability1, p.Ability2, p.AbilityHidden }) {
var p = new BasicPokemonListItem(item.ID, item.Name);
if (item.Ability1 == ID)
{
PokemonWithAbility1.Add(p);
}
if (item.Ability2 == ID)
{
PokemonWithAbility2.Add(p);
}
if (item.AbilityHidden == ID)
{
PokemonWithAbilityHidden.Add(p);
}
}
}
public int ID { get; set; }
public string IDHexBigEndian { get; set; }
public string IDHexLittleEndian { get; set; }
public string Name { get; set; }
public List<BasicPokemonListItem> PokemonWithAbility1 { get; set; }
public List<BasicPokemonListItem> PokemonWithAbility2 { get; set; }
public List<BasicPokemonListItem> PokemonWithAbilityHidden { get; set; }
}
}
| 37.607843 | 104 | 0.554223 | [
"MIT"
] | evandixon/MysteryDungeon-RawDB | Project Pokemon Pokedex/Models/PSMD/AbilityDetailsViewModel.cs | 1,920 | C# |
using System;
using System.Collections;
using FluentSpecification.Abstractions.Validation;
using FluentSpecification.Common;
using FluentSpecification.Tests.Data;
using FluentSpecification.Tests.Sdk;
using Xunit;
namespace FluentSpecification.Tests.Common
{
public partial class MinLengthSpecificationTests
{
public class IsNotSatisfiedBy
{
[Theory]
[CorrectData(typeof(MinLengthData), AsNegation = true)]
public void ValidCandidate_ReturnTrue<T>(T candidate, int minLength)
where T : IEnumerable
{
candidate = candidate?.ToString() != "null" ? candidate : default;
var sut = new MinLengthSpecification<T>(minLength);
var result = sut.IsNotSatisfiedBy(candidate);
Assert.True(result);
}
[Theory]
[IncorrectData(typeof(MinLengthData), AsNegation = true)]
public void InvalidCandidate_ReturnFalse<T>(T candidate, int minLength)
where T : IEnumerable
{
var sut = new MinLengthSpecification<T>(minLength);
var result = sut.IsNotSatisfiedBy(candidate);
Assert.False(result);
}
[Fact]
public void NullCollectionLinqToEntities_Exception()
{
var sut = new MinLengthSpecification<int[]>(0, true);
var exception = Record.Exception(() => sut.IsNotSatisfiedBy(null));
Assert.NotNull(exception);
Assert.IsType<ArgumentNullException>(exception);
}
}
public class IsNotSatisfiedBySpecificationResult
{
[Theory]
[CorrectValidationData(typeof(MinLengthData), AsNegation = true)]
public void ValidCandidate_ReturnExpectedResultObject<T>(T candidate, int minLength,
SpecificationResult expected)
where T : IEnumerable
{
candidate = candidate?.ToString() != "null" ? candidate : default;
var sut = new MinLengthSpecification<T>(minLength);
var overall = sut.IsNotSatisfiedBy(candidate, out var result);
Assert.True(overall);
Assert.Equal(expected, result, new SpecificationResultComparer());
}
[Theory]
[IncorrectValidationData(typeof(MinLengthData), AsNegation = true)]
public void InvalidCandidate_ReturnExpectedResultObject<T>(T candidate, int minLength,
SpecificationResult expected)
where T : IEnumerable
{
var sut = new MinLengthSpecification<T>(minLength);
var overall = sut.IsNotSatisfiedBy(candidate, out var result);
Assert.False(overall);
Assert.Equal(expected, result, new SpecificationResultComparer());
}
[Fact]
public void NullCollectionLinqToEntities_Exception()
{
var sut = new MinLengthSpecification<int[]>(0, true);
var exception = Record.Exception(() => sut.IsNotSatisfiedBy(null));
Assert.NotNull(exception);
Assert.IsType<ArgumentNullException>(exception);
}
}
}
} | 36.11828 | 98 | 0.587675 | [
"Apache-2.0"
] | michalkowal/FluentSpecification | src/FluentSpecification.Tests/Common/MinLengthSpecificationTests.IsNotSatisfiedBy.cs | 3,361 | C# |
using System;
using ProtoBuf;
namespace MonoGameUtility {
[ProtoContract]
public struct XZPoint : IEquatable<XZPoint> {
#region Private Fields
private static XZPoint zeroPoint = new XZPoint();
#endregion Private Fields
#region Public Fields
[ProtoMember(1)]
public int X;
[ProtoMember(2)]
public int Z;
#endregion Public Fields
#region Properties
public static XZPoint Zero {
get { return zeroPoint; }
}
#endregion Properties
#region Constructors
public XZPoint(int x, int z) {
this.X = x;
this.Z = z;
}
#endregion Constructors
#region Public methods
public static bool operator ==(XZPoint a, XZPoint b) {
return a.Equals(b);
}
public static bool operator !=(XZPoint a, XZPoint b) {
return !a.Equals(b);
}
public bool Equals(XZPoint other) {
return ((X == other.X) && (Z == other.Z));
}
public override bool Equals(object obj) {
return (obj is XZPoint) ? Equals((XZPoint)obj) : false;
}
public override int GetHashCode() {
return X ^ Z;
}
public override string ToString() {
return string.Format("{{X:{0} Z:{1}}}", X, Z);
}
#endregion
#region overloads
public static XZPoint operator +(XZPoint value1, XZPoint value2) {
value1.X += value2.X;
value1.Z += value2.Z;
return value1;
}
public static XZPoint operator -(XZPoint value1, XZPoint value2) {
value1.X -= value2.X;
value1.Z -= value2.Z;
return value1;
}
#endregion
}
}
| 20.920455 | 74 | 0.522542 | [
"MPL-2.0"
] | bsamuels453/With-Fire-and-Iron | MonoGameUtility/XZPoint.cs | 1,843 | C# |
using dotnetredis.Models;
using dotnetredis.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
namespace dotnetredis.Controllers
{
[ApiController]
[Route("/api/users")]
public class UserController : Controller
{
private readonly UserService _userService;
public UserController(UserService service)
{
_userService = service;
}
[HttpPost]
[Route("create")]
public void Create(User user)
{
_userService.Create(user);
}
[HttpGet]
[Route("{id}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public IActionResult Get(long id)
{
try
{
return Ok(_userService.Read(id));
}
catch
{
return NoContent();
}
}
[HttpPost]
[Route("load")]
public void Load(User[] users)
{
foreach (var user in users)
{
Create(user);
}
}
}
} | 22.245283 | 61 | 0.513147 | [
"MIT"
] | dashaun/dotnetredis-wip | Controllers/UserController.cs | 1,179 | C# |
using System.ComponentModel.DataAnnotations;
namespace DevAdventCalendarCompetition.Repository.Models
{
public class ModelBase
{
[Key]
public int Id { get; set; }
}
} | 19.6 | 56 | 0.678571 | [
"MIT"
] | GKotfis/DevAdventCalendar | src/DevAdventCalendarCompetition/DevAdventCalendarCompetition.Repository/Models/ModelBase.cs | 198 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Entitas.CodeGeneration.Plugins.ComponentEntityApiGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class GameEntity {
public MonoBehaviourSubClassComponent monoBehaviourSubClass { get { return (MonoBehaviourSubClassComponent)GetComponent(GameComponentsLookup.MonoBehaviourSubClass); } }
public bool hasMonoBehaviourSubClass { get { return HasComponent(GameComponentsLookup.MonoBehaviourSubClass); } }
public void AddMonoBehaviourSubClass(MonoBehaviourSubClass newMonoBehaviour) {
var index = GameComponentsLookup.MonoBehaviourSubClass;
var component = CreateComponent<MonoBehaviourSubClassComponent>(index);
component.monoBehaviour = newMonoBehaviour;
AddComponent(index, component);
}
public void ReplaceMonoBehaviourSubClass(MonoBehaviourSubClass newMonoBehaviour) {
var index = GameComponentsLookup.MonoBehaviourSubClass;
var component = CreateComponent<MonoBehaviourSubClassComponent>(index);
component.monoBehaviour = newMonoBehaviour;
ReplaceComponent(index, component);
}
public void RemoveMonoBehaviourSubClass() {
RemoveComponent(GameComponentsLookup.MonoBehaviourSubClass);
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public sealed partial class GameMatcher {
static Entitas.IMatcher<GameEntity> _matcherMonoBehaviourSubClass;
public static Entitas.IMatcher<GameEntity> MonoBehaviourSubClass {
get {
if (_matcherMonoBehaviourSubClass == null) {
var matcher = (Entitas.Matcher<GameEntity>)Entitas.Matcher<GameEntity>.AllOf(GameComponentsLookup.MonoBehaviourSubClass);
matcher.componentNames = GameComponentsLookup.componentNames;
_matcherMonoBehaviourSubClass = matcher;
}
return _matcherMonoBehaviourSubClass;
}
}
}
| 44.649123 | 172 | 0.647544 | [
"MIT"
] | ValtoLibraries/Entitas | Tests/Unity/VisualDebugging/Assets/Sources/Generated/Game/Components/GameMonoBehaviourSubClassComponent.cs | 2,545 | C# |
using System.Threading.Tasks;
using AElf.Kernel.Blockchain.Application;
using AElf.Kernel.SmartContract.Infrastructure;
using Volo.Abp.DependencyInjection;
namespace AElf.Kernel.SmartContract.Application
{
//TODO: remove _executivePools, _contractHashs, change ISingletonDependency to ITransientDependency
public class SmartContractService : ISmartContractService, ISingletonDependency
{
private readonly ISmartContractRunnerContainer _smartContractRunnerContainer;
private readonly IFunctionMetadataService _functionMetadataService;
private readonly IBlockchainService _chainService;
private readonly ISmartContractAddressService _smartContractAddressService;
private readonly ISmartContractExecutiveService _smartContractExecutiveService;
public SmartContractService(
ISmartContractRunnerContainer smartContractRunnerContainer,
IFunctionMetadataService functionMetadataService, IBlockchainService chainService,
ISmartContractAddressService smartContractAddressService,
ISmartContractExecutiveService smartContractExecutiveService)
{
_smartContractRunnerContainer = smartContractRunnerContainer;
_functionMetadataService = functionMetadataService;
_chainService = chainService;
_smartContractAddressService = smartContractAddressService;
_smartContractExecutiveService = smartContractExecutiveService;
}
/// <inheritdoc/>
public async Task DeployContractAsync(Address contractAddress,
SmartContractRegistration registration, bool isPrivileged, Hash name)
{
// get runner
var runner = _smartContractRunnerContainer.GetRunner(registration.Category);
await Task.Run(() => runner.CodeCheck(registration.Code.ToByteArray(), isPrivileged));
if (name != null)
_smartContractAddressService.SetAddress(name, contractAddress);
//Todo New version metadata handle it
// var contractType = runner.GetContractType(registration);
// var contractTemplate = runner.ExtractMetadata(contractType);
// await _functionMetadataService.DeployContract(contractAddress, contractTemplate);
}
public async Task UpdateContractAsync(Address contractAddress,
SmartContractRegistration newRegistration, bool isPrivileged, Hash name)
{
// get runner
var runner = _smartContractRunnerContainer.GetRunner(newRegistration.Category);
await Task.Run(() => runner.CodeCheck(newRegistration.Code.ToByteArray(), isPrivileged));
_smartContractExecutiveService.ClearExecutivePool(contractAddress);
//Todo New version metadata handle it
// var oldRegistration = await GetContractByAddressAsync(contractAddress);
// var oldContractType = runner.GetContractType(oldRegistration);
// var oldContractTemplate = runner.ExtractMetadata(oldContractType);
//
// var newContractType = runner.GetContractType(newRegistration);
// var newContractTemplate = runner.ExtractMetadata(newContractType);
// await _functionMetadataService.UpdateContract(contractAddress, newContractTemplate,
// oldContractTemplate);
}
}
} | 49.144928 | 103 | 0.726924 | [
"MIT"
] | quangdo3112/AElf | src/AElf.Kernel.SmartContract/Application/SmartContractService.cs | 3,393 | C# |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Orleans.CodeGeneration;
using Orleans.Runtime;
using Orleans.Serialization;
namespace Orleans
{
internal class InvokableObjectManager : IDisposable
{
private readonly CancellationTokenSource disposed = new CancellationTokenSource();
private readonly ConcurrentDictionary<GuidId, LocalObjectData> localObjects = new ConcurrentDictionary<GuidId, LocalObjectData>();
private readonly IRuntimeClient runtimeClient;
private readonly ILogger logger;
private readonly SerializationManager serializationManager;
private readonly MessagingTrace messagingTrace;
private readonly Func<object, Task> dispatchFunc;
public InvokableObjectManager(
IRuntimeClient runtimeClient,
SerializationManager serializationManager,
MessagingTrace messagingTrace,
ILogger<InvokableObjectManager> logger)
{
this.runtimeClient = runtimeClient;
this.serializationManager = serializationManager;
this.messagingTrace = messagingTrace;
this.logger = logger;
this.dispatchFunc = o =>
this.LocalObjectMessagePumpAsync((LocalObjectData) o);
}
public bool TryRegister(IAddressable obj, GuidId objectId, IGrainMethodInvoker invoker)
{
return this.localObjects.TryAdd(objectId, new LocalObjectData(obj, objectId, invoker));
}
public bool TryDeregister(GuidId objectId)
{
return this.localObjects.TryRemove(objectId, out LocalObjectData ignored);
}
public void Dispatch(Message message)
{
GuidId observerId = message.TargetObserverId;
if (observerId == null)
{
this.logger.Error(
ErrorCode.ProxyClient_OGC_TargetNotFound_2,
string.Format("Did not find TargetObserverId header in the message = {0}. A request message to a client is expected to have an observerId.", message));
return;
}
if (this.localObjects.TryGetValue(observerId, out var objectData))
{
this.Invoke(objectData, message);
}
else
{
this.logger.Error(
ErrorCode.ProxyClient_OGC_TargetNotFound,
String.Format(
"Unexpected target grain in request: {0}. Message={1}",
message.TargetGrain,
message));
}
}
private void Invoke(LocalObjectData objectData, Message message)
{
var obj = (IAddressable)objectData.LocalObject.Target;
if (obj == null)
{
//// Remove from the dictionary record for the garbage collected object? But now we won't be able to detect invalid dispatch IDs anymore.
this.logger.Warn(
ErrorCode.Runtime_Error_100162,
string.Format(
"Object associated with Observer ID {0} has been garbage collected. Deleting object reference and unregistering it. Message = {1}",
objectData.ObserverId,
message));
// Try to remove. If it's not there, we don't care.
this.TryDeregister(objectData.ObserverId);
return;
}
bool start;
lock (objectData.Messages)
{
objectData.Messages.Enqueue(message);
start = !objectData.Running;
objectData.Running = true;
}
if (this.logger.IsEnabled(LogLevel.Trace)) this.logger.Trace($"InvokeLocalObjectAsync {message} start {start}");
if (start)
{
// we want to ensure that the message pump operates asynchronously
// with respect to the current thread. see
// http://channel9.msdn.com/Events/TechEd/Europe/2013/DEV-B317#fbid=aIWUq0ssW74
// at position 54:45.
//
// according to the information posted at:
// http://stackoverflow.com/questions/12245935/is-task-factory-startnew-guaranteed-to-use-another-thread-than-the-calling-thr
// this idiom is dependent upon the a TaskScheduler not implementing the
// override QueueTask as task inlining (as opposed to queueing). this seems
// implausible to the author, since none of the .NET schedulers do this and
// it is considered bad form (the OrleansTaskScheduler does not do this).
//
// if, for some reason this doesn't hold true, we can guarantee what we
// want by passing a placeholder continuation token into Task.StartNew()
// instead. i.e.:
//
// return Task.StartNew(() => ..., new CancellationToken());
// We pass these options to Task.Factory.StartNew as they make the call identical
// to Task.Run. See: https://blogs.msdn.microsoft.com/pfxteam/2011/10/24/task-run-vs-task-factory-startnew/
Task.Factory.StartNew(
this.dispatchFunc,
objectData,
CancellationToken.None,
TaskCreationOptions.DenyChildAttach,
TaskScheduler.Default).Ignore();
}
}
private async Task LocalObjectMessagePumpAsync(LocalObjectData objectData)
{
while (true)
{
try
{
Message message;
lock (objectData.Messages)
{
if (objectData.Messages.Count == 0)
{
objectData.Running = false;
break;
}
message = objectData.Messages.Dequeue();
}
if (message.IsExpired)
{
this.messagingTrace.OnDropExpiredMessage(message, MessagingStatisticsGroup.Phase.Invoke);
continue;
}
RequestContextExtensions.Import(message.RequestContextData);
InvokeMethodRequest request = null;
try
{
request = (InvokeMethodRequest) message.BodyObject;
}
catch (Exception deserializationException)
{
if (this.logger.IsEnabled(LogLevel.Warning))
{
this.logger.LogWarning(
"Exception during message body deserialization in " + nameof(LocalObjectMessagePumpAsync) + " for message: {Message}, Exception: {Exception}",
message,
deserializationException);
}
this.runtimeClient.SendResponse(message, Response.ExceptionResponse(deserializationException));
continue;
}
var targetOb = (IAddressable)objectData.LocalObject.Target;
object resultObject = null;
Exception caught = null;
try
{
// exceptions thrown within this scope are not considered to be thrown from user code
// and not from runtime code.
var resultPromise = objectData.Invoker.Invoke(targetOb, request);
if (resultPromise != null) // it will be null for one way messages
{
resultObject = await resultPromise;
}
}
catch (Exception exc)
{
// the exception needs to be reported in the log or propagated back to the caller.
caught = exc;
}
if (caught != null)
this.ReportException(message, caught);
else if (message.Direction != Message.Directions.OneWay)
this.SendResponseAsync(message, resultObject);
}
catch (Exception outerException)
{
// ignore, keep looping.
this.logger.LogWarning("Exception in " + nameof(LocalObjectMessagePumpAsync) + ": {Exception}", outerException);
}
finally
{
RequestContext.Clear();
}
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
private void SendResponseAsync(Message message, object resultObject)
{
if (message.IsExpired)
{
this.messagingTrace.OnDropExpiredMessage(message, MessagingStatisticsGroup.Phase.Respond);
return;
}
object deepCopy;
try
{
// we're expected to notify the caller if the deep copy failed.
deepCopy = this.serializationManager.DeepCopy(resultObject);
}
catch (Exception exc2)
{
this.runtimeClient.SendResponse(message, Response.ExceptionResponse(exc2));
this.logger.Warn(
ErrorCode.ProxyClient_OGC_SendResponseFailed,
"Exception trying to send a response.",
exc2);
return;
}
// the deep-copy succeeded.
this.runtimeClient.SendResponse(message, new Response(deepCopy));
return;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
private void ReportException(Message message, Exception exception)
{
var request = (InvokeMethodRequest)message.BodyObject;
switch (message.Direction)
{
case Message.Directions.OneWay:
{
this.logger.Error(
ErrorCode.ProxyClient_OGC_UnhandledExceptionInOneWayInvoke,
String.Format(
"Exception during invocation of notification method {0}, interface {1}. Ignoring exception because this is a one way request.",
request.MethodId,
request.InterfaceId),
exception);
break;
}
case Message.Directions.Request:
{
Exception deepCopy = null;
try
{
// we're expected to notify the caller if the deep copy failed.
deepCopy = (Exception)this.serializationManager.DeepCopy(exception);
}
catch (Exception ex2)
{
this.runtimeClient.SendResponse(message, Response.ExceptionResponse(ex2));
this.logger.Warn(
ErrorCode.ProxyClient_OGC_SendExceptionResponseFailed,
"Exception trying to send an exception response", ex2);
return;
}
// the deep-copy succeeded.
var response = Response.ExceptionResponse(deepCopy);
this.runtimeClient.SendResponse(message, response);
break;
}
default:
throw new InvalidOperationException($"Unrecognized direction for message {message}, request {request}, which resulted in exception: {exception}");
}
}
public class LocalObjectData
{
internal WeakReference LocalObject { get; }
internal IGrainMethodInvoker Invoker { get; }
internal GuidId ObserverId { get; }
internal Queue<Message> Messages { get; }
internal bool Running { get; set; }
internal LocalObjectData(IAddressable obj, GuidId observerId, IGrainMethodInvoker invoker)
{
this.LocalObject = new WeakReference(obj);
this.ObserverId = observerId;
this.Invoker = invoker;
this.Messages = new Queue<Message>();
this.Running = false;
}
}
public void Dispose()
{
var tokenSource = this.disposed;
Utils.SafeExecute(() => tokenSource?.Cancel(false));
Utils.SafeExecute(() => tokenSource?.Dispose());
}
}
} | 42.646497 | 174 | 0.52946 | [
"MIT"
] | AmirSasson/orleans | src/Orleans.Core/Runtime/InvokableObjectManager.cs | 13,391 | C# |
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.CognitiveServices.Search.WebSearch.Models
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime;
using System.Runtime.Serialization;
/// <summary>
/// Defines values for SafeSearch.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum SafeSearch
{
[EnumMember(Value = "Off")]
Off,
[EnumMember(Value = "Moderate")]
Moderate,
[EnumMember(Value = "Strict")]
Strict
}
internal static class SafeSearchEnumExtension
{
internal static string ToSerializedValue(this SafeSearch? value)
{
return value == null ? null : ((SafeSearch)value).ToSerializedValue();
}
internal static string ToSerializedValue(this SafeSearch value)
{
switch( value )
{
case SafeSearch.Off:
return "Off";
case SafeSearch.Moderate:
return "Moderate";
case SafeSearch.Strict:
return "Strict";
}
return null;
}
internal static SafeSearch? ParseSafeSearch(this string value)
{
switch( value )
{
case "Off":
return SafeSearch.Off;
case "Moderate":
return SafeSearch.Moderate;
case "Strict":
return SafeSearch.Strict;
}
return null;
}
}
}
| 27.984127 | 82 | 0.546228 | [
"MIT"
] | thangnguyen2001/azure-sdk-for-net | src/SDKs/CognitiveServices/dataPlane/Search/Search/Generated/WebSearch/Models/SafeSearch.cs | 1,763 | 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.
*/
using System;
using System.Collections.Generic;
using Aliyun.Acs.Core.Transform;
using Aliyun.Acs.HBase.Model.V20190101;
namespace Aliyun.Acs.HBase.Transform.V20190101
{
public class ListTagsResponseUnmarshaller
{
public static ListTagsResponse Unmarshall(UnmarshallerContext _ctx)
{
ListTagsResponse listTagsResponse = new ListTagsResponse();
listTagsResponse.HttpResponse = _ctx.HttpResponse;
listTagsResponse.RequestId = _ctx.StringValue("ListTags.RequestId");
List<ListTagsResponse.ListTags_Tag> listTagsResponse_tags = new List<ListTagsResponse.ListTags_Tag>();
for (int i = 0; i < _ctx.Length("ListTags.Tags.Length"); i++) {
ListTagsResponse.ListTags_Tag tag = new ListTagsResponse.ListTags_Tag();
tag.TagKey = _ctx.StringValue("ListTags.Tags["+ i +"].TagKey");
tag.TagValue = _ctx.StringValue("ListTags.Tags["+ i +"].TagValue");
listTagsResponse_tags.Add(tag);
}
listTagsResponse.Tags = listTagsResponse_tags;
return listTagsResponse;
}
}
}
| 37.24 | 106 | 0.734694 | [
"Apache-2.0"
] | AxiosCros/aliyun-openapi-net-sdk | aliyun-net-sdk-hbase/HBase/Transform/V20190101/ListTagsResponseUnmarshaller.cs | 1,862 | C# |
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using WixBinding;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.DialogXmlGeneration
{
[TestFixture]
public class ListViewPropertyWithSpecialXmlCharsTestFixture : DialogLoadingTestFixtureBase
{
[Test]
public void UpdateDialogElement()
{
WixDocument doc = new WixDocument();
doc.LoadXml(GetWixXml());
CreatedComponents.Clear();
WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());
using (Form dialog = wixDialog.CreateDialog(this)) {
XmlElement dialogElement = wixDialog.UpdateDialogElement(dialog);
}
}
string GetWixXml()
{
return "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" +
"\t<Fragment>\r\n" +
"\t\t<UI>\r\n" +
"\t\t\t<Dialog Id='WelcomeDialog' Height='270' Width='370'>\r\n" +
"\t\t\t\t<Control Id='ListView1' Type='ListView' X='20' Y='187' Width='330' Height='40' Property=\"ListView'Property\"/>\r\n" +
"\t\t\t</Dialog>\r\n" +
"\t\t\t<ListView Property=\"ListView'Property\">\r\n" +
"\t\t\t</ListView>\r\n" +
"\t\t</UI>\r\n" +
"\t</Fragment>\r\n" +
"</Wix>";
}
}
}
| 31.478261 | 131 | 0.687155 | [
"MIT"
] | Plankankul/SharpDevelop-w-Framework | src/AddIns/BackendBindings/WixBinding/Test/DialogXmlGeneration/ListViewPropertyWithSpecialXmlCharsTestFixture.cs | 1,450 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Authentication;
/// <summary>
/// Contains the options used by the <see cref="AuthenticationHandler{T}"/>.
/// </summary>
public class AuthenticationSchemeOptions
{
/// <summary>
/// Check that the options are valid. Should throw an exception if things are not ok.
/// </summary>
public virtual void Validate() { }
/// <summary>
/// Checks that the options are valid for a specific scheme
/// </summary>
/// <param name="scheme">The scheme being validated.</param>
public virtual void Validate(string scheme)
=> Validate();
/// <summary>
/// Gets or sets the issuer that should be used for any claims that are created
/// </summary>
public string? ClaimsIssuer { get; set; }
/// <summary>
/// Instance used for events
/// </summary>
public object? Events { get; set; }
/// <summary>
/// If set, will be used as the service type to get the Events instance instead of the property.
/// </summary>
public Type? EventsType { get; set; }
/// <summary>
/// If set, this specifies a default scheme that authentication handlers should forward all authentication operations to
/// by default. The default forwarding logic will check the most specific ForwardAuthenticate/Challenge/Forbid/SignIn/SignOut
/// setting first, followed by checking the ForwardDefaultSelector, followed by ForwardDefault. The first non null result
/// will be used as the target scheme to forward to.
/// </summary>
public string? ForwardDefault { get; set; }
/// <summary>
/// If set, this specifies the target scheme that this scheme should forward AuthenticateAsync calls to.
/// For example Context.AuthenticateAsync("ThisScheme") => Context.AuthenticateAsync("ForwardAuthenticateValue");
/// Set the target to the current scheme to disable forwarding and allow normal processing.
/// </summary>
public string? ForwardAuthenticate { get; set; }
/// <summary>
/// If set, this specifies the target scheme that this scheme should forward ChallengeAsync calls to.
/// For example Context.ChallengeAsync("ThisScheme") => Context.ChallengeAsync("ForwardChallengeValue");
/// Set the target to the current scheme to disable forwarding and allow normal processing.
/// </summary>
public string? ForwardChallenge { get; set; }
/// <summary>
/// If set, this specifies the target scheme that this scheme should forward ForbidAsync calls to.
/// For example Context.ForbidAsync("ThisScheme") => Context.ForbidAsync("ForwardForbidValue");
/// Set the target to the current scheme to disable forwarding and allow normal processing.
/// </summary>
public string? ForwardForbid { get; set; }
/// <summary>
/// If set, this specifies the target scheme that this scheme should forward SignInAsync calls to.
/// For example Context.SignInAsync("ThisScheme") => Context.SignInAsync("ForwardSignInValue");
/// Set the target to the current scheme to disable forwarding and allow normal processing.
/// </summary>
public string? ForwardSignIn { get; set; }
/// <summary>
/// If set, this specifies the target scheme that this scheme should forward SignOutAsync calls to.
/// For example Context.SignOutAsync("ThisScheme") => Context.SignOutAsync("ForwardSignOutValue");
/// Set the target to the current scheme to disable forwarding and allow normal processing.
/// </summary>
public string? ForwardSignOut { get; set; }
/// <summary>
/// Used to select a default scheme for the current request that authentication handlers should forward all authentication operations to
/// by default. The default forwarding logic will check the most specific ForwardAuthenticate/Challenge/Forbid/SignIn/SignOut
/// setting first, followed by checking the ForwardDefaultSelector, followed by ForwardDefault. The first non null result
/// will be used as the target scheme to forward to.
/// </summary>
public Func<HttpContext, string?>? ForwardDefaultSelector { get; set; }
}
| 46.365591 | 140 | 0.704545 | [
"MIT"
] | AndrewTriesToCode/aspnetcore | src/Security/Authentication/Core/src/AuthenticationSchemeOptions.cs | 4,312 | C# |
// Copyright (c) Russlan Akiev. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace ServiceBase.Plugins
{
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
/// <summary>
/// Contains <see cref="IApplicationBuilder"/> extenion methods.
/// </summary>
public static partial class ApplicationBuilderExtensions
{
/// <summary>
/// Adds MVC to the <see cref="IApplicationBuilder"/> request
/// execution pipeline, configured to work with plugin architecture.
/// </summary>
/// <param name="app">Instance of <see cref="IApplicationBuilder"/>.</param>
/// <param name="logger">Instance of <see cref="ILogger"/>.</param>
public static void UsePluginsMvc(
this IApplicationBuilder app,
ILogger logger = null)
{
app.UseMvc(routeBuilder =>
{
routeBuilder.ConfigurePlugins(logger);
});
}
/// <summary>
/// Enables static file serving with plugin architecture.
/// </summary>
/// <param name="app">
/// Instance of <see cref="IApplicationBuilder"/>.
/// </param>
/// <param name="basePath">
/// Base path to plugins folder.
/// </param>
public static void UsePluginsStaticFiles(
this IApplicationBuilder app,
string basePath)
{
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PluginsFileProvider(basePath)
});
}
}
}
| 34.215686 | 108 | 0.561605 | [
"Apache-2.0"
] | aruss/ServiceBase | src/ServiceBase.Mvc/Plugins/ApplicationBuilderExtensions.cs | 1,747 | C# |
//
// TorrentTest.cs
//
// Authors:
// Alan McGovern alan.mcgovern@gmail.com
//
// Copyright (C) 2006 Alan McGovern
//
// 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.IO;
using MonoTorrent.BEncoding;
using MonoTorrent.Client;
using NUnit.Framework;
namespace MonoTorrent.Common
{
[TestFixture]
public class TorrentTest
{
BEncodedDictionary torrentInfo;
private Torrent torrent;
private long creationTime;
readonly System.Security.Cryptography.SHA1 sha = System.Security.Cryptography.SHA1.Create ();
/// <summary>
///
/// </summary>
[SetUp]
public void StartUp ()
{
DateTime current = new DateTime (2006, 7, 1, 5, 5, 5);
DateTime epochStart = new DateTime (1970, 1, 1, 0, 0, 0);
TimeSpan span = current - epochStart;
creationTime = (long) span.TotalSeconds;
Console.WriteLine ($"{creationTime}Creation seconds");
torrentInfo = new BEncodedDictionary {
{ "announce", new BEncodedString ("http://myannouceurl/announce") },
{ "creation date", new BEncodedNumber (creationTime) },
{ "nodes", new BEncodedList () }, //FIXME: What is this?
{ "comment.utf-8", new BEncodedString ("my big long comment") },
{ "comment", new BEncodedString ("my big long comment") },
{ "azureus_properties", new BEncodedDictionary () }, //FIXME: What is this?
{ "created by", new BEncodedString ($"MonoTorrent/{VersionInfo.ClientVersion}") },
{ "encoding", new BEncodedString ("UTF-8") },
{ "info", CreateInfoDict () },
{ "private", new BEncodedString ("1") }
};
torrent = Torrent.Load (torrentInfo);
}
private BEncodedDictionary CreateInfoDict ()
{
BEncodedDictionary dict = new BEncodedDictionary {
{ "source", new BEncodedString ("http://www.thisiswhohostedit.com") },
{ "sha1", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("this is a sha1 hash string"))) },
{ "ed2k", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("ed2k isn't a sha, but who cares"))) },
{ "publisher-url.utf-8", new BEncodedString ("http://www.iamthepublisher.com") },
{ "publisher-url", new BEncodedString ("http://www.iamthepublisher.com") },
{ "publisher.utf-8", new BEncodedString ("MonoTorrent Inc.") },
{ "publisher", new BEncodedString ("MonoTorrent Inc.") },
{ "files", CreateFiles () },
{ "name.utf-8", new BEncodedString ("MyBaseFolder") },
{ "name", new BEncodedString ("MyBaseFolder") },
{ "piece length", new BEncodedNumber (512) },
{ "private", new BEncodedString ("1") },
{ "pieces", new BEncodedString (new byte [((26000 + 512) / 512) * 20]) } // Total size is 26000, piecelength is 512
};
return dict;
}
private BEncodedList CreateFiles ()
{
BEncodedList files = new BEncodedList ();
BEncodedList path = new BEncodedList {
new BEncodedString ("file1.txt")
};
BEncodedDictionary file = new BEncodedDictionary {
{ "sha1", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash1"))) },
{ "ed2k", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash2"))) },
{ "length", new BEncodedNumber (50000) },
{ "md5sum", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash3"))) },
{ "path.utf-8", path },
{ "path", path }
};
files.Add (file);
path = new BEncodedList {
new BEncodedString ("subfolder1"),
new BEncodedString ("file2.txt")
};
file = new BEncodedDictionary {
{ "sha1", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash1"))) },
{ "ed2k", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash2"))) },
{ "length", new BEncodedNumber (60000) },
{ "md5sum", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash3"))) },
{ "path.utf-8", path },
{ "path", path }
};
files.Add (file);
path = new BEncodedList {
new BEncodedString ("subfolder1"),
new BEncodedString ("subfolder2"),
new BEncodedString ("file3.txt")
};
file = new BEncodedDictionary {
{ "sha1", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash1"))) },
{ "ed2k", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash2"))) },
{ "length", new BEncodedNumber (70000) },
{ "md5sum", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash3"))) },
{ "path.utf-8", path },
{ "path", path }
};
files.Add (file);
path = new BEncodedList {
new BEncodedString ("subfolder1"),
new BEncodedString ("subfolder2"),
new BEncodedString ("file4.txt")
};
file = new BEncodedDictionary {
{ "sha1", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash1"))) },
{ "ed2k", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash2"))) },
{ "length", new BEncodedNumber (80000) },
{ "md5sum", new BEncodedString (sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("file1 hash3"))) },
{ "path.utf-8", path },
{ "path", path }
};
files.Add (file);
return files;
}
/// <summary>
///
/// </summary>
[Test]
public void AnnounceUrl ()
{
Assert.IsTrue (torrent.AnnounceUrls.Count == 1);
Assert.IsTrue (torrent.AnnounceUrls[0].Count == 1);
Assert.IsTrue (torrent.AnnounceUrls[0][0] == "http://myannouceurl/announce");
}
/// <summary>
///
/// </summary>
[Test]
public void CreationDate ()
{
Assert.AreEqual (2006, torrent.CreationDate.Year, "Year wrong");
Assert.AreEqual (7, torrent.CreationDate.Month, "Month Wrong");
Assert.AreEqual (1, torrent.CreationDate.Day, "Day Wrong");
Assert.AreEqual (5, torrent.CreationDate.Hour, "Hour Wrong");
Assert.AreEqual (5, torrent.CreationDate.Minute, "Minute Wrong");
Assert.AreEqual (5, torrent.CreationDate.Second, "Second Wrong");
Assert.AreEqual (new DateTime (2006, 7, 1, 5, 5, 5), torrent.CreationDate);
}
/// <summary>
///
/// </summary>
[Test]
public void Comment ()
{
Assert.AreEqual (torrent.Comment, "my big long comment");
}
/// <summary>
///
/// </summary>
[Test]
public void CreatedBy ()
{
Assert.AreEqual (torrent.CreatedBy, $"MonoTorrent/{VersionInfo.ClientVersion}");
}
[Test]
public void NodesIsNotAList ()
{
torrentInfo["nodes"] = new BEncodedString ("192.168.0.1:12345");
torrent = Torrent.Load (torrentInfo);
Assert.IsNull (torrent.Nodes, "#1");
}
/// <summary>
///
/// </summary>
[Test]
public void ED2K ()
{
Assert.IsTrue (Toolbox.ByteMatch (torrent.ED2K, sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("ed2k isn't a sha, but who cares"))));
}
/// <summary>
///
/// </summary>
[Test]
public void Encoding ()
{
Assert.IsTrue (torrent.Encoding == "UTF-8");
}
/// <summary>
///
/// </summary>
[Test]
public void Files ()
{
Assert.AreEqual (4, torrent.Files.Count);
Assert.AreEqual ("file1.txt", torrent.Files[0].Path);
Assert.AreEqual (50000, torrent.Files[0].Length);
Assert.AreEqual (Path.Combine ("subfolder1", "file2.txt"), torrent.Files[1].Path);
Assert.AreEqual (60000, torrent.Files[1].Length);
Assert.AreEqual (Path.Combine (Path.Combine ("subfolder1", "subfolder2"), "file3.txt"), torrent.Files[2].Path);
Assert.AreEqual (70000, torrent.Files[2].Length);
Assert.AreEqual (Path.Combine (Path.Combine ("subfolder1", "subfolder2"), "file4.txt"), torrent.Files[3].Path);
Assert.AreEqual (80000, torrent.Files[3].Length);
}
[Test]
public void InvalidPath ()
{
var files = ((BEncodedDictionary) torrentInfo["info"])["files"] as BEncodedList;
var newFile = new BEncodedDictionary ();
var path = new BEncodedList (new BEncodedString[] { "test", "..", "bar" });
newFile["path"] = path;
newFile["length"] = (BEncodedNumber) 15251;
files.Add (newFile);
Assert.Throws<ArgumentException> (() => Torrent.Load (torrentInfo));
}
/// <summary>
///
/// </summary>
[Test]
public void Name ()
{
Assert.IsTrue (torrent.Name == "MyBaseFolder");
}
/// <summary>
///
/// </summary>
[Test]
public void Private ()
{
Assert.AreEqual (true, torrent.IsPrivate);
}
/// <summary>
///
/// </summary>
[Test]
public void PublisherUrl ()
{
Assert.AreEqual ("http://www.iamthepublisher.com", torrent.PublisherUrl);
}
/// <summary>
///
/// </summary>
[Test]
public void PieceLength ()
{
Assert.IsTrue (torrent.PieceLength == 512);
}
/// <summary>
///
/// </summary>
[Test]
public void Publisher ()
{
Assert.IsTrue (torrent.Publisher == "MonoTorrent Inc.");
}
/// <summary>
///
/// </summary>
[Test]
public void Size ()
{
Assert.AreEqual ((50000 + 60000 + 70000 + 80000), torrent.Size);
}
[Test]
public void StartEndIndices ()
{
int pieceLength = 32 * 32;
TorrentFile[] files = TorrentFile.Create (pieceLength,
("File0", 0),
("File1", pieceLength),
("File2", 0),
("File3", pieceLength - 1),
("File4", 1),
("File5", 236),
("File6", pieceLength * 7)
);
Torrent t = TestRig.CreateMultiFileTorrent (files, pieceLength);
Assert.AreEqual (0, t.Files[0].StartPieceIndex, "#0a");
Assert.AreEqual (0, t.Files[0].EndPieceIndex, "#0b");
Assert.AreEqual (0, t.Files[1].StartPieceIndex, "#1");
Assert.AreEqual (0, t.Files[1].EndPieceIndex, "#2");
Assert.AreEqual (0, t.Files[2].StartPieceIndex, "#3");
Assert.AreEqual (0, t.Files[2].EndPieceIndex, "#4");
Assert.AreEqual (1, t.Files[3].StartPieceIndex, "#5");
Assert.AreEqual (1, t.Files[3].EndPieceIndex, "#6");
Assert.AreEqual (1, t.Files[4].StartPieceIndex, "#7");
Assert.AreEqual (1, t.Files[4].EndPieceIndex, "#8");
Assert.AreEqual (2, t.Files[5].StartPieceIndex, "#9");
Assert.AreEqual (2, t.Files[5].EndPieceIndex, "#10");
Assert.AreEqual (2, t.Files[6].StartPieceIndex, "#11");
Assert.AreEqual (9, t.Files[6].EndPieceIndex, "#12");
}
[Test]
public void StartEndIndices2 ()
{
int pieceLength = 32 * 32;
TorrentFile[] files = TorrentFile.Create (pieceLength,
("File0", pieceLength),
("File1", 0)
);
Torrent t = TestRig.CreateMultiFileTorrent (files, pieceLength);
Assert.AreEqual (0, t.Files[0].StartPieceIndex, "#1");
Assert.AreEqual (0, t.Files[0].EndPieceIndex, "#2");
Assert.AreEqual (0, t.Files[1].StartPieceIndex, "#3");
Assert.AreEqual (0, t.Files[1].EndPieceIndex, "#4");
}
[Test]
public void StartEndIndices3 ()
{
int pieceLength = 32 * 32;
TorrentFile[] files = TorrentFile.Create (pieceLength,
("File0", pieceLength - 10),
("File1", 10)
);
Torrent t = TestRig.CreateMultiFileTorrent (files, pieceLength);
Assert.AreEqual (0, t.Files[0].StartPieceIndex, "#1");
Assert.AreEqual (0, t.Files[0].EndPieceIndex, "#2");
Assert.AreEqual (0, t.Files[1].StartPieceIndex, "#3");
Assert.AreEqual (0, t.Files[1].EndPieceIndex, "#4");
}
[Test]
public void StartEndIndices4 ()
{
int pieceLength = 32 * 32;
TorrentFile[] files = TorrentFile.Create (pieceLength,
("File0", pieceLength- 10),
("File1", 11)
);
Torrent t = TestRig.CreateMultiFileTorrent (files, pieceLength);
Assert.AreEqual (0, t.Files[0].StartPieceIndex, "#1");
Assert.AreEqual (0, t.Files[0].EndPieceIndex, "#2");
Assert.AreEqual (0, t.Files[1].StartPieceIndex, "#3");
Assert.AreEqual (1, t.Files[1].EndPieceIndex, "#4");
}
[Test]
public void StartEndIndices5 ()
{
int pieceLength = 32 * 32;
TorrentFile[] files = TorrentFile.Create (pieceLength,
("File0", pieceLength - 10),
("File1", 10),
("File1", 1)
);
Torrent t = TestRig.CreateMultiFileTorrent (files, pieceLength);
Assert.AreEqual (0, t.Files[0].StartPieceIndex, "#1");
Assert.AreEqual (0, t.Files[0].EndPieceIndex, "#2");
Assert.AreEqual (0, t.Files[1].StartPieceIndex, "#3");
Assert.AreEqual (0, t.Files[1].EndPieceIndex, "#4");
Assert.AreEqual (1, t.Files[2].StartPieceIndex, "#5");
Assert.AreEqual (1, t.Files[2].EndPieceIndex, "#6");
}
/// <summary>
///
/// </summary>
[Test]
public void Source ()
{
Assert.IsTrue (torrent.Source == "http://www.thisiswhohostedit.com");
}
/// <summary>
///
/// </summary>
[Test]
public void SHA1 ()
{
Assert.IsTrue (Toolbox.ByteMatch (torrent.SHA1, sha.ComputeHash (System.Text.Encoding.UTF8.GetBytes ("this is a sha1 hash string"))));
}
}
} | 36.54185 | 151 | 0.534358 | [
"MIT"
] | SICGames/monotorrent | src/MonoTorrent.Tests/Common/TorrentTest.cs | 16,590 | C# |
//===============================================================================
// Microsoft patterns & practices
// Composite Application Guidance for Windows Presentation Foundation
//===============================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious. No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System;
using System.Collections.ObjectModel;
using System.Windows.Input;
using Microsoft.Practices.Composite.Wpf.Commands;
using StockTraderRI.Modules.Watch.Services;
namespace StockTraderRI.Modules.WatchList.Tests.Mocks
{
class MockWatchListService : IWatchListService
{
internal ObservableCollection<string> MockWatchList = new ObservableCollection<string>();
#region IWatchListService Members
public ObservableCollection<string> RetrieveWatchList()
{
return MockWatchList;
}
private DelegateCommand<string> _testDelegate = new DelegateCommand<string>(delegate { });
public ICommand AddWatchCommand
{
get
{
return _testDelegate;
}
set
{
throw new NotImplementedException();
}
}
#endregion
}
}
| 36.867925 | 98 | 0.578301 | [
"Apache-2.0"
] | andrewdbond/CompositeWPF | sourceCode/compositewpf/V1/trunk/Source/StockTraderRI/StockTraderRI.Modules.WatchList.Tests/Mocks/MockWatchListService.cs | 1,954 | C# |
//
// Copyright (c) Microsoft and contributors. 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.
// 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.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using Hyak.Common;
using Hyak.Common.Internals;
using Microsoft.Azure;
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Management.Resources.Models;
using Newtonsoft.Json.Linq;
namespace Microsoft.Azure.Management.Resources
{
/// <summary>
/// Operations for managing deployments.
/// </summary>
internal partial class DeploymentOperations : IServiceOperations<ResourceManagementClient>, IDeploymentOperations
{
/// <summary>
/// Initializes a new instance of the DeploymentOperations class.
/// </summary>
/// <param name='client'>
/// Reference to the service client.
/// </param>
internal DeploymentOperations(ResourceManagementClient client)
{
this._client = client;
}
private ResourceManagementClient _client;
/// <summary>
/// Gets a reference to the
/// Microsoft.Azure.Management.Resources.ResourceManagementClient.
/// </summary>
public ResourceManagementClient Client
{
get { return this._client; }
}
/// <summary>
/// Begin deleting deployment.To determine whether the operation has
/// finished processing the request, call
/// GetLongRunningOperationStatus.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment to be deleted.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard service response for long running operations.
/// </returns>
public async Task<LongRunningOperationResponse> BeginDeletingAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
if (resourceGroupName != null && resourceGroupName.Length > 1000)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (deploymentName == null)
{
throw new ArgumentNullException("deploymentName");
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
TracingAdapter.Enter(invocationId, this, "BeginDeletingAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "/subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/resourcegroups/";
url = url + Uri.EscapeDataString(resourceGroupName);
url = url + "/deployments/";
url = url + Uri.EscapeDataString(deploymentName);
List<string> queryParameters = new List<string>();
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Delete;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.Accepted && statusCode != HttpStatusCode.NoContent)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
LongRunningOperationResponse result = null;
// Deserialize Response
result = new LongRunningOperationResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("Location"))
{
result.OperationStatusLink = httpResponse.Headers.GetValues("Location").FirstOrDefault();
}
if (httpResponse.Headers.Contains("Retry-After"))
{
result.RetryAfter = int.Parse(httpResponse.Headers.GetValues("Retry-After").FirstOrDefault(), CultureInfo.InvariantCulture);
}
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (statusCode == HttpStatusCode.Conflict)
{
result.Status = OperationStatus.Failed;
}
if (statusCode == HttpStatusCode.Accepted)
{
result.Status = OperationStatus.InProgress;
}
if (statusCode == HttpStatusCode.NoContent)
{
result.Status = OperationStatus.Succeeded;
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Cancel a currently running template deployment.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard service response including an HTTP status code and
/// request ID.
/// </returns>
public async Task<AzureOperationResponse> CancelAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
if (resourceGroupName != null && resourceGroupName.Length > 1000)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (deploymentName == null)
{
throw new ArgumentNullException("deploymentName");
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
TracingAdapter.Enter(invocationId, this, "CancelAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "/subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/resourcegroups/";
url = url + Uri.EscapeDataString(resourceGroupName);
url = url + "/deployments/";
url = url + Uri.EscapeDataString(deploymentName);
url = url + "/cancel";
List<string> queryParameters = new List<string>();
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Post;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.NoContent)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
AzureOperationResponse result = null;
// Deserialize Response
result = new AzureOperationResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Checks whether deployment exists.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group to check. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// Deployment information.
/// </returns>
public async Task<DeploymentExistsResult> CheckExistenceAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
if (resourceGroupName != null && resourceGroupName.Length > 1000)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (deploymentName == null)
{
throw new ArgumentNullException("deploymentName");
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
TracingAdapter.Enter(invocationId, this, "CheckExistenceAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/resourcegroups/";
url = url + Uri.EscapeDataString(resourceGroupName);
url = url + "/deployments/";
url = url + Uri.EscapeDataString(deploymentName);
List<string> queryParameters = new List<string>();
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Head;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.NoContent && statusCode != HttpStatusCode.NotFound)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
DeploymentExistsResult result = null;
// Deserialize Response
result = new DeploymentExistsResult();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (statusCode == HttpStatusCode.NoContent)
{
result.Exists = true;
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Create a named template deployment using a template.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment.
/// </param>
/// <param name='parameters'>
/// Required. Additional parameters supplied to the operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// Template deployment operation create result.
/// </returns>
public async Task<DeploymentOperationsCreateResult> CreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
if (resourceGroupName != null && resourceGroupName.Length > 1000)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (deploymentName == null)
{
throw new ArgumentNullException("deploymentName");
}
if (parameters == null)
{
throw new ArgumentNullException("parameters");
}
if (parameters.Properties != null)
{
if (parameters.Properties.DebugSetting != null)
{
if (parameters.Properties.DebugSetting.DeploymentDebugDetailLevel == null)
{
throw new ArgumentNullException("parameters.Properties.DebugSetting.DeploymentDebugDetailLevel");
}
}
if (parameters.Properties.ParametersLink != null)
{
if (parameters.Properties.ParametersLink.Uri == null)
{
throw new ArgumentNullException("parameters.Properties.ParametersLink.Uri");
}
}
if (parameters.Properties.TemplateLink != null)
{
if (parameters.Properties.TemplateLink.Uri == null)
{
throw new ArgumentNullException("parameters.Properties.TemplateLink.Uri");
}
}
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("parameters", parameters);
TracingAdapter.Enter(invocationId, this, "CreateOrUpdateAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "/subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/resourcegroups/";
url = url + Uri.EscapeDataString(resourceGroupName);
url = url + "/deployments/";
url = url + Uri.EscapeDataString(deploymentName);
List<string> queryParameters = new List<string>();
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Put;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Serialize Request
string requestContent = null;
JToken requestDoc = null;
JObject deploymentValue = new JObject();
requestDoc = deploymentValue;
if (parameters.Properties != null)
{
JObject propertiesValue = new JObject();
deploymentValue["properties"] = propertiesValue;
if (parameters.Properties.Template != null)
{
propertiesValue["template"] = JObject.Parse(parameters.Properties.Template);
}
if (parameters.Properties.TemplateLink != null)
{
JObject templateLinkValue = new JObject();
propertiesValue["templateLink"] = templateLinkValue;
templateLinkValue["uri"] = parameters.Properties.TemplateLink.Uri.AbsoluteUri;
if (parameters.Properties.TemplateLink.ContentVersion != null)
{
templateLinkValue["contentVersion"] = parameters.Properties.TemplateLink.ContentVersion;
}
}
if (parameters.Properties.Parameters != null)
{
propertiesValue["parameters"] = JObject.Parse(parameters.Properties.Parameters);
}
if (parameters.Properties.ParametersLink != null)
{
JObject parametersLinkValue = new JObject();
propertiesValue["parametersLink"] = parametersLinkValue;
parametersLinkValue["uri"] = parameters.Properties.ParametersLink.Uri.AbsoluteUri;
if (parameters.Properties.ParametersLink.ContentVersion != null)
{
parametersLinkValue["contentVersion"] = parameters.Properties.ParametersLink.ContentVersion;
}
}
propertiesValue["mode"] = parameters.Properties.Mode.ToString();
if (parameters.Properties.DebugSetting != null)
{
JObject debugSettingValue = new JObject();
propertiesValue["debugSetting"] = debugSettingValue;
debugSettingValue["detailLevel"] = parameters.Properties.DebugSetting.DeploymentDebugDetailLevel;
}
}
requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Created)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
DeploymentOperationsCreateResult result = null;
// Deserialize Response
if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created)
{
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
result = new DeploymentOperationsCreateResult();
JToken responseDoc = null;
if (string.IsNullOrEmpty(responseContent) == false)
{
responseDoc = JToken.Parse(responseContent);
}
if (responseDoc != null && responseDoc.Type != JTokenType.Null)
{
DeploymentExtended deploymentInstance = new DeploymentExtended();
result.Deployment = deploymentInstance;
JToken idValue = responseDoc["id"];
if (idValue != null && idValue.Type != JTokenType.Null)
{
string idInstance = ((string)idValue);
deploymentInstance.Id = idInstance;
}
JToken nameValue = responseDoc["name"];
if (nameValue != null && nameValue.Type != JTokenType.Null)
{
string nameInstance = ((string)nameValue);
deploymentInstance.Name = nameInstance;
}
JToken propertiesValue2 = responseDoc["properties"];
if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
{
DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
deploymentInstance.Properties = propertiesInstance;
JToken provisioningStateValue = propertiesValue2["provisioningState"];
if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
{
string provisioningStateInstance = ((string)provisioningStateValue);
propertiesInstance.ProvisioningState = provisioningStateInstance;
}
JToken correlationIdValue = propertiesValue2["correlationId"];
if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
{
string correlationIdInstance = ((string)correlationIdValue);
propertiesInstance.CorrelationId = correlationIdInstance;
}
JToken timestampValue = propertiesValue2["timestamp"];
if (timestampValue != null && timestampValue.Type != JTokenType.Null)
{
DateTime timestampInstance = ((DateTime)timestampValue);
propertiesInstance.Timestamp = timestampInstance;
}
JToken durationValue = propertiesValue2["duration"];
if (durationValue != null && durationValue.Type != JTokenType.Null)
{
TimeSpan durationInstance = XmlConvert.ToTimeSpan(((string)durationValue));
propertiesInstance.Duration = durationInstance;
}
JToken outputsValue = propertiesValue2["outputs"];
if (outputsValue != null && outputsValue.Type != JTokenType.Null)
{
string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Outputs = outputsInstance;
}
JToken providersArray = propertiesValue2["providers"];
if (providersArray != null && providersArray.Type != JTokenType.Null)
{
foreach (JToken providersValue in ((JArray)providersArray))
{
Provider providerInstance = new Provider();
propertiesInstance.Providers.Add(providerInstance);
JToken idValue2 = providersValue["id"];
if (idValue2 != null && idValue2.Type != JTokenType.Null)
{
string idInstance2 = ((string)idValue2);
providerInstance.Id = idInstance2;
}
JToken namespaceValue = providersValue["namespace"];
if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
{
string namespaceInstance = ((string)namespaceValue);
providerInstance.Namespace = namespaceInstance;
}
JToken registrationStateValue = providersValue["registrationState"];
if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
{
string registrationStateInstance = ((string)registrationStateValue);
providerInstance.RegistrationState = registrationStateInstance;
}
JToken resourceTypesArray = providersValue["resourceTypes"];
if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
{
foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
{
ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
JToken resourceTypeValue = resourceTypesValue["resourceType"];
if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
{
string resourceTypeInstance = ((string)resourceTypeValue);
providerResourceTypeInstance.Name = resourceTypeInstance;
}
JToken locationsArray = resourceTypesValue["locations"];
if (locationsArray != null && locationsArray.Type != JTokenType.Null)
{
foreach (JToken locationsValue in ((JArray)locationsArray))
{
providerResourceTypeInstance.Locations.Add(((string)locationsValue));
}
}
JToken apiVersionsArray = resourceTypesValue["apiVersions"];
if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
{
foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
{
providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
}
}
JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property in propertiesSequenceElement)
{
string propertiesKey = ((string)property.Name);
string propertiesValue3 = ((string)property.Value);
providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue3);
}
}
}
}
}
}
JToken dependenciesArray = propertiesValue2["dependencies"];
if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
{
foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
{
Dependency dependencyInstance = new Dependency();
propertiesInstance.Dependencies.Add(dependencyInstance);
JToken dependsOnArray = dependenciesValue["dependsOn"];
if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
{
BasicDependency basicDependencyInstance = new BasicDependency();
dependencyInstance.DependsOn.Add(basicDependencyInstance);
JToken idValue3 = dependsOnValue["id"];
if (idValue3 != null && idValue3.Type != JTokenType.Null)
{
string idInstance3 = ((string)idValue3);
basicDependencyInstance.Id = idInstance3;
}
JToken resourceTypeValue2 = dependsOnValue["resourceType"];
if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
{
string resourceTypeInstance2 = ((string)resourceTypeValue2);
basicDependencyInstance.ResourceType = resourceTypeInstance2;
}
JToken resourceNameValue = dependsOnValue["resourceName"];
if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
{
string resourceNameInstance = ((string)resourceNameValue);
basicDependencyInstance.ResourceName = resourceNameInstance;
}
}
}
JToken idValue4 = dependenciesValue["id"];
if (idValue4 != null && idValue4.Type != JTokenType.Null)
{
string idInstance4 = ((string)idValue4);
dependencyInstance.Id = idInstance4;
}
JToken resourceTypeValue3 = dependenciesValue["resourceType"];
if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
{
string resourceTypeInstance3 = ((string)resourceTypeValue3);
dependencyInstance.ResourceType = resourceTypeInstance3;
}
JToken resourceNameValue2 = dependenciesValue["resourceName"];
if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
{
string resourceNameInstance2 = ((string)resourceNameValue2);
dependencyInstance.ResourceName = resourceNameInstance2;
}
}
}
JToken validatedResourcesArray = propertiesValue2["validatedResources"];
if (validatedResourcesArray != null && validatedResourcesArray.Type != JTokenType.Null)
{
foreach (JToken validatedResourcesValue in ((JArray)validatedResourcesArray))
{
DeploymentPreFlightResource deploymentPreFlightResourceInstance = new DeploymentPreFlightResource();
propertiesInstance.ValidatedResources.Add(deploymentPreFlightResourceInstance);
JToken apiVersionValue = validatedResourcesValue["apiVersion"];
if (apiVersionValue != null && apiVersionValue.Type != JTokenType.Null)
{
string apiVersionInstance = ((string)apiVersionValue);
deploymentPreFlightResourceInstance.ApiVersion = apiVersionInstance;
}
JToken dependsOnArray2 = validatedResourcesValue["dependsOn"];
if (dependsOnArray2 != null && dependsOnArray2.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue2 in ((JArray)dependsOnArray2))
{
deploymentPreFlightResourceInstance.DependsOn.Add(((string)dependsOnValue2));
}
}
JToken propertiesValue4 = validatedResourcesValue["properties"];
if (propertiesValue4 != null && propertiesValue4.Type != JTokenType.Null)
{
string propertiesInstance2 = propertiesValue4.ToString(Newtonsoft.Json.Formatting.Indented);
deploymentPreFlightResourceInstance.Properties = propertiesInstance2;
}
JToken provisioningStateValue2 = validatedResourcesValue["provisioningState"];
if (provisioningStateValue2 != null && provisioningStateValue2.Type != JTokenType.Null)
{
string provisioningStateInstance2 = ((string)provisioningStateValue2);
deploymentPreFlightResourceInstance.ProvisioningState = provisioningStateInstance2;
}
JToken planValue = validatedResourcesValue["plan"];
if (planValue != null && planValue.Type != JTokenType.Null)
{
Plan planInstance = new Plan();
deploymentPreFlightResourceInstance.Plan = planInstance;
JToken nameValue2 = planValue["name"];
if (nameValue2 != null && nameValue2.Type != JTokenType.Null)
{
string nameInstance2 = ((string)nameValue2);
planInstance.Name = nameInstance2;
}
JToken publisherValue = planValue["publisher"];
if (publisherValue != null && publisherValue.Type != JTokenType.Null)
{
string publisherInstance = ((string)publisherValue);
planInstance.Publisher = publisherInstance;
}
JToken productValue = planValue["product"];
if (productValue != null && productValue.Type != JTokenType.Null)
{
string productInstance = ((string)productValue);
planInstance.Product = productInstance;
}
JToken promotionCodeValue = planValue["promotionCode"];
if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null)
{
string promotionCodeInstance = ((string)promotionCodeValue);
planInstance.PromotionCode = promotionCodeInstance;
}
}
JToken idValue5 = validatedResourcesValue["id"];
if (idValue5 != null && idValue5.Type != JTokenType.Null)
{
string idInstance5 = ((string)idValue5);
deploymentPreFlightResourceInstance.Id = idInstance5;
}
JToken nameValue3 = validatedResourcesValue["name"];
if (nameValue3 != null && nameValue3.Type != JTokenType.Null)
{
string nameInstance3 = ((string)nameValue3);
deploymentPreFlightResourceInstance.Name = nameInstance3;
}
JToken typeValue = validatedResourcesValue["type"];
if (typeValue != null && typeValue.Type != JTokenType.Null)
{
string typeInstance = ((string)typeValue);
deploymentPreFlightResourceInstance.Type = typeInstance;
}
JToken locationValue = validatedResourcesValue["location"];
if (locationValue != null && locationValue.Type != JTokenType.Null)
{
string locationInstance = ((string)locationValue);
deploymentPreFlightResourceInstance.Location = locationInstance;
}
JToken tagsSequenceElement = ((JToken)validatedResourcesValue["tags"]);
if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property2 in tagsSequenceElement)
{
string tagsKey = ((string)property2.Name);
string tagsValue = ((string)property2.Value);
deploymentPreFlightResourceInstance.Tags.Add(tagsKey, tagsValue);
}
}
}
}
JToken debugSettingValue2 = propertiesValue2["debugSetting"];
if (debugSettingValue2 != null && debugSettingValue2.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance = new DeploymentDebugSetting();
propertiesInstance.DebugSettingResponse = debugSettingInstance;
JToken detailLevelValue = debugSettingValue2["detailLevel"];
if (detailLevelValue != null && detailLevelValue.Type != JTokenType.Null)
{
string detailLevelInstance = ((string)detailLevelValue);
debugSettingInstance.DeploymentDebugDetailLevel = detailLevelInstance;
}
}
JToken templateValue = propertiesValue2["template"];
if (templateValue != null && templateValue.Type != JTokenType.Null)
{
string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Template = templateInstance;
}
JToken templateLinkValue2 = propertiesValue2["templateLink"];
if (templateLinkValue2 != null && templateLinkValue2.Type != JTokenType.Null)
{
TemplateLink templateLinkInstance = new TemplateLink();
propertiesInstance.TemplateLink = templateLinkInstance;
JToken uriValue = templateLinkValue2["uri"];
if (uriValue != null && uriValue.Type != JTokenType.Null)
{
Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
templateLinkInstance.Uri = uriInstance;
}
JToken contentVersionValue = templateLinkValue2["contentVersion"];
if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
{
string contentVersionInstance = ((string)contentVersionValue);
templateLinkInstance.ContentVersion = contentVersionInstance;
}
}
JToken parametersValue = propertiesValue2["parameters"];
if (parametersValue != null && parametersValue.Type != JTokenType.Null)
{
string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Parameters = parametersInstance;
}
JToken parametersLinkValue2 = propertiesValue2["parametersLink"];
if (parametersLinkValue2 != null && parametersLinkValue2.Type != JTokenType.Null)
{
ParametersLink parametersLinkInstance = new ParametersLink();
propertiesInstance.ParametersLink = parametersLinkInstance;
JToken uriValue2 = parametersLinkValue2["uri"];
if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
{
Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
parametersLinkInstance.Uri = uriInstance2;
}
JToken contentVersionValue2 = parametersLinkValue2["contentVersion"];
if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
{
string contentVersionInstance2 = ((string)contentVersionValue2);
parametersLinkInstance.ContentVersion = contentVersionInstance2;
}
}
JToken modeValue = propertiesValue2["mode"];
if (modeValue != null && modeValue.Type != JTokenType.Null)
{
DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
propertiesInstance.Mode = modeInstance;
}
JToken debugSettingValue3 = propertiesValue2["debugSetting"];
if (debugSettingValue3 != null && debugSettingValue3.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance2 = new DeploymentDebugSetting();
propertiesInstance.DebugSetting = debugSettingInstance2;
JToken detailLevelValue2 = debugSettingValue3["detailLevel"];
if (detailLevelValue2 != null && detailLevelValue2.Type != JTokenType.Null)
{
string detailLevelInstance2 = ((string)detailLevelValue2);
debugSettingInstance2.DeploymentDebugDetailLevel = detailLevelInstance2;
}
}
}
}
}
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Delete deployment and all of its resources.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment to be deleted.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard service response including an HTTP status code and
/// request ID.
/// </returns>
public async Task<AzureOperationResponse> DeleteAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
{
ResourceManagementClient client = this.Client;
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
TracingAdapter.Enter(invocationId, this, "DeleteAsync", tracingParameters);
}
cancellationToken.ThrowIfCancellationRequested();
LongRunningOperationResponse response = await client.Deployments.BeginDeletingAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
LongRunningOperationResponse result = await client.GetLongRunningOperationStatusAsync(response.OperationStatusLink, cancellationToken).ConfigureAwait(false);
int delayInSeconds = response.RetryAfter;
if (delayInSeconds == 0)
{
delayInSeconds = 30;
}
if (client.LongRunningOperationInitialTimeout >= 0)
{
delayInSeconds = client.LongRunningOperationInitialTimeout;
}
while (result.Status == OperationStatus.InProgress)
{
cancellationToken.ThrowIfCancellationRequested();
await TaskEx.Delay(delayInSeconds * 1000, cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
result = await client.GetLongRunningOperationStatusAsync(response.OperationStatusLink, cancellationToken).ConfigureAwait(false);
delayInSeconds = result.RetryAfter;
if (delayInSeconds == 0)
{
delayInSeconds = 15;
}
if (client.LongRunningOperationRetryTimeout >= 0)
{
delayInSeconds = client.LongRunningOperationRetryTimeout;
}
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
/// <summary>
/// Get a deployment.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group to get. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// Template deployment information.
/// </returns>
public async Task<DeploymentGetResult> GetAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
if (resourceGroupName != null && resourceGroupName.Length > 1000)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (deploymentName == null)
{
throw new ArgumentNullException("deploymentName");
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "/subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/resourcegroups/";
url = url + Uri.EscapeDataString(resourceGroupName);
url = url + "/deployments/";
url = url + Uri.EscapeDataString(deploymentName);
List<string> queryParameters = new List<string>();
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
DeploymentGetResult result = null;
// Deserialize Response
if (statusCode == HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
result = new DeploymentGetResult();
JToken responseDoc = null;
if (string.IsNullOrEmpty(responseContent) == false)
{
responseDoc = JToken.Parse(responseContent);
}
if (responseDoc != null && responseDoc.Type != JTokenType.Null)
{
DeploymentExtended deploymentInstance = new DeploymentExtended();
result.Deployment = deploymentInstance;
JToken idValue = responseDoc["id"];
if (idValue != null && idValue.Type != JTokenType.Null)
{
string idInstance = ((string)idValue);
deploymentInstance.Id = idInstance;
}
JToken nameValue = responseDoc["name"];
if (nameValue != null && nameValue.Type != JTokenType.Null)
{
string nameInstance = ((string)nameValue);
deploymentInstance.Name = nameInstance;
}
JToken propertiesValue = responseDoc["properties"];
if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
{
DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
deploymentInstance.Properties = propertiesInstance;
JToken provisioningStateValue = propertiesValue["provisioningState"];
if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
{
string provisioningStateInstance = ((string)provisioningStateValue);
propertiesInstance.ProvisioningState = provisioningStateInstance;
}
JToken correlationIdValue = propertiesValue["correlationId"];
if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
{
string correlationIdInstance = ((string)correlationIdValue);
propertiesInstance.CorrelationId = correlationIdInstance;
}
JToken timestampValue = propertiesValue["timestamp"];
if (timestampValue != null && timestampValue.Type != JTokenType.Null)
{
DateTime timestampInstance = ((DateTime)timestampValue);
propertiesInstance.Timestamp = timestampInstance;
}
JToken durationValue = propertiesValue["duration"];
if (durationValue != null && durationValue.Type != JTokenType.Null)
{
TimeSpan durationInstance = XmlConvert.ToTimeSpan(((string)durationValue));
propertiesInstance.Duration = durationInstance;
}
JToken outputsValue = propertiesValue["outputs"];
if (outputsValue != null && outputsValue.Type != JTokenType.Null)
{
string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Outputs = outputsInstance;
}
JToken providersArray = propertiesValue["providers"];
if (providersArray != null && providersArray.Type != JTokenType.Null)
{
foreach (JToken providersValue in ((JArray)providersArray))
{
Provider providerInstance = new Provider();
propertiesInstance.Providers.Add(providerInstance);
JToken idValue2 = providersValue["id"];
if (idValue2 != null && idValue2.Type != JTokenType.Null)
{
string idInstance2 = ((string)idValue2);
providerInstance.Id = idInstance2;
}
JToken namespaceValue = providersValue["namespace"];
if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
{
string namespaceInstance = ((string)namespaceValue);
providerInstance.Namespace = namespaceInstance;
}
JToken registrationStateValue = providersValue["registrationState"];
if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
{
string registrationStateInstance = ((string)registrationStateValue);
providerInstance.RegistrationState = registrationStateInstance;
}
JToken resourceTypesArray = providersValue["resourceTypes"];
if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
{
foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
{
ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
JToken resourceTypeValue = resourceTypesValue["resourceType"];
if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
{
string resourceTypeInstance = ((string)resourceTypeValue);
providerResourceTypeInstance.Name = resourceTypeInstance;
}
JToken locationsArray = resourceTypesValue["locations"];
if (locationsArray != null && locationsArray.Type != JTokenType.Null)
{
foreach (JToken locationsValue in ((JArray)locationsArray))
{
providerResourceTypeInstance.Locations.Add(((string)locationsValue));
}
}
JToken apiVersionsArray = resourceTypesValue["apiVersions"];
if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
{
foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
{
providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
}
}
JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property in propertiesSequenceElement)
{
string propertiesKey = ((string)property.Name);
string propertiesValue2 = ((string)property.Value);
providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue2);
}
}
}
}
}
}
JToken dependenciesArray = propertiesValue["dependencies"];
if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
{
foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
{
Dependency dependencyInstance = new Dependency();
propertiesInstance.Dependencies.Add(dependencyInstance);
JToken dependsOnArray = dependenciesValue["dependsOn"];
if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
{
BasicDependency basicDependencyInstance = new BasicDependency();
dependencyInstance.DependsOn.Add(basicDependencyInstance);
JToken idValue3 = dependsOnValue["id"];
if (idValue3 != null && idValue3.Type != JTokenType.Null)
{
string idInstance3 = ((string)idValue3);
basicDependencyInstance.Id = idInstance3;
}
JToken resourceTypeValue2 = dependsOnValue["resourceType"];
if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
{
string resourceTypeInstance2 = ((string)resourceTypeValue2);
basicDependencyInstance.ResourceType = resourceTypeInstance2;
}
JToken resourceNameValue = dependsOnValue["resourceName"];
if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
{
string resourceNameInstance = ((string)resourceNameValue);
basicDependencyInstance.ResourceName = resourceNameInstance;
}
}
}
JToken idValue4 = dependenciesValue["id"];
if (idValue4 != null && idValue4.Type != JTokenType.Null)
{
string idInstance4 = ((string)idValue4);
dependencyInstance.Id = idInstance4;
}
JToken resourceTypeValue3 = dependenciesValue["resourceType"];
if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
{
string resourceTypeInstance3 = ((string)resourceTypeValue3);
dependencyInstance.ResourceType = resourceTypeInstance3;
}
JToken resourceNameValue2 = dependenciesValue["resourceName"];
if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
{
string resourceNameInstance2 = ((string)resourceNameValue2);
dependencyInstance.ResourceName = resourceNameInstance2;
}
}
}
JToken validatedResourcesArray = propertiesValue["validatedResources"];
if (validatedResourcesArray != null && validatedResourcesArray.Type != JTokenType.Null)
{
foreach (JToken validatedResourcesValue in ((JArray)validatedResourcesArray))
{
DeploymentPreFlightResource deploymentPreFlightResourceInstance = new DeploymentPreFlightResource();
propertiesInstance.ValidatedResources.Add(deploymentPreFlightResourceInstance);
JToken apiVersionValue = validatedResourcesValue["apiVersion"];
if (apiVersionValue != null && apiVersionValue.Type != JTokenType.Null)
{
string apiVersionInstance = ((string)apiVersionValue);
deploymentPreFlightResourceInstance.ApiVersion = apiVersionInstance;
}
JToken dependsOnArray2 = validatedResourcesValue["dependsOn"];
if (dependsOnArray2 != null && dependsOnArray2.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue2 in ((JArray)dependsOnArray2))
{
deploymentPreFlightResourceInstance.DependsOn.Add(((string)dependsOnValue2));
}
}
JToken propertiesValue3 = validatedResourcesValue["properties"];
if (propertiesValue3 != null && propertiesValue3.Type != JTokenType.Null)
{
string propertiesInstance2 = propertiesValue3.ToString(Newtonsoft.Json.Formatting.Indented);
deploymentPreFlightResourceInstance.Properties = propertiesInstance2;
}
JToken provisioningStateValue2 = validatedResourcesValue["provisioningState"];
if (provisioningStateValue2 != null && provisioningStateValue2.Type != JTokenType.Null)
{
string provisioningStateInstance2 = ((string)provisioningStateValue2);
deploymentPreFlightResourceInstance.ProvisioningState = provisioningStateInstance2;
}
JToken planValue = validatedResourcesValue["plan"];
if (planValue != null && planValue.Type != JTokenType.Null)
{
Plan planInstance = new Plan();
deploymentPreFlightResourceInstance.Plan = planInstance;
JToken nameValue2 = planValue["name"];
if (nameValue2 != null && nameValue2.Type != JTokenType.Null)
{
string nameInstance2 = ((string)nameValue2);
planInstance.Name = nameInstance2;
}
JToken publisherValue = planValue["publisher"];
if (publisherValue != null && publisherValue.Type != JTokenType.Null)
{
string publisherInstance = ((string)publisherValue);
planInstance.Publisher = publisherInstance;
}
JToken productValue = planValue["product"];
if (productValue != null && productValue.Type != JTokenType.Null)
{
string productInstance = ((string)productValue);
planInstance.Product = productInstance;
}
JToken promotionCodeValue = planValue["promotionCode"];
if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null)
{
string promotionCodeInstance = ((string)promotionCodeValue);
planInstance.PromotionCode = promotionCodeInstance;
}
}
JToken idValue5 = validatedResourcesValue["id"];
if (idValue5 != null && idValue5.Type != JTokenType.Null)
{
string idInstance5 = ((string)idValue5);
deploymentPreFlightResourceInstance.Id = idInstance5;
}
JToken nameValue3 = validatedResourcesValue["name"];
if (nameValue3 != null && nameValue3.Type != JTokenType.Null)
{
string nameInstance3 = ((string)nameValue3);
deploymentPreFlightResourceInstance.Name = nameInstance3;
}
JToken typeValue = validatedResourcesValue["type"];
if (typeValue != null && typeValue.Type != JTokenType.Null)
{
string typeInstance = ((string)typeValue);
deploymentPreFlightResourceInstance.Type = typeInstance;
}
JToken locationValue = validatedResourcesValue["location"];
if (locationValue != null && locationValue.Type != JTokenType.Null)
{
string locationInstance = ((string)locationValue);
deploymentPreFlightResourceInstance.Location = locationInstance;
}
JToken tagsSequenceElement = ((JToken)validatedResourcesValue["tags"]);
if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property2 in tagsSequenceElement)
{
string tagsKey = ((string)property2.Name);
string tagsValue = ((string)property2.Value);
deploymentPreFlightResourceInstance.Tags.Add(tagsKey, tagsValue);
}
}
}
}
JToken debugSettingValue = propertiesValue["debugSetting"];
if (debugSettingValue != null && debugSettingValue.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance = new DeploymentDebugSetting();
propertiesInstance.DebugSettingResponse = debugSettingInstance;
JToken detailLevelValue = debugSettingValue["detailLevel"];
if (detailLevelValue != null && detailLevelValue.Type != JTokenType.Null)
{
string detailLevelInstance = ((string)detailLevelValue);
debugSettingInstance.DeploymentDebugDetailLevel = detailLevelInstance;
}
}
JToken templateValue = propertiesValue["template"];
if (templateValue != null && templateValue.Type != JTokenType.Null)
{
string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Template = templateInstance;
}
JToken templateLinkValue = propertiesValue["templateLink"];
if (templateLinkValue != null && templateLinkValue.Type != JTokenType.Null)
{
TemplateLink templateLinkInstance = new TemplateLink();
propertiesInstance.TemplateLink = templateLinkInstance;
JToken uriValue = templateLinkValue["uri"];
if (uriValue != null && uriValue.Type != JTokenType.Null)
{
Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
templateLinkInstance.Uri = uriInstance;
}
JToken contentVersionValue = templateLinkValue["contentVersion"];
if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
{
string contentVersionInstance = ((string)contentVersionValue);
templateLinkInstance.ContentVersion = contentVersionInstance;
}
}
JToken parametersValue = propertiesValue["parameters"];
if (parametersValue != null && parametersValue.Type != JTokenType.Null)
{
string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Parameters = parametersInstance;
}
JToken parametersLinkValue = propertiesValue["parametersLink"];
if (parametersLinkValue != null && parametersLinkValue.Type != JTokenType.Null)
{
ParametersLink parametersLinkInstance = new ParametersLink();
propertiesInstance.ParametersLink = parametersLinkInstance;
JToken uriValue2 = parametersLinkValue["uri"];
if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
{
Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
parametersLinkInstance.Uri = uriInstance2;
}
JToken contentVersionValue2 = parametersLinkValue["contentVersion"];
if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
{
string contentVersionInstance2 = ((string)contentVersionValue2);
parametersLinkInstance.ContentVersion = contentVersionInstance2;
}
}
JToken modeValue = propertiesValue["mode"];
if (modeValue != null && modeValue.Type != JTokenType.Null)
{
DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
propertiesInstance.Mode = modeInstance;
}
JToken debugSettingValue2 = propertiesValue["debugSetting"];
if (debugSettingValue2 != null && debugSettingValue2.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance2 = new DeploymentDebugSetting();
propertiesInstance.DebugSetting = debugSettingInstance2;
JToken detailLevelValue2 = debugSettingValue2["detailLevel"];
if (detailLevelValue2 != null && detailLevelValue2.Type != JTokenType.Null)
{
string detailLevelInstance2 = ((string)detailLevelValue2);
debugSettingInstance2.DeploymentDebugDetailLevel = detailLevelInstance2;
}
}
}
}
}
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Get a list of deployments.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group to filter by. The name is
/// case insensitive.
/// </param>
/// <param name='parameters'>
/// Optional. Query parameters. If null is passed returns all
/// deployments.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// List of deployments.
/// </returns>
public async Task<DeploymentListResult> ListAsync(string resourceGroupName, DeploymentListParameters parameters, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("parameters", parameters);
TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "/subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/";
url = url + "resourcegroups/" + Uri.EscapeDataString(resourceGroupName) + "/";
url = url + "deployments/";
List<string> queryParameters = new List<string>();
List<string> odataFilter = new List<string>();
if (parameters != null && parameters.ProvisioningState != null)
{
odataFilter.Add("provisioningState eq '" + Uri.EscapeDataString(parameters.ProvisioningState) + "'");
}
if (odataFilter.Count > 0)
{
queryParameters.Add("$filter=" + string.Join(null, odataFilter));
}
if (parameters != null && parameters.Top != null)
{
queryParameters.Add("$top=" + Uri.EscapeDataString(parameters.Top.Value.ToString()));
}
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
DeploymentListResult result = null;
// Deserialize Response
if (statusCode == HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
result = new DeploymentListResult();
JToken responseDoc = null;
if (string.IsNullOrEmpty(responseContent) == false)
{
responseDoc = JToken.Parse(responseContent);
}
if (responseDoc != null && responseDoc.Type != JTokenType.Null)
{
JToken valueArray = responseDoc["value"];
if (valueArray != null && valueArray.Type != JTokenType.Null)
{
foreach (JToken valueValue in ((JArray)valueArray))
{
DeploymentExtended deploymentExtendedInstance = new DeploymentExtended();
result.Deployments.Add(deploymentExtendedInstance);
JToken idValue = valueValue["id"];
if (idValue != null && idValue.Type != JTokenType.Null)
{
string idInstance = ((string)idValue);
deploymentExtendedInstance.Id = idInstance;
}
JToken nameValue = valueValue["name"];
if (nameValue != null && nameValue.Type != JTokenType.Null)
{
string nameInstance = ((string)nameValue);
deploymentExtendedInstance.Name = nameInstance;
}
JToken propertiesValue = valueValue["properties"];
if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
{
DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
deploymentExtendedInstance.Properties = propertiesInstance;
JToken provisioningStateValue = propertiesValue["provisioningState"];
if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
{
string provisioningStateInstance = ((string)provisioningStateValue);
propertiesInstance.ProvisioningState = provisioningStateInstance;
}
JToken correlationIdValue = propertiesValue["correlationId"];
if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
{
string correlationIdInstance = ((string)correlationIdValue);
propertiesInstance.CorrelationId = correlationIdInstance;
}
JToken timestampValue = propertiesValue["timestamp"];
if (timestampValue != null && timestampValue.Type != JTokenType.Null)
{
DateTime timestampInstance = ((DateTime)timestampValue);
propertiesInstance.Timestamp = timestampInstance;
}
JToken durationValue = propertiesValue["duration"];
if (durationValue != null && durationValue.Type != JTokenType.Null)
{
TimeSpan durationInstance = XmlConvert.ToTimeSpan(((string)durationValue));
propertiesInstance.Duration = durationInstance;
}
JToken outputsValue = propertiesValue["outputs"];
if (outputsValue != null && outputsValue.Type != JTokenType.Null)
{
string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Outputs = outputsInstance;
}
JToken providersArray = propertiesValue["providers"];
if (providersArray != null && providersArray.Type != JTokenType.Null)
{
foreach (JToken providersValue in ((JArray)providersArray))
{
Provider providerInstance = new Provider();
propertiesInstance.Providers.Add(providerInstance);
JToken idValue2 = providersValue["id"];
if (idValue2 != null && idValue2.Type != JTokenType.Null)
{
string idInstance2 = ((string)idValue2);
providerInstance.Id = idInstance2;
}
JToken namespaceValue = providersValue["namespace"];
if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
{
string namespaceInstance = ((string)namespaceValue);
providerInstance.Namespace = namespaceInstance;
}
JToken registrationStateValue = providersValue["registrationState"];
if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
{
string registrationStateInstance = ((string)registrationStateValue);
providerInstance.RegistrationState = registrationStateInstance;
}
JToken resourceTypesArray = providersValue["resourceTypes"];
if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
{
foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
{
ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
JToken resourceTypeValue = resourceTypesValue["resourceType"];
if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
{
string resourceTypeInstance = ((string)resourceTypeValue);
providerResourceTypeInstance.Name = resourceTypeInstance;
}
JToken locationsArray = resourceTypesValue["locations"];
if (locationsArray != null && locationsArray.Type != JTokenType.Null)
{
foreach (JToken locationsValue in ((JArray)locationsArray))
{
providerResourceTypeInstance.Locations.Add(((string)locationsValue));
}
}
JToken apiVersionsArray = resourceTypesValue["apiVersions"];
if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
{
foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
{
providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
}
}
JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property in propertiesSequenceElement)
{
string propertiesKey = ((string)property.Name);
string propertiesValue2 = ((string)property.Value);
providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue2);
}
}
}
}
}
}
JToken dependenciesArray = propertiesValue["dependencies"];
if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
{
foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
{
Dependency dependencyInstance = new Dependency();
propertiesInstance.Dependencies.Add(dependencyInstance);
JToken dependsOnArray = dependenciesValue["dependsOn"];
if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
{
BasicDependency basicDependencyInstance = new BasicDependency();
dependencyInstance.DependsOn.Add(basicDependencyInstance);
JToken idValue3 = dependsOnValue["id"];
if (idValue3 != null && idValue3.Type != JTokenType.Null)
{
string idInstance3 = ((string)idValue3);
basicDependencyInstance.Id = idInstance3;
}
JToken resourceTypeValue2 = dependsOnValue["resourceType"];
if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
{
string resourceTypeInstance2 = ((string)resourceTypeValue2);
basicDependencyInstance.ResourceType = resourceTypeInstance2;
}
JToken resourceNameValue = dependsOnValue["resourceName"];
if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
{
string resourceNameInstance = ((string)resourceNameValue);
basicDependencyInstance.ResourceName = resourceNameInstance;
}
}
}
JToken idValue4 = dependenciesValue["id"];
if (idValue4 != null && idValue4.Type != JTokenType.Null)
{
string idInstance4 = ((string)idValue4);
dependencyInstance.Id = idInstance4;
}
JToken resourceTypeValue3 = dependenciesValue["resourceType"];
if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
{
string resourceTypeInstance3 = ((string)resourceTypeValue3);
dependencyInstance.ResourceType = resourceTypeInstance3;
}
JToken resourceNameValue2 = dependenciesValue["resourceName"];
if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
{
string resourceNameInstance2 = ((string)resourceNameValue2);
dependencyInstance.ResourceName = resourceNameInstance2;
}
}
}
JToken validatedResourcesArray = propertiesValue["validatedResources"];
if (validatedResourcesArray != null && validatedResourcesArray.Type != JTokenType.Null)
{
foreach (JToken validatedResourcesValue in ((JArray)validatedResourcesArray))
{
DeploymentPreFlightResource deploymentPreFlightResourceInstance = new DeploymentPreFlightResource();
propertiesInstance.ValidatedResources.Add(deploymentPreFlightResourceInstance);
JToken apiVersionValue = validatedResourcesValue["apiVersion"];
if (apiVersionValue != null && apiVersionValue.Type != JTokenType.Null)
{
string apiVersionInstance = ((string)apiVersionValue);
deploymentPreFlightResourceInstance.ApiVersion = apiVersionInstance;
}
JToken dependsOnArray2 = validatedResourcesValue["dependsOn"];
if (dependsOnArray2 != null && dependsOnArray2.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue2 in ((JArray)dependsOnArray2))
{
deploymentPreFlightResourceInstance.DependsOn.Add(((string)dependsOnValue2));
}
}
JToken propertiesValue3 = validatedResourcesValue["properties"];
if (propertiesValue3 != null && propertiesValue3.Type != JTokenType.Null)
{
string propertiesInstance2 = propertiesValue3.ToString(Newtonsoft.Json.Formatting.Indented);
deploymentPreFlightResourceInstance.Properties = propertiesInstance2;
}
JToken provisioningStateValue2 = validatedResourcesValue["provisioningState"];
if (provisioningStateValue2 != null && provisioningStateValue2.Type != JTokenType.Null)
{
string provisioningStateInstance2 = ((string)provisioningStateValue2);
deploymentPreFlightResourceInstance.ProvisioningState = provisioningStateInstance2;
}
JToken planValue = validatedResourcesValue["plan"];
if (planValue != null && planValue.Type != JTokenType.Null)
{
Plan planInstance = new Plan();
deploymentPreFlightResourceInstance.Plan = planInstance;
JToken nameValue2 = planValue["name"];
if (nameValue2 != null && nameValue2.Type != JTokenType.Null)
{
string nameInstance2 = ((string)nameValue2);
planInstance.Name = nameInstance2;
}
JToken publisherValue = planValue["publisher"];
if (publisherValue != null && publisherValue.Type != JTokenType.Null)
{
string publisherInstance = ((string)publisherValue);
planInstance.Publisher = publisherInstance;
}
JToken productValue = planValue["product"];
if (productValue != null && productValue.Type != JTokenType.Null)
{
string productInstance = ((string)productValue);
planInstance.Product = productInstance;
}
JToken promotionCodeValue = planValue["promotionCode"];
if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null)
{
string promotionCodeInstance = ((string)promotionCodeValue);
planInstance.PromotionCode = promotionCodeInstance;
}
}
JToken idValue5 = validatedResourcesValue["id"];
if (idValue5 != null && idValue5.Type != JTokenType.Null)
{
string idInstance5 = ((string)idValue5);
deploymentPreFlightResourceInstance.Id = idInstance5;
}
JToken nameValue3 = validatedResourcesValue["name"];
if (nameValue3 != null && nameValue3.Type != JTokenType.Null)
{
string nameInstance3 = ((string)nameValue3);
deploymentPreFlightResourceInstance.Name = nameInstance3;
}
JToken typeValue = validatedResourcesValue["type"];
if (typeValue != null && typeValue.Type != JTokenType.Null)
{
string typeInstance = ((string)typeValue);
deploymentPreFlightResourceInstance.Type = typeInstance;
}
JToken locationValue = validatedResourcesValue["location"];
if (locationValue != null && locationValue.Type != JTokenType.Null)
{
string locationInstance = ((string)locationValue);
deploymentPreFlightResourceInstance.Location = locationInstance;
}
JToken tagsSequenceElement = ((JToken)validatedResourcesValue["tags"]);
if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property2 in tagsSequenceElement)
{
string tagsKey = ((string)property2.Name);
string tagsValue = ((string)property2.Value);
deploymentPreFlightResourceInstance.Tags.Add(tagsKey, tagsValue);
}
}
}
}
JToken debugSettingValue = propertiesValue["debugSetting"];
if (debugSettingValue != null && debugSettingValue.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance = new DeploymentDebugSetting();
propertiesInstance.DebugSettingResponse = debugSettingInstance;
JToken detailLevelValue = debugSettingValue["detailLevel"];
if (detailLevelValue != null && detailLevelValue.Type != JTokenType.Null)
{
string detailLevelInstance = ((string)detailLevelValue);
debugSettingInstance.DeploymentDebugDetailLevel = detailLevelInstance;
}
}
JToken templateValue = propertiesValue["template"];
if (templateValue != null && templateValue.Type != JTokenType.Null)
{
string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Template = templateInstance;
}
JToken templateLinkValue = propertiesValue["templateLink"];
if (templateLinkValue != null && templateLinkValue.Type != JTokenType.Null)
{
TemplateLink templateLinkInstance = new TemplateLink();
propertiesInstance.TemplateLink = templateLinkInstance;
JToken uriValue = templateLinkValue["uri"];
if (uriValue != null && uriValue.Type != JTokenType.Null)
{
Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
templateLinkInstance.Uri = uriInstance;
}
JToken contentVersionValue = templateLinkValue["contentVersion"];
if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
{
string contentVersionInstance = ((string)contentVersionValue);
templateLinkInstance.ContentVersion = contentVersionInstance;
}
}
JToken parametersValue = propertiesValue["parameters"];
if (parametersValue != null && parametersValue.Type != JTokenType.Null)
{
string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Parameters = parametersInstance;
}
JToken parametersLinkValue = propertiesValue["parametersLink"];
if (parametersLinkValue != null && parametersLinkValue.Type != JTokenType.Null)
{
ParametersLink parametersLinkInstance = new ParametersLink();
propertiesInstance.ParametersLink = parametersLinkInstance;
JToken uriValue2 = parametersLinkValue["uri"];
if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
{
Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
parametersLinkInstance.Uri = uriInstance2;
}
JToken contentVersionValue2 = parametersLinkValue["contentVersion"];
if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
{
string contentVersionInstance2 = ((string)contentVersionValue2);
parametersLinkInstance.ContentVersion = contentVersionInstance2;
}
}
JToken modeValue = propertiesValue["mode"];
if (modeValue != null && modeValue.Type != JTokenType.Null)
{
DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
propertiesInstance.Mode = modeInstance;
}
JToken debugSettingValue2 = propertiesValue["debugSetting"];
if (debugSettingValue2 != null && debugSettingValue2.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance2 = new DeploymentDebugSetting();
propertiesInstance.DebugSetting = debugSettingInstance2;
JToken detailLevelValue2 = debugSettingValue2["detailLevel"];
if (detailLevelValue2 != null && detailLevelValue2.Type != JTokenType.Null)
{
string detailLevelInstance2 = ((string)detailLevelValue2);
debugSettingInstance2.DeploymentDebugDetailLevel = detailLevelInstance2;
}
}
}
}
}
JToken nextLinkValue = responseDoc["nextLink"];
if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
{
string nextLinkInstance = ((string)nextLinkValue);
result.NextLink = nextLinkInstance;
}
}
}
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Get a list of deployments.
/// </summary>
/// <param name='nextLink'>
/// Required. NextLink from the previous successful call to List
/// operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// List of deployments.
/// </returns>
public async Task<DeploymentListResult> ListNextAsync(string nextLink, CancellationToken cancellationToken)
{
// Validate
if (nextLink == null)
{
throw new ArgumentNullException("nextLink");
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("nextLink", nextLink);
TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + nextLink;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
DeploymentListResult result = null;
// Deserialize Response
if (statusCode == HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
result = new DeploymentListResult();
JToken responseDoc = null;
if (string.IsNullOrEmpty(responseContent) == false)
{
responseDoc = JToken.Parse(responseContent);
}
if (responseDoc != null && responseDoc.Type != JTokenType.Null)
{
JToken valueArray = responseDoc["value"];
if (valueArray != null && valueArray.Type != JTokenType.Null)
{
foreach (JToken valueValue in ((JArray)valueArray))
{
DeploymentExtended deploymentExtendedInstance = new DeploymentExtended();
result.Deployments.Add(deploymentExtendedInstance);
JToken idValue = valueValue["id"];
if (idValue != null && idValue.Type != JTokenType.Null)
{
string idInstance = ((string)idValue);
deploymentExtendedInstance.Id = idInstance;
}
JToken nameValue = valueValue["name"];
if (nameValue != null && nameValue.Type != JTokenType.Null)
{
string nameInstance = ((string)nameValue);
deploymentExtendedInstance.Name = nameInstance;
}
JToken propertiesValue = valueValue["properties"];
if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
{
DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
deploymentExtendedInstance.Properties = propertiesInstance;
JToken provisioningStateValue = propertiesValue["provisioningState"];
if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
{
string provisioningStateInstance = ((string)provisioningStateValue);
propertiesInstance.ProvisioningState = provisioningStateInstance;
}
JToken correlationIdValue = propertiesValue["correlationId"];
if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
{
string correlationIdInstance = ((string)correlationIdValue);
propertiesInstance.CorrelationId = correlationIdInstance;
}
JToken timestampValue = propertiesValue["timestamp"];
if (timestampValue != null && timestampValue.Type != JTokenType.Null)
{
DateTime timestampInstance = ((DateTime)timestampValue);
propertiesInstance.Timestamp = timestampInstance;
}
JToken durationValue = propertiesValue["duration"];
if (durationValue != null && durationValue.Type != JTokenType.Null)
{
TimeSpan durationInstance = XmlConvert.ToTimeSpan(((string)durationValue));
propertiesInstance.Duration = durationInstance;
}
JToken outputsValue = propertiesValue["outputs"];
if (outputsValue != null && outputsValue.Type != JTokenType.Null)
{
string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Outputs = outputsInstance;
}
JToken providersArray = propertiesValue["providers"];
if (providersArray != null && providersArray.Type != JTokenType.Null)
{
foreach (JToken providersValue in ((JArray)providersArray))
{
Provider providerInstance = new Provider();
propertiesInstance.Providers.Add(providerInstance);
JToken idValue2 = providersValue["id"];
if (idValue2 != null && idValue2.Type != JTokenType.Null)
{
string idInstance2 = ((string)idValue2);
providerInstance.Id = idInstance2;
}
JToken namespaceValue = providersValue["namespace"];
if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
{
string namespaceInstance = ((string)namespaceValue);
providerInstance.Namespace = namespaceInstance;
}
JToken registrationStateValue = providersValue["registrationState"];
if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
{
string registrationStateInstance = ((string)registrationStateValue);
providerInstance.RegistrationState = registrationStateInstance;
}
JToken resourceTypesArray = providersValue["resourceTypes"];
if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
{
foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
{
ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
JToken resourceTypeValue = resourceTypesValue["resourceType"];
if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
{
string resourceTypeInstance = ((string)resourceTypeValue);
providerResourceTypeInstance.Name = resourceTypeInstance;
}
JToken locationsArray = resourceTypesValue["locations"];
if (locationsArray != null && locationsArray.Type != JTokenType.Null)
{
foreach (JToken locationsValue in ((JArray)locationsArray))
{
providerResourceTypeInstance.Locations.Add(((string)locationsValue));
}
}
JToken apiVersionsArray = resourceTypesValue["apiVersions"];
if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
{
foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
{
providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
}
}
JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property in propertiesSequenceElement)
{
string propertiesKey = ((string)property.Name);
string propertiesValue2 = ((string)property.Value);
providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue2);
}
}
}
}
}
}
JToken dependenciesArray = propertiesValue["dependencies"];
if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
{
foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
{
Dependency dependencyInstance = new Dependency();
propertiesInstance.Dependencies.Add(dependencyInstance);
JToken dependsOnArray = dependenciesValue["dependsOn"];
if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
{
BasicDependency basicDependencyInstance = new BasicDependency();
dependencyInstance.DependsOn.Add(basicDependencyInstance);
JToken idValue3 = dependsOnValue["id"];
if (idValue3 != null && idValue3.Type != JTokenType.Null)
{
string idInstance3 = ((string)idValue3);
basicDependencyInstance.Id = idInstance3;
}
JToken resourceTypeValue2 = dependsOnValue["resourceType"];
if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
{
string resourceTypeInstance2 = ((string)resourceTypeValue2);
basicDependencyInstance.ResourceType = resourceTypeInstance2;
}
JToken resourceNameValue = dependsOnValue["resourceName"];
if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
{
string resourceNameInstance = ((string)resourceNameValue);
basicDependencyInstance.ResourceName = resourceNameInstance;
}
}
}
JToken idValue4 = dependenciesValue["id"];
if (idValue4 != null && idValue4.Type != JTokenType.Null)
{
string idInstance4 = ((string)idValue4);
dependencyInstance.Id = idInstance4;
}
JToken resourceTypeValue3 = dependenciesValue["resourceType"];
if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
{
string resourceTypeInstance3 = ((string)resourceTypeValue3);
dependencyInstance.ResourceType = resourceTypeInstance3;
}
JToken resourceNameValue2 = dependenciesValue["resourceName"];
if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
{
string resourceNameInstance2 = ((string)resourceNameValue2);
dependencyInstance.ResourceName = resourceNameInstance2;
}
}
}
JToken validatedResourcesArray = propertiesValue["validatedResources"];
if (validatedResourcesArray != null && validatedResourcesArray.Type != JTokenType.Null)
{
foreach (JToken validatedResourcesValue in ((JArray)validatedResourcesArray))
{
DeploymentPreFlightResource deploymentPreFlightResourceInstance = new DeploymentPreFlightResource();
propertiesInstance.ValidatedResources.Add(deploymentPreFlightResourceInstance);
JToken apiVersionValue = validatedResourcesValue["apiVersion"];
if (apiVersionValue != null && apiVersionValue.Type != JTokenType.Null)
{
string apiVersionInstance = ((string)apiVersionValue);
deploymentPreFlightResourceInstance.ApiVersion = apiVersionInstance;
}
JToken dependsOnArray2 = validatedResourcesValue["dependsOn"];
if (dependsOnArray2 != null && dependsOnArray2.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue2 in ((JArray)dependsOnArray2))
{
deploymentPreFlightResourceInstance.DependsOn.Add(((string)dependsOnValue2));
}
}
JToken propertiesValue3 = validatedResourcesValue["properties"];
if (propertiesValue3 != null && propertiesValue3.Type != JTokenType.Null)
{
string propertiesInstance2 = propertiesValue3.ToString(Newtonsoft.Json.Formatting.Indented);
deploymentPreFlightResourceInstance.Properties = propertiesInstance2;
}
JToken provisioningStateValue2 = validatedResourcesValue["provisioningState"];
if (provisioningStateValue2 != null && provisioningStateValue2.Type != JTokenType.Null)
{
string provisioningStateInstance2 = ((string)provisioningStateValue2);
deploymentPreFlightResourceInstance.ProvisioningState = provisioningStateInstance2;
}
JToken planValue = validatedResourcesValue["plan"];
if (planValue != null && planValue.Type != JTokenType.Null)
{
Plan planInstance = new Plan();
deploymentPreFlightResourceInstance.Plan = planInstance;
JToken nameValue2 = planValue["name"];
if (nameValue2 != null && nameValue2.Type != JTokenType.Null)
{
string nameInstance2 = ((string)nameValue2);
planInstance.Name = nameInstance2;
}
JToken publisherValue = planValue["publisher"];
if (publisherValue != null && publisherValue.Type != JTokenType.Null)
{
string publisherInstance = ((string)publisherValue);
planInstance.Publisher = publisherInstance;
}
JToken productValue = planValue["product"];
if (productValue != null && productValue.Type != JTokenType.Null)
{
string productInstance = ((string)productValue);
planInstance.Product = productInstance;
}
JToken promotionCodeValue = planValue["promotionCode"];
if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null)
{
string promotionCodeInstance = ((string)promotionCodeValue);
planInstance.PromotionCode = promotionCodeInstance;
}
}
JToken idValue5 = validatedResourcesValue["id"];
if (idValue5 != null && idValue5.Type != JTokenType.Null)
{
string idInstance5 = ((string)idValue5);
deploymentPreFlightResourceInstance.Id = idInstance5;
}
JToken nameValue3 = validatedResourcesValue["name"];
if (nameValue3 != null && nameValue3.Type != JTokenType.Null)
{
string nameInstance3 = ((string)nameValue3);
deploymentPreFlightResourceInstance.Name = nameInstance3;
}
JToken typeValue = validatedResourcesValue["type"];
if (typeValue != null && typeValue.Type != JTokenType.Null)
{
string typeInstance = ((string)typeValue);
deploymentPreFlightResourceInstance.Type = typeInstance;
}
JToken locationValue = validatedResourcesValue["location"];
if (locationValue != null && locationValue.Type != JTokenType.Null)
{
string locationInstance = ((string)locationValue);
deploymentPreFlightResourceInstance.Location = locationInstance;
}
JToken tagsSequenceElement = ((JToken)validatedResourcesValue["tags"]);
if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property2 in tagsSequenceElement)
{
string tagsKey = ((string)property2.Name);
string tagsValue = ((string)property2.Value);
deploymentPreFlightResourceInstance.Tags.Add(tagsKey, tagsValue);
}
}
}
}
JToken debugSettingValue = propertiesValue["debugSetting"];
if (debugSettingValue != null && debugSettingValue.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance = new DeploymentDebugSetting();
propertiesInstance.DebugSettingResponse = debugSettingInstance;
JToken detailLevelValue = debugSettingValue["detailLevel"];
if (detailLevelValue != null && detailLevelValue.Type != JTokenType.Null)
{
string detailLevelInstance = ((string)detailLevelValue);
debugSettingInstance.DeploymentDebugDetailLevel = detailLevelInstance;
}
}
JToken templateValue = propertiesValue["template"];
if (templateValue != null && templateValue.Type != JTokenType.Null)
{
string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Template = templateInstance;
}
JToken templateLinkValue = propertiesValue["templateLink"];
if (templateLinkValue != null && templateLinkValue.Type != JTokenType.Null)
{
TemplateLink templateLinkInstance = new TemplateLink();
propertiesInstance.TemplateLink = templateLinkInstance;
JToken uriValue = templateLinkValue["uri"];
if (uriValue != null && uriValue.Type != JTokenType.Null)
{
Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
templateLinkInstance.Uri = uriInstance;
}
JToken contentVersionValue = templateLinkValue["contentVersion"];
if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
{
string contentVersionInstance = ((string)contentVersionValue);
templateLinkInstance.ContentVersion = contentVersionInstance;
}
}
JToken parametersValue = propertiesValue["parameters"];
if (parametersValue != null && parametersValue.Type != JTokenType.Null)
{
string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Parameters = parametersInstance;
}
JToken parametersLinkValue = propertiesValue["parametersLink"];
if (parametersLinkValue != null && parametersLinkValue.Type != JTokenType.Null)
{
ParametersLink parametersLinkInstance = new ParametersLink();
propertiesInstance.ParametersLink = parametersLinkInstance;
JToken uriValue2 = parametersLinkValue["uri"];
if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
{
Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
parametersLinkInstance.Uri = uriInstance2;
}
JToken contentVersionValue2 = parametersLinkValue["contentVersion"];
if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
{
string contentVersionInstance2 = ((string)contentVersionValue2);
parametersLinkInstance.ContentVersion = contentVersionInstance2;
}
}
JToken modeValue = propertiesValue["mode"];
if (modeValue != null && modeValue.Type != JTokenType.Null)
{
DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
propertiesInstance.Mode = modeInstance;
}
JToken debugSettingValue2 = propertiesValue["debugSetting"];
if (debugSettingValue2 != null && debugSettingValue2.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance2 = new DeploymentDebugSetting();
propertiesInstance.DebugSetting = debugSettingInstance2;
JToken detailLevelValue2 = debugSettingValue2["detailLevel"];
if (detailLevelValue2 != null && detailLevelValue2.Type != JTokenType.Null)
{
string detailLevelInstance2 = ((string)detailLevelValue2);
debugSettingInstance2.DeploymentDebugDetailLevel = detailLevelInstance2;
}
}
}
}
}
JToken nextLinkValue = responseDoc["nextLink"];
if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
{
string nextLinkInstance = ((string)nextLinkValue);
result.NextLink = nextLinkInstance;
}
}
}
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Validate a deployment template.
/// </summary>
/// <param name='resourceGroupName'>
/// Required. The name of the resource group. The name is case
/// insensitive.
/// </param>
/// <param name='deploymentName'>
/// Required. The name of the deployment.
/// </param>
/// <param name='parameters'>
/// Required. Deployment to validate.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// Information from validate template deployment response.
/// </returns>
public async Task<DeploymentValidateResponse> ValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken)
{
// Validate
if (resourceGroupName == null)
{
throw new ArgumentNullException("resourceGroupName");
}
if (resourceGroupName != null && resourceGroupName.Length > 1000)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
{
throw new ArgumentOutOfRangeException("resourceGroupName");
}
if (deploymentName == null)
{
throw new ArgumentNullException("deploymentName");
}
if (parameters == null)
{
throw new ArgumentNullException("parameters");
}
if (parameters.Properties != null)
{
if (parameters.Properties.DebugSetting != null)
{
if (parameters.Properties.DebugSetting.DeploymentDebugDetailLevel == null)
{
throw new ArgumentNullException("parameters.Properties.DebugSetting.DeploymentDebugDetailLevel");
}
}
if (parameters.Properties.ParametersLink != null)
{
if (parameters.Properties.ParametersLink.Uri == null)
{
throw new ArgumentNullException("parameters.Properties.ParametersLink.Uri");
}
}
if (parameters.Properties.TemplateLink != null)
{
if (parameters.Properties.TemplateLink.Uri == null)
{
throw new ArgumentNullException("parameters.Properties.TemplateLink.Uri");
}
}
}
// Tracing
bool shouldTrace = TracingAdapter.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = TracingAdapter.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("parameters", parameters);
TracingAdapter.Enter(invocationId, this, "ValidateAsync", tracingParameters);
}
// Construct URL
string url = "";
url = url + "/subscriptions/";
if (this.Client.Credentials.SubscriptionId != null)
{
url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
}
url = url + "/resourcegroups/";
url = url + Uri.EscapeDataString(resourceGroupName);
url = url + "/providers/microsoft.resources/deployments/";
url = url + Uri.EscapeDataString(deploymentName);
url = url + "/validate";
List<string> queryParameters = new List<string>();
queryParameters.Add("api-version=2016-02-01");
if (queryParameters.Count > 0)
{
url = url + "?" + string.Join("&", queryParameters);
}
string baseUrl = this.Client.BaseUri.AbsoluteUri;
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl[baseUrl.Length - 1] == '/')
{
baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
}
if (url[0] == '/')
{
url = url.Substring(1);
}
url = baseUrl + "/" + url;
url = url.Replace(" ", "%20");
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Post;
httpRequest.RequestUri = new Uri(url);
// Set Headers
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Serialize Request
string requestContent = null;
JToken requestDoc = null;
JObject deploymentValue = new JObject();
requestDoc = deploymentValue;
if (parameters.Properties != null)
{
JObject propertiesValue = new JObject();
deploymentValue["properties"] = propertiesValue;
if (parameters.Properties.Template != null)
{
propertiesValue["template"] = JObject.Parse(parameters.Properties.Template);
}
if (parameters.Properties.TemplateLink != null)
{
JObject templateLinkValue = new JObject();
propertiesValue["templateLink"] = templateLinkValue;
templateLinkValue["uri"] = parameters.Properties.TemplateLink.Uri.AbsoluteUri;
if (parameters.Properties.TemplateLink.ContentVersion != null)
{
templateLinkValue["contentVersion"] = parameters.Properties.TemplateLink.ContentVersion;
}
}
if (parameters.Properties.Parameters != null)
{
propertiesValue["parameters"] = JObject.Parse(parameters.Properties.Parameters);
}
if (parameters.Properties.ParametersLink != null)
{
JObject parametersLinkValue = new JObject();
propertiesValue["parametersLink"] = parametersLinkValue;
parametersLinkValue["uri"] = parameters.Properties.ParametersLink.Uri.AbsoluteUri;
if (parameters.Properties.ParametersLink.ContentVersion != null)
{
parametersLinkValue["contentVersion"] = parameters.Properties.ParametersLink.ContentVersion;
}
}
propertiesValue["mode"] = parameters.Properties.Mode.ToString();
if (parameters.Properties.DebugSetting != null)
{
JObject debugSettingValue = new JObject();
propertiesValue["debugSetting"] = debugSettingValue;
debugSettingValue["detailLevel"] = parameters.Properties.DebugSetting.DeploymentDebugDetailLevel;
}
}
requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
TracingAdapter.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
TracingAdapter.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.BadRequest)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
TracingAdapter.Error(invocationId, ex);
}
throw ex;
}
// Create Result
DeploymentValidateResponse result = null;
// Deserialize Response
if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.BadRequest)
{
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
result = new DeploymentValidateResponse();
JToken responseDoc = null;
if (string.IsNullOrEmpty(responseContent) == false)
{
responseDoc = JToken.Parse(responseContent);
}
if (responseDoc != null && responseDoc.Type != JTokenType.Null)
{
JToken errorValue = responseDoc["error"];
if (errorValue != null && errorValue.Type != JTokenType.Null)
{
ResourceManagementErrorWithDetails errorInstance = new ResourceManagementErrorWithDetails();
result.Error = errorInstance;
JToken detailsArray = errorValue["details"];
if (detailsArray != null && detailsArray.Type != JTokenType.Null)
{
foreach (JToken detailsValue in ((JArray)detailsArray))
{
ResourceManagementError resourceManagementErrorInstance = new ResourceManagementError();
errorInstance.Details.Add(resourceManagementErrorInstance);
JToken codeValue = detailsValue["code"];
if (codeValue != null && codeValue.Type != JTokenType.Null)
{
string codeInstance = ((string)codeValue);
resourceManagementErrorInstance.Code = codeInstance;
}
JToken messageValue = detailsValue["message"];
if (messageValue != null && messageValue.Type != JTokenType.Null)
{
string messageInstance = ((string)messageValue);
resourceManagementErrorInstance.Message = messageInstance;
}
JToken targetValue = detailsValue["target"];
if (targetValue != null && targetValue.Type != JTokenType.Null)
{
string targetInstance = ((string)targetValue);
resourceManagementErrorInstance.Target = targetInstance;
}
}
}
JToken codeValue2 = errorValue["code"];
if (codeValue2 != null && codeValue2.Type != JTokenType.Null)
{
string codeInstance2 = ((string)codeValue2);
errorInstance.Code = codeInstance2;
}
JToken messageValue2 = errorValue["message"];
if (messageValue2 != null && messageValue2.Type != JTokenType.Null)
{
string messageInstance2 = ((string)messageValue2);
errorInstance.Message = messageInstance2;
}
JToken targetValue2 = errorValue["target"];
if (targetValue2 != null && targetValue2.Type != JTokenType.Null)
{
string targetInstance2 = ((string)targetValue2);
errorInstance.Target = targetInstance2;
}
}
JToken propertiesValue2 = responseDoc["properties"];
if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
{
DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
result.Properties = propertiesInstance;
JToken provisioningStateValue = propertiesValue2["provisioningState"];
if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
{
string provisioningStateInstance = ((string)provisioningStateValue);
propertiesInstance.ProvisioningState = provisioningStateInstance;
}
JToken correlationIdValue = propertiesValue2["correlationId"];
if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
{
string correlationIdInstance = ((string)correlationIdValue);
propertiesInstance.CorrelationId = correlationIdInstance;
}
JToken timestampValue = propertiesValue2["timestamp"];
if (timestampValue != null && timestampValue.Type != JTokenType.Null)
{
DateTime timestampInstance = ((DateTime)timestampValue);
propertiesInstance.Timestamp = timestampInstance;
}
JToken durationValue = propertiesValue2["duration"];
if (durationValue != null && durationValue.Type != JTokenType.Null)
{
TimeSpan durationInstance = XmlConvert.ToTimeSpan(((string)durationValue));
propertiesInstance.Duration = durationInstance;
}
JToken outputsValue = propertiesValue2["outputs"];
if (outputsValue != null && outputsValue.Type != JTokenType.Null)
{
string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Outputs = outputsInstance;
}
JToken providersArray = propertiesValue2["providers"];
if (providersArray != null && providersArray.Type != JTokenType.Null)
{
foreach (JToken providersValue in ((JArray)providersArray))
{
Provider providerInstance = new Provider();
propertiesInstance.Providers.Add(providerInstance);
JToken idValue = providersValue["id"];
if (idValue != null && idValue.Type != JTokenType.Null)
{
string idInstance = ((string)idValue);
providerInstance.Id = idInstance;
}
JToken namespaceValue = providersValue["namespace"];
if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
{
string namespaceInstance = ((string)namespaceValue);
providerInstance.Namespace = namespaceInstance;
}
JToken registrationStateValue = providersValue["registrationState"];
if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
{
string registrationStateInstance = ((string)registrationStateValue);
providerInstance.RegistrationState = registrationStateInstance;
}
JToken resourceTypesArray = providersValue["resourceTypes"];
if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
{
foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
{
ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
JToken resourceTypeValue = resourceTypesValue["resourceType"];
if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
{
string resourceTypeInstance = ((string)resourceTypeValue);
providerResourceTypeInstance.Name = resourceTypeInstance;
}
JToken locationsArray = resourceTypesValue["locations"];
if (locationsArray != null && locationsArray.Type != JTokenType.Null)
{
foreach (JToken locationsValue in ((JArray)locationsArray))
{
providerResourceTypeInstance.Locations.Add(((string)locationsValue));
}
}
JToken apiVersionsArray = resourceTypesValue["apiVersions"];
if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
{
foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
{
providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
}
}
JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property in propertiesSequenceElement)
{
string propertiesKey = ((string)property.Name);
string propertiesValue3 = ((string)property.Value);
providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue3);
}
}
}
}
}
}
JToken dependenciesArray = propertiesValue2["dependencies"];
if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
{
foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
{
Dependency dependencyInstance = new Dependency();
propertiesInstance.Dependencies.Add(dependencyInstance);
JToken dependsOnArray = dependenciesValue["dependsOn"];
if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
{
BasicDependency basicDependencyInstance = new BasicDependency();
dependencyInstance.DependsOn.Add(basicDependencyInstance);
JToken idValue2 = dependsOnValue["id"];
if (idValue2 != null && idValue2.Type != JTokenType.Null)
{
string idInstance2 = ((string)idValue2);
basicDependencyInstance.Id = idInstance2;
}
JToken resourceTypeValue2 = dependsOnValue["resourceType"];
if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
{
string resourceTypeInstance2 = ((string)resourceTypeValue2);
basicDependencyInstance.ResourceType = resourceTypeInstance2;
}
JToken resourceNameValue = dependsOnValue["resourceName"];
if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
{
string resourceNameInstance = ((string)resourceNameValue);
basicDependencyInstance.ResourceName = resourceNameInstance;
}
}
}
JToken idValue3 = dependenciesValue["id"];
if (idValue3 != null && idValue3.Type != JTokenType.Null)
{
string idInstance3 = ((string)idValue3);
dependencyInstance.Id = idInstance3;
}
JToken resourceTypeValue3 = dependenciesValue["resourceType"];
if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
{
string resourceTypeInstance3 = ((string)resourceTypeValue3);
dependencyInstance.ResourceType = resourceTypeInstance3;
}
JToken resourceNameValue2 = dependenciesValue["resourceName"];
if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
{
string resourceNameInstance2 = ((string)resourceNameValue2);
dependencyInstance.ResourceName = resourceNameInstance2;
}
}
}
JToken validatedResourcesArray = propertiesValue2["validatedResources"];
if (validatedResourcesArray != null && validatedResourcesArray.Type != JTokenType.Null)
{
foreach (JToken validatedResourcesValue in ((JArray)validatedResourcesArray))
{
DeploymentPreFlightResource deploymentPreFlightResourceInstance = new DeploymentPreFlightResource();
propertiesInstance.ValidatedResources.Add(deploymentPreFlightResourceInstance);
JToken apiVersionValue = validatedResourcesValue["apiVersion"];
if (apiVersionValue != null && apiVersionValue.Type != JTokenType.Null)
{
string apiVersionInstance = ((string)apiVersionValue);
deploymentPreFlightResourceInstance.ApiVersion = apiVersionInstance;
}
JToken dependsOnArray2 = validatedResourcesValue["dependsOn"];
if (dependsOnArray2 != null && dependsOnArray2.Type != JTokenType.Null)
{
foreach (JToken dependsOnValue2 in ((JArray)dependsOnArray2))
{
deploymentPreFlightResourceInstance.DependsOn.Add(((string)dependsOnValue2));
}
}
JToken propertiesValue4 = validatedResourcesValue["properties"];
if (propertiesValue4 != null && propertiesValue4.Type != JTokenType.Null)
{
string propertiesInstance2 = propertiesValue4.ToString(Newtonsoft.Json.Formatting.Indented);
deploymentPreFlightResourceInstance.Properties = propertiesInstance2;
}
JToken provisioningStateValue2 = validatedResourcesValue["provisioningState"];
if (provisioningStateValue2 != null && provisioningStateValue2.Type != JTokenType.Null)
{
string provisioningStateInstance2 = ((string)provisioningStateValue2);
deploymentPreFlightResourceInstance.ProvisioningState = provisioningStateInstance2;
}
JToken planValue = validatedResourcesValue["plan"];
if (planValue != null && planValue.Type != JTokenType.Null)
{
Plan planInstance = new Plan();
deploymentPreFlightResourceInstance.Plan = planInstance;
JToken nameValue = planValue["name"];
if (nameValue != null && nameValue.Type != JTokenType.Null)
{
string nameInstance = ((string)nameValue);
planInstance.Name = nameInstance;
}
JToken publisherValue = planValue["publisher"];
if (publisherValue != null && publisherValue.Type != JTokenType.Null)
{
string publisherInstance = ((string)publisherValue);
planInstance.Publisher = publisherInstance;
}
JToken productValue = planValue["product"];
if (productValue != null && productValue.Type != JTokenType.Null)
{
string productInstance = ((string)productValue);
planInstance.Product = productInstance;
}
JToken promotionCodeValue = planValue["promotionCode"];
if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null)
{
string promotionCodeInstance = ((string)promotionCodeValue);
planInstance.PromotionCode = promotionCodeInstance;
}
}
JToken idValue4 = validatedResourcesValue["id"];
if (idValue4 != null && idValue4.Type != JTokenType.Null)
{
string idInstance4 = ((string)idValue4);
deploymentPreFlightResourceInstance.Id = idInstance4;
}
JToken nameValue2 = validatedResourcesValue["name"];
if (nameValue2 != null && nameValue2.Type != JTokenType.Null)
{
string nameInstance2 = ((string)nameValue2);
deploymentPreFlightResourceInstance.Name = nameInstance2;
}
JToken typeValue = validatedResourcesValue["type"];
if (typeValue != null && typeValue.Type != JTokenType.Null)
{
string typeInstance = ((string)typeValue);
deploymentPreFlightResourceInstance.Type = typeInstance;
}
JToken locationValue = validatedResourcesValue["location"];
if (locationValue != null && locationValue.Type != JTokenType.Null)
{
string locationInstance = ((string)locationValue);
deploymentPreFlightResourceInstance.Location = locationInstance;
}
JToken tagsSequenceElement = ((JToken)validatedResourcesValue["tags"]);
if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null)
{
foreach (JProperty property2 in tagsSequenceElement)
{
string tagsKey = ((string)property2.Name);
string tagsValue = ((string)property2.Value);
deploymentPreFlightResourceInstance.Tags.Add(tagsKey, tagsValue);
}
}
}
}
JToken debugSettingValue2 = propertiesValue2["debugSetting"];
if (debugSettingValue2 != null && debugSettingValue2.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance = new DeploymentDebugSetting();
propertiesInstance.DebugSettingResponse = debugSettingInstance;
JToken detailLevelValue = debugSettingValue2["detailLevel"];
if (detailLevelValue != null && detailLevelValue.Type != JTokenType.Null)
{
string detailLevelInstance = ((string)detailLevelValue);
debugSettingInstance.DeploymentDebugDetailLevel = detailLevelInstance;
}
}
JToken templateValue = propertiesValue2["template"];
if (templateValue != null && templateValue.Type != JTokenType.Null)
{
string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Template = templateInstance;
}
JToken templateLinkValue2 = propertiesValue2["templateLink"];
if (templateLinkValue2 != null && templateLinkValue2.Type != JTokenType.Null)
{
TemplateLink templateLinkInstance = new TemplateLink();
propertiesInstance.TemplateLink = templateLinkInstance;
JToken uriValue = templateLinkValue2["uri"];
if (uriValue != null && uriValue.Type != JTokenType.Null)
{
Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
templateLinkInstance.Uri = uriInstance;
}
JToken contentVersionValue = templateLinkValue2["contentVersion"];
if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
{
string contentVersionInstance = ((string)contentVersionValue);
templateLinkInstance.ContentVersion = contentVersionInstance;
}
}
JToken parametersValue = propertiesValue2["parameters"];
if (parametersValue != null && parametersValue.Type != JTokenType.Null)
{
string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
propertiesInstance.Parameters = parametersInstance;
}
JToken parametersLinkValue2 = propertiesValue2["parametersLink"];
if (parametersLinkValue2 != null && parametersLinkValue2.Type != JTokenType.Null)
{
ParametersLink parametersLinkInstance = new ParametersLink();
propertiesInstance.ParametersLink = parametersLinkInstance;
JToken uriValue2 = parametersLinkValue2["uri"];
if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
{
Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
parametersLinkInstance.Uri = uriInstance2;
}
JToken contentVersionValue2 = parametersLinkValue2["contentVersion"];
if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
{
string contentVersionInstance2 = ((string)contentVersionValue2);
parametersLinkInstance.ContentVersion = contentVersionInstance2;
}
}
JToken modeValue = propertiesValue2["mode"];
if (modeValue != null && modeValue.Type != JTokenType.Null)
{
DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
propertiesInstance.Mode = modeInstance;
}
JToken debugSettingValue3 = propertiesValue2["debugSetting"];
if (debugSettingValue3 != null && debugSettingValue3.Type != JTokenType.Null)
{
DeploymentDebugSetting debugSettingInstance2 = new DeploymentDebugSetting();
propertiesInstance.DebugSetting = debugSettingInstance2;
JToken detailLevelValue2 = debugSettingValue3["detailLevel"];
if (detailLevelValue2 != null && detailLevelValue2.Type != JTokenType.Null)
{
string detailLevelInstance2 = ((string)detailLevelValue2);
debugSettingInstance2.DeploymentDebugDetailLevel = detailLevelInstance2;
}
}
}
}
}
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (statusCode == HttpStatusCode.OK)
{
result.IsValid = true;
}
if (shouldTrace)
{
TracingAdapter.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
}
}
| 62.17363 | 188 | 0.398823 | [
"Apache-2.0"
] | CerebralMischief/azure-sdk-for-net | src/ResourceManagement/Resource/ResourceManagement/Generated/DeploymentOperations.cs | 229,172 | C# |
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Polly;
using Polly.Retry;
using U.Common.NetCore.EF;
using U.ProductService.Domain.Common;
using U.ProductService.Domain.Entities.Manufacturer;
using U.ProductService.Domain.Entities.Product;
using U.ProductService.Persistance.Contexts;
namespace U.ProductService.Application.Infrastructure
{
public class ProductContextSeeder
{
public async Task SeedAsync(ProductContext context, DbOptions dbOptions, ILogger<ProductContextSeeder> logger)
{
if (!dbOptions.Seed)
{
logger.LogInformation("Seed has not been activated.");
return;
}
var policy = CreatePolicy(logger, nameof(ProductContextSeeder));
await policy.ExecuteAsync(async () =>
{
await using (context)
{
await context.Database.MigrateAsync();
if (!context.ProductTypes.Any())
{
await context.ProductTypes.AddRangeAsync(GetPredefinedProductTypes().ToList());
}
if (!context.MimeTypes.Any())
{
await context.MimeTypes.AddRangeAsync(GetPredefinedMimeTypes().ToList());
}
if (!context.Manufacturers.Any())
{
await context.Manufacturers.AddRangeAsync(GetPredefinedManufacturer().ToList());
}
if (!context.Categories.Any())
{
await context.Categories.AddRangeAsync(GetPredefinedCategory());
}
await context.SaveChangesAsync();
}
});
}
private IEnumerable<ProductType> GetPredefinedProductTypes()
{
return Enumeration.GetAll<ProductType>();
}
private IEnumerable<MimeType> GetPredefinedMimeTypes()
{
return Enumeration.GetAll<MimeType>();
}
private Category GetPredefinedCategory()
{
return Category.GetDraftCategory();
}
private IEnumerable<Manufacturer> GetPredefinedManufacturer()
{
yield return Manufacturer.GetDraftManufacturer();
yield return new Manufacturer(Guid.Parse("0ed65687-35c3-4ca2-82bd-8e01ea80ae86"),
"Ubi-Man",
"Ubi-Man",
"Ubiquitous shop, selling everything!");
yield return new Manufacturer(Guid.Parse("990ac537-b7f7-46e4-bc8f-2a743a6cdaeb"),
"Shopcom",
"Shopcom",
"Shop that sells everything online!");
yield return new Manufacturer(Guid.Parse("7b671d69-990a-490d-80bb-2d88a8b3f797"),
"Fake-shop",
"Fake-shop",
"Does not sell anything, it's a fake shop!");
yield return new Manufacturer(Guid.Parse("d28d5a73-9ebe-4cc9-b473-b5a50c6d038c"),
"GigaWholesaleR",
"GigaWholesaleR",
"Wholesale, shipping everywhere, selling worldwide!");
}
private AsyncRetryPolicy CreatePolicy(ILogger<ProductContextSeeder> logger, string prefix, int retries = 3)
{
return Policy.Handle<SqlException>()
.WaitAndRetryAsync(
retryCount: retries,
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogWarning(exception,
"[{prefix}] Exception {ExceptionType} with message {Message} detected on attempt {retry} of {retries}",
prefix, exception.GetType().Name, exception.Message, retry, retries);
}
);
}
}
} | 34.798319 | 131 | 0.557595 | [
"MIT"
] | SebastianRuzanowski/Ubiquitous | src/Services/U.ProductService/U.ProductService.Application/Infrastructure/ProductContextSeeder.cs | 4,143 | C# |
using System;
namespace Fpl.Search.Models
{
public enum QueryClient
{
Slack,
Web,
Console
}
} | 11.909091 | 27 | 0.541985 | [
"MIT"
] | ehamberg/fplbot | src/Fpl.Search/Models/QueryAnalyticsItem.cs | 133 | C# |
using System;
namespace AsmExplorer
{
enum TypeKind {
Class,
Struct,
Interface,
Enum,
StaticClass,
Other
}
static class TypeKinds {
public static TypeKind Classify(Type type) {
if (type.IsValueType)
return TypeKind.Struct;
if (type.IsEnum)
return TypeKind.Enum;
if (type.IsClass) {
if (type.IsAbstract && type.IsSealed)
return TypeKind.StaticClass;
return TypeKind.Class;
}
if (type.IsInterface)
return TypeKind.Interface;
return TypeKind.Other;
}
public static string KindName(this TypeKind kind)
{
switch (kind)
{
case TypeKind.Class:
return "Classes";
case TypeKind.Struct:
return "Structs";
case TypeKind.Interface:
return "Interfaces";
case TypeKind.Enum:
return "Enums";
case TypeKind.StaticClass:
return "Static classes";
case TypeKind.Other:
return "Others";
default:
throw new ArgumentOutOfRangeException(nameof(kind), kind, null);
}
}
}
} | 28.882353 | 85 | 0.446707 | [
"BSD-2-Clause",
"MIT"
] | sakano/unity-asm-explorer-package | Packages/com.s-schoener.asmexplorer/Runtime/TypeKinds.cs | 1,473 | C# |
using System;
using System.Linq;
namespace Luhn.Core
{
public class LuhnChecker
{
private static readonly Predicate<string> Check = s =>
s.Select(c => int.Parse(new string(new[] {c})))
.Select((v, i) => i%2 == 0 ? v*2 : v)
.Select(v => v > 9 ? 1 + v - 10 : v)
.Sum()%10 == 0;
public static bool Validate(string input)
{
return !string.IsNullOrWhiteSpace(input)
&& !input.ToCharArray().Any(c => !char.IsNumber(c))
&& Check(input);
}
}
} | 29.55 | 70 | 0.478849 | [
"MIT"
] | hadmacker/luhncheck | Luhn.Core/LuhnChecker.cs | 593 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.ApplicationModel.UserDataTasks
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented]
#endif
public enum UserDataTaskRecurrenceUnit
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
Daily,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
Weekly,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
Monthly,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
MonthlyOnDay,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
Yearly,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
YearlyOnDay,
#endif
}
#endif
}
| 36.59375 | 99 | 0.714774 | [
"Apache-2.0"
] | Abhishek-Sharma-Msft/uno | src/Uno.UWP/Generated/3.0.0.0/Windows.ApplicationModel.UserDataTasks/UserDataTaskRecurrenceUnit.cs | 1,171 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Xml;
namespace Spectre.Console.Cli
{
[Description("Generates an XML representation of the CLI configuration.")]
[SuppressMessage("Performance", "CA1812: Avoid uninstantiated internal classes")]
internal sealed class XmlDocCommand : Command<XmlDocCommand.Settings>
{
private readonly CommandModel _model;
private readonly IAnsiConsole _writer;
public XmlDocCommand(IConfiguration configuration, CommandModel model)
{
_model = model ?? throw new ArgumentNullException(nameof(model));
_writer = configuration.Settings.Console.GetConsole();
}
public sealed class Settings : CommandSettings
{
}
public override int Execute([NotNull] CommandContext context, [NotNull] Settings settings)
{
_writer.Write(Serialize(_model), Style.Plain);
return 0;
}
public static string Serialize(CommandModel model)
{
var settings = new XmlWriterSettings
{
Indent = true,
IndentChars = " ",
NewLineChars = "\n",
OmitXmlDeclaration = false,
Encoding = Encoding.UTF8,
};
using (var buffer = new StringWriterWithEncoding(Encoding.UTF8))
using (var xmlWriter = XmlWriter.Create(buffer, settings))
{
SerializeModel(model).WriteTo(xmlWriter);
xmlWriter.Flush();
return buffer.GetStringBuilder().ToString();
}
}
private static XmlDocument SerializeModel(CommandModel model)
{
var document = new XmlDocument();
var root = document.CreateElement("Model");
if (model.DefaultCommand != null)
{
root.AppendChild(document.CreateComment("DEFAULT COMMAND"));
root.AppendChild(CreateCommandNode(document, model.DefaultCommand, isDefaultCommand: true));
}
foreach (var command in model.Commands.Where(x => !x.IsHidden))
{
root.AppendChild(document.CreateComment(command.Name.ToUpperInvariant()));
root.AppendChild(CreateCommandNode(document, command));
}
document.AppendChild(root);
return document;
}
private static XmlNode CreateCommandNode(XmlDocument doc, CommandInfo command, bool isDefaultCommand = false)
{
var node = doc.CreateElement("Command");
// Attributes
node.SetNullableAttribute("Name", command.Name);
node.SetBooleanAttribute("IsBranch", command.IsBranch);
if (isDefaultCommand)
{
node.SetBooleanAttribute("IsDefault", true);
}
if (command.CommandType != null)
{
node.SetNullableAttribute("ClrType", command.CommandType?.FullName);
}
node.SetNullableAttribute("Settings", command.SettingsType?.FullName);
// Parameters
if (command.Parameters.Count > 0)
{
var parameterRootNode = doc.CreateElement("Parameters");
foreach (var parameter in CreateParameterNodes(doc, command))
{
parameterRootNode.AppendChild(parameter);
}
node.AppendChild(parameterRootNode);
}
// Commands
foreach (var childCommand in command.Children)
{
node.AppendChild(doc.CreateComment(childCommand.Name.ToUpperInvariant()));
node.AppendChild(CreateCommandNode(doc, childCommand));
}
return node;
}
private static IEnumerable<XmlNode> CreateParameterNodes(XmlDocument document, CommandInfo command)
{
// Arguments
foreach (var argument in command.Parameters.OfType<CommandArgument>().OrderBy(x => x.Position))
{
var node = document.CreateElement("Argument");
node.SetNullableAttribute("Name", argument.Value);
node.SetAttribute("Position", argument.Position.ToString(CultureInfo.InvariantCulture));
node.SetBooleanAttribute("Required", argument.Required);
node.SetEnumAttribute("Kind", argument.ParameterKind);
node.SetNullableAttribute("ClrType", argument.ParameterType?.FullName);
if (!string.IsNullOrWhiteSpace(argument.Description))
{
var descriptionNode = document.CreateElement("Description");
descriptionNode.InnerText = argument.Description;
node.AppendChild(descriptionNode);
}
if (argument.Validators.Count > 0)
{
var validatorRootNode = document.CreateElement("Validators");
foreach (var validator in argument.Validators.OrderBy(x => x.GetType().FullName))
{
var validatorNode = document.CreateElement("Validator");
validatorNode.SetNullableAttribute("ClrType", validator.GetType().FullName);
validatorNode.SetNullableAttribute("Message", validator.ErrorMessage);
validatorRootNode.AppendChild(validatorNode);
}
node.AppendChild(validatorRootNode);
}
yield return node;
}
// Options
foreach (var option in command.Parameters.OfType<CommandOption>()
.OrderBy(x => string.Join(",", x.LongNames))
.ThenBy(x => string.Join(",", x.ShortNames)))
{
var node = document.CreateElement("Option");
if (option.IsShadowed)
{
node.SetBooleanAttribute("Shadowed", true);
}
node.SetNullableAttribute("Short", option.ShortNames);
node.SetNullableAttribute("Long", option.LongNames);
node.SetNullableAttribute("Value", option.ValueName);
node.SetBooleanAttribute("Required", option.Required);
node.SetEnumAttribute("Kind", option.ParameterKind);
node.SetNullableAttribute("ClrType", option.ParameterType?.FullName);
if (!string.IsNullOrWhiteSpace(option.Description))
{
var descriptionNode = document.CreateElement("Description");
descriptionNode.InnerText = option.Description;
node.AppendChild(descriptionNode);
}
yield return node;
}
}
}
}
| 38.135135 | 117 | 0.573494 | [
"MIT"
] | 0xced/spectre.console | src/Spectre.Console/Cli/Internal/Commands/XmlDocCommand.cs | 7,055 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.Network.V20200701.Inputs
{
/// <summary>
/// List of all Static Routes.
/// </summary>
public sealed class StaticRouteArgs : Pulumi.ResourceArgs
{
[Input("addressPrefixes")]
private InputList<string>? _addressPrefixes;
/// <summary>
/// List of all address prefixes.
/// </summary>
public InputList<string> AddressPrefixes
{
get => _addressPrefixes ?? (_addressPrefixes = new InputList<string>());
set => _addressPrefixes = value;
}
/// <summary>
/// The name of the StaticRoute that is unique within a VnetRoute.
/// </summary>
[Input("name")]
public Input<string>? Name { get; set; }
/// <summary>
/// The ip address of the next hop.
/// </summary>
[Input("nextHopIpAddress")]
public Input<string>? NextHopIpAddress { get; set; }
public StaticRouteArgs()
{
}
}
}
| 27.957447 | 84 | 0.598935 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/Network/V20200701/Inputs/StaticRouteArgs.cs | 1,314 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using FlubuCore.Context;
using FlubuCore.Tasks;
using FlubuCore.Tasks.Process;
namespace FlubuCore.Azure.Tasks.Sql
{
public partial class AzureSqlServerFirewallRuleCreateTask : ExternalProcessTaskBase<AzureSqlServerFirewallRuleCreateTask>
{
/// <summary>
/// Create a firewall rule.
/// </summary>
public AzureSqlServerFirewallRuleCreateTask(string endIpAddress = null , string name = null , string resourceGroup = null , string server = null , string startIpAddress = null)
{
WithArguments("az sql server firewall-rule create");
WithArguments("--end-ip-address");
if (!string.IsNullOrEmpty(endIpAddress))
{
WithArguments(endIpAddress);
}
WithArguments("--name");
if (!string.IsNullOrEmpty(name))
{
WithArguments(name);
}
WithArguments("--resource-group");
if (!string.IsNullOrEmpty(resourceGroup))
{
WithArguments(resourceGroup);
}
WithArguments("--server");
if (!string.IsNullOrEmpty(server))
{
WithArguments(server);
}
WithArguments("--start-ip-address");
if (!string.IsNullOrEmpty(startIpAddress))
{
WithArguments(startIpAddress);
}
}
protected override string Description { get; set; }
}
}
| 27.5 | 188 | 0.586364 | [
"MIT"
] | flubu-core/FlubuCore.Azure | FlubuCore.Azure/Tasks/Sql/AzureSqlServerFirewallRuleCreateTask.cs | 1,540 | C# |
using System.Reflection;
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("AWSSDK.ImportExport")]
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AWS Import/Export. AWS Import/Export accelerates moving large amounts of data into and out of the AWS cloud using portable storage devices for transport.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[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)]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3")]
[assembly: AssemblyFileVersion("3.7.0.49")] | 46.84375 | 233 | 0.751835 | [
"Apache-2.0"
] | mikemissakian/aws-sdk-net | sdk/code-analysis/ServiceAnalysis/ImportExport/Properties/AssemblyInfo.cs | 1,499 | C# |
using System.CommandLine;
using TodayInDestiny2.Tasks.Wrapper;
var rootCommand = new RootCommand("Today in Destiny Task Function Wrapper")
{
RefreshCurrentActivitiesCommand.GetCommand()
};
return await rootCommand.InvokeAsync(args); | 29.75 | 75 | 0.810924 | [
"MIT"
] | vivekhnz/today-in-destiny2 | tasks/wrapper/Program.cs | 240 | 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>
//------------------------------------------------------------------------------
#pragma warning disable 1591
namespace MVCProject {
/// <summary>
///Represents a strongly typed in-memory cache of data.
///</summary>
[global::System.Serializable()]
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
[global::System.Xml.Serialization.XmlRootAttribute("SistemaBibliotecaDBDataSet")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
public partial class SistemaBibliotecaDBDataSet : global::System.Data.DataSet {
private AutoresDataTable tableAutores;
private EditorasDataTable tableEditoras;
private GenerosDataTable tableGeneros;
private LivroAutorDataTable tableLivroAutor;
private LivrosDataTable tableLivros;
private LocacaoDataTable tableLocacao;
private UsuariosDataTable tableUsuarios;
private global::System.Data.DataRelation relationFK_Livros_To_Editoras;
private global::System.Data.DataRelation relationFK_Livros_To_Generos;
private global::System.Data.DataRelation relationFK_Livros_To_UsuariosAlt;
private global::System.Data.DataRelation relationFK_Livros_To_UsuariosInc;
private global::System.Data.DataRelation relationFK_Locacao_Livros;
private global::System.Data.DataRelation relationFK_Locacao_UsuAlt;
private global::System.Data.DataRelation relationFK_Locacao_UsuarioALoc;
private global::System.Data.DataRelation relationFK_Locacao_UsuInc;
private global::System.Data.DataRelation relationFK_LivroAutor_Livros;
private global::System.Data.DataRelation relationFK_LivroAutor_Autores;
private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public SistemaBibliotecaDBDataSet() {
this.BeginInit();
this.InitClass();
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
base.Tables.CollectionChanged += schemaChangedHandler;
base.Relations.CollectionChanged += schemaChangedHandler;
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected SistemaBibliotecaDBDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context, false) {
if ((this.IsBinarySerialized(info, context) == true)) {
this.InitVars(false);
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
this.Tables.CollectionChanged += schemaChangedHandler1;
this.Relations.CollectionChanged += schemaChangedHandler1;
return;
}
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
global::System.Data.DataSet ds = new global::System.Data.DataSet();
ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
if ((ds.Tables["Autores"] != null)) {
base.Tables.Add(new AutoresDataTable(ds.Tables["Autores"]));
}
if ((ds.Tables["Editoras"] != null)) {
base.Tables.Add(new EditorasDataTable(ds.Tables["Editoras"]));
}
if ((ds.Tables["Generos"] != null)) {
base.Tables.Add(new GenerosDataTable(ds.Tables["Generos"]));
}
if ((ds.Tables["LivroAutor"] != null)) {
base.Tables.Add(new LivroAutorDataTable(ds.Tables["LivroAutor"]));
}
if ((ds.Tables["Livros"] != null)) {
base.Tables.Add(new LivrosDataTable(ds.Tables["Livros"]));
}
if ((ds.Tables["Locacao"] != null)) {
base.Tables.Add(new LocacaoDataTable(ds.Tables["Locacao"]));
}
if ((ds.Tables["Usuarios"] != null)) {
base.Tables.Add(new UsuariosDataTable(ds.Tables["Usuarios"]));
}
this.DataSetName = ds.DataSetName;
this.Prefix = ds.Prefix;
this.Namespace = ds.Namespace;
this.Locale = ds.Locale;
this.CaseSensitive = ds.CaseSensitive;
this.EnforceConstraints = ds.EnforceConstraints;
this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
this.InitVars();
}
else {
this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
}
this.GetSerializationData(info, context);
global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
base.Tables.CollectionChanged += schemaChangedHandler;
this.Relations.CollectionChanged += schemaChangedHandler;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public AutoresDataTable Autores {
get {
return this.tableAutores;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public EditorasDataTable Editoras {
get {
return this.tableEditoras;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public GenerosDataTable Generos {
get {
return this.tableGeneros;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public LivroAutorDataTable LivroAutor {
get {
return this.tableLivroAutor;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public LivrosDataTable Livros {
get {
return this.tableLivros;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public LocacaoDataTable Locacao {
get {
return this.tableLocacao;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public UsuariosDataTable Usuarios {
get {
return this.tableUsuarios;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.BrowsableAttribute(true)]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)]
public override global::System.Data.SchemaSerializationMode SchemaSerializationMode {
get {
return this._schemaSerializationMode;
}
set {
this._schemaSerializationMode = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new global::System.Data.DataTableCollection Tables {
get {
return base.Tables;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new global::System.Data.DataRelationCollection Relations {
get {
return base.Relations;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void InitializeDerivedDataSet() {
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataSet Clone() {
SistemaBibliotecaDBDataSet cln = ((SistemaBibliotecaDBDataSet)(base.Clone()));
cln.InitVars();
cln.SchemaSerializationMode = this.SchemaSerializationMode;
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override bool ShouldSerializeTables() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override bool ShouldSerializeRelations() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) {
if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
this.Reset();
global::System.Data.DataSet ds = new global::System.Data.DataSet();
ds.ReadXml(reader);
if ((ds.Tables["Autores"] != null)) {
base.Tables.Add(new AutoresDataTable(ds.Tables["Autores"]));
}
if ((ds.Tables["Editoras"] != null)) {
base.Tables.Add(new EditorasDataTable(ds.Tables["Editoras"]));
}
if ((ds.Tables["Generos"] != null)) {
base.Tables.Add(new GenerosDataTable(ds.Tables["Generos"]));
}
if ((ds.Tables["LivroAutor"] != null)) {
base.Tables.Add(new LivroAutorDataTable(ds.Tables["LivroAutor"]));
}
if ((ds.Tables["Livros"] != null)) {
base.Tables.Add(new LivrosDataTable(ds.Tables["Livros"]));
}
if ((ds.Tables["Locacao"] != null)) {
base.Tables.Add(new LocacaoDataTable(ds.Tables["Locacao"]));
}
if ((ds.Tables["Usuarios"] != null)) {
base.Tables.Add(new UsuariosDataTable(ds.Tables["Usuarios"]));
}
this.DataSetName = ds.DataSetName;
this.Prefix = ds.Prefix;
this.Namespace = ds.Namespace;
this.Locale = ds.Locale;
this.CaseSensitive = ds.CaseSensitive;
this.EnforceConstraints = ds.EnforceConstraints;
this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
this.InitVars();
}
else {
this.ReadXml(reader);
this.InitVars();
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() {
global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream();
this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
stream.Position = 0;
return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.InitVars(true);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars(bool initTable) {
this.tableAutores = ((AutoresDataTable)(base.Tables["Autores"]));
if ((initTable == true)) {
if ((this.tableAutores != null)) {
this.tableAutores.InitVars();
}
}
this.tableEditoras = ((EditorasDataTable)(base.Tables["Editoras"]));
if ((initTable == true)) {
if ((this.tableEditoras != null)) {
this.tableEditoras.InitVars();
}
}
this.tableGeneros = ((GenerosDataTable)(base.Tables["Generos"]));
if ((initTable == true)) {
if ((this.tableGeneros != null)) {
this.tableGeneros.InitVars();
}
}
this.tableLivroAutor = ((LivroAutorDataTable)(base.Tables["LivroAutor"]));
if ((initTable == true)) {
if ((this.tableLivroAutor != null)) {
this.tableLivroAutor.InitVars();
}
}
this.tableLivros = ((LivrosDataTable)(base.Tables["Livros"]));
if ((initTable == true)) {
if ((this.tableLivros != null)) {
this.tableLivros.InitVars();
}
}
this.tableLocacao = ((LocacaoDataTable)(base.Tables["Locacao"]));
if ((initTable == true)) {
if ((this.tableLocacao != null)) {
this.tableLocacao.InitVars();
}
}
this.tableUsuarios = ((UsuariosDataTable)(base.Tables["Usuarios"]));
if ((initTable == true)) {
if ((this.tableUsuarios != null)) {
this.tableUsuarios.InitVars();
}
}
this.relationFK_Livros_To_Editoras = this.Relations["FK_Livros_To_Editoras"];
this.relationFK_Livros_To_Generos = this.Relations["FK_Livros_To_Generos"];
this.relationFK_Livros_To_UsuariosAlt = this.Relations["FK_Livros_To_UsuariosAlt"];
this.relationFK_Livros_To_UsuariosInc = this.Relations["FK_Livros_To_UsuariosInc"];
this.relationFK_Locacao_Livros = this.Relations["FK_Locacao_Livros"];
this.relationFK_Locacao_UsuAlt = this.Relations["FK_Locacao_UsuAlt"];
this.relationFK_Locacao_UsuarioALoc = this.Relations["FK_Locacao_UsuarioALoc"];
this.relationFK_Locacao_UsuInc = this.Relations["FK_Locacao_UsuInc"];
this.relationFK_LivroAutor_Livros = this.Relations["FK_LivroAutor_Livros"];
this.relationFK_LivroAutor_Autores = this.Relations["FK_LivroAutor_Autores"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.DataSetName = "SistemaBibliotecaDBDataSet";
this.Prefix = "";
this.Namespace = "http://tempuri.org/SistemaBibliotecaDBDataSet.xsd";
this.EnforceConstraints = true;
this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
this.tableAutores = new AutoresDataTable();
base.Tables.Add(this.tableAutores);
this.tableEditoras = new EditorasDataTable();
base.Tables.Add(this.tableEditoras);
this.tableGeneros = new GenerosDataTable();
base.Tables.Add(this.tableGeneros);
this.tableLivroAutor = new LivroAutorDataTable();
base.Tables.Add(this.tableLivroAutor);
this.tableLivros = new LivrosDataTable();
base.Tables.Add(this.tableLivros);
this.tableLocacao = new LocacaoDataTable();
base.Tables.Add(this.tableLocacao);
this.tableUsuarios = new UsuariosDataTable();
base.Tables.Add(this.tableUsuarios);
this.relationFK_Livros_To_Editoras = new global::System.Data.DataRelation("FK_Livros_To_Editoras", new global::System.Data.DataColumn[] {
this.tableEditoras.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLivros.EditoraColumn}, false);
this.Relations.Add(this.relationFK_Livros_To_Editoras);
this.relationFK_Livros_To_Generos = new global::System.Data.DataRelation("FK_Livros_To_Generos", new global::System.Data.DataColumn[] {
this.tableGeneros.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLivros.GeneroColumn}, false);
this.Relations.Add(this.relationFK_Livros_To_Generos);
this.relationFK_Livros_To_UsuariosAlt = new global::System.Data.DataRelation("FK_Livros_To_UsuariosAlt", new global::System.Data.DataColumn[] {
this.tableUsuarios.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLivros.UsuAltColumn}, false);
this.Relations.Add(this.relationFK_Livros_To_UsuariosAlt);
this.relationFK_Livros_To_UsuariosInc = new global::System.Data.DataRelation("FK_Livros_To_UsuariosInc", new global::System.Data.DataColumn[] {
this.tableUsuarios.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLivros.UsuIncColumn}, false);
this.Relations.Add(this.relationFK_Livros_To_UsuariosInc);
this.relationFK_Locacao_Livros = new global::System.Data.DataRelation("FK_Locacao_Livros", new global::System.Data.DataColumn[] {
this.tableLivros.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLocacao.LivroColumn}, false);
this.Relations.Add(this.relationFK_Locacao_Livros);
this.relationFK_Locacao_UsuAlt = new global::System.Data.DataRelation("FK_Locacao_UsuAlt", new global::System.Data.DataColumn[] {
this.tableUsuarios.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLocacao.UsuAltColumn}, false);
this.Relations.Add(this.relationFK_Locacao_UsuAlt);
this.relationFK_Locacao_UsuarioALoc = new global::System.Data.DataRelation("FK_Locacao_UsuarioALoc", new global::System.Data.DataColumn[] {
this.tableUsuarios.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLocacao.UsuarioColumn}, false);
this.Relations.Add(this.relationFK_Locacao_UsuarioALoc);
this.relationFK_Locacao_UsuInc = new global::System.Data.DataRelation("FK_Locacao_UsuInc", new global::System.Data.DataColumn[] {
this.tableUsuarios.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLocacao.UsuIncColumn}, false);
this.Relations.Add(this.relationFK_Locacao_UsuInc);
this.relationFK_LivroAutor_Livros = new global::System.Data.DataRelation("FK_LivroAutor_Livros", new global::System.Data.DataColumn[] {
this.tableLivros.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLivroAutor.LivroColumn}, false);
this.Relations.Add(this.relationFK_LivroAutor_Livros);
this.relationFK_LivroAutor_Autores = new global::System.Data.DataRelation("FK_LivroAutor_Autores", new global::System.Data.DataColumn[] {
this.tableAutores.IdColumn}, new global::System.Data.DataColumn[] {
this.tableLivroAutor.AutorColumn}, false);
this.Relations.Add(this.relationFK_LivroAutor_Autores);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeAutores() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeEditoras() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeGeneros() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeLivroAutor() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeLivros() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeLocacao() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private bool ShouldSerializeUsuarios() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) {
if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) {
this.InitVars();
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
any.Namespace = ds.Namespace;
sequence.Items.Add(any);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void AutoresRowChangeEventHandler(object sender, AutoresRowChangeEvent e);
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void EditorasRowChangeEventHandler(object sender, EditorasRowChangeEvent e);
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void GenerosRowChangeEventHandler(object sender, GenerosRowChangeEvent e);
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void LivroAutorRowChangeEventHandler(object sender, LivroAutorRowChangeEvent e);
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void LivrosRowChangeEventHandler(object sender, LivrosRowChangeEvent e);
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void LocacaoRowChangeEventHandler(object sender, LocacaoRowChangeEvent e);
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public delegate void UsuariosRowChangeEventHandler(object sender, UsuariosRowChangeEvent e);
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class AutoresDataTable : global::System.Data.TypedTableBase<AutoresRow> {
private global::System.Data.DataColumn columnId;
private global::System.Data.DataColumn columnNome;
private global::System.Data.DataColumn columnDescricao;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresDataTable() {
this.TableName = "Autores";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal AutoresDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected AutoresDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IdColumn {
get {
return this.columnId;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn NomeColumn {
get {
return this.columnNome;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DescricaoColumn {
get {
return this.columnDescricao;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRow this[int index] {
get {
return ((AutoresRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event AutoresRowChangeEventHandler AutoresRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event AutoresRowChangeEventHandler AutoresRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event AutoresRowChangeEventHandler AutoresRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event AutoresRowChangeEventHandler AutoresRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddAutoresRow(AutoresRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRow AddAutoresRow(string Nome, string Descricao) {
AutoresRow rowAutoresRow = ((AutoresRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
Nome,
Descricao};
rowAutoresRow.ItemArray = columnValuesArray;
this.Rows.Add(rowAutoresRow);
return rowAutoresRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRow FindById(int Id) {
return ((AutoresRow)(this.Rows.Find(new object[] {
Id})));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
AutoresDataTable cln = ((AutoresDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new AutoresDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnId = base.Columns["Id"];
this.columnNome = base.Columns["Nome"];
this.columnDescricao = base.Columns["Descricao"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnId = new global::System.Data.DataColumn("Id", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnId);
this.columnNome = new global::System.Data.DataColumn("Nome", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnNome);
this.columnDescricao = new global::System.Data.DataColumn("Descricao", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDescricao);
this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] {
this.columnId}, true));
this.columnId.AutoIncrement = true;
this.columnId.AutoIncrementSeed = -1;
this.columnId.AutoIncrementStep = -1;
this.columnId.AllowDBNull = false;
this.columnId.ReadOnly = true;
this.columnId.Unique = true;
this.columnNome.AllowDBNull = false;
this.columnNome.MaxLength = 100;
this.columnDescricao.MaxLength = 1000;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRow NewAutoresRow() {
return ((AutoresRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new AutoresRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(AutoresRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.AutoresRowChanged != null)) {
this.AutoresRowChanged(this, new AutoresRowChangeEvent(((AutoresRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.AutoresRowChanging != null)) {
this.AutoresRowChanging(this, new AutoresRowChangeEvent(((AutoresRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.AutoresRowDeleted != null)) {
this.AutoresRowDeleted(this, new AutoresRowChangeEvent(((AutoresRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.AutoresRowDeleting != null)) {
this.AutoresRowDeleting(this, new AutoresRowChangeEvent(((AutoresRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveAutoresRow(AutoresRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "AutoresDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class EditorasDataTable : global::System.Data.TypedTableBase<EditorasRow> {
private global::System.Data.DataColumn columnId;
private global::System.Data.DataColumn columnNome;
private global::System.Data.DataColumn columnDescricao;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasDataTable() {
this.TableName = "Editoras";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal EditorasDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected EditorasDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IdColumn {
get {
return this.columnId;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn NomeColumn {
get {
return this.columnNome;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DescricaoColumn {
get {
return this.columnDescricao;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRow this[int index] {
get {
return ((EditorasRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event EditorasRowChangeEventHandler EditorasRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event EditorasRowChangeEventHandler EditorasRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event EditorasRowChangeEventHandler EditorasRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event EditorasRowChangeEventHandler EditorasRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddEditorasRow(EditorasRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRow AddEditorasRow(string Nome, string Descricao) {
EditorasRow rowEditorasRow = ((EditorasRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
Nome,
Descricao};
rowEditorasRow.ItemArray = columnValuesArray;
this.Rows.Add(rowEditorasRow);
return rowEditorasRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRow FindById(int Id) {
return ((EditorasRow)(this.Rows.Find(new object[] {
Id})));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
EditorasDataTable cln = ((EditorasDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new EditorasDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnId = base.Columns["Id"];
this.columnNome = base.Columns["Nome"];
this.columnDescricao = base.Columns["Descricao"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnId = new global::System.Data.DataColumn("Id", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnId);
this.columnNome = new global::System.Data.DataColumn("Nome", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnNome);
this.columnDescricao = new global::System.Data.DataColumn("Descricao", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDescricao);
this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] {
this.columnId}, true));
this.columnId.AutoIncrement = true;
this.columnId.AutoIncrementSeed = -1;
this.columnId.AutoIncrementStep = -1;
this.columnId.AllowDBNull = false;
this.columnId.ReadOnly = true;
this.columnId.Unique = true;
this.columnNome.AllowDBNull = false;
this.columnNome.MaxLength = 200;
this.columnDescricao.MaxLength = 1000;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRow NewEditorasRow() {
return ((EditorasRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new EditorasRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(EditorasRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.EditorasRowChanged != null)) {
this.EditorasRowChanged(this, new EditorasRowChangeEvent(((EditorasRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.EditorasRowChanging != null)) {
this.EditorasRowChanging(this, new EditorasRowChangeEvent(((EditorasRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.EditorasRowDeleted != null)) {
this.EditorasRowDeleted(this, new EditorasRowChangeEvent(((EditorasRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.EditorasRowDeleting != null)) {
this.EditorasRowDeleting(this, new EditorasRowChangeEvent(((EditorasRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveEditorasRow(EditorasRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "EditorasDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class GenerosDataTable : global::System.Data.TypedTableBase<GenerosRow> {
private global::System.Data.DataColumn columnId;
private global::System.Data.DataColumn columnTipo;
private global::System.Data.DataColumn columnDescricao;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosDataTable() {
this.TableName = "Generos";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal GenerosDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected GenerosDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IdColumn {
get {
return this.columnId;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn TipoColumn {
get {
return this.columnTipo;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DescricaoColumn {
get {
return this.columnDescricao;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRow this[int index] {
get {
return ((GenerosRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event GenerosRowChangeEventHandler GenerosRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event GenerosRowChangeEventHandler GenerosRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event GenerosRowChangeEventHandler GenerosRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event GenerosRowChangeEventHandler GenerosRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddGenerosRow(GenerosRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRow AddGenerosRow(string Tipo, string Descricao) {
GenerosRow rowGenerosRow = ((GenerosRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
Tipo,
Descricao};
rowGenerosRow.ItemArray = columnValuesArray;
this.Rows.Add(rowGenerosRow);
return rowGenerosRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRow FindById(int Id) {
return ((GenerosRow)(this.Rows.Find(new object[] {
Id})));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
GenerosDataTable cln = ((GenerosDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new GenerosDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnId = base.Columns["Id"];
this.columnTipo = base.Columns["Tipo"];
this.columnDescricao = base.Columns["Descricao"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnId = new global::System.Data.DataColumn("Id", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnId);
this.columnTipo = new global::System.Data.DataColumn("Tipo", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnTipo);
this.columnDescricao = new global::System.Data.DataColumn("Descricao", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDescricao);
this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] {
this.columnId}, true));
this.columnId.AutoIncrement = true;
this.columnId.AutoIncrementSeed = -1;
this.columnId.AutoIncrementStep = -1;
this.columnId.AllowDBNull = false;
this.columnId.ReadOnly = true;
this.columnId.Unique = true;
this.columnTipo.AllowDBNull = false;
this.columnTipo.MaxLength = 200;
this.columnDescricao.MaxLength = 1000;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRow NewGenerosRow() {
return ((GenerosRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new GenerosRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(GenerosRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.GenerosRowChanged != null)) {
this.GenerosRowChanged(this, new GenerosRowChangeEvent(((GenerosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.GenerosRowChanging != null)) {
this.GenerosRowChanging(this, new GenerosRowChangeEvent(((GenerosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.GenerosRowDeleted != null)) {
this.GenerosRowDeleted(this, new GenerosRowChangeEvent(((GenerosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.GenerosRowDeleting != null)) {
this.GenerosRowDeleting(this, new GenerosRowChangeEvent(((GenerosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveGenerosRow(GenerosRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "GenerosDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class LivroAutorDataTable : global::System.Data.TypedTableBase<LivroAutorRow> {
private global::System.Data.DataColumn columnLivro;
private global::System.Data.DataColumn columnAutor;
private global::System.Data.DataColumn _columnAutores_Nome;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorDataTable() {
this.TableName = "LivroAutor";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal LivroAutorDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected LivroAutorDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn LivroColumn {
get {
return this.columnLivro;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn AutorColumn {
get {
return this.columnAutor;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn _Autores_NomeColumn {
get {
return this._columnAutores_Nome;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRow this[int index] {
get {
return ((LivroAutorRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivroAutorRowChangeEventHandler LivroAutorRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivroAutorRowChangeEventHandler LivroAutorRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivroAutorRowChangeEventHandler LivroAutorRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivroAutorRowChangeEventHandler LivroAutorRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddLivroAutorRow(LivroAutorRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRow AddLivroAutorRow(LivrosRow parentLivrosRowByFK_LivroAutor_Livros, AutoresRow parentAutoresRowByFK_LivroAutor_Autores, string _Autores_Nome) {
LivroAutorRow rowLivroAutorRow = ((LivroAutorRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
null,
_Autores_Nome};
if ((parentLivrosRowByFK_LivroAutor_Livros != null)) {
columnValuesArray[0] = parentLivrosRowByFK_LivroAutor_Livros[0];
}
if ((parentAutoresRowByFK_LivroAutor_Autores != null)) {
columnValuesArray[1] = parentAutoresRowByFK_LivroAutor_Autores[0];
}
rowLivroAutorRow.ItemArray = columnValuesArray;
this.Rows.Add(rowLivroAutorRow);
return rowLivroAutorRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
LivroAutorDataTable cln = ((LivroAutorDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new LivroAutorDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnLivro = base.Columns["Livro"];
this.columnAutor = base.Columns["Autor"];
this._columnAutores_Nome = base.Columns["Autores.Nome"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnLivro = new global::System.Data.DataColumn("Livro", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnLivro);
this.columnAutor = new global::System.Data.DataColumn("Autor", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnAutor);
this._columnAutores_Nome = new global::System.Data.DataColumn("Autores.Nome", typeof(string), null, global::System.Data.MappingType.Element);
this._columnAutores_Nome.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "_columnAutores_Nome");
this._columnAutores_Nome.ExtendedProperties.Add("Generator_UserColumnName", "Autores.Nome");
base.Columns.Add(this._columnAutores_Nome);
this.columnLivro.AllowDBNull = false;
this.columnAutor.AllowDBNull = false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRow NewLivroAutorRow() {
return ((LivroAutorRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new LivroAutorRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(LivroAutorRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.LivroAutorRowChanged != null)) {
this.LivroAutorRowChanged(this, new LivroAutorRowChangeEvent(((LivroAutorRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.LivroAutorRowChanging != null)) {
this.LivroAutorRowChanging(this, new LivroAutorRowChangeEvent(((LivroAutorRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.LivroAutorRowDeleted != null)) {
this.LivroAutorRowDeleted(this, new LivroAutorRowChangeEvent(((LivroAutorRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.LivroAutorRowDeleting != null)) {
this.LivroAutorRowDeleting(this, new LivroAutorRowChangeEvent(((LivroAutorRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveLivroAutorRow(LivroAutorRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "LivroAutorDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class LivrosDataTable : global::System.Data.TypedTableBase<LivrosRow> {
private global::System.Data.DataColumn columnId;
private global::System.Data.DataColumn columnRegistro;
private global::System.Data.DataColumn columnTitulo;
private global::System.Data.DataColumn columnIsbn;
private global::System.Data.DataColumn columnGenero;
private global::System.Data.DataColumn columnEditora;
private global::System.Data.DataColumn columnSinopse;
private global::System.Data.DataColumn columnObservacoes;
private global::System.Data.DataColumn columnAtivo;
private global::System.Data.DataColumn columnUsuInc;
private global::System.Data.DataColumn columnUsuAlt;
private global::System.Data.DataColumn columnDatInc;
private global::System.Data.DataColumn columnDatAlt;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosDataTable() {
this.TableName = "Livros";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal LivrosDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected LivrosDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IdColumn {
get {
return this.columnId;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn RegistroColumn {
get {
return this.columnRegistro;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn TituloColumn {
get {
return this.columnTitulo;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IsbnColumn {
get {
return this.columnIsbn;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn GeneroColumn {
get {
return this.columnGenero;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn EditoraColumn {
get {
return this.columnEditora;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn SinopseColumn {
get {
return this.columnSinopse;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn ObservacoesColumn {
get {
return this.columnObservacoes;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn AtivoColumn {
get {
return this.columnAtivo;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuIncColumn {
get {
return this.columnUsuInc;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuAltColumn {
get {
return this.columnUsuAlt;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DatIncColumn {
get {
return this.columnDatInc;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DatAltColumn {
get {
return this.columnDatAlt;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow this[int index] {
get {
return ((LivrosRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivrosRowChangeEventHandler LivrosRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivrosRowChangeEventHandler LivrosRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivrosRowChangeEventHandler LivrosRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LivrosRowChangeEventHandler LivrosRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddLivrosRow(LivrosRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow AddLivrosRow(int Registro, string Titulo, string Isbn, GenerosRow parentGenerosRowByFK_Livros_To_Generos, EditorasRow parentEditorasRowByFK_Livros_To_Editoras, string Sinopse, string Observacoes, bool Ativo, UsuariosRow parentUsuariosRowByFK_Livros_To_UsuariosInc, UsuariosRow parentUsuariosRowByFK_Livros_To_UsuariosAlt, System.DateTime DatInc, System.DateTime DatAlt) {
LivrosRow rowLivrosRow = ((LivrosRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
Registro,
Titulo,
Isbn,
null,
null,
Sinopse,
Observacoes,
Ativo,
null,
null,
DatInc,
DatAlt};
if ((parentGenerosRowByFK_Livros_To_Generos != null)) {
columnValuesArray[4] = parentGenerosRowByFK_Livros_To_Generos[0];
}
if ((parentEditorasRowByFK_Livros_To_Editoras != null)) {
columnValuesArray[5] = parentEditorasRowByFK_Livros_To_Editoras[0];
}
if ((parentUsuariosRowByFK_Livros_To_UsuariosInc != null)) {
columnValuesArray[9] = parentUsuariosRowByFK_Livros_To_UsuariosInc[0];
}
if ((parentUsuariosRowByFK_Livros_To_UsuariosAlt != null)) {
columnValuesArray[10] = parentUsuariosRowByFK_Livros_To_UsuariosAlt[0];
}
rowLivrosRow.ItemArray = columnValuesArray;
this.Rows.Add(rowLivrosRow);
return rowLivrosRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow FindById(int Id) {
return ((LivrosRow)(this.Rows.Find(new object[] {
Id})));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
LivrosDataTable cln = ((LivrosDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new LivrosDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnId = base.Columns["Id"];
this.columnRegistro = base.Columns["Registro"];
this.columnTitulo = base.Columns["Titulo"];
this.columnIsbn = base.Columns["Isbn"];
this.columnGenero = base.Columns["Genero"];
this.columnEditora = base.Columns["Editora"];
this.columnSinopse = base.Columns["Sinopse"];
this.columnObservacoes = base.Columns["Observacoes"];
this.columnAtivo = base.Columns["Ativo"];
this.columnUsuInc = base.Columns["UsuInc"];
this.columnUsuAlt = base.Columns["UsuAlt"];
this.columnDatInc = base.Columns["DatInc"];
this.columnDatAlt = base.Columns["DatAlt"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnId = new global::System.Data.DataColumn("Id", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnId);
this.columnRegistro = new global::System.Data.DataColumn("Registro", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnRegistro);
this.columnTitulo = new global::System.Data.DataColumn("Titulo", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnTitulo);
this.columnIsbn = new global::System.Data.DataColumn("Isbn", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnIsbn);
this.columnGenero = new global::System.Data.DataColumn("Genero", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnGenero);
this.columnEditora = new global::System.Data.DataColumn("Editora", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnEditora);
this.columnSinopse = new global::System.Data.DataColumn("Sinopse", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnSinopse);
this.columnObservacoes = new global::System.Data.DataColumn("Observacoes", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnObservacoes);
this.columnAtivo = new global::System.Data.DataColumn("Ativo", typeof(bool), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnAtivo);
this.columnUsuInc = new global::System.Data.DataColumn("UsuInc", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuInc);
this.columnUsuAlt = new global::System.Data.DataColumn("UsuAlt", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuAlt);
this.columnDatInc = new global::System.Data.DataColumn("DatInc", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDatInc);
this.columnDatAlt = new global::System.Data.DataColumn("DatAlt", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDatAlt);
this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] {
this.columnId}, true));
this.columnId.AutoIncrement = true;
this.columnId.AutoIncrementSeed = -1;
this.columnId.AutoIncrementStep = -1;
this.columnId.AllowDBNull = false;
this.columnId.ReadOnly = true;
this.columnId.Unique = true;
this.columnRegistro.AllowDBNull = false;
this.columnTitulo.AllowDBNull = false;
this.columnTitulo.MaxLength = 1200;
this.columnIsbn.AllowDBNull = false;
this.columnIsbn.MaxLength = 15;
this.columnGenero.AllowDBNull = false;
this.columnEditora.AllowDBNull = false;
this.columnSinopse.MaxLength = 2147483647;
this.columnObservacoes.MaxLength = 1000;
this.columnAtivo.AllowDBNull = false;
this.columnUsuInc.AllowDBNull = false;
this.columnUsuAlt.AllowDBNull = false;
this.columnDatInc.AllowDBNull = false;
this.columnDatAlt.AllowDBNull = false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow NewLivrosRow() {
return ((LivrosRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new LivrosRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(LivrosRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.LivrosRowChanged != null)) {
this.LivrosRowChanged(this, new LivrosRowChangeEvent(((LivrosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.LivrosRowChanging != null)) {
this.LivrosRowChanging(this, new LivrosRowChangeEvent(((LivrosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.LivrosRowDeleted != null)) {
this.LivrosRowDeleted(this, new LivrosRowChangeEvent(((LivrosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.LivrosRowDeleting != null)) {
this.LivrosRowDeleting(this, new LivrosRowChangeEvent(((LivrosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveLivrosRow(LivrosRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "LivrosDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class LocacaoDataTable : global::System.Data.TypedTableBase<LocacaoRow> {
private global::System.Data.DataColumn columnId;
private global::System.Data.DataColumn columnLivro;
private global::System.Data.DataColumn columnUsuario;
private global::System.Data.DataColumn columnTipo;
private global::System.Data.DataColumn columnDevolucao;
private global::System.Data.DataColumn columnAtivo;
private global::System.Data.DataColumn columnUsuInc;
private global::System.Data.DataColumn columnUsuAlt;
private global::System.Data.DataColumn columnDatInc;
private global::System.Data.DataColumn columnDatAlt;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoDataTable() {
this.TableName = "Locacao";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal LocacaoDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected LocacaoDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IdColumn {
get {
return this.columnId;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn LivroColumn {
get {
return this.columnLivro;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuarioColumn {
get {
return this.columnUsuario;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn TipoColumn {
get {
return this.columnTipo;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DevolucaoColumn {
get {
return this.columnDevolucao;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn AtivoColumn {
get {
return this.columnAtivo;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuIncColumn {
get {
return this.columnUsuInc;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuAltColumn {
get {
return this.columnUsuAlt;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DatIncColumn {
get {
return this.columnDatInc;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DatAltColumn {
get {
return this.columnDatAlt;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow this[int index] {
get {
return ((LocacaoRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LocacaoRowChangeEventHandler LocacaoRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LocacaoRowChangeEventHandler LocacaoRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LocacaoRowChangeEventHandler LocacaoRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event LocacaoRowChangeEventHandler LocacaoRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddLocacaoRow(LocacaoRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow AddLocacaoRow(LivrosRow parentLivrosRowByFK_Locacao_Livros, UsuariosRow parentUsuariosRowByFK_Locacao_UsuarioALoc, int Tipo, System.DateTime Devolucao, bool Ativo, UsuariosRow parentUsuariosRowByFK_Locacao_UsuInc, UsuariosRow parentUsuariosRowByFK_Locacao_UsuAlt, System.DateTime DatInc, System.DateTime DatAlt) {
LocacaoRow rowLocacaoRow = ((LocacaoRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
null,
null,
Tipo,
Devolucao,
Ativo,
null,
null,
DatInc,
DatAlt};
if ((parentLivrosRowByFK_Locacao_Livros != null)) {
columnValuesArray[1] = parentLivrosRowByFK_Locacao_Livros[0];
}
if ((parentUsuariosRowByFK_Locacao_UsuarioALoc != null)) {
columnValuesArray[2] = parentUsuariosRowByFK_Locacao_UsuarioALoc[0];
}
if ((parentUsuariosRowByFK_Locacao_UsuInc != null)) {
columnValuesArray[6] = parentUsuariosRowByFK_Locacao_UsuInc[0];
}
if ((parentUsuariosRowByFK_Locacao_UsuAlt != null)) {
columnValuesArray[7] = parentUsuariosRowByFK_Locacao_UsuAlt[0];
}
rowLocacaoRow.ItemArray = columnValuesArray;
this.Rows.Add(rowLocacaoRow);
return rowLocacaoRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow FindById(int Id) {
return ((LocacaoRow)(this.Rows.Find(new object[] {
Id})));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
LocacaoDataTable cln = ((LocacaoDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new LocacaoDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnId = base.Columns["Id"];
this.columnLivro = base.Columns["Livro"];
this.columnUsuario = base.Columns["Usuario"];
this.columnTipo = base.Columns["Tipo"];
this.columnDevolucao = base.Columns["Devolucao"];
this.columnAtivo = base.Columns["Ativo"];
this.columnUsuInc = base.Columns["UsuInc"];
this.columnUsuAlt = base.Columns["UsuAlt"];
this.columnDatInc = base.Columns["DatInc"];
this.columnDatAlt = base.Columns["DatAlt"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnId = new global::System.Data.DataColumn("Id", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnId);
this.columnLivro = new global::System.Data.DataColumn("Livro", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnLivro);
this.columnUsuario = new global::System.Data.DataColumn("Usuario", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuario);
this.columnTipo = new global::System.Data.DataColumn("Tipo", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnTipo);
this.columnDevolucao = new global::System.Data.DataColumn("Devolucao", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDevolucao);
this.columnAtivo = new global::System.Data.DataColumn("Ativo", typeof(bool), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnAtivo);
this.columnUsuInc = new global::System.Data.DataColumn("UsuInc", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuInc);
this.columnUsuAlt = new global::System.Data.DataColumn("UsuAlt", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuAlt);
this.columnDatInc = new global::System.Data.DataColumn("DatInc", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDatInc);
this.columnDatAlt = new global::System.Data.DataColumn("DatAlt", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDatAlt);
this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] {
this.columnId}, true));
this.columnId.AutoIncrement = true;
this.columnId.AutoIncrementSeed = -1;
this.columnId.AutoIncrementStep = -1;
this.columnId.AllowDBNull = false;
this.columnId.ReadOnly = true;
this.columnId.Unique = true;
this.columnLivro.AllowDBNull = false;
this.columnUsuario.AllowDBNull = false;
this.columnTipo.AllowDBNull = false;
this.columnDevolucao.AllowDBNull = false;
this.columnAtivo.AllowDBNull = false;
this.columnUsuInc.AllowDBNull = false;
this.columnUsuAlt.AllowDBNull = false;
this.columnDatInc.AllowDBNull = false;
this.columnDatAlt.AllowDBNull = false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow NewLocacaoRow() {
return ((LocacaoRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new LocacaoRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(LocacaoRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.LocacaoRowChanged != null)) {
this.LocacaoRowChanged(this, new LocacaoRowChangeEvent(((LocacaoRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.LocacaoRowChanging != null)) {
this.LocacaoRowChanging(this, new LocacaoRowChangeEvent(((LocacaoRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.LocacaoRowDeleted != null)) {
this.LocacaoRowDeleted(this, new LocacaoRowChangeEvent(((LocacaoRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.LocacaoRowDeleting != null)) {
this.LocacaoRowDeleting(this, new LocacaoRowChangeEvent(((LocacaoRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveLocacaoRow(LocacaoRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "LocacaoDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class UsuariosDataTable : global::System.Data.TypedTableBase<UsuariosRow> {
private global::System.Data.DataColumn columnId;
private global::System.Data.DataColumn columnNome;
private global::System.Data.DataColumn columnLogin;
private global::System.Data.DataColumn columnSenha;
private global::System.Data.DataColumn columnEmail;
private global::System.Data.DataColumn columnAtivo;
private global::System.Data.DataColumn columnUsuInc;
private global::System.Data.DataColumn columnUsuAlt;
private global::System.Data.DataColumn columnDatInc;
private global::System.Data.DataColumn columnDatAlt;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosDataTable() {
this.TableName = "Usuarios";
this.BeginInit();
this.InitClass();
this.EndInit();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal UsuariosDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
this.CaseSensitive = table.CaseSensitive;
}
if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
this.Locale = table.Locale;
}
if ((table.Namespace != table.DataSet.Namespace)) {
this.Namespace = table.Namespace;
}
this.Prefix = table.Prefix;
this.MinimumCapacity = table.MinimumCapacity;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected UsuariosDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn IdColumn {
get {
return this.columnId;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn NomeColumn {
get {
return this.columnNome;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn LoginColumn {
get {
return this.columnLogin;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn SenhaColumn {
get {
return this.columnSenha;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn EmailColumn {
get {
return this.columnEmail;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn AtivoColumn {
get {
return this.columnAtivo;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuIncColumn {
get {
return this.columnUsuInc;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn UsuAltColumn {
get {
return this.columnUsuAlt;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DatIncColumn {
get {
return this.columnDatInc;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataColumn DatAltColumn {
get {
return this.columnDatAlt;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
return this.Rows.Count;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow this[int index] {
get {
return ((UsuariosRow)(this.Rows[index]));
}
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event UsuariosRowChangeEventHandler UsuariosRowChanging;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event UsuariosRowChangeEventHandler UsuariosRowChanged;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event UsuariosRowChangeEventHandler UsuariosRowDeleting;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public event UsuariosRowChangeEventHandler UsuariosRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void AddUsuariosRow(UsuariosRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow AddUsuariosRow(string Nome, string Login, string Senha, string Email, bool Ativo, int UsuInc, int UsuAlt, System.DateTime DatInc, System.DateTime DatAlt) {
UsuariosRow rowUsuariosRow = ((UsuariosRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
null,
Nome,
Login,
Senha,
Email,
Ativo,
UsuInc,
UsuAlt,
DatInc,
DatAlt};
rowUsuariosRow.ItemArray = columnValuesArray;
this.Rows.Add(rowUsuariosRow);
return rowUsuariosRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow FindById(int Id) {
return ((UsuariosRow)(this.Rows.Find(new object[] {
Id})));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public override global::System.Data.DataTable Clone() {
UsuariosDataTable cln = ((UsuariosDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new UsuariosDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal void InitVars() {
this.columnId = base.Columns["Id"];
this.columnNome = base.Columns["Nome"];
this.columnLogin = base.Columns["Login"];
this.columnSenha = base.Columns["Senha"];
this.columnEmail = base.Columns["Email"];
this.columnAtivo = base.Columns["Ativo"];
this.columnUsuInc = base.Columns["UsuInc"];
this.columnUsuAlt = base.Columns["UsuAlt"];
this.columnDatInc = base.Columns["DatInc"];
this.columnDatAlt = base.Columns["DatAlt"];
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitClass() {
this.columnId = new global::System.Data.DataColumn("Id", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnId);
this.columnNome = new global::System.Data.DataColumn("Nome", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnNome);
this.columnLogin = new global::System.Data.DataColumn("Login", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnLogin);
this.columnSenha = new global::System.Data.DataColumn("Senha", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnSenha);
this.columnEmail = new global::System.Data.DataColumn("Email", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnEmail);
this.columnAtivo = new global::System.Data.DataColumn("Ativo", typeof(bool), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnAtivo);
this.columnUsuInc = new global::System.Data.DataColumn("UsuInc", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuInc);
this.columnUsuAlt = new global::System.Data.DataColumn("UsuAlt", typeof(int), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnUsuAlt);
this.columnDatInc = new global::System.Data.DataColumn("DatInc", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDatInc);
this.columnDatAlt = new global::System.Data.DataColumn("DatAlt", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDatAlt);
this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] {
this.columnId}, true));
this.columnId.AutoIncrement = true;
this.columnId.AutoIncrementSeed = -1;
this.columnId.AutoIncrementStep = -1;
this.columnId.AllowDBNull = false;
this.columnId.ReadOnly = true;
this.columnId.Unique = true;
this.columnNome.AllowDBNull = false;
this.columnNome.MaxLength = 100;
this.columnLogin.AllowDBNull = false;
this.columnLogin.MaxLength = 50;
this.columnSenha.AllowDBNull = false;
this.columnSenha.MaxLength = 50;
this.columnEmail.AllowDBNull = false;
this.columnEmail.MaxLength = 100;
this.columnAtivo.AllowDBNull = false;
this.columnUsuInc.AllowDBNull = false;
this.columnUsuAlt.AllowDBNull = false;
this.columnDatInc.AllowDBNull = false;
this.columnDatAlt.AllowDBNull = false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow NewUsuariosRow() {
return ((UsuariosRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new UsuariosRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(UsuariosRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.UsuariosRowChanged != null)) {
this.UsuariosRowChanged(this, new UsuariosRowChangeEvent(((UsuariosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.UsuariosRowChanging != null)) {
this.UsuariosRowChanging(this, new UsuariosRowChangeEvent(((UsuariosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.UsuariosRowDeleted != null)) {
this.UsuariosRowDeleted(this, new UsuariosRowChangeEvent(((UsuariosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.UsuariosRowDeleting != null)) {
this.UsuariosRowDeleting(this, new UsuariosRowChangeEvent(((UsuariosRow)(e.Row)), e.Action));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void RemoveUsuariosRow(UsuariosRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
SistemaBibliotecaDBDataSet ds = new SistemaBibliotecaDBDataSet();
global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
any1.Namespace = "http://www.w3.org/2001/XMLSchema";
any1.MinOccurs = new decimal(0);
any1.MaxOccurs = decimal.MaxValue;
any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any1);
global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
any2.MinOccurs = new decimal(1);
any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any2);
global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute1.Name = "namespace";
attribute1.FixedValue = ds.Namespace;
type.Attributes.Add(attribute1);
global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
attribute2.Name = "tableTypeName";
attribute2.FixedValue = "UsuariosDataTable";
type.Attributes.Add(attribute2);
type.Particle = sequence;
global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
if (xs.Contains(dsSchema.TargetNamespace)) {
global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
try {
global::System.Xml.Schema.XmlSchema schema = null;
dsSchema.Write(s1);
for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
s2.SetLength(0);
schema.Write(s2);
if ((s1.Length == s2.Length)) {
s1.Position = 0;
s2.Position = 0;
for (; ((s1.Position != s1.Length)
&& (s1.ReadByte() == s2.ReadByte())); ) {
;
}
if ((s1.Position == s1.Length)) {
return type;
}
}
}
}
finally {
if ((s1 != null)) {
s1.Close();
}
if ((s2 != null)) {
s2.Close();
}
}
}
xs.Add(dsSchema);
return type;
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class AutoresRow : global::System.Data.DataRow {
private AutoresDataTable tableAutores;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal AutoresRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableAutores = ((AutoresDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Id {
get {
return ((int)(this[this.tableAutores.IdColumn]));
}
set {
this[this.tableAutores.IdColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Nome {
get {
return ((string)(this[this.tableAutores.NomeColumn]));
}
set {
this[this.tableAutores.NomeColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Descricao {
get {
try {
return ((string)(this[this.tableAutores.DescricaoColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'Descricao\' in table \'Autores\' is DBNull.", e);
}
}
set {
this[this.tableAutores.DescricaoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool IsDescricaoNull() {
return this.IsNull(this.tableAutores.DescricaoColumn);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void SetDescricaoNull() {
this[this.tableAutores.DescricaoColumn] = global::System.Convert.DBNull;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRow[] GetLivroAutorRows() {
if ((this.Table.ChildRelations["FK_LivroAutor_Autores"] == null)) {
return new LivroAutorRow[0];
}
else {
return ((LivroAutorRow[])(base.GetChildRows(this.Table.ChildRelations["FK_LivroAutor_Autores"])));
}
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class EditorasRow : global::System.Data.DataRow {
private EditorasDataTable tableEditoras;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal EditorasRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableEditoras = ((EditorasDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Id {
get {
return ((int)(this[this.tableEditoras.IdColumn]));
}
set {
this[this.tableEditoras.IdColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Nome {
get {
return ((string)(this[this.tableEditoras.NomeColumn]));
}
set {
this[this.tableEditoras.NomeColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Descricao {
get {
try {
return ((string)(this[this.tableEditoras.DescricaoColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'Descricao\' in table \'Editoras\' is DBNull.", e);
}
}
set {
this[this.tableEditoras.DescricaoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool IsDescricaoNull() {
return this.IsNull(this.tableEditoras.DescricaoColumn);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void SetDescricaoNull() {
this[this.tableEditoras.DescricaoColumn] = global::System.Convert.DBNull;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow[] GetLivrosRows() {
if ((this.Table.ChildRelations["FK_Livros_To_Editoras"] == null)) {
return new LivrosRow[0];
}
else {
return ((LivrosRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Livros_To_Editoras"])));
}
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class GenerosRow : global::System.Data.DataRow {
private GenerosDataTable tableGeneros;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal GenerosRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableGeneros = ((GenerosDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Id {
get {
return ((int)(this[this.tableGeneros.IdColumn]));
}
set {
this[this.tableGeneros.IdColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Tipo {
get {
return ((string)(this[this.tableGeneros.TipoColumn]));
}
set {
this[this.tableGeneros.TipoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Descricao {
get {
try {
return ((string)(this[this.tableGeneros.DescricaoColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'Descricao\' in table \'Generos\' is DBNull.", e);
}
}
set {
this[this.tableGeneros.DescricaoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool IsDescricaoNull() {
return this.IsNull(this.tableGeneros.DescricaoColumn);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void SetDescricaoNull() {
this[this.tableGeneros.DescricaoColumn] = global::System.Convert.DBNull;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow[] GetLivrosRows() {
if ((this.Table.ChildRelations["FK_Livros_To_Generos"] == null)) {
return new LivrosRow[0];
}
else {
return ((LivrosRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Livros_To_Generos"])));
}
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class LivroAutorRow : global::System.Data.DataRow {
private LivroAutorDataTable tableLivroAutor;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal LivroAutorRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableLivroAutor = ((LivroAutorDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Livro {
get {
return ((int)(this[this.tableLivroAutor.LivroColumn]));
}
set {
this[this.tableLivroAutor.LivroColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Autor {
get {
return ((int)(this[this.tableLivroAutor.AutorColumn]));
}
set {
this[this.tableLivroAutor.AutorColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string _Autores_Nome {
get {
try {
return ((string)(this[this.tableLivroAutor._Autores_NomeColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'Autores.Nome\' in table \'LivroAutor\' is DBNull.", e);
}
}
set {
this[this.tableLivroAutor._Autores_NomeColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow LivrosRow {
get {
return ((LivrosRow)(this.GetParentRow(this.Table.ParentRelations["FK_LivroAutor_Livros"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_LivroAutor_Livros"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRow AutoresRow {
get {
return ((AutoresRow)(this.GetParentRow(this.Table.ParentRelations["FK_LivroAutor_Autores"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_LivroAutor_Autores"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool Is_Autores_NomeNull() {
return this.IsNull(this.tableLivroAutor._Autores_NomeColumn);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void Set_Autores_NomeNull() {
this[this.tableLivroAutor._Autores_NomeColumn] = global::System.Convert.DBNull;
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class LivrosRow : global::System.Data.DataRow {
private LivrosDataTable tableLivros;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal LivrosRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableLivros = ((LivrosDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Id {
get {
return ((int)(this[this.tableLivros.IdColumn]));
}
set {
this[this.tableLivros.IdColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Registro {
get {
return ((int)(this[this.tableLivros.RegistroColumn]));
}
set {
this[this.tableLivros.RegistroColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Titulo {
get {
return ((string)(this[this.tableLivros.TituloColumn]));
}
set {
this[this.tableLivros.TituloColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Isbn {
get {
return ((string)(this[this.tableLivros.IsbnColumn]));
}
set {
this[this.tableLivros.IsbnColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Genero {
get {
return ((int)(this[this.tableLivros.GeneroColumn]));
}
set {
this[this.tableLivros.GeneroColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Editora {
get {
return ((int)(this[this.tableLivros.EditoraColumn]));
}
set {
this[this.tableLivros.EditoraColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Sinopse {
get {
try {
return ((string)(this[this.tableLivros.SinopseColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'Sinopse\' in table \'Livros\' is DBNull.", e);
}
}
set {
this[this.tableLivros.SinopseColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Observacoes {
get {
try {
return ((string)(this[this.tableLivros.ObservacoesColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'Observacoes\' in table \'Livros\' is DBNull.", e);
}
}
set {
this[this.tableLivros.ObservacoesColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool Ativo {
get {
return ((bool)(this[this.tableLivros.AtivoColumn]));
}
set {
this[this.tableLivros.AtivoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int UsuInc {
get {
return ((int)(this[this.tableLivros.UsuIncColumn]));
}
set {
this[this.tableLivros.UsuIncColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int UsuAlt {
get {
return ((int)(this[this.tableLivros.UsuAltColumn]));
}
set {
this[this.tableLivros.UsuAltColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime DatInc {
get {
return ((global::System.DateTime)(this[this.tableLivros.DatIncColumn]));
}
set {
this[this.tableLivros.DatIncColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime DatAlt {
get {
return ((global::System.DateTime)(this[this.tableLivros.DatAltColumn]));
}
set {
this[this.tableLivros.DatAltColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRow EditorasRow {
get {
return ((EditorasRow)(this.GetParentRow(this.Table.ParentRelations["FK_Livros_To_Editoras"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Livros_To_Editoras"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRow GenerosRow {
get {
return ((GenerosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Livros_To_Generos"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Livros_To_Generos"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow UsuariosRowByFK_Livros_To_UsuariosAlt {
get {
return ((UsuariosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Livros_To_UsuariosAlt"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Livros_To_UsuariosAlt"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow UsuariosRowByFK_Livros_To_UsuariosInc {
get {
return ((UsuariosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Livros_To_UsuariosInc"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Livros_To_UsuariosInc"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool IsSinopseNull() {
return this.IsNull(this.tableLivros.SinopseColumn);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void SetSinopseNull() {
this[this.tableLivros.SinopseColumn] = global::System.Convert.DBNull;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool IsObservacoesNull() {
return this.IsNull(this.tableLivros.ObservacoesColumn);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public void SetObservacoesNull() {
this[this.tableLivros.ObservacoesColumn] = global::System.Convert.DBNull;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow[] GetLocacaoRows() {
if ((this.Table.ChildRelations["FK_Locacao_Livros"] == null)) {
return new LocacaoRow[0];
}
else {
return ((LocacaoRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Locacao_Livros"])));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRow[] GetLivroAutorRows() {
if ((this.Table.ChildRelations["FK_LivroAutor_Livros"] == null)) {
return new LivroAutorRow[0];
}
else {
return ((LivroAutorRow[])(base.GetChildRows(this.Table.ChildRelations["FK_LivroAutor_Livros"])));
}
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class LocacaoRow : global::System.Data.DataRow {
private LocacaoDataTable tableLocacao;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal LocacaoRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableLocacao = ((LocacaoDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Id {
get {
return ((int)(this[this.tableLocacao.IdColumn]));
}
set {
this[this.tableLocacao.IdColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Livro {
get {
return ((int)(this[this.tableLocacao.LivroColumn]));
}
set {
this[this.tableLocacao.LivroColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Usuario {
get {
return ((int)(this[this.tableLocacao.UsuarioColumn]));
}
set {
this[this.tableLocacao.UsuarioColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Tipo {
get {
return ((int)(this[this.tableLocacao.TipoColumn]));
}
set {
this[this.tableLocacao.TipoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime Devolucao {
get {
return ((global::System.DateTime)(this[this.tableLocacao.DevolucaoColumn]));
}
set {
this[this.tableLocacao.DevolucaoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool Ativo {
get {
return ((bool)(this[this.tableLocacao.AtivoColumn]));
}
set {
this[this.tableLocacao.AtivoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int UsuInc {
get {
return ((int)(this[this.tableLocacao.UsuIncColumn]));
}
set {
this[this.tableLocacao.UsuIncColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int UsuAlt {
get {
return ((int)(this[this.tableLocacao.UsuAltColumn]));
}
set {
this[this.tableLocacao.UsuAltColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime DatInc {
get {
return ((global::System.DateTime)(this[this.tableLocacao.DatIncColumn]));
}
set {
this[this.tableLocacao.DatIncColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime DatAlt {
get {
return ((global::System.DateTime)(this[this.tableLocacao.DatAltColumn]));
}
set {
this[this.tableLocacao.DatAltColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow LivrosRow {
get {
return ((LivrosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Locacao_Livros"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Locacao_Livros"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow UsuariosRowByFK_Locacao_UsuAlt {
get {
return ((UsuariosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Locacao_UsuAlt"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Locacao_UsuAlt"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow UsuariosRowByFK_Locacao_UsuarioALoc {
get {
return ((UsuariosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Locacao_UsuarioALoc"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Locacao_UsuarioALoc"]);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow UsuariosRowByFK_Locacao_UsuInc {
get {
return ((UsuariosRow)(this.GetParentRow(this.Table.ParentRelations["FK_Locacao_UsuInc"])));
}
set {
this.SetParentRow(value, this.Table.ParentRelations["FK_Locacao_UsuInc"]);
}
}
}
/// <summary>
///Represents strongly named DataRow class.
///</summary>
public partial class UsuariosRow : global::System.Data.DataRow {
private UsuariosDataTable tableUsuarios;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal UsuariosRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableUsuarios = ((UsuariosDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Id {
get {
return ((int)(this[this.tableUsuarios.IdColumn]));
}
set {
this[this.tableUsuarios.IdColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Nome {
get {
return ((string)(this[this.tableUsuarios.NomeColumn]));
}
set {
this[this.tableUsuarios.NomeColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Login {
get {
return ((string)(this[this.tableUsuarios.LoginColumn]));
}
set {
this[this.tableUsuarios.LoginColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Senha {
get {
return ((string)(this[this.tableUsuarios.SenhaColumn]));
}
set {
this[this.tableUsuarios.SenhaColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public string Email {
get {
return ((string)(this[this.tableUsuarios.EmailColumn]));
}
set {
this[this.tableUsuarios.EmailColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool Ativo {
get {
return ((bool)(this[this.tableUsuarios.AtivoColumn]));
}
set {
this[this.tableUsuarios.AtivoColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int UsuInc {
get {
return ((int)(this[this.tableUsuarios.UsuIncColumn]));
}
set {
this[this.tableUsuarios.UsuIncColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int UsuAlt {
get {
return ((int)(this[this.tableUsuarios.UsuAltColumn]));
}
set {
this[this.tableUsuarios.UsuAltColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime DatInc {
get {
return ((global::System.DateTime)(this[this.tableUsuarios.DatIncColumn]));
}
set {
this[this.tableUsuarios.DatIncColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public System.DateTime DatAlt {
get {
return ((global::System.DateTime)(this[this.tableUsuarios.DatAltColumn]));
}
set {
this[this.tableUsuarios.DatAltColumn] = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow[] GetLivrosRowsByFK_Livros_To_UsuariosAlt() {
if ((this.Table.ChildRelations["FK_Livros_To_UsuariosAlt"] == null)) {
return new LivrosRow[0];
}
else {
return ((LivrosRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Livros_To_UsuariosAlt"])));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow[] GetLivrosRowsByFK_Livros_To_UsuariosInc() {
if ((this.Table.ChildRelations["FK_Livros_To_UsuariosInc"] == null)) {
return new LivrosRow[0];
}
else {
return ((LivrosRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Livros_To_UsuariosInc"])));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow[] GetLocacaoRowsByFK_Locacao_UsuAlt() {
if ((this.Table.ChildRelations["FK_Locacao_UsuAlt"] == null)) {
return new LocacaoRow[0];
}
else {
return ((LocacaoRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Locacao_UsuAlt"])));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow[] GetLocacaoRowsByFK_Locacao_UsuarioALoc() {
if ((this.Table.ChildRelations["FK_Locacao_UsuarioALoc"] == null)) {
return new LocacaoRow[0];
}
else {
return ((LocacaoRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Locacao_UsuarioALoc"])));
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow[] GetLocacaoRowsByFK_Locacao_UsuInc() {
if ((this.Table.ChildRelations["FK_Locacao_UsuInc"] == null)) {
return new LocacaoRow[0];
}
else {
return ((LocacaoRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Locacao_UsuInc"])));
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class AutoresRowChangeEvent : global::System.EventArgs {
private AutoresRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRowChangeEvent(AutoresRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class EditorasRowChangeEvent : global::System.EventArgs {
private EditorasRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRowChangeEvent(EditorasRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class GenerosRowChangeEvent : global::System.EventArgs {
private GenerosRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRowChangeEvent(GenerosRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class LivroAutorRowChangeEvent : global::System.EventArgs {
private LivroAutorRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRowChangeEvent(LivroAutorRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class LivrosRowChangeEvent : global::System.EventArgs {
private LivrosRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRowChangeEvent(LivrosRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class LocacaoRowChangeEvent : global::System.EventArgs {
private LocacaoRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRowChangeEvent(LocacaoRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
/// <summary>
///Row event argument class
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public class UsuariosRowChangeEvent : global::System.EventArgs {
private UsuariosRow eventRow;
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRowChangeEvent(UsuariosRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosRow Row {
get {
return this.eventRow;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
}
}
}
}
}
namespace MVCProject.SistemaBibliotecaDBDataSetTableAdapters {
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class AutoresTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public AutoresTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Autores";
tableMapping.ColumnMappings.Add("Id", "Id");
tableMapping.ColumnMappings.Add("Nome", "Nome");
tableMapping.ColumnMappings.Add("Descricao", "Descricao");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[Autores] WHERE (([Id] = @Original_Id) AND ([Nome] = @Original_" +
"Nome) AND ((@IsNull_Descricao = 1 AND [Descricao] IS NULL) OR ([Descricao] = @Or" +
"iginal_Descricao)))";
this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Descricao", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[Autores] ([Nome], [Descricao]) VALUES (@Nome, @Descricao);\r\nSE" +
"LECT Id, Nome, Descricao FROM Autores WHERE (Id = SCOPE_IDENTITY())";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.UpdateCommand.Connection = this.Connection;
this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Autores] SET [Nome] = @Nome, [Descricao] = @Descricao WHERE (([Id] = @Original_Id) AND ([Nome] = @Original_Nome) AND ((@IsNull_Descricao = 1 AND [Descricao] IS NULL) OR ([Descricao] = @Original_Descricao)));
SELECT Id, Nome, Descricao FROM Autores WHERE (Id = @Id)";
this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Descricao", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Id, Nome, Descricao FROM dbo.Autores";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.AutoresDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.AutoresDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.AutoresDataTable dataTable = new SistemaBibliotecaDBDataSet.AutoresDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.AutoresDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "Autores");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(int Original_Id, string Original_Nome, string Original_Descricao) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
if ((Original_Nome == null)) {
throw new global::System.ArgumentNullException("Original_Nome");
}
else {
this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(Original_Nome));
}
if ((Original_Descricao == null)) {
this.Adapter.DeleteCommand.Parameters[2].Value = ((object)(1));
this.Adapter.DeleteCommand.Parameters[3].Value = global::System.DBNull.Value;
}
else {
this.Adapter.DeleteCommand.Parameters[2].Value = ((object)(0));
this.Adapter.DeleteCommand.Parameters[3].Value = ((string)(Original_Descricao));
}
global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(string Nome, string Descricao) {
if ((Nome == null)) {
throw new global::System.ArgumentNullException("Nome");
}
else {
this.Adapter.InsertCommand.Parameters[0].Value = ((string)(Nome));
}
if ((Descricao == null)) {
this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.InsertCommand.Parameters[1].Value = ((string)(Descricao));
}
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(string Nome, string Descricao, int Original_Id, string Original_Nome, string Original_Descricao, int Id) {
if ((Nome == null)) {
throw new global::System.ArgumentNullException("Nome");
}
else {
this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(Nome));
}
if ((Descricao == null)) {
this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Descricao));
}
this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(Original_Id));
if ((Original_Nome == null)) {
throw new global::System.ArgumentNullException("Original_Nome");
}
else {
this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Original_Nome));
}
if ((Original_Descricao == null)) {
this.Adapter.UpdateCommand.Parameters[4].Value = ((object)(1));
this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[4].Value = ((object)(0));
this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(Original_Descricao));
}
this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(Id));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.UpdateCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.UpdateCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(string Nome, string Descricao, int Original_Id, string Original_Nome, string Original_Descricao) {
return this.Update(Nome, Descricao, Original_Id, Original_Nome, Original_Descricao, Original_Id);
}
}
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class EditorasTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public EditorasTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Editoras";
tableMapping.ColumnMappings.Add("Id", "Id");
tableMapping.ColumnMappings.Add("Nome", "Nome");
tableMapping.ColumnMappings.Add("Descricao", "Descricao");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[Editoras] WHERE (([Id] = @Original_Id) AND ([Nome] = @Original" +
"_Nome) AND ((@IsNull_Descricao = 1 AND [Descricao] IS NULL) OR ([Descricao] = @O" +
"riginal_Descricao)))";
this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Descricao", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[Editoras] ([Nome], [Descricao]) VALUES (@Nome, @Descricao);\r\nS" +
"ELECT Id, Nome, Descricao FROM Editoras WHERE (Id = SCOPE_IDENTITY())";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.UpdateCommand.Connection = this.Connection;
this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Editoras] SET [Nome] = @Nome, [Descricao] = @Descricao WHERE (([Id] = @Original_Id) AND ([Nome] = @Original_Nome) AND ((@IsNull_Descricao = 1 AND [Descricao] IS NULL) OR ([Descricao] = @Original_Descricao)));
SELECT Id, Nome, Descricao FROM Editoras WHERE (Id = @Id)";
this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Descricao", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Id, Nome, Descricao FROM dbo.Editoras";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.EditorasDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.EditorasDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.EditorasDataTable dataTable = new SistemaBibliotecaDBDataSet.EditorasDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.EditorasDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "Editoras");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(int Original_Id, string Original_Nome, string Original_Descricao) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
if ((Original_Nome == null)) {
throw new global::System.ArgumentNullException("Original_Nome");
}
else {
this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(Original_Nome));
}
if ((Original_Descricao == null)) {
this.Adapter.DeleteCommand.Parameters[2].Value = ((object)(1));
this.Adapter.DeleteCommand.Parameters[3].Value = global::System.DBNull.Value;
}
else {
this.Adapter.DeleteCommand.Parameters[2].Value = ((object)(0));
this.Adapter.DeleteCommand.Parameters[3].Value = ((string)(Original_Descricao));
}
global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(string Nome, string Descricao) {
if ((Nome == null)) {
throw new global::System.ArgumentNullException("Nome");
}
else {
this.Adapter.InsertCommand.Parameters[0].Value = ((string)(Nome));
}
if ((Descricao == null)) {
this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.InsertCommand.Parameters[1].Value = ((string)(Descricao));
}
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(string Nome, string Descricao, int Original_Id, string Original_Nome, string Original_Descricao, int Id) {
if ((Nome == null)) {
throw new global::System.ArgumentNullException("Nome");
}
else {
this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(Nome));
}
if ((Descricao == null)) {
this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Descricao));
}
this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(Original_Id));
if ((Original_Nome == null)) {
throw new global::System.ArgumentNullException("Original_Nome");
}
else {
this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Original_Nome));
}
if ((Original_Descricao == null)) {
this.Adapter.UpdateCommand.Parameters[4].Value = ((object)(1));
this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[4].Value = ((object)(0));
this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(Original_Descricao));
}
this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(Id));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.UpdateCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.UpdateCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(string Nome, string Descricao, int Original_Id, string Original_Nome, string Original_Descricao) {
return this.Update(Nome, Descricao, Original_Id, Original_Nome, Original_Descricao, Original_Id);
}
}
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class GenerosTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public GenerosTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Generos";
tableMapping.ColumnMappings.Add("Id", "Id");
tableMapping.ColumnMappings.Add("Tipo", "Tipo");
tableMapping.ColumnMappings.Add("Descricao", "Descricao");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[Generos] WHERE (([Id] = @Original_Id) AND ([Tipo] = @Original_" +
"Tipo) AND ((@IsNull_Descricao = 1 AND [Descricao] IS NULL) OR ([Descricao] = @Or" +
"iginal_Descricao)))";
this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Tipo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Descricao", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[Generos] ([Tipo], [Descricao]) VALUES (@Tipo, @Descricao);\r\nSE" +
"LECT Id, Tipo, Descricao FROM Generos WHERE (Id = SCOPE_IDENTITY())";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Tipo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.UpdateCommand.Connection = this.Connection;
this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Generos] SET [Tipo] = @Tipo, [Descricao] = @Descricao WHERE (([Id] = @Original_Id) AND ([Tipo] = @Original_Tipo) AND ((@IsNull_Descricao = 1 AND [Descricao] IS NULL) OR ([Descricao] = @Original_Descricao)));
SELECT Id, Tipo, Descricao FROM Generos WHERE (Id = @Id)";
this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Tipo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Tipo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Descricao", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Descricao", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Descricao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Id, Tipo, Descricao FROM dbo.Generos";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.GenerosDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.GenerosDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.GenerosDataTable dataTable = new SistemaBibliotecaDBDataSet.GenerosDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.GenerosDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "Generos");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(int Original_Id, string Original_Tipo, string Original_Descricao) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
if ((Original_Tipo == null)) {
throw new global::System.ArgumentNullException("Original_Tipo");
}
else {
this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(Original_Tipo));
}
if ((Original_Descricao == null)) {
this.Adapter.DeleteCommand.Parameters[2].Value = ((object)(1));
this.Adapter.DeleteCommand.Parameters[3].Value = global::System.DBNull.Value;
}
else {
this.Adapter.DeleteCommand.Parameters[2].Value = ((object)(0));
this.Adapter.DeleteCommand.Parameters[3].Value = ((string)(Original_Descricao));
}
global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(string Tipo, string Descricao) {
if ((Tipo == null)) {
throw new global::System.ArgumentNullException("Tipo");
}
else {
this.Adapter.InsertCommand.Parameters[0].Value = ((string)(Tipo));
}
if ((Descricao == null)) {
this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.InsertCommand.Parameters[1].Value = ((string)(Descricao));
}
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(string Tipo, string Descricao, int Original_Id, string Original_Tipo, string Original_Descricao, int Id) {
if ((Tipo == null)) {
throw new global::System.ArgumentNullException("Tipo");
}
else {
this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(Tipo));
}
if ((Descricao == null)) {
this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Descricao));
}
this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(Original_Id));
if ((Original_Tipo == null)) {
throw new global::System.ArgumentNullException("Original_Tipo");
}
else {
this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Original_Tipo));
}
if ((Original_Descricao == null)) {
this.Adapter.UpdateCommand.Parameters[4].Value = ((object)(1));
this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[4].Value = ((object)(0));
this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(Original_Descricao));
}
this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(Id));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.UpdateCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.UpdateCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(string Tipo, string Descricao, int Original_Id, string Original_Tipo, string Original_Descricao) {
return this.Update(Tipo, Descricao, Original_Id, Original_Tipo, Original_Descricao, Original_Id);
}
}
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class LivroAutorTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivroAutorTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "LivroAutor";
tableMapping.ColumnMappings.Add("Livro", "Livro");
tableMapping.ColumnMappings.Add("Autor", "Autor");
tableMapping.ColumnMappings.Add("Autores.Nome", "Autores.Nome");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[LivroAutor] ([Livro], [Autor]) VALUES (@Livro, @Autor)";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Livro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Livro", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Autor", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Autor", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Livro, Autor FROM dbo.LivroAutor";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "SELECT LivroAutor.Livro, LivroAutor.Autor, Autores.Nome as \'Autores.Nome\'\r\nFROM " +
" LivroAutor INNER JOIN\r\n Autores ON LivroAutor.Autor = Autore" +
"s.Id\r\nWHERE LivroAutor.Livro = @LivroId";
this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@LivroId", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Livro", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.LivroAutorDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.LivroAutorDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.LivroAutorDataTable dataTable = new SistemaBibliotecaDBDataSet.LivroAutorDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, false)]
public virtual int FillBy(SistemaBibliotecaDBDataSet.LivroAutorDataTable dataTable, int LivroId) {
this.Adapter.SelectCommand = this.CommandCollection[1];
this.Adapter.SelectCommand.Parameters[0].Value = ((int)(LivroId));
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual SistemaBibliotecaDBDataSet.LivroAutorDataTable GetDataBy(int LivroId) {
this.Adapter.SelectCommand = this.CommandCollection[1];
this.Adapter.SelectCommand.Parameters[0].Value = ((int)(LivroId));
SistemaBibliotecaDBDataSet.LivroAutorDataTable dataTable = new SistemaBibliotecaDBDataSet.LivroAutorDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.LivroAutorDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "LivroAutor");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(int Livro, int Autor) {
this.Adapter.InsertCommand.Parameters[0].Value = ((int)(Livro));
this.Adapter.InsertCommand.Parameters[1].Value = ((int)(Autor));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
}
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class LivrosTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LivrosTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Livros";
tableMapping.ColumnMappings.Add("Id", "Id");
tableMapping.ColumnMappings.Add("Registro", "Registro");
tableMapping.ColumnMappings.Add("Titulo", "Titulo");
tableMapping.ColumnMappings.Add("Isbn", "Isbn");
tableMapping.ColumnMappings.Add("Genero", "Genero");
tableMapping.ColumnMappings.Add("Editora", "Editora");
tableMapping.ColumnMappings.Add("Sinopse", "Sinopse");
tableMapping.ColumnMappings.Add("Observacoes", "Observacoes");
tableMapping.ColumnMappings.Add("Ativo", "Ativo");
tableMapping.ColumnMappings.Add("UsuInc", "UsuInc");
tableMapping.ColumnMappings.Add("UsuAlt", "UsuAlt");
tableMapping.ColumnMappings.Add("DatInc", "DatInc");
tableMapping.ColumnMappings.Add("DatAlt", "DatAlt");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[Livros] WHERE (([Id] = @Original_Id) AND ([Registro] = @Original_Registro) AND ([Titulo] = @Original_Titulo) AND ([Isbn] = @Original_Isbn) AND ([Genero] = @Original_Genero) AND ([Editora] = @Original_Editora) AND ((@IsNull_Observacoes = 1 AND [Observacoes] IS NULL) OR ([Observacoes] = @Original_Observacoes)) AND ([Ativo] = @Original_Ativo) AND ([UsuInc] = @Original_UsuInc) AND ([UsuAlt] = @Original_UsuAlt) AND ([DatInc] = @Original_DatInc) AND ([DatAlt] = @Original_DatAlt))";
this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Registro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Registro", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Titulo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Titulo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Isbn", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Isbn", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Genero", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Genero", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Editora", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Editora", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Observacoes", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Observacoes", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Observacoes", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Observacoes", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[Livros] ([Registro], [Titulo], [Isbn], [Genero], [Editora], [Sinopse], [Observacoes], [Ativo], [UsuInc], [UsuAlt], [DatInc], [DatAlt]) VALUES (@Registro, @Titulo, @Isbn, @Genero, @Editora, @Sinopse, @Observacoes, @Ativo, @UsuInc, @UsuAlt, @DatInc, @DatAlt);
SELECT Id, Registro, Titulo, Isbn, Genero, Editora, Sinopse, Observacoes, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM Livros WHERE (Id = SCOPE_IDENTITY())";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Registro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Registro", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Titulo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Titulo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Isbn", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Isbn", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Genero", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Genero", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Editora", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Editora", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Sinopse", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Sinopse", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Observacoes", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Observacoes", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.UpdateCommand.Connection = this.Connection;
this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Livros] SET [Registro] = @Registro, [Titulo] = @Titulo, [Isbn] = @Isbn, [Genero] = @Genero, [Editora] = @Editora, [Sinopse] = @Sinopse, [Observacoes] = @Observacoes, [Ativo] = @Ativo, [UsuInc] = @UsuInc, [UsuAlt] = @UsuAlt, [DatInc] = @DatInc, [DatAlt] = @DatAlt WHERE (([Id] = @Original_Id) AND ([Registro] = @Original_Registro) AND ([Titulo] = @Original_Titulo) AND ([Isbn] = @Original_Isbn) AND ([Genero] = @Original_Genero) AND ([Editora] = @Original_Editora) AND ((@IsNull_Observacoes = 1 AND [Observacoes] IS NULL) OR ([Observacoes] = @Original_Observacoes)) AND ([Ativo] = @Original_Ativo) AND ([UsuInc] = @Original_UsuInc) AND ([UsuAlt] = @Original_UsuAlt) AND ([DatInc] = @Original_DatInc) AND ([DatAlt] = @Original_DatAlt));
SELECT Id, Registro, Titulo, Isbn, Genero, Editora, Sinopse, Observacoes, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM Livros WHERE (Id = @Id)";
this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Registro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Registro", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Titulo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Titulo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Isbn", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Isbn", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Genero", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Genero", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Editora", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Editora", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Sinopse", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Sinopse", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Observacoes", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Observacoes", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Registro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Registro", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Titulo", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Titulo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Isbn", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Isbn", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Genero", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Genero", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Editora", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Editora", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Observacoes", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Observacoes", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Observacoes", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Observacoes", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Id, Registro, Titulo, Isbn, Genero, Editora, Sinopse, Observacoes, Ativo, " +
"UsuInc, UsuAlt, DatInc, DatAlt FROM dbo.Livros";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "SELECT *\r\nFROM Livros INNER JOIN\r\n LivroAutor ON Livros.Id =" +
" LivroAutor.Livro\r\nWHERE (LivroAutor.Autor = @AutorId)";
this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@AutorId", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Autor", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.LivrosDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.LivrosDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.LivrosDataTable dataTable = new SistemaBibliotecaDBDataSet.LivrosDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, false)]
public virtual int FillBy(SistemaBibliotecaDBDataSet.LivrosDataTable dataTable, int AutorId) {
this.Adapter.SelectCommand = this.CommandCollection[1];
this.Adapter.SelectCommand.Parameters[0].Value = ((int)(AutorId));
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual SistemaBibliotecaDBDataSet.LivrosDataTable GetDataBy(int AutorId) {
this.Adapter.SelectCommand = this.CommandCollection[1];
this.Adapter.SelectCommand.Parameters[0].Value = ((int)(AutorId));
SistemaBibliotecaDBDataSet.LivrosDataTable dataTable = new SistemaBibliotecaDBDataSet.LivrosDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.LivrosDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "Livros");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(int Original_Id, int Original_Registro, string Original_Titulo, string Original_Isbn, int Original_Genero, int Original_Editora, string Original_Observacoes, bool Original_Ativo, int Original_UsuInc, int Original_UsuAlt, System.DateTime Original_DatInc, System.DateTime Original_DatAlt) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
this.Adapter.DeleteCommand.Parameters[1].Value = ((int)(Original_Registro));
if ((Original_Titulo == null)) {
throw new global::System.ArgumentNullException("Original_Titulo");
}
else {
this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_Titulo));
}
if ((Original_Isbn == null)) {
throw new global::System.ArgumentNullException("Original_Isbn");
}
else {
this.Adapter.DeleteCommand.Parameters[3].Value = ((string)(Original_Isbn));
}
this.Adapter.DeleteCommand.Parameters[4].Value = ((int)(Original_Genero));
this.Adapter.DeleteCommand.Parameters[5].Value = ((int)(Original_Editora));
if ((Original_Observacoes == null)) {
this.Adapter.DeleteCommand.Parameters[6].Value = ((object)(1));
this.Adapter.DeleteCommand.Parameters[7].Value = global::System.DBNull.Value;
}
else {
this.Adapter.DeleteCommand.Parameters[6].Value = ((object)(0));
this.Adapter.DeleteCommand.Parameters[7].Value = ((string)(Original_Observacoes));
}
this.Adapter.DeleteCommand.Parameters[8].Value = ((bool)(Original_Ativo));
this.Adapter.DeleteCommand.Parameters[9].Value = ((int)(Original_UsuInc));
this.Adapter.DeleteCommand.Parameters[10].Value = ((int)(Original_UsuAlt));
this.Adapter.DeleteCommand.Parameters[11].Value = ((System.DateTime)(Original_DatInc));
this.Adapter.DeleteCommand.Parameters[12].Value = ((System.DateTime)(Original_DatAlt));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(int Registro, string Titulo, string Isbn, int Genero, int Editora, string Sinopse, string Observacoes, bool Ativo, int UsuInc, int UsuAlt, System.DateTime DatInc, System.DateTime DatAlt) {
this.Adapter.InsertCommand.Parameters[0].Value = ((int)(Registro));
if ((Titulo == null)) {
throw new global::System.ArgumentNullException("Titulo");
}
else {
this.Adapter.InsertCommand.Parameters[1].Value = ((string)(Titulo));
}
if ((Isbn == null)) {
throw new global::System.ArgumentNullException("Isbn");
}
else {
this.Adapter.InsertCommand.Parameters[2].Value = ((string)(Isbn));
}
this.Adapter.InsertCommand.Parameters[3].Value = ((int)(Genero));
this.Adapter.InsertCommand.Parameters[4].Value = ((int)(Editora));
if ((Sinopse == null)) {
this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value;
}
else {
this.Adapter.InsertCommand.Parameters[5].Value = ((string)(Sinopse));
}
if ((Observacoes == null)) {
this.Adapter.InsertCommand.Parameters[6].Value = global::System.DBNull.Value;
}
else {
this.Adapter.InsertCommand.Parameters[6].Value = ((string)(Observacoes));
}
this.Adapter.InsertCommand.Parameters[7].Value = ((bool)(Ativo));
this.Adapter.InsertCommand.Parameters[8].Value = ((int)(UsuInc));
this.Adapter.InsertCommand.Parameters[9].Value = ((int)(UsuAlt));
this.Adapter.InsertCommand.Parameters[10].Value = ((System.DateTime)(DatInc));
this.Adapter.InsertCommand.Parameters[11].Value = ((System.DateTime)(DatAlt));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(
int Registro,
string Titulo,
string Isbn,
int Genero,
int Editora,
string Sinopse,
string Observacoes,
bool Ativo,
int UsuInc,
int UsuAlt,
System.DateTime DatInc,
System.DateTime DatAlt,
int Original_Id,
int Original_Registro,
string Original_Titulo,
string Original_Isbn,
int Original_Genero,
int Original_Editora,
string Original_Observacoes,
bool Original_Ativo,
int Original_UsuInc,
int Original_UsuAlt,
System.DateTime Original_DatInc,
System.DateTime Original_DatAlt,
int Id) {
this.Adapter.UpdateCommand.Parameters[0].Value = ((int)(Registro));
if ((Titulo == null)) {
throw new global::System.ArgumentNullException("Titulo");
}
else {
this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Titulo));
}
if ((Isbn == null)) {
throw new global::System.ArgumentNullException("Isbn");
}
else {
this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(Isbn));
}
this.Adapter.UpdateCommand.Parameters[3].Value = ((int)(Genero));
this.Adapter.UpdateCommand.Parameters[4].Value = ((int)(Editora));
if ((Sinopse == null)) {
this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(Sinopse));
}
if ((Observacoes == null)) {
this.Adapter.UpdateCommand.Parameters[6].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[6].Value = ((string)(Observacoes));
}
this.Adapter.UpdateCommand.Parameters[7].Value = ((bool)(Ativo));
this.Adapter.UpdateCommand.Parameters[8].Value = ((int)(UsuInc));
this.Adapter.UpdateCommand.Parameters[9].Value = ((int)(UsuAlt));
this.Adapter.UpdateCommand.Parameters[10].Value = ((System.DateTime)(DatInc));
this.Adapter.UpdateCommand.Parameters[11].Value = ((System.DateTime)(DatAlt));
this.Adapter.UpdateCommand.Parameters[12].Value = ((int)(Original_Id));
this.Adapter.UpdateCommand.Parameters[13].Value = ((int)(Original_Registro));
if ((Original_Titulo == null)) {
throw new global::System.ArgumentNullException("Original_Titulo");
}
else {
this.Adapter.UpdateCommand.Parameters[14].Value = ((string)(Original_Titulo));
}
if ((Original_Isbn == null)) {
throw new global::System.ArgumentNullException("Original_Isbn");
}
else {
this.Adapter.UpdateCommand.Parameters[15].Value = ((string)(Original_Isbn));
}
this.Adapter.UpdateCommand.Parameters[16].Value = ((int)(Original_Genero));
this.Adapter.UpdateCommand.Parameters[17].Value = ((int)(Original_Editora));
if ((Original_Observacoes == null)) {
this.Adapter.UpdateCommand.Parameters[18].Value = ((object)(1));
this.Adapter.UpdateCommand.Parameters[19].Value = global::System.DBNull.Value;
}
else {
this.Adapter.UpdateCommand.Parameters[18].Value = ((object)(0));
this.Adapter.UpdateCommand.Parameters[19].Value = ((string)(Original_Observacoes));
}
this.Adapter.UpdateCommand.Parameters[20].Value = ((bool)(Original_Ativo));
this.Adapter.UpdateCommand.Parameters[21].Value = ((int)(Original_UsuInc));
this.Adapter.UpdateCommand.Parameters[22].Value = ((int)(Original_UsuAlt));
this.Adapter.UpdateCommand.Parameters[23].Value = ((System.DateTime)(Original_DatInc));
this.Adapter.UpdateCommand.Parameters[24].Value = ((System.DateTime)(Original_DatAlt));
this.Adapter.UpdateCommand.Parameters[25].Value = ((int)(Id));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.UpdateCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.UpdateCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(
int Registro,
string Titulo,
string Isbn,
int Genero,
int Editora,
string Sinopse,
string Observacoes,
bool Ativo,
int UsuInc,
int UsuAlt,
System.DateTime DatInc,
System.DateTime DatAlt,
int Original_Id,
int Original_Registro,
string Original_Titulo,
string Original_Isbn,
int Original_Genero,
int Original_Editora,
string Original_Observacoes,
bool Original_Ativo,
int Original_UsuInc,
int Original_UsuAlt,
System.DateTime Original_DatInc,
System.DateTime Original_DatAlt) {
return this.Update(Registro, Titulo, Isbn, Genero, Editora, Sinopse, Observacoes, Ativo, UsuInc, UsuAlt, DatInc, DatAlt, Original_Id, Original_Registro, Original_Titulo, Original_Isbn, Original_Genero, Original_Editora, Original_Observacoes, Original_Ativo, Original_UsuInc, Original_UsuAlt, Original_DatInc, Original_DatAlt, Original_Id);
}
}
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class LocacaoTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public LocacaoTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Locacao";
tableMapping.ColumnMappings.Add("Id", "Id");
tableMapping.ColumnMappings.Add("Livro", "Livro");
tableMapping.ColumnMappings.Add("Usuario", "Usuario");
tableMapping.ColumnMappings.Add("Tipo", "Tipo");
tableMapping.ColumnMappings.Add("Devolucao", "Devolucao");
tableMapping.ColumnMappings.Add("Ativo", "Ativo");
tableMapping.ColumnMappings.Add("UsuInc", "UsuInc");
tableMapping.ColumnMappings.Add("UsuAlt", "UsuAlt");
tableMapping.ColumnMappings.Add("DatInc", "DatInc");
tableMapping.ColumnMappings.Add("DatAlt", "DatAlt");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[Locacao] WHERE (([Id] = @Original_Id) AND ([Livro] = @Original_Livro) AND ([Usuario] = @Original_Usuario) AND ([Tipo] = @Original_Tipo) AND ([Devolucao] = @Original_Devolucao) AND ([Ativo] = @Original_Ativo) AND ([UsuInc] = @Original_UsuInc) AND ([UsuAlt] = @Original_UsuAlt) AND ([DatInc] = @Original_DatInc) AND ([DatAlt] = @Original_DatAlt))";
this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Livro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Livro", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Usuario", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Usuario", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Tipo", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Devolucao", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Devolucao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[Locacao] ([Livro], [Usuario], [Tipo], [Devolucao], [Ativo], [UsuInc], [UsuAlt], [DatInc], [DatAlt]) VALUES (@Livro, @Usuario, @Tipo, @Devolucao, @Ativo, @UsuInc, @UsuAlt, @DatInc, @DatAlt);
SELECT Id, Livro, Usuario, Tipo, Devolucao, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM Locacao WHERE (Id = SCOPE_IDENTITY())";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Livro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Livro", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Usuario", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Usuario", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Tipo", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Devolucao", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Devolucao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.UpdateCommand.Connection = this.Connection;
this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Locacao] SET [Livro] = @Livro, [Usuario] = @Usuario, [Tipo] = @Tipo, [Devolucao] = @Devolucao, [Ativo] = @Ativo, [UsuInc] = @UsuInc, [UsuAlt] = @UsuAlt, [DatInc] = @DatInc, [DatAlt] = @DatAlt WHERE (([Id] = @Original_Id) AND ([Livro] = @Original_Livro) AND ([Usuario] = @Original_Usuario) AND ([Tipo] = @Original_Tipo) AND ([Devolucao] = @Original_Devolucao) AND ([Ativo] = @Original_Ativo) AND ([UsuInc] = @Original_UsuInc) AND ([UsuAlt] = @Original_UsuAlt) AND ([DatInc] = @Original_DatInc) AND ([DatAlt] = @Original_DatAlt));
SELECT Id, Livro, Usuario, Tipo, Devolucao, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM Locacao WHERE (Id = @Id)";
this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Livro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Livro", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Usuario", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Usuario", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Tipo", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Devolucao", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Devolucao", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Livro", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Livro", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Usuario", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Usuario", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Tipo", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Tipo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Devolucao", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Devolucao", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Id, Livro, Usuario, Tipo, Devolucao, Ativo, UsuInc, UsuAlt, DatInc, DatAlt" +
" FROM dbo.Locacao";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.LocacaoDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.LocacaoDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.LocacaoDataTable dataTable = new SistemaBibliotecaDBDataSet.LocacaoDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.LocacaoDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "Locacao");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(int Original_Id, int Original_Livro, int Original_Usuario, int Original_Tipo, System.DateTime Original_Devolucao, bool Original_Ativo, int Original_UsuInc, int Original_UsuAlt, System.DateTime Original_DatInc, System.DateTime Original_DatAlt) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
this.Adapter.DeleteCommand.Parameters[1].Value = ((int)(Original_Livro));
this.Adapter.DeleteCommand.Parameters[2].Value = ((int)(Original_Usuario));
this.Adapter.DeleteCommand.Parameters[3].Value = ((int)(Original_Tipo));
this.Adapter.DeleteCommand.Parameters[4].Value = ((System.DateTime)(Original_Devolucao));
this.Adapter.DeleteCommand.Parameters[5].Value = ((bool)(Original_Ativo));
this.Adapter.DeleteCommand.Parameters[6].Value = ((int)(Original_UsuInc));
this.Adapter.DeleteCommand.Parameters[7].Value = ((int)(Original_UsuAlt));
this.Adapter.DeleteCommand.Parameters[8].Value = ((System.DateTime)(Original_DatInc));
this.Adapter.DeleteCommand.Parameters[9].Value = ((System.DateTime)(Original_DatAlt));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(int Livro, int Usuario, int Tipo, System.DateTime Devolucao, bool Ativo, int UsuInc, int UsuAlt, System.DateTime DatInc, System.DateTime DatAlt) {
this.Adapter.InsertCommand.Parameters[0].Value = ((int)(Livro));
this.Adapter.InsertCommand.Parameters[1].Value = ((int)(Usuario));
this.Adapter.InsertCommand.Parameters[2].Value = ((int)(Tipo));
this.Adapter.InsertCommand.Parameters[3].Value = ((System.DateTime)(Devolucao));
this.Adapter.InsertCommand.Parameters[4].Value = ((bool)(Ativo));
this.Adapter.InsertCommand.Parameters[5].Value = ((int)(UsuInc));
this.Adapter.InsertCommand.Parameters[6].Value = ((int)(UsuAlt));
this.Adapter.InsertCommand.Parameters[7].Value = ((System.DateTime)(DatInc));
this.Adapter.InsertCommand.Parameters[8].Value = ((System.DateTime)(DatAlt));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(
int Livro,
int Usuario,
int Tipo,
System.DateTime Devolucao,
bool Ativo,
int UsuInc,
int UsuAlt,
System.DateTime DatInc,
System.DateTime DatAlt,
int Original_Id,
int Original_Livro,
int Original_Usuario,
int Original_Tipo,
System.DateTime Original_Devolucao,
bool Original_Ativo,
int Original_UsuInc,
int Original_UsuAlt,
System.DateTime Original_DatInc,
System.DateTime Original_DatAlt,
int Id) {
this.Adapter.UpdateCommand.Parameters[0].Value = ((int)(Livro));
this.Adapter.UpdateCommand.Parameters[1].Value = ((int)(Usuario));
this.Adapter.UpdateCommand.Parameters[2].Value = ((int)(Tipo));
this.Adapter.UpdateCommand.Parameters[3].Value = ((System.DateTime)(Devolucao));
this.Adapter.UpdateCommand.Parameters[4].Value = ((bool)(Ativo));
this.Adapter.UpdateCommand.Parameters[5].Value = ((int)(UsuInc));
this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(UsuAlt));
this.Adapter.UpdateCommand.Parameters[7].Value = ((System.DateTime)(DatInc));
this.Adapter.UpdateCommand.Parameters[8].Value = ((System.DateTime)(DatAlt));
this.Adapter.UpdateCommand.Parameters[9].Value = ((int)(Original_Id));
this.Adapter.UpdateCommand.Parameters[10].Value = ((int)(Original_Livro));
this.Adapter.UpdateCommand.Parameters[11].Value = ((int)(Original_Usuario));
this.Adapter.UpdateCommand.Parameters[12].Value = ((int)(Original_Tipo));
this.Adapter.UpdateCommand.Parameters[13].Value = ((System.DateTime)(Original_Devolucao));
this.Adapter.UpdateCommand.Parameters[14].Value = ((bool)(Original_Ativo));
this.Adapter.UpdateCommand.Parameters[15].Value = ((int)(Original_UsuInc));
this.Adapter.UpdateCommand.Parameters[16].Value = ((int)(Original_UsuAlt));
this.Adapter.UpdateCommand.Parameters[17].Value = ((System.DateTime)(Original_DatInc));
this.Adapter.UpdateCommand.Parameters[18].Value = ((System.DateTime)(Original_DatAlt));
this.Adapter.UpdateCommand.Parameters[19].Value = ((int)(Id));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.UpdateCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.UpdateCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(
int Livro,
int Usuario,
int Tipo,
System.DateTime Devolucao,
bool Ativo,
int UsuInc,
int UsuAlt,
System.DateTime DatInc,
System.DateTime DatAlt,
int Original_Id,
int Original_Livro,
int Original_Usuario,
int Original_Tipo,
System.DateTime Original_Devolucao,
bool Original_Ativo,
int Original_UsuInc,
int Original_UsuAlt,
System.DateTime Original_DatInc,
System.DateTime Original_DatAlt) {
return this.Update(Livro, Usuario, Tipo, Devolucao, Ativo, UsuInc, UsuAlt, DatInc, DatAlt, Original_Id, Original_Livro, Original_Usuario, Original_Tipo, Original_Devolucao, Original_Ativo, Original_UsuInc, Original_UsuAlt, Original_DatInc, Original_DatAlt, Original_Id);
}
}
/// <summary>
///Represents the connection and commands used to retrieve and save data.
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DataObjectAttribute(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public partial class UsuariosTableAdapter : global::System.ComponentModel.Component {
private global::System.Data.SqlClient.SqlDataAdapter _adapter;
private global::System.Data.SqlClient.SqlConnection _connection;
private global::System.Data.SqlClient.SqlTransaction _transaction;
private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
private bool _clearBeforeFill;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UsuariosTableAdapter() {
this.ClearBeforeFill = true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
get {
if ((this._adapter == null)) {
this.InitAdapter();
}
return this._adapter;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlConnection Connection {
get {
if ((this._connection == null)) {
this.InitConnection();
}
return this._connection;
}
set {
this._connection = value;
if ((this.Adapter.InsertCommand != null)) {
this.Adapter.InsertCommand.Connection = value;
}
if ((this.Adapter.DeleteCommand != null)) {
this.Adapter.DeleteCommand.Connection = value;
}
if ((this.Adapter.UpdateCommand != null)) {
this.Adapter.UpdateCommand.Connection = value;
}
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
if ((this.CommandCollection[i] != null)) {
((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
this.CommandCollection[i].Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction = this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction = this._transaction;
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
get {
if ((this._commandCollection == null)) {
this.InitCommandCollection();
}
return this._commandCollection;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool ClearBeforeFill {
get {
return this._clearBeforeFill;
}
set {
this._clearBeforeFill = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitAdapter() {
this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
tableMapping.SourceTable = "Table";
tableMapping.DataSetTable = "Usuarios";
tableMapping.ColumnMappings.Add("Id", "Id");
tableMapping.ColumnMappings.Add("Nome", "Nome");
tableMapping.ColumnMappings.Add("Login", "Login");
tableMapping.ColumnMappings.Add("Senha", "Senha");
tableMapping.ColumnMappings.Add("Email", "Email");
tableMapping.ColumnMappings.Add("Ativo", "Ativo");
tableMapping.ColumnMappings.Add("UsuInc", "UsuInc");
tableMapping.ColumnMappings.Add("UsuAlt", "UsuAlt");
tableMapping.ColumnMappings.Add("DatInc", "DatInc");
tableMapping.ColumnMappings.Add("DatAlt", "DatAlt");
this._adapter.TableMappings.Add(tableMapping);
this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.DeleteCommand.Connection = this.Connection;
this._adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[Usuarios] WHERE (([Id] = @Original_Id) AND ([Nome] = @Original_Nome) AND ([Login] = @Original_Login) AND ([Senha] = @Original_Senha) AND ([Email] = @Original_Email) AND ([Ativo] = @Original_Ativo) AND ([UsuInc] = @Original_UsuInc) AND ([UsuAlt] = @Original_UsuAlt) AND ([DatInc] = @Original_DatInc) AND ([DatAlt] = @Original_DatAlt))";
this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Login", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Login", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Senha", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Senha", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Email", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Email", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.InsertCommand.Connection = this.Connection;
this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[Usuarios] ([Nome], [Login], [Senha], [Email], [Ativo], [UsuInc], [UsuAlt], [DatInc], [DatAlt]) VALUES (@Nome, @Login, @Senha, @Email, @Ativo, @UsuInc, @UsuAlt, @DatInc, @DatAlt);
SELECT Id, Nome, Login, Senha, Email, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM Usuarios WHERE (Id = SCOPE_IDENTITY())";
this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Login", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Login", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Senha", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Senha", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Email", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Email", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
this._adapter.UpdateCommand.Connection = this.Connection;
this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Usuarios] SET [Nome] = @Nome, [Login] = @Login, [Senha] = @Senha, [Email] = @Email, [Ativo] = @Ativo, [UsuInc] = @UsuInc, [UsuAlt] = @UsuAlt, [DatInc] = @DatInc, [DatAlt] = @DatAlt WHERE (([Id] = @Original_Id) AND ([Nome] = @Original_Nome) AND ([Login] = @Original_Login) AND ([Senha] = @Original_Senha) AND ([Email] = @Original_Email) AND ([Ativo] = @Original_Ativo) AND ([UsuInc] = @Original_UsuInc) AND ([UsuAlt] = @Original_UsuAlt) AND ([DatInc] = @Original_DatInc) AND ([DatAlt] = @Original_DatAlt));
SELECT Id, Nome, Login, Senha, Email, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM Usuarios WHERE (Id = @Id)";
this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Login", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Login", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Senha", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Senha", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Email", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Email", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Id", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Nome", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Nome", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Login", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Login", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Senha", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Senha", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Email", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Email", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Ativo", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Ativo", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuInc", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_UsuAlt", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "UsuAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatInc", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatInc", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_DatAlt", global::System.Data.SqlDbType.DateTime, 0, global::System.Data.ParameterDirection.Input, 0, 0, "DatAlt", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Id", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "Id", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitConnection() {
this._connection = new global::System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::MVCProject.Properties.Settings.Default.SistemaBibliotecaDBConnectionString;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT Id, Nome, Login, Senha, Email, Ativo, UsuInc, UsuAlt, DatInc, DatAlt FROM " +
"dbo.Usuarios";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "SELECT Id\r\nFROM Usuarios\r\nWHERE (Login = @login) AND (Senha = @senha)";
this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@login", global::System.Data.SqlDbType.VarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, "Login", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@senha", global::System.Data.SqlDbType.VarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, "Senha", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(SistemaBibliotecaDBDataSet.UsuariosDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}
int returnValue = this.Adapter.Fill(dataTable);
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
public virtual SistemaBibliotecaDBDataSet.UsuariosDataTable GetData() {
this.Adapter.SelectCommand = this.CommandCollection[0];
SistemaBibliotecaDBDataSet.UsuariosDataTable dataTable = new SistemaBibliotecaDBDataSet.UsuariosDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet.UsuariosDataTable dataTable) {
return this.Adapter.Update(dataTable);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(SistemaBibliotecaDBDataSet dataSet) {
return this.Adapter.Update(dataSet, "Usuarios");
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow dataRow) {
return this.Adapter.Update(new global::System.Data.DataRow[] {
dataRow});
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int Update(global::System.Data.DataRow[] dataRows) {
return this.Adapter.Update(dataRows);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
public virtual int Delete(int Original_Id, string Original_Nome, string Original_Login, string Original_Senha, string Original_Email, bool Original_Ativo, int Original_UsuInc, int Original_UsuAlt, System.DateTime Original_DatInc, System.DateTime Original_DatAlt) {
this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_Id));
if ((Original_Nome == null)) {
throw new global::System.ArgumentNullException("Original_Nome");
}
else {
this.Adapter.DeleteCommand.Parameters[1].Value = ((string)(Original_Nome));
}
if ((Original_Login == null)) {
throw new global::System.ArgumentNullException("Original_Login");
}
else {
this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_Login));
}
if ((Original_Senha == null)) {
throw new global::System.ArgumentNullException("Original_Senha");
}
else {
this.Adapter.DeleteCommand.Parameters[3].Value = ((string)(Original_Senha));
}
if ((Original_Email == null)) {
throw new global::System.ArgumentNullException("Original_Email");
}
else {
this.Adapter.DeleteCommand.Parameters[4].Value = ((string)(Original_Email));
}
this.Adapter.DeleteCommand.Parameters[5].Value = ((bool)(Original_Ativo));
this.Adapter.DeleteCommand.Parameters[6].Value = ((int)(Original_UsuInc));
this.Adapter.DeleteCommand.Parameters[7].Value = ((int)(Original_UsuAlt));
this.Adapter.DeleteCommand.Parameters[8].Value = ((System.DateTime)(Original_DatInc));
this.Adapter.DeleteCommand.Parameters[9].Value = ((System.DateTime)(Original_DatAlt));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.DeleteCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.DeleteCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
public virtual int Insert(string Nome, string Login, string Senha, string Email, bool Ativo, int UsuInc, int UsuAlt, System.DateTime DatInc, System.DateTime DatAlt) {
if ((Nome == null)) {
throw new global::System.ArgumentNullException("Nome");
}
else {
this.Adapter.InsertCommand.Parameters[0].Value = ((string)(Nome));
}
if ((Login == null)) {
throw new global::System.ArgumentNullException("Login");
}
else {
this.Adapter.InsertCommand.Parameters[1].Value = ((string)(Login));
}
if ((Senha == null)) {
throw new global::System.ArgumentNullException("Senha");
}
else {
this.Adapter.InsertCommand.Parameters[2].Value = ((string)(Senha));
}
if ((Email == null)) {
throw new global::System.ArgumentNullException("Email");
}
else {
this.Adapter.InsertCommand.Parameters[3].Value = ((string)(Email));
}
this.Adapter.InsertCommand.Parameters[4].Value = ((bool)(Ativo));
this.Adapter.InsertCommand.Parameters[5].Value = ((int)(UsuInc));
this.Adapter.InsertCommand.Parameters[6].Value = ((int)(UsuAlt));
this.Adapter.InsertCommand.Parameters[7].Value = ((System.DateTime)(DatInc));
this.Adapter.InsertCommand.Parameters[8].Value = ((System.DateTime)(DatAlt));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.InsertCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.InsertCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(
string Nome,
string Login,
string Senha,
string Email,
bool Ativo,
int UsuInc,
int UsuAlt,
System.DateTime DatInc,
System.DateTime DatAlt,
int Original_Id,
string Original_Nome,
string Original_Login,
string Original_Senha,
string Original_Email,
bool Original_Ativo,
int Original_UsuInc,
int Original_UsuAlt,
System.DateTime Original_DatInc,
System.DateTime Original_DatAlt,
int Id) {
if ((Nome == null)) {
throw new global::System.ArgumentNullException("Nome");
}
else {
this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(Nome));
}
if ((Login == null)) {
throw new global::System.ArgumentNullException("Login");
}
else {
this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Login));
}
if ((Senha == null)) {
throw new global::System.ArgumentNullException("Senha");
}
else {
this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(Senha));
}
if ((Email == null)) {
throw new global::System.ArgumentNullException("Email");
}
else {
this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Email));
}
this.Adapter.UpdateCommand.Parameters[4].Value = ((bool)(Ativo));
this.Adapter.UpdateCommand.Parameters[5].Value = ((int)(UsuInc));
this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(UsuAlt));
this.Adapter.UpdateCommand.Parameters[7].Value = ((System.DateTime)(DatInc));
this.Adapter.UpdateCommand.Parameters[8].Value = ((System.DateTime)(DatAlt));
this.Adapter.UpdateCommand.Parameters[9].Value = ((int)(Original_Id));
if ((Original_Nome == null)) {
throw new global::System.ArgumentNullException("Original_Nome");
}
else {
this.Adapter.UpdateCommand.Parameters[10].Value = ((string)(Original_Nome));
}
if ((Original_Login == null)) {
throw new global::System.ArgumentNullException("Original_Login");
}
else {
this.Adapter.UpdateCommand.Parameters[11].Value = ((string)(Original_Login));
}
if ((Original_Senha == null)) {
throw new global::System.ArgumentNullException("Original_Senha");
}
else {
this.Adapter.UpdateCommand.Parameters[12].Value = ((string)(Original_Senha));
}
if ((Original_Email == null)) {
throw new global::System.ArgumentNullException("Original_Email");
}
else {
this.Adapter.UpdateCommand.Parameters[13].Value = ((string)(Original_Email));
}
this.Adapter.UpdateCommand.Parameters[14].Value = ((bool)(Original_Ativo));
this.Adapter.UpdateCommand.Parameters[15].Value = ((int)(Original_UsuInc));
this.Adapter.UpdateCommand.Parameters[16].Value = ((int)(Original_UsuAlt));
this.Adapter.UpdateCommand.Parameters[17].Value = ((System.DateTime)(Original_DatInc));
this.Adapter.UpdateCommand.Parameters[18].Value = ((System.DateTime)(Original_DatAlt));
this.Adapter.UpdateCommand.Parameters[19].Value = ((int)(Id));
global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
this.Adapter.UpdateCommand.Connection.Open();
}
try {
int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
return returnValue;
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
this.Adapter.UpdateCommand.Connection.Close();
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
public virtual int Update(
string Nome,
string Login,
string Senha,
string Email,
bool Ativo,
int UsuInc,
int UsuAlt,
System.DateTime DatInc,
System.DateTime DatAlt,
int Original_Id,
string Original_Nome,
string Original_Login,
string Original_Senha,
string Original_Email,
bool Original_Ativo,
int Original_UsuInc,
int Original_UsuAlt,
System.DateTime Original_DatInc,
System.DateTime Original_DatAlt) {
return this.Update(Nome, Login, Senha, Email, Ativo, UsuInc, UsuAlt, DatInc, DatAlt, Original_Id, Original_Nome, Original_Login, Original_Senha, Original_Email, Original_Ativo, Original_UsuInc, Original_UsuAlt, Original_DatInc, Original_DatAlt, Original_Id);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual global::System.Nullable<int> LoginQuery(string login, string senha) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1];
if ((login == null)) {
throw new global::System.ArgumentNullException("login");
}
else {
command.Parameters[0].Value = ((string)(login));
}
if ((senha == null)) {
throw new global::System.ArgumentNullException("senha");
}
else {
command.Parameters[1].Value = ((string)(senha));
}
global::System.Data.ConnectionState previousConnectionState = command.Connection.State;
if (((command.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
command.Connection.Open();
}
object returnValue;
try {
returnValue = command.ExecuteScalar();
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
command.Connection.Close();
}
}
if (((returnValue == null)
|| (returnValue.GetType() == typeof(global::System.DBNull)))) {
return new global::System.Nullable<int>();
}
else {
return new global::System.Nullable<int>(((int)(returnValue)));
}
}
}
/// <summary>
///TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios
///</summary>
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" +
"esigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")]
public partial class TableAdapterManager : global::System.ComponentModel.Component {
private UpdateOrderOption _updateOrder;
private AutoresTableAdapter _autoresTableAdapter;
private EditorasTableAdapter _editorasTableAdapter;
private GenerosTableAdapter _generosTableAdapter;
private LivroAutorTableAdapter _livroAutorTableAdapter;
private LivrosTableAdapter _livrosTableAdapter;
private LocacaoTableAdapter _locacaoTableAdapter;
private UsuariosTableAdapter _usuariosTableAdapter;
private bool _backupDataSetBeforeUpdate;
private global::System.Data.IDbConnection _connection;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public UpdateOrderOption UpdateOrder {
get {
return this._updateOrder;
}
set {
this._updateOrder = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public AutoresTableAdapter AutoresTableAdapter {
get {
return this._autoresTableAdapter;
}
set {
this._autoresTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public EditorasTableAdapter EditorasTableAdapter {
get {
return this._editorasTableAdapter;
}
set {
this._editorasTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public GenerosTableAdapter GenerosTableAdapter {
get {
return this._generosTableAdapter;
}
set {
this._generosTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public LivroAutorTableAdapter LivroAutorTableAdapter {
get {
return this._livroAutorTableAdapter;
}
set {
this._livroAutorTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public LivrosTableAdapter LivrosTableAdapter {
get {
return this._livrosTableAdapter;
}
set {
this._livrosTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public LocacaoTableAdapter LocacaoTableAdapter {
get {
return this._locacaoTableAdapter;
}
set {
this._locacaoTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" +
"ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" +
"a", "System.Drawing.Design.UITypeEditor")]
public UsuariosTableAdapter UsuariosTableAdapter {
get {
return this._usuariosTableAdapter;
}
set {
this._usuariosTableAdapter = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public bool BackupDataSetBeforeUpdate {
get {
return this._backupDataSetBeforeUpdate;
}
set {
this._backupDataSetBeforeUpdate = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public global::System.Data.IDbConnection Connection {
get {
if ((this._connection != null)) {
return this._connection;
}
if (((this._autoresTableAdapter != null)
&& (this._autoresTableAdapter.Connection != null))) {
return this._autoresTableAdapter.Connection;
}
if (((this._editorasTableAdapter != null)
&& (this._editorasTableAdapter.Connection != null))) {
return this._editorasTableAdapter.Connection;
}
if (((this._generosTableAdapter != null)
&& (this._generosTableAdapter.Connection != null))) {
return this._generosTableAdapter.Connection;
}
if (((this._livroAutorTableAdapter != null)
&& (this._livroAutorTableAdapter.Connection != null))) {
return this._livroAutorTableAdapter.Connection;
}
if (((this._livrosTableAdapter != null)
&& (this._livrosTableAdapter.Connection != null))) {
return this._livrosTableAdapter.Connection;
}
if (((this._locacaoTableAdapter != null)
&& (this._locacaoTableAdapter.Connection != null))) {
return this._locacaoTableAdapter.Connection;
}
if (((this._usuariosTableAdapter != null)
&& (this._usuariosTableAdapter.Connection != null))) {
return this._usuariosTableAdapter.Connection;
}
return null;
}
set {
this._connection = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int TableAdapterInstanceCount {
get {
int count = 0;
if ((this._autoresTableAdapter != null)) {
count = (count + 1);
}
if ((this._editorasTableAdapter != null)) {
count = (count + 1);
}
if ((this._generosTableAdapter != null)) {
count = (count + 1);
}
if ((this._livroAutorTableAdapter != null)) {
count = (count + 1);
}
if ((this._livrosTableAdapter != null)) {
count = (count + 1);
}
if ((this._locacaoTableAdapter != null)) {
count = (count + 1);
}
if ((this._usuariosTableAdapter != null)) {
count = (count + 1);
}
return count;
}
}
/// <summary>
///Update rows in top-down order.
///</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private int UpdateUpdatedRows(SistemaBibliotecaDBDataSet dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) {
int result = 0;
if ((this._editorasTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.Editoras.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._editorasTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
if ((this._generosTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.Generos.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._generosTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
if ((this._usuariosTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.Usuarios.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._usuariosTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
if ((this._autoresTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.Autores.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._autoresTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
if ((this._livrosTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.Livros.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._livrosTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
if ((this._locacaoTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.Locacao.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._locacaoTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
if ((this._livroAutorTableAdapter != null)) {
global::System.Data.DataRow[] updatedRows = dataSet.LivroAutor.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent);
updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows);
if (((updatedRows != null)
&& (0 < updatedRows.Length))) {
result = (result + this._livroAutorTableAdapter.Update(updatedRows));
allChangedRows.AddRange(updatedRows);
}
}
return result;
}
/// <summary>
///Insert rows in top-down order.
///</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private int UpdateInsertedRows(SistemaBibliotecaDBDataSet dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) {
int result = 0;
if ((this._editorasTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.Editoras.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._editorasTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
if ((this._generosTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.Generos.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._generosTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
if ((this._usuariosTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.Usuarios.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._usuariosTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
if ((this._autoresTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.Autores.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._autoresTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
if ((this._livrosTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.Livros.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._livrosTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
if ((this._locacaoTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.Locacao.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._locacaoTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
if ((this._livroAutorTableAdapter != null)) {
global::System.Data.DataRow[] addedRows = dataSet.LivroAutor.Select(null, null, global::System.Data.DataViewRowState.Added);
if (((addedRows != null)
&& (0 < addedRows.Length))) {
result = (result + this._livroAutorTableAdapter.Update(addedRows));
allAddedRows.AddRange(addedRows);
}
}
return result;
}
/// <summary>
///Delete rows in bottom-up order.
///</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private int UpdateDeletedRows(SistemaBibliotecaDBDataSet dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows) {
int result = 0;
if ((this._livroAutorTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.LivroAutor.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._livroAutorTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
if ((this._locacaoTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.Locacao.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._locacaoTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
if ((this._livrosTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.Livros.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._livrosTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
if ((this._autoresTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.Autores.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._autoresTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
if ((this._usuariosTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.Usuarios.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._usuariosTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
if ((this._generosTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.Generos.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._generosTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
if ((this._editorasTableAdapter != null)) {
global::System.Data.DataRow[] deletedRows = dataSet.Editoras.Select(null, null, global::System.Data.DataViewRowState.Deleted);
if (((deletedRows != null)
&& (0 < deletedRows.Length))) {
result = (result + this._editorasTableAdapter.Update(deletedRows));
allChangedRows.AddRange(deletedRows);
}
}
return result;
}
/// <summary>
///Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first
///</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) {
if (((updatedRows == null)
|| (updatedRows.Length < 1))) {
return updatedRows;
}
if (((allAddedRows == null)
|| (allAddedRows.Count < 1))) {
return updatedRows;
}
global::System.Collections.Generic.List<global::System.Data.DataRow> realUpdatedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>();
for (int i = 0; (i < updatedRows.Length); i = (i + 1)) {
global::System.Data.DataRow row = updatedRows[i];
if ((allAddedRows.Contains(row) == false)) {
realUpdatedRows.Add(row);
}
}
return realUpdatedRows.ToArray();
}
/// <summary>
///Update all changes to the dataset.
///</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public virtual int UpdateAll(SistemaBibliotecaDBDataSet dataSet) {
if ((dataSet == null)) {
throw new global::System.ArgumentNullException("dataSet");
}
if ((dataSet.HasChanges() == false)) {
return 0;
}
if (((this._autoresTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._autoresTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
if (((this._editorasTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._editorasTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
if (((this._generosTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._generosTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
if (((this._livroAutorTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._livroAutorTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
if (((this._livrosTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._livrosTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
if (((this._locacaoTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._locacaoTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
if (((this._usuariosTableAdapter != null)
&& (this.MatchTableAdapterConnection(this._usuariosTableAdapter.Connection) == false))) {
throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" +
"tring.");
}
global::System.Data.IDbConnection workConnection = this.Connection;
if ((workConnection == null)) {
throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" +
"ger TableAdapter property to a valid TableAdapter instance.");
}
bool workConnOpened = false;
if (((workConnection.State & global::System.Data.ConnectionState.Broken)
== global::System.Data.ConnectionState.Broken)) {
workConnection.Close();
}
if ((workConnection.State == global::System.Data.ConnectionState.Closed)) {
workConnection.Open();
workConnOpened = true;
}
global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction();
if ((workTransaction == null)) {
throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" +
"ctions or the current state is not allowing the transaction to begin.");
}
global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>();
global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>();
global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter> adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter>();
global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection> revertConnections = new global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection>();
int result = 0;
global::System.Data.DataSet backupDataSet = null;
if (this.BackupDataSetBeforeUpdate) {
backupDataSet = new global::System.Data.DataSet();
backupDataSet.Merge(dataSet);
}
try {
// ---- Prepare for update -----------
//
if ((this._autoresTableAdapter != null)) {
revertConnections.Add(this._autoresTableAdapter, this._autoresTableAdapter.Connection);
this._autoresTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._autoresTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._autoresTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._autoresTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._autoresTableAdapter.Adapter);
}
}
if ((this._editorasTableAdapter != null)) {
revertConnections.Add(this._editorasTableAdapter, this._editorasTableAdapter.Connection);
this._editorasTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._editorasTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._editorasTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._editorasTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._editorasTableAdapter.Adapter);
}
}
if ((this._generosTableAdapter != null)) {
revertConnections.Add(this._generosTableAdapter, this._generosTableAdapter.Connection);
this._generosTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._generosTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._generosTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._generosTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._generosTableAdapter.Adapter);
}
}
if ((this._livroAutorTableAdapter != null)) {
revertConnections.Add(this._livroAutorTableAdapter, this._livroAutorTableAdapter.Connection);
this._livroAutorTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._livroAutorTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._livroAutorTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._livroAutorTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._livroAutorTableAdapter.Adapter);
}
}
if ((this._livrosTableAdapter != null)) {
revertConnections.Add(this._livrosTableAdapter, this._livrosTableAdapter.Connection);
this._livrosTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._livrosTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._livrosTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._livrosTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._livrosTableAdapter.Adapter);
}
}
if ((this._locacaoTableAdapter != null)) {
revertConnections.Add(this._locacaoTableAdapter, this._locacaoTableAdapter.Connection);
this._locacaoTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._locacaoTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._locacaoTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._locacaoTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._locacaoTableAdapter.Adapter);
}
}
if ((this._usuariosTableAdapter != null)) {
revertConnections.Add(this._usuariosTableAdapter, this._usuariosTableAdapter.Connection);
this._usuariosTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));
this._usuariosTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction));
if (this._usuariosTableAdapter.Adapter.AcceptChangesDuringUpdate) {
this._usuariosTableAdapter.Adapter.AcceptChangesDuringUpdate = false;
adaptersWithAcceptChangesDuringUpdate.Add(this._usuariosTableAdapter.Adapter);
}
}
//
//---- Perform updates -----------
//
if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) {
result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows));
result = (result + this.UpdateInsertedRows(dataSet, allAddedRows));
}
else {
result = (result + this.UpdateInsertedRows(dataSet, allAddedRows));
result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows));
}
result = (result + this.UpdateDeletedRows(dataSet, allChangedRows));
//
//---- Commit updates -----------
//
workTransaction.Commit();
if ((0 < allAddedRows.Count)) {
global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count];
allAddedRows.CopyTo(rows);
for (int i = 0; (i < rows.Length); i = (i + 1)) {
global::System.Data.DataRow row = rows[i];
row.AcceptChanges();
}
}
if ((0 < allChangedRows.Count)) {
global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count];
allChangedRows.CopyTo(rows);
for (int i = 0; (i < rows.Length); i = (i + 1)) {
global::System.Data.DataRow row = rows[i];
row.AcceptChanges();
}
}
}
catch (global::System.Exception ex) {
workTransaction.Rollback();
// ---- Restore the dataset -----------
if (this.BackupDataSetBeforeUpdate) {
global::System.Diagnostics.Debug.Assert((backupDataSet != null));
dataSet.Clear();
dataSet.Merge(backupDataSet);
}
else {
if ((0 < allAddedRows.Count)) {
global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count];
allAddedRows.CopyTo(rows);
for (int i = 0; (i < rows.Length); i = (i + 1)) {
global::System.Data.DataRow row = rows[i];
row.AcceptChanges();
row.SetAdded();
}
}
}
throw ex;
}
finally {
if (workConnOpened) {
workConnection.Close();
}
if ((this._autoresTableAdapter != null)) {
this._autoresTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._autoresTableAdapter]));
this._autoresTableAdapter.Transaction = null;
}
if ((this._editorasTableAdapter != null)) {
this._editorasTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._editorasTableAdapter]));
this._editorasTableAdapter.Transaction = null;
}
if ((this._generosTableAdapter != null)) {
this._generosTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._generosTableAdapter]));
this._generosTableAdapter.Transaction = null;
}
if ((this._livroAutorTableAdapter != null)) {
this._livroAutorTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._livroAutorTableAdapter]));
this._livroAutorTableAdapter.Transaction = null;
}
if ((this._livrosTableAdapter != null)) {
this._livrosTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._livrosTableAdapter]));
this._livrosTableAdapter.Transaction = null;
}
if ((this._locacaoTableAdapter != null)) {
this._locacaoTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._locacaoTableAdapter]));
this._locacaoTableAdapter.Transaction = null;
}
if ((this._usuariosTableAdapter != null)) {
this._usuariosTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._usuariosTableAdapter]));
this._usuariosTableAdapter.Transaction = null;
}
if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) {
global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count];
adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters);
for (int i = 0; (i < adapters.Length); i = (i + 1)) {
global::System.Data.Common.DataAdapter adapter = adapters[i];
adapter.AcceptChangesDuringUpdate = true;
}
}
}
return result;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected virtual void SortSelfReferenceRows(global::System.Data.DataRow[] rows, global::System.Data.DataRelation relation, bool childFirst) {
global::System.Array.Sort<global::System.Data.DataRow>(rows, new SelfReferenceComparer(relation, childFirst));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
protected virtual bool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) {
if ((this._connection != null)) {
return true;
}
if (((this.Connection == null)
|| (inputConnection == null))) {
return true;
}
if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) {
return true;
}
return false;
}
/// <summary>
///Update Order Option
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public enum UpdateOrderOption {
InsertUpdateDelete = 0,
UpdateInsertDelete = 1,
}
/// <summary>
///Used to sort self-referenced table's rows
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private class SelfReferenceComparer : object, global::System.Collections.Generic.IComparer<global::System.Data.DataRow> {
private global::System.Data.DataRelation _relation;
private int _childFirst;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
internal SelfReferenceComparer(global::System.Data.DataRelation relation, bool childFirst) {
this._relation = relation;
if (childFirst) {
this._childFirst = -1;
}
else {
this._childFirst = 1;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
private global::System.Data.DataRow GetRoot(global::System.Data.DataRow row, out int distance) {
global::System.Diagnostics.Debug.Assert((row != null));
global::System.Data.DataRow root = row;
distance = 0;
global::System.Collections.Generic.IDictionary<global::System.Data.DataRow, global::System.Data.DataRow> traversedRows = new global::System.Collections.Generic.Dictionary<global::System.Data.DataRow, global::System.Data.DataRow>();
traversedRows[row] = row;
global::System.Data.DataRow parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default);
for (
; ((parent != null)
&& (traversedRows.ContainsKey(parent) == false));
) {
distance = (distance + 1);
root = parent;
traversedRows[parent] = parent;
parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default);
}
if ((distance == 0)) {
traversedRows.Clear();
traversedRows[row] = row;
parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original);
for (
; ((parent != null)
&& (traversedRows.ContainsKey(parent) == false));
) {
distance = (distance + 1);
root = parent;
traversedRows[parent] = parent;
parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original);
}
}
return root;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
public int Compare(global::System.Data.DataRow row1, global::System.Data.DataRow row2) {
if (object.ReferenceEquals(row1, row2)) {
return 0;
}
if ((row1 == null)) {
return -1;
}
if ((row2 == null)) {
return 1;
}
int distance1 = 0;
global::System.Data.DataRow root1 = this.GetRoot(row1, out distance1);
int distance2 = 0;
global::System.Data.DataRow root2 = this.GetRoot(row2, out distance2);
if (object.ReferenceEquals(root1, root2)) {
return (this._childFirst * distance1.CompareTo(distance2));
}
else {
global::System.Diagnostics.Debug.Assert(((root1.Table != null)
&& (root2.Table != null)));
if ((root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2))) {
return -1;
}
else {
return 1;
}
}
}
}
}
}
#pragma warning restore 1591 | 60.945651 | 804 | 0.609122 | [
"MIT"
] | HenocEtienne2512/Git | GitC-master/05-08-19_09-08-19/MVCProject/MVCProject/SistemaBibliotecaDBDataSet.Designer.cs | 474,342 | C# |
using System;
using System.IO;
using CoreGraphics;
using Foundation;
using UIKit;
namespace Microsoft.Maui.Graphics.Platform
{
internal class PlatformPdfExportContext : PdfExportContext
{
private string _tempFilePath;
private readonly NSMutableDictionary _documentInfo;
private readonly PlatformCanvas _canvas;
private bool _closed;
public PlatformPdfExportContext(
float defaultWidth,
float defaultHeight) : base(defaultWidth, defaultHeight)
{
_documentInfo = new NSMutableDictionary();
_canvas = new PlatformCanvas(() => CGColorSpace.CreateDeviceRGB());
}
protected override void AddPageImpl(float width, float height)
{
if (_closed)
throw new Exception("Unable to add a page because the PDFContext is already closed.");
if (_tempFilePath == null)
{
_tempFilePath = Path.GetTempFileName();
UIGraphics.BeginPDFContext(_tempFilePath, CGRect.Empty, _documentInfo);
}
var pageInfo = new NSMutableDictionary();
UIGraphics.BeginPDFPage(new CGRect(0, 0, width, height), pageInfo);
var context = UIGraphics.GetCurrentContext();
context.SetFillColorSpace(CGColorSpace.CreateDeviceRGB());
context.SetStrokeColorSpace(CGColorSpace.CreateDeviceRGB());
_canvas.Context = context;
}
public override void WriteToStream(Stream stream)
{
Close();
using (var inputStream = new FileStream(_tempFilePath, FileMode.Open, FileAccess.Read))
{
inputStream.CopyTo(stream);
}
}
public NSData Data
{
get
{
Close();
return NSData.FromFile(_tempFilePath);
}
}
public override ICanvas Canvas => _canvas;
private void Close()
{
if (!_closed)
{
try
{
UIGraphics.EndPDFContent();
}
catch (Exception exc)
{
System.Diagnostics.Debug.WriteLine(exc);
}
finally
{
_closed = true;
}
}
}
public override void Dispose()
{
base.Dispose();
Close();
try
{
if (File.Exists(_tempFilePath))
File.Delete(_tempFilePath);
}
catch (Exception exc)
{
System.Diagnostics.Debug.WriteLine(exc);
}
}
}
}
| 20.742574 | 90 | 0.692124 | [
"MIT"
] | eerhardt/Microsoft.Maui.Graphics | src/Microsoft.Maui.Graphics/iOS/PlatformPdfExportContext.cs | 2,095 | 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 kendra-2019-02-03.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.Kendra.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.Kendra.Model.Internal.MarshallTransformations
{
/// <summary>
/// Principal Marshaller
/// </summary>
public class PrincipalMarshaller : IRequestMarshaller<Principal, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(Principal requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetAccess())
{
context.Writer.WritePropertyName("Access");
context.Writer.Write(requestObject.Access);
}
if(requestObject.IsSetName())
{
context.Writer.WritePropertyName("Name");
context.Writer.Write(requestObject.Name);
}
if(requestObject.IsSetType())
{
context.Writer.WritePropertyName("Type");
context.Writer.Write(requestObject.Type);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static PrincipalMarshaller Instance = new PrincipalMarshaller();
}
} | 32.905405 | 105 | 0.629158 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/Kendra/Generated/Model/Internal/MarshallTransformations/PrincipalMarshaller.cs | 2,435 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace CongressManager
{
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.291667 | 99 | 0.590051 | [
"MIT"
] | VisualAcademy/AspNetCoreBook | CongressManager/CongressManager/App_Start/RouteConfig.cs | 585 | C# |
using System.Threading;
using System.Threading.Tasks;
using AutoFixture.Xunit2;
using FluentAssertions;
using Reinforce.RestApi;
using Reinforce.Constants;
using Reinforce.RestApi.Models;
using Xunit;
namespace ReinforceTests.RestApiTests
{
public class IPlatformEventSchemaBySchemaIDTests
{
[Theory, AutoData]
public async Task IPlatformEventSchemaBySchemaID(string expected, string schemaId)
{
using var handler = MockHttpMessageHandler.SetupHandler(expected);
var api = handler.SetupApi<IPlatformEventSchemaBySchemaID>();
var result = await api.GetAsync<string>(schemaId);
result.Should().BeEquivalentTo(expected);
handler.ConfirmPath($"/services/data/{Api.Version}/event/eventSchema/{schemaId}");
}
[Theory, AutoData]
public async Task IPlatformEventSchemaBySchemaID_PayloadFormat(string expected, string schemaId, string payloadFormat)
{
using var handler = MockHttpMessageHandler.SetupHandler(expected);
var api = handler.SetupApi<IPlatformEventSchemaBySchemaID>();
var result = await api.GetAsync<string>(schemaId, payloadFormat, CancellationToken.None, "v44.0");
result.Should().BeEquivalentTo(expected);
handler.ConfirmPath($"/services/data/v44.0/event/eventSchema/{schemaId}?payloadFormat={payloadFormat}");
}
}
} | 41.794118 | 126 | 0.707248 | [
"MIT"
] | Mfolguera/Reinforce | tests/ReinforceTests/RestApiTests/IPlatformEventSchemaBySchemaIDTests.cs | 1,421 | C# |
namespace P03.DependencyInversion.Strategies
{
public class MultiplicationStrategy : IStrategy
{
public int Calculate(int firstOperand, int secondOperand)
{
return firstOperand * secondOperand;
}
}
}
| 22.636364 | 65 | 0.654618 | [
"MIT"
] | kovachevmartin/SoftUni | CSharp-OOP/09-COMMUNICATION_EVENTS/P03.DependencyInversion/Strategies/MultiplicationStrategy.cs | 251 | C# |
///*******************************************************
// *
// * 作者:胡庆访
// * 创建时间:20110810
// * 说明:此文件只包含一个类,具体内容见类型注释。
// * 运行环境:.NET 4.0
// * 版本号:1.1.0
// *
// * 历史记录:
// * 创建文件 胡庆访 20100510
// * 使用 IsChecked 附加属性来实现 CheckBox 多选。 胡庆访 20110810
// *
//*******************************************************/
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Windows.Input;
//using System.Windows.Data;
//using System.Windows;
//using System.Windows.Media;
//using System.Windows.Controls;
//using Rafy.WPF.Controls;
//using Rafy.MetaModel;
using Rafy.MetaModel.View;
//using System.Diagnostics;
//using Rafy.WPF;
//using System.Collections;
//using System.Collections.ObjectModel;
//using System.Collections.Specialized;
//using System.Windows.Controls.Primitives;
//namespace Rafy.WPF.Controls
//{
// /// <summary>
// /// 一个可以使用 CheckBox 进行多选的 DataGrid
// ///
// /// 点击 DataGridCell 中的任意地点都会引发 DataGrid 自己处理整行的 IsSelected 状态,导致其它行处于非选择状态。
// /// 所以这里不再使用 DataGrid.SelectionChanged 事件,即:
// /// 打开选择功能的表格后,DataGrid.SelecteItems 及 SelectionChanged 事件都不再可用,
// /// 而是应该使用本对象定义的 SelectedObjects 及 CheckChanged 事件。
// ///
// /// 实现方案:
// /// 一、重点关注以下三个绑定/消息通知:
// /// 1. CheckBox 的 IsChecked 属性和 DataGridRow 的附加属性 (SelectionDataGrid.IsChecked) 使用 Binding 进行双向绑定。
// /// 2. DataGridRow.(SelectionDataGrid.IsChecked) 和一个表示当前所有选中项的私有变量 _selectedObjects 使用代码进行双向绑定:
// /// IsChecked 到 _selectedObjects 使用附加属性的 PropertyChanged 事件进行同步。
// /// _selectedObjects 到 IsChecked 使用集合的 CollectionChanged 事件进行同步。
// /// 3. 最后,_selectedObjects 集合在变化时,转换为一个 CheckChanged 事件用于通知外部。
// /// 二、整个过程完全抛弃 DataGrid.SelectionChanged,DataGridRow.IsSelected 等机制。(原因如上所说,无法抑制 DataGridCell 的设置选择行为。)
// /// 三、选择附加属性来作为 CheckBox.IsChecked 属性和 _selectedObjects 集合之间双向绑定的中间者,原因在于:
// /// 1. CheckBox 的事件监听不好控制,两个属性双向绑定后,直接在附加属性的变更回调中写代码更加易读。
// /// 2. 控件外部可以随时通过获取/设置某一行的此附加属性来控制
// /// </summary>
// public class SelectionDataGrid : DataGrid, ISelectableListControl
// {
// #region SelectionCheckBoxStyle
// private static Style _selectionCheckBoxStyle;
// private static Style SelectionCheckBoxStyle
// {
// get
// {
// //以下代码类似于 DataGridCheckBoxColumn 中的 DefaultElementStyle。
// if (_selectionCheckBoxStyle == null)
// {
// var style = new Style(typeof(CheckBox), Application.Current.TryFindResource(typeof(CheckBox)) as Style);
// //显式设置 Checkbox 的测试点击状态为 true。
// style.Setters.Add(new Setter(UIElement.IsHitTestVisibleProperty, true));
// style.Setters.Add(new Setter(UIElement.FocusableProperty, true));
// style.Seal();
// _selectionCheckBoxStyle = style;
// }
// return _selectionCheckBoxStyle;
// }
// }
// #endregion
// #region DataGridRow.DataGridOwnerProperty
// private static readonly DependencyProperty DataGridOwnerProperty = DependencyProperty.RegisterAttached(
// "DataGridOwner", typeof(SelectionDataGrid), typeof(SelectionDataGrid),
// new PropertyMetadata(DataGridOwnerPropertyChanged)
// );
// /// <summary>
// /// 获取某行所属的表格控件
// /// </summary>
// /// <param name="element"></param>
// /// <returns></returns>
// public static SelectionDataGrid GetDataGridOwner(DataGridRow element)
// {
// return (SelectionDataGrid)element.GetValue(DataGridOwnerProperty);
// }
// /// <summary>
// /// 设置某行所属的表格控件
// /// </summary>
// /// <param name="element"></param>
// /// <param name="value"></param>
// private static void SetDataGridOwner(DataGridRow element, SelectionDataGrid value)
// {
// element.SetValue(DataGridOwnerProperty, value);
// }
// private static void DataGridOwnerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
// {
// var value = (SelectionDataGrid)e.NewValue;
// }
// #endregion
// #region DataGridRow.IsCheckedProperty
// public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.RegisterAttached(
// "IsChecked", typeof(bool), typeof(SelectionDataGrid),
// new PropertyMetadata(IsCheckedPropertyChanged)
// );
// /// <summary>
// /// 获取某行的选中状态
// /// </summary>
// /// <param name="element"></param>
// /// <returns></returns>
// public static bool GetIsChecked(DataGridRow element)
// {
// return (bool)element.GetValue(IsCheckedProperty);
// }
// /// <summary>
// /// 设置某行的选中状态
// /// </summary>
// /// <param name="element"></param>
// /// <param name="value"></param>
// public static void SetIsChecked(DataGridRow element, bool value)
// {
// element.SetValue(IsCheckedProperty, value);
// }
// private static void IsCheckedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
// {
// var value = (bool)e.NewValue;
// var row = d as DataGridRow;
// var @this = GetDataGridOwner(row);
// if (@this.CheckingMode != CheckingMode.CheckingRow)
// {
// throw new NotSupportedException("只能 CheckingRow 模式下已经打开选择功能的 SelectionDataGrid 才能设置此属性!");
// }
// if (value)
// {
// @this._selectedObjects.Add(row.Item);
// }
// else
// {
// @this._selectedObjects.Remove(row.Item);
// }
// }
// #endregion
// #region CheckingModeProperty
// public static readonly DependencyProperty CheckingModeProperty = DependencyProperty.Register(
// "CheckingMode", typeof(CheckingMode), typeof(SelectionDataGrid),
// new PropertyMetadata(CheckingMode.None, CheckingModePropertyChanged)
// );
// /// <summary>
// /// “Check选择” 模式
// /// </summary>
// public CheckingMode CheckingMode
// {
// get { return (CheckingMode)this.GetValue(CheckingModeProperty); }
// set { this.SetValue(CheckingModeProperty, value); }
// }
// private static void CheckingModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
// {
// var grid = d as SelectionDataGrid;
// var value = (CheckingMode)e.NewValue;
// if (value != CheckingMode.None)
// {
// if (grid._selectionColumn == null)
// {
// grid.EnableSelect();
// }
// grid.ResetBindingByMode();
// }
// else
// {
// grid.DisableSelect();
// }
// }
// #endregion
// #region 选择模式的切换
// private SelectedItemsCollection _selectedObjects;
// private DataGridCheckBoxColumn _selectionColumn;
// /// <summary>
// /// 在 CheckingMode 被打开的模式下,用于选择的 CheckBox 列。
// /// </summary>
// public DataGridCheckBoxColumn SelectionColumn
// {
// get { return this._selectionColumn; }
// }
// /// <summary>
// /// 当前已经选择的对象列表
// /// </summary>
// public IList SelectedObjects
// {
// get
// {
// if (this.CheckingMode == CheckingMode.CheckingRow) { return this._selectedObjects; }
// return base.SelectedItems;
// }
// }
// private void EnableSelect()
// {
// this._selectionColumn = new DataGridCheckBoxColumn()
// {
// Header = "选择",
// EditingElementStyle = SelectionCheckBoxStyle.BasedOn,
// ElementStyle = SelectionCheckBoxStyle
// };
// this.Columns.Insert(0, this._selectionColumn);
// this._selectedObjects = new SelectedItemsCollection(this);
// this._selectedObjects.CollectionChanged += On_SelectedItems_CollectionChanged;
// }
// private void DisableSelect()
// {
// if (this._selectionColumn != null)
// {
// this.Columns.Remove(this._selectionColumn);
// this._selectionColumn = null;
// this._selectedObjects = null;
// this._selectedObjects.CollectionChanged -= On_SelectedItems_CollectionChanged;
// }
// }
// #endregion
// #region CheckChangedEvent
// private static RoutedEvent CheckChangedEvent = EventManager.RegisterRoutedEvent(
// "CheckChanged", RoutingStrategy.Bubble, typeof(CheckChangedEventHandler), typeof(SelectionDataGrid)
// );
// /// <summary>
// /// 某一项被选择或者反选时发生此事件
// /// </summary>
// public event CheckChangedEventHandler CheckChanged
// {
// add { this.AddHandler(CheckChangedEvent, value); }
// remove { this.RemoveHandler(CheckChangedEvent, value); }
// }
// #endregion
// protected override void OnLoadingRow(DataGridRowEventArgs e)
// {
// base.OnLoadingRow(e);
// var row = e.Row;
// //在行中记录父控件指针
// SetDataGridOwner(row, this);
// //初始化选中状态。
// if (this.CheckingMode == CheckingMode.CheckingRow)
// {
// if (this._selectedObjects.Contains(row.Item)) { SetIsChecked(row, true); }
// }
// }
// /// <summary>
// /// 根据绑定模式不同使用不同的绑定
// /// </summary>
// private void ResetBindingByMode()
// {
// var mode = this.CheckingMode;
// if (mode != CheckingMode.None)
// {
// //两种不同的模式
// if (mode == CheckingMode.CheckingViewModel)
// {
// this.SelectionUnit = DataGridSelectionUnit.FullRow;
// this._selectionColumn.Binding = new Binding(PropertyConvention.IsSelected);
// }
// else
// {
// this.SelectionUnit = DataGridSelectionUnit.Cell;
// this._selectionColumn.Binding = new Binding
// {
// Path = new PropertyPath(SelectionDataGrid.IsCheckedProperty),
// RelativeSource = new RelativeSource
// {
// Mode = RelativeSourceMode.FindAncestor,
// AncestorType = typeof(DataGridRow)
// }
// };
// }
// }
// }
// /// <summary>
// /// 两个职责:
// /// 1. 同步到 DataGridRow.(SelectionDataGrid.IsChecked) 属性上;
// /// 2. 引发 CheckChanged 事件通知外部。
// /// </summary>
// /// <param name="sender"></param>
// /// <param name="e"></param>
// private void On_SelectedItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
// {
// //同步控件的状态
// if (this.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
// {
// if (e.Action == NotifyCollectionChangedAction.Reset)
// {
// this.CheckItems(this.ItemsSource, false);
// }
// else
// {
// this.CheckItems(e.NewItems, true);
// this.CheckItems(e.OldItems, false);
// }
// }
// //Bubble Event
// this.RaiseEvent(new CheckChangedEventArgs()
// {
// RoutedEvent = CheckChangedEvent,
// AddedItems = e.NewItems == null ? new List<object>() : e.NewItems,
// RemovedItems = e.OldItems == null ? new List<object>() : e.OldItems,
// });
// }
// private void CheckItems(IEnumerable list, bool isChecked)
// {
// if (list != null)
// {
// foreach (var newItem in list)
// {
// var row = this.ItemContainerGenerator.ContainerFromItem(newItem) as DataGridRow;
// if (row != null) SetIsChecked(row, isChecked);
// }
// }
// }
// #region private class SelectedItemsCollection
// /// <summary>
// /// 一个不会添加重复数据的集合
// /// </summary>
// private class SelectedItemsCollection : ObservableCollection<object>
// {
// private ItemsControl _owner;
// public SelectedItemsCollection(ItemsControl owner)
// {
// this._owner = owner;
// }
// protected override void InsertItem(int index, object item)
// {
// if (this.CanAdd(item)) { base.InsertItem(index, item); }
// }
// protected override void SetItem(int index, object item)
// {
// if (this.CanAdd(item)) { base.SetItem(index, item); }
// }
// private bool CanAdd(object item)
// {
// return !this.Contains(item) &&
// this._owner.ItemsSource.Cast<object>().Contains(item);
// }
// }
// #endregion
// #region 临时代码比较复杂,有空应该整理下
// /// <summary>
// /// 当前正在编辑的行中的单元
// /// </summary>
// private DataGridCell _editingCellInRow;
// ///// <summary>
// ///// 选择的时候,直接开始编辑。
// ///// 并且如果是checkbox时,则改变选中状态。
// ///// </summary>
// ///// <param name="e"></param>
// //protected override void OnSelectedCellsChanged(SelectedCellsChangedEventArgs e)
// //{
// // base.OnSelectedCellsChanged(e);
// // //如果是checkbox,直接换值
// // var column = this.CurrentColumn as DataGridCheckBoxColumn;
// // if ((column != null) && (null != CurrentItem) && (null != column.Binding))
// // {
// // var propertyName = (column.Binding as Binding).Path.Path;
// // var currentItem = this.CurrentItem;
// // var oldValue = currentItem.GetPropertyValue(propertyName);
// // var newValue = !(bool)oldValue;
// // currentItem.SetPropertyValue(propertyName, newValue);
// // }
// //}
// protected override void OnCellEditEnding(DataGridCellEditEndingEventArgs e)
// {
// base.OnCellEditEnding(e);
// Debug.WriteLine("End Editing");
// //选择另一行,把_editingCellInRow清空
// //因为MS会自动把这行Commit
// this._editingCellInRow = null;
// //this._editingControl = null;
// Debug.WriteLine("Changd another row, MS DataGrid control committed the old row automatically.");
// }
// protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
// {
// #region Debug
// //Debug.WriteLine("========================= Start =========================" + DateTime.Now.Ticks);
// //var oldCelll = e.OldFocus as DataGridCell;
// //var newCell = e.NewFocus as DataGridCell;
// //if (e.OldFocus != null)
// //{
// // Debug.WriteLine("OldFocus:" + e.OldFocus.GetType().Name);
// //}
// //if (oldCelll != null)
// //{
// // Debug.WriteLine(oldCelll.IsEditing);
// //}
// //if (e.NewFocus != null)
// //{
// // Debug.WriteLine("NewFocus:" + e.NewFocus.GetType().Name);
// //}
// //if (newCell != null)
// //{
// // Debug.WriteLine(newCell.IsEditing);
// //}
// //Debug.WriteLine("========================= End =========================");
// #endregion
// base.OnLostKeyboardFocus(e);
// //避免在第一次存储_editingCell的时候就调用Commit
// bool firstTime = false;
// #region 在进入编辑状态时执行。
// //如果是DataGridCell,并且正在编辑状态,
// //则这时候焦点就是从DataGridCell到TextBox等编辑控件移动的过程中。
// var oldCell = e.OldFocus as DataGridCell;
// if (oldCell != null && oldCell.IsEditing)
// {
// ////目前只有专门为下拉框进行特殊处理了。
// //if ((e.NewFocus is LookupListPropertyEditorControl) == false)
// //{
// this._editingCellInRow = oldCell;
// //this._editingControl = e.NewFocus as Visual;//可能并不是Visual,所以有可能为null
// firstTime = true;
// Debug.WriteLine("Start editing a cell in a row.");
// //}
// }
// #endregion
// if (firstTime == false)
// {
// #region 以下判断当编辑完成后,失去焦点时执行。
// //是否提交
// bool commit = false;
// //计算是还需要commit
// //如果正在编辑
// if (this._editingCellInRow != null)
// {
// //如果是聚焦自己的空白区域,可以提交。
// if (this == e.NewFocus)
// {
// commit = true;
// }
// if (e.NewFocus != null)
// {
// var newFocus = e.NewFocus as DependencyObject;
// //如果焦点已经移出这个DataGrid,则也需要提交。
// //不过这里需要加上额外的PopupRoot的判断,因为弹出的下拉框,它也不是DataGrid的逻辑子节点
// var cell = newFocus.GetVisualParent<DataGridCell>();
// if (cell == null || this.Columns.All(c => c != cell.Column))
// {
// //弹出框里面的元素的逻辑根节点,是一个Internal的类:PopupRoot
// var root = newFocus.GetVisualRoot();
// if (root.GetType().Name != "PopupRoot")
// {
// commit = true;
// }
// }
// }
// //var control = e.NewFocus as DependencyObject;
// //如果control不是grid中的控件,则可能需要commit
// //if (control != null && this.IsAncestorOf(control) == false)
// //{
// //下拉选择的控件里面,如果还有DataGrid的话,
// //上面的两个判断也会通过(不知道为什么编辑控件里面的控件不是Grid的Desendant。),但是这时候也不能进行commit操作。
// //这里是为LookupListPropertyEditorControl中的子控件写的特定的代码,可能会发生bug:
// //当用户在这个grid编辑时,直接点击其它的grid中的DataGridCell或Button,这时候commit就不会发生,EditLevel就会出错不匹配。
// //if ((control is Button) == false &&
// // (control is DataGridCell) == false
// // )
// //{
// // commit = true;
// //}
// //}
// }
// if (commit)
// {
// Debug.WriteLine("Commit editing cell.");
// this.CommitEdit(DataGridEditingUnit.Row, true);
// this._editingCellInRow = null;
// }
// #endregion
// }
// }
// //protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
// //{
// // #region Debug
// // //Debug.WriteLine("Gottinggggggggggggggggggggggggggggggggggggggggggggggggg Begin");
// // //var oldCell = e.OldFocus as DataGridCell;
// // //var newCell = e.NewFocus as DataGridCell;
// // //if (e.OldFocus != null)
// // //{
// // // Debug.WriteLine("OldFocus:" + e.OldFocus.GetType().FullName);
// // //}
// // //if (oldCell != null)
// // //{
// // // Debug.WriteLine(oldCell.IsEditing);
// // //}
// // //if (e.NewFocus != null)
// // //{
// // // Debug.WriteLine("NewFocus:" + e.NewFocus.GetType().FullName);
// // //}
// // //if (newCell != null)
// // //{
// // // Debug.WriteLine(newCell.IsEditing);
// // //}
// // //Debug.WriteLine("Gottinggggggggggggggggggggggggggggggggggggggggggggggggg End");
// // #endregion
// // base.OnGotKeyboardFocus(e);
// //}
// #endregion
// }
// /// <summary>
// /// 选择项变更事件处理类型
// /// </summary>
// /// <param name="sender"></param>
// /// <param name="e"></param>
// public delegate void CheckChangedEventHandler(object sender, CheckChangedEventArgs e);
// /// <summary>
// /// 选择项变更事件参数
// /// </summary>
// public class CheckChangedEventArgs : RoutedEventArgs
// {
// /// <summary>
// /// 新选择的数据项
// /// </summary>
// public IList AddedItems { get; internal set; }
// /// <summary>
// /// 取消选择的数据项
// /// </summary>
// public IList RemovedItems { get; internal set; }
// }
//}
/////// <summary>
/////// ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/wpf_conceptual/html/b1a64b61-14be-4d75-b89a-5c67bebb2c7b.htm
/////// Hit Testing in the Visual Layer
/////// </summary>
////public class GridCheckBoxColumn : DataGridCheckBoxColumn
////{
//// protected override void CancelCellEdit(FrameworkElement editingElement, object uneditedValue)
//// {
//// base.CancelCellEdit(editingElement, uneditedValue);
//// }
//// protected override bool CommitCellEdit(FrameworkElement editingElement)
//// {
//// var result = base.CommitCellEdit(editingElement);
//// return result;
//// }
//// protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
//// {
//// var result = base.GenerateEditingElement(cell, dataItem);
//// return result;
//// }
//// protected override void OnBindingChanged(BindingBase oldBinding, BindingBase newBinding)
//// {
//// base.OnBindingChanged(oldBinding, newBinding);
//// }
//// protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
//// {
//// var result = base.PrepareCellForEdit(editingElement, editingEventArgs);
//// return result;
//// }
//// protected override bool OnCoerceIsReadOnly(bool baseValue)
//// {
//// var result = base.OnCoerceIsReadOnly(baseValue);
//// result = true;
//// return result;
//// }
//// //protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
//// //{
//// // CheckBox checkBox = (cell != null) ? (cell.Content as CheckBox) : null;
//// // if (checkBox == null)
//// // {
//// // checkBox = new CheckBox();
//// // }
//// // checkBox.IsThreeState = IsThreeState;
//// // var style = new Style();
//// // //style.Setters.Add(this.ElementStyle.Setters[0]);
//// // style.Setters.Add(this.ElementStyle.Setters[1]);
//// // style.Setters.Add(this.ElementStyle.Setters[2]);
//// // style.Setters.Add(this.ElementStyle.Setters[3]);
//// // checkBox.Style = style;
//// // BindingBase binding = Binding;
//// // if (binding != null)
//// // {
//// // BindingOperations.SetBinding(checkBox, CheckBox.IsCheckedProperty, binding);
//// // }
//// // else
//// // {
//// // BindingOperations.ClearBinding(checkBox, CheckBox.IsCheckedProperty);
//// // }
//// // return checkBox;
//// //}
////} | 36.312775 | 127 | 0.49909 | [
"MIT"
] | zgynhqf/trunk | Rafy/WPF/Rafy.WPF/Controls/zzzSDG/SelectionDataGrid.cs | 26,957 | C# |
using System;
using FlutterSDK;
using FlutterSDK.Widgets.Framework;
using System.Net.Http;
using FlutterBinding.UI;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using SkiaSharp;
using FlutterBinding.Engine.Painting;
using static FlutterSDK.Global;
using FlutterBinding.Mapping;
using FlutterSDK.Foundation.Binding;
using FlutterSDK.Foundation.Consolidateresponse;
using FlutterSDK.Foundation.Synchronousfuture;
using FlutterSDK.Foundation.Node;
using FlutterSDK.Foundation.Diagnostics;
using FlutterSDK.Foundation.Profile;
using FlutterSDK.Foundation.@object;
using FlutterSDK.Foundation.Bitfield;
using FlutterSDK.Foundation.Isolates;
using FlutterSDK.Foundation.Platform;
using FlutterSDK.Foundation.Assertions;
using FlutterSDK.Foundation.Debug;
using FlutterSDK.Foundation.Unicode;
using FlutterSDK.Foundation.Observerlist;
using FlutterSDK.Foundation.Key;
using FlutterSDK.Foundation.Stackframe;
using FlutterSDK.Foundation.Print;
using FlutterSDK.Foundation.Changenotifier;
using FlutterSDK.Foundation.Serialization;
using FlutterSDK.Foundation.Annotations;
using FlutterSDK.Foundation.Constants;
using FlutterSDK.Foundation.Licenses;
using FlutterSDK.Foundation.Collections;
using FlutterSDK.Foundation.Basictypes;
using FlutterSDK.Animation.Tween;
using FlutterSDK.Animation.Animation;
using FlutterSDK.Animation.Curves;
using FlutterSDK.Animation.Listenerhelpers;
using FlutterSDK.Physics.Clampedsimulation;
using FlutterSDK.Physics.Frictionsimulation;
using FlutterSDK.Physics.Gravitysimulation;
using FlutterSDK.Physics.Tolerance;
using FlutterSDK.Physics.Simulation;
using FlutterSDK.Physics.Springsimulation;
using FlutterSDK.Physics.Utils;
using FlutterSDK.Scheduler.Binding;
using FlutterSDK.Scheduler.Ticker;
using FlutterSDK.Scheduler.Priority;
using FlutterSDK.Scheduler.Debug;
using FlutterSDK.Semantics.Binding;
using FlutterSDK.Semantics.Debug;
using FlutterSDK.Semantics.Semanticsservice;
using FlutterSDK.Semantics.Semanticsevent;
using FlutterSDK.Semantics.Semantics;
using FlutterSDK.Animation.Animations;
using FlutterSDK.Rendering.Texture;
using FlutterSDK.Gestures.Eager;
using FlutterSDK.Gestures.Debug;
using FlutterSDK.Gestures.Pointerrouter;
using FlutterSDK.Gestures.Recognizer;
using FlutterSDK.Gestures.Dragdetails;
using FlutterSDK.Gestures.Lsqsolver;
using FlutterSDK.Gestures.Scale;
using FlutterSDK.Gestures.Drag;
using FlutterSDK.Gestures.Forcepress;
using FlutterSDK.Gestures.Events;
using FlutterSDK.Gestures.Monodrag;
using FlutterSDK.Gestures.Arena;
using FlutterSDK.Gestures.Multidrag;
using FlutterSDK.Gestures.Constants;
using FlutterSDK.Gestures.Converter;
using FlutterSDK.Gestures.Tap;
using FlutterSDK.Gestures.Binding;
using FlutterSDK.Gestures.Pointersignalresolver;
using FlutterSDK.Gestures.Team;
using FlutterSDK.Gestures.Hittest;
using FlutterSDK.Gestures.Velocitytracker;
using FlutterSDK.Gestures.Multitap;
using FlutterSDK.Gestures.Longpress;
using FlutterSDK.Rendering.Proxybox;
using FlutterSDK.Rendering.Viewportoffset;
using FlutterSDK.Rendering.Flex;
using FlutterSDK.Rendering.Sliverfill;
using FlutterSDK.Rendering.Sliverfixedextentlist;
using FlutterSDK.Rendering.View;
using FlutterSDK.Rendering.Editable;
using FlutterSDK.Rendering.Animatedsize;
using FlutterSDK.Rendering.Custompaint;
using FlutterSDK.Rendering.Performanceoverlay;
using FlutterSDK.Rendering.Sliverpadding;
using FlutterSDK.Rendering.Shiftedbox;
using FlutterSDK.Rendering.Debug;
using FlutterSDK.Rendering.Debugoverflowindicator;
using FlutterSDK.Rendering.Tweens;
using FlutterSDK.Painting.Borders;
using FlutterSDK.Painting.Textstyle;
using FlutterSDK.Painting.Colors;
using FlutterSDK.Painting.Circleborder;
using FlutterSDK.Painting.Edgeinsets;
using FlutterSDK.Painting.Decoration;
using FlutterSDK.Painting.Textspan;
using FlutterSDK.Painting.Strutstyle;
using FlutterSDK.Painting.Beveledrectangleborder;
using FlutterSDK.Painting.Placeholderspan;
using FlutterSDK.Painting.Imagecache;
using FlutterSDK.Painting.Shapedecoration;
using FlutterSDK.Services.Platformviews;
using FlutterSDK.Services.Systemchannels;
using FlutterSDK.Services.Assetbundle;
using FlutterSDK.Services.Binding;
using FlutterSDK.Services.Keyboardkey;
using FlutterSDK.Services.Textformatter;
using FlutterSDK.Services.Rawkeyboardmacos;
using FlutterSDK.Services.Binarymessenger;
using FlutterSDK.Services.Messagecodecs;
using FlutterSDK.Services.Rawkeyboardfuchsia;
using FlutterSDK.Services.Hapticfeedback;
using FlutterSDK.Services.Platformmessages;
using FlutterSDK.Services.Clipboard;
using FlutterSDK.Services.Textediting;
using FlutterSDK.Services.Rawkeyboardlinux;
using FlutterSDK.Services.Textinput;
using FlutterSDK.Services.Rawkeyboardweb;
using FlutterSDK.Services.Rawkeyboard;
using FlutterSDK.Services.Systemchrome;
using FlutterSDK.Services.Systemsound;
using FlutterSDK.Services.Keyboardmaps;
using FlutterSDK.Services.Fontloader;
using FlutterSDK.Services.Systemnavigator;
using FlutterSDK.Services.Rawkeyboardandroid;
using FlutterSDK.Services.Platformchannel;
using FlutterSDK.Services.Messagecodec;
using FlutterSDK.Painting.Textpainter;
using FlutterSDK.Painting.Boxdecoration;
using FlutterSDK.Painting.Paintutilities;
using FlutterSDK.Painting.Stadiumborder;
using FlutterSDK.Painting.Basictypes;
using FlutterSDK.Painting.Alignment;
using FlutterSDK.Painting.Imageprovider;
using FlutterSDK.Painting.Boxfit;
using FlutterSDK.Painting.Continuousrectangleborder;
using FlutterSDK.Painting.Roundedrectangleborder;
using FlutterSDK.Painting.Matrixutils;
using FlutterSDK.Painting.Gradient;
using FlutterSDK.Painting.Notchedshapes;
using FlutterSDK.Painting.Fractionaloffset;
using FlutterSDK.Painting.Borderradius;
using FlutterSDK.Painting.Imageresolution;
using FlutterSDK.Painting.Flutterlogo;
using FlutterSDK.Painting.Imagedecoder;
using FlutterSDK.Painting.Boxshadow;
using FlutterSDK.Painting.Binding;
using FlutterSDK.Painting.Imagestream;
using FlutterSDK.Painting.Boxborder;
using FlutterSDK.Painting.Decorationimage;
using FlutterSDK.Painting.Clip;
using FlutterSDK.Painting.Debug;
using FlutterSDK.Painting.Shaderwarmup;
using FlutterSDK.Painting.Inlinespan;
using FlutterSDK.Painting.Geometry;
using FlutterSDK.Rendering.Image;
using FlutterSDK.Rendering.Box;
using FlutterSDK.Rendering.Slivermultiboxadaptor;
using FlutterSDK.Rendering.Error;
using FlutterSDK.Rendering.Table;
using FlutterSDK.Rendering.Tableborder;
using FlutterSDK.Rendering.Platformview;
using FlutterSDK.Rendering.Binding;
using FlutterSDK.Rendering.Sliverpersistentheader;
using FlutterSDK.Rendering.Listbody;
using FlutterSDK.Rendering.Paragraph;
using FlutterSDK.Rendering.Proxysliver;
using FlutterSDK.Rendering.@object;
using FlutterSDK.Rendering.Rotatedbox;
using FlutterSDK.Rendering.Viewport;
using FlutterSDK.Rendering.Customlayout;
using FlutterSDK.Rendering.Layer;
using FlutterSDK.Rendering.Listwheelviewport;
using FlutterSDK.Rendering.Sliverlist;
using FlutterSDK.Rendering.Flow;
using FlutterSDK.Rendering.Wrap;
using FlutterSDK.Rendering.Sliver;
using FlutterSDK.Rendering.Slivergrid;
using FlutterSDK.Rendering.Stack;
using FlutterSDK.Rendering.Mousetracking;
using FlutterSDK.Widgets.Pages;
using FlutterSDK.Widgets.Performanceoverlay;
using FlutterSDK.Widgets.Automatickeepalive;
using FlutterSDK.Widgets.Scrollcontroller;
using FlutterSDK.Widgets.Widgetinspector;
using FlutterSDK.Widgets.Icon;
using FlutterSDK.Widgets.Scrollcontext;
using FlutterSDK.Widgets.Inheritedmodel;
using FlutterSDK.Widgets.Annotatedregion;
using FlutterSDK.Widgets.Scrollnotification;
using FlutterSDK.Widgets.Scrollpositionwithsinglecontext;
using FlutterSDK.Widgets.Mediaquery;
using FlutterSDK.Widgets.Actions;
using FlutterSDK.Widgets.App;
using FlutterSDK.Widgets.Focusmanager;
using FlutterSDK.Widgets.Visibility;
using FlutterSDK.Widgets.Icondata;
using FlutterSDK.Widgets.Valuelistenablebuilder;
using FlutterSDK.Widgets.Placeholder;
using FlutterSDK.Widgets.Overlay;
using FlutterSDK.Widgets.Focustraversal;
using FlutterSDK.Widgets.Animatedlist;
using FlutterSDK.Widgets.Scrollbar;
using FlutterSDK.Widgets.Iconthemedata;
using FlutterSDK.Widgets.Sliver;
using FlutterSDK.Widgets.Animatedswitcher;
using FlutterSDK.Widgets.Orientationbuilder;
using FlutterSDK.Widgets.Dismissible;
using FlutterSDK.Widgets.Binding;
using FlutterSDK.Widgets.Scrollactivity;
using FlutterSDK.Widgets.Dragtarget;
using FlutterSDK.Widgets.Draggablescrollablesheet;
using FlutterSDK.Widgets.Tweenanimationbuilder;
using FlutterSDK.Widgets.Widgetspan;
using FlutterSDK.Widgets.Image;
using FlutterSDK.Widgets.Title;
using FlutterSDK.Widgets.Willpopscope;
using FlutterSDK.Widgets.Banner;
using FlutterSDK.Widgets.Debug;
using FlutterSDK.Widgets.Imagefilter;
using FlutterSDK.Widgets.Fadeinimage;
using FlutterSDK.Widgets.Sliverlayoutbuilder;
using FlutterSDK.Widgets.Pageview;
using FlutterSDK.Widgets.Heroes;
using FlutterSDK.Widgets.Nestedscrollview;
using FlutterSDK.Widgets.Tickerprovider;
using FlutterSDK.Widgets.Overscrollindicator;
using FlutterSDK.Widgets.Scrollconfiguration;
using FlutterSDK.Widgets.Uniquewidget;
using FlutterSDK.Widgets.Table;
using FlutterSDK.Widgets.Pagestorage;
using FlutterSDK.Widgets.Singlechildscrollview;
using FlutterSDK.Widgets.Gridpaper;
using FlutterSDK.Widgets.Sizechangedlayoutnotifier;
using FlutterSDK.Widgets.Sliverfill;
using FlutterSDK.Widgets.Scrollawareimageprovider;
using FlutterSDK.Widgets.Routes;
using FlutterSDK.Widgets.Texture;
using FlutterSDK.Widgets.Safearea;
using FlutterSDK.Widgets.Navigator;
using FlutterSDK.Widgets.Gesturedetector;
using FlutterSDK.Widgets.Localizations;
using FlutterSDK.Widgets.Animatedcrossfade;
using FlutterSDK.Widgets.Imageicon;
using FlutterSDK.Widgets.Async;
using FlutterSDK.Widgets.Scrollable;
using FlutterSDK.Widgets.Statustransitions;
using FlutterSDK.Widgets.Inheritedtheme;
using FlutterSDK.Widgets.Viewport;
using FlutterSDK.Widgets.Inheritednotifier;
using FlutterSDK.Widgets.Sliverpersistentheader;
using FlutterSDK.Widgets.Colorfilter;
using FlutterSDK.Widgets.Form;
using FlutterSDK.Widgets.Scrollsimulation;
using FlutterSDK.Widgets.Sliverprototypeextentlist;
using FlutterSDK.Widgets.Rawkeyboardlistener;
using FlutterSDK.Widgets.Shortcuts;
using FlutterSDK.Widgets.Bottomnavigationbaritem;
using FlutterSDK.Widgets.Disposablebuildcontext;
using FlutterSDK.Widgets.Scrollmetrics;
using FlutterSDK.Widgets.Modalbarrier;
using FlutterSDK.Widgets.Text;
using FlutterSDK.Widgets.Editabletext;
using FlutterSDK.Widgets.Listwheelscrollview;
using FlutterSDK.Widgets.Notificationlistener;
using FlutterSDK.Widgets.Layoutbuilder;
using FlutterSDK.Widgets.Focusscope;
using FlutterSDK.Widgets.Textselection;
using FlutterSDK.Widgets.Implicitanimations;
using FlutterSDK.Widgets.Icontheme;
using FlutterSDK.Widgets.Container;
using FlutterSDK.Widgets.Primaryscrollcontroller;
using FlutterSDK.Animation.Animationcontroller;
using FlutterSDK.Animation.Tweensequence;
using FlutterSDK.Widgets.Basic;
using FlutterSDK.Widgets.Semanticsdebugger;
using FlutterSDK.Widgets.Navigationtoolbar;
using FlutterSDK.Widgets.Platformview;
using FlutterSDK.Widgets.Transitions;
using FlutterSDK.Widgets.Preferredsize;
using FlutterSDK.Widgets.Scrollphysics;
using FlutterSDK.Widgets.Animatedsize;
using FlutterSDK.Widgets.Scrollposition;
using FlutterSDK.Widgets.Spacer;
using FlutterSDK.Widgets.Scrollview;
using FlutterSDK.Foundation;
using FlutterSDK.Foundation._Bitfieldio;
using FlutterSDK.Foundation._Isolatesio;
using FlutterSDK.Foundation._Platformio;
using FlutterSDK.Material.Appbar;
using FlutterSDK.Material.Debug;
using FlutterSDK.Material.Dialog;
using FlutterSDK.Material.Flatbutton;
using FlutterSDK.Material.Listtile;
using FlutterSDK.Material.Materiallocalizations;
using FlutterSDK.Material.Page;
using FlutterSDK.Material.Progressindicator;
using FlutterSDK.Material.Scaffold;
using FlutterSDK.Material.Scrollbar;
using FlutterSDK.Material.Theme;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Animatedicons.Animatedicons;
using FlutterSDK.Material.Animatedicons.Animatediconsdata;
using FlutterSDK.Material.Arc;
using FlutterSDK.Material.Colors;
using FlutterSDK.Material.Floatingactionbutton;
using FlutterSDK.Material.Icons;
using FlutterSDK.Material.Appbartheme;
using FlutterSDK.Material.Backbutton;
using FlutterSDK.Material.Constants;
using FlutterSDK.Material.Flexiblespacebar;
using FlutterSDK.Material.Iconbutton;
using FlutterSDK.Material.Material;
using FlutterSDK.Material.Tabs;
using FlutterSDK.Material.Texttheme;
using FlutterSDK.Material.Bannertheme;
using FlutterSDK.Material.Buttonbar;
using FlutterSDK.Material.Buttontheme;
using FlutterSDK.Material.Divider;
using FlutterSDK.Material.Bottomappbartheme;
using FlutterSDK.Material.Elevationoverlay;
using FlutterSDK.Material.Inkwell;
using FlutterSDK.Material.Bottomsheettheme;
using FlutterSDK.Material.Curves;
using FlutterSDK.Material.Materialstate;
using FlutterSDK.Material.Themedata;
using FlutterSDK.Material.Buttonbartheme;
using FlutterSDK.Material.Raisedbutton;
using FlutterSDK.Material.Colorscheme;
using FlutterSDK.Material.Materialbutton;
using FlutterSDK.Material.Outlinebutton;
using FlutterSDK.Material.Cardtheme;
using FlutterSDK.Material.Toggleable;
using FlutterSDK.Material.Checkbox;
using FlutterSDK.Material.Chiptheme;
using FlutterSDK.Material.Feedback;
using FlutterSDK.Material.Tooltip;
using FlutterSDK.Material.Dropdown;
using FlutterSDK.Material.Datatable;
using FlutterSDK.Material.Dialogtheme;
using FlutterSDK.Material.Dividertheme;
using FlutterSDK.Material.Inputdecorator;
using FlutterSDK.Material.Shadows;
using FlutterSDK.Material.Expandicon;
using FlutterSDK.Material.Mergeablematerial;
using FlutterSDK.Material.Button;
using FlutterSDK.Material.Floatingactionbuttontheme;
using FlutterSDK.Material.Inkhighlight;
using FlutterSDK.Material.Inputborder;
using FlutterSDK.Material.Reorderablelist;
using FlutterSDK.Material.Time;
using FlutterSDK.Material.Typography;
using FlutterSDK.Scheduler;
using FlutterSDK.Material.Navigationrailtheme;
using FlutterSDK.Material.Navigationrail;
using FlutterSDK.Material.Pagetransitionstheme;
using FlutterSDK.Material.Card;
using FlutterSDK.Material.Datatablesource;
using FlutterSDK.Material.Inkdecoration;
using FlutterSDK.Material.Pickers.Datepickercommon;
using FlutterSDK.Material.Pickers.Dateutils;
using FlutterSDK.Material.Pickers.Calendardatepicker;
using FlutterSDK.Material.Pickers.Datepickerheader;
using FlutterSDK.Material.Pickers.Inputdatepicker;
using FlutterSDK.Material.Textfield;
using FlutterSDK.Material.Textformfield;
using FlutterSDK.Material.Popupmenutheme;
using FlutterSDK.Material.Radio;
using FlutterSDK.Material.Slidertheme;
using FlutterSDK.Material.Bottomsheet;
using FlutterSDK.Material.Drawer;
using FlutterSDK.Material.Floatingactionbuttonlocation;
using FlutterSDK.Material.Snackbar;
using FlutterSDK.Material.Snackbartheme;
namespace FlutterSDK.Material.Search
{
internal static class SearchDefaultClass
{
/// <Summary>
/// Shows a full screen search page and returns the search result selected by
/// the user when the page is closed.
///
/// The search page consists of an app bar with a search field and a body which
/// can either show suggested search queries or the search results.
///
/// The appearance of the search page is determined by the provided
/// `delegate`. The initial query string is given by `query`, which defaults
/// to the empty string. When `query` is set to null, `delegate.query` will
/// be used as the initial query.
///
/// This method returns the selected search result, which can be set in the
/// [SearchDelegate.close] call. If the search page is closed with the system
/// back button, it returns null.
///
/// A given [SearchDelegate] can only be associated with one active [showSearch]
/// call. Call [SearchDelegate.close] before re-using the same delegate instance
/// for another [showSearch] call.
///
/// The transition to the search page triggered by this method looks best if the
/// screen triggering the transition contains an [AppBar] at the top and the
/// transition is called from an [IconButton] that's part of [AppBar.actions].
/// The animation provided by [SearchDelegate.transitionAnimation] can be used
/// to trigger additional animations in the underlying page while the search
/// page fades in or out. This is commonly used to animate an [AnimatedIcon] in
/// the [AppBar.leading] position e.g. from the hamburger menu to the back arrow
/// used to exit the search page.
///
/// See also:
///
/// * [SearchDelegate] to define the content of the search page.
/// </Summary>
internal static Future<T> ShowSearch<T>(FlutterSDK.Widgets.Framework.BuildContext context = default(FlutterSDK.Widgets.Framework.BuildContext), FlutterSDK.Material.Search.SearchDelegate<T> @delegate = default(FlutterSDK.Material.Search.SearchDelegate<T>), string query = default(string))
{
delegate.Query = query ?? delegate.Query;
delegate._CurrentBody = _SearchBody.Suggestions;
return NavigatorDefaultClass.Navigator.Of(context).Push(new _SearchPageRoute<T>(@delegate: @delegate));
}
}
/// <Summary>
/// Delegate for [showSearch] to define the content of the search page.
///
/// The search page always shows an [AppBar] at the top where users can
/// enter their search queries. The buttons shown before and after the search
/// query text field can be customized via [SearchDelegate.leading] and
/// [SearchDelegate.actions].
///
/// The body below the [AppBar] can either show suggested queries (returned by
/// [SearchDelegate.buildSuggestions]) or - once the user submits a search - the
/// results of the search as returned by [SearchDelegate.buildResults].
///
/// [SearchDelegate.query] always contains the current query entered by the user
/// and should be used to build the suggestions and results.
///
/// The results can be brought on screen by calling [SearchDelegate.showResults]
/// and you can go back to showing the suggestions by calling
/// [SearchDelegate.showSuggestions].
///
/// Once the user has selected a search result, [SearchDelegate.close] should be
/// called to remove the search page from the top of the navigation stack and
/// to notify the caller of [showSearch] about the selected search result.
///
/// A given [SearchDelegate] can only be associated with one active [showSearch]
/// call. Call [SearchDelegate.close] before re-using the same delegate instance
/// for another [showSearch] call.
/// </Summary>
public interface ISearchDelegate<T>
{
FlutterSDK.Widgets.Framework.Widget BuildSuggestions(FlutterSDK.Widgets.Framework.BuildContext context);
FlutterSDK.Widgets.Framework.Widget BuildResults(FlutterSDK.Widgets.Framework.BuildContext context);
FlutterSDK.Widgets.Framework.Widget BuildLeading(FlutterSDK.Widgets.Framework.BuildContext context);
List<FlutterSDK.Widgets.Framework.Widget> BuildActions(FlutterSDK.Widgets.Framework.BuildContext context);
FlutterSDK.Material.Themedata.ThemeData AppBarTheme(FlutterSDK.Widgets.Framework.BuildContext context);
void ShowResults(FlutterSDK.Widgets.Framework.BuildContext context);
void ShowSuggestions(FlutterSDK.Widgets.Framework.BuildContext context);
void Close(FlutterSDK.Widgets.Framework.BuildContext context, T result);
string SearchFieldLabel { get; }
FlutterSDK.Services.Textinput.TextInputType KeyboardType { get; }
FlutterSDK.Services.Textinput.TextInputAction TextInputAction { get; }
string Query { get; set; }
FlutterSDK.Animation.Animation.Animation<double> TransitionAnimation { get; }
}
/// <Summary>
/// Delegate for [showSearch] to define the content of the search page.
///
/// The search page always shows an [AppBar] at the top where users can
/// enter their search queries. The buttons shown before and after the search
/// query text field can be customized via [SearchDelegate.leading] and
/// [SearchDelegate.actions].
///
/// The body below the [AppBar] can either show suggested queries (returned by
/// [SearchDelegate.buildSuggestions]) or - once the user submits a search - the
/// results of the search as returned by [SearchDelegate.buildResults].
///
/// [SearchDelegate.query] always contains the current query entered by the user
/// and should be used to build the suggestions and results.
///
/// The results can be brought on screen by calling [SearchDelegate.showResults]
/// and you can go back to showing the suggestions by calling
/// [SearchDelegate.showSuggestions].
///
/// Once the user has selected a search result, [SearchDelegate.close] should be
/// called to remove the search page from the top of the navigation stack and
/// to notify the caller of [showSearch] about the selected search result.
///
/// A given [SearchDelegate] can only be associated with one active [showSearch]
/// call. Call [SearchDelegate.close] before re-using the same delegate instance
/// for another [showSearch] call.
/// </Summary>
public class SearchDelegate<T>
{
/// <Summary>
/// Constructor to be called by subclasses which may specify [searchFieldLabel], [keyboardType] and/or
/// [textInputAction].
///
/// {@tool snippet}
/// ```dart
/// class CustomSearchHintDelegate extends SearchDelegate {
/// CustomSearchHintDelegate({
/// String hintText,
/// }) : super(
/// searchFieldLabel: hintText,
/// keyboardType: TextInputType.text,
/// textInputAction: TextInputAction.search,
/// );
///
/// @override
/// Widget buildLeading(BuildContext context) => Text("leading");
///
/// @override
/// Widget buildSuggestions(BuildContext context) => Text("suggestions");
///
/// @override
/// Widget buildResults(BuildContext context) => Text('results');
///
/// @override
/// List<Widget> buildActions(BuildContext context) => [];
/// }
/// ```
/// {@end-tool}
/// </Summary>
public SearchDelegate(string searchFieldLabel = default(string), FlutterSDK.Services.Textinput.TextInputType keyboardType = default(FlutterSDK.Services.Textinput.TextInputType), FlutterSDK.Services.Textinput.TextInputAction textInputAction = default(FlutterSDK.Services.Textinput.TextInputAction))
{
this.SearchFieldLabel = searchFieldLabel;
this.KeyboardType = keyboardType;
this.TextInputAction = textInputAction;
}
/// <Summary>
/// The hint text that is shown in the search field when it is empty.
///
/// If this value is set to null, the value of MaterialLocalizations.of(context).searchFieldLabel will be used instead.
/// </Summary>
public virtual string SearchFieldLabel { get; set; }
/// <Summary>
/// The type of action button to use for the keyboard.
///
/// Defaults to the default value specified in [TextField].
/// </Summary>
public virtual FlutterSDK.Services.Textinput.TextInputType KeyboardType { get; set; }
/// <Summary>
/// The text input action configuring the soft keyboard to a particular action
/// button.
///
/// Defaults to [TextInputAction.search].
/// </Summary>
public virtual FlutterSDK.Services.Textinput.TextInputAction TextInputAction { get; set; }
internal virtual FlutterSDK.Widgets.Focusmanager.FocusNode _FocusNode { get; set; }
internal virtual FlutterSDK.Widgets.Editabletext.TextEditingController _QueryTextController { get; set; }
internal virtual FlutterSDK.Animation.Animations.ProxyAnimation _ProxyAnimation { get; set; }
internal virtual FlutterSDK.Foundation.Changenotifier.ValueNotifier<FlutterSDK.Material.Search._SearchBody> _CurrentBodyNotifier { get; set; }
internal virtual FlutterSDK.Material.Search._SearchPageRoute<T> _Route { get; set; }
public virtual string Query { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
public virtual FlutterSDK.Animation.Animation.Animation<double> TransitionAnimation { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
internal virtual FlutterSDK.Material.Search._SearchBody _CurrentBody { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
/// <Summary>
/// Suggestions shown in the body of the search page while the user types a
/// query into the search field.
///
/// The delegate method is called whenever the content of [query] changes.
/// The suggestions should be based on the current [query] string. If the query
/// string is empty, it is good practice to show suggested queries based on
/// past queries or the current context.
///
/// Usually, this method will return a [ListView] with one [ListTile] per
/// suggestion. When [ListTile.onTap] is called, [query] should be updated
/// with the corresponding suggestion and the results page should be shown
/// by calling [showResults].
/// </Summary>
public virtual FlutterSDK.Widgets.Framework.Widget BuildSuggestions(FlutterSDK.Widgets.Framework.BuildContext context)
{
return default(Widget);
}
/// <Summary>
/// The results shown after the user submits a search from the search page.
///
/// The current value of [query] can be used to determine what the user
/// searched for.
///
/// This method might be applied more than once to the same query.
/// If your [buildResults] method is computationally expensive, you may want
/// to cache the search results for one or more queries.
///
/// Typically, this method returns a [ListView] with the search results.
/// When the user taps on a particular search result, [close] should be called
/// with the selected result as argument. This will close the search page and
/// communicate the result back to the initial caller of [showSearch].
/// </Summary>
public virtual FlutterSDK.Widgets.Framework.Widget BuildResults(FlutterSDK.Widgets.Framework.BuildContext context)
{
return default(Widget);
}
/// <Summary>
/// A widget to display before the current query in the [AppBar].
///
/// Typically an [IconButton] configured with a [BackButtonIcon] that exits
/// the search with [close]. One can also use an [AnimatedIcon] driven by
/// [transitionAnimation], which animates from e.g. a hamburger menu to the
/// back button as the search overlay fades in.
///
/// Returns null if no widget should be shown.
///
/// See also:
///
/// * [AppBar.leading], the intended use for the return value of this method.
/// </Summary>
public virtual FlutterSDK.Widgets.Framework.Widget BuildLeading(FlutterSDK.Widgets.Framework.BuildContext context)
{
return default(Widget);
}
/// <Summary>
/// Widgets to display after the search query in the [AppBar].
///
/// If the [query] is not empty, this should typically contain a button to
/// clear the query and show the suggestions again (via [showSuggestions]) if
/// the results are currently shown.
///
/// Returns null if no widget should be shown
///
/// See also:
///
/// * [AppBar.actions], the intended use for the return value of this method.
/// </Summary>
public virtual List<FlutterSDK.Widgets.Framework.Widget> BuildActions(FlutterSDK.Widgets.Framework.BuildContext context)
{
return default(List<Widget>);
}
/// <Summary>
/// The theme used to style the [AppBar].
///
/// By default, a white theme is used.
///
/// See also:
///
/// * [AppBar.backgroundColor], which is set to [ThemeData.primaryColor].
/// * [AppBar.iconTheme], which is set to [ThemeData.primaryIconTheme].
/// * [AppBar.textTheme], which is set to [ThemeData.primaryTextTheme].
/// * [AppBar.brightness], which is set to [ThemeData.primaryColorBrightness].
/// </Summary>
public virtual FlutterSDK.Material.Themedata.ThemeData AppBarTheme(FlutterSDK.Widgets.Framework.BuildContext context)
{
ThemeData theme = ThemeDefaultClass.Theme.Of(context);
return theme.CopyWith(primaryColor: ColorsDefaultClass.Colors.White, primaryIconTheme: theme.PrimaryIconTheme.CopyWith(color: ColorsDefaultClass.Colors.Grey), primaryColorBrightness: Brightness.Light, primaryTextTheme: theme.TextTheme);
}
/// <Summary>
/// Transition from the suggestions returned by [buildSuggestions] to the
/// [query] results returned by [buildResults].
///
/// If the user taps on a suggestion provided by [buildSuggestions] the
/// screen should typically transition to the page showing the search
/// results for the suggested query. This transition can be triggered
/// by calling this method.
///
/// See also:
///
/// * [showSuggestions] to show the search suggestions again.
/// </Summary>
public virtual void ShowResults(FlutterSDK.Widgets.Framework.BuildContext context)
{
_FocusNode?.Unfocus();
_CurrentBody = _SearchBody.Results;
}
/// <Summary>
/// Transition from showing the results returned by [buildResults] to showing
/// the suggestions returned by [buildSuggestions].
///
/// Calling this method will also put the input focus back into the search
/// field of the [AppBar].
///
/// If the results are currently shown this method can be used to go back
/// to showing the search suggestions.
///
/// See also:
///
/// * [showResults] to show the search results.
/// </Summary>
public virtual void ShowSuggestions(FlutterSDK.Widgets.Framework.BuildContext context)
{
_FocusNode.RequestFocus();
_CurrentBody = _SearchBody.Suggestions;
}
/// <Summary>
/// Closes the search page and returns to the underlying route.
///
/// The value provided for `result` is used as the return value of the call
/// to [showSearch] that launched the search initially.
/// </Summary>
public virtual void Close(FlutterSDK.Widgets.Framework.BuildContext context, T result)
{
_CurrentBody = null;
_FocusNode?.Unfocus();
NavigatorDefaultClass.Navigator.Of(context);
NavigatorDefaultClass.Navigator.Of(context).PopUntil((Route<object> route) => =>route == _Route);
NavigatorDefaultClass.Navigator.Of(context).Pop(result);
}
}
public class _SearchPageRoute<T> : FlutterSDK.Widgets.Pages.PageRoute<T>
{
public _SearchPageRoute(FlutterSDK.Material.Search.SearchDelegate<T> @delegate = default(FlutterSDK.Material.Search.SearchDelegate<T>))
: base()
{
this.@delegate = @delegate;
Delegate._Route = this;
}
public virtual FlutterSDK.Material.Search.SearchDelegate<T> @delegate { get; set; }
public virtual FlutterBinding.UI.Color BarrierColor { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
public virtual string BarrierLabel { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
public virtual TimeSpan TransitionDuration { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
public virtual bool MaintainState { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
public new FlutterSDK.Widgets.Framework.Widget BuildTransitions(FlutterSDK.Widgets.Framework.BuildContext context, FlutterSDK.Animation.Animation.Animation<double> animation, FlutterSDK.Animation.Animation.Animation<double> secondaryAnimation, FlutterSDK.Widgets.Framework.Widget child)
{
return new FadeTransition(opacity: animation, child: child);
}
public new FlutterSDK.Animation.Animation.Animation<double> CreateAnimation()
{
Animation<double> animation = base.CreateAnimation();
Delegate._ProxyAnimation.Parent = animation;
return animation;
}
public new FlutterSDK.Widgets.Framework.Widget BuildPage(FlutterSDK.Widgets.Framework.BuildContext context, FlutterSDK.Animation.Animation.Animation<double> animation, FlutterSDK.Animation.Animation.Animation<double> secondaryAnimation)
{
return new _SearchPage<T>(@delegate: @Delegate, animation: animation);
}
public new void DidComplete(T result)
{
base.DidComplete(result);
Delegate._Route = null;
Delegate._CurrentBody = null;
}
}
public class _SearchPage<T> : FlutterSDK.Widgets.Framework.StatefulWidget
{
public _SearchPage(FlutterSDK.Material.Search.SearchDelegate<T> @delegate = default(FlutterSDK.Material.Search.SearchDelegate<T>), FlutterSDK.Animation.Animation.Animation<double> animation = default(FlutterSDK.Animation.Animation.Animation<double>))
{
this.@delegate = @delegate;
this.Animation = animation;
}
public virtual FlutterSDK.Material.Search.SearchDelegate<T> @delegate { get; set; }
public virtual FlutterSDK.Animation.Animation.Animation<double> Animation { get; set; }
public new FlutterSDK.Widgets.Framework.State<FlutterSDK.Widgets.Framework.StatefulWidget> CreateState() => new _SearchPageState<T>();
}
public class _SearchPageState<T> : FlutterSDK.Widgets.Framework.State<FlutterSDK.Material.Search._SearchPage<T>>
{
public _SearchPageState()
{ }
public virtual FlutterSDK.Widgets.Focusmanager.FocusNode FocusNode { get; set; }
public new void InitState()
{
base.InitState();
Widget.Delegate._QueryTextController.AddListener(_OnQueryChanged);
Widget.Animation.AddStatusListener(_OnAnimationStatusChanged);
Widget.Delegate._CurrentBodyNotifier.AddListener(_OnSearchBodyChanged);
FocusNode.AddListener(_OnFocusChanged);
Widget.Delegate._FocusNode = FocusNode;
}
public new void Dispose()
{
base.Dispose();
Widget.Delegate._QueryTextController.RemoveListener(_OnQueryChanged);
Widget.Animation.RemoveStatusListener(_OnAnimationStatusChanged);
Widget.Delegate._CurrentBodyNotifier.RemoveListener(_OnSearchBodyChanged);
Widget.Delegate._FocusNode = null;
FocusNode.Dispose();
}
private void _OnAnimationStatusChanged(FlutterSDK.Animation.Animation.AnimationStatus status)
{
if (status != AnimationStatus.Completed)
{
return;
}
Widget.Animation.RemoveStatusListener(_OnAnimationStatusChanged);
if (Widget.Delegate._CurrentBody == _SearchBody.Suggestions)
{
FocusNode.RequestFocus();
}
}
public new void DidUpdateWidget(FlutterSDK.Material.Search._SearchPage<T> oldWidget)
{
base.DidUpdateWidget(oldWidget);
if (Widget.Delegate != oldWidget.Delegate)
{
oldWidget.Delegate._QueryTextController.RemoveListener(_OnQueryChanged);
Widget.Delegate._QueryTextController.AddListener(_OnQueryChanged);
oldWidget.Delegate._CurrentBodyNotifier.RemoveListener(_OnSearchBodyChanged);
Widget.Delegate._CurrentBodyNotifier.AddListener(_OnSearchBodyChanged);
oldWidget.Delegate._FocusNode = null;
Widget.Delegate._FocusNode = FocusNode;
}
}
private void _OnFocusChanged()
{
if (FocusNode.HasFocus && Widget.Delegate._CurrentBody != _SearchBody.Suggestions)
{
Widget.Delegate.ShowSuggestions(Context);
}
}
private void _OnQueryChanged()
{
SetState(() =>
{
}
);
}
private void _OnSearchBodyChanged()
{
SetState(() =>
{
}
);
}
public new FlutterSDK.Widgets.Framework.Widget Build(FlutterSDK.Widgets.Framework.BuildContext context)
{
ThemeData theme = Widget.Delegate.AppBarTheme(context);
string searchFieldLabel = Widget.Delegate.SearchFieldLabel ?? MateriallocalizationsDefaultClass.MaterialLocalizations.Of(context).SearchFieldLabel;
Widget body = default(Widget);
switch (Widget.Delegate._CurrentBody) { case _SearchBody.Suggestions: body = new KeyedSubtree(key: new ValueKey<_SearchBody>(_SearchBody.Suggestions), child: Widget.Delegate.BuildSuggestions(context)); break; case _SearchBody.Results: body = new KeyedSubtree(key: new ValueKey<_SearchBody>(_SearchBody.Results), child: Widget.Delegate.BuildResults(context)); break; }
string routeName = default(string);
switch (theme.Platform) { case TargetPlatform.IOS: case TargetPlatform.MacOS: routeName = ""; break; case TargetPlatform.Android: case TargetPlatform.Fuchsia: case TargetPlatform.Linux: case TargetPlatform.Windows: routeName = searchFieldLabel; }
return new Semantics(explicitChildNodes: true, scopesRoute: true, namesRoute: true, label: routeName, child: new Scaffold(appBar: new AppBar(backgroundColor: theme.PrimaryColor, iconTheme: theme.PrimaryIconTheme, textTheme: theme.PrimaryTextTheme, brightness: theme.PrimaryColorBrightness, leading: Widget.Delegate.BuildLeading(context), title: new TextField(controller: Widget.Delegate._QueryTextController, focusNode: FocusNode, style: theme.TextTheme.Headline6, textInputAction: Widget.Delegate.TextInputAction, keyboardType: Widget.Delegate.KeyboardType, onSubmitted: (string _) =>
{
Widget.Delegate.ShowResults(context);
}
, decoration: new InputDecoration(border: InputborderDefaultClass.InputBorder.None, hintText: searchFieldLabel, hintStyle: theme.InputDecorationTheme.HintStyle)), actions: Widget.Delegate.BuildActions(context)), body: new AnimatedSwitcher(duration: new TimeSpan(milliseconds: 300), child: body)));
}
}
/// <Summary>
/// Describes the body that is currently shown under the [AppBar] in the
/// search page.
/// </Summary>
public enum _SearchBody
{
/// <Summary>
/// Suggested queries are shown in the body.
///
/// The suggested queries are generated by [SearchDelegate.buildSuggestions].
/// </Summary>
Suggestions,
/// <Summary>
/// Search results are currently shown in the body.
///
/// The search results are generated by [SearchDelegate.buildResults].
/// </Summary>
Results,
}
}
| 42.700101 | 597 | 0.740989 | [
"MIT"
] | JeroMiya/xamarin.flutter | FlutterSDK/src/Material/Search.cs | 42,145 | C# |
#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
#endregion
namespace Blazorise.Base
{
public abstract class BaseSimpleText : BaseComponent
{
#region Members
private TextColor color = TextColor.None;
private TextAlignment alignment = TextAlignment.Left;
private TextTransform textTransform = TextTransform.None;
private TextWeight textWeight = TextWeight.None;
private bool isItalic = false;
#endregion
#region Methods
protected override void RegisterClasses()
{
ClassMapper
.If( () => ClassProvider.SimpleTextColor( Color ), () => Color != TextColor.None )
.If( () => ClassProvider.SimpleTextAlignment( Alignment ), () => Alignment != TextAlignment.None )
.If( () => ClassProvider.SimpleTextTransform( Transform ), () => Transform != TextTransform.None )
.If( () => ClassProvider.SimpleTextWeight( Weight ), () => Weight != TextWeight.None )
.If( () => ClassProvider.SimpleTextItalic(), () => IsItalic );
base.RegisterClasses();
}
#endregion
#region Properties
[Parameter]
protected TextColor Color
{
get => color;
set
{
color = value;
ClassMapper.Dirty();
}
}
[Parameter]
protected TextAlignment Alignment
{
get => alignment;
set
{
alignment = value;
ClassMapper.Dirty();
}
}
[Parameter]
protected TextTransform Transform
{
get => textTransform;
set
{
textTransform = value;
ClassMapper.Dirty();
}
}
[Parameter]
protected TextWeight Weight
{
get => textWeight;
set
{
textWeight = value;
ClassMapper.Dirty();
}
}
[Parameter]
protected bool IsItalic
{
get => isItalic;
set
{
isItalic = value;
ClassMapper.Dirty();
}
}
[Parameter] protected RenderFragment ChildContent { get; set; }
#endregion
}
}
| 23 | 114 | 0.505929 | [
"MIT"
] | Anberm/Blazorise | Source/Blazorise/Base/BaseSimpleText.cs | 2,532 | 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.
using Xunit;
namespace System.ComponentModel.Tests
{
public class ContainerFilterServiceTests
{
[Fact]
public void FilterComponents_Invoke_ReturnsComponents()
{
var service = new SubContainerFilterService();
Assert.Null(service.FilterComponents(null));
var components = new ComponentCollection(new Component[] { new Component() });
Assert.Same(components, service.FilterComponents(components));
}
private class SubContainerFilterService : ContainerFilterService
{
}
}
}
| 30.5 | 90 | 0.679697 | [
"MIT"
] | 06needhamt/runtime | src/libraries/System.ComponentModel.TypeConverter/tests/ContainerFilterServiceTests.cs | 793 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IntegerExpression.cs" company="WildGums">
// Copyright (c) 2008 - 2014 WildGums. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Orc.FilterBuilder
{
using System;
using System.Diagnostics;
using System.Runtime.Serialization;
[DebuggerDisplay("{ValueControlType} {SelectedCondition} {Value}")]
[Serializable]
public class NumericExpression : NumericExpression<double>
{
protected NumericExpression(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public NumericExpression()
{
IsDecimal = true;
IsSigned = true;
ValueControlType = ValueControlType.Numeric;
}
public NumericExpression(Type type)
: this()
{
IsNullable = type.IsNullable();
}
}
}
| 30.054054 | 120 | 0.481115 | [
"MIT"
] | half-evil/Orc.FilterBuilder | src/Orc.FilterBuilder/Expressions/NumericExpression.cs | 1,114 | C# |
using System;
using System.Collections.Generic;
using DataStructures.Common;
using DataStructures.Lists;
namespace DataStructures.Heaps
{
/// <summary>
/// BINOMIAL MIN HEAP Data Structure
/// </summary>
public class BinomialMinHeap<T> : IMinHeap<T> where T : IComparable<T>
{
/// <summary>
/// The Heap Node class.
/// </summary>
private class BinomialNode<T> where T : IComparable<T>
{
public T Value { get; set; }
public BinomialNode<T> Parent { get; set; }
public BinomialNode<T> Sibling { get; set; } // Right-Sibling
public BinomialNode<T> Child { get; set; } // Left-Child
// Constructors
public BinomialNode() : this(default(T), null, null, null) { }
public BinomialNode(T value) : this(value, null, null, null) { }
public BinomialNode(T value, BinomialNode<T> parent, BinomialNode<T> sibling, BinomialNode<T> child)
{
Value = value;
Parent = parent;
Sibling = sibling;
Child = child;
}
// Helper boolean flags
public bool HasSiblings
{
get { return this.Sibling != null; }
}
public bool HasChildren
{
get { return this.Child != null; }
}
}
/// <summary>
/// INSTANCE VARIABLES
/// </summary>
private int _size { get; set; }
private const int _defaultCapacity = 8;
private ArrayList<BinomialNode<T>> _forest { get; set; }
/// <summary>
/// CONSTRUCTORS
/// </summary>
public BinomialMinHeap()
: this(8)
{
// Empty constructor
}
public BinomialMinHeap(int capacity)
{
if (capacity <= 0)
throw new ArgumentOutOfRangeException();
capacity = (capacity < _defaultCapacity ? _defaultCapacity : capacity);
_size = 0;
_forest = new ArrayList<BinomialNode<T>>(capacity);
}
/************************************************************************************************/
/** PRIVATE HELPER FUNCTIONS */
/// <summary>
/// Removes root of tree at he specified index.
/// </summary>
private void _removeAtIndex(int minIndex)
{
// Get the deletedTree
// The min-root lies at _forest[minIndex]
BinomialNode<T> deletedTreeRoot = _forest[minIndex].Child;
// Exit if there was no children under old-min-root
if (deletedTreeRoot == null)
return;
// CONSTRUCT H'' (double-prime)
BinomialMinHeap<T> deletedForest = new BinomialMinHeap<T>();
deletedForest._forest.Resize(minIndex + 1);
deletedForest._size = (1 << minIndex) - 1;
for (int i = (minIndex - 1); i >= 0; --i)
{
deletedForest._forest[i] = deletedTreeRoot;
deletedTreeRoot = deletedTreeRoot.Sibling;
deletedForest._forest[i].Sibling = null;
}
// CONSTRUCT H' (single-prime)
_forest[minIndex] = null;
_size = deletedForest._size + 1;
Merge(deletedForest);
// Decrease the size
--_size;
}
/// <summary>
/// Returns index of the tree with the minimum root's value.
/// </summary>
private int _findMinIndex()
{
int i, minIndex;
// Loop until you reach a slot in the _forest that is not null.
// The final value of "i" will be pointing to the non-null _forest slot.
for (i = 0; i < _forest.Count && _forest[i] == null; ++i) ;
// Loop over the trees in forest, and return the index of the slot that has the tree with the min-valued root
for (minIndex = i; i < _forest.Count; ++i)
if (_forest[i] != null && (_forest[i].Value.IsLessThan(_forest[minIndex].Value)))
minIndex = i;
return minIndex;
}
/// <summary>
/// Combines two trees and returns the new tree root node.
/// </summary>
private BinomialNode<T> _combineTrees(BinomialNode<T> firstTreeRoot, BinomialNode<T> secondTreeRoot)
{
if (firstTreeRoot == null || secondTreeRoot == null)
throw new ArgumentNullException("Either one of the nodes or both are null.");
if (secondTreeRoot.Value.IsLessThan(firstTreeRoot.Value))
return _combineTrees(secondTreeRoot, firstTreeRoot);
secondTreeRoot.Sibling = firstTreeRoot.Child;
firstTreeRoot.Child = secondTreeRoot;
secondTreeRoot.Parent = firstTreeRoot;
return firstTreeRoot;
}
/// <summary>
/// Clones a tree, given it's root node.
/// </summary>
private BinomialNode<T> _cloneTree(BinomialNode<T> treeRoot)
{
if (treeRoot == null)
return null;
return new BinomialNode<T>() { Value = treeRoot.Value, Child = _cloneTree(treeRoot.Child), Sibling = _cloneTree(treeRoot.Sibling) };
}
/************************************************************************************************/
/** PUBLIC API FUNCTIONS */
/// <summary>
/// Returns count of elements in heap.
/// </summary>
public int Count
{
get { return _size; }
}
/// <summary>
/// Checks if heap is empty
/// </summary>
/// <returns></returns>
public bool IsEmpty
{
get { return (_size == 0); }
}
/// <summary>
/// Initializes this heap with a collection of elements.
/// </summary>
public void Initialize(IList<T> newCollection)
{
if (newCollection == null)
throw new ArgumentNullException();
if (newCollection.Count > ArrayList<T>.MAXIMUM_ARRAY_LENGTH_x64)
throw new OverflowException();
_forest = new ArrayList<BinomialNode<T>>(newCollection.Count + 1);
for (int i = 0; i < newCollection.Count; ++i)
this.Add(newCollection[i]);
}
/// <summary>
/// Inserts a new item to heap.
/// </summary>
public void Add(T heapKey)
{
var tempHeap = new BinomialMinHeap<T>();
tempHeap._forest.Add(new BinomialNode<T>(heapKey));
tempHeap._size = 1;
// Merge this with tempHeap
Merge(tempHeap);
// Increase the _size
++_size;
}
/// <summary>
/// Return the min element.
/// </summary>
public T Peek()
{
if (IsEmpty)
throw new Exception("Heap is empty.");
int minIndex = _findMinIndex();
var minValue = _forest[minIndex].Value;
return minValue;
}
/// <summary>
/// Remove the min element from heap.
/// </summary>
public void RemoveMin()
{
if (IsEmpty)
throw new Exception("Heap is empty.");
_removeAtIndex(_findMinIndex());
}
/// <summary>
/// Return the min element and then remove it from heap.
/// </summary>
public T ExtractMin()
{
if (IsEmpty)
throw new Exception("Heap is empty.");
// Get the min-node index
int minIndex = _findMinIndex();
var minValue = _forest[minIndex].Value;
// Remove min from heap
_removeAtIndex(minIndex);
return minValue;
}
/// <summary>
/// Merges the elements of another heap with this heap.
/// </summary>
public void Merge(BinomialMinHeap<T> otherHeap)
{
// Avoid aliasing problems
if (this == otherHeap)
return;
// Avoid null or empty cases
if (otherHeap == null || otherHeap.IsEmpty)
return;
BinomialNode<T> carryNode = null;
_size = _size + otherHeap._size;
// One capacity-change step
if (_size > _forest.Count)
{
int newSize = Math.Max(this._forest.Count, otherHeap._forest.Count) + 1;
this._forest.Resize(newSize);
}
for (int i = 0, j = 1; j <= _size; i++, j *= 2)
{
BinomialNode<T> treeRoot1 = (_forest.IsEmpty == true ? null : _forest[i]);
BinomialNode<T> treeRoot2 = (i < otherHeap._forest.Count ? otherHeap._forest[i] : null);
int whichCase = (treeRoot1 == null ? 0 : 1);
whichCase += (treeRoot2 == null ? 0 : 2);
whichCase += (carryNode == null ? 0 : 4);
switch (whichCase)
{
/*** SINGLE CASES ***/
case 0: /* No trees */
case 1: /* Only this */
break;
case 2: /* Only otherHeap */
this._forest[i] = treeRoot2;
otherHeap._forest[i] = null;
break;
case 4: /* Only carryNode */
this._forest[i] = carryNode;
carryNode = null;
break;
/*** BINARY CASES ***/
case 3: /* this and otherHeap */
carryNode = _combineTrees(treeRoot1, treeRoot2);
this._forest[i] = otherHeap._forest[i] = null;
break;
case 5: /* this and carryNode */
carryNode = _combineTrees(treeRoot1, carryNode);
this._forest[i] = null;
break;
case 6: /* otherHeap and carryNode */
carryNode = _combineTrees(treeRoot2, carryNode);
otherHeap._forest[i] = null;
break;
case 7: /* all the nodes */
this._forest[i] = carryNode;
carryNode = _combineTrees(treeRoot1, treeRoot2);
otherHeap._forest[i] = null;
break;
}//end-switch
}//end-for
// Clear otherHeap
otherHeap.Clear();
}
/// <summary>
/// Returns an array copy of heap.
/// </summary>
public T[] ToArray()
{
throw new NotImplementedException();
}
/// <summary>
/// Rebuilds the heap.
/// </summary>
public void RebuildHeap()
{
throw new NotImplementedException();
}
/// <summary>
/// Returns a list copy of heap.
/// </summary>
public List<T> ToList()
{
throw new NotImplementedException();
}
/// <summary>
/// Returns a binomial max-heap copy of this instance.
/// </summary>
public IMaxHeap<T> ToMaxHeap()
{
throw new NotImplementedException();
}
/// <summary>
/// Clear this instance.
/// </summary>
public void Clear()
{
_size = 0;
_forest.Clear();
}
}
}
| 31.713528 | 144 | 0.472148 | [
"MIT"
] | 4L4M1N/C-Sharp-Algorithms | DataStructures/Heaps/BinomialMinHeap.cs | 11,958 | C# |
using System.Collections.Generic;
using System.Runtime.Serialization;
using SnipeSharp.Serialization;
namespace SnipeSharp.Filters
{
/// <summary>
/// A filter for assets, featuring asset-only search fields.
/// </summary>
public sealed class AssetSearchFilter : AbstractAssetSearchFilter, ISortableSearchFilter<AssetSearchColumn?>
{
/// <inheritdoc />
[SerializeAs("limit")]
public int? Limit { get; set; } = null;
/// <inheritdoc />
[SerializeAs("offset")]
public int? Offset { get; set; } = null;
/// <inheritdoc />
[SerializeAs("search")]
public string Search { get; set; }
/// <inheritdoc />
[SerializeAs("sort")]
public AssetSearchColumn? SortColumn { get; set; } = null;
/// <inheritdoc />
[SerializeAs("order")]
public SearchOrder? Order { get; set; } = null;
/// <summary>
/// Initialize a new instance of the AssetSearchFilter class.
/// </summary>
public AssetSearchFilter()
{
}
/// <summary>
/// Initialize a new instance of the AssetSearchFilter class with the specified search string.
/// </summary>
public AssetSearchFilter(string searchString)
{
Search = searchString;
}
/// <summary>
/// Adds a custom field to this filter.
/// </summary>
/// <remarks>These will be passed as a dictionary under the "filter" key.</remarks>
/// <param name="name">The name of the field. This is the column name, not the friendly name.</param>
/// <param name="value">The value of the field.</param>
/// <returns>A reference to this instance after the AddField operation has completed.</returns>
public AssetSearchFilter AddField(string name, string value)
{
CustomFields[name] = value;
return this;
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if(null != CustomFields && CustomFields.Count > 0)
_customFields = CustomFields;
}
}
}
| 32.102941 | 112 | 0.584975 | [
"MIT"
] | cofl/SnipeSharp | SnipeSharp/Filters/AssetSearchFilter.cs | 2,183 | C# |
using UnityEngine;
using CW.Common;
namespace SpaceGraphicsToolkit
{
/// <summary>This component allows you to move the current GameObject based on WASD/mouse/finger drags. NOTE: This requires the CwInputManager in your scene to function.</summary>
[HelpURL(SgtCommon.HelpUrlPrefix + "SgtCameraMove")]
[AddComponentMenu(SgtCommon.ComponentMenuPrefix + "Camera Move")]
public class SgtCameraMove : MonoBehaviour
{
public enum RotationType
{
None,
Acceleration,
MainCamera
}
/// <summary>Is this component currently listening for inputs?</summary>
public bool Listen { set { listen = value; } get { return listen; } } [SerializeField] private bool listen = true;
/// <summary>How quickly the position goes to the target value (-1 = instant).</summary>
public float Damping { set { damping = value; } get { return damping; } } [SerializeField] private float damping = 10.0f;
/// <summary>If you want movements to apply to Rigidbody.velocity, set it here.</summary>
public Rigidbody Target { set { target = value; } get { return target; } } [SerializeField] private Rigidbody target;
/// <summary>If the target is something like a spaceship, rotate it based on movement?</summary>
public RotationType TargetRotation { set { targetRotation = value; } get { return targetRotation; } } [SerializeField] private RotationType targetRotation;
/// <summary>The speed of the velocity rotation.</summary>
public float TargetDamping { set { targetDamping = value; } get { return targetDamping; } } [SerializeField] private float targetDamping = 1.0f;
/// <summary>The movement speed will be multiplied by this when near to planets.</summary>
public float SpeedMin { set { speedMin = value; } get { return speedMin; } } [SerializeField] private float speedMin = 1.0f;
/// <summary>The movement speed will be multiplied by this when far from planets.</summary>
public float SpeedMax { set { speedMax = value; } get { return speedMax; } } [SerializeField] private float speedMax = 10.0f;
/// <summary>The higher you set this, the faster the <b>SpeedMin</b> value will be reached when approaching planets.</summary>
public float SpeedRange { set { speedRange = value; } get { return speedRange; } } [SerializeField] private float speedRange = 100.0f;
/// <summary></summary>
public float SpeedWheel { set { speedWheel = value; } get { return speedWheel; } } [SerializeField] [Range(0.0f, 0.5f)] private float speedWheel = 0.1f;
/// <summary>The keys/fingers required to move left/right.</summary>
public CwInputManager.Axis HorizontalControls { set { horizontalControls = value; } get { return horizontalControls; } } [SerializeField] private CwInputManager.Axis horizontalControls = new CwInputManager.Axis(2, false, CwInputManager.AxisGesture.HorizontalDrag, 1.0f, KeyCode.A, KeyCode.D, KeyCode.LeftArrow, KeyCode.RightArrow, 100.0f);
/// <summary>The keys/fingers required to move backward/forward.</summary>
public CwInputManager.Axis DepthControls { set { depthControls = value; } get { return depthControls; } } [SerializeField] private CwInputManager.Axis depthControls = new CwInputManager.Axis(2, false, CwInputManager.AxisGesture.HorizontalDrag, 1.0f, KeyCode.S, KeyCode.W, KeyCode.DownArrow, KeyCode.UpArrow, 100.0f);
/// <summary>The keys/fingers required to move down/up.</summary>
public CwInputManager.Axis VerticalControls { set { verticalControls = value; } get { return verticalControls; } } [SerializeField] private CwInputManager.Axis verticalControls = new CwInputManager.Axis(3, false, CwInputManager.AxisGesture.HorizontalDrag, 1.0f, KeyCode.F, KeyCode.R, KeyCode.None, KeyCode.None, 100.0f);
[System.NonSerialized]
private Vector3 remainingDelta;
[System.NonSerialized]
private Vector3 lastFixedDelta;
private Vector3 GetDelta(float deltaTime)
{
var delta = default(Vector3);
delta.x = horizontalControls.GetValue(deltaTime);
delta.y = verticalControls.GetValue(deltaTime);
delta.z = depthControls.GetValue(deltaTime);
return delta;
}
protected virtual void OnEnable()
{
CwInputManager.EnsureThisComponentExists();
}
protected virtual void Update()
{
lastFixedDelta = GetDelta(Time.fixedDeltaTime);
if (target == null && listen == true)
{
AddToDelta(GetDelta(Time.deltaTime));
DampenDelta();
}
if (CwInput.GetMouseExists() == true)
{
speedRange *= 1.0f - Mathf.Clamp(CwInput.GetMouseWheelDelta(), -1.0f, 1.0f) * speedWheel;
}
}
protected virtual void FixedUpdate()
{
if (target != null && listen == true)
{
AddToDelta(lastFixedDelta);
DampenDelta();
}
}
private float GetSpeedMultiplier()
{
if (speedMax > 0.0f)
{
var distance = float.PositiveInfinity;
SgtCommon.InvokeCalculateDistance(transform.position, ref distance);
var distance01 = Mathf.InverseLerp(speedMin * speedRange, speedMax * speedRange, distance);
return Mathf.Lerp(speedMin, speedMax, distance01);
}
return 0.0f;
}
private void AddToDelta(Vector3 delta)
{
// Store old position
var oldPosition = transform.position;
// Translate
transform.Translate(delta * GetSpeedMultiplier(), Space.Self);
// Add to remaining
var acceleration = transform.position - oldPosition;
remainingDelta += acceleration;
// Revert position
transform.position = oldPosition;
// Rotate to acceleration?
if (target != null && targetRotation != RotationType.None && delta != Vector3.zero)
{
var factor = CwHelper.DampenFactor(targetDamping, Time.deltaTime);
var rotation = target.transform.rotation;
switch (targetRotation)
{
case RotationType.Acceleration:
{
rotation = Quaternion.LookRotation(acceleration, target.transform.up);
}
break;
case RotationType.MainCamera:
{
var camera = Camera.main;
if (camera != null)
{
rotation = camera.transform.rotation;
}
}
break;
}
target.transform.rotation = Quaternion.Slerp(target.transform.rotation, rotation, factor);
target.angularVelocity = Vector3.Lerp(target.angularVelocity, Vector3.zero, factor);
}
}
private void DampenDelta()
{
// Dampen remaining delta
var factor = CwHelper.DampenFactor(damping, Time.deltaTime);
var newDelta = Vector3.Lerp(remainingDelta, Vector3.zero, factor);
// Translate by difference
if (target != null)
{
target.velocity += remainingDelta - newDelta;
}
else
{
transform.position += remainingDelta - newDelta;
}
// Update remaining
remainingDelta = newDelta;
}
}
}
#if UNITY_EDITOR
namespace SpaceGraphicsToolkit
{
using UnityEditor;
using TARGET = SgtCameraMove;
[CanEditMultipleObjects]
[CustomEditor(typeof(TARGET))]
public class SgtCameraMove_Editor : CwEditor
{
protected override void OnInspector()
{
TARGET tgt; TARGET[] tgts; GetTargets(out tgt, out tgts);
Draw("listen", "Is this component currently listening for inputs?");
Draw("damping", "How quickly the position goes to the target value (-1 = instant).");
Separator();
Draw("target", "If you want movements to apply to Rigidbody.velocity, set it here.");
Draw("targetRotation", "If the target is something like a spaceship, rotate it based on movement?");
Draw("targetDamping", "The speed of the velocity rotation.");
Separator();
Draw("speedMin", "The movement speed will be multiplied by this when near to planets.");
Draw("speedMax", "The movement speed will be multiplied by this when far from planets.");
Draw("speedRange", "The higher you set this, the faster the <b>SpeedMin</b> value will be reached when approaching planets.");
Draw("speedWheel");
Separator();
Draw("horizontalControls", "The keys/fingers required to move right/left.");
Draw("depthControls", "The keys/fingers required to move backward/forward.");
Draw("verticalControls", "The keys/fingers required to move down/up.");
}
}
}
#endif | 35.816964 | 341 | 0.712701 | [
"MIT"
] | RaimundoGallino/EonHey-VR-Experience | Assets/Plugins/CW/SpaceGraphicsToolkit/Features/Shared/Examples/Scripts/SgtCameraMove.cs | 8,023 | C# |
using DCL.Controllers;
using DCL.Helpers;
using DCL.Interface;
using DCL.Models;
using DCL.Configuration;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using DCL.Components;
using Newtonsoft.Json;
using UnityEngine;
namespace DCL
{
public class SceneController : ISceneController
{
public static bool VERBOSE = false;
public bool enabled { get; set; } = true;
private Coroutine deferredDecodingCoroutine;
public void Initialize()
{
sceneSortDirty = true;
positionDirty = true;
lastSortFrame = 0;
enabled = true;
Environment.i.platform.debugController.OnDebugModeSet += OnDebugModeSet;
// We trigger the Decentraland logic once SceneController has been instanced and is ready to act.
WebInterface.StartDecentraland();
if (deferredMessagesDecoding) // We should be able to delete this code
deferredDecodingCoroutine = CoroutineStarter.Start(DeferredDecoding()); //
DCLCharacterController.OnCharacterMoved += SetPositionDirty;
CommonScriptableObjects.sceneID.OnChange += OnCurrentSceneIdChange;
//TODO(Brian): Move those subscriptions elsewhere.
PoolManager.i.OnGet -= Environment.i.platform.physicsSyncController.MarkDirty;
PoolManager.i.OnGet += Environment.i.platform.physicsSyncController.MarkDirty;
PoolManager.i.OnGet -= Environment.i.platform.cullingController.objectsTracker.MarkDirty;
PoolManager.i.OnGet += Environment.i.platform.cullingController.objectsTracker.MarkDirty;
}
private void OnDebugModeSet()
{
Environment.i.world.sceneBoundsChecker.SetFeedbackStyle(new SceneBoundsFeedbackStyle_RedFlicker());
}
public void Start()
{
if (prewarmSceneMessagesPool)
{
for (int i = 0; i < 100000; i++)
{
sceneMessagesPool.Enqueue(new QueuedSceneMessage_Scene());
}
}
if (prewarmEntitiesPool)
{
EnsureEntityPool();
}
// Warmup some shader variants
Resources.Load<ShaderVariantCollection>("ShaderVariantCollections/shaderVariants-selected").WarmUp();
}
public void Dispose()
{
PoolManager.i.OnGet -= Environment.i.platform.physicsSyncController.MarkDirty;
PoolManager.i.OnGet -= Environment.i.platform.cullingController.objectsTracker.MarkDirty;
DCLCharacterController.OnCharacterMoved -= SetPositionDirty;
Environment.i.platform.debugController.OnDebugModeSet -= OnDebugModeSet;
UnloadAllScenes(includePersistent: true);
if (deferredDecodingCoroutine != null)
CoroutineStarter.Stop(deferredDecodingCoroutine);
}
public void Update()
{
if (!enabled)
return;
InputController_Legacy.i.Update();
Environment.i.world.pointerEventsController.Update();
if (lastSortFrame != Time.frameCount && sceneSortDirty)
{
lastSortFrame = Time.frameCount;
sceneSortDirty = false;
SortScenesByDistance();
}
}
public void LateUpdate()
{
if (!enabled)
return;
Environment.i.platform.physicsSyncController.Sync();
}
public void EnsureEntityPool() // TODO: Move to PoolManagerFactory
{
if (PoolManager.i.ContainsPool(EMPTY_GO_POOL_NAME))
return;
GameObject go = new GameObject();
Pool pool = PoolManager.i.AddPool(EMPTY_GO_POOL_NAME, go, maxPrewarmCount: 2000, isPersistent: true);
if (prewarmEntitiesPool)
pool.ForcePrewarm();
}
//======================================================================
#region MESSAGES_HANDLING
//======================================================================
#if UNITY_EDITOR
public delegate void ProcessDelegate(string sceneId, string method);
public event ProcessDelegate OnMessageProcessInfoStart;
public event ProcessDelegate OnMessageProcessInfoEnds;
#endif
public bool deferredMessagesDecoding { get; set; } = false;
Queue<string> payloadsToDecode = new Queue<string>();
const float MAX_TIME_FOR_DECODE = 0.005f;
public bool ProcessMessage(QueuedSceneMessage_Scene msgObject, out CustomYieldInstruction yieldInstruction)
{
string sceneId = msgObject.sceneId;
string method = msgObject.method;
yieldInstruction = null;
IParcelScene scene;
bool res = false;
IWorldState worldState = Environment.i.world.state;
DebugConfig debugConfig = DataStore.i.debugConfig;
if (worldState.loadedScenes.TryGetValue(sceneId, out scene))
{
#if UNITY_EDITOR
if (debugConfig.soloScene && scene is GlobalScene && debugConfig.ignoreGlobalScenes)
{
return false;
}
#endif
if (!scene.GetSceneTransform().gameObject.activeInHierarchy)
{
return true;
}
#if UNITY_EDITOR
OnMessageProcessInfoStart?.Invoke(sceneId, method);
#endif
ProfilingEvents.OnMessageProcessStart?.Invoke(method);
ProcessMessage(scene as ParcelScene, method, msgObject.payload, out yieldInstruction);
ProfilingEvents.OnMessageProcessEnds?.Invoke(method);
#if UNITY_EDITOR
OnMessageProcessInfoEnds?.Invoke(sceneId, method);
#endif
res = true;
}
else
{
res = false;
}
sceneMessagesPool.Enqueue(msgObject);
return res;
}
private void ProcessMessage(ParcelScene scene, string method, object msgPayload,
out CustomYieldInstruction yieldInstruction)
{
yieldInstruction = null;
IDelayedComponent delayedComponent = null;
try
{
switch (method)
{
case MessagingTypes.ENTITY_CREATE:
{
if (msgPayload is Protocol.CreateEntity payload)
scene.CreateEntity(payload.entityId);
break;
}
case MessagingTypes.ENTITY_REPARENT:
{
if (msgPayload is Protocol.SetEntityParent payload)
scene.SetEntityParent(payload.entityId, payload.parentId);
break;
}
case MessagingTypes.ENTITY_COMPONENT_CREATE_OR_UPDATE:
{
if (msgPayload is Protocol.EntityComponentCreateOrUpdate payload)
{
delayedComponent = scene.EntityComponentCreateOrUpdate(payload.entityId,
(CLASS_ID_COMPONENT) payload.classId, payload.json) as IDelayedComponent;
}
break;
}
case MessagingTypes.ENTITY_COMPONENT_DESTROY:
{
if (msgPayload is Protocol.EntityComponentDestroy payload)
scene.EntityComponentRemove(payload.entityId, payload.name);
break;
}
case MessagingTypes.SHARED_COMPONENT_ATTACH:
{
if (msgPayload is Protocol.SharedComponentAttach payload)
scene.SharedComponentAttach(payload.entityId, payload.id);
break;
}
case MessagingTypes.SHARED_COMPONENT_CREATE:
{
if (msgPayload is Protocol.SharedComponentCreate payload)
scene.SharedComponentCreate(payload.id, payload.classId);
break;
}
case MessagingTypes.SHARED_COMPONENT_DISPOSE:
{
if (msgPayload is Protocol.SharedComponentDispose payload)
scene.SharedComponentDispose(payload.id);
break;
}
case MessagingTypes.SHARED_COMPONENT_UPDATE:
{
if (msgPayload is Protocol.SharedComponentUpdate payload)
delayedComponent = scene.SharedComponentUpdate(payload.componentId, payload.json) as IDelayedComponent;
break;
}
case MessagingTypes.ENTITY_DESTROY:
{
if (msgPayload is Protocol.RemoveEntity payload)
scene.RemoveEntity(payload.entityId);
break;
}
case MessagingTypes.INIT_DONE:
{
scene.sceneLifecycleHandler.SetInitMessagesDone();
break;
}
case MessagingTypes.QUERY:
{
if (msgPayload is QueryMessage queryMessage)
ParseQuery(queryMessage.payload, scene.sceneData.id);
break;
}
case MessagingTypes.OPEN_EXTERNAL_URL:
{
if (msgPayload is Protocol.OpenExternalUrl payload)
OnOpenExternalUrlRequest?.Invoke(scene, payload.url);
break;
}
case MessagingTypes.OPEN_NFT_DIALOG:
{
if (msgPayload is Protocol.OpenNftDialog payload)
DataStore.i.onOpenNFTPrompt.Set(new NFTPromptModel(payload.contactAddress, payload.tokenId,
payload.comment), true);
break;
}
default:
Debug.LogError($"Unknown method {method}");
break;
}
}
catch (Exception e)
{
throw new Exception(
$"Scene message error. scene: {scene.sceneData.id} method: {method} payload: {JsonUtility.ToJson(msgPayload)} {e}");
}
if (delayedComponent != null)
{
if (delayedComponent.isRoutineRunning)
yieldInstruction = delayedComponent.yieldInstruction;
}
}
public void ParseQuery(object payload, string sceneId)
{
IParcelScene scene = Environment.i.world.state.loadedScenes[sceneId];
if (!(payload is RaycastQuery raycastQuery))
return;
Vector3 worldOrigin = raycastQuery.ray.origin + Utils.GridToWorldPosition(scene.sceneData.basePosition.x, scene.sceneData.basePosition.y);
raycastQuery.ray.unityOrigin = PositionUtils.WorldToUnityPosition(worldOrigin);
raycastQuery.sceneId = sceneId;
PhysicsCast.i.Query(raycastQuery);
}
public void SendSceneMessage(string payload) { SendSceneMessage(payload, deferredMessagesDecoding); }
private void SendSceneMessage(string payload, bool enqueue)
{
string[] chunks = payload.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
int count = chunks.Length;
for (int i = 0; i < count; i++)
{
if (CommonScriptableObjects.rendererState.Get() && enqueue)
{
payloadsToDecode.Enqueue(chunks[i]);
}
else
{
DecodeAndEnqueue(chunks[i]);
}
}
}
private void DecodeAndEnqueue(string payload)
{
ProfilingEvents.OnMessageDecodeStart?.Invoke("Misc");
string sceneId;
string message;
string messageTag;
PB_SendSceneMessage sendSceneMessage;
if (!MessageDecoder.DecodePayloadChunk(payload, out sceneId, out message, out messageTag, out sendSceneMessage))
{
return;
}
QueuedSceneMessage_Scene queuedMessage;
if (sceneMessagesPool.Count > 0)
queuedMessage = sceneMessagesPool.Dequeue();
else
queuedMessage = new QueuedSceneMessage_Scene();
MessageDecoder.DecodeSceneMessage(sceneId, message, messageTag, sendSceneMessage, ref queuedMessage);
EnqueueSceneMessage(queuedMessage);
ProfilingEvents.OnMessageDecodeEnds?.Invoke("Misc");
}
private IEnumerator DeferredDecoding()
{
float start = Time.realtimeSinceStartup;
float maxTimeForDecode;
while (true)
{
maxTimeForDecode = CommonScriptableObjects.rendererState.Get() ? MAX_TIME_FOR_DECODE : float.MaxValue;
if (payloadsToDecode.Count > 0)
{
string payload = payloadsToDecode.Dequeue();
DecodeAndEnqueue(payload);
if (Time.realtimeSinceStartup - start < maxTimeForDecode)
continue;
}
yield return null;
start = Time.unscaledTime;
}
}
public void EnqueueSceneMessage(QueuedSceneMessage_Scene message)
{
bool isGlobalScene = WorldStateUtils.IsGlobalScene(message.sceneId);
Environment.i.messaging.manager.AddControllerIfNotExists(this, message.sceneId);
Environment.i.messaging.manager.Enqueue(isGlobalScene, message);
}
//======================================================================
#endregion
//======================================================================
//======================================================================
#region SCENES_MANAGEMENT
//======================================================================
public event Action<string> OnReadyScene;
public IParcelScene CreateTestScene(LoadParcelScenesMessage.UnityParcelScene data = null)
{
if (data == null)
{
data = new LoadParcelScenesMessage.UnityParcelScene();
}
if (data.parcels == null)
{
data.parcels = new Vector2Int[] { data.basePosition };
}
if (string.IsNullOrEmpty(data.id))
{
data.id = $"(test):{data.basePosition.x},{data.basePosition.y}";
}
if (Environment.i.world.state.loadedScenes.ContainsKey(data.id))
{
Debug.LogWarning($"Scene {data.id} is already loaded.");
return Environment.i.world.state.loadedScenes[data.id];
}
var go = new GameObject();
var newScene = go.AddComponent<ParcelScene>();
newScene.ownerController = this;
newScene.isTestScene = true;
newScene.isPersistent = true;
newScene.SetData(data);
if (DCLCharacterController.i != null)
newScene.InitializeDebugPlane();
Environment.i.world.state.scenesSortedByDistance.Add(newScene);
Environment.i.messaging.manager.AddControllerIfNotExists(this, data.id);
Environment.i.world.state.loadedScenes.Add(data.id, newScene);
OnNewSceneAdded?.Invoke(newScene);
return newScene;
}
public void SendSceneReady(string sceneId)
{
Environment.i.world.state.readyScenes.Add(sceneId);
Environment.i.messaging.manager.SetSceneReady(sceneId);
WebInterface.ReportControlEvent(new WebInterface.SceneReady(sceneId));
Environment.i.world.blockersController.SetupWorldBlockers();
OnReadyScene?.Invoke(sceneId);
}
public void ActivateBuilderInWorldEditScene() { Environment.i.world.sceneBoundsChecker.SetFeedbackStyle(new SceneBoundsFeedbackStyle_BIW()); }
public void DeactivateBuilderInWorldEditScene() { Environment.i.world.sceneBoundsChecker.SetFeedbackStyle(new SceneBoundsFeedbackStyle_Simple()); }
private void SetPositionDirty(DCLCharacterPosition character)
{
var currentX = (int) Math.Floor(character.worldPosition.x / ParcelSettings.PARCEL_SIZE);
var currentY = (int) Math.Floor(character.worldPosition.z / ParcelSettings.PARCEL_SIZE);
positionDirty = currentX != currentGridSceneCoordinate.x || currentY != currentGridSceneCoordinate.y;
if (positionDirty)
{
sceneSortDirty = true;
currentGridSceneCoordinate.x = currentX;
currentGridSceneCoordinate.y = currentY;
// Since the first position for the character is not sent from Kernel until just-before calling
// the rendering activation from Kernel, we need to sort the scenes to get the current scene id
// to lock the rendering accordingly...
if (!CommonScriptableObjects.rendererState.Get())
{
SortScenesByDistance();
}
}
}
public void SortScenesByDistance()
{
if (DCLCharacterController.i == null)
return;
IWorldState worldState = Environment.i.world.state;
worldState.currentSceneId = null;
worldState.scenesSortedByDistance.Sort(SortScenesByDistanceMethod);
using (var iterator = Environment.i.world.state.scenesSortedByDistance.GetEnumerator())
{
IParcelScene scene;
bool characterIsInsideScene;
while (iterator.MoveNext())
{
scene = iterator.Current;
if (scene == null)
continue;
characterIsInsideScene = WorldStateUtils.IsCharacterInsideScene(scene);
if (!worldState.globalSceneIds.Contains(scene.sceneData.id) && characterIsInsideScene)
{
worldState.currentSceneId = scene.sceneData.id;
break;
}
}
}
if (!DataStore.i.debugConfig.isDebugMode && string.IsNullOrEmpty(worldState.currentSceneId))
{
// When we don't know the current scene yet, we must lock the rendering from enabling until it is set
CommonScriptableObjects.rendererState.AddLock(this);
}
else
{
// 1. Set current scene id
CommonScriptableObjects.sceneID.Set(worldState.currentSceneId);
// 2. Attempt to remove SceneController's lock on rendering
CommonScriptableObjects.rendererState.RemoveLock(this);
}
OnSortScenes?.Invoke();
}
private int SortScenesByDistanceMethod(IParcelScene sceneA, IParcelScene sceneB)
{
sortAuxiliaryVector = sceneA.sceneData.basePosition - currentGridSceneCoordinate;
int dist1 = sortAuxiliaryVector.sqrMagnitude;
sortAuxiliaryVector = sceneB.sceneData.basePosition - currentGridSceneCoordinate;
int dist2 = sortAuxiliaryVector.sqrMagnitude;
return dist1 - dist2;
}
private void OnCurrentSceneIdChange(string newSceneId, string prevSceneId)
{
if (Environment.i.world.state.TryGetScene(newSceneId, out IParcelScene newCurrentScene)
&& !(newCurrentScene as ParcelScene).sceneLifecycleHandler.isReady)
{
CommonScriptableObjects.rendererState.AddLock(newCurrentScene);
(newCurrentScene as ParcelScene).sceneLifecycleHandler.OnSceneReady += (readyScene) => { CommonScriptableObjects.rendererState.RemoveLock(readyScene); };
}
}
public void LoadParcelScenesExecute(string scenePayload)
{
LoadParcelScenesMessage.UnityParcelScene scene;
ProfilingEvents.OnMessageDecodeStart?.Invoke(MessagingTypes.SCENE_LOAD);
scene = Utils.SafeFromJson<LoadParcelScenesMessage.UnityParcelScene>(scenePayload);
ProfilingEvents.OnMessageDecodeEnds?.Invoke(MessagingTypes.SCENE_LOAD);
if (scene == null || scene.id == null)
return;
var sceneToLoad = scene;
DebugConfig debugConfig = DataStore.i.debugConfig;
#if UNITY_EDITOR
if (debugConfig.soloScene && sceneToLoad.basePosition.ToString() != debugConfig.soloSceneCoords.ToString())
{
SendSceneReady(sceneToLoad.id);
return;
}
#endif
ProfilingEvents.OnMessageProcessStart?.Invoke(MessagingTypes.SCENE_LOAD);
IWorldState worldState = Environment.i.world.state;
if (!worldState.loadedScenes.ContainsKey(sceneToLoad.id))
{
var newGameObject = new GameObject("New Scene");
var newScene = newGameObject.AddComponent<ParcelScene>();
newScene.SetData(sceneToLoad);
if (debugConfig.isDebugMode)
{
newScene.InitializeDebugPlane();
}
newScene.ownerController = this;
worldState.loadedScenes.Add(sceneToLoad.id, newScene);
worldState.scenesSortedByDistance.Add(newScene);
sceneSortDirty = true;
OnNewSceneAdded?.Invoke(newScene);
Environment.i.messaging.manager.AddControllerIfNotExists(this, newScene.sceneData.id);
if (VERBOSE)
Debug.Log($"{Time.frameCount} : Load parcel scene {newScene.sceneData.basePosition}");
}
ProfilingEvents.OnMessageProcessEnds?.Invoke(MessagingTypes.SCENE_LOAD);
}
public void UpdateParcelScenesExecute(string sceneId)
{
LoadParcelScenesMessage.UnityParcelScene sceneData;
ProfilingEvents.OnMessageDecodeStart?.Invoke(MessagingTypes.SCENE_UPDATE);
sceneData = Utils.SafeFromJson<LoadParcelScenesMessage.UnityParcelScene>(sceneId);
ProfilingEvents.OnMessageDecodeEnds?.Invoke(MessagingTypes.SCENE_UPDATE);
IWorldState worldState = Environment.i.world.state;
if (worldState.TryGetScene(sceneData.id, out IParcelScene sceneInterface))
{
ParcelScene scene = sceneInterface as ParcelScene;
scene.SetUpdateData(sceneData);
}
else
{
LoadParcelScenesExecute(sceneId);
}
}
public void UpdateParcelScenesExecute(LoadParcelScenesMessage.UnityParcelScene scene)
{
if (scene == null || scene.id == null)
return;
var sceneToLoad = scene;
ProfilingEvents.OnMessageProcessStart?.Invoke(MessagingTypes.SCENE_UPDATE);
ParcelScene parcelScene = Environment.i.world.state.GetScene(sceneToLoad.id) as ParcelScene;
if (parcelScene != null)
parcelScene.SetUpdateData(sceneToLoad);
ProfilingEvents.OnMessageProcessEnds?.Invoke(MessagingTypes.SCENE_UPDATE);
}
public void UnloadScene(string sceneKey)
{
var queuedMessage = new QueuedSceneMessage()
{ type = QueuedSceneMessage.Type.UNLOAD_PARCEL, message = sceneKey };
ProfilingEvents.OnMessageWillQueue?.Invoke(MessagingTypes.SCENE_DESTROY);
Environment.i.messaging.manager.ForceEnqueueToGlobal(MessagingBusType.INIT, queuedMessage);
Environment.i.messaging.manager.RemoveController(sceneKey);
IWorldState worldState = Environment.i.world.state;
if (worldState.loadedScenes.ContainsKey(sceneKey))
{
ParcelScene sceneToUnload = worldState.GetScene(sceneKey) as ParcelScene;
sceneToUnload.isPersistent = false;
if (sceneToUnload is GlobalScene globalScene && globalScene.isPortableExperience)
OnNewPortableExperienceSceneRemoved?.Invoke(sceneKey);
}
}
public void UnloadParcelSceneExecute(string sceneId)
{
ProfilingEvents.OnMessageProcessStart?.Invoke(MessagingTypes.SCENE_DESTROY);
IWorldState worldState = Environment.i.world.state;
if (!worldState.Contains(sceneId) || worldState.loadedScenes[sceneId].isPersistent)
{
return;
}
var scene = worldState.loadedScenes[sceneId] as ParcelScene;
if (scene == null)
return;
worldState.loadedScenes.Remove(sceneId);
worldState.globalSceneIds.Remove(sceneId);
// Remove the scene id from the msg. priorities list
worldState.scenesSortedByDistance.Remove(scene);
// Remove messaging controller for unloaded scene
Environment.i.messaging.manager.RemoveController(scene.sceneData.id);
scene.Cleanup(!CommonScriptableObjects.rendererState.Get());
if (VERBOSE)
{
Debug.Log($"{Time.frameCount} : Destroying scene {scene.sceneData.basePosition}");
}
Environment.i.world.blockersController.SetupWorldBlockers();
ProfilingEvents.OnMessageProcessEnds?.Invoke(MessagingTypes.SCENE_DESTROY);
}
public void UnloadAllScenes(bool includePersistent = false)
{
var worldState = Environment.i.world.state;
if (includePersistent)
{
var persistentScenes = worldState.loadedScenes.Where(x => x.Value.isPersistent);
foreach (var kvp in persistentScenes)
{
if (kvp.Value is ParcelScene scene)
{
scene.isPersistent = false;
}
}
}
var list = worldState.loadedScenes.ToArray();
for (int i = 0; i < list.Length; i++)
{
UnloadParcelSceneExecute(list[i].Key);
}
}
public void LoadParcelScenes(string decentralandSceneJSON)
{
var queuedMessage = new QueuedSceneMessage()
{
type = QueuedSceneMessage.Type.LOAD_PARCEL,
message = decentralandSceneJSON
};
ProfilingEvents.OnMessageWillQueue?.Invoke(MessagingTypes.SCENE_LOAD);
Environment.i.messaging.manager.ForceEnqueueToGlobal(MessagingBusType.INIT, queuedMessage);
if (VERBOSE)
Debug.Log($"{Time.frameCount} : Load parcel scene queue {decentralandSceneJSON}");
}
public void UpdateParcelScenes(string decentralandSceneJSON)
{
var queuedMessage = new QueuedSceneMessage()
{ type = QueuedSceneMessage.Type.UPDATE_PARCEL, message = decentralandSceneJSON };
ProfilingEvents.OnMessageWillQueue?.Invoke(MessagingTypes.SCENE_UPDATE);
Environment.i.messaging.manager.ForceEnqueueToGlobal(MessagingBusType.INIT, queuedMessage);
}
public void UnloadAllScenesQueued()
{
var queuedMessage = new QueuedSceneMessage() { type = QueuedSceneMessage.Type.UNLOAD_SCENES };
ProfilingEvents.OnMessageWillQueue?.Invoke(MessagingTypes.SCENE_DESTROY);
Environment.i.messaging.manager.ForceEnqueueToGlobal(MessagingBusType.INIT, queuedMessage);
}
public void CreateGlobalScene(string json)
{
#if UNITY_EDITOR
DebugConfig debugConfig = DataStore.i.debugConfig;
if (debugConfig.soloScene && debugConfig.ignoreGlobalScenes)
return;
#endif
CreateGlobalSceneMessage globalScene = Utils.SafeFromJson<CreateGlobalSceneMessage>(json);
string newGlobalSceneId = globalScene.id;
IWorldState worldState = Environment.i.world.state;
if (worldState.loadedScenes.ContainsKey(newGlobalSceneId))
return;
var newGameObject = new GameObject("Global Scene - " + newGlobalSceneId);
var newScene = newGameObject.AddComponent<GlobalScene>();
newScene.ownerController = this;
newScene.unloadWithDistance = false;
newScene.isPersistent = true;
newScene.sceneName = globalScene.name;
newScene.isPortableExperience = globalScene.isPortableExperience;
LoadParcelScenesMessage.UnityParcelScene data = new LoadParcelScenesMessage.UnityParcelScene
{
id = newGlobalSceneId,
basePosition = new Vector2Int(0, 0),
baseUrl = globalScene.baseUrl,
contents = globalScene.contents
};
newScene.SetData(data);
if (!string.IsNullOrEmpty(globalScene.icon))
newScene.iconUrl = newScene.contentProvider.GetContentsUrl(globalScene.icon);
worldState.loadedScenes.Add(newGlobalSceneId, newScene);
OnNewSceneAdded?.Invoke(newScene);
if (newScene.isPortableExperience)
OnNewPortableExperienceSceneAdded?.Invoke(newScene);
worldState.globalSceneIds.Add(newGlobalSceneId);
Environment.i.messaging.manager.AddControllerIfNotExists(this, newGlobalSceneId, isGlobal: true);
if (VERBOSE)
{
Debug.Log($"Creating Global scene {newGlobalSceneId}");
}
}
public void IsolateScene(IParcelScene sceneToActive)
{
foreach (IParcelScene scene in Environment.i.world.state.scenesSortedByDistance)
{
if (scene != sceneToActive)
scene.GetSceneTransform().gameObject.SetActive(false);
}
}
public void ReIntegrateIsolatedScene()
{
foreach (IParcelScene scene in Environment.i.world.state.scenesSortedByDistance)
{
scene.GetSceneTransform().gameObject.SetActive(true);
}
}
//======================================================================
#endregion
//======================================================================
public Queue<QueuedSceneMessage_Scene> sceneMessagesPool { get; } = new Queue<QueuedSceneMessage_Scene>();
public bool prewarmSceneMessagesPool { get; set; } = true;
public bool prewarmEntitiesPool { get; set; } = true;
private bool sceneSortDirty = false;
private bool positionDirty = true;
private int lastSortFrame = 0;
public event Action OnSortScenes;
public event Action<IParcelScene, string> OnOpenExternalUrlRequest;
public event Action<IParcelScene> OnNewSceneAdded;
public event Action<IParcelScene> OnNewPortableExperienceSceneAdded;
public event Action<string> OnNewPortableExperienceSceneRemoved;
private Vector2Int currentGridSceneCoordinate = new Vector2Int(EnvironmentSettings.MORDOR_SCALAR, EnvironmentSettings.MORDOR_SCALAR);
private Vector2Int sortAuxiliaryVector = new Vector2Int(EnvironmentSettings.MORDOR_SCALAR, EnvironmentSettings.MORDOR_SCALAR);
public const string EMPTY_GO_POOL_NAME = "Empty";
}
} | 36.726764 | 169 | 0.571607 | [
"Apache-2.0"
] | 0xBlockchainx0/unity-renderer | unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/SceneController.cs | 32,797 | C# |
using System.IO;
using static OpenGL.Gl;
namespace SharpEngine {
public class Material {
readonly uint program;
public Material(string vertexShaderPath, string fragmentShaderPath) {
// create vertex shader
var vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, File.ReadAllText(vertexShaderPath));
glCompileShader(vertexShader);
// create fragment shader
var fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, File.ReadAllText(fragmentShaderPath));
glCompileShader(fragmentShader);
// create shader program - rendering pipeline
program = glCreateProgram();
glAttachShader(program, vertexShader);
glAttachShader(program, fragmentShader);
glLinkProgram(program);
glDeleteShader(vertexShader);
glDeleteShader(fragmentShader);
}
public unsafe void SetTransform(Matrix matrix) {
int transformLocation = glGetUniformLocation(this.program, "transform");
glUniformMatrix4fv(transformLocation, 1, true, &matrix.m11);
}
public void Use() {
glUseProgram(program);
}
}
} | 35.243243 | 84 | 0.641871 | [
"MIT"
] | Armin-AF/SharpEngine | Material.cs | 1,304 | C# |
using System.ComponentModel.DataAnnotations;
namespace _3_Version.Models
{
public class Contact {
/// <summary>
/// A unique identifier for the contact
/// </summary>
/// <value></value>
public int Id { get; set; }
/// <summary>
/// The contact's given name
/// </summary>
/// <value></value>
[MaxLength(50)]
public string FirstName { get; set; }
/// <summary>
/// The contact's family name or surname
/// </summary>
/// <value></value>
[Required]
[MaxLength(50)]
public string LastName { get; set; }
}
} | 19.064516 | 44 | 0.566836 | [
"MIT"
] | Ahmed22188/csharp_with_csharpfritz | sessions/Season-02/0205-ApiPartTwo/src/3_Version/Models/Contact.cs | 591 | C# |
//------------------------------------------------------------------------------
// <copyright file="FirmwareBuild.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// </copyright>
//------------------------------------------------------------------------------
namespace Microsoft.Azure.Kinect.Sensor
{
/// <summary>
/// Firmware build type.
/// </summary>
[Native.NativeReference("k4a_firmware_build_t")]
public enum FirmwareBuild
{
/// <summary>
/// Production firmware.
/// </summary>
Release = 0,
/// <summary>
/// Preproduction firmware.
/// </summary>
Debug,
}
}
| 27.259259 | 81 | 0.456522 | [
"MIT"
] | 3nfinite/Azure-Kinect-Sensor-SDK | src/csharp/SDK/FirmwareBuild.cs | 738 | C# |
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
namespace Fpm.MainUISeleniumTest
{
public class TestHelper
{
public static void AssertTextContains(string text, string contained)
{
AssertTextContains(text, contained, string.Empty);
}
public static void AssertTextContains(string text, string contained, string messageOnTestFailure)
{
Assert.IsNotNull(text, "Text is null but was expected to contain: " + contained);
Assert.IsTrue(text.ToLower().Contains(contained.ToLower()), messageOnTestFailure);
}
public static void AssertTextDoesNotContain(string text, string notContained)
{
AssertTextDoesNotContain(text, notContained, string.Empty);
}
public static void AssertTextDoesNotContain(string text, string notContained, string messageOnTestFailure)
{
Assert.IsNotNull(text, "Text is null but was expected to not contain: " + notContained);
Assert.IsFalse(text.ToLower().Contains(notContained.ToLower()), messageOnTestFailure);
}
public static void AssertElementTextIsEqual(string expectedText, IWebElement webElement)
{
Assert.AreEqual(expectedText, webElement.Text);
}
public static void AssertElementTextIsEqual(string expectedText, string webElementText)
{
Assert.AreEqual(expectedText, webElementText);
}
}
} | 37.45 | 114 | 0.679573 | [
"MIT"
] | PublicHealthEngland/fingertips-open | FingertipsProfileManager/MainUISeleniumTest/TestHelper.cs | 1,500 | C# |
using System;
using System.Reflection;
class StartUp
{
static void Main(string[] args)
{
Type personType = typeof(Person);
PropertyInfo[] properties = personType.GetProperties
(BindingFlags.Public | BindingFlags.Instance);
Console.WriteLine(properties.Length);
}
} | 24.153846 | 60 | 0.665605 | [
"MIT"
] | Bullsized/DB-Advanced-Entity-Framework | 02 Defining Classes Exercise/01 Define a Class Person/StartUp.cs | 316 | C# |
// Copyright 2019 Esri.
//
// 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 ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Ogc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using Windows.UI.Popups;
using Windows.UI.Xaml;
namespace ArcGISRuntime.UWP.Samples.PlayKmlTours
{
[ArcGISRuntime.Samples.Shared.Attributes.Sample(
name: "Play KML Tour",
category: "Layers",
description: "Play tours in KML files.",
instructions: "The sample will load the KMZ file from ArcGIS Online. When a tour is found, the _Play_ button will be enabled. Use _Play_ and _Pause_ to control the tour. When you're ready to show the tour, use the reset button to return the tour to the unplayed state.",
tags: new[] { "KML", "animation", "interactive", "narration", "pause", "play", "story", "tour" })]
[ArcGISRuntime.Samples.Shared.Attributes.OfflineData("f10b1d37fdd645c9bc9b189fb546307c")]
public partial class PlayKmlTours
{
// The KML tour controller provides player controls for KML tours.
private readonly KmlTourController _tourController = new KmlTourController();
public PlayKmlTours()
{
InitializeComponent();
Initialize();
}
private async void Initialize()
{
// Load the scene with a basemap and a terrain surface.
MySceneView.Scene = new Scene(BasemapStyle.ArcGISImageryStandard);
MySceneView.Scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));
// Get the URL to the data.
string filePath = DataManager.GetDataFolder("f10b1d37fdd645c9bc9b189fb546307c", "Esri_tour.kmz");
Uri kmlUrl = new Uri(filePath);
// Create the KML dataset and layer.
KmlDataset dataset = new KmlDataset(kmlUrl);
KmlLayer layer = new KmlLayer(dataset);
// Add the layer to the map.
MySceneView.Scene.OperationalLayers.Add(layer);
try
{
// Load the dataset.
await dataset.LoadAsync();
// Find the first KML tour.
FindKmlTour(dataset.RootNodes);
// Handle absence of tour gracefully.
if (_tourController.Tour == null)
{
throw new InvalidOperationException("No tour found. Can't enable touring for a KML file with no tours.");
}
// Listen for changes to the tour status.
_tourController.Tour.PropertyChanged += Tour_PropertyChanged;
// Be notified when the sample is left so that the tour can be reset.
this.Unloaded += Sample_Unloaded;
// Enable the play button.
PlayButton.IsEnabled = true;
// Hide the status bar.
LoadingStatusBar.Visibility = Visibility.Collapsed;
}
catch (Exception e)
{
Debug.WriteLine(e.ToString());
await new MessageDialog(e.ToString(), "Error").ShowAsync();
}
}
private void FindKmlTour(IEnumerable<KmlNode> rootNodes)
{
// Hold a list of nodes to explore.
Queue<KmlNode> nodesToExplore = new Queue<KmlNode>();
// Add each root node to the list.
foreach (KmlNode rootNode in rootNodes)
{
nodesToExplore.Enqueue(rootNode);
}
// Keep exploring until a tour is found or there are no more nodes.
while (nodesToExplore.Any())
{
// Remove a node from the queue.
KmlNode currentNode = nodesToExplore.Dequeue();
// If the node is a tour, use it.
if (currentNode is KmlTour tour)
{
_tourController.Tour = tour;
return;
}
// If the node is a container, add all of its children to the list of nodes to explore.
if (currentNode is KmlContainer container)
{
foreach (KmlNode node in container.ChildNodes)
{
nodesToExplore.Enqueue(node);
}
}
// Otherwise, continue.
}
}
private void Tour_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
// Skip for everything except tour status property changes.
if (e.PropertyName != nameof(KmlTour.TourStatus))
{
return;
}
// Set the UI based on the current state of the tour.
switch (_tourController.Tour.TourStatus)
{
case KmlTourStatus.Completed:
case KmlTourStatus.Initialized:
PlayButton.IsEnabled = true;
PauseButton.IsEnabled = false;
break;
case KmlTourStatus.Paused:
PlayButton.IsEnabled = true;
PauseButton.IsEnabled = false;
ResetButton.IsEnabled = true;
break;
case KmlTourStatus.Playing:
ResetButton.IsEnabled = true;
PlayButton.IsEnabled = false;
PauseButton.IsEnabled = true;
break;
}
}
// Play the tour when the button is pressed.
private void Play_Clicked(object sender, RoutedEventArgs e) => _tourController?.Play();
// Pause the tour when the button is pressed.
private void Pause_Clicked(object sender, RoutedEventArgs e) => _tourController?.Pause();
// Reset the tour when the button is pressed.
private void Reset_Clicked(object sender, RoutedEventArgs e) => _tourController?.Reset();
// Reset the tour when the user leaves the sample - avoids a crash.
private void Sample_Unloaded(object sender, RoutedEventArgs e)
{
_tourController?.Pause();
_tourController?.Reset();
}
}
} | 40.011561 | 278 | 0.588847 | [
"Apache-2.0"
] | Esri/arcgis-runtime-samples-dotne | src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/PlayKmlTours/PlayKmlTours.xaml.cs | 6,924 | C# |
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.OS;
using CloudStreamForms.Droid.Services;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using static CloudStreamForms.Droid.MainActivity;
namespace CloudStreamForms.Droid
{
[System.Serializable]
public class LocalNot
{
public string title;
public string body;
public int id;
public bool autoCancel = true;
public bool showWhen = true;
public int smallIcon = PublicNot;
public string bigIcon = "";
public bool mediaStyle = true;
public string data = "";
public bool onGoing = false;
public int progress = -1;
public DateTime? when = null;
public List<LocalAction> actions = new List<LocalAction>();
public int notificationImportance = (int)NotificationImportance.Default;
public static NotificationManager NotManager => (NotificationManager)Application.Context.GetSystemService(Context.NotificationService);
public static Dictionary<string, Bitmap> cachedBitmaps = new Dictionary<string, Bitmap>(); // TO ADD PREFORMACE WHEN ADDING NOTIFICATION W SAME IMAGE
public static async Task<Bitmap> GetImageBitmapFromUrl(string url)
{
if (cachedBitmaps.ContainsKey(url)) {
return cachedBitmaps[url];
}
try {
Bitmap imageBitmap = null;
using (var webClient = new WebClient()) {
var imageBytes = await webClient.DownloadDataTaskAsync(url);
if (imageBytes != null && imageBytes.Length > 0) {
imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length);
}
}
cachedBitmaps.Add(url, imageBitmap);
return imageBitmap;
}
catch (Exception) {
return null;
}
}
public static long CurrentTimeMillis(DateTime time)
{
return (long)(time - Jan1st1970).TotalMilliseconds;
}
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static PendingIntent GetCurrentPending(string data = "")
{
Intent _resultIntent = new Intent(Application.Context, typeof(MainActivity));
_resultIntent.SetAction(Intent.ActionMain);
_resultIntent.AddCategory(Intent.CategoryLauncher);
if (data != "") {
_resultIntent.PutExtra("data", data);
}
PendingIntent pendingIntent = PendingIntent.GetActivity(activity, 0,
_resultIntent, 0);
return pendingIntent;
}
public static async void ShowLocalNot(LocalNot not, Context context = null)
{
var cc = context ?? Application.Context;
var builder = new Notification.Builder(cc);
builder.SetContentTitle(not.title);
bool containsMultiLine = not.body.Contains("\n");
if (Build.VERSION.SdkInt < BuildVersionCodes.O || !containsMultiLine) {
builder.SetContentText(not.body);
}
builder.SetSmallIcon(not.smallIcon);
builder.SetAutoCancel(not.autoCancel);
builder.SetOngoing(not.onGoing);
if (not.progress != -1) {
builder.SetProgress(100, not.progress, false);
}
builder.SetVisibility(NotificationVisibility.Public);
builder.SetOnlyAlertOnce(true);
if (Build.VERSION.SdkInt >= BuildVersionCodes.O) {
var channelId = $"{cc.PackageName}.general";
var channel = new NotificationChannel(channelId, "General", (NotificationImportance)not.notificationImportance);
NotManager.CreateNotificationChannel(channel);
builder.SetChannelId(channelId);
if (not.bigIcon != null) {
if (not.bigIcon != "") {
var bitmap = await GetImageBitmapFromUrl(not.bigIcon);
if (bitmap != null) {
builder.SetLargeIcon(bitmap);
if (not.mediaStyle) {
builder.SetStyle(new Notification.MediaStyle()); // NICER IMAGE
}
}
}
}
if (containsMultiLine) {
var b = new Notification.BigTextStyle();
b.BigText(not.body);
builder.SetStyle(b);
}
if (not.actions.Count > 0) {
List<Notification.Action> actions = new List<Notification.Action>();
for (int i = 0; i < not.actions.Count; i++) {
var _resultIntent = new Intent(context, typeof(MainIntentService));
_resultIntent.PutExtra("data", not.actions[i].action);
var pending = PendingIntent.GetService(context, 3337 + i + not.id,
_resultIntent,
PendingIntentFlags.UpdateCurrent
);
actions.Add(new Notification.Action(not.actions[i].sprite, not.actions[i].name, pending));
}
builder.SetActions(actions.ToArray());
}
}
builder.SetShowWhen(not.showWhen);
if (not.when != null) {
builder.SetWhen(CurrentTimeMillis((DateTime)not.when));
}
var stackBuilder = Android.Support.V4.App.TaskStackBuilder.Create(cc);
var resultIntent = GetLauncherActivity(cc);
if (not.data != "") {
resultIntent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
var _data = Android.Net.Uri.Parse(not.data);//"cloudstreamforms:tt0371746Name=Iron man=EndAll");
resultIntent.SetData(_data);
stackBuilder.AddNextIntent(resultIntent);
var resultPendingIntent =
stackBuilder.GetPendingIntent(not.id, (int)PendingIntentFlags.UpdateCurrent);
builder.SetContentIntent(resultPendingIntent);
}
else {
stackBuilder.AddNextIntent(resultIntent);
builder.SetContentIntent(GetCurrentPending());
}
try {
NotManager.Notify(not.id, builder.Build());
}
catch { }
}
public static Intent GetLauncherActivity(Context context = null)
{
var cc = context ?? Application.Context;
var packageName = cc.PackageName;
return cc.PackageManager.GetLaunchIntentForPackage(packageName).SetPackage(null);
}
}
} | 30.894444 | 151 | 0.709585 | [
"MIT"
] | LagradOst/CloudSteam-2 | CloudStreamForms/CloudStreamForms.Android/LocalNot.cs | 5,563 | C# |
using Android.App;
using Android.Content.PM;
using Android.Graphics.Drawables;
using Android.OS;
using Android.Views;
namespace Diabetic.Droid
{
[Activity(Label = "@string/app_name", Theme = "@style/Theme.Splash", Icon = "@drawable/mcdo", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
} | 32.5 | 196 | 0.683333 | [
"Apache-2.0"
] | kevinhipeau/workshop-gusto | Diabetic/Diabetic.Android/MainActivity.cs | 782 | C# |
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
namespace Destiny.Core.Flow.Caching
{
public interface ICache
{
/// <summary>
/// 得到
/// </summary>
/// <param name="key">键</param>
/// <returns>返回得到</returns>
TCacheData Get<TCacheData>(string key);
/// <summary>
/// 得到或添加
/// </summary>
/// <param name="func"></param>
/// <param name="expireSeconds">过期秒数-1,0不过期。</param>
/// <returns></returns>
TCacheData GetOrAdd<TCacheData>(
string key,
Func<TCacheData> func, int expireSeconds = -1);
/// <summary>
/// 异步得到缓存
/// </summary>
/// <param name="key"></param>
/// <param name="token">键</param>
/// <returns></returns>
Task<TCacheData> GetAsync<TCacheData>(string key, CancellationToken token = default);
/// <summary>
/// 得到或添加
/// </summary>
/// <param name="key"><键/param>
/// <param name="func"></param>
/// <param name="token"></param>
/// <param name="expireSeconds">过期秒数-1,0不过期。</param>
/// <returns>返回得到或添加后的缓存数据</returns>
Task<TCacheData> GetOrAddAsync<TCacheData>(
[NotNull] string key,
Func<Task<TCacheData>> func,
int expireSeconds = -1,
CancellationToken token = default
);
#region 设置
/// <summary>
/// 设置缓存
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <param name="expireSeconds">过期秒数-1,0不过期。</param>
void Set<TCacheData>(string key, TCacheData value, int expireSeconds = -1);
/// <summary>
/// 异步设置缓存
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <param name="token"></param>
/// <param name="expireSeconds">过期秒数-1,0不过期。</param>
Task SetAsync<TCacheData>(string key, TCacheData value, int expireSeconds = -1, CancellationToken token = default);
#endregion
#region 删除
/// <summary>
/// 删除缓存
/// </summary>
/// <param name="key">要删除的键</param>
void Remove(string key);
/// <summary>
/// 异步删除缓存
/// </summary>
/// <param name="key"></param>
/// <param name="token"></param>
/// <returns></returns>
Task RemoveAsync(string key, CancellationToken token = default);
#endregion
}
}
| 27.515789 | 123 | 0.518363 | [
"MIT"
] | dotNetTreasury/Destiny.Core.Flow | src/Destiny.Core.Flow.Caching/ICache.cs | 2,822 | C# |
// Licensed to Finnovation Labs Limited under one or more agreements.
// Finnovation Labs Limited licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using FinnovationLabs.OpenBanking.Library.Connector.Services;
namespace FinnovationLabs.OpenBanking.Library.Connector.Models.Persistent
{
internal abstract class EntityBase
{
public EntityBase() { }
protected EntityBase(
Guid id,
string? name,
string? createdBy,
ITimeProvider timeProvider)
{
Id = id;
Name = name;
IsDeleted = new ReadWriteProperty<bool>(false, timeProvider, CreatedBy);
Created = timeProvider.GetUtcNow();
CreatedBy = createdBy;
}
/// <summary>
/// Unique OBC ID
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Friendly name to support debugging etc. (must be unique i.e. not already in use).
/// This is optional.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Mutable "is deleted" status to support soft delete of record
/// </summary>
public ReadWriteProperty<bool> IsDeleted { get; set; } = null!;
/// <summary>
/// Created timestamp
/// </summary>
public DateTimeOffset Created { get; set; }
/// <summary>
/// "Created by" string. Similarly to "modified by" for mutable fields, this field
/// cna be used to denote authorship.
/// </summary>
public string? CreatedBy { get; set; }
public void Initialise(
Guid id,
string? name,
string? createdBy,
ITimeProvider timeProvider)
{
Id = id;
Name = name;
IsDeleted = new ReadWriteProperty<bool>(false, timeProvider, CreatedBy);
Created = timeProvider.GetUtcNow();
CreatedBy = createdBy;
}
}
}
| 31.161765 | 97 | 0.561114 | [
"MIT"
] | finlabsuk/open-banking-connector | src/OpenBanking.Library.Connector/Models/Persistent/EntityBase.cs | 2,121 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreGraphics;
using Foundation;
using Photos;
using UIKit;
namespace bugTrapKit
{
public partial class BtImageCollectionViewController : BtCollectionViewController, IUICollectionViewDelegateFlowLayout, IPHPhotoLibraryChangeObserver
{
static nfloat size = (UIScreen.MainScreen.Bounds.Width - 6) / 4;
static nfloat scale = UIScreen.MainScreen.Scale;
const string storyboardId = "BtImageCollectionViewController",
imageCell = "BtImageCollectionViewCell", addImageCell = "BtAddImageCollectionViewCell";
CGSize cellSize = CGSize.Empty, thumbSize = CGSize.Empty;
bool selecting;
List<NSIndexPath> editIndexes = new List<NSIndexPath> ();
PHFetchOptions fetchOptions = new PHFetchOptions ();
PHFetchResult assetsFetchResults;
Dictionary<NSIndexPath, int> imageRequests = new Dictionary<NSIndexPath, int> ();
bool selectingSnapshotImagesForExport {
get {
var navController = NavigationController as BtImageNavigationController;
return navController?.SelectingSnapshotImagesForExport ?? false;
}
set {
var navController = NavigationController as BtImageNavigationController;
if (navController != null) navController.SelectingSnapshotImagesForExport = value;
}
}
public BtImageCollectionViewController (IntPtr handle) : base(handle)
{
fetchOptions.SortDescriptors = new [] { new NSSortDescriptor ("modificationDate", false) };
// delay requesting permission for Test Cloud runs so it doesn't crash
Task.Run(async() => {
#if UITEST
await Task.Delay(3000);
#endif
await TrapState.Shared.GetAlbumLocalIdentifier();
assetsFetchResults = PHAsset.FetchAssets(PHAssetMediaType.Image, fetchOptions);
});
}
public override void ViewDidLoad ()
{
base.ViewDidLoad();
ScreenName = GAIKeys.ScreenNames.SelectSnapshot;
cellSize = new CGSize (size, size);
thumbSize = new CGSize (cellSize.Width * scale, cellSize.Height * scale);
noImageView.Frame = UIScreen.MainScreen.Bounds;
CollectionView.AllowsMultipleSelection = true;
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear(animated);
PHPhotoLibrary.SharedPhotoLibrary.RegisterChangeObserver(this);
// var navController = NavigationController as BtImageNavigationController;
// if (navController != null) selecting = navController.SelectingSnapshotImagesForExport;
selecting = selectingSnapshotImagesForExport;
updateViewConfiguration(false, updateScreenName: false, reloadData: true);
var selectedIndexs = CollectionView.GetIndexPathsForSelectedItems();
if (selectedIndexs != null) {
foreach (var indexPath in selectedIndexs) {
CollectionView.DeselectItem(indexPath, false);
}
}
}
public override void ViewDidDisappear (bool animated)
{
PHPhotoLibrary.SharedPhotoLibrary.UnregisterChangeObserver(this);
base.ViewDidDisappear(animated);
}
#region PHPhotoLibraryChangeObserver
List<NSIndexPath> indexPathsFromIndexSet (NSIndexSet indexSet)
{
List<NSIndexPath> indexPaths = new List<NSIndexPath> ();
if (indexSet == null) return indexPaths;
indexSet.EnumerateIndexes((nuint idx, ref bool stop) => indexPaths.Add(NSIndexPath.FromItemSection((nint)idx, 0)));
return indexPaths;
}
public void PhotoLibraryDidChange (PHChange changeInstance)
{
BeginInvokeOnMainThread(() => {
// check if there are changes to the assets (insertions, deletions, updates)
var collectionChanges = changeInstance.GetFetchResultChangeDetails(assetsFetchResults);
if (collectionChanges != null) {
assetsFetchResults = collectionChanges.FetchResultAfterChanges;
if (!collectionChanges.HasIncrementalChanges || collectionChanges.HasMoves) {
CollectionView.ReloadData();
} else {
var removedIndexes = indexPathsFromIndexSet(collectionChanges.RemovedIndexes);
var insertedIndexes = indexPathsFromIndexSet(collectionChanges.InsertedIndexes);
var changedIndexes = indexPathsFromIndexSet(collectionChanges.ChangedIndexes);
// if we have incremental diffs, tell the collection view to animate insertions and deletions
CollectionView.PerformBatchUpdates(() => {
if (!removedIndexes.IsEmpty()) CollectionView.DeleteItems(removedIndexes.ToArray());
if (!insertedIndexes.IsEmpty()) CollectionView.InsertItems(insertedIndexes.ToArray());
if (!changedIndexes.IsEmpty()) CollectionView.ReloadItems(changedIndexes.ToArray());
}, null);
}
}
});
}
#endregion
public override UIBarButtonItem EditButtonItem {
get { return editButton; }
}
public override nint NumberOfSections (UICollectionView collectionView)
{
return 1;
}
// nint itemCountForEconfigureation {
// get { return TrapState.Shared.InActionExtension ? TrapState.Shared.ExtensionSnapshotImageCount : assetsFetchResults?.Count ?? 0; }
// }
public override nint GetItemsCount (UICollectionView collectionView, nint section)
{
return TrapState.Shared.InActionExtension ? TrapState.Shared.ExtensionSnapshotImageCount : assetsFetchResults?.Count ?? 0;
}
public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = collectionView.DequeueReusableCell(imageCell, indexPath) as BtImageCollectionViewCell;
if (TrapState.Shared.InActionExtension) {
cell.SetData(TrapState.Shared.GetExtensionSnapshotImageAtIndex(indexPath.Item));
cell.SetSelected(TrapState.Shared.IsActiveSnapshot(indexPath.Item));
} else {
var manager = PHImageManager.DefaultManager;
if (imageRequests.ContainsKey(indexPath)) manager.CancelImageRequest(imageRequests[indexPath]);
var asset = assetsFetchResults[indexPath.Item] as PHAsset;
imageRequests[indexPath] = manager.RequestImageForAsset(asset, thumbSize, PHImageContentMode.AspectFill, null,
(result, info) => cell.SetData(result)
);
}
return cell;
}
public override void ItemSelected (UICollectionView collectionView, NSIndexPath indexPath)
{
if (TrapState.Shared.InActionExtension) {
SaveActiveSnapshotAndResetAnnotateImageView(indexPath.Item, null);
return;
}
if (Editing && !editIndexes.Contains(indexPath)) {
editIndexes.Add(indexPath);
} else if (selecting) { // selecting images to add to an Issue
var asset = assetsFetchResults?[indexPath.Item] as PHAsset;
TrapState.Shared.AddSnapshotImage(asset.LocalIdentifier);
} else {
var asset = assetsFetchResults?[indexPath.Item] as PHAsset;
var selectedItems = CollectionView.GetIndexPathsForSelectedItems().Where(ip => ip != indexPath);
CollectionView.PerformBatchUpdates(() => {
foreach (var item in selectedItems) {
CollectionView.DeselectItem(item, true);
}
}, null);
SaveActiveSnapshotAndResetAnnotateImageView(null, asset?.LocalIdentifier);
}
}
public override bool ShouldSelectItem (UICollectionView collectionView, NSIndexPath indexPath)
{
return true;
}
public override bool ShouldDeselectItem (UICollectionView collectionView, NSIndexPath indexPath)
{
var deselect = Editing || selecting;
if (deselect) SaveActiveSnapshotAndResetAnnotateImageView(null, TrapState.Shared.LocalIdentifiersForActiveSnapshot);
return deselect;
}
public override void ItemDeselected (UICollectionView collectionView, NSIndexPath indexPath)
{
if (Editing) {
editIndexes.Remove(indexPath);
} else if (selecting) {
var asset = assetsFetchResults?[indexPath.Item] as PHAsset;
TrapState.Shared.RemoveSnapshotImage(asset?.LocalIdentifier);
// may need to accout for this view presented over the new bug details tvc
// TrackerService.Shared.setCurrentTrackerType(.None) // why?
} else {
var asset = assetsFetchResults?[indexPath.Item] as PHAsset;
SaveActiveSnapshotAndResetAnnotateImageView(null, asset?.LocalIdentifier);
}
}
[Export("collectionView:layout:sizeForItemAtIndexPath:")]
public CGSize GetSizeForItem (UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath)
{
return cellSize;
}
void SaveActiveSnapshotAndResetAnnotateImageView (nint? indexForExtension, string localIdentifier)
{
// var navController = NavigationController as BtImageNavigationController;
// if (navController != null) navController.SelectingSnapshotImagesForExport = false;
selectingSnapshotImagesForExport = false;
var annotateImageNavController = PresentingViewController?.ChildViewControllers?[0] as BtAnnotateImageNavigationController;
var annotateImageController = annotateImageNavController?.TopViewController as BtAnnotateImageViewController ??
PresentingViewController?.ChildViewControllers?[0] as BtAnnotateImageViewController;
annotateImageController.SaveCurrentSnapshotAndResetState(indexForExtension, localIdentifier);
DismissViewController(true, null);
}
partial void titleClicked (UIButton sender)
{
editIndexes = new List<NSIndexPath> ();
Editing = false;
updateViewConfiguration(false, selecting);
TrapState.Shared.ResetSnapshotImages(false);
selectingSnapshotImagesForExport = false;
DismissViewController(true, null);
}
partial void cancelClicked (UIBarButtonItem sender)
{
// cancel should only appear if selecting screenshots for a new bug, or in edit state (delete)
if (Editing) {
Editing = false;
updateViewConfiguration();
CollectionView.ReloadItems(editIndexes.ToArray());
editIndexes = new List<NSIndexPath> ();
} else if (selecting) {
TrapState.Shared.ResetSnapshotImages();
selectingSnapshotImagesForExport = false;
DismissViewController(true, null);
}
}
async partial void trashClicked (UIBarButtonItem sender)
{
Editing = false;
updateViewConfiguration(showActivity: true);
var editAssets = editIndexes.Select(ip => assetsFetchResults[ip.Item] as PHAsset);
await TrapState.Shared.DeleteAssets(editAssets.ToList());
editIndexes = new List<NSIndexPath> ();
BeginInvokeOnMainThread(() => updateViewConfiguration());
}
partial void editClicked (UIBarButtonItem sender)
{
Editing = true;
updateViewConfiguration();
}
async partial void doneClicked (UIBarButtonItem sender)
{
if (selecting) {
selectingSnapshotImagesForExport = false;
var annotateImageNavController = PresentingViewController.ChildViewControllers?.FirstOrDefault() as BtAnnotateImageNavigationController ?? PresentingViewController as BtAnnotateImageNavigationController;
await DismissViewControllerAsync(true);
annotateImageNavController?.PresentNewBugDetailsNavController(true);
} else {
DismissViewController(true, null);
}
}
partial void addClicked (UIBarButtonItem sender)
{
}
void updateViewConfiguration (bool animate = true, bool reloadData = false, bool updateScreenName = true, bool showActivity = false)
{
if (GetItemsCount(CollectionView, 0) == 0 && !noImageView.IsDescendantOfView(View)) {
View.AddSubview(noImageView);
} else if (noImageView.IsDescendantOfView(View)) {
noImageView.RemoveFromSuperview();
}
if (updateScreenName) UpdateScreenName(Editing ? GAIKeys.ScreenNames.EditSnapshots : GAIKeys.ScreenNames.SelectSnapshot);
CollectionView.AllowsMultipleSelection = true;
var leftItem = selecting || Editing ? cancelButton : editButton;
var rightItem = showActivity ? activityButton : Editing ? trashButton : selecting ? doneButton : null;
if (NavigationItem.LeftBarButtonItem != leftItem) NavigationItem.SetLeftBarButtonItem(leftItem, animate);
if (NavigationItem.RightBarButtonItem != rightItem) NavigationItem.SetRightBarButtonItem(rightItem, animate);
if (reloadData) {
if (TrapState.Shared.InActionExtension) {
CollectionView.ReloadData();
} else {
Task.Run(async () => {
var oldCount = assetsFetchResults?.Count ?? 0;
await TrapState.Shared.GetAlbumLocalIdentifier();
PHPhotoLibrary.SharedPhotoLibrary.UnregisterChangeObserver(this);
assetsFetchResults = PHAsset.FetchAssets(PHAssetMediaType.Image, fetchOptions);
if ((assetsFetchResults?.Count ?? 0) > oldCount) InvokeOnMainThread(() => CollectionView.ReloadData());
PHPhotoLibrary.SharedPhotoLibrary.RegisterChangeObserver(this);
});
}
}
}
// } else if let oldCount = assetsFetchResults?.count {
//
// TrapState.Shared.getAlbumLocalIdentifier() { _ in
//
// PHPhotoLibrary.sharedPhotoLibrary().unregisterChangeObserver(self)
//
// self.assetsFetchResults = PHAsset.fetchAssetsWithMediaType(.Image, options: self.fetchOptions)
//
// if self.assetsFetchResults?.count > oldCount {
//
// dispatch_async(dispatch_get_main_queue()) {
//
// self.collectionView!.reloadData()
// }
// }
//
// PHPhotoLibrary.sharedPhotoLibrary().registerChangeObserver(self)
// }
// }
// }
public override bool PrefersStatusBarHidden () => true;
public override UIStatusBarStyle PreferredStatusBarStyle () => UIStatusBarStyle.LightContent;
}
}
| 28.989107 | 207 | 0.745153 | [
"MIT"
] | colbylwilliams/bugtrap | iOS/Code/Xamarin/bugTrap/bugTrapKit/Controllers/CollectionViewControllers/BtImageCollectionViewController.cs | 13,306 | C# |
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using DataDictionary.Sample.MultiTenancy;
using EasyAbp.Abp.DataDictionary;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Emailing;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.IdentityServer;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.PermissionManagement.IdentityServer;
using Volo.Abp.SettingManagement;
using Volo.Abp.TenantManagement;
namespace DataDictionary.Sample
{
[DependsOn(
typeof(SampleDomainSharedModule),
typeof(AbpAuditLoggingDomainModule),
typeof(AbpBackgroundJobsDomainModule),
typeof(AbpFeatureManagementDomainModule),
typeof(AbpIdentityDomainModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpIdentityServerDomainModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AbpSettingManagementDomainModule),
typeof(AbpTenantManagementDomainModule),
typeof(AbpEmailingModule),
typeof(AbpDataDictionaryDomainModule)
)]
public class SampleDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
#if DEBUG
context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
#endif
}
}
}
| 33.77551 | 99 | 0.75287 | [
"MIT"
] | EasyAbp/Abp.DataDictionary | samples/src/DataDictionary.Sample.Domain/SampleDomainModule.cs | 1,657 | C# |
using Microsoft.Xna.Framework;
using System;
namespace TerrariaApi.Server
{
public class ChatReceivedEventArgs : EventArgs
{
public byte PlayerID
{
get;
internal set;
}
public Color Color
{
get;
internal set;
}
public string Message
{
get;
internal set;
}
}
}
| 11.730769 | 47 | 0.652459 | [
"MIT"
] | BloodARG/tModLoaderTShock | src/tModLoader/TerrariaApi.Server/EventArgs/ChatReceivedEventArgs.cs | 307 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PublicTransport.Infrastructure.Data;
#nullable disable
namespace PublicTransport.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20220323183353_AddAndUpdateTables")]
partial class AddAndUpdateTables
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.News", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AuthorId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("News");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.NewsComment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<Guid>("NewsId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("NewsId");
b.HasIndex("UserId");
b.ToTable("NewsComments");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.Photo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AuthorId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("DateOfPicture")
.HasColumnType("datetime2");
b.Property<DateTime>("DateUploaded")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<bool>("IsAuthor")
.HasColumnType("bit");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserMessage")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<Guid>("VehicleId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("VehicleId");
b.ToTable("Photo");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.PhotoComment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<Guid>("PhotoId")
.HasColumnType("uniqueidentifier");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("PhotoId");
b.HasIndex("UserId");
b.ToTable("PhotoComment");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.Vehicle", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Condition")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("FactoryNumber")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("InUseSince")
.HasColumnType("datetime2");
b.Property<DateTime?>("InUseTo")
.HasColumnType("datetime2");
b.Property<string>("InventoryNumber")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Make")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Model")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("YearBuilt")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Vehicle");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.WebsiteUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<DateTime>("RegisteredOn")
.HasColumnType("datetime2");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.News", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", "Author")
.WithMany()
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.NewsComment", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.News", "News")
.WithMany("NewsComments")
.HasForeignKey("NewsId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", "User")
.WithMany("NewsComments")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("News");
b.Navigation("User");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.Photo", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", "Author")
.WithMany("Photos")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PublicTransport.Infrastructure.Data.Models.Vehicle", "Vehicle")
.WithMany("Photos")
.HasForeignKey("VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Vehicle");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.PhotoComment", b =>
{
b.HasOne("PublicTransport.Infrastructure.Data.Models.Photo", "Photo")
.WithMany("PhotoComments")
.HasForeignKey("PhotoId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PublicTransport.Infrastructure.Data.Models.WebsiteUser", "User")
.WithMany("PhotoComments")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Photo");
b.Navigation("User");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.News", b =>
{
b.Navigation("NewsComments");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.Photo", b =>
{
b.Navigation("PhotoComments");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.Vehicle", b =>
{
b.Navigation("Photos");
});
modelBuilder.Entity("PublicTransport.Infrastructure.Data.Models.WebsiteUser", b =>
{
b.Navigation("NewsComments");
b.Navigation("PhotoComments");
b.Navigation("Photos");
});
#pragma warning restore 612, 618
}
}
}
| 36.951957 | 103 | 0.451967 | [
"MIT"
] | HNochev/PublicTransport | PublicTransport.Infrastructure/Migrations/20220323183353_AddAndUpdateTables.Designer.cs | 20,769 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/DirectML.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using NUnit.Framework;
using System;
using System.Runtime.InteropServices;
namespace TerraFX.Interop.UnitTests
{
/// <summary>Provides validation of the <see cref="DML_VALUE_SCALE_2D_OPERATOR_DESC" /> struct.</summary>
public static unsafe class DML_VALUE_SCALE_2D_OPERATOR_DESCTests
{
/// <summary>Validates that the <see cref="DML_VALUE_SCALE_2D_OPERATOR_DESC" /> struct is blittable.</summary>
[Test]
public static void IsBlittableTest()
{
Assert.That(Marshal.SizeOf<DML_VALUE_SCALE_2D_OPERATOR_DESC>(), Is.EqualTo(sizeof(DML_VALUE_SCALE_2D_OPERATOR_DESC)));
}
/// <summary>Validates that the <see cref="DML_VALUE_SCALE_2D_OPERATOR_DESC" /> struct has the right <see cref="LayoutKind" />.</summary>
[Test]
public static void IsLayoutSequentialTest()
{
Assert.That(typeof(DML_VALUE_SCALE_2D_OPERATOR_DESC).IsLayoutSequential, Is.True);
}
/// <summary>Validates that the <see cref="DML_VALUE_SCALE_2D_OPERATOR_DESC" /> struct has the correct size.</summary>
[Test]
public static void SizeOfTest()
{
if (Environment.Is64BitProcess)
{
Assert.That(sizeof(DML_VALUE_SCALE_2D_OPERATOR_DESC), Is.EqualTo(32));
}
else
{
Assert.That(sizeof(DML_VALUE_SCALE_2D_OPERATOR_DESC), Is.EqualTo(20));
}
}
}
}
| 39.704545 | 145 | 0.669147 | [
"MIT"
] | phizch/terrafx.interop.windows | tests/Interop/Windows/um/DirectML/DML_VALUE_SCALE_2D_OPERATOR_DESCTests.cs | 1,749 | C# |
#if (UNITY_WINRT || UNITY_WP_8_1) && !UNITY_EDITOR && !UNITY_WP8
#region License
// Copyright (c) 2007 James Newton-King
//
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json
{
internal enum JsonContainerType
{
None,
Object,
Array,
Constructor
}
internal struct JsonPosition
{
internal JsonContainerType Type;
internal int Position;
internal string PropertyName;
internal bool HasIndex;
public JsonPosition(JsonContainerType type)
{
Type = type;
HasIndex = TypeHasIndex(type);
Position = -1;
PropertyName = null;
}
internal void WriteTo(StringBuilder sb)
{
switch (Type)
{
case JsonContainerType.Object:
if (sb.Length > 0)
sb.Append(".");
sb.Append(PropertyName);
break;
case JsonContainerType.Array:
case JsonContainerType.Constructor:
sb.Append("[");
sb.Append(Position);
sb.Append("]");
break;
}
}
internal static bool TypeHasIndex(JsonContainerType type)
{
return (type == JsonContainerType.Array || type == JsonContainerType.Constructor);
}
internal static string BuildPath(IEnumerable<JsonPosition> positions)
{
StringBuilder sb = new StringBuilder();
foreach (JsonPosition state in positions)
{
state.WriteTo(sb);
}
return sb.ToString();
}
internal static string FormatMessage(IJsonLineInfo lineInfo, string path, string message)
{
// don't add a fullstop and space when message ends with a new line
if (!message.EndsWith(Environment.NewLine))
{
message = message.Trim();
if (!message.EndsWith("."))
message += ".";
message += " ";
}
message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
if (lineInfo != null && lineInfo.HasLineInfo())
message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
message += ".";
return message;
}
}
}
#endif | 28.42735 | 131 | 0.668972 | [
"Apache-2.0"
] | 1st-SE-HCMUS/SpaceCrushUnity | Assets/JsonDotNet/Source/WinRT/RT_JsonPosition.cs | 3,326 | C# |
namespace Sideways
{
using System;
using System.Windows;
public readonly struct CandlePosition : IEquatable<CandlePosition>
{
internal readonly int Left;
internal readonly int Right;
private readonly int candleWidth;
private readonly Size renderSize;
private readonly ValueRange valueRange;
private CandlePosition(int left, int right, int candleWidth, Size renderSize, ValueRange valueRange)
{
this.Left = left;
this.Right = right;
this.candleWidth = candleWidth;
this.renderSize = renderSize;
this.valueRange = valueRange;
}
internal double Center => (this.Left + this.Right) / 2.0;
public static bool operator ==(CandlePosition left, CandlePosition right)
{
return left.Equals(right);
}
public static bool operator !=(CandlePosition left, CandlePosition right)
{
return !left.Equals(right);
}
public static CandlePosition RightToLeft(Size renderSize, int candleWidth, ValueRange valueRange, int leftPad = 0, int rightPad = 0)
{
var right = (int)renderSize.Width - rightPad;
var left = right - candleWidth + rightPad + leftPad;
return new(
left: left,
right: right,
candleWidth: candleWidth,
renderSize: renderSize,
valueRange: valueRange);
}
public static CandlePosition RightToLeftPadded(Size renderSize, int candleWidth, ValueRange valueRange)
{
return candleWidth switch
{
< 2 => RightToLeft(renderSize, candleWidth, valueRange, 0, 0),
3 => RightToLeft(renderSize, candleWidth, valueRange, 0, 1),
4 => RightToLeft(renderSize, candleWidth, valueRange, 1, 1),
5 => RightToLeft(renderSize, candleWidth, valueRange, 1, 1),
< 8 => RightToLeft(renderSize, candleWidth, valueRange, 1, 1),
< 12 => RightToLeft(renderSize, candleWidth, valueRange, 2, 2),
< 24 => RightToLeft(renderSize, candleWidth, valueRange, 3, 3),
_ => RightToLeft(renderSize, candleWidth, valueRange, 4, 4),
};
}
public static double ClampedX(DateTimeOffset time, DescendingCandles candles, double actualWidth, int candleWidth, CandleInterval interval)
{
if (candles.Count == 0 ||
time > candles[0].Time)
{
return actualWidth;
}
return X(time, candles, actualWidth, candleWidth, interval) ?? 0;
}
public static double? X(DateTimeOffset time, DescendingCandles candles, double actualWidth, int candleWidth, CandleInterval interval)
{
if (candles.Count == 0 ||
time > candles[0].Time)
{
return null;
}
// ReSharper disable once PossibleLossOfFraction
var x = actualWidth - (0.5 * candleWidth);
foreach (var candle in candles)
{
switch (interval)
{
case CandleInterval.Week
when time.IsSameWeek(candle.Time):
return x;
case CandleInterval.Day
when time.IsSameDay(candle.Time):
return x;
case CandleInterval.Hour
when Candle.ShouldMergeHour(time, candle.Time):
return x;
case CandleInterval.FifteenMinutes
when Candle.ShouldMergeFifteenMinutes(time, candle.Time):
return x;
case CandleInterval.FiveMinutes
when Candle.ShouldMergeFiveMinutes(time, candle.Time):
return x;
case CandleInterval.Minute
when candle.Time <= time:
return x;
}
x -= candleWidth;
if (x < 0 ||
candle.Time < time)
{
return null;
}
}
return null;
}
public static Point? Point(TimeAndPrice timeAndPrice, DescendingCandles candles, Size renderSize, int candleWidth, CandleInterval interval, ValueRange valueRange)
{
if (X(timeAndPrice.Time, candles, renderSize.Width, candleWidth, interval) is { } x)
{
return new Point(
x,
valueRange.Y(timeAndPrice.Price, renderSize.Height));
}
return null;
}
public static double SnapX(double x, double actualWidth, int candleWidth)
{
return actualWidth - Center(actualWidth - x);
double Center(double value) => value - (value % candleWidth) + (0.5 * candleWidth);
}
public double Y(float value) => this.valueRange.Y(value, this.renderSize.Height);
public TimeAndPrice? TimeAndPrice(Point position, DescendingCandles candles)
{
var i = (int)Math.Floor((this.renderSize.Width - position.X) / this.candleWidth);
if (i >= 0 && i < candles.Count)
{
return new TimeAndPrice(candles[i].Time, this.valueRange.ValueFromY(position.Y, this.renderSize.Height));
}
return null;
}
public CandlePosition ShiftLeft() => new(
left: this.Left - this.candleWidth,
right: this.Right - this.candleWidth,
candleWidth: this.candleWidth,
renderSize: this.renderSize,
valueRange: this.valueRange);
public bool Equals(CandlePosition other)
{
return this.Left.Equals(other.Left) &&
this.Right.Equals(other.Right) &&
this.candleWidth.Equals(other.candleWidth) &&
Size.Equals(this.renderSize, other.renderSize) &&
this.valueRange.Equals(other.valueRange);
}
public override bool Equals(object? obj)
{
return obj is CandlePosition other && this.Equals(other);
}
public override int GetHashCode()
{
return HashCode.Combine(this.Left, this.Right, this.candleWidth, this.renderSize, this.valueRange);
}
}
}
| 37.005618 | 170 | 0.54395 | [
"MIT"
] | JohanLarsson/Sideways | Sideways/Chart/CandlePosition.cs | 6,589 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
namespace DTFiniteGraphMachine {
public class CountMap<T> : Dictionary<T, int> {
// PRAGMA MARK - Public Interface
public void Increment(T key, int amount = 1) {
this[key] = this.GetValue(key) + amount;
}
public void Decrement(T key, int amount = 1) {
this[key] = this.GetValue(key) - amount;
}
public int GetValue(T key) {
return this.SafeGet(key, defaultValue: 0);
}
}
} | 24.95 | 50 | 0.653307 | [
"MIT"
] | DarrenTsung/finite-graph-machine | FiniteGraphMachine/Core/CountMap.cs | 499 | C# |
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Xml;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop
{
public static class LanguageService
{
static string languagePath = Path.Combine(PropertyService.DataDirectory, "resources", "languages");
static ReadOnlyCollection<Language> languages = null;
public static ReadOnlyCollection<Language> Languages {
get {
return languages;
}
}
public static Language GetLanguage(string code)
{
foreach (Language l in languages) {
if (l.Code == code)
return l;
}
foreach (Language l in languages) {
if (l.Code.StartsWith(code, StringComparison.Ordinal))
return l;
}
return languages[0];
}
static LanguageService()
{
List<Language> languages = new List<Language>();
XmlDocument doc = new XmlDocument();
doc.Load(Path.Combine(languagePath, "LanguageDefinition.xml"));
XmlNodeList nodes = doc.DocumentElement.ChildNodes;
foreach (XmlNode node in nodes) {
XmlElement el = node as XmlElement;
if (el != null) {
languages.Add(new Language(
el.Attributes["name"].InnerText,
el.Attributes["code"].InnerText,
Path.Combine(languagePath, el.Attributes["icon"].InnerText),
el.GetAttribute("dir") == "rtl"
));
}
}
LanguageService.languages = languages.AsReadOnly();
}
/// <summary>
/// Ensures that the active language exists
/// </summary>
public static void ValidateLanguage()
{
ResourceService.Language = GetLanguage(ResourceService.Language).Code;
}
}
}
| 25.746479 | 103 | 0.694748 | [
"MIT"
] | Plankankul/SharpDevelop-w-Framework | src/Main/Base/Project/Src/Services/Language/LanguageService.cs | 1,830 | C# |
using UnityEngine;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace StrumpyShaderEditor
{
[DataContract(Namespace = "http://strumpy.net/ShaderEditor/")]
[NodeMetaData("MxV", "Operation", typeof(MxVNode),"Multiply a Matrix with a Vertex. Equivalent to translating it by that vertex, this is mostly used internally to vertex shaders, but may be of use for transfering values to the pixel graph.")]
public class MxVNode : Node, IResultCacheNode {
private const string NodeName = "MxV";
[DataMember] private Float4OutputChannel _result;
[DataMember] private MatrixInputChannel _matrix;
[DataMember] private Float4InputChannel _vector;
public MxVNode()
{
Initialize();
}
public override sealed void Initialize ()
{
_result = _result ?? new Float4OutputChannel( 0, "Result" );
_matrix = _matrix ?? new MatrixInputChannel( 0, "Matrix", Matrix4x4.identity );
_vector = _vector ?? new Float4InputChannel( 1, "Vector", Vector4.zero );
}
protected override IEnumerable<OutputChannel> GetOutputChannels()
{
var ret = new List<OutputChannel> {_result};
return ret;
}
public override IEnumerable<InputChannel> GetInputChannels()
{
var ret = new List<InputChannel> { _matrix,_vector};
return ret;
}
public override string NodeTypeName
{
get{ return NodeName; }
}
public string GetAdditionalFields()
{
var arg1 = _vector.ChannelInput( this );
var arg2 = _matrix.ChannelInput( this );
var ret = arg1.AdditionalFields;
ret += arg2.AdditionalFields;
return ret;
}
public string GetUsage()
{
var arg1 = _matrix.ChannelInput( this );
var arg2 = _vector.ChannelInput( this );
var result = "float4 ";
result += UniqueNodeIdentifier;
result += "=";
result += "mul( ";
result += arg1.QueryResult + ", ";
result += arg2.QueryResult + " );\n";
return result;
}
public override string GetExpression( uint channelId )
{
AssertOutputChannelExists( channelId );
return UniqueNodeIdentifier;
}
}
} | 28.30137 | 243 | 0.697967 | [
"MIT"
] | Aeal/SSE | ShaderEditor/Assets/StrumpyShaderEditor/Editor/Graph/Nodes/Operations/MxVNode.cs | 2,066 | C# |
using System.Collections.Generic;
using System.Linq;
using Amazon.Lambda.AspNetCoreServer;
using Amazon.Lambda.Core;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http.Features;
namespace Albelli.Templates.Amazon.Core.Pipelines
{
[PublicAPI]
public abstract class PipelinedAspNetCoreFunction<TRequest, TResponse> : AbstractAspNetCoreFunction<TRequest, TResponse>
{
protected PipelinedAspNetCoreFunction()
: base()
{
}
protected PipelinedAspNetCoreFunction(StartupMode startupMode)
: base(startupMode)
{
}
public List<IAspNetRequestPipelineHandler<TRequest>> AspNetRequestPipelineHandlers { get; } = new List<IAspNetRequestPipelineHandler<TRequest>>();
public List<IAspNetResponsePipelineHandler<TResponse>> AspNetResponsePipelineHandlers { get; } = new List<IAspNetResponsePipelineHandler<TResponse>>();
protected override void PostMarshallRequestFeature(IHttpRequestFeature aspNetCoreRequestFeature, TRequest lambdaRequest, ILambdaContext lambdaContext)
{
AspNetRequestPipelineHandlers.ForEach(handler => handler.PostMarshallRequestFeature(aspNetCoreRequestFeature, lambdaRequest, lambdaContext));
base.PostMarshallRequestFeature(aspNetCoreRequestFeature, lambdaRequest, lambdaContext);
}
protected override void PostMarshallResponseFeature(IHttpResponseFeature aspNetCoreResponseFeature, TResponse lambdaResponse, ILambdaContext lambdaContext)
{
base.PostMarshallResponseFeature(aspNetCoreResponseFeature, lambdaResponse, lambdaContext);
AspNetResponsePipelineHandlers.ToArray().Reverse().ToList().ForEach(handler => handler.PostMarshallResponseFeature(aspNetCoreResponseFeature, lambdaResponse, lambdaContext));
}
}
} | 47.102564 | 186 | 0.763201 | [
"MIT"
] | albumprinter/Albelli.Lambda.Templates | src/Albelli.Templates.Amazon.Core/Pipelines/PipelinedAspNetCoreFunction.cs | 1,839 | C# |
namespace MooVC.Serialization
{
using System.Runtime.Serialization;
public static partial class SerializationInfoExtensions
{
public static float GetInternalSingle(this SerializationInfo info, string name)
{
return info.GetSingle(FormatName(name));
}
}
} | 25.666667 | 87 | 0.685065 | [
"MIT"
] | MooVC/MooVC | src/MooVC/Serialization/SerializationInfoExtensions.GetInternalSingle.cs | 310 | C# |
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell.Interop;
namespace Jannesen.VisualStudioExtension.TypedTSql.LanguageService.Library
{
internal class SimpleObjectList: IVsSimpleObjectList2
{
private List<SimpleObject> _items;
public SimpleObjectList(List<SimpleObject> items)
{
_items = items;
}
int IVsSimpleObjectList2.CanDelete(uint index, out int pfOK)
{
pfOK = 0;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.CanGoToSource(uint index, VSOBJGOTOSRCTYPE srcType, out int pfOK)
{
if (index >= _items.Count) {
pfOK = 0;
return VSConstants.E_INVALIDARG;
}
pfOK = _items[(int)index].CanGoToSource(srcType) ? 1 : 0;
return VSConstants.S_OK;
}
int IVsSimpleObjectList2.CanRename(uint index, string pszNewName, out int pfOK)
{
pfOK = 0;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.CountSourceItems(uint index, out IVsHierarchy ppHier, out uint pItemid, out uint pcItems)
{
if (index >= _items.Count) {
ppHier = null;
pItemid = 0;
pcItems = 0;
return VSConstants.E_INVALIDARG;
}
return _items[(int)index].CountSourceItems(out ppHier, out pItemid, out pcItems);
}
int IVsSimpleObjectList2.DoDelete(uint index, uint grfFlags)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.DoDragDrop(uint index, IDataObject pDataObject, uint grfKeyState, ref uint pdwEffect)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.DoRename(uint index, string pszNewName, uint grfFlags)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.EnumClipboardFormats(uint index, uint grfFlags, uint celt, VSOBJCLIPFORMAT[] rgcfFormats, uint[] pcActual)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.FillDescription2(uint index, uint grfOptions, IVsObjectBrowserDescription3 pobDesc)
{
if (index >= _items.Count)
return VSConstants.E_INVALIDARG;
return _items[(int)index].FillDescription(grfOptions, pobDesc);
}
int IVsSimpleObjectList2.GetBrowseObject(uint index, out object ppdispBrowseObj)
{
ppdispBrowseObj = null;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetCapabilities2(out uint pgrfCapabilities)
{
pgrfCapabilities = 0;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetCategoryField2(uint index, int category, out uint pfCatField)
{
if ((int)index == -1) {
pfCatField = 0;
return VSConstants.S_OK;
}
if (index >= _items.Count) {
pfCatField = 0;
return VSConstants.E_INVALIDARG;
}
return _items[(int)index].GetCategoryField(category, out pfCatField);
}
int IVsSimpleObjectList2.GetClipboardFormat(uint index, uint grfFlags, FORMATETC[] pFormatetc, STGMEDIUM[] pMedium)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetContextMenu(uint index, out Guid pclsidActive, out int pnMenuId, out IOleCommandTarget ppCmdTrgtActive)
{
if (index >= _items.Count) {
pclsidActive = Guid.Empty;
pnMenuId = 0;
ppCmdTrgtActive = null;
return VSConstants.E_INVALIDARG;
}
return _items[(int)index].GetContextMenu(out pclsidActive, out pnMenuId, out ppCmdTrgtActive);
}
int IVsSimpleObjectList2.GetDisplayData(uint index, VSTREEDISPLAYDATA[] pData)
{
if (index >= _items.Count)
return VSConstants.E_INVALIDARG;
return _items[(int)index].GetDisplayData(pData);
}
int IVsSimpleObjectList2.GetExpandable3(uint index, uint listTypeExcluded, out int pfExpandable)
{
if (index >= _items.Count) {
pfExpandable = 0;
return VSConstants.E_INVALIDARG;
}
pfExpandable = _items[(int)index].GetExpandable3(listTypeExcluded) ? 1 : 0;
return VSConstants.S_OK;
}
int IVsSimpleObjectList2.GetExtendedClipboardVariant(uint index, uint grfFlags, VSOBJCLIPFORMAT[] pcfFormat, out object pvarFormat)
{
pvarFormat = null;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetFlags(out uint pFlags)
{
pFlags = 0;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetItemCount(out uint pCount)
{
pCount = (uint)_items.Count;
return VSConstants.S_OK;
}
int IVsSimpleObjectList2.GetList2(uint index, uint listType, uint flags, VSOBSEARCHCRITERIA2[] pobSrch, out IVsSimpleObjectList2 ppIVsSimpleObjectList2)
{
if (index >= _items.Count) {
ppIVsSimpleObjectList2 = null;
return VSConstants.E_INVALIDARG;
}
return _items[(int)index].GetList(listType, flags, pobSrch, out ppIVsSimpleObjectList2);
}
int IVsSimpleObjectList2.GetMultipleSourceItems(uint index, uint grfGSI, uint cItems, VSITEMSELECTION[] rgItemSel)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetNavInfo(uint index, out IVsNavInfo ppNavInfo)
{
ppNavInfo = null;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetNavInfoNode(uint index, out IVsNavInfoNode ppNavInfoNode)
{
if (index >= _items.Count) {
ppNavInfoNode = null;
return VSConstants.E_INVALIDARG;
}
ThreadHelper.ThrowIfNotOnUIThread();
ppNavInfoNode = _items[(int)index] as IVsNavInfoNode;
return (ppNavInfoNode != null) ? VSConstants.S_OK : VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetProperty(uint index, int propid, out object pvar)
{
pvar = null;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetSourceContextWithOwnership(uint index, out string pbstrFilename, out uint pulLineNum)
{
pbstrFilename = null;
pulLineNum = 0;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetTextWithOwnership(uint index, VSTREETEXTOPTIONS tto, out string pbstrText)
{
if (index >= _items.Count) {
pbstrText = null;
return VSConstants.E_INVALIDARG;
}
pbstrText = _items[(int)index].GetText(tto);
return pbstrText != null ? VSConstants.S_OK : VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetTipTextWithOwnership(uint index, VSTREETOOLTIPTYPE eTipType, out string pbstrText)
{
if (index >= _items.Count) {
pbstrText = null;
return VSConstants.E_INVALIDARG;
}
pbstrText = _items[(int)index].GetTipText(eTipType);
return pbstrText != null ? VSConstants.S_OK : VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GetUserContext(uint index, out object ppunkUserCtx)
{
ppunkUserCtx = null;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE srcType)
{
if (index >= _items.Count)
return VSConstants.E_INVALIDARG;
return _items[(int)index].GoToSource(srcType);
}
int IVsSimpleObjectList2.LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
{
pulIndex = 0;
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.OnClose(VSTREECLOSEACTIONS[] ptca)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.QueryDragDrop(uint index, IDataObject pDataObject, uint grfKeyState, ref uint pdwEffect)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.ShowHelp(uint index)
{
return VSConstants.E_NOTIMPL;
}
int IVsSimpleObjectList2.UpdateCounter(out uint pCurUpdate)
{
pCurUpdate = 0;
return VSConstants.S_OK;
}
}
}
| 37.185185 | 160 | 0.59927 | [
"Apache-2.0"
] | jannesen/TypedTSql | Jannesen.VisualStudioExtension.TypedTSql/LanguageService/SimpleLibrary/SimpleObjectList.cs | 9,038 | 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("SmartCardDriver")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("SmartCardDriver")]
[assembly: System.Reflection.AssemblyTitleAttribute("SmartCardDriver")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
| 41.458333 | 80 | 0.652261 | [
"Apache-2.0"
] | nerohytis/ALTS | SmartCardDriver/obj/Debug/netstandard2.0/SmartCardDriver.AssemblyInfo.cs | 995 | C# |
//------------------------------------------------------------------------------
// <copyright file="OpenFileDialog.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Windows.Forms
{
using System.Diagnostics;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using CodeAccessPermission = System.Security.CodeAccessPermission;
using System.Security.Permissions;
using System.IO;
using System.ComponentModel;
using Microsoft.Win32;
using System.Runtime.Versioning;
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog"]/*' />
/// <devdoc>
/// <para>
/// Represents a common dialog box
/// that displays the control that allows the user to open a file. This class
/// cannot be inherited.
/// </para>
/// </devdoc>
[SRDescription(SR.DescriptionOpenFileDialog)]
public sealed class OpenFileDialog : FileDialog
{
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.CheckFileExists"]/*' />
/// <devdoc>
/// <para>
/// Gets or sets a value indicating whether the dialog box displays a
/// warning if the user specifies a file name that does not exist.
/// </para>
/// </devdoc>
[
DefaultValue(true),
SRDescription(SR.OFDcheckFileExistsDescr)
]
public override bool CheckFileExists
{
get
{
return base.CheckFileExists;
}
set
{
base.CheckFileExists = value;
}
}
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.Multiselect"]/*' />
/// <devdoc>
/// <para>
/// Gets or sets a value
/// indicating whether the dialog box allows multiple files to be selected.
/// </para>
/// </devdoc>
[
SRCategory(SR.CatBehavior),
DefaultValue(false),
SRDescription(SR.OFDmultiSelectDescr)
]
public bool Multiselect
{
get
{
return GetOption(NativeMethods.OFN_ALLOWMULTISELECT);
}
set
{
SetOption(NativeMethods.OFN_ALLOWMULTISELECT, value);
}
}
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.ReadOnlyChecked"]/*' />
/// <devdoc>
/// <para>
/// Gets or sets a value indicating whether
/// the read-only check box is selected.
/// </para>
/// </devdoc>
[
SRCategory(SR.CatBehavior),
DefaultValue(false),
SRDescription(SR.OFDreadOnlyCheckedDescr)
]
public bool ReadOnlyChecked
{
get
{
return GetOption(NativeMethods.OFN_READONLY);
}
set
{
SetOption(NativeMethods.OFN_READONLY, value);
}
}
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.ShowReadOnly"]/*' />
/// <devdoc>
/// <para>
/// Gets or sets a value indicating whether the dialog contains a read-only check box.
/// </para>
/// </devdoc>
[
SRCategory(SR.CatBehavior),
DefaultValue(false),
SRDescription(SR.OFDshowReadOnlyDescr)
]
public bool ShowReadOnly
{
get
{
return !GetOption(NativeMethods.OFN_HIDEREADONLY);
}
set
{
SetOption(NativeMethods.OFN_HIDEREADONLY, !value);
}
}
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.OpenFile"]/*' />
/// <devdoc>
/// <para>
/// Opens the file selected by the user with read-only permission. The file
/// attempted is specified by the <see cref='System.Windows.Forms.FileDialog.FileName'/> property.
/// </para>
/// </devdoc>
[SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")]
/// SECREVIEW: ReviewImperativeSecurity
/// vulnerability to watch out for: A method uses imperative security and might be constructing the permission using state information or return values that can change while the demand is active.
/// reason for exclude: filename is snapped directly at the beginning of the function.
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
public Stream OpenFile()
{
Debug.WriteLineIf(IntSecurity.SecurityDemand.TraceVerbose, "FileDialogOpenFile Demanded");
IntSecurity.FileDialogOpenFile.Demand();
string filename = FileNamesInternal[0];
if (filename == null || (filename.Length == 0))
throw new ArgumentNullException("FileName");
Stream s = null;
// SECREVIEW : We demanded the FileDialog permission above, so it is safe
// : to assert this here. Since the user picked the file, it
// : is OK to give them readonly access to the stream.
//
new FileIOPermission(FileIOPermissionAccess.Read, IntSecurity.UnsafeGetFullPath(filename)).Assert();
try
{
s = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
}
finally
{
CodeAccessPermission.RevertAssert();
}
return s;
}
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.Reset"]/*' />
/// <devdoc>
/// <para>
/// Resets all properties to their default values.
/// </para>
/// </devdoc>
public override void Reset()
{
base.Reset();
SetOption(NativeMethods.OFN_FILEMUSTEXIST, true);
}
internal override void EnsureFileDialogPermission()
{
Debug.WriteLineIf(IntSecurity.SecurityDemand.TraceVerbose, "FileDialogOpenFile Demanded in OpenFileDialog.RunFileDialog");
IntSecurity.FileDialogOpenFile.Demand();
}
/// <include file='doc\OpenFileDialog.uex' path='docs/doc[@for="OpenFileDialog.RunFileDialog"]/*' />
/// <devdoc>
/// Displays a file open dialog.
/// </devdoc>
/// <internalonly/>
internal override bool RunFileDialog(NativeMethods.OPENFILENAME_I ofn)
{
//We have already done the demand in EnsureFileDialogPermission but it doesn't hurt to do it again
Debug.WriteLineIf(IntSecurity.SecurityDemand.TraceVerbose, "FileDialogOpenFile Demanded in OpenFileDialog.RunFileDialog");
IntSecurity.FileDialogOpenFile.Demand();
bool result = UnsafeNativeMethods.GetOpenFileName(ofn);
if (!result)
{
// Something may have gone wrong - check for error condition
//
int errorCode = SafeNativeMethods.CommDlgExtendedError();
switch (errorCode)
{
case NativeMethods.FNERR_INVALIDFILENAME:
throw new InvalidOperationException(SR.GetString(SR.FileDialogInvalidFileName, FileName));
case NativeMethods.FNERR_SUBCLASSFAILURE:
throw new InvalidOperationException(SR.GetString(SR.FileDialogSubLassFailure));
case NativeMethods.FNERR_BUFFERTOOSMALL:
throw new InvalidOperationException(SR.GetString(SR.FileDialogBufferTooSmall));
}
}
return result;
}
internal override string[] ProcessVistaFiles(FileDialogNative.IFileDialog dialog)
{
FileDialogNative.IFileOpenDialog openDialog = (FileDialogNative.IFileOpenDialog)dialog;
if (Multiselect)
{
FileDialogNative.IShellItemArray results;
openDialog.GetResults(out results);
uint count;
results.GetCount(out count);
string[] files = new string[count];
for (uint i = 0; i < count; ++i)
{
FileDialogNative.IShellItem item;
results.GetItemAt(i, out item);
files[unchecked((int)i)] = GetFilePathFromShellItem(item);
}
return files;
}
else
{
FileDialogNative.IShellItem item;
openDialog.GetResult(out item);
return new string[] { GetFilePathFromShellItem(item) };
}
}
internal override FileDialogNative.IFileDialog CreateVistaDialog()
{
return new FileDialogNative.NativeFileOpenDialog();
}
[
Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")
]
public string SafeFileName
{
get
{
new FileIOPermission(PermissionState.Unrestricted).Assert();
string fullPath = FileName;
CodeAccessPermission.RevertAssert();
if (string.IsNullOrEmpty(fullPath))
{
return "";
}
string safePath = RemoveSensitivePathInformation(fullPath);
return safePath;
}
}
private static string RemoveSensitivePathInformation(string fullPath)
{
return System.IO.Path.GetFileName(fullPath);
}
[
Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays"),
SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")
]
public string[] SafeFileNames
{
get
{
new FileIOPermission(PermissionState.Unrestricted).Assert();
string[] fullPaths = FileNames;
CodeAccessPermission.RevertAssert();
if (null == fullPaths || 0 == fullPaths.Length)
{ return new string[0]; }
string[] safePaths = new string[fullPaths.Length];
for (int i = 0; i < safePaths.Length; ++i)
{
safePaths[i] = RemoveSensitivePathInformation(fullPaths[i]);
}
return safePaths;
}
}
internal override bool SettingsSupportVistaDialog
{
get
{
return base.SettingsSupportVistaDialog && !this.ShowReadOnly;
}
}
}
}
| 37.167203 | 205 | 0.547106 | [
"Apache-2.0"
] | 295007712/295007712.github.io | sourceCode/dotNet4.6/ndp/fx/src/winforms/Managed/System/WinForms/OpenFileDialog.cs | 11,559 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
using CommandLine;
[assembly: AssemblyTitle("MarWac.Merlin.Console")]
[assembly: AssemblyDescription("Console application to execute Merlin configuration management through text commands.")]
[assembly: AssemblyUsage("Usage: merlin-console -f Source.yml -t Target.xml")]
[assembly: ComVisible(false)] | 41.444444 | 121 | 0.788204 | [
"MIT"
] | maw136/merlin | MarWac.Merlin.Console/Properties/AssemblyInfo.cs | 367 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace RESTfulAPI.Pages
{
/// <summary>
///
/// </summary>
public class AboutModel : PageModel
{
/// <summary>
///
/// </summary>
public string Message { get; private set; }
/// <summary>
///
/// </summary>
public string RouteDataText { get; private set; }
/// <summary>
///
/// </summary>
public void OnGet()
{
Message = "Your application description page.";
}
}
}
| 20.138889 | 59 | 0.551724 | [
"MIT"
] | dpedwards/dotnet-core-restapi | RESTfulAPI/RESTfulAPI/Pages/About.cshtml.cs | 725 | C# |
using Microsoft.Extensions.Configuration;
using SFA.DAS.Encoding;
using StructureMap;
namespace SFA.DAS.Encoder.DependencyResolution
{
public class ConfigurationRegistry : Registry
{
public ConfigurationRegistry()
{
AddConfiguration<EncodingConfig>(Constants.ConfigurationKeys.EncodingConfig);
}
private void AddConfiguration<T>(string key) where T : class
{
For<T>().Use(c => GetConfiguration<T>(c, key)).Singleton();
}
private T GetConfiguration<T>(IContext context, string name)
{
var configuration = context.GetInstance<IConfiguration>();
var section = configuration.GetSection(name);
var value = section.Get<T>();
return value;
}
}
} | 28.535714 | 89 | 0.629537 | [
"MIT"
] | SkillsFundingAgency/das-utilities | SFA.DAS.Encoder/DependencyResolution/ConfigurationRegistry.cs | 801 | C# |
using System;
using System.Linq;
using AutoMapper;
using MTGAHelper.Entity;
using MTGAHelper.Lib;
using Serilog;
namespace MTGAHelper.Web.UI.Shared
{
public class AutoMapperRawDeckToColorConverter : IValueConverter<ConfigModelRawDeck, string>
{
readonly UtilColors utilColors;
public AutoMapperRawDeckToColorConverter(UtilColors utilColors)
{
this.utilColors = utilColors;
}
public string Convert(ConfigModelRawDeck src, ResolutionContext context)
{
var cardsMain = src?.Cards?.Where(i => i.Zone == DeckCardZoneEnum.Deck || i.Zone == DeckCardZoneEnum.Commander);
if (cardsMain == null)
return "";
try
{
var cards = cardsMain.Select(i => i.GrpId).ToArray();
return utilColors.FromGrpIds(cards);
}
catch (Exception ex)
{
Log.Error(ex, $"ERROR: whats null? <{src}> <{src?.Cards}> <{string.Join(",", src?.Cards?.Select(i => i.GrpId))}>");
return "";
}
}
}
}
| 28.615385 | 131 | 0.574373 | [
"MIT"
] | robaxelsen/MTGAHelper-Windows-Client | MTGAHelper.Web.Models/IoC/AutoMapperRawDeckToColorConverter.cs | 1,118 | C# |
using System.Drawing;
namespace ImageParse
{
public static class Rects
{
public static Point TopLeft(this Rectangle rect) => rect.Location;
public static Point TopRight(this Rectangle rect) => new Point(rect.Right, rect.Top);
public static Point BottomLeft(this Rectangle rect) => new Point(rect.Left, rect.Bottom);
public static Point BottomRight(this Rectangle rect) => new Point(rect.Right, rect.Bottom);
public static Point Top(this Rectangle rect) => rect.TopLeft().Average(rect.TopRight());
public static Point Bottom(this Rectangle rect) => rect.BottomLeft().Average(rect.BottomRight());
public static Point Left(this Rectangle rect) => rect.TopLeft().Average(rect.BottomLeft());
public static Point Right(this Rectangle rect) => rect.TopRight().Average(rect.BottomRight());
public static Point Middle(this Rectangle rect) => rect.TopLeft().Average(rect.BottomRight());
}
}
| 53.722222 | 105 | 0.702172 | [
"Apache-2.0"
] | darthwalsh/ImageParse | Rects.cs | 969 | C# |
/*
* SimScale API
*
* The version of the OpenAPI document: 0.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using OpenAPIDateConverter = SimScale.Sdk.Client.OpenAPIDateConverter;
namespace SimScale.Sdk.Model
{
/// <summary>
/// FixedGradientEVBC
/// </summary>
[DataContract]
public partial class FixedGradientEVBC : OneOfCustomFluidBCEddyViscosity, IEquatable<FixedGradientEVBC>
{
/// <summary>
/// Initializes a new instance of the <see cref="FixedGradientEVBC" /> class.
/// </summary>
[JsonConstructorAttribute]
protected FixedGradientEVBC() { }
/// <summary>
/// Initializes a new instance of the <see cref="FixedGradientEVBC" /> class.
/// </summary>
/// <param name="type">Schema name: FixedGradientEVBC (required) (default to "FIXED_GRADIENT").</param>
/// <param name="gradient">gradient.</param>
public FixedGradientEVBC(string type = "FIXED_GRADIENT", DimensionalEddyViscosityGradient gradient = default(DimensionalEddyViscosityGradient))
{
// to ensure "type" is required (not null)
this.Type = type ?? throw new ArgumentNullException("type is a required property for FixedGradientEVBC and cannot be null");
this.Gradient = gradient;
}
/// <summary>
/// Schema name: FixedGradientEVBC
/// </summary>
/// <value>Schema name: FixedGradientEVBC</value>
[DataMember(Name="type", EmitDefaultValue=false)]
public string Type { get; set; }
/// <summary>
/// Gets or Sets Gradient
/// </summary>
[DataMember(Name="gradient", EmitDefaultValue=false)]
public DimensionalEddyViscosityGradient Gradient { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class FixedGradientEVBC {\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" Gradient: ").Append(Gradient).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as FixedGradientEVBC);
}
/// <summary>
/// Returns true if FixedGradientEVBC instances are equal
/// </summary>
/// <param name="input">Instance of FixedGradientEVBC to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(FixedGradientEVBC input)
{
if (input == null)
return false;
return
(
this.Type == input.Type ||
(this.Type != null &&
this.Type.Equals(input.Type))
) &&
(
this.Gradient == input.Gradient ||
(this.Gradient != null &&
this.Gradient.Equals(input.Gradient))
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Type != null)
hashCode = hashCode * 59 + this.Type.GetHashCode();
if (this.Gradient != null)
hashCode = hashCode * 59 + this.Gradient.GetHashCode();
return hashCode;
}
}
}
}
| 33.744526 | 151 | 0.566948 | [
"MIT"
] | SimScaleGmbH/simscale-csharp-sdk | src/SimScale.Sdk/Model/FixedGradientEVBC.cs | 4,623 | C# |
// <copyright file="RequestCharacterListAction.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.GameLogic.PlayerActions.Character;
using MUnique.OpenMU.GameLogic.Views.Character;
/// <summary>
/// Action to request the character list.
/// </summary>
public class RequestCharacterListAction
{
/// <summary>
/// Requests the character list and advances the player state to <see cref="PlayerState.CharacterSelection"/>.
/// </summary>
/// <param name="player">The player who requests the character list.</param>
public void RequestCharacterList(Player player)
{
if (player.PlayerState.TryAdvanceTo(PlayerState.CharacterSelection))
{
player.ViewPlugIns.GetPlugIn<IShowCharacterListPlugIn>()?.ShowCharacterList();
}
}
} | 35.96 | 114 | 0.719689 | [
"MIT"
] | ADMTec/OpenMU | src/GameLogic/PlayerActions/Character/RequestCharacterListAction.cs | 901 | C# |
using Lanches.Models;
using Lanches.ViewModels;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Lanches.Components
{
public class CarrinhoCompraResumo : ViewComponent
{
private readonly CarrinhoCompra _carrinhoCompra;
public CarrinhoCompraResumo(CarrinhoCompra carrinhoCompra)
{
_carrinhoCompra = carrinhoCompra;
}
public IViewComponentResult Invoke()
{
var itens = _carrinhoCompra.GetCarrinhoCompraItens();
//var itens = new List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() };
_carrinhoCompra.CarrinhoCompraItens = itens;
var carrinhoCompraVM = new CarrinhoCompraViewModel
{
CarrinhoCompra = _carrinhoCompra,
CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal()
};
return View(carrinhoCompraVM);
}
}
}
| 28.805556 | 112 | 0.666345 | [
"MIT"
] | DeivideSilva/Asp.NetCore | Lanches/Components/CarrinhoCompraResumo.cs | 1,039 | C# |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. 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.
* 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 TencentCloud.Cdb.V20170320.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class DeleteTimeWindowRequest : AbstractModel
{
/// <summary>
/// 实例ID,格式如:cdb-c1nl9rpv或者cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例ID相同。
/// </summary>
[JsonProperty("InstanceId")]
public string InstanceId{ get; set; }
/// <summary>
/// 内部实现,用户禁止调用
/// </summary>
internal override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "InstanceId", this.InstanceId);
}
}
}
| 30.136364 | 83 | 0.668175 | [
"Apache-2.0"
] | gcguo/tencentcloud-sdk-dotnet | TencentCloud/Cdb/V20170320/Models/DeleteTimeWindowRequest.cs | 1,406 | 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("Task2MethodPrintStatistics")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Task2MethodPrintStatistics")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("0d275250-1397-4a17-867d-b931c8c15c17")]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.513514 | 84 | 0.750175 | [
"MIT"
] | nmarazov/TA-Homework | Courses 2016-spring/HQC-Part1/VariablesDataExpressionsConstants/Task2MethodPrintStatistics/Properties/AssemblyInfo.cs | 1,428 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Venture.Common.Data;
using Venture.Common.Events;
using Venture.TeamWrite.Domain.DomainEvents;
namespace Venture.TeamWrite.Domain
{
public class Team : AggregateRoot
{
public User ProjectOwner { get; private set; }
public ICollection<User> Users { get; private set; }
public ICollection<Comment> Chat { get; private set; }
public void Create(Guid id, User projectOwner)
{
var payload = new {ProjectOwnerId = projectOwner.Id};
var jsonPayload = JsonConvert.SerializeObject(payload);
var teamCreatedEvent = new TeamCreatedEvent(
id,
1,
jsonPayload);
Apply(teamCreatedEvent);
}
public void Join(User user)
{
CheckIfCreated();
CheckIfDeleted();
var payload = new { UserId = user.Id};
var jsonPayload = JsonConvert.SerializeObject(payload);
var teamJoinedEvent = new TeamJoinedEvent(
Id,
Version +1 ,
jsonPayload);
Apply(teamJoinedEvent);
}
public void Leave(User user)
{
CheckIfCreated();
CheckIfDeleted();
var payload = new { UserId = user.Id };
var jsonPayload = JsonConvert.SerializeObject(payload);
var teamLeftEvent = new TeamLeftEvent(
Id,
Version + 1,
jsonPayload);
Apply(teamLeftEvent);
}
public void Approve(User user)
{
CheckIfCreated();
CheckIfDeleted();
if (! Users.Any(u => u.Id == user.Id))
{
throw new ArgumentException("Cannot approve user that hasn't joined");
}
var payload = new { UserId = user.Id };
var jsonPayload = JsonConvert.SerializeObject(payload);
var teamUserApprovedEvent = new TeamUserApprovedEvent(
Id,
Version + 1,
jsonPayload);
Apply(teamUserApprovedEvent);
}
public void PostComment(Comment comment)
{
CheckIfCreated();
CheckIfDeleted();
if (!comment.Author.Approved && !(comment.Author.Id == ProjectOwner.Id))
{
throw new ArgumentException("Comment author not approved to post in team chat.");
}
var payload = new { Id = comment.Id, AuthorId = comment.Author.Id, Content = comment.Content, PostedOn = comment.PostedOn };
var jsonPayload = JsonConvert.SerializeObject(payload);
var teamCommentPostedEvent = new TeamCommentPostedEvent(
Id,
Version + 1,
jsonPayload);
Apply(teamCommentPostedEvent);
}
public override void Delete()
{
CheckIfCreated();
var teamDeletedEvent = new TeamDeletedEvent(
Id,
Version + 1,
"");
Apply(teamDeletedEvent);
}
protected override void ChangeState(DomainEvent domainEvent)
{
dynamic data = JsonConvert.DeserializeObject(domainEvent.JsonPayload);
switch (domainEvent.Type)
{
case "TeamCreatedEvent":
Id = domainEvent.AggregateId;
ProjectOwner = new User((Guid)data.ProjectOwnerId);
Chat = new List<Comment>();
Users = new List<User>();
break;
case "TeamJoinedEvent":
Users.Add(new User((Guid)data.UserId));
break;
case "TeamLeftEvent":
Users.Remove(Users.SingleOrDefault(u => u.Id == (Guid)data.UserId));
break;
case "TeamUserApprovedEvent":
var user = Users.FirstOrDefault(u => u.Id == (Guid)data.UserId);
user.Approve();
break;
case "TeamCommentPostedEvent":
var comment = new Comment((Guid)data.Id, new User((Guid)data.AuthorId), (string)data.Content, (DateTime)data.PostedOn);
Chat.Add(comment);
break;
case "TeamDeletedEvent":
Deleted = true;
break;
default:
throw new Exception("Unknown event");
}
}
private void CheckIfCreated()
{
if (!IsCreated())
{
throw new InvalidOperationException("Team not created");
}
}
private void CheckIfDeleted()
{
if (!Deleted)
{
throw new InvalidOperationException("Team not created");
}
}
}
}
| 28.795455 | 139 | 0.510063 | [
"MIT"
] | radu-solca/Venture | Venture.TeamWrite/Venture.TeamWrite.Domain/Team.cs | 5,070 | C# |
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
namespace EventStore.UriTemplate {
// Thin wrapper around formatted string; use type system to help ensure we
// are doing canonicalization right/consistently - the literal sections are held in an
// un-escaped format
// We are assuming that the string will be always built as Lit{Var}Lit[{Var}Lit[{Var}Lit[...]]],
// when the first and last literals may be empty
internal class UriTemplateCompoundPathSegment : UriTemplatePathSegment, IComparable<UriTemplateCompoundPathSegment> {
private readonly string _firstLiteral;
private readonly List<VarAndLitPair> _varLitPairs;
private CompoundSegmentClass _csClass;
private UriTemplateCompoundPathSegment(string originalSegment, bool endsWithSlash, string firstLiteral)
: base(originalSegment, UriTemplatePartType.Compound, endsWithSlash) {
_firstLiteral = firstLiteral;
_varLitPairs = new List<VarAndLitPair>();
}
public static new UriTemplateCompoundPathSegment CreateFromUriTemplate(string segment, UriTemplate template) {
var origSegment = segment;
var endsWithSlash = segment.EndsWith("/", StringComparison.Ordinal);
if (endsWithSlash) {
segment = segment.Remove(segment.Length - 1);
}
var nextVarStart = segment.IndexOf("{", StringComparison.Ordinal);
Ensure.Nonnegative(nextVarStart,
"The method is only called after identifying a '{' character in the segment");
var firstLiteral = ((nextVarStart > 0) ? segment.Substring(0, nextVarStart) : string.Empty);
if (firstLiteral.IndexOf(UriTemplate.WildcardPath, StringComparison.Ordinal) != -1) {
throw new FormatException($"UTInvalidWildcardInVariableOrLiteral {template.OriginalTemplate} {UriTemplate.WildcardPath}");
}
var result = new UriTemplateCompoundPathSegment(origSegment, endsWithSlash,
((firstLiteral != string.Empty) ? Uri.UnescapeDataString(firstLiteral) : string.Empty));
do {
var nextVarEnd = segment.IndexOf("}", nextVarStart + 1, StringComparison.Ordinal);
if (nextVarEnd < nextVarStart + 2) {
throw new FormatException($"UTInvalidFormatSegmentOrQueryPart {segment}");
}
bool hasDefault;
var varName = template.AddPathVariable(UriTemplatePartType.Compound,
segment.Substring(nextVarStart + 1, nextVarEnd - nextVarStart - 1), out hasDefault);
if (hasDefault) {
throw new InvalidOperationException(
$"UTDefaultValueToCompoundSegmentVar template:{template},origSegment:{origSegment},varName:{varName}");
}
nextVarStart = segment.IndexOf("{", nextVarEnd + 1, StringComparison.Ordinal);
string literal;
if (nextVarStart > 0) {
if (nextVarStart == nextVarEnd + 1) {
throw new ArgumentException($"UTDoesNotSupportAdjacentVarsInCompoundSegment template:{template},segment:{segment}");
}
literal = segment.Substring(nextVarEnd + 1, nextVarStart - nextVarEnd - 1);
} else if (nextVarEnd + 1 < segment.Length) {
literal = segment.Substring(nextVarEnd + 1);
} else {
literal = string.Empty;
}
if (literal.IndexOf(UriTemplate.WildcardPath, StringComparison.Ordinal) != -1) {
throw new FormatException($"UTInvalidWildcardInVariableOrLiteral {template.OriginalTemplate} {UriTemplate.WildcardPath}");
}
if (literal.IndexOf('}') != -1) {
throw new FormatException($"UTInvalidFormatSegmentOrQueryPart {segment}");
}
result._varLitPairs.Add(new VarAndLitPair(varName, ((literal == string.Empty) ? string.Empty : Uri.UnescapeDataString(literal))));
} while (nextVarStart > 0);
if (string.IsNullOrEmpty(result._firstLiteral)) {
if (string.IsNullOrEmpty(result._varLitPairs[result._varLitPairs.Count - 1].Literal)) {
result._csClass = CompoundSegmentClass.HasNoPrefixNorSuffix;
} else {
result._csClass = CompoundSegmentClass.HasOnlySuffix;
}
} else {
if (string.IsNullOrEmpty(result._varLitPairs[result._varLitPairs.Count - 1].Literal)) {
result._csClass = CompoundSegmentClass.HasOnlyPrefix;
} else {
result._csClass = CompoundSegmentClass.HasPrefixAndSuffix;
}
}
return result;
}
public override void Bind(string[] values, ref int valueIndex, StringBuilder path) {
if (valueIndex + _varLitPairs.Count <= values.Length == false)
throw new Exception("Not enough values to bind");
path.Append(_firstLiteral);
for (var pairIndex = 0; pairIndex < _varLitPairs.Count; pairIndex++) {
path.Append(values[valueIndex++]);
path.Append(_varLitPairs[pairIndex].Literal);
}
if (EndsWithSlash) {
path.Append("/");
}
}
public override bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash) {
Ensure.NotNull(other, "why would we ever call this?");
//if (other == null) {
// Fx.Assert("why would we ever call this?");
// return false;
//}
if (!ignoreTrailingSlash && (EndsWithSlash != other.EndsWithSlash)) {
return false;
}
var otherAsCompound = other as UriTemplateCompoundPathSegment;
if (otherAsCompound == null) {
// if other can't be cast as a compound then it can't be equivalent
return false;
}
if (_varLitPairs.Count != otherAsCompound._varLitPairs.Count) {
return false;
}
if (StringComparer.OrdinalIgnoreCase.Compare(_firstLiteral, otherAsCompound._firstLiteral) != 0) {
return false;
}
for (var pairIndex = 0; pairIndex < _varLitPairs.Count; pairIndex++) {
if (StringComparer.OrdinalIgnoreCase.Compare(_varLitPairs[pairIndex].Literal,
otherAsCompound._varLitPairs[pairIndex].Literal) != 0) {
return false;
}
}
return true;
}
public override bool IsMatch(UriTemplateLiteralPathSegment segment, bool ignoreTrailingSlash) {
if (!ignoreTrailingSlash && (EndsWithSlash != segment.EndsWithSlash)) {
return false;
}
return TryLookup(segment.AsUnescapedString(), null);
}
public override void Lookup(string segment, NameValueCollection boundParameters) {
if (!TryLookup(segment, boundParameters)) {
//Fx.Assert("How can that be? Lookup is expected to be called after IsMatch");
throw new InvalidOperationException("UTCSRLookupBeforeMatch How can that be? Lookup is expected to be called after IsMatch");
}
}
private bool TryLookup(string segment, NameValueCollection boundParameters) {
var segmentPosition = 0;
if (!string.IsNullOrEmpty(_firstLiteral)) {
if (segment.StartsWith(_firstLiteral, StringComparison.Ordinal)) {
segmentPosition = _firstLiteral.Length;
} else {
return false;
}
}
for (var pairIndex = 0; pairIndex < _varLitPairs.Count - 1; pairIndex++) {
var nextLiteralPosition = segment.IndexOf(_varLitPairs[pairIndex].Literal, segmentPosition, StringComparison.Ordinal);
if (nextLiteralPosition < segmentPosition + 1) {
return false;
}
if (boundParameters != null) {
var varValue = segment.Substring(segmentPosition, nextLiteralPosition - segmentPosition);
boundParameters.Add(_varLitPairs[pairIndex].VarName, varValue);
}
segmentPosition = nextLiteralPosition + _varLitPairs[pairIndex].Literal.Length;
}
if (segmentPosition < segment.Length) {
if (string.IsNullOrEmpty(_varLitPairs[_varLitPairs.Count - 1].Literal)) {
if (boundParameters != null) {
boundParameters.Add(_varLitPairs[_varLitPairs.Count - 1].VarName,
segment.Substring(segmentPosition));
}
return true;
} else if ((segmentPosition + _varLitPairs[_varLitPairs.Count - 1].Literal.Length < segment.Length) &&
segment.EndsWith(_varLitPairs[_varLitPairs.Count - 1].Literal, StringComparison.Ordinal)) {
if (boundParameters != null) {
boundParameters.Add(_varLitPairs[_varLitPairs.Count - 1].VarName,
segment.Substring(segmentPosition, segment.Length - segmentPosition - _varLitPairs[_varLitPairs.Count - 1].Literal.Length));
}
return true;
} else {
return false;
}
} else {
return false;
}
}
// A note about comparing compound segments:
// We are using this for generating the sorted collections at the nodes of the UriTemplateTrieNode.
// The idea is that we are sorting the segments based on preferred matching, when we have two
// compound segments matching the same wire segment, we will give preference to the preceding one.
// The order is based on the following concepts:
// - We are defining four classes of compound segments: prefix+suffix, prefix-only, suffix-only
// and none
// - Whenever we are comparing segments from different class the preferred one is the segment with
// the prefared class, based on the order we defined them (p+s \ p \ s \ n).
// - Within each class the preference is based on the prefix\suffix, while prefix has precedence
// over suffix if both exists.
// - If after comparing the class, as well as the prefix\suffix, we didn't reach to a conclusion,
// the preference is given to the segment with more variables parts.
// This order mostly follows the intuitive common sense; the major issue comes from preferring the
// prefix over the suffix in the case where both exist. This is derived from the problematic of any
// other type of solution that don't prefere the prefix over the suffix or vice versa. To better
// understanding lets considered the following example:
// In comparing 'foo{x}bar' and 'food{x}ar', unless we are preferring prefix or suffix, we have
// to state that they have the same order. So is the case with 'foo{x}babar' and 'food{x}ar', which
// will lead us to claiming the 'foo{x}bar' and 'foo{x}babar' are from the same order, which they
// clearly are not.
// Taking other approaches to this problem results in similar cases. The only solution is preferring
// either the prefix or the suffix over the other; since we already preferred prefix over suffix
// implicitly (we preferred the prefix only class over the suffix only, we also prefared literal
// over variable, if in the same path segment) that still maintain consistency.
// Therefore:
// - 'food{var}' should be before 'foo{var}'; '{x}.{y}.{z}' should be before '{x}.{y}'.
// - the order between '{var}bar' and '{var}qux' is not important
// - '{x}.{y}' and '{x}_{y}' should have the same order
// - 'foo{x}bar' is less preferred than 'food{x}ar'
// In the above third case - if we are opening the table with allowDuplicate=false, we will throw;
// if we are opening it with allowDuplicate=true we will let it go and might match both templates
// for certain wire candidates.
int IComparable<UriTemplateCompoundPathSegment>.CompareTo(UriTemplateCompoundPathSegment other) {
Ensure.NotNull(other, "We are only expected to get here for comparing real compound segments");
switch (_csClass) {
case CompoundSegmentClass.HasPrefixAndSuffix:
switch (other._csClass) {
case CompoundSegmentClass.HasPrefixAndSuffix:
return CompareToOtherThatHasPrefixAndSuffix(other);
case CompoundSegmentClass.HasOnlyPrefix:
case CompoundSegmentClass.HasOnlySuffix:
case CompoundSegmentClass.HasNoPrefixNorSuffix:
return -1;
default:
throw new Exception("Invalid other.CompoundSegmentClass");
}
case CompoundSegmentClass.HasOnlyPrefix:
switch (other._csClass) {
case CompoundSegmentClass.HasPrefixAndSuffix:
return 1;
case CompoundSegmentClass.HasOnlyPrefix:
return CompareToOtherThatHasOnlyPrefix(other);
case CompoundSegmentClass.HasOnlySuffix:
case CompoundSegmentClass.HasNoPrefixNorSuffix:
return -1;
default:
throw new Exception("Invalid other.CompoundSegmentClass");
}
case CompoundSegmentClass.HasOnlySuffix:
switch (other._csClass) {
case CompoundSegmentClass.HasPrefixAndSuffix:
case CompoundSegmentClass.HasOnlyPrefix:
return 1;
case CompoundSegmentClass.HasOnlySuffix:
return CompareToOtherThatHasOnlySuffix(other);
case CompoundSegmentClass.HasNoPrefixNorSuffix:
return -1;
default:
throw new Exception("Invalid other.CompoundSegmentClass");
}
case CompoundSegmentClass.HasNoPrefixNorSuffix:
switch (other._csClass) {
case CompoundSegmentClass.HasPrefixAndSuffix:
case CompoundSegmentClass.HasOnlyPrefix:
case CompoundSegmentClass.HasOnlySuffix:
return 1;
case CompoundSegmentClass.HasNoPrefixNorSuffix:
return CompareToOtherThatHasNoPrefixNorSuffix(other);
default:
throw new Exception("Invalid other.CompoundSegmentClass");
}
default:
throw new Exception("Invalid this.CompoundSegmentClass");
}
}
private int CompareToOtherThatHasPrefixAndSuffix(UriTemplateCompoundPathSegment other) {
if (_csClass == CompoundSegmentClass.HasPrefixAndSuffix == false)
throw new Exception("Otherwise, how did we got here?");
if (other._csClass == CompoundSegmentClass.HasPrefixAndSuffix == false)
throw new Exception("Otherwise, how did we got here?");
// In this case we are determining the order based on the prefix of the two segments,
// then by their suffix and then based on the number of variables
var prefixOrder = ComparePrefixToOtherPrefix(other);
if (prefixOrder == 0) {
var suffixOrder = CompareSuffixToOtherSuffix(other);
if (suffixOrder == 0) {
return (other._varLitPairs.Count - _varLitPairs.Count);
} else {
return suffixOrder;
}
} else {
return prefixOrder;
}
}
private int CompareToOtherThatHasOnlyPrefix(UriTemplateCompoundPathSegment other) {
if (_csClass == CompoundSegmentClass.HasOnlyPrefix == false)
throw new Exception("Otherwise, how did we got here?");
if (other._csClass == CompoundSegmentClass.HasOnlyPrefix == false)
throw new Exception("Otherwise, how did we got here?");
// In this case we are determining the order based on the prefix of the two segments,
// then based on the number of variables
var prefixOrder = ComparePrefixToOtherPrefix(other);
if (prefixOrder == 0) {
return (other._varLitPairs.Count - _varLitPairs.Count);
} else {
return prefixOrder;
}
}
private int CompareToOtherThatHasOnlySuffix(UriTemplateCompoundPathSegment other) {
if (_csClass == CompoundSegmentClass.HasOnlySuffix == false)
throw new Exception("Otherwise, how did we got here?");
if (other._csClass == CompoundSegmentClass.HasOnlySuffix == false)
throw new Exception("Otherwise, how did we got here?");
// In this case we are determining the order based on the suffix of the two segments,
// then based on the number of variables
var suffixOrder = CompareSuffixToOtherSuffix(other);
if (suffixOrder == 0) {
return (other._varLitPairs.Count - _varLitPairs.Count);
} else {
return suffixOrder;
}
}
private int CompareToOtherThatHasNoPrefixNorSuffix(UriTemplateCompoundPathSegment other) {
if (_csClass == CompoundSegmentClass.HasNoPrefixNorSuffix == false)
throw new Exception("Otherwise, how did we got here?");
if (other._csClass == CompoundSegmentClass.HasNoPrefixNorSuffix == false)
throw new Exception("Otherwise, how did we got here?");
// In this case the order is determined by the number of variables
return (other._varLitPairs.Count - _varLitPairs.Count);
}
private int ComparePrefixToOtherPrefix(UriTemplateCompoundPathSegment other) {
return string.Compare(other._firstLiteral, _firstLiteral, StringComparison.OrdinalIgnoreCase);
}
private int CompareSuffixToOtherSuffix(UriTemplateCompoundPathSegment other) {
var reversedSuffix = ReverseString(_varLitPairs[_varLitPairs.Count - 1].Literal);
var reversedOtherSuffix = ReverseString(other._varLitPairs[other._varLitPairs.Count - 1].Literal);
return string.Compare(reversedOtherSuffix, reversedSuffix, StringComparison.OrdinalIgnoreCase);
}
private static string ReverseString(string stringToReverse) {
var reversedString = new char[stringToReverse.Length];
for (var i = 0; i < stringToReverse.Length; i++) {
reversedString[i] = stringToReverse[stringToReverse.Length - i - 1];
}
return new string(reversedString);
}
private enum CompoundSegmentClass {
Undefined,
HasPrefixAndSuffix,
HasOnlyPrefix,
HasOnlySuffix,
HasNoPrefixNorSuffix
}
private struct VarAndLitPair {
private readonly string _literal;
private readonly string _varName;
public VarAndLitPair(string varName, string literal) {
_varName = varName;
_literal = literal;
}
public string Literal {
get {
return _literal;
}
}
public string VarName {
get {
return _varName;
}
}
}
}
}
| 42.180905 | 134 | 0.724148 | [
"Apache-2.0",
"CC0-1.0"
] | riccardone/EventStoreCore | src/EventStore.UriTemplate/UriTemplateCompoundPathSegment.cs | 16,790 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.