text
stringlengths
13
6.01M
using System; using System.Windows.Input; namespace Demo.Commands { public sealed class DelegateCommand : ICommand { private readonly Action<Object> _executed; private readonly Func<Object, Boolean> _canExecute; public DelegateCommand(Action<Object> executed) : this(executed, null) { } public DelegateCommand(Action<Object> executed, Func<Object, Boolean> canExecute) { _executed = executed; _canExecute = canExecute; } public Boolean CanExecute(Object parameter) { return _canExecute == null || _canExecute(parameter); } public void Execute(Object parameter) { _executed(parameter); } public void RaiseCanExecuteChanged() { CanExecuteChanged?.Invoke(this, EventArgs.Empty); } public event EventHandler CanExecuteChanged; } }
namespace EventsTimers { using System; /// <summary> /// Read in MSDN about the keyword event in C# and how to publish events. /// Re-implement the above using .NET events and following the best practices. /// </summary> class Test { static void Main(string[] args) { Timer timer = new Timer(1); // Subscribe to event timer.ElapsedSeconds += new Timer.Callback(() => Console.WriteLine(DateTime.Now) ); timer.Start(); } } }
using FlappyBirds.Utils; using System; using System.Data; using System.Linq; using System.Windows.Forms; namespace FlappyBirds { public partial class Scores : Form { public Scores() { InitializeComponent(); } public void SetScores() { var items = ScoreUtils.ReadTopScores() .Select(item => new ListViewItem(item.ToString())) .ToArray(); ListScores.Items.AddRange(items); } private void Scores_SelectedIndexChanged(object sender, EventArgs e) { } } }
using System.Web.Mvc; using ZiZhuJY.Web.UI.Attributes; namespace ZiZhuJY.Web.UI.Controllers { [Localization] public class GraphWorldController : Controller { // // GET: /GraphWorld/ public ActionResult Index() { return View(); } } }
using System; using System.Collections.Generic; namespace CalcGUI { class Operations { // class contains all mathematical operation-related functions public static string getFinalAns(List<string> input) { // loop through final formatted list // pass numbers and operator into calculate function List<string> formattedList = ProcessInput.formatInput(input); for (int i = 0; i < formattedList.Count; i++) { if (formattedList[i].Equals("^")) { formattedList = calculate(formattedList, i); --i; } } for (int i = 0; i < formattedList.Count; i++) { if (CheckInput.timesDivOrMod(formattedList[i])) { formattedList = calculate(formattedList, i); --i; } } for (int i = 0; i < formattedList.Count; i++) { if (CheckInput.plusOrMinus(formattedList[i])) { formattedList = calculate(formattedList, i); --i; } } return "" + double.Parse(formattedList[0]); } private static List<string> calculate(List<string> formattedList, int i) { // perform mathematical operation based on sign / calculate answers double prevNum = double.Parse(formattedList[i - 1]); double nextNum = double.Parse(formattedList[i + 1]); switch (formattedList[i]) { case "^": formattedList[i] = pow(prevNum, nextNum); break; case "x": formattedList[i] = multiply(prevNum, nextNum); break; case "/": formattedList[i] = divide(prevNum, nextNum); break; case "%": formattedList[i] = mod(prevNum, nextNum); break; case "+": formattedList[i] = add(prevNum, nextNum); break; case "-": formattedList[i] = subtract(prevNum, nextNum); break; } formattedList[i - 1] = ""; formattedList[i + 1] = ""; formattedList.RemoveAll(string.IsNullOrEmpty); return formattedList; } private static string add(double number1, double number2) { double sum = number1 + number2; return "" + sum; } private static string subtract(double number1, double number2) { double difference = number1 - number2; return "" + difference; } private static string multiply(double number1, double number2) { double product = number1 * number2; return "" + product; } private static string divide(double number1, double number2) { double quotient = number1 / number2; return "" + quotient; } private static string mod(double number1, double number2) { double remainder = number1 % number2; return "" + remainder; } private static string pow(double number1, double number2) { double result = Math.Pow(number1, number2); return "" + result; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class MainMenuManager : MonoBehaviour { public void StartButton () { SceneManager.LoadScene("Game"); } public void AboutButton () { SceneManager.LoadScene("About"); } public void BackButton () { SceneManager.LoadScene("MainMenu"); } }
namespace Bindable.Linq.Tests.Unit.Aggregators { internal class AverageAggregatorTests {} }
using Dynamia.BillingSystem.BusinessManager; using System.Collections.Generic; namespace Dynamia.BillingSystem.SQLDAO { /// <summary> /// Class facade of data access objects. /// </summary> /// <!--Modificado por: Daniel G. Merchan B.--> /// <!--Modificado el: 04:31 p.m. 06/08/2014.--> public class DAOFacade { #region Fields private DAOBilling daoSalesForce; private DAOAsset daoAsset; private DAOQuote daoQuote; private DAOLogs daoLog; private DAOBillingConfiguration daoBillingConfiguration; #endregion #region Methods /// <summary> /// Responsible method make the call to the stored procedure /// with billing information depending on the business unit. /// </summary> /// <param name="limitDay">Date for the first quota.</param> /// <param name="businessUnits">List of business units that are billed</param> public List<BOBilling> GetBillingInformation(string contract) { daoSalesForce = new DAOBilling(); return daoSalesForce.GetBillingInformation(contract); } /// <summary> /// Responsible method make the call to the stored procedure /// with billing information depending on the business unit. /// </summary> /// <param name="limitDay">Date for the first quota.</param> /// <param name="businessUnits">List of business units that are billed</param> public List<BOBilling> GetBillingInformation(string limitDay, List<BOBillingConfiguration> boBillingConfigurationList) { daoSalesForce = new DAOBilling(); return daoSalesForce.GetBillingInformation(limitDay, boBillingConfigurationList); } public List<BOBilling> GetAnnulationBillingInformation(string limitDay) { daoSalesForce = new DAOBilling(); return daoSalesForce.GetAnnulationBillingInformation(limitDay); } public List<BOAsset> GetAssetInformation(string limitDay, string billingDataId, BOBillingConfiguration boBillingConfiguration) { daoAsset = new DAOAsset(); return daoAsset.GetAssetsInformation(limitDay, billingDataId, boBillingConfiguration); } public List<BOAsset> GetAssetsAnulationInformation(string limitDay, string billingDataId) { daoAsset = new DAOAsset(); return daoAsset.GetAssetsAnulationInformation(limitDay, billingDataId); } public void UpdateBillingData(BOBilling billingData, BOAsset asset, BOQuote quote) { daoSalesForce = new DAOBilling(); daoSalesForce.UpdateBillingData(billingData, asset, quote); } public void AnnulateQuote(BOBilling billingData, BOQuote quote) { daoSalesForce = new DAOBilling(); daoSalesForce.AnnulateQuote(billingData, quote); } public void UpdateAsset(BOAsset asset) { daoAsset = new DAOAsset(); daoAsset.UpdateAsset(asset); } public void UpdateQuote(BOQuote quote) { daoQuote = new DAOQuote(); daoQuote.UpdateQuote(quote); } public void UpdateLog(BOBilling billingData, BOAsset assetData, BOQuote quoteData) { daoLog = new DAOLogs(); daoLog.UpdateLog(billingData, assetData, quoteData); } public void InsertErrorLog(string message) { daoLog = new DAOLogs(); daoLog.InsertErrorLog(message); } public List<BOBillingConfiguration> GetAllBillingConfiguration() { daoBillingConfiguration = new DAOBillingConfiguration(); return daoBillingConfiguration.GetAllBillingConfiguration(); } public BOBillingConfiguration GetBillingConfigurationByBusinessUnit(string businessUnit) { daoBillingConfiguration = new DAOBillingConfiguration(); return daoBillingConfiguration.GetBillingConfigurationByBusinessUnit(businessUnit); } public BOBillingConfiguration GetBillingConfigurationByContract(string contract) { daoBillingConfiguration = new DAOBillingConfiguration(); return daoBillingConfiguration.GetBillingConfigurationByContract(contract); } #endregion } }
namespace Braspag.Domain.Interfaces.UnityOfWork { public interface IUnitiOfWork { } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Collections.Concurrent; using System.ComponentModel.Composition; using System.Diagnostics; using System.Threading.Tasks; using Microsoft.Common.Core; using Microsoft.Common.Core.Shell; using Microsoft.Common.Core.Threading; using Microsoft.R.Support.Help.Definitions; namespace Microsoft.R.Support.Help.Functions { /// <summary> /// Contains index of function to package improving /// performance of locating package that contains /// the function documentation. /// </summary> [Export(typeof(IFunctionIndex))] public partial class FunctionIndex { private readonly ICoreShell _shell; private readonly BinaryAsyncLock _buildIndexLock; [ImportingConstructor] public FunctionIndex(ICoreShell shell) { _shell = shell; _buildIndexLock = new BinaryAsyncLock(); } public void BuildIndexForPackage(IPackageInfo package) { foreach (INamedItemInfo f in package.Functions) { AddFunctionToPackage(package.Name, f); } } public async Task BuildIndexAsync() { var indexIsBuilt = await _buildIndexLock.WaitAsync(); if (!indexIsBuilt) { try { await TaskUtilities.SwitchToBackgroundThread(); var startIndexBuild = DateTime.Now; BuildIndex(); Debug.WriteLine("R functions index build time: {0} ms", (DateTime.Now - startIndexBuild).TotalMilliseconds); } finally { _buildIndexLock.Release(); } } } private void BuildIndex() { var packageIndex = _shell.ExportProvider.GetExportedValue<IPackageIndex>(); var packages = packageIndex.Packages; foreach (var p in packages) { BuildIndexForPackage(p); } } private void AddFunctionToPackage(string packageName, INamedItemInfo function) { BlockingCollection<INamedItemInfo> funcs; if (!_packageToFunctionsMap.TryGetValue(packageName, out funcs)) { funcs = new BlockingCollection<INamedItemInfo>(); _packageToFunctionsMap[packageName] = funcs; } _functionToPackageMap[function.Name] = packageName; funcs.Add(function); } } }
using System; using System.Collections.Generic; using System.Text; namespace AgentStoryComponents { public class UserExistsException : Exception { public UserExistsException(string msg) : base(msg) {} } public class UserMayNotClone : Exception { public UserMayNotClone(string msg) : base(msg) { } } public class InvalidGroupActionException : Exception { public InvalidGroupActionException(string msg) : base(msg) {} } public class InsufficientPermissionsException : Exception { public InsufficientPermissionsException(string msg) : base(msg) {} } public class MessageNotSentException : Exception { public MessageNotSentException(string msg) : base(msg) { } } public class ServiceTimeoutException : Exception { public ServiceTimeoutException(string msg) : base(msg) { } } public class UnableToDeleteUserException : Exception { public UnableToDeleteUserException(string msg) : base(msg) { } } public class CommandExecuteException : Exception { public CommandExecuteException(string msg) : base(msg) { } } public class PossibleHackException : Exception { public PossibleHackException(string msg) : base(msg) { } } public class InvitationDoesNotExistException : Exception { public InvitationDoesNotExistException(string msg) : base(msg) {} } public class UserDoesNotExistException : Exception { public UserDoesNotExistException(string msg) : base(msg) {} } public class GroupDoesNotExistException : Exception { public GroupDoesNotExistException(string msg) : base(msg) { } } public class GroupExistsException : Exception { public GroupExistsException(string msg) : base(msg) { } } public class CommandDoesNotExistException : Exception { public CommandDoesNotExistException(string msg) : base(msg) { } } public class ParameterNotFoundException : Exception { public ParameterNotFoundException(string msg) : base(msg) { } } public class ParameterNotNumberException : Exception { public ParameterNotNumberException(string msg) : base(msg) { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Collections; public class PacketUtil { public static void WriteByte(List<byte> buffer, byte v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteSbyte(List<byte> buffer, sbyte v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteUshort(List<byte> buffer, ushort v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteShort(List<byte> buffer, short v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteUint(List<byte> buffer, uint v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteInt(List<byte> buffer, int v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteUlong(List<byte> buffer, ulong v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteLong(List<byte> buffer, long v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteFloat(List<byte> buffer, float v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteDouble(List<byte> buffer, double v) { byte[] bytes = TypeConvert.GetBytes(v); buffer.AddRange(bytes); } public static void WriteString(List<byte> buffer, string val) { if (string.IsNullOrEmpty(val)) { ushort length = 0; buffer.AddRange(TypeConvert.GetBytes(length)); } else { byte[] bytes = Encoding.UTF8.GetBytes(val); ushort length = (ushort)bytes.GetLength(0); buffer.AddRange(TypeConvert.GetBytes(length)); buffer.AddRange(bytes); } } public static byte ReadByte(byte[] bytes) { return (byte)TypeConvert.GetByte(bytes); } public static sbyte ReadSbyte(byte[] bytes) { return (sbyte)TypeConvert.GetSbyte(bytes); } public static ushort ReadUshort(byte[] bytes) { return (ushort)TypeConvert.GetUshort(bytes); } public static short ReadShort(byte[] bytes) { return (short)TypeConvert.GetShort(bytes); } public static uint ReadUint(byte[] bytes) { return (uint)TypeConvert.GetUint(bytes); } public static int ReadInt(byte[] bytes) { return (int)TypeConvert.GetInt(bytes); } public static ulong ReadUlong(byte[] bytes) { return (ulong)TypeConvert.GetUlong(bytes); } public static long ReadLong(byte[] bytes) { return (long)TypeConvert.GetLong(bytes); } public static float ReadFloat(byte[] bytes) { return (float)TypeConvert.GetFloat(bytes); } public static double ReadDouble(byte[] bytes) { return (double)TypeConvert.GetDouble(bytes); } public static string ReadString(byte[] bytes) { return Encoding.UTF8.GetString(bytes); } }
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Text; namespace FirstWebApp.Data { public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } public string Name { get; set; } public DbSet<Smartphone> Smartphones { get; set; } public DbSet<Battery> Battery { get; set; } public DbSet<Body> Body { get; set; } public DbSet<Connect> Connect { get; set; } public DbSet<Display> Display { get; set; } public DbSet<Features> Features { get; set; } public DbSet<Date> Date { get; set; } public DbSet<MainCamera> MainCamera { get; set; } public DbSet<Memory> Memory { get; set; } public DbSet<View> View { get; set; } public DbSet<Network> Network { get; set; } public DbSet<Hardware> Hardware { get; set; } public DbSet<SelfieCamera> SelfieCamera { get; set; } public DbSet<Sound> Sound { get; set; } public DbSet<Image> Image { get; set; } public DbSet<ContactMessages> ContactMessages { get; set; } } }
using System; using System.Collections.Generic; using System.Text; namespace Chess2_redo { class Pawn : Piece { string direction; bool firstmove = true; Piece[,] temp_b; public Pawn(string newName, int one, int two, string clr) { this.Id = newName; this.x = one; this.y = two; this.color = clr; if (firstmove && this.y == 1) { this.direction = "up"; } else if (firstmove && this.y == 6) { this.direction = "down"; } } public override bool checkMove(int newx, int newy) { temp_b = Program.game.board.game_board; int abs_v = Math.Abs(newy - this.y); if (newx == x && newy > y && direction == "up" && newy > this.y) { if (abs_v == 2 && firstmove && temp_b[newx, newy] == null && temp_b[x,y+1]== null) { firstmove = false; return true; } else if (abs_v == 1 && temp_b[newx, newy] == null) { if (firstmove) firstmove = false; return true; } return false; } else if (newx == x && newy < y && direction == "down" && newy < this.y) { if (abs_v == 2 && firstmove && temp_b[newx, newy] == null && temp_b[x, y - 1] == null) { firstmove = false; return true; } else if (abs_v == 1 && temp_b[newx, newy] == null) { if (firstmove) firstmove = false; return true; } return false; } // these codes are for checking if pawn is caping a enemy piece // might need to make this shorter in the future //SE else if (newx == x + 1 && newy == y - 1 && direction == "down") { return pawnCheckCap(newx, newy); } //SW else if (newx == x - 1 && newy == y-1 && direction == "down") { return pawnCheckCap(newx, newy); } //NE else if (newx == x + 1 && newy == y + 1 && direction == "up") { return pawnCheckCap(newx, newy); } //NW else if (newx == x - 1 && newy == y + 1 && direction == "up") { return pawnCheckCap(newx, newy); } return false; } public bool pawnCheckCap(int newx, int newy) { if (temp_b[newx, newy] != null && temp_b[newx, newy].color != this.color) { return true; } return false; } } } //this has many issues IE pawns firstmove will be falsed if checkMove of King returns ture for moving 2space //!!! remember that pawn cant move two space after first move is caping
using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; public class Abilities : MonoBehaviour { public Renderer groundRenderer; public Collider groundCollider; public GameObject[] ParticleExamples; public int exampleIndex; public List<GameObject> onScreenParticles = new List<GameObject>(); void Awake() { List<GameObject> particleExampleList = new List<GameObject>(); int nbChild = this.transform.childCount; for (int i = 0; i < nbChild; i++) { GameObject child = this.transform.GetChild(i).gameObject; particleExampleList.Add(child); } particleExampleList.Sort(delegate (GameObject o1, GameObject o2) { return o1.name.CompareTo(o2.name); }); ParticleExamples = particleExampleList.ToArray(); StartCoroutine("CheckForDeletedParticles"); } void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit = new RaycastHit(); if (groundCollider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 9999f)) { GameObject particle = spawnParticle(); particle.transform.position = hit.point + particle.transform.position; } } } public void OnPreviousEffect() { prevParticle(); } public void OnNextEffect() { nextParticle(); } private GameObject spawnParticle() { GameObject particles = (GameObject)Instantiate(ParticleExamples[exampleIndex]); particles.transform.position = new Vector3(0, particles.transform.position.y, 0); particles.SetActive(true); ParticleSystem ps = particles.GetComponent<ParticleSystem>(); if (ps != null) { var main = ps.main; if (main.loop) { ps.gameObject.AddComponent<CFX_AutoStopLoopedEffect>(); ps.gameObject.AddComponent<CFX_AutoDestructShuriken>(); } } onScreenParticles.Add(particles); return particles; } IEnumerator CheckForDeletedParticles() { while (true) { yield return new WaitForSeconds(5.0f); for (int i = onScreenParticles.Count - 1; i >= 0; i--) { if (onScreenParticles[i] == null) { onScreenParticles.RemoveAt(i); } } } } private void prevParticle() { exampleIndex--; if (exampleIndex < 0) exampleIndex = ParticleExamples.Length - 1; } private void nextParticle() { exampleIndex++; if (exampleIndex >= ParticleExamples.Length) exampleIndex = 0; } private void destroyParticles() { for (int i = onScreenParticles.Count - 1; i >= 0; i--) { if (onScreenParticles[i] != null) { GameObject.Destroy(onScreenParticles[i]); } onScreenParticles.RemoveAt(i); } } }
using System; using MXDbhelper.Common; namespace MXQHLibrary { [TableView("Sys_EntityProperty")] public class EntityProperty { /// <summary> /// 实体名 /// </summary> [ColumnProperty(Key.True)] public string EntityName { get; set; } /// <summary> /// 栏位名 /// </summary> [ColumnProperty(Key.True)] public string ColumnName { get; set; } /// <summary> /// 栏位属性 0-属性, 1-类, 2-列表类 /// </summary> public int? ColumnType { get; set; } /// <summary> /// 实体关联方式 - INNER JOIN, LEFT JOIN, RIGHT JOIN /// </summary> public string RelationType { get; set; } /// <summary> /// 是否主键, 0-否,1-是 /// </summary> public bool IsKey { get; set; } /// <summary> /// 排序方式 NON-无,ASC-升序,降序 /// </summary> public string OrderWay { get; set; } /// <summary> /// 排序顺序 /// </summary> public int? OrderNum { get; set; } } }
#region License /* Copyright (c) 2009 - 2013 Fatjon Sakiqi 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 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 namespace Cloo { using System; using System.Diagnostics; ///<summary> ///Represents an error state that occurred while executing an OpenCL API call. ///</summary> ///<seealso cref = "ComputeErrorCode"/> public class ComputeException : ApplicationException { #region Fields [DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly ComputeErrorCode code; #endregion #region Properties ///<summary> ///Gets the <see cref = "ComputeErrorCode"/> of the <see cref = "ComputeException"/>. ///</summary> public ComputeErrorCode ComputeErrorCode { get { return code; } } #endregion #region Constructors ///<summary> ///Creates a new <see cref = "ComputeException"/> with a specified <see cref = "ComputeErrorCode"/>. ///</summary> ///<param name = "code"> A <see cref = "ComputeErrorCode"/>. </param> public ComputeException(ComputeErrorCode code) : base("OpenCL error code detected: " + code.ToString() + ".") { this.code = code; } #endregion #region Public methods ///<summary> ///Checks for an OpenCL error code and throws a <see cref = "ComputeException"/> if such is encountered. ///</summary> ///<param name = "errorCode"> The value to be checked for an OpenCL error. </param> public static void ThrowOnError(int errorCode) { ThrowOnError((ComputeErrorCode)errorCode); } ///<summary> ///Checks for an OpenCL error code and throws a <see cref = "ComputeException"/> if such is encountered. ///</summary> ///<param name = "errorCode"> The OpenCL error code. </param> public static void ThrowOnError(ComputeErrorCode errorCode) { switch (errorCode) { case ComputeErrorCode.Success: return; case ComputeErrorCode.DeviceNotFound: throw new DeviceNotFoundComputeException(); case ComputeErrorCode.DeviceNotAvailable: throw new DeviceNotAvailableComputeException(); case ComputeErrorCode.CompilerNotAvailable: throw new CompilerNotAvailableComputeException(); case ComputeErrorCode.MemoryObjectAllocationFailure: throw new MemoryObjectAllocationFailureComputeException(); case ComputeErrorCode.OutOfResources: throw new OutOfResourcesComputeException(); case ComputeErrorCode.OutOfHostMemory: throw new OutOfHostMemoryComputeException(); case ComputeErrorCode.ProfilingInfoNotAvailable: throw new ProfilingInfoNotAvailableComputeException(); case ComputeErrorCode.MemoryCopyOverlap: throw new MemoryCopyOverlapComputeException(); case ComputeErrorCode.ImageFormatMismatch: throw new ImageFormatMismatchComputeException(); case ComputeErrorCode.ImageFormatNotSupported: throw new ImageFormatNotSupportedComputeException(); case ComputeErrorCode.BuildProgramFailure: throw new BuildProgramFailureComputeException(); case ComputeErrorCode.MapFailure: throw new MapFailureComputeException(); case ComputeErrorCode.InvalidValue: throw new InvalidValueComputeException(); case ComputeErrorCode.InvalidDeviceType: throw new InvalidDeviceTypeComputeException(); case ComputeErrorCode.InvalidPlatform: throw new InvalidPlatformComputeException(); case ComputeErrorCode.InvalidDevice: throw new InvalidDeviceComputeException(); case ComputeErrorCode.InvalidContext: throw new InvalidContextComputeException(); case ComputeErrorCode.InvalidCommandQueueFlags: throw new InvalidCommandQueueFlagsComputeException(); case ComputeErrorCode.InvalidCommandQueue: throw new InvalidCommandQueueComputeException(); case ComputeErrorCode.InvalidHostPointer: throw new InvalidHostPointerComputeException(); case ComputeErrorCode.InvalidMemoryObject: throw new InvalidMemoryObjectComputeException(); case ComputeErrorCode.InvalidImageFormatDescriptor: throw new InvalidImageFormatDescriptorComputeException(); case ComputeErrorCode.InvalidImageSize: throw new InvalidImageSizeComputeException(); case ComputeErrorCode.InvalidSampler: throw new InvalidSamplerComputeException(); case ComputeErrorCode.InvalidBinary: throw new InvalidBinaryComputeException(); case ComputeErrorCode.InvalidBuildOptions: throw new InvalidBuildOptionsComputeException(); case ComputeErrorCode.InvalidProgram: throw new InvalidProgramComputeException(); case ComputeErrorCode.InvalidProgramExecutable: throw new InvalidProgramExecutableComputeException(); case ComputeErrorCode.InvalidKernelName: throw new InvalidKernelNameComputeException(); case ComputeErrorCode.InvalidKernelDefinition: throw new InvalidKernelDefinitionComputeException(); case ComputeErrorCode.InvalidKernel: throw new InvalidKernelComputeException(); case ComputeErrorCode.InvalidArgumentIndex: throw new InvalidArgumentIndexComputeException(); case ComputeErrorCode.InvalidArgumentValue: throw new InvalidArgumentValueComputeException(); case ComputeErrorCode.InvalidArgumentSize: throw new InvalidArgumentSizeComputeException(); case ComputeErrorCode.InvalidKernelArguments: throw new InvalidKernelArgumentsComputeException(); case ComputeErrorCode.InvalidWorkDimension: throw new InvalidWorkDimensionsComputeException(); case ComputeErrorCode.InvalidWorkGroupSize: throw new InvalidWorkGroupSizeComputeException(); case ComputeErrorCode.InvalidWorkItemSize: throw new InvalidWorkItemSizeComputeException(); case ComputeErrorCode.InvalidGlobalOffset: throw new InvalidGlobalOffsetComputeException(); case ComputeErrorCode.InvalidEventWaitList: throw new InvalidEventWaitListComputeException(); case ComputeErrorCode.InvalidEvent: throw new InvalidEventComputeException(); case ComputeErrorCode.InvalidOperation: throw new InvalidOperationComputeException(); case ComputeErrorCode.InvalidGLObject: throw new InvalidGLObjectComputeException(); case ComputeErrorCode.InvalidBufferSize: throw new InvalidBufferSizeComputeException(); case ComputeErrorCode.InvalidMipLevel: throw new InvalidMipLevelComputeException(); default: throw new ComputeException(errorCode); } } #endregion } #region Exception classes //Disable CS 1591 warnings (missing XML comment for publicly visible type or member). #pragma warning disable 1591 public class DeviceNotFoundComputeException : ComputeException { public DeviceNotFoundComputeException() : base(ComputeErrorCode.DeviceNotFound) { } } public class DeviceNotAvailableComputeException : ComputeException { public DeviceNotAvailableComputeException() : base(ComputeErrorCode.DeviceNotAvailable) { } } public class CompilerNotAvailableComputeException : ComputeException { public CompilerNotAvailableComputeException() : base(ComputeErrorCode.CompilerNotAvailable) { } } public class MemoryObjectAllocationFailureComputeException : ComputeException { public MemoryObjectAllocationFailureComputeException() : base(ComputeErrorCode.MemoryObjectAllocationFailure) { } } public class OutOfResourcesComputeException : ComputeException { public OutOfResourcesComputeException() : base(ComputeErrorCode.OutOfResources) { } } public class OutOfHostMemoryComputeException : ComputeException { public OutOfHostMemoryComputeException() : base(ComputeErrorCode.OutOfHostMemory) { } } public class ProfilingInfoNotAvailableComputeException : ComputeException { public ProfilingInfoNotAvailableComputeException() : base(ComputeErrorCode.ProfilingInfoNotAvailable) { } } public class MemoryCopyOverlapComputeException : ComputeException { public MemoryCopyOverlapComputeException() : base(ComputeErrorCode.MemoryCopyOverlap) { } } public class ImageFormatMismatchComputeException : ComputeException { public ImageFormatMismatchComputeException() : base(ComputeErrorCode.ImageFormatMismatch) { } } public class ImageFormatNotSupportedComputeException : ComputeException { public ImageFormatNotSupportedComputeException() : base(ComputeErrorCode.ImageFormatNotSupported) { } } public class BuildProgramFailureComputeException : ComputeException { public BuildProgramFailureComputeException() : base(ComputeErrorCode.BuildProgramFailure) { } } public class MapFailureComputeException : ComputeException { public MapFailureComputeException() : base(ComputeErrorCode.MapFailure) { } } public class InvalidValueComputeException : ComputeException { public InvalidValueComputeException() : base(ComputeErrorCode.InvalidValue) { } } public class InvalidDeviceTypeComputeException : ComputeException { public InvalidDeviceTypeComputeException() : base(ComputeErrorCode.InvalidDeviceType) { } } public class InvalidPlatformComputeException : ComputeException { public InvalidPlatformComputeException() : base(ComputeErrorCode.InvalidPlatform) { } } public class InvalidDeviceComputeException : ComputeException { public InvalidDeviceComputeException() : base(ComputeErrorCode.InvalidDevice) { } } public class InvalidContextComputeException : ComputeException { public InvalidContextComputeException() : base(ComputeErrorCode.InvalidContext) { } } public class InvalidCommandQueueFlagsComputeException : ComputeException { public InvalidCommandQueueFlagsComputeException() : base(ComputeErrorCode.InvalidCommandQueueFlags) { } } public class InvalidCommandQueueComputeException : ComputeException { public InvalidCommandQueueComputeException() : base(ComputeErrorCode.InvalidCommandQueue) { } } public class InvalidHostPointerComputeException : ComputeException { public InvalidHostPointerComputeException() : base(ComputeErrorCode.InvalidHostPointer) { } } public class InvalidMemoryObjectComputeException : ComputeException { public InvalidMemoryObjectComputeException() : base(ComputeErrorCode.InvalidMemoryObject) { } } public class InvalidImageFormatDescriptorComputeException : ComputeException { public InvalidImageFormatDescriptorComputeException() : base(ComputeErrorCode.InvalidImageFormatDescriptor) { } } public class InvalidImageSizeComputeException : ComputeException { public InvalidImageSizeComputeException() : base(ComputeErrorCode.InvalidImageSize) { } } public class InvalidSamplerComputeException : ComputeException { public InvalidSamplerComputeException() : base(ComputeErrorCode.InvalidSampler) { } } public class InvalidBinaryComputeException : ComputeException { public InvalidBinaryComputeException() : base(ComputeErrorCode.InvalidBinary) { } } public class InvalidBuildOptionsComputeException : ComputeException { public InvalidBuildOptionsComputeException() : base(ComputeErrorCode.InvalidBuildOptions) { } } public class InvalidProgramComputeException : ComputeException { public InvalidProgramComputeException() : base(ComputeErrorCode.InvalidProgram) { } } public class InvalidProgramExecutableComputeException : ComputeException { public InvalidProgramExecutableComputeException() : base(ComputeErrorCode.InvalidProgramExecutable) { } } public class InvalidKernelNameComputeException : ComputeException { public InvalidKernelNameComputeException() : base(ComputeErrorCode.InvalidKernelName) { } } public class InvalidKernelDefinitionComputeException : ComputeException { public InvalidKernelDefinitionComputeException() : base(ComputeErrorCode.InvalidKernelDefinition) { } } public class InvalidKernelComputeException : ComputeException { public InvalidKernelComputeException() : base(ComputeErrorCode.InvalidKernel) { } } public class InvalidArgumentIndexComputeException : ComputeException { public InvalidArgumentIndexComputeException() : base(ComputeErrorCode.InvalidArgumentIndex) { } } public class InvalidArgumentValueComputeException : ComputeException { public InvalidArgumentValueComputeException() : base(ComputeErrorCode.InvalidArgumentValue) { } } public class InvalidArgumentSizeComputeException : ComputeException { public InvalidArgumentSizeComputeException() : base(ComputeErrorCode.InvalidArgumentSize) { } } public class InvalidKernelArgumentsComputeException : ComputeException { public InvalidKernelArgumentsComputeException() : base(ComputeErrorCode.InvalidKernelArguments) { } } public class InvalidWorkDimensionsComputeException : ComputeException { public InvalidWorkDimensionsComputeException() : base(ComputeErrorCode.InvalidWorkDimension) { } } public class InvalidWorkGroupSizeComputeException : ComputeException { public InvalidWorkGroupSizeComputeException() : base(ComputeErrorCode.InvalidWorkGroupSize) { } } public class InvalidWorkItemSizeComputeException : ComputeException { public InvalidWorkItemSizeComputeException() : base(ComputeErrorCode.InvalidWorkItemSize) { } } public class InvalidGlobalOffsetComputeException : ComputeException { public InvalidGlobalOffsetComputeException() : base(ComputeErrorCode.InvalidGlobalOffset) { } } public class InvalidEventWaitListComputeException : ComputeException { public InvalidEventWaitListComputeException() : base(ComputeErrorCode.InvalidEventWaitList) { } } public class InvalidEventComputeException : ComputeException { public InvalidEventComputeException() : base(ComputeErrorCode.InvalidEvent) { } } public class InvalidOperationComputeException : ComputeException { public InvalidOperationComputeException() : base(ComputeErrorCode.InvalidOperation) { } } public class InvalidGLObjectComputeException : ComputeException { public InvalidGLObjectComputeException() : base(ComputeErrorCode.InvalidGLObject) { } } public class InvalidBufferSizeComputeException : ComputeException { public InvalidBufferSizeComputeException() : base(ComputeErrorCode.InvalidBufferSize) { } } public class InvalidMipLevelComputeException : ComputeException { public InvalidMipLevelComputeException() : base(ComputeErrorCode.InvalidMipLevel) { } } #endregion }
using BPiaoBao.Common.Enums; using BPiaoBao.DomesticTicket.Domain.Models.Orders.Behaviors; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BPiaoBao.DomesticTicket.Domain.Models.Orders.States { [OrderState(EnumOrderStatus.ApplyBabyFail)] public class ApplyBabyFailState:BaseOrderState { public override Type[] GetBahaviorTypes() { return new Type[] { typeof(CancelOrderBehavior), typeof(PayOrderBehavior), typeof(CancelIssueTicketBehavior), typeof(PlatformCancelTicketNotifyBehavior), typeof(PaidOrderBehavior), typeof(QueryPaidStatusBebavior), typeof(TicketsIssueBehavior), typeof(WaitReimburseWithRepelIssueBahavior) }; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class LockToBoundaries : MonoBehaviour { public GameObject myTerrain; // link from inspector or obtained via GetComponent / Object.Find //this value is used to further clamp the camera away from the edge. //Transform will not travel closer than nonPassibleBorderWidth from a terrain edge public float nonPassibleBorderWidth = 30; public float maxHeight = 1000, minHeight = 0; Vector3 mapMinBounds; Vector3 mapMaxBounds; public float heightMaxMultiplier = 5; // Use this for initialization void Start () { //calculate Terrain bounds float xsize = myTerrain.GetComponentInChildren<MeshRenderer>().bounds.size.x; float ysize = myTerrain.GetComponentInChildren<MeshRenderer>().bounds.size.y; float zsize = myTerrain.GetComponentInChildren<MeshRenderer>().bounds.size.z; int zmultiplier = 0; foreach(MeshRenderer terrainMesh in myTerrain.GetComponentsInChildren<MeshRenderer>()) { zmultiplier += 1; if (terrainMesh.bounds.size.y > ysize) ysize = terrainMesh.bounds.size.y; } zsize *= zmultiplier; var myTerrainTransform = myTerrain.transform; mapMinBounds = new Vector3(myTerrainTransform.position.x- xsize/2.0f, myTerrainTransform.position.y, myTerrainTransform.position.z- zsize / 2.0f); mapMaxBounds += mapMinBounds + new Vector3(xsize, ysize*heightMaxMultiplier, zsize); //apply any border edging spce clamping mapMinBounds.x += nonPassibleBorderWidth; mapMinBounds.z += nonPassibleBorderWidth; mapMaxBounds.x -= nonPassibleBorderWidth; mapMaxBounds.z -= nonPassibleBorderWidth; } // Update is called once per frame void Update () { Vector3 cameraTransformPosition = transform.position; if (cameraTransformPosition.x > mapMaxBounds.x) { cameraTransformPosition.x = mapMaxBounds.x; } if (cameraTransformPosition.z > mapMaxBounds.z) { cameraTransformPosition.z = mapMaxBounds.z; } if (cameraTransformPosition.x < mapMinBounds.x) { cameraTransformPosition.x = mapMinBounds.x; } if (cameraTransformPosition.z < mapMinBounds.z) { cameraTransformPosition.z = mapMinBounds.z; } if (cameraTransformPosition.y <= minHeight) { cameraTransformPosition.y = minHeight; } if (cameraTransformPosition.y >= maxHeight) { cameraTransformPosition.y = maxHeight; } transform.position = cameraTransformPosition; } }
using kolekcje; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace serializacja { public interface IConverter { void Serializuj<T>(T g,string n); T DeSerializuj<T>(string plik); } }
using MapOnlyExample.Service; using MapOnlyExample.Service.ViewModel; using System; using System.Linq; using System.Windows.Forms; namespace MapOnlyExample.WinformDemo { public partial class fmMain : Form { private UserService userService; public fmMain() { userService = new UserService(); InitializeComponent(); } private void fmMain_Load(object sender, EventArgs e) { dgUser.AutoGenerateColumns = false; dgUser.DataSource = userService.GetUserListing(string.Empty); dgUser.Refresh(); } private void btnAddnew_Click(object sender, EventArgs e) { var UserViewModel = new UserViewModel { Id = new Guid(), FirstName = txtFirstname.Text, LastName = txtLastname.Text, UserName = txtUserName.Text, Password = txtPassword.Text, RePassword = txtRePassword.Text, Address = txtAddress.Text, Birthday = dtpBirthday.Value, Email = txtEmail.Text, Gender = cbGender.Text }; if (userService.Register(UserViewModel)) { dgUser.DataSource = userService.GetUserListing(string.Empty); dgUser.Refresh(); Reset(); } else { MessageBox.Show(userService.Errors.First().Value); } } private void Reset() { txtFirstname.Text = ""; txtLastname.Text = ""; txtUserName.Text = ""; txtPassword.Text = ""; txtRePassword.Text = ""; txtAddress.Text = ""; dtpBirthday.Value = DateTime.Now; txtEmail.Text = ""; cbGender.Text = ""; } private void btnClearForm_Click(object sender, EventArgs e) { Reset(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Aroma_Violet.Models; namespace Aroma_Violet.Controllers { public class UserController : Controller { [Authorize] public ActionResult Index(string spec = "User") { var adminView = new UserViewModel(); adminView.Menu = new UserMenu(spec); return View(adminView); } } }
using System; namespace LegoMinfigures.Legs { enum Shoes { CowboyBoots, SpaceBoots, Sandals, SteelToeBoots, ShelltoeAdidas, None } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium.Firefox; using OpenQA.Selenium; using OpenQA.Selenium.Support.UI; using OpenQA.Selenium.Interactions; using System.Windows.Forms; using System.Threading; using System.Text.RegularExpressions; namespace ShoppingVisa { [TestClass] public class Visa { static IWebDriver driver; [AssemblyInitialize] public static void SetUp(TestContext context) { driver = new FirefoxDriver(); } [TestMethod] public void OrdenVisa() { driver.Navigate().GoToUrl("http://juntoz-qa.com/"); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li/div/div[2]/div/div/div/div/button")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(1000); driver.FindElement(By.Name("userEmail")).Clear(); driver.FindElement(By.Name("userEmail")).SendKeys("silviamarroquin1402@gmail.com"); driver.FindElement(By.Name("password")).Clear(); driver.FindElement(By.Name("password")).SendKeys("denisse"); driver.FindElement(By.Id("btnLogin")).Click(); Thread.Sleep(3000); driver.FindElement(By.CssSelector("div.content-input-search-header > span.twitter-typeahead > #typeahead")).Clear(); driver.FindElement(By.CssSelector("div.content-input-search-header > span.twitter-typeahead > #typeahead")).SendKeys("wawitas"); SendKeys.SendWait("{ENTER}"); driver.Navigate().GoToUrl("http://juntoz-qa.com/catalogo?keywords=wawitas&allStore=true&specialPrice=false"); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("img.img-responsive.catalog-products-body__product-img-big"))) break; } catch (Exception) { } Thread.Sleep(1000); } Assert.IsTrue(IsElementPresent(By.CssSelector("img.img-responsive.catalog-products-body__product-img-big"))); driver.FindElement(By.CssSelector("img.img-responsive.catalog-products-body__product-img-big")).Click(); driver.Navigate().GoToUrl("http://juntoz-qa.com/producto/wawitas-andador-musical-72w1120pb8-ros?ref=1&keywords=wawitas&variationThumb=71"); Thread.Sleep(1000); Assert.IsTrue(IsElementPresent(By.CssSelector("img.img-responsive"))); Assert.AreEqual("Juguetes, Niños y Bebés", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/header/section/div[2]/ul/li/a/p")).Text); Assert.AreEqual("Ver Todo", driver.FindElement(By.LinkText("Ver Todo")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("a.ng-binding.ng-scope"))); Assert.AreEqual("Juguetes, Niños y Bebés", driver.FindElement(By.CssSelector("a.ng-binding.ng-scope")).Text); Assert.AreEqual("Bebés", driver.FindElement(By.CssSelector("span.ng-scope > breadcrumb.ng-isolate-scope > a.ng-binding.ng-scope")).Text); Assert.AreEqual("Coches para Bebés", driver.FindElement(By.CssSelector("span.ng-scope > breadcrumb.ng-isolate-scope > span.ng-scope > breadcrumb.ng-isolate-scope > a.ng-binding.ng-scope")).Text); Assert.AreEqual("Wawitas", driver.FindElement(By.XPath("//a[contains(text(),'Wawitas')]")).Text); Assert.AreEqual("/ Wawitas- Andador Musical", driver.FindElement(By.CssSelector("span.name-product-breadcrumb.ng-binding")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("div.zoomWindow"))); Assert.AreEqual("Wawitas- Andador Musical", driver.FindElement(By.CssSelector("h1.single-product-name.ng-binding")).Text); Assert.AreEqual("Por", driver.FindElement(By.CssSelector("div.single-product-brand-name.ng-scope > span")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("div.single-product-brand-name.ng-scope > a.ng-binding"))); Assert.AreEqual("Wawitas", driver.FindElement(By.CssSelector("div.single-product-brand-name.ng-scope > a.ng-binding")).Text); Assert.AreEqual("0 Calificaciones", driver.FindElement(By.CssSelector("div.single-product-rating > a > span.ng-binding")).Text); Assert.AreEqual("Vendido y enviado por", driver.FindElement(By.CssSelector("div.single-product-store > span")).Text); Assert.AreEqual("", driver.FindElement(By.CssSelector("img.img-representative")).Text); Assert.AreEqual("S/ 240.00", driver.FindElement(By.CssSelector("strong.specialPriceProduct.ng-binding")).Text); Assert.AreEqual("Color:", driver.FindElement(By.CssSelector("span.variation-name.ng-binding")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='select-control-variation']/div/select"))); StringAssert.Equals("SeleccionarCelesteRosadoVerde", driver.FindElement(By.XPath("//div[@id='select-control-variation']/div/select")).Text); new SelectElement(driver.FindElement(By.XPath("//div[@id='select-control-variation']/div/select"))).SelectByText("Celeste"); driver.FindElement(By.XPath("//option[2]")).Click(); Assert.IsTrue(IsElementPresent(By.Id("btn-append-to-to-body"))); Assert.AreEqual("1", driver.FindElement(By.Id("btn-append-to-to-body")).Text); Assert.AreEqual("Especificaciones:", driver.FindElement(By.CssSelector("li.active > a > span")).Text); Assert.AreEqual("- Andador musical", driver.FindElement(By.CssSelector("li.ng-scope > span.ng-binding.ng-scope")).Text); Assert.AreEqual("- estilo pianito", driver.FindElement(By.XPath("//div[@id='home']/ul/li[2]/span")).Text); Assert.AreEqual("- Tiene una bandeja de juegos", driver.FindElement(By.XPath("//div[@id='home']/ul/li[3]/span")).Text); Assert.AreEqual("- Ocho ruedas giratorias de silicona", driver.FindElement(By.XPath("//div[@id='home']/ul/li[4]/span")).Text); Assert.AreEqual("- Asiento acolchado y graduable", driver.FindElement(By.XPath("//div[@id='home']/ul/li[5]/span")).Text); Assert.AreEqual("- Plegable", driver.FindElement(By.XPath("//div[@id='home']/ul/li[6]/span")).Text); Assert.AreEqual("- Tres niveles de altura", driver.FindElement(By.XPath("//div[@id='home']/ul/li[7]/span")).Text); Assert.AreEqual("- Para edades entre 6 meses a 18 meses", driver.FindElement(By.XPath("//div[@id='home']/ul/li[8]/span")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("a.view-more-description"))); Assert.AreEqual("Ver más", driver.FindElement(By.CssSelector("a.view-more-description")).Text); Assert.AreEqual("Comparte:", driver.FindElement(By.CssSelector("span.text-information-zoom")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("button.btn-facebook"))); Assert.IsTrue(IsElementPresent(By.CssSelector("i.fa.fa-twitter"))); Assert.AreEqual("", driver.FindElement(By.CssSelector("button.btn-facebook")).Text); Assert.AreEqual("", driver.FindElement(By.CssSelector("i.fa.fa-twitter")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("div.panel-body"))); try { if (IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div[2]/div/div[2]/div/div[3]/div[2]/div/div/div/button"))) try { driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div[2]/div/div[2]/div/div[3]/div[2]/div/div/div/button")).Click(); driver.FindElement(By.XPath("//li[2]/button")).Click(); } catch (Exception) { } Thread.Sleep(1000); } catch (AssertFailedException) { } IJavaScriptExecutor jse = (IJavaScriptExecutor)driver; jse.ExecuteScript("scroll(250, 0)"); driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div[2]/div/div[2]/div/div[3]/div[2]/div/div/div/button")).Click(); driver.FindElement(By.XPath("//li[2]/button")).Click(); driver.FindElement(By.Id("btncartitem")).Click(); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("div.popover-cart-header__content.ng-scope"))) break; } catch (Exception) { } Thread.Sleep(1000); } Assert.IsTrue(IsElementPresent(By.CssSelector("div.popover-cart-header__content.ng-scope"))); Assert.IsTrue(IsElementPresent(By.CssSelector("b > i.fa.fa-shopping-cart"))); Assert.AreEqual("1", driver.FindElement(By.CssSelector("b > span.ng-binding")).Text); Assert.AreEqual("en tu carrito", driver.FindElement(By.CssSelector("h3 > a > span.ng-scope")).Text); Assert.AreEqual("Wawitas- Andador Musical", driver.FindElement(By.CssSelector("span.item-name.col-md-10 > a.ng-binding")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("img.img-responsive"))); Assert.AreEqual("S/ 240.00", driver.FindElement(By.CssSelector("h5.product-price > span.ng-binding")).Text); Assert.IsTrue(IsElementPresent(By.XPath("(//button[@type='button'])[6]"))); Assert.AreEqual("1", driver.FindElement(By.XPath("(//button[@type='button'])[6]")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li[2]/div/div[2]/div/div/table/tbody/tr/td[2]/h5/span[2]/span"))); Assert.AreEqual("Subtotal:", driver.FindElement(By.CssSelector("span > b")).Text); Assert.AreEqual("S/ 240.00", driver.FindElement(By.CssSelector("span.subtotal-amount.ng-binding")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li[2]/div/div[2]/div/div/table/tfoot/tr/td/button"))); Assert.AreEqual("Comprar todo", driver.FindElement(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li[2]/div/div[2]/div/div/table/tfoot/tr/td/button")).Text); driver.FindElement(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li[2]/div/div[2]/div/div/table/tfoot/tr/td/button")).Click(); driver.FindElement(By.Id("btncartitem")).Click(); Thread.Sleep(1000); Assert.AreEqual("Checkout", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/h1/small")).Text); Assert.AreEqual("Por favor, ingresa la información solicitada para completar su compra", driver.FindElement(By.CssSelector("small.text-navy.ng-scope")).Text); driver.FindElement(By.Id("btncartitem")).Click(); Assert.AreEqual("1. Información de Contacto", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/h2/small")).Text); Assert.AreEqual("Datos del destinatario", driver.FindElement(By.CssSelector("h4")).Text); //Modificar; StringAssert.Equals("Nombres", driver.FindElement(By.CssSelector("label.ng-scope")).Text); Assert.AreEqual("Silvia", driver.FindElement(By.XPath("//div[2]/div[2]/div/span")).Text); Assert.AreEqual("Alcalde", driver.FindElement(By.XPath("//div[2]/div/span[2]")).Text); Assert.AreEqual("Dirección:", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/div[3]/div/label")).Text); Assert.AreEqual("los fresnos 324", driver.FindElement(By.CssSelector("div.col-md-9.no-padding-left > span.ng-binding")).Text); Assert.AreEqual("Teléfono:", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/div[5]/div/label")).Text); Assert.AreEqual("992485140", driver.FindElement(By.CssSelector("div.text-darkgray.ng-binding")).Text); Assert.AreEqual("Cambiar la dirección de envío", driver.FindElement(By.CssSelector("h4.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.Name("otheraddresscheckout"))); Assert.AreEqual("Javier prado", driver.FindElement(By.CssSelector("label > small.ng-binding.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/div[7]/div[2]/a/small"))); Assert.AreEqual("Agregar nueva dirección de envío", driver.FindElement(By.LinkText("Agregar nueva dirección de envío")).Text); Assert.AreEqual("Datos de Facturación", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/h4[3]")).Text); Assert.AreEqual("Tipo:", driver.FindElement(By.CssSelector("div.col-md-4 > label.ng-scope")).Text); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/div[8]/div/div/select"))) break; } catch (Exception) { } Thread.Sleep(1000); } Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/div[8]/div/div/select"))); StringAssert.Equals("Boleta Factura", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div/div/div[2]/div[8]/div/div/select")).Text); Assert.AreEqual("2. Método de Pago", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/h2/small")).Text); Assert.IsTrue(IsElementPresent(By.Name("payMethodOptionRadio"))); Assert.AreEqual("Tarjeta credito", driver.FindElement(By.CssSelector("b.ng-binding.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("#lb_pm2 > input[name=\"payMethodOptionRadio\"]"))); Assert.AreEqual("Banca por internet, Agentes y Agencias", driver.FindElement(By.XPath("//label[@id='lb_pm2']/span/span[2]")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("#lb_pm3 > input[name=\"payMethodOptionRadio\"]"))); Assert.AreEqual("", driver.FindElement(By.CssSelector("span.checkout-banks.bank-bcp")).Text); Assert.AreEqual("Pago en bancos", driver.FindElement(By.CssSelector("#lb_pm3 > b.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("#lb_pm4 > input[name=\"payMethodOptionRadio\"]"))); Assert.AreEqual("Pago contra entrega", driver.FindElement(By.CssSelector("#lb_pm4 > b.ng-binding.ng-scope")).Text); driver.FindElement(By.Name("payMethodOptionRadio")).Click(); Assert.AreEqual("Nombre del titular", driver.FindElement(By.CssSelector("div.validation-section > div.row > div.col-md-12 > label")).Text); Assert.IsTrue(IsElementPresent(By.XPath("(//input[@type='text'])[19]"))); // Modificar driver.FindElement(By.XPath("(//input[@type='text'])[19]")).Clear(); driver.FindElement(By.XPath("(//input[@type='text'])[19]")).SendKeys("Silvia Alcalde"); Assert.AreEqual("Número de tarjeta", driver.FindElement(By.CssSelector("div.validation-section > div.row > div.col-md-12 > label.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.XPath("(//input[@type='text'])[20]"))); //Modificar driver.FindElement(By.CssSelector("input.eagleCardValidator")).Clear(); driver.FindElement(By.CssSelector("input.eagleCardValidator")).SendKeys("1274582412459874"); Assert.AreEqual("Soporta Visa, MasterCard y American Express.", driver.FindElement(By.CssSelector("div.col-md-12 > small")).Text); Assert.AreEqual("Monto mínimo de compra: S/ 10.00", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/div/div/div/div/div/div/div[3]/div/small[2]")).Text); Assert.AreEqual("Fecha de vecimiento", driver.FindElement(By.CssSelector("div.col-md-9 > label.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/div/div/div/div/div/div/div[7]/div/div/div/select"))); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/div/div/div/div/div/div/div[7]/div/div/div[3]/select"))); Assert.AreEqual("CVV", driver.FindElement(By.CssSelector("div.row.vertical > div.col-md-3 > label")).Text); Assert.IsTrue(IsElementPresent(By.XPath("(//input[@type='text'])[22]"))); StringAssert.Equals("EneroFebreroMarzoAbrilMayoJunioJulioAgostoSeptiembreOctubreNoviembreDiciembre", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/div/div/div/div/div/div/div[7]/div/div/div/select")).Text); new SelectElement(driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/div/div/div/div/div/div/div[7]/div/div/div/select"))).SelectByText("Julio"); new SelectElement(driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[2]/div/div/div/div/div/div/div[7]/div/div/div[3]/select"))).SelectByText("2021"); driver.FindElement(By.XPath("(//input[@type='text'])[22]")).Clear(); driver.FindElement(By.XPath("(//input[@type='text'])[22]")).SendKeys("245"); Assert.IsTrue(IsElementPresent(By.CssSelector("a.text-maroon > small.ng-scope"))); try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.CssSelector("a.text-maroon > small.ng-scope")).Text, "^exact:¿Qué es esto[\\s\\S]$")); } catch (AssertFailedException) { } Assert.AreEqual("Guardar esta tarjeta para mis próximas compras", driver.FindElement(By.CssSelector("label > span.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//input[@type='checkbox']"))); driver.FindElement(By.XPath("(//input[@type='text'])[20]")).Clear(); driver.FindElement(By.XPath("(//input[@type='text'])[20]")).SendKeys("4380039943528067"); Assert.IsTrue(IsElementPresent(By.CssSelector("input.eagleCardValidator.visa"))); Assert.IsTrue(IsElementPresent(By.XPath("(//button[@type='button'])[5]"))); Assert.AreEqual("Finalizar compra", driver.FindElement(By.XPath("(//button[@type='button'])[5]")).Text); Assert.AreEqual("3. Resumen de orden", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/h2/small")).Text); Assert.AreEqual("Producto", driver.FindElement(By.CssSelector("th.text-center.ng-scope")).Text); Assert.AreEqual("Cantidad", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/thead/tr/th[2]")).Text); Assert.AreEqual("Subtotal", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/thead/tr/th[3]")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("img.img-responsive"))); Assert.AreEqual("1", driver.FindElement(By.CssSelector("td.text-darkgray.text-center > span.ng-binding")).Text); StringAssert.Equals("S/.240.00", driver.FindElement(By.XPath("//tr[@id='item_72']/td[3]")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("button.close"))); Assert.AreEqual("Subtotal", driver.FindElement(By.CssSelector("tfoot.chkout-table-footer > tr > td")).Text); Assert.AreEqual("(1 Productos)", driver.FindElement(By.CssSelector("tfoot.chkout-table-footer > tr > td.text-right.ng-binding")).Text); Assert.AreEqual("S/ 240.00", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/tfoot/tr/td[3]")).Text); Assert.AreEqual("Envío", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/tfoot/tr[3]/td[2]")).Text); Assert.AreEqual("S/ 19.82", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/tfoot/tr[3]/td[3]")).Text); Assert.AreEqual("Total", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/tfoot/tr[4]/td[2]")).Text); Assert.AreEqual("S/ 259.82", driver.FindElement(By.CssSelector("td.text-right > b.ng-binding")).Text); Assert.AreEqual("Tiempo de envío", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/tfoot/tr[5]/td[2]")).Text); Assert.AreEqual("6 días utiles", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div/div/table/tfoot/tr[5]/td[3]")).Text); Assert.AreEqual("Código de cupón:", driver.FindElement(By.CssSelector("div.padding-left-20.text-navy > div.row > div.col-md-12 > label.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.Name("name"))); Assert.AreEqual("Comentarios:", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/form/div[3]/div/div[5]/div/label")).Text); Assert.IsTrue(IsElementPresent(By.Name("comentarios"))); Assert.IsTrue(IsElementPresent(By.XPath("(//button[@type='button'])[11]"))); Assert.AreEqual("Finalizar compra", driver.FindElement(By.XPath("(//button[@type='button'])[11]")).Text); //Modificar driver.FindElement(By.Name("comentarios")).Clear(); driver.FindElement(By.Name("comentarios")).SendKeys("Test"); driver.FindElement(By.XPath("(//button[@type='button'])[11]")).Click(); Thread.Sleep(3000); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("h1.text-center.chk-title > b"))) break; } catch (Exception) { } Thread.Sleep(1000); } for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("div.media-body.chk-item > p"))) break; } catch (Exception) { } Thread.Sleep(1000); } Assert.IsTrue(IsElementPresent(By.XPath("//body/div[5]/div[2]/div"))); StringAssert.Equals("Wawitas", driver.FindElement(By.CssSelector("h4.media-heading.ng-binding")).Text); Assert.AreEqual("Wawitas- Andador Musical", driver.FindElement(By.CssSelector("b.ng-binding")).Text); Assert.AreEqual("S/ 240", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div[2]/div[3]/div/div/div/div/div/div/div[2]/p[2]/b")).Text); Assert.AreEqual("Cantidad: 1", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div[2]/div[3]/div/div/div/div/div/div/div[2]/p[3]")).Text); Assert.AreEqual("Costos de envío: S/ 19.82", driver.FindElement(By.CssSelector("h4.total-amount")).Text); Assert.AreEqual("Total facturado: S/ 259.82", driver.FindElement(By.CssSelector("h3.total-amount.no-margin-top")).Text); Assert.AreEqual("Te enviaremos un email de confirmación", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div[2]/div[3]/div/div/div[2]/h4[2]")).Text); } [TestMethod] public void ValidarOrden() { driver.Navigate().GoToUrl("http://juntoz-qa.com/"); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li/div/div[2]/div/div/div/div/button")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(1000); driver.FindElement(By.Name("userEmail")).Clear(); driver.FindElement(By.Name("userEmail")).SendKeys("silviamarroquin1402@gmail.com"); driver.FindElement(By.Name("password")).Clear(); driver.FindElement(By.Name("password")).SendKeys("denisse"); driver.FindElement(By.Id("btnLogin")).Click(); Thread.Sleep(3000); StringAssert.Equals("Mi Carrito", driver.FindElement(By.Id("btncartitem")).Text); driver.FindElement(By.Id("btnaccount")).Click(); Assert.IsTrue(IsElementPresent(By.Id("logoutForm"))); Assert.IsTrue(IsElementPresent(By.LinkText("Mis Órdenes"))); driver.FindElement(By.LinkText("Mis Órdenes")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(3000); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("div.tab-content"))) break; } catch (Exception) { } Thread.Sleep(1000); } StringAssert.Equals("Mi cuenta", driver.FindElement(By.CssSelector("b.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.LinkText("Resumen"))); Assert.AreEqual("Resumen", driver.FindElement(By.LinkText("Resumen")).Text); try { Assert.IsTrue(IsElementPresent(By.LinkText("Ajustes de cuenta"))); StringAssert.Equals("Ajustes de cuenta", driver.FindElement(By.LinkText("Ajustes de cuenta")).Text); } catch (AssertFailedException) { } try { Assert.IsTrue(IsElementPresent(By.LinkText("Administrar direcciones"))); Assert.AreEqual("Administrar direcciones", driver.FindElement(By.LinkText("Administrar direcciones")).Text); }catch (AssertFailedException) { } try { Assert.IsTrue(IsElementPresent(By.LinkText("Mis órdenes"))); Assert.AreEqual("Mis órdenes", driver.FindElement(By.LinkText("Mis órdenes")).Text); }catch (AssertFailedException) { } try { Assert.IsTrue(IsElementPresent(By.LinkText("Cupón"))); Assert.AreEqual("Cupón", driver.FindElement(By.LinkText("Cupón")).Text); }catch (AssertFailedException) { } Assert.AreEqual("Mis órdenes", driver.FindElement(By.CssSelector("h3.text-navy.text-bold")).Text); Assert.IsTrue(IsElementPresent(By.XPath("(//input[@type='text'])[7]"))); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div[2]/div/select"))); StringAssert.Equals("Última semana Últimos 15 días Último mes", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div[2]/div/select")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div[2]/div/select[2]"))); StringAssert.Equals("Todas las Órdenes Órdenes completadasÓrdenes abiertasÓrdenes canceladas", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div[2]/div/select[2]")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("button.btn.bg-navy"))); Assert.AreEqual("Buscar", driver.FindElement(By.CssSelector("button.btn.bg-navy")).Text); Assert.AreEqual("Órdenes de juntoz", driver.FindElement(By.LinkText("Órdenes de juntoz")).Text); Assert.AreEqual("# de orden", driver.FindElement(By.XPath("//table[@id='accordion']/thead/tr/th[2]")).Text); Assert.AreEqual("Fecha", driver.FindElement(By.XPath("//table[@id='accordion']/thead/tr/th[3]")).Text); Assert.AreEqual("Sub total", driver.FindElement(By.XPath("//table[@id='accordion']/thead/tr/th[4]")).Text); Assert.AreEqual("Costo de envío", driver.FindElement(By.XPath("//table[@id='accordion']/thead/tr/th[5]")).Text); Assert.AreEqual("Total", driver.FindElement(By.XPath("//table[@id='accordion']/thead/tr/th[6]")).Text); Assert.AreEqual("S/ 240.00", driver.FindElement(By.CssSelector("td.text-right.ng-binding")).Text); Assert.AreEqual("S/ 19.82", driver.FindElement(By.XPath("//table[@id='accordion']/tbody[3]/tr/td[5]")).Text); Assert.AreEqual("S/ 259.82", driver.FindElement(By.XPath("//table[@id='accordion']/tbody[3]/tr/td[6]")).Text); Assert.AreEqual("Órdenes de White Label", driver.FindElement(By.LinkText("Órdenes de White Label")).Text); Assert.AreEqual("# de orden", driver.FindElement(By.XPath("(//table[@id='accordion']/thead/tr/th[2])[2]")).Text); Assert.AreEqual("Fecha", driver.FindElement(By.XPath("(//table[@id='accordion']/thead/tr/th[3])[2]")).Text); Assert.AreEqual("Sub total", driver.FindElement(By.XPath("(//table[@id='accordion']/thead/tr/th[4])[2]")).Text); Assert.AreEqual("Costo de envío", driver.FindElement(By.XPath("(//table[@id='accordion']/thead/tr/th[5])[2]")).Text); Assert.AreEqual("Total", driver.FindElement(By.XPath("(//table[@id='accordion']/thead/tr/th[6])[2]")).Text); //Numero de la orden : INGRESAR driver.FindElement(By.Id("160928193803")).Click(); Thread.Sleep(500); Assert.AreEqual("Pedidos por Orden", driver.FindElement(By.CssSelector("h4")).Text); StringAssert.Equals("# de orden", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/thead/tr/th")).Text); StringAssert.Equals("Tienda", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/thead/tr/th[2]")).Text); StringAssert.Equals("Status", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/thead/tr/th[3]")).Text); StringAssert.Equals("Total", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/thead/tr/th[4]")).Text); StringAssert.Equals("Opciones", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/thead/tr/th[5]")).Text); //modificar orden Assert.AreEqual("160928193803-001", driver.FindElement(By.CssSelector("tr.ng-scope > td.text-center.ng-binding")).Text); StringAssert.Equals("Wawitas", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/tbody/tr/td[2]")).Text); StringAssert.Equals("Nuevo", driver.FindElement(By.XPath("//tr[@id='c160926213709']/td/table/tbody/tr/td[3]/span")).Text); Assert.AreEqual("S/. 259.82", driver.FindElement(By.CssSelector("tr.ng-scope > td.text-right.ng-binding")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("i.fa.fa-eye"))); Assert.IsTrue(IsElementPresent(By.CssSelector("i.fa.fa-times"))); driver.FindElement(By.CssSelector("i.fa.fa-eye")).Click(); Thread.Sleep(1000); Assert.AreEqual("Orden N°: 160928193803", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div/h3")).Text); Assert.AreEqual("Pedido", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li/div/div/span[2]")).Text); Assert.AreEqual("Recibido", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li[2]/div/div/span[2]")).Text); Assert.AreEqual("Confirmado", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li[3]/div/div/span[2]")).Text); StringAssert.Equals("Pedido en\n Camino", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li[4]/div/div")).Text); Assert.AreEqual("Pedido", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li[5]/div/div/span")).Text); Assert.AreEqual("Cerrado", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li[6]/div/div/span[2]")).Text); Assert.AreEqual("Cancelado", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/ol/li[7]/div/div/span[2]")).Text); Assert.AreEqual("Artículos de la orden", driver.FindElement(By.CssSelector("li > div.list-category-left-bar > span.parent-category-filters > b")).Text); Assert.AreEqual("Artículo 1", driver.FindElement(By.CssSelector("th > div.ng-binding")).Text); Assert.AreEqual("SKU", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/thead/tr/th[2]")).Text); Assert.AreEqual("Cantidad", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/thead/tr/th[3]")).Text); Assert.AreEqual("Precio unitario", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/thead/tr/th[4]")).Text); Assert.AreEqual("Subtotal", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/thead/tr/th[5]")).Text); Assert.AreEqual("Estado", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/thead/tr/th[6]")).Text); Assert.AreEqual("Cancelar", driver.FindElement(By.CssSelector("label.ng-scope")).Text); Assert.IsTrue(IsElementPresent(By.LinkText("Wawitas- Andador Musical - Color : Celeste"))); Assert.AreEqual("Wawitas- Andador Musical - Color : Celeste", driver.FindElement(By.LinkText("Wawitas- Andador Musical - Color : Celeste")).Text); Assert.AreEqual("W1120PB8-cel", driver.FindElement(By.CssSelector("td.text-center.ng-binding")).Text); Assert.AreEqual("1", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/tbody/tr/td[4]")).Text); Assert.AreEqual("S/. 240.00", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/tbody/tr/td[5]")).Text); Assert.AreEqual("S/. 240.00", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/tbody/tr/td[6]")).Text); Assert.AreEqual("Nuevo", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/tbody/tr/td[7]/span")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/tbody/tr/td[8]/button"))); Assert.AreEqual("Descuento: S/. 0.00", driver.FindElement(By.CssSelector("div.col-md-12.text-right > h5")).Text); Assert.AreEqual("S/. 19.82", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div[2]/div/h5[2]/span")).Text); Assert.AreEqual("Subtotal (1) artículos: S/. 259.82", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div[2]/div/h4")).Text); try { Assert.IsTrue(IsElementPresent(By.LinkText("Regresar a Mis Órdenes"))); Assert.AreEqual("Regresar a Mis Órdenes", driver.FindElement(By.LinkText("Regresar a Mis Órdenes")).Text); } catch (AssertFailedException) { } Assert.AreEqual("Dirección de envío", driver.FindElement(By.CssSelector("div.col-md-6 > ul.category-list.list-unstyled > li > div.list-category-left-bar > span.parent-category-filters > b")).Text); Assert.AreEqual("Silvia Alcalde", driver.FindElement(By.CssSelector("b.ng-binding")).Text); Assert.AreEqual("los fresnos 324", driver.FindElement(By.CssSelector("li.padding-left-10.ng-binding")).Text); Assert.AreEqual("992485140", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/div/div/ul/li/div/ul/li[4]")).Text); Assert.AreEqual("Método de pago", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/div/div[2]/ul/li/div/span/b")).Text); Assert.AreEqual("VISA", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/div/div[2]/ul/li/div/ul/li")).Text); } [TestMethod] public void EstadosOrden() { // open first page in first tab string firstPageUrl = "http://juntoz-qa.com/"; driver.Navigate().GoToUrl(firstPageUrl); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li/div/div[2]/div/div/div/div/button")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(1000); driver.FindElement(By.Name("userEmail")).Clear(); driver.FindElement(By.Name("userEmail")).SendKeys("silviamarroquin1402@gmail.com"); driver.FindElement(By.Name("password")).Clear(); driver.FindElement(By.Name("password")).SendKeys("denisse"); driver.FindElement(By.Id("btnLogin")).Click(); Thread.Sleep(3000); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.LinkText("Mis Órdenes")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(3000); //Modificar Orden driver.FindElement(By.Id("160928193803")).Click(); Thread.Sleep(1000); driver.FindElement(By.CssSelector("i.fa.fa-eye")).Click(); Thread.Sleep(3000); Assert.AreEqual("Nuevo", driver.FindElement(By.XPath("//td[7]/span")).Text); string firstTabHandle = driver.CurrentWindowHandle; Actions action = new Actions(driver); action.SendKeys(OpenQA.Selenium.Keys.Control + "t").Build().Perform(); string secondTabHandle = driver.CurrentWindowHandle; driver.SwitchTo().Window(secondTabHandle); string secondPageUrl = "http://juntoz-web-login-qa.azurewebsites.net/"; driver.Navigate().GoToUrl(secondPageUrl); driver.Navigate().GoToUrl("http://juntoz-web-login-qa.azurewebsites.net/auth/login?client_id=a2912434ae844eb48be398d5bfa77c3806c7a1bcc1bf44ee8acd8cdbf7e1d5e3&formView=login&returnUrl=http://juntoz-web-admin-qa.azurewebsites.net&actionName="); driver.FindElement(By.Id("Email")).Clear(); driver.FindElement(By.Id("Email")).SendKeys("denisse@ieholding.com"); driver.FindElement(By.Id("Password")).Clear(); driver.FindElement(By.Id("Password")).SendKeys("denissita"); driver.FindElement(By.XPath("//button[@type='submit']")).Click(); driver.FindElement(By.XPath("//section/ul/li[4]/a/span")).Click(); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("ul.treeview-menu.menu-open > li > a > span.ng-scope"))) break; } catch (Exception) { } Thread.Sleep(1000); } driver.FindElement(By.CssSelector("ul.treeview-menu.menu-open > li > a > span.ng-scope")).Click(); driver.Navigate().GoToUrl("http://juntoz-web-admin-qa.azurewebsites.net/#/orders"); for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("i.fa.fa-cubes"))) break; } catch (Exception) { } Thread.Sleep(1000); } for (int second = 0; ; second++) { if (second >= 60) Assert.Fail("timeout"); try { if (IsElementPresent(By.CssSelector("h3.box-title > span"))) break; } catch (Exception) { } Thread.Sleep(1000); } Thread.Sleep(5000); Assert.IsTrue(IsElementPresent(By.CssSelector("h3.box-title > span"))); Assert.AreEqual("Ordenes", driver.FindElement(By.CssSelector("h3.box-title > span")).Text); driver.FindElement(By.XPath("//input[@type='text']")).Clear(); driver.FindElement(By.XPath("//input[@type='text']")).SendKeys("160928193803"); SendKeys.SendWait("{ENTER}"); driver.FindElement(By.CssSelector("button.btn.btn-success")).Click(); Thread.Sleep(15000); driver.FindElement(By.Id("160928193803")).Click(); driver.FindElement(By.LinkText("160928193803-001")).Click(); Thread.Sleep(10000); Assert.IsTrue(IsElementPresent(By.XPath("//div[@id='right-sidebar']/div/div[2]/div/div"))); Assert.IsTrue(IsElementPresent(By.CssSelector("div.content"))); Assert.IsTrue(IsElementPresent(By.CssSelector("div.sa-header-options.pull-right > button.btn.btn-primary"))); Assert.AreEqual("Confirmar Order", driver.FindElement(By.CssSelector("div.sa-header-options.pull-right > button.btn.btn-primary")).Text); Assert.IsTrue(IsElementPresent(By.XPath("(//button[@type='submit'])[10]"))); Assert.AreEqual("Cancelar Order", driver.FindElement(By.XPath("(//button[@type='submit'])[10]")).Text); Thread.Sleep(2000); //Assert.AreEqual("Confirmar Order", driver.FindElement(By.CssSelector("div.sa-header-options.pull-right > button.btn.btn-primary")).Text); //driver.FindElement(By.CssSelector("div.sa-header-options.pull-right > button.btn.btn-primary")).Click(); action.SendKeys(OpenQA.Selenium.Keys.Control + "2").Build().Perform(); driver.SwitchTo().Window(secondTabHandle); Thread.Sleep(1000); driver.Navigate().Refresh(); //Assert.AreEqual("Confirmado", driver.FindElement(By.XPath("//td[7]/span")).Text); action.SendKeys(OpenQA.Selenium.Keys.Control + "1").Build().Perform(); } [TestMethod] public void CancelarOrden() { driver.Navigate().GoToUrl("http://juntoz-qa.com/"); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.XPath("//div[@id='header-juntoz']/nav/div/div[2]/div/div/div/div/ul/li/div/div[2]/div/div/div/div/button")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(1000); driver.FindElement(By.Name("userEmail")).Clear(); driver.FindElement(By.Name("userEmail")).SendKeys("silviamarroquin1402@gmail.com"); driver.FindElement(By.Name("password")).Clear(); driver.FindElement(By.Name("password")).SendKeys("denisse"); driver.FindElement(By.Id("btnLogin")).Click(); Thread.Sleep(3000); driver.FindElement(By.Id("btnaccount")).Click(); driver.FindElement(By.LinkText("Mis Órdenes")).Click(); driver.FindElement(By.Id("btnaccount")).Click(); Thread.Sleep(3000); //Modificar Orden driver.FindElement(By.Id("160928193803")).Click(); Thread.Sleep(1000); driver.FindElement(By.CssSelector("i.fa.fa-eye")).Click(); Thread.Sleep(3000); Assert.AreEqual("Nuevo", driver.FindElement(By.XPath("//td[7]/span")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("button.btn.bg-navy"))); Assert.AreEqual("Cancelar orden", driver.FindElement(By.CssSelector("button.btn.bg-navy")).Text); driver.FindElement(By.CssSelector("button.btn.bg-navy")).Click(); Assert.IsTrue(IsElementPresent(By.CssSelector("h3.modal-title.ng-binding"))); Assert.IsTrue(IsElementPresent(By.CssSelector("h3.modal-title.ng-binding"))); Assert.AreEqual("Cancelar orden", driver.FindElement(By.CssSelector("h3.modal-title.ng-binding")).Text); Assert.AreEqual("Lamentamos tu decisión.", driver.FindElement(By.CssSelector("small")).Text); try { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.CssSelector("h4 > small")).Text, "^exact:¿Cuál es el motivo de tu cancelación[\\s\\S]$")); } catch (AssertFailedException) { } Assert.IsTrue(IsElementPresent(By.XPath("//select"))); StringAssert.Equals("Cambio de direcciónNo podré esperar el tiempo de entregaCambio de productoYa no tengo dinero para pagarLo encontré mas barato en otra tiendaTengo un cupón de descuentoCambiar método de pagoLo compre en otra tiendaQuiero aprovechar promoción vigenteNo reconozco la compra realizada", driver.FindElement(By.XPath("//select")).Text); Assert.IsTrue(IsElementPresent(By.XPath("//div[3]/button"))); Assert.AreEqual("Cerrar", driver.FindElement(By.XPath("//div[3]/button")).Text); Assert.IsTrue(IsElementPresent(By.CssSelector("button.close"))); Assert.AreEqual("x", driver.FindElement(By.CssSelector("button.close")).Text); new SelectElement(driver.FindElement(By.XPath("//select"))).SelectByText("Cambio de dirección"); Assert.IsTrue(IsElementPresent(By.XPath("//div[3]/button[2]"))); Assert.AreEqual("Cancelar", driver.FindElement(By.XPath("//div[3]/button[2]")).Text); driver.FindElement(By.XPath("//div[3]/button[2]")).Click(); Assert.AreEqual("Cancelado", driver.FindElement(By.XPath("//div[@id='body-juntoz']/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div[3]/div/ul/li/div/div/div/table/tbody/tr/td[7]/span")).Text); driver.Navigate().Refresh(); } private bool IsElementPresent(By by) { try { driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } public bool TryFindElement(By by, IWebElement element) { try { element = driver.FindElement(by); return true; } catch (NoSuchElementException) { return false; } } public bool IsElementVisible(IWebElement element) { return element.Enabled; } } }
using System; using System.Collections.Generic; using System.Text; namespace Passenger.Core.Domain { public class Passenger { public Guid Id { get; set; } public Guid UserId { get; set; } public Node Address { get; set; } } }
using System; using System.Linq; using System.Threading.Tasks; using DSharpPlus; using DSharpPlus.Entities; using DSharpPlus.SlashCommands; using Requestrr.WebApi.RequestrrBot.Locale; namespace Requestrr.WebApi.RequestrrBot.ChatClients.Discord { public class DiscordPingWorkFlow { private readonly InteractionContext _context; public DiscordPingWorkFlow(InteractionContext context) { _context = context; } public async Task HandlePingAsync() { await _context.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().AsEphemeral(true).WithContent(Language.Current.DiscordCommandPingResponse)); } } }
namespace Triton.Game.Mapping { using ns26; using System; [Attribute38("BoosterDbfRecord")] public class BoosterDbfRecord : DbfRecord { public BoosterDbfRecord(IntPtr address) : this(address, "BoosterDbfRecord") { } public BoosterDbfRecord(IntPtr address, string className) : base(address, className) { } public object GetVar(string name) { object[] objArray1 = new object[] { name }; return base.method_14<object>("GetVar", objArray1); } public System.Type GetVarType(string name) { object[] objArray1 = new object[] { name }; return base.method_14<System.Type>("GetVarType", objArray1); } public void SetArenaPrefab(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetArenaPrefab", objArray1); } public void SetBuyWithGoldEvent(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetBuyWithGoldEvent", objArray1); } public void SetLeavingSoon(bool v) { object[] objArray1 = new object[] { v }; base.method_8("SetLeavingSoon", objArray1); } public void SetLeavingSoonText(DbfLocValue v) { object[] objArray1 = new object[] { v }; base.method_8("SetLeavingSoonText", objArray1); } public void SetName(DbfLocValue v) { object[] objArray1 = new object[] { v }; base.method_8("SetName", objArray1); } public void SetNoteDesc(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetNoteDesc", objArray1); } public void SetOpenPackEvent(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetOpenPackEvent", objArray1); } public void SetPackOpeningFxPrefab(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetPackOpeningFxPrefab", objArray1); } public void SetPackOpeningPrefab(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetPackOpeningPrefab", objArray1); } public void SetSortOrder(int v) { object[] objArray1 = new object[] { v }; base.method_8("SetSortOrder", objArray1); } public void SetStorePrefab(string v) { object[] objArray1 = new object[] { v }; base.method_8("SetStorePrefab", objArray1); } public void SetVar(string name, object val) { object[] objArray1 = new object[] { name, val }; base.method_8("SetVar", objArray1); } public string ArenaPrefab { get { return base.method_13("get_ArenaPrefab", Array.Empty<object>()); } } public string BuyWithGoldEvent { get { return base.method_13("get_BuyWithGoldEvent", Array.Empty<object>()); } } public bool LeavingSoon { get { return base.method_11<bool>("get_LeavingSoon", Array.Empty<object>()); } } public DbfLocValue LeavingSoonText { get { return base.method_14<DbfLocValue>("get_LeavingSoonText", Array.Empty<object>()); } } public string m_ArenaPrefab { get { return base.method_4("m_ArenaPrefab"); } } public string m_BuyWithGoldEvent { get { return base.method_4("m_BuyWithGoldEvent"); } } public bool m_LeavingSoon { get { return base.method_2<bool>("m_LeavingSoon"); } } public DbfLocValue m_LeavingSoonText { get { return base.method_3<DbfLocValue>("m_LeavingSoonText"); } } public DbfLocValue m_Name { get { return base.method_3<DbfLocValue>("m_Name"); } } public string m_NoteDesc { get { return base.method_4("m_NoteDesc"); } } public string m_OpenPackEvent { get { return base.method_4("m_OpenPackEvent"); } } public string m_PackOpeningFxPrefab { get { return base.method_4("m_PackOpeningFxPrefab"); } } public string m_PackOpeningPrefab { get { return base.method_4("m_PackOpeningPrefab"); } } public int m_SortOrder { get { return base.method_2<int>("m_SortOrder"); } } public string m_StorePrefab { get { return base.method_4("m_StorePrefab"); } } public DbfLocValue Name { get { return base.method_14<DbfLocValue>("get_Name", Array.Empty<object>()); } } public string NoteDesc { get { return base.method_13("get_NoteDesc", Array.Empty<object>()); } } public string OpenPackEvent { get { return base.method_13("get_OpenPackEvent", Array.Empty<object>()); } } public string PackOpeningFxPrefab { get { return base.method_13("get_PackOpeningFxPrefab", Array.Empty<object>()); } } public string PackOpeningPrefab { get { return base.method_13("get_PackOpeningPrefab", Array.Empty<object>()); } } public int SortOrder { get { return base.method_11<int>("get_SortOrder", Array.Empty<object>()); } } public string StorePrefab { get { return base.method_13("get_StorePrefab", Array.Empty<object>()); } } } }
using ControlObraAPI.Models; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Description; namespace ControlObraAPI.Controllers { public class GeneralViewFilterController : ApiController { private CFB_BuildEntities db = new CFB_BuildEntities(); // GET: api/Proyecto [Route("api/Proyecto")] public IEnumerable<VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3_Result> GetProyecto(int tipoConsulta) { return db.VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3(tipoConsulta, null, null, null, null).AsEnumerable(); } // GET: api/Modelo [Route("api/Modelo")] public IEnumerable<VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3_Result> GetModelo(int tipoConsulta, int parametro) { return db.VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3(tipoConsulta, parametro, null, null, null).AsEnumerable(); } // GET: api/Obra [Route("api/Obra")] public IEnumerable<VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3_Result> GetObra(int tipoConsulta, int parametro, int parametro1) { return db.VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3(tipoConsulta, parametro, parametro1, null, null).AsEnumerable(); } // GET: api/Actividad [Route("api/Actividad")] public IEnumerable<VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3_Result> GetActividad(int tipoConsulta, int parametro, int parametro1) { return db.VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3(tipoConsulta, parametro, parametro1, null, null).AsEnumerable(); } // GET: api/Tarea [Route("api/Tarea")] public IEnumerable<VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3_Result> GetTarea(int tipoConsulta, int parametro, int parametro1, int parametro2, int parametro3) { return db.VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3(tipoConsulta, parametro, parametro1, parametro2, parametro3).AsEnumerable(); } // GET: api/Detalle [Route("api/Detalle")] public IEnumerable<VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3_Result> GetDetalle(int tipoConsulta, int parametro, int parametro1, int parametro2, int parametro3) { return db.VISTA_PROYECTO_MODELO_OBRA_ACTIVIDAD_TAREA_DETALLE3(tipoConsulta, parametro, parametro1, parametro2, parametro3).AsEnumerable(); } // POST: api/ // GET: api/GeneralViewFilter/5 public string Get(int id) { return "value"; } // POST: api/Requisicion [ResponseType(typeof(Requisicion))] [Route("api/Requisicion")] public async Task<IHttpActionResult> RequisicionPost(Requisicion req) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.INSERT_PREREQ(req.CodProyecto, req.CodModelo, req.CodLote, req.CodActividad, req.CodTarea, req.CodDetalle, req.Cantidad, req.CodUnidad, req.EsUnidad, req.Solicitado, req.Despacho, req.Bodega, req.Incluir, req.Numero, req.Usuario, req.IdDispositivo, req.Tipo, req.Estado); await db.SaveChangesAsync(); return Ok(req); } // PUT: api/GeneralViewFilter/5 public void Put(int id, [FromBody]string value) { } // DELETE: api/GeneralViewFilter/5 public void Delete(int id) { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GestDep.Entities { public partial class Gym { public Gym() { Offers = new List<Activity>(); Has = new List<Room>(); } public Gym(DateTime closingHour, int discountLocal, int discountRetired, double freeUserPrice, int id, string name, DateTime openingHour, int zipCode) { ClosingHour = closingHour; DiscountLocal = discountLocal; DiscountRetired = discountRetired; FreeUserPrice = freeUserPrice; Id = id; Name = name; OpeningHour = openingHour; ZipCode = zipCode; Offers = new List<Activity>(); Has = new List<Room>(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Controle.View { public class SaidaView { } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace transGraph { public partial class viewDataBill : Form { string clientId; string billUin; dbFacade db = new dbFacade(); string status = "1"; Dictionary<string, string> saveStat = new Dictionary<string, string>(); public viewDataBill(string clientId,string billUin) { this.clientId = clientId; this.billUin = billUin; InitializeComponent(); DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn(); cmb.HeaderText = "Статус"; cmb.Name = "cmb"; cmb.Width = 100; cmb.Items.Add("Создан"); cmb.Items.Add("В пути"); cmb.Items.Add("Доставлен"); cmb.Items.Add("Отменен"); dataG.Columns.Add(cmb); dataG.Columns.Add("Пар.","Пар."); dataG.Columns[dataG.ColumnCount - 1].Width = 30; DataTable data = db.FetchAllSql("SELECT d5,d14,d13,d12,d2,d7,d8 FROM billdata WHERE id = '" + clientId + "'"); // get name this.label2.Text = data.Rows[0][0].ToString(); // get adress this.label3.Text = data.Rows[0][1].ToString(); // get note this.label5.Text = data.Rows[0][2].ToString(); // get phome this.label7.Text = data.Rows[0][3].ToString(); // get time this.label9.Text = data.Rows[0][4].ToString(); string[] dataBillName = data.Rows[0][6].ToString().Split(';'); string[] dataBillBarcode = data.Rows[0][5].ToString().Split(';'); for (int i = 0; i < dataBillName.Length; i++) { string billName = dataBillName[i]; string billBarcode = dataBillBarcode[i]; string billSupp = "-/-"; try { DataTable dataR = db.FetchAllSql("SELECT title FROM supps WHERE id = '" + data.Rows[0][4].ToString() + "'"); billSupp = dataR.Rows[0][0].ToString(); } catch(Exception) {} this.dataG.Rows.Add(billSupp, billName, billBarcode); } } public string getStatus(string barcode) { string ret = "Создан"; bool handSet = false; DataTable data = db.FetchAllSql("SELECT value FROM billstat WHERE barcode = '" + barcode + "'"); try { if (data.Rows[0][0].ToString() == "0") { ret = "Отменен"; handSet = true; } if (data.Rows[0][0].ToString() == "3") { ret = "Доставлен"; handSet = true; } if (data.Rows[0][0].ToString() == "2") { ret = "В пути"; handSet = true; } if (data.Rows[0][0].ToString() == "1") { ret = "Создан"; handSet = true; } } catch { if (this.status == "1") ret = "Создан"; if (this.status == "2") ret = "В пути"; if (this.status == "3") ret = "Доставлен"; if (this.status == "0") ret = "Отменен"; } return ret; } public string getStatusPar(string barcode) { string ret = "А"; DataTable data = db.FetchAllSql("SELECT type FROM billstat WHERE barcode = '" + barcode + "'"); try { if(data.Rows[0][0].ToString() == "1") ret = "Р"; } catch { } return ret; } public string getStatId(string ss) { string ret = "1"; if (ss == "Создан") ret = "1"; if (ss == "В пути") ret = "2"; if (ss == "Доставлен") ret = "3"; if (ss == "Отменен") ret = "0"; return ret; } private void button1_Click(object sender, EventArgs e) { dataG.EndEdit(); dataG.RefreshEdit(); for (int i = 0; i < this.dataG.RowCount; i++) { try { if (this.saveStat[dataG[3, i].Value.ToString()] != dataG[4, i].Value.ToString()) { db.FetchAllSql("REPLACE INTO billstat (barcode,value,type) VALUES ('" + dataG[3, i].Value.ToString() + "','" + getStatId(dataG[4, i].Value.ToString()) + "','1')"); } } catch (Exception) { } } this.Close(); } } }
// Accord Statistics Library // The Accord.NET Framework // http://accord-framework.net // // Copyright © César Souza, 2009-2015 // cesarsouza at gmail.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // namespace Accord.Statistics.Distributions.Univariate { using System; using Accord.Math; using AForge; /// <summary> /// Power Normal distribution. /// </summary> /// /// <remarks> /// <para> /// References: /// <list type="bullet"> /// <item><description><a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda366d.htm"> /// NIST/SEMATECH e-Handbook of Statistical Methods. Power Normal distribution. Available on: /// http://www.itl.nist.gov/div898/handbook/eda/section3/eda366d.htm </a></description></item> /// </list></para> /// </remarks> /// /// <example> /// <para> /// This example shows how to create a Power Normal distribution /// and compute some of its properties.</para> /// /// <code> /// // Create a new Power-Normal distribution with p = 4.2 /// var pnormal = new PowerNormalDistribution(power: 4.2); /// /// double cdf = pnormal.DistributionFunction(x: 1.4); // 0.99997428721920678 /// double pdf = pnormal.ProbabilityDensityFunction(x: 1.4); // 0.00020022645890003279 /// double lpdf = pnormal.LogProbabilityDensityFunction(x: 1.4); // -0.20543269836728234 /// /// double ccdf = pnormal.ComplementaryDistributionFunction(x: 1.4); // 0.000025712780793218926 /// double icdf = pnormal.InverseDistributionFunction(p: cdf); // 1.3999999999998953 /// /// double hf = pnormal.HazardFunction(x: 1.4); // 7.7870402470368854 /// double chf = pnormal.CumulativeHazardFunction(x: 1.4); // 10.568522382550167 /// /// string str = pnormal.ToString(); // PND(x; p = 4.2) /// </code> /// </example> /// [Serializable] public class PowerNormalDistribution : UnivariateContinuousDistribution { // Distribution parameters private double power = 1; // power (p) /// <summary> /// Constructs a Power Normal distribution /// with given power (shape) parameter. /// </summary> /// /// <param name="power">The distribution's power p.</param> /// public PowerNormalDistribution([Positive] double power) { if (power <= 0) throw new ArgumentOutOfRangeException("power", "Power must be positive."); initialize(power); } /// <summary> /// Gets the distribution shape (power) parameter. /// </summary> /// public double Power { get { return power; } } /// <summary> /// Not supported. /// </summary> /// public override double Mean { get { throw new NotSupportedException(); } } /// <summary> /// Not supported. /// </summary> /// public override double Median { get { throw new NotSupportedException(); } } /// <summary> /// Not supported. /// </summary> /// public override double Mode { get { throw new NotSupportedException(); } } /// <summary> /// Not supported. /// </summary> /// public override double Variance { get { throw new NotSupportedException(); } } /// <summary> /// Not supported. /// </summary> /// public override double StandardDeviation { get { throw new NotSupportedException(); } } /// <summary> /// Not supported. /// </summary> /// public override double Entropy { get { throw new NotSupportedException(); } } /// <summary> /// Gets the support interval for this distribution. /// </summary> /// /// <value> /// A <see cref="DoubleRange" /> containing /// the support interval for this distribution. /// </value> /// public override DoubleRange Support { get { return new DoubleRange(0, Double.PositiveInfinity); } } /// <summary> /// Gets the cumulative distribution function (cdf) for /// this distribution evaluated at point <c>x</c>. /// </summary> /// /// <param name="x"> /// A single point in the distribution range.</param> /// /// <remarks> /// The Cumulative Distribution Function (CDF) describes the cumulative /// probability that a given value or any value smaller than it will occur. /// </remarks> /// public override double DistributionFunction(double x) { double phi = Normal.Function(-x); return 1.0 - Math.Pow(phi, power); } /// <summary> /// Gets the inverse of the cumulative distribution function (icdf) for /// this distribution evaluated at probability <c>p</c>. This function /// is also known as the Quantile function. /// </summary> /// /// <remarks> /// The Inverse Cumulative Distribution Function (ICDF) specifies, for /// a given probability, the value which the random variable will be at, /// or below, with that probability. /// </remarks> /// /// <param name="p">A probability value between 0 and 1.</param> /// /// <returns>A sample which could original the given probability /// value when applied in the <see cref="DistributionFunction"/>.</returns> /// public override double InverseDistributionFunction(double p) { return Normal.Inverse(1.0 - Math.Pow(1.0 - p, 1.0 / power)); } /// <summary> /// Gets the probability density function (pdf) for /// this distribution evaluated at point <c>x</c>. /// </summary> /// /// <param name="x"> /// A single point in the distribution range.</param> /// /// <remarks> /// The Probability Density Function (PDF) describes the /// probability that a given value <c>x</c> will occur. /// </remarks> /// /// <returns> /// The probability of <c>x</c> occurring /// in the current distribution.</returns> /// public override double ProbabilityDensityFunction(double x) { double pdf = Normal.Derivative(x); double cdf = Normal.Function(-x); return power * pdf * Math.Pow(cdf, power - 1); } /// <summary> /// Gets the log-probability density function (pdf) for /// this distribution evaluated at point <c>x</c>. /// </summary> /// /// <param name="x"> /// A single point in the distribution range.</param> /// /// <remarks> /// The Probability Density Function (PDF) describes the /// probability that a given value <c>x</c> will occur. /// </remarks> /// /// <returns> /// The logarithm of the probability of <c>x</c> /// occurring in the current distribution.</returns> /// public override double LogProbabilityDensityFunction(double x) { return Math.Log(power) + Normal.LogDerivative(x) + (power - 1) * Normal.Function(-x); } /// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> /// public override object Clone() { return new PowerNormalDistribution(power); } /// <summary> /// Returns a <see cref="System.String"/> that represents this instance. /// </summary> /// /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> /// public override string ToString(string format, IFormatProvider formatProvider) { return String.Format(formatProvider, "PND(x; p = {0})", power.ToString(format, formatProvider)); } private void initialize(double power) { this.power = power; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class AttackDeflect : BattleAttack { [Header("反彈")] [Space(5)] [Range(0f, 3f)] public float speedMultiplier; public bool toOrigin; public GameObject projectileOnHitParticle; public AudioClip projectileOnHitSound; public override void Attack(GameObject attacker, Vector2 targetPosition, float holdTime) { base.Attack(attacker, targetPosition, holdTime); var col = Physics2D.OverlapCircleAll(attacker.transform.position, range); for (int i = 0; i < col.Length; i++) { if (col[i].gameObject.CompareTag("Projectile")) { Projectile proj = col[i].gameObject.GetComponent<Projectile>(); if (proj != null) { proj.LayerMask = LayerMask; proj.Position = attacker.transform.position; if (toOrigin && !proj.Attacker.Equals(attacker)) { proj.Deflect(speedMultiplier); proj.Attacker = attacker; } else { Vector2 direction = targetPosition - (Vector2)attacker.transform.position; proj.ChangeDirection(direction, false, false, speedMultiplier); proj.Attacker = attacker; } if (projectileOnHitParticle != null) { proj.particleOnDestroy = projectileOnHitParticle; } if (onHitSoundEffect != null) { proj.OnHitSoundEffect = projectileOnHitSound; } } } } } }
using System; using System.Collections.Generic; using System.Text; using System.Linq; namespace HackerRank_HomeCode { public class MaxMin { public void FindMindist() { int n = Convert.ToInt32(Console.ReadLine()); int k = Convert.ToInt32(Console.ReadLine()); int[] arr = new int[n]; for (int i = 0; i < n; i++) { int arrItem = Convert.ToInt32(Console.ReadLine()); arr[i] = arrItem; } var stredArray = arr.OrderBy(x => x).ToArray(); long mindist = Int64.MaxValue; if (k < n) { for (int i = 0; i <= n - k; i++) { mindist = Math.Min(stredArray[i + k - 1] - stredArray[i], mindist); } } else { mindist = stredArray[n - 1] - stredArray[0]; } Console.WriteLine($"Minum dist is {mindist}"); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class battleScript : MonoBehaviour { public enum BattleState { player1Phase1, player2Phase1, player1Phase2, player2Phase2 } public GameObject player1Prefab; public GameObject player2Prefab; GameObject player1; GameObject player2; public BattleState battleState; public float timer; public bool timerOn; public Text text; public generateCard[] cardHolders; public GameObject cardHolder1, cardHolder2, cardHolder3, cardHolder4, cardHolder5, cardHolder6, cardHolder7, cardHolder8, cardHolder9, cardHolder10, cardHolder11, cardHolder12, cardHolder13, cardHolder14; public GameObject extraCardHolder1, extraCardHolder2; public int countPlaysPlayer1 = 0; public int countPlaysPlayer2 = 0; public int totalCountPlaysPlayer1 = 3; public int totalCountPlaysPlayer2 = 3; void Start() { player1 = Instantiate(player1Prefab); player2 = Instantiate(player2Prefab); cardHolders = FindObjectsOfType<generateCard>(); extraCardHolder1 = GameObject.FindGameObjectWithTag("ECH1"); extraCardHolder2 = GameObject.FindGameObjectWithTag("ECH2"); foreach (var item in cardHolders) { if (item.gameObject.name == "CardHolder (1)") { cardHolder1 = item.gameObject; } else if (item.gameObject.name == "CardHolder (2)") { cardHolder2 = item.gameObject; } else if (item.gameObject.name == "CardHolder (3)") { cardHolder3 = item.gameObject; } else if (item.gameObject.name == "CardHolder (4)") { cardHolder4 = item.gameObject; } else if (item.gameObject.name == "CardHolder (5)") { cardHolder5 = item.gameObject; } else if (item.gameObject.name == "CardHolder (6)") { cardHolder6 = item.gameObject; } else if (item.gameObject.name == "CardHolder (7)") { cardHolder7 = item.gameObject; } else if (item.gameObject.name == "CardHolder (8)") { cardHolder8 = item.gameObject; } else if (item.gameObject.name == "CardHolder (9)") { cardHolder9 = item.gameObject; } else if (item.gameObject.name == "CardHolder (10)") { cardHolder10 = item.gameObject; } else if (item.gameObject.name == "CardHolder (11)") { cardHolder11 = item.gameObject; } else if (item.gameObject.name == "CardHolder (12)") { cardHolder12 = item.gameObject; } else if (item.gameObject.name == "CardHolder (13)") { cardHolder13 = item.gameObject; } else if (item.gameObject.name == "CardHolder (14)") { cardHolder14 = item.gameObject; } } CardHolderStatusPlayer1(); CardHolderStatusPlayer2(); cardHolder4.SetActive(false); cardHolder5.SetActive(false); cardHolder11.SetActive(false); cardHolder12.SetActive(false); extraCardHolder1.SetActive(false); extraCardHolder2.SetActive(false); StartCoroutine(Player1Phase1()); } IEnumerator Player1Phase1() { battleState = BattleState.player1Phase1; CardHolderStatusPlayer1(); yield return new WaitForSeconds(1f); if(totalCountPlaysPlayer1 != 5) { extraCardHolder1.SetActive(true); } if(totalCountPlaysPlayer1 == 3) { cardHolder4.SetActive(false); cardHolder5.SetActive(false); } else if(totalCountPlaysPlayer1 == 4) { cardHolder5.SetActive(false); } cardHolder6.SetActive(false); cardHolder7.SetActive(false); foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.generateRandomCard(); } } timer = 15; timerOn = true; yield return new WaitForSeconds(15f); foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.destroyCard(); } } timerOn = false; StartCoroutine(Player2Phase1()); } IEnumerator Player2Phase1() { battleState = BattleState.player2Phase1; CardHolderStatusPlayer2(); yield return new WaitForSeconds(1f); if(totalCountPlaysPlayer2 != 5) { extraCardHolder2.SetActive(true); } if (totalCountPlaysPlayer2 == 3) { cardHolder11.SetActive(false); cardHolder12.SetActive(false); } else if (totalCountPlaysPlayer2 == 4) { cardHolder12.SetActive(false); } cardHolder13.SetActive(false); cardHolder14.SetActive(false); foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.generateRandomCard(); } } timer = 15; timerOn = true; yield return new WaitForSeconds(15f); foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.destroyCard(); } } timerOn = false; StartCoroutine(Player1Phase2()); } IEnumerator Player1Phase2() { battleState = BattleState.player1Phase2; countPlaysPlayer1 = totalCountPlaysPlayer1; CardHolderStatusPlayer1(); yield return new WaitForSeconds(1f); cardHolder6.SetActive(true); cardHolder7.SetActive(true); foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.generateSpecificCard(); } } timer = 15; timerOn = true; yield return new WaitForSeconds(15f); foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.destroyCard(); } } timerOn = false; StartCoroutine(Player2Phase2()); } IEnumerator Player2Phase2() { battleState = BattleState.player2Phase2; countPlaysPlayer2 = totalCountPlaysPlayer2; CardHolderStatusPlayer2(); yield return new WaitForSeconds(1f); cardHolder13.SetActive(true); cardHolder14.SetActive(true); foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.generateSpecificCard(); } } timer = 15; timerOn = true; yield return new WaitForSeconds(15f); foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.destroyCard(); } } timerOn = false; StartCoroutine(Player1Phase1()); } public void CardHolderStatusPlayer1() { if(battleState == BattleState.player1Phase1) { if(totalCountPlaysPlayer1 == 3) { cardHolder1.transform.localPosition = new Vector3(-400, 65, 0); cardHolder2.transform.localPosition = new Vector3(-400, 20, 0); cardHolder3.transform.localPosition = new Vector3(-400, -25, 0); extraCardHolder1.transform.localPosition = new Vector3(-400, -67, 0); } else if (totalCountPlaysPlayer1 == 4) { cardHolder1.transform.localPosition = new Vector3(-400, 100, 0); cardHolder2.transform.localPosition = new Vector3(-400, 55, 0); cardHolder3.transform.localPosition = new Vector3(-400, 10, 0); cardHolder4.transform.localPosition = new Vector3(-400, -35, 0); extraCardHolder1.transform.localPosition = new Vector3(-400, -77, 0); cardHolder4.SetActive(true); } else if (totalCountPlaysPlayer1 == 5) { cardHolder1.transform.localPosition = new Vector3(-400, 110, 0); cardHolder2.transform.localPosition = new Vector3(-400, 65, 0); cardHolder3.transform.localPosition = new Vector3(-400, 20, 0); cardHolder4.transform.localPosition = new Vector3(-400, -25, 0); cardHolder5.transform.localPosition = new Vector3(-400, -70, 0); cardHolder5.SetActive(true); } } else if (battleState == BattleState.player1Phase2) { cardHolder1.transform.localPosition = new Vector3(-400, 55, 0); cardHolder2.transform.localPosition = new Vector3(-400, -35, 0); cardHolder3.transform.localPosition = new Vector3(-315, 10, 0); cardHolder4.transform.localPosition = new Vector3(-400, 10, 0); cardHolder6.transform.localPosition = new Vector3(-315, 55, 0); cardHolder7.transform.localPosition = new Vector3(-315, -35, 0); cardHolder4.SetActive(true); } } public void CardHolderStatusPlayer2() { if (battleState == BattleState.player2Phase1) { if(totalCountPlaysPlayer2 == 3) { cardHolder8.transform.localPosition = new Vector3(400, 65, 0); cardHolder9.transform.localPosition = new Vector3(400, 20, 0); cardHolder10.transform.localPosition = new Vector3(400, -25, 0); extraCardHolder2.transform.localPosition = new Vector3(400, -67, 0); } else if (totalCountPlaysPlayer2 == 4) { cardHolder8.transform.localPosition = new Vector3(400, 100, 0); cardHolder9.transform.localPosition = new Vector3(400, 55, 0); cardHolder10.transform.localPosition = new Vector3(400, 10, 0); cardHolder11.transform.localPosition = new Vector3(400, -35, 0); extraCardHolder2.transform.localPosition = new Vector3(400, -77, 0); cardHolder11.SetActive(true); } else if (totalCountPlaysPlayer2 == 5) { cardHolder8.transform.localPosition = new Vector3(400, 110, 0); cardHolder9.transform.localPosition = new Vector3(400, 65, 0); cardHolder10.transform.localPosition = new Vector3(400, 20, 0); cardHolder11.transform.localPosition = new Vector3(400, -25, 0); cardHolder12.transform.localPosition = new Vector3(400, -70, 0); cardHolder12.SetActive(true); } } else if(battleState == BattleState.player2Phase2) { cardHolder8.transform.localPosition = new Vector3(400, -35, 0); cardHolder9.transform.localPosition = new Vector3(400, 55, 0); cardHolder10.transform.localPosition = new Vector3(315, 10, 0); cardHolder11.transform.localPosition = new Vector3(400, 10, 0); cardHolder13.transform.localPosition = new Vector3(315, -35, 0); cardHolder14.transform.localPosition = new Vector3(315, 55, 0); cardHolder11.SetActive(true); } } public void EndTurn() { if (battleState == BattleState.player1Phase1) { foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.destroyCard(); } } extraCardHolder1.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player2Phase1()); } else if (battleState == BattleState.player2Phase1) { foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.destroyCard(); } } extraCardHolder2.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player1Phase2()); } else if (battleState == BattleState.player1Phase2) { foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.destroyCard(); } } extraCardHolder1.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player2Phase2()); } else if (battleState == BattleState.player2Phase2) { foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.destroyCard(); } } extraCardHolder2.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player1Phase1()); } } public void OnCardClick() { if (battleState == BattleState.player1Phase1) { foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.destroyCard(); } } extraCardHolder1.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player2Phase1()); } else if (battleState == BattleState.player2Phase1) { foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.destroyCard(); } } extraCardHolder2.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player1Phase2()); } else if (battleState == BattleState.player1Phase2) { if (countPlaysPlayer1 > 1) { countPlaysPlayer1--; } else { foreach (var item in cardHolders) { if (item.tag == "Player1Cards") { item.destroyCard(); } } extraCardHolder1.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player2Phase2()); } } else if (battleState == BattleState.player2Phase2) { if (countPlaysPlayer2 > 1) { countPlaysPlayer2--; } else { foreach (var item in cardHolders) { if (item.tag == "Player2Cards") { item.destroyCard(); } } extraCardHolder2.SetActive(false); StopAllCoroutines(); timerOn = false; StartCoroutine(Player1Phase1()); } } } private void Update() { if (battleState == BattleState.player1Phase1 || battleState == BattleState.player1Phase2) { Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, new Vector3(-2.4f, 0, -1), Time.deltaTime * 5); } else if (battleState == BattleState.player2Phase1 || battleState == BattleState.player2Phase2) { Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, new Vector3(2.4f, 0, -1), Time.deltaTime * 5); } if (timerOn) { timer -= Time.deltaTime; text.text = Mathf.Ceil(timer).ToString(); } else { text.text = ""; } if (player1.GetComponent<moveScript>().onDefense && battleState == BattleState.player1Phase2) { player1.GetComponent<cardScript>().disableCards(); } else if (battleState == BattleState.player1Phase2 || battleState == BattleState.player1Phase1) { player1.GetComponent<cardScript>().enableCards(); } if (player2.GetComponent<moveScript>().onDefense && battleState == BattleState.player2Phase2) { player2.GetComponent<cardScript>().disableCards(); } else if (battleState == BattleState.player2Phase2 || battleState == BattleState.player2Phase1) { player2.GetComponent<cardScript>().enableCards(); } } }
using System; using System.ComponentModel.DataAnnotations; namespace esstp.Models.ViewModels { public class PortfolioPageViewModel { public int Id { get; set; } //portfolio public string Position { get; set; } //portfolio public string Name { get; set; } //market public string Symbol { get; set; } //market public double Units { get; set; } //market public double ValueOpen { get; set; } //portfolio [DisplayFormat(DataFormatString = "{0:N2}")] //[Display(Name = "EUR")] public double Invested { get; set; } //portfolio [DisplayFormat(DataFormatString = "{0:N2}")] public double CurrentProfit { get; set; } // portfolio.valuopen / market.current [DisplayFormat(DataFormatString = "{0:N2}")] public double CurrentInvested { get; set; } //portfolio.invested * currentprofit [DisplayFormat(DataFormatString = "{0:N2}")] public double Current { get; set; } //market.current } }
namespace ChainOfResponsibility { using System; public class Euro50Dispenser : Dispenser { private readonly int noteValue = 50; public override void Dispense(Currency currency) { int requestAmount = currency.GetAmount(); if (requestAmount >= this.noteValue) { int amount = requestAmount / this.noteValue; int remainder = requestAmount % this.noteValue; Console.WriteLine($"Dispensing : { amount } x {this.noteValue} = {amount * this.noteValue} Euro"); if (remainder != 0) { this.Successor.Dispense(new Currency(remainder)); } } else { this.Successor.Dispense(currency); } } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Humain { public enum Building { House, Casern, Farm } public enum Unite { Farmer, Soldier } }
namespace Meziantou.Analyzer.Rules; internal enum OptimizeLinqUsageData { None, UseLengthProperty, UseLongLengthProperty, UseCountProperty, UseFindMethod, UseFindMethodWithConversion, UseIndexer, UseIndexerFirst, UseIndexerLast, DuplicatedOrderBy, CombineWhereWithNextMethod, UseFalse, UseTrue, UseAny, UseNotAny, UseTakeAndCount, UseSkipAndNotAny, UseSkipAndAny, UseCastInsteadOfSelect, UseTrueForAllMethod, UseTrueForAllMethodWithConversion, UseExistsMethod, UseExistsMethodWithConversion, }
using System; using UnityEngine; public class ImageScrollRect : MonoBehaviour { private const float SlideTime = 0.25f; private const float HoldTime = 3f; public Rect _rect; public Texture2D[] _images; private float _time; private int _index; private RenderTexture _target; private void Start() { } private void Update() { int num = Mathf.FloorToInt((float)Screen.get_width() * this._rect.get_width()); int num2 = Mathf.FloorToInt((float)Screen.get_height() * this._rect.get_height()); if (this._target != null && (this._target.get_width() != num || this._target.get_height() != num2)) { RenderTexture.ReleaseTemporary(this._target); this._target = null; } if (this._target == null) { this._target = RenderTexture.GetTemporary(num, num2); } this._time += Time.get_deltaTime(); if (this._time >= 3.25f) { this._time = 0f; this._index = (this._index + 1) % this._images.Length; } float num3 = Mathf.Clamp01(this._time / 0.25f); RenderTexture active = RenderTexture.get_active(); RenderTexture.set_active(this._target); Texture2D texture2D = this._images[this._index]; GL.PushMatrix(); GL.LoadPixelMatrix(0f, (float)this._target.get_width(), (float)this._target.get_height(), 0f); Graphics.DrawTexture(new Rect((float)(-(float)this._target.get_width()) * (1f - num3), 0f, (float)this._target.get_width(), (float)this._target.get_height()), texture2D); GL.PopMatrix(); RenderTexture.set_active(active); } private void OnGUI() { if (this._target == null) { return; } GUI.set_depth(-4); Rect rect = this._rect; rect.set_x(rect.get_x() * (float)Screen.get_width()); rect.set_width(rect.get_width() * (float)Screen.get_width()); rect.set_y(rect.get_y() * (float)Screen.get_height()); rect.set_height(rect.get_height() * (float)Screen.get_height()); GUI.DrawTexture(rect, this._target); } }
namespace Triton.Game.Mapping { using ns26; using System; using Triton.Game; using Triton.Game.Mono; [Attribute38("BnetBar")] public class BnetBar : MonoBehaviour { public BnetBar(IntPtr address) : this(address, "BnetBar") { } public BnetBar(IntPtr address, string className) : base(address, className) { } public void Awake() { base.method_8("Awake", Array.Empty<object>()); } public void DestroyLoginTooltip() { base.method_8("DestroyLoginTooltip", Array.Empty<object>()); } public void Disable() { base.method_8("Disable", Array.Empty<object>()); } public void Enable() { base.method_8("Enable", Array.Empty<object>()); } public static BnetBar Get() { return MonoClass.smethod_15<BnetBar>(TritonHs.MainAssemblyPath, "", "BnetBar", "Get", Array.Empty<object>()); } public bool HandleEscapeKey() { return base.method_11<bool>("HandleEscapeKey", Array.Empty<object>()); } public bool HandleKeyboardInput() { return base.method_11<bool>("HandleKeyboardInput", Array.Empty<object>()); } public void HideFriendList() { base.method_8("HideFriendList", Array.Empty<object>()); } public bool IsEnabled() { return base.method_11<bool>("IsEnabled", Array.Empty<object>()); } public void OnDestroy() { base.method_8("OnDestroy", Array.Empty<object>()); } public void OnFatalError(FatalErrorMessage message, object userData) { object[] objArray1 = new object[] { message, userData }; base.method_8("OnFatalError", objArray1); } public void OnFriendButtonReleased(UIEvent e) { object[] objArray1 = new object[] { e }; base.method_8("OnFriendButtonReleased", objArray1); } public void OnLoggedIn() { base.method_8("OnLoggedIn", Array.Empty<object>()); } public void OnMenuButtonReleased(UIEvent e) { object[] objArray1 = new object[] { e }; base.method_8("OnMenuButtonReleased", objArray1); } public void OnSceneLoaded(SceneMgr.Mode mode, Scene scene, object userData) { object[] objArray1 = new object[] { mode, scene, userData }; base.method_8("OnSceneLoaded", objArray1); } public void PositionCurrencyFrame(GameObject parent, Vector3 offset) { object[] objArray1 = new object[] { parent, offset }; base.method_8("PositionCurrencyFrame", objArray1); } public void ShowFriendList() { base.method_8("ShowFriendList", Array.Empty<object>()); } public void ShowGameMenu(string name, GameObject go, object callbackData) { object[] objArray1 = new object[] { name, go, callbackData }; base.method_8("ShowGameMenu", objArray1); } public static void SpectatorCount_OnRollout(UIEvent evt) { object[] objArray1 = new object[] { evt }; MonoClass.smethod_18(TritonHs.MainAssemblyPath, "", "BnetBar", "SpectatorCount_OnRollout", objArray1); } public static void SpectatorCount_OnRollover(UIEvent evt) { object[] objArray1 = new object[] { evt }; MonoClass.smethod_18(TritonHs.MainAssemblyPath, "", "BnetBar", "SpectatorCount_OnRollover", objArray1); } public void Start() { base.method_8("Start", Array.Empty<object>()); } public void SuppressLoginTooltip(bool val) { object[] objArray1 = new object[] { val }; base.method_8("SuppressLoginTooltip", objArray1); } public void ToggleActive(bool active) { object[] objArray1 = new object[] { active }; base.method_8("ToggleActive", objArray1); } public void ToggleEnableButtons(bool enabled) { object[] objArray1 = new object[] { enabled }; base.method_8("ToggleEnableButtons", objArray1); } public void ToggleFriendListShowing() { base.method_8("ToggleFriendListShowing", Array.Empty<object>()); } public void ToggleFriendsButton(bool enabled) { object[] objArray1 = new object[] { enabled }; base.method_8("ToggleFriendsButton", objArray1); } public void ToggleGameMenu() { base.method_8("ToggleGameMenu", Array.Empty<object>()); } public void Update() { base.method_8("Update", Array.Empty<object>()); } public void UpdateForDemoMode() { base.method_8("UpdateForDemoMode", Array.Empty<object>()); } public void UpdateForPhone() { base.method_8("UpdateForPhone", Array.Empty<object>()); } public void UpdateLayout() { base.method_8("UpdateLayout", Array.Empty<object>()); } public void UpdateLoginTooltip() { base.method_8("UpdateLoginTooltip", Array.Empty<object>()); } public void WillReset() { base.method_8("WillReset", Array.Empty<object>()); } public static int CameraDepth { get { return MonoClass.smethod_6<int>(TritonHs.MainAssemblyPath, "", "BnetBar", "CameraDepth"); } } public Flipbook m_batteryLevel { get { return base.method_3<Flipbook>("m_batteryLevel"); } } public Flipbook m_batteryLevelPhone { get { return base.method_3<Flipbook>("m_batteryLevelPhone"); } } public ConnectionIndicator m_connectionIndicator { get { return base.method_3<ConnectionIndicator>("m_connectionIndicator"); } } public CurrencyFrame m_currencyFrame { get { return base.method_3<CurrencyFrame>("m_currencyFrame"); } } public UberText m_currentTime { get { return base.method_3<UberText>("m_currentTime"); } } public BnetBarFriendButton m_friendButton { get { return base.method_3<BnetBarFriendButton>("m_friendButton"); } } public GameMenu m_gameMenu { get { return base.method_3<GameMenu>("m_gameMenu"); } } public bool m_gameMenuLoading { get { return base.method_2<bool>("m_gameMenuLoading"); } } public bool m_hasUnacknowledgedPendingInvites { get { return base.method_2<bool>("m_hasUnacknowledgedPendingInvites"); } } public float m_initialConnectionIndicatorScaleX { get { return base.method_2<float>("m_initialConnectionIndicatorScaleX"); } } public float m_initialFriendButtonScaleX { get { return base.method_2<float>("m_initialFriendButtonScaleX"); } } public float m_initialMenuButtonScaleX { get { return base.method_2<float>("m_initialMenuButtonScaleX"); } } public float m_initialWidth { get { return base.method_2<float>("m_initialWidth"); } } public bool m_isEnabled { get { return base.method_2<bool>("m_isEnabled"); } } public bool m_isInitting { get { return base.method_2<bool>("m_isInitting"); } } public bool m_isLoggedIn { get { return base.method_2<bool>("m_isLoggedIn"); } } public float m_lastClockUpdate { get { return base.method_2<float>("m_lastClockUpdate"); } } public float m_lightingBlend { get { return base.method_2<float>("m_lightingBlend"); } } public GameObject m_loginTooltip { get { return base.method_3<GameObject>("m_loginTooltip"); } } public BnetBarMenuButton m_menuButton { get { return base.method_3<BnetBarMenuButton>("m_menuButton"); } } public GameObject m_menuButtonMesh { get { return base.method_3<GameObject>("m_menuButtonMesh"); } } public GameObject m_questProgressToastBone { get { return base.method_3<GameObject>("m_questProgressToastBone"); } } public GameObject m_socialToastBone { get { return base.method_3<GameObject>("m_socialToastBone"); } } public GameObject m_spectatorCountPanel { get { return base.method_3<GameObject>("m_spectatorCountPanel"); } } public string m_spectatorCountPrefabPath { get { return base.method_4("m_spectatorCountPrefabPath"); } } public TooltipZone m_spectatorCountTooltipZone { get { return base.method_3<TooltipZone>("m_spectatorCountTooltipZone"); } } public GameObject m_spectatorModeIndicator { get { return base.method_3<GameObject>("m_spectatorModeIndicator"); } } public string m_spectatorModeIndicatorPrefab { get { return base.method_4("m_spectatorModeIndicatorPrefab"); } } public bool m_suppressLoginTooltip { get { return base.method_2<bool>("m_suppressLoginTooltip"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using Aga.Controls.Tree; using System.Drawing; namespace DBManager { public class treeItem : Node { public string nodeText {get; set;} public string fieldType { get; set; } public string fieldSize { get; set; } public bool allowNull { get; set; } public ImageList imageList { get; set; } internal int _imageIndex; //{ get; set; } public Bitmap nodeIcon { get; set; } public bool nodeCheck { get; set; } public string fieldTypeInternal { get; set; } public treeItem(string nodeText, string fieldType, string fieldSize, bool allowNull, bool nodeCheck, string fieldTypeInternal,int imgIndex, ImageList imgList) { this.nodeText = nodeText; this.fieldType = fieldType; this.fieldSize = fieldSize; this.allowNull = allowNull; this.nodeCheck = nodeCheck; this.fieldTypeInternal = fieldTypeInternal; this.imageList = imgList; this.imageIndex = imgIndex; } public int imageIndex { get { return _imageIndex; } set { _imageIndex = value; nodeIcon = new Bitmap(imageList.Images[value]); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BPiaoBao.Cashbag.Domain.Models { public class ReadyAccount { /// <summary> /// 现金账户余额 /// </summary> public decimal ReadyBalance { get; set; } /// <summary> /// 冻结金额 /// </summary> public decimal FreezeAmount { get; set; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="InventoryReportsController.cs" company="Eyefinity, Inc."> // Eyefinity, Inc. - 2013 // </copyright> // <summary> // Defines the SalesReportsController type. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace Eyefinity.PracticeManagement.Controllers.Api { using System; using System.Net; using System.Net.Http; using System.Web.Http; using Eyefinity.Enterprise.Business.Reports; using Eyefinity.PracticeManagement.Common; using Eyefinity.PracticeManagement.Common.Api; using Eyefinity.PracticeManagement.Model.Reports; /// <summary> /// The sales reports controller. /// </summary> [NoCache] [Authorize] [ValidateHttpAntiForgeryToken] public class InventoryReportsController : ApiController { /// <summary>The logger</summary> private static readonly log4net.ILog Logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); /// <summary> /// The it 2 manager. /// </summary> private readonly InventoryReportsIt2Manager it2Manager; /// <summary> /// Initializes a new instance of the <see cref="SalesReportsController"/> class. /// </summary> public InventoryReportsController() { this.it2Manager = new InventoryReportsIt2Manager(); } /// <summary> /// The get. /// </summary> /// <param name="officeNumber"> /// The office number. /// </param> /// <param name="report"> /// The report. /// </param> /// <returns> /// The <see cref="SalesReportCriteria"/>. /// </returns> public HttpResponseMessage Get(string officeNumber, string report) { try { AccessControl.VerifyUserAccessToOffice(officeNumber); } catch (Exception ex) { var message = ex.Message; const string ValidationString = "You do not have security permission to access this area.<br/><br/> " + "Please contact your Office Manager or Office Administrator if you believe this is an error."; return this.Request.CreateResponse(HttpStatusCode.Forbidden, new { validationmessage = ValidationString }); } try { return Request.CreateResponse(HttpStatusCode.OK, this.it2Manager.GetReportCriteria(officeNumber, report)); } catch (Exception ex) { var msg = string.Format("Get(officeNumber = {0}, {1}, {2}", officeNumber, "\n", ex); return HandleExceptions.LogExceptions(msg, Logger, ex); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; namespace QuickCollab.Security { public class PasswordHashService { private Random _random; public PasswordHashService() { _random = new Random(DateTime.Now.Millisecond); } public string SaltedPassword(string password, string salt) { SHA256 sha = new SHA256Managed(); byte[] hash = sha.ComputeHash(Encoding.ASCII.GetBytes(password + salt)); StringBuilder stringBuilder = new StringBuilder(); foreach (byte b in hash) { stringBuilder.AppendFormat("{0:x2}", b); } return stringBuilder.ToString(); } public string GetNewSalt() { StringBuilder builder = new StringBuilder(16); for (int i = 0; i < 16; i++) { builder.Append((char)_random.Next(33, 126)); } return builder.ToString(); } } }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public interface TutorialPart { bool IsDone(); void Play(); }
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using MediatR; using VehicleManagement.Application.Common.Interfaces; using VehicleManagement.Domain.Entities; namespace VehicleManagement.Application.Queries.Brands { public static class GetBrandById { public record Query(Guid Id) : IRequest<Response>; public class Handler : IRequestHandler<Query, Response> { private readonly IBrandRepository _repository; public Handler(IBrandRepository repository) { _repository = repository; } public async Task<Response> Handle(Query request, CancellationToken cancellationToken) { var brand = await _repository.FindById(request.Id); return brand == null ? null : new Response(brand.Id, brand.Name); } } public record Response(Guid Id, string Name); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; public class MoveObject : MonoBehaviour { public Vector3 endPoint; private Vector3 originPoint; bool isOrigin; Rigidbody rigidbody; private void Start() { originPoint = transform.position; endPoint = transform.position + endPoint; rigidbody = GetComponent<Rigidbody>(); } public void Move() { isOrigin = !isOrigin; if (isOrigin) { Sequence sequence = DOTween.Sequence(); sequence.OnStart(() => rigidbody.velocity = Vector3.zero); sequence.Append(transform.DOMove(endPoint, 5f).SetEase(Ease.InOutSine)); sequence.OnComplete(() => rigidbody.velocity = Vector3.zero); } else { Sequence sequence = DOTween.Sequence(); sequence.OnStart(()=>rigidbody.velocity=Vector3.zero); transform.DOMove(originPoint, 5f).SetEase(Ease.InOutSine); sequence.OnComplete(() => rigidbody.velocity = Vector3.zero); } } private void OnDrawGizmos() { Gizmos.DrawSphere(transform.position + endPoint, 1f); } }
using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlServerCe; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace Switchex { public class Profile { public static int newProfileID { get; set; } public string ProfileName { get; set; } public string ProfilePath { get; set; } public string ProfileDesc { get; set; } public int ProfileType { get; set; } public bool ProfileDefault { get; set; } public int ProfileID { get; set; } public Profile(bool isNew, int id) { try { using(SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.switchexConnectionString)) { using(SqlCeCommand cmd = new SqlCeCommand("", conn)) { if(isNew) { int nextNew = 1; conn.Open(); foreach(Profile profile in Globals.profiles) { if(profile.ProfileName.Contains("New Profile ") && profile.ProfileName.Length >= 13) { if(Convert.ToInt32(profile.ProfileName.Substring(12)) == nextNew) { nextNew = Convert.ToInt32(profile.ProfileName.Substring(12)) + 1; } } } ProfileName = "New Profile " + nextNew; ProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); ProfileDesc = "A blank profile."; ProfileType = 32; cmd.CommandText = "INSERT INTO Profiles (ProfileName, ProfilePath, ProfileDescription, ProfileType) " + "VALUES (@name, @path, @desc, @type)"; cmd.Parameters.AddWithValue("@name", ProfileName); cmd.Parameters.AddWithValue("@path", ProfilePath); cmd.Parameters.AddWithValue("@desc", ProfileDesc); cmd.Parameters.AddWithValue("@type", ProfileType); cmd.ExecuteNonQuery(); cmd.CommandText = "SELECT @@IDENTITY"; ProfileID = Convert.ToInt32(cmd.ExecuteScalar()); } else { cmd.CommandText = "SELECT * FROM Profiles WHERE ID=@id"; cmd.Parameters.AddWithValue("@id", id); using(DataSet ds = new DataSet()) { using(SqlCeDataAdapter adapter = new SqlCeDataAdapter(cmd)) { adapter.SelectCommand = cmd; adapter.Fill(ds); foreach(DataRow row in ds.Tables[0].Rows) { ProfileID = Convert.ToInt32(row.ItemArray[0]); ProfileName = row.ItemArray[1].ToString(); ProfilePath = row.ItemArray[2].ToString(); ProfileDesc = row.ItemArray[3].ToString(); ProfileType = Convert.ToInt32(row.ItemArray[4]); ProfileDefault = (bool)row.ItemArray[5]; } } } } } } } catch(Exception ex) { Globals.frmError.ShowDialog(ex); } } /// <summary> /// Edit the profile. /// </summary> /// <param name="id">The ID of the profile</param> /// <param name="name">The name of the profile (Optional)</param> /// <param name="path">The path of the profile (Optional)</param> /// <param name="desc">The description of the profile (Optional)</param> /// <param name="type">The type of profile (Optional)</param> /// <param name="isDefault">If the profile is the default or not (Optional)</param> public void EditProfile(int id, string name = null, string path = null, string desc = null, int type = 0, bool isDefault = false) { string oldName = null; if(name != null) { oldName = ProfileName; ProfileName = name; } if(path != null) ProfilePath = path; if(desc != null) ProfileDesc = desc; if(type != 0) ProfileType = type; ProfileDefault = isDefault; try { using(SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.switchexConnectionString)) { using(SqlCeCommand cmd = new SqlCeCommand("UPDATE Profiles SET ProfileName=@name, ProfilePath=@path, ProfileDescription=@desc, " + "ProfileType=@type, ProfileDefault=@default WHERE ID=@id", conn)) { cmd.Parameters.AddWithValue("@name", ProfileName); cmd.Parameters.AddWithValue("@path", ProfilePath); cmd.Parameters.AddWithValue("@desc", ProfileDesc); cmd.Parameters.AddWithValue("@type", ProfileType); cmd.Parameters.AddWithValue("@default", (ProfileDefault ? 1 : 0)); cmd.Parameters.AddWithValue("@id", id); conn.Open(); cmd.ExecuteNonQuery(); if(name != null && oldName != null) { cmd.CommandText = "UPDATE Servers SET ServerProfile=@name WHERE ServerProfile=@old"; cmd.Parameters.AddWithValue("@old", oldName); cmd.ExecuteNonQuery(); } } } } catch(Exception ex) { Globals.frmError.ShowDialog(ex); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FuzzyLogic.Operations { public class Union : IBinaryOperation { public double Operate(double operand1, double operand2) => Math.Max(operand1, operand2); } }
using Requestrr.WebApi.config; using Requestrr.WebApi.RequestrrBot; namespace Requestrr.WebApi.Controllers.ChatClients { public class BotClientSettingsProvider { public BotClientSettings Provide() { dynamic settings = SettingsFile.Read(); return new BotClientSettings { Client = (string)settings.BotClient.Client, }; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class LevelGeneratorManager : MonoBehaviour { public float[,] positions; public float[,] scales; public float[] zRotations; public string[] names; public int levelHeight; public int Save(Collider2D[] objects, int passedLevelHeight) { GetData(objects, passedLevelHeight); return save.SaveLevel(this); } void GetData(Collider2D[] objects, int passedLevelHeight) { positions = new float[objects.Length, 2]; scales = new float[objects.Length, 2]; zRotations = new float[objects.Length]; names = new string[objects.Length]; levelHeight = passedLevelHeight; for (int x = 0; x < objects.Length; x++) { names[x] = objects[x].gameObject.name; positions[x, 0] = objects[x].gameObject.transform.position.x; positions[x, 1] = objects[x].gameObject.transform.position.y; scales[x, 0] = objects[x].gameObject.transform.localScale.x; scales[x, 1] = objects[x].gameObject.transform.localScale.y; zRotations[x] = objects[x].gameObject.transform.rotation.eulerAngles.z; } } public void ResetLevel() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }
using System; using System.Collections.Generic; using System.IO; using System.Text; namespace kamidori_asm { class CompileScript { struct Label { public string label; public int id; // so i can reuse this struct for the string labels. being lazy a bit here public long offset; }; static CustomBinaryReader curScript; static BinaryWriter outScript; static string headerString = "", textFile = ""; static long headerSize = 0; static long curBaseLength = 0; static Dictionary<string, long> labels = new Dictionary<string, long>(); static List<Label> fixLabels = new List<Label>(); static List<Label> fixStaticInts = new List<Label>(); static List<Label> strings = new List<Label>(); // we must index these 3 calls and write them at the end of the script, so make a list for them static List<int> staticIntList = new List<int>(); static List<long> u0041a7b0List = new List<long>(); static List<long> u00417d60List = new List<long>(); static List<long> callList = new List<long>(); static int checkText = 0, newLines = 0, newLinesID = 0; public static void Compile(string sourceScript, string outputScript) { InitCommands(); curScript = new CustomBinaryReader(sourceScript); outScript = new BinaryWriter(File.Create(outputScript)); if (curBaseLength == 0) // uninitialized curBaseLength = curScript.Length; ReadHeader(); ReadStrings(textFile); while (!curScript.IsEOF()) { if (curScript.PeekChar() == '(') // command { Match('('); int command = GetCommand(); if (command == commandList["show-text"]) { checkText = 1; } else if (command == commandList["u004252d0"]) { checkText = 2; } else { checkText = 0; newLines = 0; } //Console.WriteLine(command); while (!curScript.IsEOF() && curScript.PeekChar() != ')') { SkipWhitespace(); if (curScript.PeekChar() == '(') { ParseParens(); } else if (curScript.PeekChar() == '#') { int num = GetNumber(); outScript.Write(0); outScript.Write(num); } else { Label l = new Label(); l.label = GetNext(); l.offset = outScript.BaseStream.Position + 4; // skip type fixLabels.Add(l); outScript.Write(0); outScript.Write(0); } } Match(')'); } else // label { string label = GetNext(); if (!String.IsNullOrWhiteSpace(label)) { /* Label l = new Label(); l.label = label.TrimEnd(':'); l.offset = outScript.BaseStream.Position; */ /* Console.WriteLine("Label: " + label); Environment.Exit(1); */ labels.Add(label.TrimEnd(':'), outScript.BaseStream.Position); } } if (checkText == 1 && newLines > 0) // show-text { //Console.WriteLine("New lines 1: " + newLines); // simulate a \n by writing an end-text-line for the linebreak and then show-text to write the remaining text lines int id = newLinesID; for (int i = 0; i < newLines; i++) { // (wait-for-input #x0) outScript.Write(commandList["end-text-line"]); outScript.Write((int)0); outScript.Write((int)0); // (show-text #x0 (external-string (string num))) outScript.Write(commandList["show-text"]); outScript.Write((int)0); outScript.Write((int)0); Label l = new Label(); l.id = id; l.offset = outScript.BaseStream.Position + 4; // +4 to skip to the actual address we need to write strings.Add(l); outScript.Write(GetType("external-string")); outScript.Write((int)0); id++; } checkText = 0; newLines = 0; } else if (checkText == 2 && newLines > 0) // u004252d0 { //Console.WriteLine("New lines 2: " + newLines); // simulate a \n by writing an end-text-line for the linebreak and then show-text to write the remaining text lines int id = newLinesID; for (int i = 0; i < newLines; i++) { // (show-text #x0 (external-string (string num))) outScript.Write(commandList["u004252d0"]); outScript.Write(GetType("global-string-1")); outScript.Write(0x6A39); Label l = new Label(); l.id = id; l.offset = outScript.BaseStream.Position + 4; // +4 to skip to the actual address we need to write strings.Add(l); outScript.Write(GetType("external-string")); outScript.Write((int)0); id++; } checkText = 0; newLines = 0; } //Environment.Exit(1); } // end while for (int i = 0; i < fixLabels.Count; i++) { Label l = fixLabels[i]; if (labels.ContainsKey(l.label)) { outScript.BaseStream.Seek(l.offset, SeekOrigin.Begin); outScript.Write((int)(labels[l.label] - headerSize) / 4); } else { Console.WriteLine("Unknown label: " + l.label + " " + l.offset); Environment.Exit(1); } } WriteStrings(); outScript.Seek(0, SeekOrigin.End); long baseOffset = outScript.BaseStream.Position - 0x3c; for (int i = 0; i < fixStaticInts.Count; i++) { outScript.BaseStream.Seek(fixStaticInts[i].offset, SeekOrigin.Begin); outScript.Write(((fixStaticInts[i].id * 4) + (int)baseOffset) / 4); // fix static integer reference } outScript.Seek(0, SeekOrigin.End); for (int i = 0; i < staticIntList.Count; i++) { outScript.Write(staticIntList[i]); } outScript.Seek(0x24, SeekOrigin.Begin); outScript.Write(u0041a7b0List.Count); outScript.Write((int)((outScript.BaseStream.Length - headerSize) / 4)); outScript.Seek(0, SeekOrigin.End); for (int i = 0; i < u0041a7b0List.Count; i++) { outScript.Write((int)((u0041a7b0List[i] - headerSize) / 4)); } outScript.Seek(0x2c, SeekOrigin.Begin); outScript.Write(u00417d60List.Count); outScript.Write((int)((outScript.BaseStream.Length - headerSize) / 4)); outScript.Seek(0, SeekOrigin.End); for (int i = 0; i < u00417d60List.Count; i++) { outScript.Write((int)((u00417d60List[i] - headerSize) / 4)); } outScript.Seek(0x34, SeekOrigin.Begin); outScript.Write(callList.Count); outScript.Write((int)((outScript.BaseStream.Length - headerSize) / 4)); outScript.Seek(0, SeekOrigin.End); for (int i = 0; i < callList.Count; i++) { outScript.Write((int)((callList[i] - headerSize) / 4)); } curScript.Close(); outScript.Close(); } /* From ViruX's code: (defstruct header signature ; char[8] - 'SYS4415' local-variable-counts ; int[6] ; ^ ; 0 - local integers 1 ? +523A4h ( inited to encrypted null - or decrypted, if one disables it ) - table used in case 9 - int-table-3 ; 1 - local floats ? +523A8h - same as 0 - case 10 - float-table2 ; 2 - local strings 1 ? +523ACh ( 3-4 string pointers are inited? hardcoded.) - case 11 - dyn-string-table3 ; 3 - local integers 2 ? +523B0 - same as other ints - table used in case 12 - same number is used again, to init : +523E8+i*4 - int-table-4 ; 4 - ints ? +523B4 - same - unused or different table - again, used again ^ ; 5 - local strings 2 ? +523B8 - same - case 14 - used again ^ - dyn-string-table-4 ;static-variable-header-size ; int, unsure about name, 1C static-data/code-offsets ; size/4, or int[6] ; ^ - probably offsets to those 3 special instruction types (calls and ...) ; 0 - size of offset table 1 ; 1 - offset table 1 offset ; 2 - size of offset table 2 ; 3 - offset table 2 offset ; 4 - size of offset table 3 ; 5 - offset table 3 offset static-integers ; not part of the header, but actually the footer, but since this structure here is not a file header, but a general script header... external-string-file ; not part of the real header at all, but present in case if *store-strings-in-external-file* is set ) */ static void ReadHeader() { string s = GetNext(); if (s == "#S") { Match('('); Match("header"); for(;;) { if (curScript.PeekChar() == ')') break; s = GetNext(); if (s == ":signature") { headerString = GetString(); outScript.Write(headerString.ToCharArray(), 0, headerString.Length); headerSize += headerString.Length; } else if (s == ":local-variable-counts") { Match('('); int local_integers_1 = 0; int local_floats = 0; int local_strings_1 = 0; int local_integers_2 = 0; int unknown_ints = 0; int local_strings_2 = 0; while (curScript.PeekChar() != ')') { s = GetNext(); if (s == ":local-integers-1") local_integers_1 = GetNumber(); else if (s == ":local-strings-1") local_strings_1 = GetNumber(); else if (s == ":local-floats") local_floats = GetNumber(); else if (s == ":local-integers-2") local_integers_2 = GetNumber(); else if (s == ":local-strings-2") local_strings_2 = GetNumber(); else if (s == ":unknown-ints") unknown_ints = GetNumber(); //Console.WriteLine(s); //Console.WriteLine(GetType(s)); //int num = GetNumber(); //Console.WriteLine(s); //outScript.Write(num); headerSize += 4; } outScript.Write(local_integers_1); outScript.Write(local_floats); outScript.Write(local_strings_1); outScript.Write(local_integers_2); outScript.Write(unknown_ints); outScript.Write(local_strings_2); Match(')'); } else if (s == ":static-data/code-offsets") { outScript.Write(0x1c); // size of section headerSize += 4; for (int i = 0; i < 3; i++) // create tntries for 3 index sets total: u0041a7b0, u00417d60, and call { outScript.Write(0); // size of index set headerSize += 4; outScript.Write(0); // offset to index set headerSize += 4; } s = GetNext(); if (s != "nil") { Console.WriteLine("Unexpected value for static-data/code-offsets: " + s); Environment.Exit(1); } } else if (s == ":static-integers") { SkipWhitespace(); if (curScript.PeekChar() == '(') { Match('('); while (curScript.PeekChar() != ')') { int n = GetNumber(); staticIntList.Add(n); } Match(')'); } else { s = GetNext(); if (s != "nil") { Console.WriteLine("Unknown value for static-integers: " + s); Environment.Exit(1); } } } else if (s == ":external-string-file") { s = GetNext(); if (s != "nil" && s[0] != '"') { Console.WriteLine("Unexpected value for static-data/code-offsets: " + s); Environment.Exit(1); } else { textFile = s; textFile = textFile.Remove(0, 1); textFile = textFile.Remove(textFile.Length - 1, 1); } } else { Console.WriteLine("Unknown section: " + s); Environment.Exit(1); } } Match(')'); } // end if } static int GetType(string inputType) { int output = 0; if (inputType[0] == ':') inputType = inputType.TrimStart(':'); switch (inputType) { case "global-integer-1": output = 3; break; case "global-integer-2": output = 6; break; case "local-integer-1": output = 9; break; case "local-integer-2": output = 12; break; case "global-float": output = 4; break; case "local-float": output = 10; break; case "global-string-1": output = 5; break; case "global-string-2": output = 8; break; case "local-string-1": output = 11; break; case "local-string-2": output = 14; break; case "external-string": output = 2; break; } return output; } static void SkipWhitespace() { char c = (char)curScript.PeekChar(); if (!String.IsNullOrWhiteSpace(c.ToString())) return; c = curScript.ReadChar(); while (!curScript.IsEOF() && String.IsNullOrWhiteSpace(c.ToString())) // skip all whitespace { c = curScript.ReadChar(); } curScript.Seek(curScript.Position - 1); } /* * Skip any whitespace then read all non-whitespace characters until whitespace is hit. * Returns the non-whitespace characters read. */ static string GetNext() { StringBuilder output = new StringBuilder(); SkipWhitespace(); char c = curScript.ReadChar(); while (!curScript.IsEOF() && !String.IsNullOrWhiteSpace(c.ToString()) && c != '(' && c != ')') // skip all whitespace { output.Append(Convert.ToString(c)); c = curScript.ReadChar(); } curScript.Seek(curScript.Position - 1); return output.ToString(); } // Get a string, must start and end with " static string GetString() { StringBuilder output = new StringBuilder(); Match('"'); for(;;) { char c = curScript.ReadChar(); if (c == '"') { break; } output.Append(Convert.ToString(c)); } return output.ToString(); } // Convert hex string to int static int GetNumber() { int output = 0; Match('#'); Match('x'); bool negative = false; if (curScript.PeekChar() == '-') { Match('-'); negative = true; } bool readNumber = true; while (readNumber) { char c = curScript.ReadChar(); if (c >= '0' && c <= '9') { output <<= 4; output += c - 0x30; } else if (c >= 'A' && c <= 'F') { output <<= 4; output += c - 0x37; } else if (c >= 'a' && c <= 'f') { output <<= 4; output += c - 0x57; } else { readNumber = false; } } if (negative) output = 0 - output; curScript.Seek(curScript.Position - 1); return output; } static bool Match(char input) { SkipWhitespace(); char readData = curScript.ReadChar(); bool matched = readData == input; if (!matched) { Console.WriteLine("Expected " + input + " at byte " + curScript.Position + ", got: " + readData); Environment.Exit(1); } return matched; } static bool Match(string input) { SkipWhitespace(); string readData = GetNext(); bool matched = readData == input; if (!matched) { Console.WriteLine("Expected " + input + " at byte " + curScript.Position + ", got: " + readData); Environment.Exit(1); } return matched; } static void ParseParens() { Match('('); string type = GetNext(); int num = GetNumber(); //Console.WriteLine(type + " " + num); if (type == "external-string") { // store the offset we need to patch Label l = new Label(); l.id = num; l.offset = outScript.BaseStream.Position + 4; // +4 to skip to the actual address we need to write strings.Add(l); if(newlineList.ContainsKey(l.id)) { newLines = newlineList[l.id].lines; newLinesID = newlineList[l.id].id; } } else if (type == "static-integer-reference") { Label l = new Label(); l.id = num; l.offset = outScript.BaseStream.Position + 4; fixStaticInts.Add(l); } outScript.Write(GetType(type)); outScript.Write(num); Match(')'); } static int GetCommand() { int opcode = -1; if (commandList.Count <= 0) { Console.WriteLine("Failed to initialize command list."); Environment.Exit(1); return opcode; } string commandName = GetNext().ToLower(); if (commandList.ContainsKey(commandName)) { if (commandName == "u0041a7b0") u0041a7b0List.Add(outScript.BaseStream.Position); else if (commandName == "u00417d60") u00417d60List.Add(outScript.BaseStream.Position); else if (commandName == "call") callList.Add(outScript.BaseStream.Position); opcode = commandList[commandName]; outScript.Write(opcode); } else { Console.WriteLine("Could not find in table: '" + commandName + "'"); Environment.Exit(1); } return opcode; } struct Overflow { public int id; public int lines; }; static Dictionary<int, byte[]> stringList = new Dictionary<int, byte[]>(); static Dictionary<int, Overflow> newlineList = new Dictionary<int, Overflow>(); static int overflowLine = 0x10000; static void ReadStrings(string inputStrings) { StreamReader stringFile = new StreamReader(inputStrings); while(stringFile.Peek() != -1) { string s = stringFile.ReadLine(); s = s.Trim().Trim('{').Trim('}'); if (s.StartsWith("ENG|")) // english line, save it { s = s.Remove(0, 4); // remove everything up until the id int pipe = s.IndexOf('|'); if (pipe == -1) continue; string id = s.Substring(0,pipe); string text = s.Substring(pipe + 1); //text = text.Replace("\\n", "\n"); List<string> strings = new List<string>(); int spi = 0; if(text.Contains("\\n")) { while (text.Contains("\\n")) // split the lines up in case there's a \n { strings.Add(text.Substring(0, text.IndexOf("\\n"))); text = text.Remove(0, text.IndexOf("\\n") + 2); } } strings.Add(text); int idnum = Convert.ToInt32(id); Overflow o = new Overflow(); o.lines = strings.Count - 1; o.id = overflowLine; newlineList[idnum] = o; for (int i = 0; i < strings.Count; i++) { byte[] sb = System.Text.Encoding.GetEncoding(932).GetBytes(strings[i]); if (i > 0) { idnum = overflowLine; overflowLine++; } stringList[idnum] = sb; } //Environment.Exit(1); } } stringFile.Close(); } static void WriteStrings() { for (int i = 0; i < strings.Count; i++) // start from the beginning of the array { Label l = strings[i]; if (!stringList.ContainsKey(l.id)) { Console.WriteLine("Could not find ID " + l.id + " in the string table"); Environment.Exit(1); } outScript.BaseStream.Seek(0, SeekOrigin.End); long offset = outScript.BaseStream.Position - headerSize; //outScript.Write(s, 0, s.Length); //outScript.Write("\0".ToCharArray(), 0, 1); // write the padding. must be aligned to the 4th byte //outScript.Write("\0\0\0\0".ToCharArray(), 0, (int)(4 - (outScript.BaseStream.Length % 4))); byte[] s = stringList[l.id]; for (int x = 0; x < s.Length; x++) { byte b = (byte)((~(int)s[x])&0xff); outScript.Write(b); } uint fill = 0xffffffff; outScript.Write((byte)(fill & 0xff)); for (int x = 0, len = (int)(4 - (outScript.BaseStream.Length % 4)); x < len; x++) { outScript.Write((byte)(fill & 0xff)); } outScript.BaseStream.Seek(l.offset, SeekOrigin.Begin); outScript.Write((int)(offset / 4)); } outScript.Seek(0, SeekOrigin.End); } static Dictionary<string, int> commandList = new Dictionary<string, int>(); static void InitCommands() { commandList.Add("u004149c0", 0x00000001); commandList.Add("exit", 0x00000002); commandList.Add("u00417d60", 0x00000003); commandList.Add("u00417e30", 0x00000004); commandList.Add("ret", 0x00000005); commandList.Add("u00417e80", 0x00000006); commandList.Add("u00417f90", 0x00000007); commandList.Add("u00417fc0", 0x00000008); commandList.Add("exit-script", 0x00000009); commandList.Add("u00424170", 0x0000000A); commandList.Add("u00418090", 0x0000000B); commandList.Add("u004149e0", 0x0000000C); commandList.Add("u004181a0", 0x0000000D); commandList.Add("u00418200", 0x0000000E); commandList.Add("u00418300", 0x0000000F); commandList.Add("u00414a00", 0x00000010); commandList.Add("u00418330", 0x00000011); commandList.Add("u004183f0", 0x00000012); commandList.Add("u00418420", 0x00000013); commandList.Add("u00414a20", 0x00000014); commandList.Add("u00418490", 0x00000015); commandList.Add("u00418520", 0x00000016); commandList.Add("u00418560", 0x00000017); commandList.Add("u004185b0", 0x0000001E); commandList.Add("u00418690", 0x0000001F); commandList.Add("u004187c0", 0x00000020); commandList.Add("u00418860", 0x00000021); commandList.Add("u00418920", 0x00000022); commandList.Add("u004189d0", 0x00000023); commandList.Add("u00418a90", 0x00000024); commandList.Add("u00418b40", 0x00000025); commandList.Add("u00418c00", 0x00000026); commandList.Add("u00418cc0", 0x00000027); commandList.Add("u00418d90", 0x00000028); commandList.Add("u00418e60", 0x0000002A); commandList.Add("u00418f30", 0x0000002B); commandList.Add("u00419010", 0x0000002C); commandList.Add("u004190a0", 0x0000002D); commandList.Add("u004194b0", 0x0000002E); commandList.Add("u004195a0", 0x0000002F); commandList.Add("u00419670", 0x00000030); commandList.Add("u00419750", 0x00000031); commandList.Add("u004197c0", 0x00000032); commandList.Add("u00419900", 0x00000033); commandList.Add("u004199c0", 0x00000034); commandList.Add("u00419af0", 0x00000035); commandList.Add("u00419c00", 0x00000036); commandList.Add("u00419c90", 0x00000037); commandList.Add("u00419da0", 0x00000038); commandList.Add("u00419e80", 0x00000050); commandList.Add("u00419ec0", 0x00000051); commandList.Add("u00419f00", 0x00000052); commandList.Add("u00419f40", 0x00000053); commandList.Add("u00419f80", 0x00000054); commandList.Add("u00419fc0", 0x00000055); commandList.Add("u00419ff0", 0x00000056); commandList.Add("u0041a030", 0x00000057); commandList.Add("u0041a070", 0x00000058); commandList.Add("u0041a0b0", 0x00000059); commandList.Add("u0041a0f0", 0x0000005A); commandList.Add("u0041a130", 0x0000005B); commandList.Add("u0041a170", 0x0000005C); commandList.Add("u0041a1b0", 0x0000005D); commandList.Add("u0041a1f0", 0x0000005E); commandList.Add("u0041a230", 0x0000005F); commandList.Add("u0041a270", 0x00000060); commandList.Add("u0041a320", 0x00000061); commandList.Add("u0041a360", 0x00000062); commandList.Add("u00414a60", 0x00000063); commandList.Add("copy-local-array", 0x00000064); commandList.Add("u00414aa0", 0x00000065); commandList.Add("u00414ae0", 0x00000066); commandList.Add("u00414b20", 0x00000067); commandList.Add("u00414b60", 0x00000068); commandList.Add("u00414ba0", 0x00000069); commandList.Add("u00414be0", 0x0000006A); commandList.Add("u00414c20", 0x0000006B); commandList.Add("u0041a450", 0x0000006C); commandList.Add("u00416960", 0x0000006D); commandList.Add("show-text", 0x0000006E); commandList.Add("end-text-line", 0x0000006F); commandList.Add("u0041a750", 0x00000070); commandList.Add("u0041a7b0", 0x00000071); commandList.Add("wait-for-input", 0x00000072); commandList.Add("u0041ab30", 0x00000073); commandList.Add("u0041ac00", 0x00000074); commandList.Add("u0041ac30", 0x00000075); commandList.Add("u0041ac60", 0x00000076); commandList.Add("u0041acb0", 0x00000077); commandList.Add("u0041ad00", 0x00000078); commandList.Add("u0041ad30", 0x00000079); commandList.Add("u0041ad70", 0x0000007A); commandList.Add("u0041adb0", 0x0000007B); commandList.Add("u00416a90", 0x0000007C); commandList.Add("u0041ae00", 0x0000007D); commandList.Add("u0041aea0", 0x0000007E); commandList.Add("u00414c60", 0x0000007F); commandList.Add("u0041af00", 0x00000080); commandList.Add("u0041af30", 0x00000081); commandList.Add("u0041af80", 0x00000082); commandList.Add("u00414c90", 0x00000083); commandList.Add("u00414cf0", 0x00000085); commandList.Add("u0041b210", 0x00000086); commandList.Add("u00414d10", 0x00000087); commandList.Add("u0041b290", 0x00000088); commandList.Add("u0041b2e0", 0x00000089); commandList.Add("u0041b330", 0x0000008A); commandList.Add("u0041b3d0", 0x0000008B); commandList.Add("jmp", 0x0000008C); commandList.Add("u0041bce0", 0x0000008D); commandList.Add("u0041bd60", 0x0000008E); commandList.Add("call", 0x0000008F); commandList.Add("u0041beb0", 0x00000090); commandList.Add("u0041bfb0", 0x00000091); commandList.Add("u0041c030", 0x00000092); commandList.Add("u00415040", 0x00000093); commandList.Add("u00415090", 0x00000094); commandList.Add("u0041c0c0", 0x00000095); commandList.Add("u004150c0", 0x00000096); commandList.Add("u0041c150", 0x00000097); commandList.Add("jcc", 0x000000A0); commandList.Add("u00427c00", 0x000000A1); commandList.Add("u00427fd0", 0x000000A2); commandList.Add("u004244d0", 0x000000A3); commandList.Add("u0041c270", 0x000000AA); commandList.Add("u0041c330", 0x000000AB); commandList.Add("u0041c3e0", 0x000000AC); commandList.Add("u00415110", 0x000000AD); commandList.Add("u00415130", 0x000000AE); //commandList.Add("u00415490", 0x000000AF); commandList.Add("u0041c530", 0x000000B0); commandList.Add("u0041c560", 0x000000B1); commandList.Add("u0041c590", 0x000000B2); commandList.Add("u004154b0", 0x000000B3); commandList.Add("u0041d010", 0x000000B4); commandList.Add("u0041d050", 0x000000B5); commandList.Add("u0041d080", 0x000000B6); commandList.Add("u0041d0e0", 0x000000B7); commandList.Add("u00415520", 0x000000B8); commandList.Add("u0041d140", 0x000000B9); commandList.Add("u0041d0b0", 0x000000BA); commandList.Add("u0041d250", 0x000000BB); commandList.Add("u0041d280", 0x000000BC); commandList.Add("u00415570", 0x000000BD); commandList.Add("u004155e0", 0x000000BE); commandList.Add("u0041d1a0", 0x000000BF); commandList.Add("u00415620", 0x000000C0); commandList.Add("u00415650", 0x000000C1); commandList.Add("u0041d2b0", 0x000000C2); commandList.Add("u0041d390", 0x000000C3); commandList.Add("u0041d3e0", 0x000000C4); commandList.Add("u0041d4a0", 0x000000C5); commandList.Add("u0041d5d0", 0x000000C6); commandList.Add("u0041d760", 0x000000C7); commandList.Add("u0041dfa0", 0x000000C8); commandList.Add("u00415770", 0x000000C9); commandList.Add("u004157a0", 0x000000CA); commandList.Add("u00415800", 0x000000CB); commandList.Add("u0041e050", 0x000000CC); commandList.Add("u00416be0", 0x000000CD); commandList.Add("u0041e0b0", 0x000000CE); commandList.Add("u00416d40", 0x000000CF); commandList.Add("u00415830", 0x000000D0); commandList.Add("u00415860", 0x000000D1); commandList.Add("u0041e110", 0x000000D2); commandList.Add("u00425960", 0x000000D3); commandList.Add("u004266f0", 0x000000D4); commandList.Add("u004262c0", 0x000000D5); commandList.Add("u004267d0", 0x000000D6); commandList.Add("u0041e1a0", 0x000000D7); commandList.Add("u0041e150", 0x000000D8); commandList.Add("u00415880", 0x000000D9); commandList.Add("u004158b0", 0x000000DA); commandList.Add("u00415940", 0x000000FA); commandList.Add("u0041e240", 0x000000FB); commandList.Add("u004159f0", 0x000000FC); commandList.Add("u0041e2d0", 0x000000FD); commandList.Add("u0041e360", 0x000000FE); commandList.Add("u00415a10", 0x000000FF); commandList.Add("u00415a60", 0x00000100); commandList.Add("u00415bf0", 0x00000101); commandList.Add("u0041e3c0", 0x00000102); commandList.Add("u0041e4a0", 0x00000103); commandList.Add("u00415c50", 0x00000104); commandList.Add("u0041e4d0", 0x00000105); commandList.Add("u00415e40", 0x00000106); commandList.Add("u0041e500", 0x00000107); commandList.Add("u00415e70", 0x00000108); commandList.Add("u00415ec0", 0x00000109); commandList.Add("u0041e540", 0x0000010A); commandList.Add("u0041e5a0", 0x0000010B); commandList.Add("u0041e5e0", 0x0000010C); commandList.Add("u00415f10", 0x0000010D); commandList.Add("u0041e650", 0x0000010E); commandList.Add("u0041e690", 0x0000010F); commandList.Add("u0041e6c0", 0x0000012C); commandList.Add("u0041e720", 0x0000012D); commandList.Add("u0041e940", 0x0000012E); commandList.Add("u0041ecb0", 0x0000012F); commandList.Add("u00415f40", 0x00000130); commandList.Add("u00415f70", 0x00000131); commandList.Add("u0041ef00", 0x00000132); commandList.Add("u0041eff0", 0x00000133); commandList.Add("u0041f050", 0x00000134); commandList.Add("u0041f0e0", 0x00000135); commandList.Add("u0041f150", 0x00000136); commandList.Add("u0041f1c0", 0x00000137); commandList.Add("u0041f2b0", 0x00000138); commandList.Add("u0041f310", 0x00000139); commandList.Add("u0041f3a0", 0x0000013A); commandList.Add("u0041f440", 0x0000013B); commandList.Add("u0041f7e0", 0x0000013C); commandList.Add("u0041f840", 0x0000013D); commandList.Add("u0041f8d0", 0x0000013E); commandList.Add("u0041f950", 0x0000013F); commandList.Add("u0041f9c0", 0x00000140); commandList.Add("u0041faa0", 0x00000141); commandList.Add("u0041fb10", 0x00000142); commandList.Add("u00415fb0", 0x00000143); commandList.Add("u004259d0", 0x00000144); commandList.Add("u00416040", 0x00000145); commandList.Add("u0041fb40", 0x00000146); commandList.Add("u0041fb80", 0x00000147); commandList.Add("u004160a0", 0x00000148); commandList.Add("u0041fce0", 0x00000149); commandList.Add("u0041fd10", 0x0000014A); commandList.Add("u0041ff50", 0x0000014B); commandList.Add("u00420030", 0x0000014C); commandList.Add("u00420130", 0x0000014D); commandList.Add("u0041c5e0", 0x00000190); commandList.Add("u0041a4a0", 0x00000191); commandList.Add("u004252d0", 0x00000192); commandList.Add("u00425370", 0x00000193); commandList.Add("u00425480", 0x00000194); commandList.Add("u00425580", 0x00000195); commandList.Add("u0041b400", 0x00000196); commandList.Add("u0041b510", 0x00000197); commandList.Add("u0041b540", 0x00000198); commandList.Add("u00414d50", 0x00000199); commandList.Add("u00414e50", 0x0000019A); commandList.Add("u00414e80", 0x0000019B); commandList.Add("u00414ec0", 0x0000019C); commandList.Add("u0041c680", 0x0000019D); commandList.Add("u0041c6e0", 0x0000019E); commandList.Add("u0041c860", 0x0000019F); commandList.Add("u0041c9b0", 0x000001A0); commandList.Add("u0041cb40", 0x000001A1); commandList.Add("u00428010", 0x000001A2); commandList.Add("u00424580", 0x000001A3); commandList.Add("u0041b580", 0x000001A4); commandList.Add("u00427550", 0x000001A5); commandList.Add("u0041a4d0", 0x000001A6); commandList.Add("comment", 0x000001A7); commandList.Add("u00415490", 0x000001A8); commandList.Add("u00428090", 0x000001A9); commandList.Add("u00425920", 0x000001AA); commandList.Add("u0041cca0", 0x000001AB); commandList.Add("u0041cd80", 0x000001AC); commandList.Add("u004154f0", 0x000001AD); commandList.Add("u0041ced0", 0x000001AE); commandList.Add("u004245c0", 0x000001AF); commandList.Add("u0041a510", 0x000001B0); commandList.Add("u0041b5c0", 0x000001B1); commandList.Add("u00425790", 0x000001B2); commandList.Add("u004257d0", 0x000001B3); commandList.Add("u004237c0", 0x000001B4); commandList.Add("u0041b5f0", 0x000001B5); commandList.Add("u00414f60", 0x000001B6); commandList.Add("u0041b640", 0x000001B7); commandList.Add("u0041b670", 0x000001B8); commandList.Add("u0041b710", 0x000001B9); commandList.Add("u0041d850", 0x000001BA); commandList.Add("u0041b7b0", 0x000001BB); commandList.Add("u00415670", 0x000001BC); commandList.Add("u0041d910", 0x000001BD); commandList.Add("u0041d9d0", 0x000001BE); commandList.Add("u004156c0", 0x000001BF); commandList.Add("u0041db70", 0x000001C0); commandList.Add("u0041b820", 0x000001C1); commandList.Add("u0041b860", 0x000001C2); commandList.Add("u0041b8a0", 0x000001C3); commandList.Add("u00415720", 0x000001C4); commandList.Add("u00425800", 0x000001C5); commandList.Add("u0041dd80", 0x000001C6); commandList.Add("u00414f90", 0x000001C7); commandList.Add("u00425680", 0x000001C8); commandList.Add("u0041b8e0", 0x000001C9); commandList.Add("u0041b9b0", 0x000001CA); commandList.Add("u00414fd0", 0x000001CB); commandList.Add("u00415010", 0x000001CC); commandList.Add("u0041a560", 0x000001CD); commandList.Add("u0041b9f0", 0x000001CE); commandList.Add("u0041da10", 0x000001CF); commandList.Add("u0041ba80", 0x000001D0); commandList.Add("u0041bae0", 0x000001D1); commandList.Add("u0041bb40", 0x000001D2); commandList.Add("u0041bb90", 0x000001D3); commandList.Add("u0041bc00", 0x000001D4); commandList.Add("u00415700", 0x000001D5); commandList.Add("u0041da40", 0x000001D6); commandList.Add("u0041da80", 0x000001D7); commandList.Add("u0041dad0", 0x000001D8); commandList.Add("u0041db20", 0x000001D9); commandList.Add("u004160d0", 0x000001F4); commandList.Add("u00416120", 0x000001F5); commandList.Add("u00416170", 0x000001F6); commandList.Add("u00420270", 0x000001F7); commandList.Add("u004202c0", 0x000001F8); commandList.Add("u00420350", 0x000001F9); commandList.Add("u00420480", 0x000001FA); commandList.Add("u004204f0", 0x000001FB); commandList.Add("u004205f0", 0x000001FC); commandList.Add("u00420620", 0x000001FD); commandList.Add("u004206c0", 0x000001FE); commandList.Add("u00420770", 0x000001FF); commandList.Add("u00420800", 0x00000200); commandList.Add("u00416190", 0x00000201); commandList.Add("u00420880", 0x00000202); commandList.Add("u00420950", 0x00000203); commandList.Add("u00420a10", 0x00000204); commandList.Add("u00420a60", 0x00000205); commandList.Add("u004161c0", 0x00000206); commandList.Add("u00420b00", 0x00000207); commandList.Add("u00420bf0", 0x00000208); commandList.Add("u00420c50", 0x00000209); commandList.Add("u00420ce0", 0x0000020A); commandList.Add("u00420d50", 0x0000020B); commandList.Add("u00416200", 0x0000020C); commandList.Add("u00420e10", 0x0000020D); commandList.Add("u00416250", 0x0000020E); commandList.Add("u00420e40", 0x0000020F); commandList.Add("u00420ff0", 0x00000210); commandList.Add("u00421060", 0x00000211); commandList.Add("u00421090", 0x00000212); commandList.Add("u004210d0", 0x00000213); commandList.Add("u00421120", 0x00000214); commandList.Add("u00421160", 0x00000215); commandList.Add("u004211a0", 0x00000216); commandList.Add("u004211e0", 0x00000217); commandList.Add("u00421270", 0x00000218); commandList.Add("u004212e0", 0x00000219); commandList.Add("u00421370", 0x0000021A); commandList.Add("u004213e0", 0x0000021B); commandList.Add("u00416270", 0x0000021C); commandList.Add("u00421410", 0x0000021D); commandList.Add("u00421450", 0x0000021E); commandList.Add("u00421510", 0x0000021F); commandList.Add("u004215d0", 0x00000220); commandList.Add("u00421670", 0x00000221); commandList.Add("u004216c0", 0x00000222); commandList.Add("u00421700", 0x00000223); commandList.Add("u00416290", 0x00000224); commandList.Add("u00421780", 0x00000225); commandList.Add("u004217d0", 0x00000226); commandList.Add("u00421880", 0x00000227); commandList.Add("u00421940", 0x00000228); commandList.Add("u004219e0", 0x00000229); commandList.Add("u00421a90", 0x0000022A); commandList.Add("u00421b30", 0x0000022B); commandList.Add("u00421bd0", 0x0000022C); commandList.Add("u00421c60", 0x0000022D); commandList.Add("u00421d10", 0x0000022E); commandList.Add("u00421dd0", 0x0000022F); commandList.Add("u00421e70", 0x00000230); commandList.Add("u00421ea0", 0x00000231); commandList.Add("u00421ef0", 0x00000232); commandList.Add("u00421fb0", 0x00000233); commandList.Add("u00422060", 0x00000234); commandList.Add("u00422100", 0x00000235); commandList.Add("u004221a0", 0x00000236); commandList.Add("u00422350", 0x00000237); commandList.Add("u00422390", 0x00000238); commandList.Add("u004223c0", 0x00000239); commandList.Add("u00422420", 0x0000023A); commandList.Add("u00422460", 0x0000023B); commandList.Add("u004162b0", 0x0000023C); commandList.Add("u004162f0", 0x0000023D); commandList.Add("u004228c0", 0x0000023E); commandList.Add("u00422930", 0x0000023F); commandList.Add("u004229a0", 0x00000240); commandList.Add("u00422b80", 0x00000241); commandList.Add("u00422d60", 0x00000242); commandList.Add("u00417070", 0x00000243); commandList.Add("u00416360", 0x00000244); commandList.Add("u00422da0", 0x00000245); commandList.Add("u00422e10", 0x00000246); commandList.Add("u00416390", 0x00000247); commandList.Add("u00422e80", 0x00000248); commandList.Add("u00422eb0", 0x00000249); commandList.Add("u004163c0", 0x0000024A); commandList.Add("u00422ea0", 0x0000024E); commandList.Add("u00422ed0", 0x0000024F); commandList.Add("u00422f60", 0x00000250); commandList.Add("u00422ff0", 0x00000251); commandList.Add("u00422fe0", 0x00000258); commandList.Add("u00416410", 0x00000259); commandList.Add("u00423020", 0x000002BC); commandList.Add("u00423100", 0x000002BD); commandList.Add("u00423140", 0x000002BE); commandList.Add("u00423180", 0x000002BF); commandList.Add("u004231c0", 0x000002C0); commandList.Add("u00425bc0", 0x000002C1); commandList.Add("u00425cd0", 0x000002C2); commandList.Add("u00423200", 0x000002C3); commandList.Add("u00416450", 0x000002C4); } } }
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; /** * * name : IUnitOfWork.cs * author : Aleksy Ruszala * date : 29/04/2019 * * */ namespace Application.Repo.Contracts { public interface IUnitOfWork : IDisposable { Task Commit(); } }
using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace Requestrr.WebApi.Extensions { public static class HttpResponseMessageExtensions { public static async Task ThrowIfNotSuccessfulAsync(this HttpResponseMessage responseMessage, string message, Func<dynamic, string> getErrorFunc) { if (!responseMessage.IsSuccessStatusCode) { var textResponse = await responseMessage.Content.ReadAsStringAsync(); dynamic jsonObject = null; try { jsonObject = JObject.Parse(textResponse); } catch { // Ignore } if (jsonObject != null) { throw new Exception($"{message}: {responseMessage.ReasonPhrase} - {getErrorFunc(jsonObject) ?? textResponse}"); } throw new Exception($"{message}: {responseMessage.ReasonPhrase} - {textResponse}"); } return; } } }
using System; using System.IO; using System.Reflection; using System.Windows; namespace BusyBox.Helpers { public static class ResourceHelper { public static T Get<T>(string resourceName) { var assembly = Assembly.GetExecutingAssembly(); using (var stream = assembly.GetManifestResourceStream("BusyBox.ResourceDictionary.xaml")) { var reader = new System.Windows.Markup.XamlReader(); var resDictionary = (ResourceDictionary)reader.LoadAsync(stream); return (T)resDictionary[resourceName]; } } } }
using System; using TravelertApp.ViewModels; using TravelertApp.Views; using TravelertApp.Views.ProfilePageUsers; using TravelertApp.Views.RegisterUsers; using TravelertApp.Views.TabbedPageUsers; using Xamarin.Essentials; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace TravelertApp { public partial class App : Application { private string ConsumerUID; public App() { InitializeComponent(); //auth = DependencyService.Get<IAuth>(); try { //ung normal code nung wala ung firesharp if (ConsumersLoginViewModel.IsLoggedIn || EntrepreneursLoginViewModel.IsLoggedIn) //if the user is signed in { //if (!ConsumersLoginViewModel.IsLoggedIn) //if the user is a consumer //{ // MainPage = new NavigationPage(new GeneralPublicPage()); //} //else if (!EntrepreneursLoginViewModel.IsLoggedIn) //else if the user is an entrepreneur //{ // MainPage = new NavigationPage(new EntrepreneurPage()); //} //else //{ // return; //} } else { MainPage = new NavigationPage(new LoginPage()); //dapat login page to, pag may itetest na pages palitan lang } } catch (Exception e) { Current.MainPage.DisplayAlert("Alert", "There was a problem in the connection", "Ok"); } //MainPage = new NavigationPage(new RegisterGeneralPublicPage()); //changing this to new NavigationPage and pass the home page (LoginPage) as the parameter // - if we don't do this modification, then our application will get an exception //Pag experimental daw ung projects eto lalagay?? Tas tatanggalin pag iimplement na? Device.SetFlags(new[] { "SwipeView_Experimental" }); } protected override void OnStart() { } protected override void OnSleep() { } protected override void OnResume() { } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; namespace NETTWO_Files2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void save_Click(object sender, EventArgs e) {//save in Settings data d = new NETTWO_Files2.data(); d.name = textBox1.Text; d.phone = textBox2.Text; d.Save(); } private void read_Click(object sender, EventArgs e) {//read in Settings data d = new NETTWO_Files2.data(); textBox1.Text = d.name; textBox2.Text = d.phone; } private void saveFile_Click(object sender, EventArgs e) {//save using a File Class string[] stuff = { textBox1.Text, textBox2.Text }; File.WriteAllLines(@"C:\Users\ryang\Desktop\stuff.txt", stuff); } private void readFile_Click(object sender, EventArgs e) { string[] stuff = File.ReadAllLines(@"C:\Users\ryang\Desktop\stuff.dat"); textBox1.Text = stuff[0]; textBox2.Text = stuff[1]; } private void saveRTF_Click(object sender, EventArgs e) {//save RTF richTextBox1.Text = textBox1.Text + "," + textBox2.Text; richTextBox1.SaveFile(@"C:\Users\ryang\Desktop\rtf.dat"); } private void readRTF_Click(object sender, EventArgs e) {//read RTF richTextBox1.LoadFile(@"C:\Users\ryang\Desktop\rtf.dat"); string[] data = richTextBox1.Text.Split(','); textBox1.Text = data[0]; textBox2.Text = data[1]; } private void saveSequential_Click(object sender, EventArgs e) {//save Sequential //before objects came along //open "c:\data\stuff.dat" for output as #1 //write #1, x //write #1, y //close #1 //now with .NET FileStream f = new FileStream(@"C:\Users\ryang\Desktop\seq.dat", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter w = new StreamWriter(f); w.WriteLine(textBox1.Text); w.WriteLine(textBox2.Text); w.Close(); f.Close(); } private void readSequential_Click(object sender, EventArgs e) {//read Sequential FileStream f = new FileStream(@"C:\Users\ryang\Desktop\seq.dat", FileMode.Open, FileAccess.Read); StreamReader r = new StreamReader(f); textBox1.Text = r.ReadLine(); textBox2.Text = r.ReadLine(); r.Close(); f.Close(); } private void sequentialCSV_Click(object sender, EventArgs e) {//write many csv records & read back string[] data = { "abc", "123", "xyz" }; string record = string.Join(",", data); //creates string ready for csv file StreamWriter w = new StreamWriter(@"C:\Users\ryang\Desktop\demo.csv"); //one line StreamWriter destroys and recreates file w.WriteLine(record); w.WriteLine(record); w.Close(); StreamReader r = new StreamReader(@"C:\Users\ryang\Desktop\demo.csv"); while((record = r.ReadLine()) != null) { //pull apart csv record string[] stuff = record.Split(','); //now use stuff[0], stuff[1], etc. } r.Close(); } private void sequentialFormatted_Click(object sender, EventArgs e) {//write many formatted records and read back int id = 1; string name = "Robert"; double amount = 123.00; string record; record = string.Format("{0,2:00}{1,-20}{2,8:00000.00}", id, name, amount); //-is for left alignment and :f2 is for decimal in amount StreamWriter w = new StreamWriter(@"C:\Users\ryang\Desktop\demo.dat"); w.WriteLine(record); w.WriteLine(record); w.Close(); StreamReader r = new StreamReader(@"C:\Users\ryang\Desktop\demo.dat"); while((record = r.ReadLine()) != null) { id = Convert.ToInt32(record.Substring(0, 2)); name = record.Substring(2, 20); amount = Convert.ToDouble(record.Substring(22, 8)); } r.Close(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Webshop.Data { public class OrderDto { //Tárolt adatok public string UserId { get; set; } public string PaymentMetod { get; set; } public string ShippingMethod { get; set; } public DateTime orderTime { get; set; } // public int StatusId { get; set; } public string StatusName { get; set; } // public string kiVette { get; set; } public int OrderId { get; set; } public List<int> orderItemsID { get; set; } = new List<int>(); } }
using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CaseConverter { public class Utility { //log private static StringBuilder sbLog = new StringBuilder(); public static List<string> GetExcelFiles() { List<string> result = new List<string>(); return result; } public static void CreateOutputFiles(DataTable dt, string outputFolder) { } public static void AddLog(string s) { Console.WriteLine(s); sbLog.AppendLine(s); } public static DataTable ReadInputFile(string filename) { DataTable result = new DataTable(); return result; } public static DataTable TranslateIntoHumanLanguage(DataTable inputData) { DataTable result = new DataTable(); return result; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace FeelingGoodApp.Models { public class LocationViewModel { public LocationViewModel(string name, string formattedAddress, float rating) { Name = name; FormattedAddress = formattedAddress; Rating = rating; } public LocationViewModel() { } public int Id { get; set; } public string Name { get; set; } public string FormattedAddress { get; set; } public float Rating { get; set; } } }
using Checkout.Payment.Processor.Domain.Models.Enums; using Checkout.Payment.Processor.Seedwork.Extensions; using MediatR; using System; namespace Checkout.Payment.Processor.Domain.Commands { public class UpdatePaymentCommand : IRequest<ITryResult> { public Guid PaymentId { get; set; } public string BankPaymentId { get; set; } public PaymentStatus PaymentStatus { get; set; } public string PaymentStatusDetails { get; set; } } }
using System; namespace IndependienteStaFe.Models { public class UserUpdate { public string token { get; set; } public string name { get; set; } public string Lastname { get; set; } public string Id { get; set; } public string Emal { get; set; } public string Password { get; set; } public string City { get; set; } public string Address { get; set; } public string Cellnumber { get; set; } public string Gender { get; set; } public DateTime Birdhdate { get; set; } public bool Datapolicy { get; set; } public bool Termsandconditions { get; set; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace sales_management_system { public partial class 入庫情報 : Form { public 入庫情報(string hattyuCode, string shouhinCode, string shouhinmei, string makermei, string hattyusu) { InitializeComponent(); txt_hcode.Text = hattyuCode; txt_scode.Text = shouhinCode; txt_sname.Text = shouhinmei; txt_manufacturer_name.Text = makermei; txt_hattyuusuu.Text = hattyusu; } private void btn_back_Click(object sender, EventArgs e) { this.Close(); } } }
using Microsoft.AspNetCore.SignalR; using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using SignalR.API.Hubs; using SignalR.API.Migrations; using SignalR.API.Utils; using System; using System.Threading.Tasks; namespace SignalR.API.Services { public class SqlDependencyNotification : ISqlDependencyNotification { private readonly IHubContext<QuestionHub, IQuestionHub> hubContext; private readonly IConfiguration configuration; public SqlDependencyNotification( IHubContext<QuestionHub, IQuestionHub> hubContext, IConfiguration configuration) { this.hubContext = hubContext; this.configuration = configuration; } public async Task SubscribeQuestionAsync(Guid questionId) { using var dbContext = GetDbcontextInstance(); using var connection = dbContext.Database.GetDbConnection(); await connection.OpenAsync(); await SubscribeQuestionAnswerAsync(questionId, connection); } private async Task SubscribeQuestionAnswerAsync(Guid questionId, System.Data.Common.DbConnection connection) { var command = connection.CreateCommand(); command.CommandText = $"SELECT Id FROM Answers WHERE QuestionId = '{questionId.ToString()}';"; var scoreDependency = new SqlDependency((SqlCommand)command); scoreDependency.OnChange += OnAnswerAdded; SqlDependency.Start(configuration.GetConnectionString("SqlServer")); _ = await command.ExecuteReaderAsync(); } private void OnAnswerAdded(object sender, SqlNotificationEventArgs e) { using var dbContext = GetDbcontextInstance(); var service = new QuestionService(dbContext); var groups = Consts.QuestionGroups.Keys; foreach (var group in groups) { var question = Task.Run(async () => await service.GetAsync(Guid.Parse(group))).Result; _ = Task.Run(async () => await SubscribeQuestionAsync(question.Id)); _ = Task.Run(async () => await hubContext .Clients .Group(group) .AnswerAdded(question.Answers) ); } } private ApplicationDbContext GetDbcontextInstance() { var options = new DbContextOptionsBuilder<ApplicationDbContext>() .UseSqlServer(configuration.GetConnectionString("SqlServer")) .Options; return new ApplicationDbContext(options); } } }
// // This source code is licensed in accordance with the licensing outlined // on the main Tychaia website (www.tychaia.com). Changes to the // license on the website apply retroactively. // using System; using Protogame; using Protogame.SHMUP; using Microsoft.Xna.Framework; namespace RedMeansGo.Entities { public class WhiteBloodCell : Entity { public float Speed { get; set; } public override void Update(World world) { var speed = this.Speed * (1 - ((world as RedMeansGoWorld).Player as Player).Health + 1); this.Y += (float)speed; this.X += (float)(Math.Cos(this.Y / ((Tileset.TILESET_PIXEL_HEIGHT - RedMeansGoGame.GAME_HEIGHT) / 2) * Math.PI * 2 ) * speed); this.Rotation += 0.05f; if (this.Y > Tileset.TILESET_PIXEL_HEIGHT) world.Entities.Remove(this); this.Color = new Color(255, 255, 255); var w = world as RedMeansGoWorld; if ((w.Player as Entities.Player).Health > 0) { if (w.Player.X - this.X < 60 && w.Player.X - this.X > -60 && w.Player.Y - this.Y < 60 && w.Player.Y - this.Y > -60) { if (Vector2.Distance( new Vector2(this.X, this.Y), new Vector2(w.Player.X, w.Player.Y)) < 8) (world as RedMeansGoWorld).Restart(); } } base.Update(world); } } }
using System; namespace iQuest.VendingMachine.PresentationLayer.DisplayConfiguration { internal class DisplayBase { protected void DisplayLine(string message, ConsoleColor color) { ConsoleColor oldColor = Console.ForegroundColor; Console.ForegroundColor = color; Console.WriteLine(message); Console.ForegroundColor = oldColor; } protected void Display(string message, ConsoleColor color) { ConsoleColor oldColor = Console.ForegroundColor; Console.ForegroundColor = color; Console.Write(message); Console.ForegroundColor = oldColor; } } }
using System; using System.Collections.Generic; using System.Net.Sockets; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; namespace ITWServer.Network { public class PacketHandler { private Dictionary<Type, List<object>> bindedMethods = new Dictionary<Type, List<object>>(); public delegate bool HandlerMethod<T>(Vdb.Session session, T packet) where T : ITW.Protocol.Packet; public void Bind<T>(HandlerMethod<T> method) where T : ITW.Protocol.Packet { if (bindedMethods.ContainsKey(typeof(T)) == false) { bindedMethods.Add(typeof(T), new List<object>()); } bindedMethods[typeof(T)].Add(method); } public void Call<T>(Vdb.Session session, T packet) where T : ITW.Protocol.Packet { if(bindedMethods.ContainsKey(packet.GetType()) == false) { return; } foreach (object obj in bindedMethods[packet.GetType()]) { (obj as HandlerMethod<T>)(session, packet); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace Roylance.Common { public static class ObjectExtensions { public static void CheckIfNull(this object item, string propertyName) { if (item == null) { throw new ArgumentNullException(propertyName); } } public static IEnumerable<IEnumerable<T>> Permute<T>(this IEnumerable<T> collection, double percentageToKeep = 0.66) { var maxCollectionSize = (int)Math.Ceiling(collection.Count() * percentageToKeep); if (collection.Count() > maxCollectionSize) { yield return collection; var permuteMethods = new PermuteMethods(); foreach (var item in permuteMethods.PermuteInternal(collection, maxCollectionSize)) { yield return item; } // collect me, gc! permuteMethods = null; } } class PermuteMethods { readonly HashSet<string> seenKeys = new HashSet<string>(); internal IEnumerable<IEnumerable<T>> PermuteInternal<T>(IEnumerable<T> collection, int maxCollectionSize) { for (var i = 0; i < collection.Count(); i++) { var newList = collection.Where(item => !item.Equals(collection.ElementAt(i))).ToList(); var key = string.Join("~", newList.OrderBy(item => item.GetHashCode()).Select(item => item.GetHashCode().ToString())); if (newList.Count > maxCollectionSize && !seenKeys.Contains(key)) { this.seenKeys.Add(key); yield return newList; foreach (var subList in PermuteInternal(newList, maxCollectionSize)) { if (subList.Count() > 0) { yield return subList; } } } } } } } }
using Assets.Scripts.Overlay.MainMenu; using Assets.Scripts.Player; using Assets.Scripts.RobinsonCrusoe_Game.Characters; using Assets.Scripts.RobinsonCrusoe_Game.GameAttributes; using Assets.Scripts.RobinsonCrusoe_Game.Level; using Assets.Scripts.RobinsonCrusoe_Game.RoundSystem; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Analytics; using UnityEngine.SceneManagement; using UnityEngine.UI; public class StartGameSession : MonoBehaviour { public bool canStart = false; public Dropdown difficulty; // Start is called before the first frame update void Start() { } public void TaskOnClick() { if (canStart) { PartyHandler.CreateParty(TempoarySettings.Party, TempoarySettings.NumberOfPlayers); new RoundSystem(new Castaways()); //TODO: add level selection DifficultyHandler.Value = difficulty.GetComponent<Dropdown>().value; //Analytics var param = new Dictionary<string, object>(); int index = 0; foreach(var character in PartyHandler.PartySession) { param.Add(character.CharacterName, index); index++; } Analytics.CustomEvent("Party", param); SceneManager.LoadScene("GameScene"); } } }
using Checkout.Payment.Processor.Seedwork.Interfaces; namespace Checkout.Payment.Processor.Seedwork.Models { public class DomainNotificationEvent : IDomainNotificationEvent { public DomainNotificationType Type { get; set; } public string Message { get; set; } } }
using System.Collections.Generic; namespace SFA.DAS.Notifications.Messages.Commands { public class SendEmailCommand { public string TemplateId { get; } public string RecipientsAddress { get; } public IReadOnlyDictionary<string, string> Tokens { get; } public SendEmailCommand(string templateId, string recipientsAddress, IReadOnlyDictionary<string, string> tokens) { TemplateId = templateId; RecipientsAddress = recipientsAddress; Tokens = tokens; } } }
using Bb.Expressions.CsharpGenerators; using System; using System.Collections.Generic; using System.Diagnostics.SymbolStore; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; namespace Bb.Expressions { public class MethodCompiler : SourceCode { public MethodCompiler() { } public string OutputPath { get; set; } #region parameters public ParameterExpression AddParameter(Type type, string name = null) { if (string.IsNullOrEmpty(name)) name = this._parameters.GetNewName(type); var vari = this._parameters.GetByName(name); if (vari != null) throw new Exceptions.DuplicatedArgumentNameException($"parameter {name} already exists"); else { var instance = Expression.Parameter(type, name); var variable = new Variable() { Name = instance.Name, Instance = instance }; this._parameters.Add(variable); this.LastParameter = instance; return instance; } } public ParameterExpression GetParameter(string name) { var variable = _parameters.GetByName(name); return variable?.Instance; } public IEnumerable<ParameterExpression> Parameters { get => this._parameters.Items.Select(c => c.Instance); } public ParameterExpression LastParameter { get; private set; } #endregion parameters public override ParameterExpression GetVar(string name) { var variable = base.GetVar(name); if (variable == null) variable = this.GetParameter(name); return variable; } #region Compiler public virtual TDelegate Compile<TDelegate>(string filepathCode) { var lbd = GenerateLambda<TDelegate>(filepathCode); if (System.Diagnostics.Debugger.IsAttached) { var _u = new string[] { "Newtonsoft.Json.Linq", "Bb.ComponentModel.Factories", "Bb.Json.Jslt.Services" }; //var sb = SourceGenerator.GetCode(result, _u); //System.Diagnostics.Debug.WriteLine(sb.ToString()); var code = SourceCodeDomGenerator.GetCode(lbd, "n_" + Path.GetFileNameWithoutExtension(filepathCode), "Myclass", "MyMethod", false, _u); System.CodeDom.CodeCompileUnit compileUnit = new System.CodeDom.CodeCompileUnit() { }; string path = Path.Combine(this.OutputPath, "_temps"); if (!Directory.Exists(path)) Directory.CreateDirectory(path); string file = Path.Combine(path, filepathCode); compileUnit.Namespaces.Add(code); LocalCodeGenerator.GenerateCsharpCode(compileUnit, file); } return lbd.Compile(); } public LambdaExpression GenerateLambda(Type delegateType) { var parameters = this._parameters.Items.Select(c => c.Instance).ToArray(); HashSet<string> variableParent = new HashSet<string>(parameters.Select(c => c.Name)); var expression = this.GetExpression(variableParent); if (expression.CanReduce) expression = expression.Reduce(); var result = Expression.Lambda(delegateType, expression, parameters.ToArray()); return result; } public Expression<TDelegate> GenerateLambda<TDelegate>(string filepathCode) { var parameters = this._parameters.Items.Select(c => c.Instance).ToArray(); HashSet<string> variableParent = new HashSet<string>(parameters.Select(c => c.Name)); var expression = this.GetExpression(variableParent); if (expression.CanReduce) expression = expression.Reduce(); var result = Expression.Lambda<TDelegate>(expression, parameters.ToArray()); return result; } #endregion compiler private Variables _parameters = new Variables(); } }
using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BPiaoBao.Client.UIExt { /// <summary> /// 带分页的基础视图模型 /// </summary> public abstract class PageBaseViewModel : BaseVM { #region 构造函数 /// <summary> /// Initializes a new instance of the <see cref="PageBaseViewModel"/> class. /// </summary> public PageBaseViewModel() { //EndTime = DateTime.Now; //StartTime = DateTime.Today.AddMonths(-1); } #endregion #region 公开属性 #region StartTime /// <summary> /// The <see cref="StartTime" /> property's name. /// </summary> public const string StartTimePropertyName = "StartTime"; private DateTime? startTime; /// <summary> /// 开始时间 /// </summary> public DateTime? StartTime { get { return startTime; } set { if (startTime == value) return; RaisePropertyChanging(StartTimePropertyName); startTime = value; RaisePropertyChanged(StartTimePropertyName); } } #endregion #region EndTime /// <summary> /// The <see cref="EndTime" /> property's name. /// </summary> public const string EndTimePropertyName = "EndTime"; private DateTime? endTime = null; /// <summary> /// 查询结束时间,该属性会自动修改到当天23:59:59 /// </summary> public DateTime? EndTime { get { return endTime; } set { if (value != null) { value = new DateTime(value.Value.Year, value.Value.Month, value.Value.Day); value = value.Value.Add(TimeSpan.FromDays(1)).Add(TimeSpan.FromMilliseconds(-1)); } if (endTime == value) return; RaisePropertyChanging(EndTimePropertyName); endTime = value; RaisePropertyChanged(EndTimePropertyName); } } #endregion #region CurrentPageIndex /// <summary> /// The <see cref="CurrentPageIndex" /> property's name. /// </summary> public const string CurrentPageIndexPropertyName = "CurrentPageIndex"; private int currentPageIndex = 1; /// <summary> /// 当前页 /// </summary> public int CurrentPageIndex { get { return currentPageIndex; } set { if (currentPageIndex == value) return; RaisePropertyChanging(CurrentPageIndexPropertyName); currentPageIndex = value; RaisePropertyChanged(CurrentPageIndexPropertyName); } } #endregion #region TotalCount /// <summary> /// The <see cref="TotalCount" /> property's name. /// </summary> public const string TotalCountPropertyName = "TotalCount"; private int totalCount = 0; /// <summary> /// 总页数 /// </summary> public int TotalCount { get { return totalCount; } set { if (totalCount == value) return; RaisePropertyChanging(TotalCountPropertyName); totalCount = value; RaisePropertyChanged(TotalCountPropertyName); } } #endregion #region PageSize /// <summary> /// The <see cref="PageSize" /> property's name. /// </summary> public const string PageSizePropertyName = "PageSize"; private int pageSize = 20; /// <summary> /// 页面大小 /// </summary> public int PageSize { get { return pageSize; } set { if (pageSize == value) return; RaisePropertyChanging(PageSizePropertyName); pageSize = value; RaisePropertyChanged(PageSizePropertyName); } } #endregion #region IsBusy ///// <summary> ///// The <see cref="IsBusy" /> property's name. ///// </summary> //public const string IsBusyPropertyName = "IsBusy"; //private bool isBusy = false; /// <summary> /// 是否在繁忙 /// </summary> public new bool IsBusy { get { return isBusy; } set { if (isBusy == value) return; RaisePropertyChanging(IsBusyPropertyName); isBusy = value; RaisePropertyChanged(IsBusyPropertyName); if (queryCommand != null) queryCommand.RaiseCanExecuteChanged(); } } #endregion #endregion #region 公开命令 #region QueryCommand private RelayCommand queryCommand; /// <summary> /// 查询命令 /// </summary> public RelayCommand QueryCommand { get { return queryCommand ?? (queryCommand = new RelayCommand(ExecuteQueryCommand, CanExecuteQueryCommand)); } } /// <summary> /// 执行查询命令 /// </summary> protected virtual void ExecuteQueryCommand() { } /// <summary> /// 检查是否可以执行命令 /// </summary> /// <returns></returns> protected virtual bool CanExecuteQueryCommand() { return !isBusy; } #endregion #endregion } }
using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CMS_Tools.Authen { public partial class LoginGG : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { try { var JSON = Lib.GoogleLib.GetConfigGoogle(Lib.Constants.GG_JSON_FILE); string linkRequest = JSON.web.auth_uri + "?scope=profile" + "&access_type=offline&include_granted_scopes=true&state=state_parameter_passthrough_value&redirect_uri=" + (Lib.Constants.SERVER_TYPE == "REAL" ? JSON.web.redirect_uris[1] : JSON.web.redirect_uris[0]) + "&response_type=code&client_id=" + JSON.web.client_id; Response.Redirect(linkRequest); } catch (ThreadAbortException) { } catch (Exception ex) { Lib.Logs.SaveError("ERROR REQUEST LOGIN GG: " + ex); } } } }
using System; using System.IO; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.IO.Ports; using System.Windows.Controls; using System.Runtime.InteropServices; using System.Windows.Shapes; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Input; using System.Text; namespace arduinoCameraStream { public partial class App : Application { static SerialPort _serialPort = new SerialPort(); static public List<String> LDeviceId = new List<String>(); static public int deviceIdIndex = -1; static public DateTime epochDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); static public Canvas iCanvas; static public bool isRecording = false; static public bool isPlaying = false; static public uint recordingFrameCount = 0; static string serialBuffer = ""; static string newDataBuffer = ""; static string frameBuffer = ""; static string imageBuffer = ""; static public ProgressBar hSerialProgress; static public TextBlock hSerialProgressText; static public string recordingFolder = ""; static int totalFrameLength = 640 * 480 + "*FRAME_START*".Length + "*FRAME_STOP*".Length; static List<String> rawFilesToShow; static string rawStreamDirectory = ""; static public int rawViewerIndex = 0; static public void openSerial() { if (deviceIdIndex == -1) return; _serialPort.PortName = LDeviceId[deviceIdIndex]; _serialPort.BaudRate = 250000; //115200 _serialPort.Parity = Parity.None; _serialPort.DataBits = 8; _serialPort.StopBits = StopBits.One; _serialPort.Handshake = Handshake.None; _serialPort.DtrEnable = true; _serialPort.RtsEnable = true; _serialPort.NewLine = "\r\n"; _serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); _serialPort.ErrorReceived += new SerialErrorReceivedEventHandler(ErrorReceivedHandler); _serialPort.Open(); } public static void setPixel(WriteableBitmap wbm, int x, int y, Color c) { if (y > wbm.PixelHeight - 1 || x > wbm.PixelWidth - 1) return; if (y < 0 || x < 0) return; if (!wbm.Format.Equals(PixelFormats.Bgra32))return; wbm.Lock(); IntPtr buff = wbm.BackBuffer; int Stride = wbm.BackBufferStride; unsafe { byte* pbuff = (byte*)buff.ToPointer(); int loc= y * Stride + x*4; pbuff[ loc]=c.B; pbuff[loc+1]=c.G; pbuff[loc+2]=c.R; pbuff[loc+3]=c.A; } wbm.AddDirtyRect(new Int32Rect(x,y,1,1)); wbm.Unlock(); } static public void openSerialHandler(object sender, RoutedEventArgs e) { openSerial(); /*List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>(); colors.Add(System.Windows.Media.Colors.Red); colors.Add(System.Windows.Media.Colors.Blue); colors.Add(System.Windows.Media.Colors.Green); BitmapPalette myPalette = new BitmapPalette(colors); WriteableBitmap writeableBmp = new WriteableBitmap(640, 480, 72, 72, PixelFormats.Bgra32, myPalette); int z = 0; for (int y = 0; y < 480; y++) { for (int x = 0; x < 640; x++) { setPixel(writeableBmp, x, y, Color.FromArgb(255, 255, 255, 255)); z += 3; } } Image img = new Image(); img.Source = writeableBmp; img.Width = 640; img.Height = 480; Canvas.SetLeft(img, 0); Canvas.SetTop(img, 0); iCanvas.Children.Add(img);*/ } static void setProgress(int current, int total) { double percent = Math.Round(current * 100.0 / total); hSerialProgressText.Text = current + "/" + total + " (" + percent + "%)"; hSerialProgress.Value = percent; } static string GetRtfUnicodeEscapedString(string s) { var sb = new StringBuilder(); foreach (var c in s) { if (c == '\\' || c == '{' || c == '}') sb.Append(@"\" + c); /*else if (c <= 0x7f) sb.Append(c); else*/ sb.Append("\\u" + Convert.ToUInt32(c) + "?"); } return sb.ToString(); } static byte[] getByteFrameBuffer(string frameBuffer) { byte[] bFrameBuffer = new byte[640*480]; for (int i = 0; i < 640 * 480; i++) { bFrameBuffer[i] = (i < frameBuffer.Length && frameBuffer[i] < 256) ? Convert.ToByte(frameBuffer[i]) : Convert.ToByte(0); } return bFrameBuffer; } static void drawImgFromByteArray(byte[] AimgRGB) { List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>(); colors.Add(System.Windows.Media.Colors.Red); colors.Add(System.Windows.Media.Colors.Blue); colors.Add(System.Windows.Media.Colors.Green); BitmapPalette myPalette = new BitmapPalette(colors); WriteableBitmap writeableBmp = new WriteableBitmap(640, 480, 72, 72, PixelFormats.Bgra32, myPalette); int z = 0; for (int y = 0; y < 480; y++) { for (int x = 0; x < 640; x++) { setPixel(writeableBmp, x, y, Color.FromArgb(255, AimgRGB[z], AimgRGB[z + 1], AimgRGB[z + 2])); z += 3; } } Image img = new Image(); img.Source = writeableBmp; img.Width = 640; img.Height = 480; Canvas.SetLeft(img, 0); Canvas.SetTop(img, 0); iCanvas.Children.Add(img); } private static void receiveMainThread(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; if (sp.BytesToRead != 0) { newDataBuffer = sp.ReadExisting(); serialBuffer += newDataBuffer; //console.append(GetRtfUnicodeEscapedString(newDataBuffer)); setProgress(serialBuffer.Length, totalFrameLength); if (serialBuffer.Length > "*FRAME_START*".Length + "*FRAME_STOP*".Length && serialBuffer.IndexOf("*FRAME_START*") > -1 && serialBuffer.IndexOf("*FRAME_STOP*") > -1) { if (serialBuffer.IndexOf("*FRAME_START*") < serialBuffer.IndexOf("*FRAME_STOP*")) { setProgress(totalFrameLength, totalFrameLength); int start = serialBuffer.IndexOf("*FRAME_START*") + "*FRAME_START*".Length; int len = serialBuffer.IndexOf("*FRAME_STOP*") - start; frameBuffer = serialBuffer.Substring(start, len); //delete the current frame from the serialBuffer serialBuffer = serialBuffer.Substring(serialBuffer.IndexOf("*FRAME_STOP*") + "*FRAME_STOP*".Length); console.append("\\fs22 \\f0 \\cf0 \\par\\pard received a frame with a size of " + ((frameBuffer.Length == 640 * 480) ? "" + frameBuffer.Length : "\\cf2 \\ul\\b " + frameBuffer.Length + "\\b0\\ul0\\cf0 ") + " byte"); if (isRecording) { using (BinaryWriter writer = new BinaryWriter(File.Open(recordingFolder + "/" + recordingFrameCount + ".raw", FileMode.Create))) { writer.Write(frameBuffer); } recordingFrameCount++; } byte[] AimgRGB = new byte[640 * 480 * 3]; byte[] bFrameBuffer = getByteFrameBuffer(frameBuffer); decoding.deBayerHQl(bFrameBuffer, AimgRGB); drawImgFromByteArray(AimgRGB); } //if we have a part of a frame in the serial buffer we drop it if (serialBuffer.IndexOf("*FRAME_START*") > serialBuffer.IndexOf("*FRAME_STOP*")) { serialBuffer.Substring(serialBuffer.IndexOf("*FRAME_START*")); } } } } private static void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { if (Application.Current == null) return; var d = Application.Current.Dispatcher; if (d.CheckAccess()) receiveMainThread(sender, e); else d.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => receiveMainThread(sender, e))); } private static void ErrorReceivedHandler(object sender, SerialErrorReceivedEventArgs e) { Console.Write("ErrorReceivedHandler"); SerialPort sp = (SerialPort)sender; Console.WriteLine("Data Received: " + sp.BytesToRead); string indata = sp.ReadExisting(); Console.Write(indata); } static public void serialSelectorChanged(object sender, SelectionChangedEventArgs e) { var COMList = sender as ComboBox; //string text = COMList.SelectedItem as string; deviceIdIndex = COMList.SelectedIndex; } static void openRawStreamFolder_getFilesList(string folder) { rawStreamDirectory = folder; DirectoryInfo dirInfo = new DirectoryInfo(folder); FileInfo[] info = dirInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly); rawFilesToShow = new List<String>(); foreach (FileInfo f in info) { /*f.Name; Convert.ToUInt32(f.Length); f.DirectoryName; f.FullName; f.Extension;*/ if (f.Extension == ".raw") { rawFilesToShow.Add(f.Name); } } } static public void openRawStreamFolder(string folder) { openRawStreamFolder_getFilesList(folder); rawFilesToShow.Sort(); rawViewerIndex = 0; if (rawFilesToShow.Count == 0) MessageBox.Show("No .raw files found in the selected folder", "Error", MessageBoxButton.OK, MessageBoxImage.Error); drawImgFromRawFile(); } static public void drawImgFromRawFile() { if (rawFilesToShow.Count == 0) return; console.append("\\fs22 \\f0 \\cf0 \\par\\pard opening file: " + rawFilesToShow[rawViewerIndex]); var fs = new FileStream(rawStreamDirectory + "\\" + rawFilesToShow[rawViewerIndex], FileMode.Open); var len = (int)fs.Length; var fileBuf = new byte[len]; fs.Read(fileBuf, 0, len); string frameB = System.Text.Encoding.UTF8.GetString(fileBuf); byte[] AimgRGB = new byte[640 * 480 * 3]; byte[] bFrameBuffer = getByteFrameBuffer(frameB); decoding.deBayerHQl(bFrameBuffer, AimgRGB); drawImgFromByteArray(AimgRGB); } static public void rawViewerIndexNext() { rawViewerIndex++; if (rawViewerIndex > rawFilesToShow.Count - 1) rawViewerIndex = 0; } static public void rawViewerIndexPrev() { rawViewerIndex--; if (rawViewerIndex < 0) rawViewerIndex = rawFilesToShow.Count - 1; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BDProj { public partial class AddAuthor : Form { AddBook addBook; public AddAuthor(AddBook addBook) { InitializeComponent(); this.addBook = addBook; } private void buttonAdd_Click(object sender, EventArgs e) { if ((textBoxName.Text != null || textBoxName.Text != "") && textBoxSurname.Text != null || textBoxSurname.Text != "") { Author author = new Author() { Firstname = textBoxName.Text, Lastname = textBoxSurname.Text }; addBook.PushAuthor(author); MessageBox.Show("Dodano!", "Dodano", MessageBoxButtons.OK); this.Close(); } else { MessageBox.Show("Niepoprawne dane!", "Błąd!"); } } private void buttonCancel_Click(object sender, EventArgs e) { this.Close(); } } }
using System; using System.Collections.Generic; using System.IO; using WpfIntro.Models; namespace WpfIntro.DataAccessLayer.Common { public interface IFileAccess { int CreateNewMediaItemFile(string name, string url, DateTime createTime); int CreateNewMediaLogFile(string logText, MediaItem logMediaItem); IEnumerable<FileInfo> SearchFiles(string searchTerm, MediaTypes searchType); IEnumerable<FileInfo> GetAllFiles(MediaTypes searchType); } }
using System; using System.IO; using System.Threading.Tasks; using Medit1.Models; using Microsoft.AspNetCore.Http; namespace Medit1.Utils { public static class ImageAdder { public static async Task<Image> AddImage(IFormFile photoFile, Cruise cruise) { var imageName = $"{Guid.NewGuid().ToString()}_{photoFile.FileName}"; var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/img/cruises", imageName); var stream = new FileStream(path, FileMode.Create); await photoFile.CopyToAsync(stream); var image = new Image() { Cruise = cruise, Path = imageName }; return image; } } }
using LuaInterface; using SLua; using System; using UnityEngine; public class Lua_UnityEngine_Profiler : LuaObject { [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int constructor(IntPtr l) { int result; try { Profiler o = new Profiler(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int AddFramesFromFile_s(IntPtr l) { int result; try { string text; LuaObject.checkType(l, 1, out text); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int BeginSample_s(IntPtr l) { int result; try { int num = LuaDLL.lua_gettop(l); if (num == 1) { string text; LuaObject.checkType(l, 1, out text); LuaObject.pushValue(l, true); result = 1; } else if (num == 2) { string text2; LuaObject.checkType(l, 1, out text2); Object @object; LuaObject.checkType<Object>(l, 2, out @object); LuaObject.pushValue(l, true); result = 1; } else { LuaObject.pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int EndSample_s(IntPtr l) { int result; try { LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetRuntimeMemorySize_s(IntPtr l) { int result; try { Object @object; LuaObject.checkType<Object>(l, 1, out @object); int runtimeMemorySize = Profiler.GetRuntimeMemorySize(@object); LuaObject.pushValue(l, true); LuaObject.pushValue(l, runtimeMemorySize); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetMonoHeapSize_s(IntPtr l) { int result; try { uint monoHeapSize = Profiler.GetMonoHeapSize(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, monoHeapSize); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetMonoUsedSize_s(IntPtr l) { int result; try { uint monoUsedSize = Profiler.GetMonoUsedSize(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, monoUsedSize); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetTotalAllocatedMemory_s(IntPtr l) { int result; try { uint totalAllocatedMemory = Profiler.GetTotalAllocatedMemory(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, totalAllocatedMemory); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetTotalUnusedReservedMemory_s(IntPtr l) { int result; try { uint totalUnusedReservedMemory = Profiler.GetTotalUnusedReservedMemory(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, totalUnusedReservedMemory); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetTotalReservedMemory_s(IntPtr l) { int result; try { uint totalReservedMemory = Profiler.GetTotalReservedMemory(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, totalReservedMemory); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_supported(IntPtr l) { int result; try { LuaObject.pushValue(l, true); LuaObject.pushValue(l, Profiler.get_supported()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_logFile(IntPtr l) { int result; try { LuaObject.pushValue(l, true); LuaObject.pushValue(l, Profiler.get_logFile()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_logFile(IntPtr l) { int result; try { string logFile; LuaObject.checkType(l, 2, out logFile); Profiler.set_logFile(logFile); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_enableBinaryLog(IntPtr l) { int result; try { LuaObject.pushValue(l, true); LuaObject.pushValue(l, Profiler.get_enableBinaryLog()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_enableBinaryLog(IntPtr l) { int result; try { bool enableBinaryLog; LuaObject.checkType(l, 2, out enableBinaryLog); Profiler.set_enableBinaryLog(enableBinaryLog); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_enabled(IntPtr l) { int result; try { LuaObject.pushValue(l, true); LuaObject.pushValue(l, Profiler.get_enabled()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_enabled(IntPtr l) { int result; try { bool enabled; LuaObject.checkType(l, 2, out enabled); Profiler.set_enabled(enabled); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_maxNumberOfSamplesPerFrame(IntPtr l) { int result; try { LuaObject.pushValue(l, true); LuaObject.pushValue(l, Profiler.get_maxNumberOfSamplesPerFrame()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_maxNumberOfSamplesPerFrame(IntPtr l) { int result; try { int maxNumberOfSamplesPerFrame; LuaObject.checkType(l, 2, out maxNumberOfSamplesPerFrame); Profiler.set_maxNumberOfSamplesPerFrame(maxNumberOfSamplesPerFrame); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_usedHeapSize(IntPtr l) { int result; try { LuaObject.pushValue(l, true); LuaObject.pushValue(l, Profiler.get_usedHeapSize()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } public static void reg(IntPtr l) { LuaObject.getTypeTable(l, "UnityEngine.Profiler"); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.AddFramesFromFile_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.BeginSample_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.EndSample_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.GetRuntimeMemorySize_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.GetMonoHeapSize_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.GetMonoUsedSize_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.GetTotalAllocatedMemory_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.GetTotalUnusedReservedMemory_s)); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_Profiler.GetTotalReservedMemory_s)); LuaObject.addMember(l, "supported", new LuaCSFunction(Lua_UnityEngine_Profiler.get_supported), null, false); LuaObject.addMember(l, "logFile", new LuaCSFunction(Lua_UnityEngine_Profiler.get_logFile), new LuaCSFunction(Lua_UnityEngine_Profiler.set_logFile), false); LuaObject.addMember(l, "enableBinaryLog", new LuaCSFunction(Lua_UnityEngine_Profiler.get_enableBinaryLog), new LuaCSFunction(Lua_UnityEngine_Profiler.set_enableBinaryLog), false); LuaObject.addMember(l, "enabled", new LuaCSFunction(Lua_UnityEngine_Profiler.get_enabled), new LuaCSFunction(Lua_UnityEngine_Profiler.set_enabled), false); LuaObject.addMember(l, "maxNumberOfSamplesPerFrame", new LuaCSFunction(Lua_UnityEngine_Profiler.get_maxNumberOfSamplesPerFrame), new LuaCSFunction(Lua_UnityEngine_Profiler.set_maxNumberOfSamplesPerFrame), false); LuaObject.addMember(l, "usedHeapSize", new LuaCSFunction(Lua_UnityEngine_Profiler.get_usedHeapSize), null, false); LuaObject.createTypeMetatable(l, new LuaCSFunction(Lua_UnityEngine_Profiler.constructor), typeof(Profiler)); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TourCrawler { public class KeyWord { public string Province { get; set; } public string Keyword { get; set; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using QTHT.BusinesLogic; using C1.Win.C1FlexGrid; using DanhMuc.DataAccess; using CGCN.DataAccess; using DanhMuc.BusinesLogic; using QTHT.DataAccess; namespace DanhMuc.Interface { public partial class ucHangSX : UserControl { private CellStyle cserror; private logBL _ctrlog = new logBL(); #region Method private void CheckQuyenDL() { ultraToolbarsManager1.Tools["btn_Add"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["btn_Save"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["btn_Del"].SharedProps.Visible = false; try { quyennguoidung obj = new quyennguoidung(); quyennguoidungBL ctr = new quyennguoidungBL(); obj = ctr.GetByIDNhanVienvsMenuName(Data.iduse, "tsHangSX"); string[] arrquyendl = obj.quyendl.Split(';'); if (arrquyendl[0].Trim().Equals("EDIT") == true) { ultraToolbarsManager1.Tools["btn_Add"].SharedProps.Visible = true; ultraToolbarsManager1.Tools["btn_Save"].SharedProps.Visible = true; } if (arrquyendl[1].Trim().Equals("DEL") == true) { ultraToolbarsManager1.Tools["btn_Del"].SharedProps.Visible = true; } } catch { ultraToolbarsManager1.Tools["btn_Add"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["btn_Save"].SharedProps.Visible = false; ultraToolbarsManager1.Tools["btn_Del"].SharedProps.Visible = false; } } private void HienThiDS() { tblhangsanxuatBL _ctr = new tblhangsanxuatBL(); DataTable dt = new DataTable(); dt = _ctr.GetAll(); if (dt != null) { c1FlexGrid1.DataSource = dt; dt.Columns.Add("TT", typeof(Int32)); FormatGrid(); } } private void FormatGrid() { for (int i = 0; i < c1FlexGrid1.Cols.Count; i++) { if (i == 0) { c1FlexGrid1[0, i] = "STT"; c1FlexGrid1.Cols[i].Visible = true; c1FlexGrid1.Cols[i].Width = 60; } else if (c1FlexGrid1.Cols[i].Caption.Equals("ten")) { c1FlexGrid1[0, i] = "Hãng sản xuất(*)"; c1FlexGrid1.Cols[i].Visible = true; } else if (c1FlexGrid1.Cols[i].Caption.Equals("ghichu")) { c1FlexGrid1[0, i] = "Mô tả"; c1FlexGrid1.Cols[i].Visible = true; } else { c1FlexGrid1.Cols[i].Visible = false; } c1FlexGrid1.Cols[i].TextAlignFixed = TextAlignEnum.CenterCenter; } Font _font = new Font("Time new Roman", 14); c1FlexGrid1.Font = _font; for (int j = 1; j < c1FlexGrid1.Rows.Count; j++) { c1FlexGrid1[j, 0] = j; c1FlexGrid1[j, "TT"] = 0; } c1FlexGrid1.Cols[0].TextAlign = TextAlignEnum.CenterCenter; c1FlexGrid1.AutoSizeCols(); c1FlexGrid1.AutoSizeRows(); } private List<tblhangsanxuat> GetData() { tblhangsanxuatBL ctr = new tblhangsanxuatBL(); List<tblhangsanxuat> lst = new List<tblhangsanxuat>(); string loi = ""; for (int i = 1; i < c1FlexGrid1.Rows.Count; i++) { if (c1FlexGrid1[i, "TT"].ToString().Equals("0") == false) { try { loi = ""; tblhangsanxuat _obj = new tblhangsanxuat(); if (c1FlexGrid1[i, "ten"].ToString().Trim().Equals("") == true || c1FlexGrid1[i, "ten"] == null) { loi = "Tên hãng sản xuất không được để trắng."; c1FlexGrid1.SetUserData(i, "ten", loi); c1FlexGrid1.Rows[i].Style = cserror; } _obj.ten = c1FlexGrid1[i, "ten"].ToString(); if (c1FlexGrid1[i, "TT"].ToString().Equals("1") == true) { if (ctr.CheckExit("", _obj.ten) == true) { loi = "Tên hãng sản xuất đã có trong cơ sở dữ liệu."; c1FlexGrid1.SetUserData(i, "ten", loi); c1FlexGrid1.Rows[i].Style = cserror; } _obj.id = Guid.NewGuid().ToString(); c1FlexGrid1[i, "id"] = _obj.id.Trim(); } if (c1FlexGrid1[i, "TT"].ToString().Equals("2") == true) { _obj.id = c1FlexGrid1[i, "id"].ToString().Trim(); if (ctr.CheckExit(_obj.id, _obj.ten) == true) { loi = "Tên hãng sản xuất đã có trong cơ sở dữ liệu."; c1FlexGrid1.SetUserData(i, "ten", loi); c1FlexGrid1.Rows[i].Style = cserror; } } _obj.ghichu = c1FlexGrid1[i, "ghichu"].ToString(); lst.Add(_obj); } catch { } } } return lst; } private void Delete() { tblhangsanxuatBL _ctr = new tblhangsanxuatBL(); string loi = ""; string sten = ""; string iid = ""; int n = c1FlexGrid1.RowSel; if (n >= 1) { try { sten = c1FlexGrid1[c1FlexGrid1.RowSel, "ten"].ToString().Trim(); } catch { } try { iid = c1FlexGrid1[c1FlexGrid1.RowSel, "id"].ToString().Trim(); } catch { } DialogResult bien; bien = MessageBox.Show("Xác nhận xóa dữ liệu", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (bien == DialogResult.Yes) { loi = _ctr.Delete(iid); if (loi.Equals("") == true) { try { _ctrlog.Append(Data.use, "Xóa hãng sản xuất: " + sten.Trim()); } catch { } HienThiDS(); } else { MessageBox.Show(loi, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else MessageBox.Show("Dữ liệu hiện tại đang trắng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); c1FlexGrid1.Focus(); } private void Save() { string temploi = ""; string loi = ""; tblhangsanxuatBL _ctr = new tblhangsanxuatBL(); List<tblhangsanxuat> lst = new List<tblhangsanxuat>(); lst = GetData(); if (lst != null) { for (int i = 0; i < lst.Count; i++) { loi = ""; tblhangsanxuat _obj = new tblhangsanxuat(); try { _obj = _ctr.GetByID(lst[i].id); } catch { } if (_obj == null) { try { loi = c1FlexGrid1.GetUserData(c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true), "ten").ToString().Trim(); } catch { } if (loi.Equals("") == true) { loi = _ctr.Insert(lst[i]); if (loi.Equals("") == false) { c1FlexGrid1.Rows[c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true)].Style = cserror; } else { _ctrlog.Append(Data.use, "Thêm mới hãng sản xuất: " + lst[i].ten.Trim()); } } else { c1FlexGrid1.Rows[c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true)].Style = cserror; } if (loi.Trim().Equals("") == false) { temploi = loi; } } else { try { loi = c1FlexGrid1.GetUserData(c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true), "ten").ToString().Trim(); } catch { } if (loi.Equals("") == true) { loi = _ctr.Update(lst[i]); if (loi.Equals("") == false) { c1FlexGrid1.SetUserData(c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true), "ten", loi); c1FlexGrid1.Rows[c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true)].Style = cserror; } else { _ctrlog.Append(Data.use, "Cập nhật hãng sản xuất: " + lst[i].ten.Trim()); } } else { c1FlexGrid1.SetUserData(c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true), "ten", loi); c1FlexGrid1.Rows[c1FlexGrid1.FindRow(lst[i].id.ToString().Trim(), 1, c1FlexGrid1.Cols["id"].Index, true, true, true)].Style = cserror; } if (loi.Trim().Equals("") == false) { temploi = loi; } } } } if (temploi.Trim().Equals("") == true) { HienThiDS(); MessageBox.Show("Cập nhật dữ liệu thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Cập nhật dữ liệu không thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void Cancel() { HienThiDS(); } private void Add() { c1FlexGrid1.Focus(); c1FlexGrid1.Rows.Add(); c1FlexGrid1[c1FlexGrid1.Rows.Count - 1, "TT"] = 1; c1FlexGrid1[c1FlexGrid1.Rows.Count - 1, "id"] = ""; c1FlexGrid1[c1FlexGrid1.Rows.Count - 1, 0] = (c1FlexGrid1.Rows.Count - 1).ToString(); c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1,2); } #endregion public ucHangSX() { InitializeComponent(); } private void ucHangSX_Load(object sender, EventArgs e) { CheckQuyenDL(); c1FlexGrid1.KeyActionEnter = KeyActionEnum.MoveAcross; cserror = c1FlexGrid1.Styles.Add("Error"); cserror.BackColor = Color.Red; HienThiDS(); } #region Xử lý sự kiện trên grid private void c1FlexGrid1_Click(object sender, EventArgs e) { //Hiển thị lỗi nếu có try { string loi = ""; try { loi = c1FlexGrid1.GetUserData(c1FlexGrid1.RowSel, "ten").ToString().Trim(); } catch { } toolTip1.SetToolTip(c1FlexGrid1, loi); } catch { } } private void c1FlexGrid1_AfterEdit(object sender, RowColEventArgs e) { try { c1FlexGrid1.AutoSizeRow(e.Row); c1FlexGrid1.AutoSizeCol(e.Col); int hang = c1FlexGrid1.Row; int cot = c1FlexGrid1.Cols.Count - 1; if (Convert.ToInt32(c1FlexGrid1[hang, cot]) == 0) { c1FlexGrid1[c1FlexGrid1.RowSel, c1FlexGrid1.Cols.Count - 1] = 2; } if (c1FlexGrid1.ColSel == c1FlexGrid1.Cols.Count - 2 && c1FlexGrid1.RowSel == c1FlexGrid1.Rows.Count - 1) { if (c1FlexGrid1.RowSel == c1FlexGrid1.Rows.Count - 1) { Add(); c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1, 1); } else { c1FlexGrid1.StartEditing(c1FlexGrid1.RowSel + 1, 2); } //Add(); c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1, 1); } } catch { } } private void c1FlexGrid1_KeyDown(object sender, KeyEventArgs e) { if ((e.Control && e.KeyCode == Keys.A) || e.KeyCode == Keys.Add){ Add(); } if (e.Control && e.KeyCode == Keys.S) { Save(); } if (e.KeyCode == Keys.Delete) { Delete(); } } private void c1FlexGrid1_KeyUp(object sender, KeyEventArgs e) { c1FlexGrid1_KeyDown(sender, e); } #endregion private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "btn_Add": // ButtonTool Add(); break; case "btn_Save": // ButtonTool c1FlexGrid1.Focus(); Save(); break; case "btn_Abort": // ButtonTool Cancel(); break; case "btn_Del": // ButtonTool Delete(); break; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Sunny.Lib; namespace UploadBatch { public class Const { public static FileLogger BatchFileLogger = new FileLogger( () => { string path = EnvironmentHelper.CurrentExecuteDir; return string.Format("{0}/Log/UploadBatch/{1}", path, DateTime.Now.ToString("yyyy-MM")); }, () => { string path = EnvironmentHelper.CurrentExecuteDir; return DateTime.Now.ToString("yyyy-MM-dd") + ".log"; } ); } }
using System.Collections.Immutable; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Text; namespace Meziantou.Analyzer.Rules; [ExportCodeFixProvider(LanguageNames.CSharp), Shared] public sealed class CommaFixer : CodeFixProvider { public override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(RuleIdentifiers.MissingCommaInObjectInitializer); public override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer; public override Task RegisterCodeFixesAsync(CodeFixContext context) { foreach (var diagnostic in context.Diagnostics) { context.RegisterCodeFix( CodeAction.Create( "Add comma", cancellationToken => GetTransformedDocumentAsync(context.Document, diagnostic, cancellationToken), "Add comma"), diagnostic); } return Task.CompletedTask; } private static async Task<Document> GetTransformedDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) { var syntaxRoot = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (syntaxRoot == null) return document; var syntaxNode = syntaxRoot.FindNode(diagnostic.Location.SourceSpan); var textChange = new TextChange(diagnostic.Location.SourceSpan, syntaxNode.ToString() + ","); var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); return document.WithText(text.WithChanges(textChange)); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace vpui { /// <summary> /// Interaction logic for CodeAdornerBottom.xaml /// </summary> public partial class CodeAdornerBottom : UserControl { public CodeAdornerBottom() { InitializeComponent(); } private void base_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { BottomItem bottomItem = this.DataContext as BottomItem; bottomItem.Item.Host.OnStartAdornerAction(CodeControl.MOVE, e, bottomItem.Item); } private void bascentre_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { BottomItem bottomItem = this.DataContext as BottomItem; bottomItem.Item.Host.OnStartAdornerAction(CodeControl.BASCENTRE, e, bottomItem.Item); } } }
using Newtonsoft.Json; using System.Collections.Generic; namespace MailerQ.Mime { /// <summary> /// This represent a Mime json message /// See https://www.responsiveemail.com/json/introduction for more info /// </summary> [JsonObject( NamingStrategyType = typeof(LowercaseNamingStrategy), ItemNullValueHandling = NullValueHandling.Ignore )] public class Mime { #region Top level MIME properties /// <summary> /// Subject line of the email. /// </summary> public string Subject { get; set; } /// <summary> /// Email address and name of the sender. /// </summary> public EmailAddress From { get; set; } /// <summary> /// Optional email address and name of the user to which replies are sent. /// </summary> [JsonProperty("replyTo")] public EmailAddress ReplyTo { get; set; } /// <summary> /// List of receivers. /// </summary> [JsonConverter(typeof(SingleOrArrayConverter<EmailAddress>))] public ICollection<EmailAddress> To { get; set; } /// <summary> /// List of CC addresses. /// </summary> [JsonConverter(typeof(SingleOrArrayConverter<EmailAddress>))] public ICollection<EmailAddress> Cc { get; set; } /// <summary> /// List of BCC addresses. /// </summary> [JsonConverter(typeof(SingleOrArrayConverter<EmailAddress>))] public ICollection<EmailAddress> Bcc { get; set; } /// <summary> /// Additional custom headers to be added to the mail header. /// </summary> public IDictionary<string, string> Headers { get; set; } /// <summary> /// Attachments to download and add to the email. /// </summary> public ICollection<Attachment> Attachments { get; set; } /// <summary> /// Private key for DKIM signature. /// </summary> public object Dkim { get; set; } #endregion #region Top level content and style properties /// <summary> /// Supply text version for clients that do not support HTML emails /// </summary> public string Text { get; set; } /// <summary> /// Template wide font and text settings. /// </summary> public object Font { get; set; } /// <summary> /// Background settings for the entire template. /// </summary> public object Background { get; set; } /// <summary> /// The main block that holds all of the other blocks and content of the responsive email. /// </summary> public object Content { get; set; } /// <summary> /// Custom CSS settings to be added to the body tag. /// </summary> public object Css { get; set; } /// <summary> /// Custom attributes to be added to the body tag. /// </summary> public object Attributes { get; set; } #endregion #region Top level advanced properties /// <summary> /// Define specific rules to overwrite information specified in the JSON. /// </summary> public object Rewrite { get; set; } /// <summary> /// Supply email tracking information. /// </summary> public object Tracking { get; set; } /// <summary> /// Supply data used for personalization /// </summary> public object Data { get; set; } #endregion } }
using System; namespace ReadyGamerOne.Rougelike.Person { public interface IInteractablePerson { bool IfInteract { get; } Action<AbstractPerson> OnInteract { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.SqlClient; using System.Data; using System.Text; namespace WebService.Datos { public class Conexion { string cadenaBD = "Data Source=CÉSAR-PC\\SQLEXPRESS;Initial Catalog=UsersBD;Integrated Security=True"; public SqlConnection conexion = new SqlConnection(); public Conexion() { conexion.ConnectionString = cadenaBD; } private void abrirConexion() { Console.WriteLine("haciendo conexion"); try { conexion.Open(); Console.WriteLine("conexion abierta"); } catch (Exception ex) { Console.WriteLine("error al abrir la base de datos\n" + ex.Message); } } public void cerrar() { conexion.Close(); } private void Insertar(Persona per) { //creamos un comando de sql SqlCommand command = new SqlCommand(); //abrimos la conexion a la bd abrirConexion(); //ejecutamos la consulta StringBuilder str = new StringBuilder(); str.Append("insert into dbo.Persona (id,nombre,edoCivil) values"); str.AppendFormat("({0},'{1}',{2})", per.Id, per.Nombre, 0); command.CommandText = str.ToString(); command.CommandType = System.Data.CommandType.Text; command.Connection = conexion; command.ExecuteNonQuery(); //hacemos la consulta //SqlDataAdapter info = new SqlDataAdapter(command); conexion.Close(); } public void insertar(Persona per){ Insertar(per); } private List<Persona> recibir() { //creamos un comando de sql SqlCommand command = new SqlCommand(); //abrimos la conexion a la bd abrirConexion(); //ejecutamos la consulta command.CommandText = "select * from dbo.Persona"; command.CommandType = System.Data.CommandType.Text; command.Connection = conexion; //hacemos la consulta SqlDataAdapter info = new SqlDataAdapter(command); //creamos una tabla para guaradar el resultado DataTable table = new DataTable(); //llenamos la tabla info.Fill(table); //cerramos la conexion cerrar(); List<Persona> nombres = new List<Persona>(); foreach (DataRow row in table.Rows) { int id = int.Parse(row["id"].ToString()); string nm = row["nombre"].ToString(); bool edo = false;//int.Parse(row["edoCivil"].ToString()) == 1; Persona nuevo = new Persona() { Id = id, Nombre = nm, EdoCivil = edo }; nombres.Add(nuevo); } return nombres; } public string soloUnaPersona() { SqlCommand command = new SqlCommand(); abrirConexion(); command.CommandText = "select nombre from dbo.Persona where id = 1"; command.CommandType = System.Data.CommandType.Text; command.Connection = conexion; SqlDataAdapter info = new SqlDataAdapter(command); DataTable table = new DataTable(); info.Fill(table); DataRow row = table.Rows[0]; // conexion. return row["nombre"].ToString(); } public List<Persona> resultado_select() { return recibir(); } } }
using System.ComponentModel.DataAnnotations; namespace EducationManual.Models { public class TaskForStudent { [Key] public int? TaskId { get; set; } public string Name { get; set; } } }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ControlValveMaintenance.Models { class Users : ObservableCollection<User> { /// <summary> /// DEFAULT CONSTRUCTOR /// </summary> public Users() { } } }
using Microsoft.ApplicationInsights; using System; using System.Collections.Generic; namespace TheLastSlice { public class AppInsightsClient { private TelemetryClient TelemetryClient { get; set; } private Guid UserGuid { get; set; } private Guid SessionGuid { get; set; } private DateTime StartTime { get; set; } public AppInsightsClient() { TelemetryClient = new TelemetryClient(); SessionGuid = System.Guid.NewGuid(); Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; Object value = localSettings.Values["UserGUID"]; if (value == null) { UserGuid = System.Guid.NewGuid(); localSettings.Values["UserGUID"] = UserGuid; } else { UserGuid = (Guid)value; } StartTime = DateTime.Now; } private Dictionary<string, string> GetPropertiesDictionary() { return new Dictionary<string, string> { { "UserGuid", UserGuid.ToString() }, { "SessionGuid", SessionGuid.ToString() }, }; } public void GameOver(GameOverReason reason) { var properties = GetPropertiesDictionary(); properties.Add("GameOverReason", reason.ToString()); var metrics = new Dictionary<string, double> { { "Num Levels", TheLastSliceGame.LevelManager.Levels.Count }, { "Seconds Played", (DateTime.Now - StartTime).TotalSeconds }, }; TelemetryClient.TrackEvent("GameOver", properties, metrics); } public void LevelComplete(int level, DateTime secondsToBeat) { var properties = GetPropertiesDictionary(); properties.Add("Level", level.ToString()); var metrics = new Dictionary<string, double> { { "Seconds To Beat Level", (DateTime.Now - secondsToBeat).TotalSeconds }, }; TelemetryClient.TrackEvent("LevelComplete", properties, metrics); } public void PostScoreSuccess() { var metrics = new Dictionary<string, double> { }; TelemetryClient.TrackEvent("PostScoreSuccess", GetPropertiesDictionary(), metrics); } } }
namespace Boxes { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class Box { private Point upperLeft; private Point upperRight; private Point bottomLeft; private Point bottomRight; public Point UpperLeft { get { return upperLeft; } set { upperLeft = value; } } public Point UpperRight { get { return upperRight; } set { upperRight = value; } } public Point BottomLeft { get { return bottomLeft; } set { bottomLeft = value; } } public Point BottomRight { get { return bottomRight; } set { bottomRight = value; } } public int Width { get; set; } public int Height { get; set; } public static int CalculatePerimeter(int width, int height) { var perimeter = (2 * width) + (2 * height); return perimeter; } public static int CaculateArea(int width, int height) { var area = width * height; return area; } } }
using FeedsProcessing.Models; using System; using System.ComponentModel.DataAnnotations; using System.Text.Json; namespace FeedsProcessing.Validation { public interface INotificationModelValidator { public ValidationResult Validate(NotificationModel model); } public class NotificationModelValidator : INotificationModelValidator { public ValidationResult Validate(NotificationModel model) { if (string.IsNullOrEmpty(model.Id)) return new ValidationResult("Invalid parameter 'id' specified"); if (string.IsNullOrEmpty(model.Token)) return new ValidationResult("Invalid parameter 'token' specified"); if (!IsValidDateTime(model.CreatedAt)) return new ValidationResult("Invalid parameter 'created_at' specified"); switch (model) { case FacebookNotificationModel facebook: if (facebook.Posts.ValueKind != JsonValueKind.Array) return new ValidationResult("Invalid parameter 'posts' specified"); break; case TwitterNotificationModel twitter: if (twitter.Tweets.ValueKind != JsonValueKind.Array) return new ValidationResult("Invalid parameter 'tweets' specified"); break; } return ValidationResult.Success; } //TODO: should be extension method private static bool IsValidDateTime(string date) => !string.IsNullOrEmpty(date) && DateTime.TryParse(date, out _); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraController : MonoBehaviour { public float rotateSpeed; private Vector3 offset; public float speed; void LateUpdate () { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.Tab)){ if (Input.GetKey(KeyCode.LeftShift)){ transform.Rotate(rotateSpeed, 0, 0); } else{ transform.Rotate(-rotateSpeed, 0, 0); } } if (Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.E)){ if (Input.GetKey(KeyCode.Q)){ transform.Rotate(0, -rotateSpeed, 0, Space.World); } else{ transform.Rotate(0, rotateSpeed, 0, Space.World); } } if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)){ if (Input.GetKey(KeyCode.A)){ transform.Translate(-speed, 0, 0, Space.World); } else{ transform.Translate(speed, 0, 0, Space.World); } } else{ transform.Translate(0, 0, 0); } if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S)){ if (Input.GetKey(KeyCode.W)){ transform.Translate(0, 0, speed, Space.World); } else{ transform.Translate(0, 0, -speed, Space.World); } } else{ transform.Translate(0, 0, 0); } if (Input.GetKey("x") || Input.GetKey("z")){ if (Input.GetKey("x")){ transform.Translate(0, speed, 0, Space.World); } else{ transform.Translate(0, -speed, 0, Space.World); } } else{ transform.Translate(0, 0, 0); } } }
using ByteBank; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TestaDivisao_LidandocomERROS { class Program { static void Main(string[] args) { try { Metodo(); } catch (DivideByZeroException) { Console.WriteLine("Não é divisivel por zero"); } catch(Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.WriteLine("Aconteceu um erro"); } Console.ReadLine(); } //Teste com a cadeia de chamada: //Metodo -> TestaDivisao -> Dividir private static void Metodo() { TestaDivisao(0); //TestaDivisao(2); } private static void TestaDivisao(int divisor) { /*No "try" eu digo para o compilador, tente execultar este bloco de codigo aqui * caso caia em alguma exceção faça isto e assim acaba caindo no "catch"*/ try { int resultado = Dividir(10, divisor); Console.WriteLine("Resultado da divisão de 10 por " + divisor + " é " + resultado); } /*O que ocorre no "catch"? * Caso o bloco "try" não for execultado com sucesso, o compilador retorna o erro * aonde este erro sera tradado no catch. * No C# os erros são tratados como objetos, que são nada mais do que aquela mensagem * que aparece no bloco de exeção EX: System.ByZero.Exception.... * No "catch" eu recebo este erro, ou melhor este objeto que o compilador me retornou * e informo qual o tipo de tratamento eu devo dar a este erro */ catch (DivideByZeroException erro) { Console.WriteLine(erro.Message);//Mensagem do Objeto Console.WriteLine(erro.StackTrace);//Stack = Pilha / Trace = Rastro / Contem o rastro do erro // Console.WriteLine(erro. ); Console.WriteLine("Não é possivel fazer uma divisão por zero!"); } } private static int Dividir(int numero, int divisor) { try { return numero / divisor; } catch(DivideByZeroException) { Console.WriteLine("Excecao com numeros"+numero+" e divisor "+divisor); // return -1; throw; } } } }
using System; using System.Collections.Generic; namespace SchedulerTask { /// <summary> /// Формирование фронта /// </summary> class FrontBuilding { private List<Party> party; private List<IOperation> operations; private EquipmentManager equipmentManager; public FrontBuilding(List<Party> party, EquipmentManager equipmentManager) { this.party = party; // Получение операций из партий operations = new List<IOperation>(); foreach (Party i in party) { TreeIterator partyIterator = i.getIterator(i); while (partyIterator.next()) { operations.AddRange(partyIterator.Current.getPartyOperations()); } } this.equipmentManager = equipmentManager; } public void Build() { EventList events = new EventList(); foreach (Party i in party) { events.Add(new Event(i.getStartTimeParty())); } while (events.Count != 0) { List<IOperation> front = new List<IOperation>(); // Формирование фронта foreach (IOperation operation in operations) { //if (!operation.IsEnabled() && operation.PreviousOperationIsEnd(events[0].Time) && operation.GetParty().getStartTimeParty() <= events[0].Time) if (!operation.IsEnabled() && operation.PreviousOperationIsEnd(events[0].Time) && DateTime.Compare(operation.GetParty().getStartTimeParty(), events[0].Time) <= 0) //operation наступает раньше events[0].Time { DateTime operationTime; SingleEquipment equipment; if (equipmentManager.IsFree(events[0].Time, operation, out operationTime, out equipment)) { front.Add(operation); } else { events.Add(new Event(operationTime)); } } } // Сортировка фронта FrontSort.sortFront(front); // Назначение операций foreach (IOperation operation in front) { DateTime operationTime; SingleEquipment equipment; if (equipmentManager.IsFree(events[0].Time, operation, out operationTime, out equipment)) { operation.SetOperationInPlan(events[0].Time, operationTime, equipment); equipment.OccupyEquip(events[0].Time, operationTime); } events.Add(new Event(operationTime)); } events.RemoveFirst(); } } } }
// // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // #region Usings using System; #endregion namespace DotNetNuke.ComponentModel.DataAnnotations { public class TableNameAttribute : Attribute { public TableNameAttribute(string tableName) { TableName = tableName; } public string TableName { get; set; } } }
using Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Repository.Interface { public interface ICategoryRepository { List<category> GetAll(); List<category> GetAll(group_manager manager); } }
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public partial class Updatecust : System.Web.UI.Page { string constr = ConfigurationManager.ConnectionStrings["BizCon"].ConnectionString; string page = ConfigurationManager.AppSettings["Title"]; int routeid = 0; protected void Page_Load(object sender, EventArgs e) { routeid = Convert.ToInt32(Request.QueryString["Route_ID"].ToString()); if (!IsPostBack) { BindControlvalues(); } } private void BindControlvalues() { SqlConnection conn = new SqlConnection(constr); SqlCommand cmd = new SqlCommand("select Route_ID,Transporter_Name,From_loc as Source,To_loc as Destination,Capacity,Unit,Oneway_Price,Twoway_price,Post_date from bizconnect.dbo.Bizconnect_Route_Price where Route_ID=" + routeid, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds); UpdTransporter.Text = ds.Tables[0].Rows[0][1].ToString(); UpdSource.Text = ds.Tables[0].Rows[0][2].ToString(); UpdDestination.Text = ds.Tables[0].Rows[0][3].ToString(); UpdCapacity.Text = ds.Tables[0].Rows[0][4].ToString(); Updunit.Text = ds.Tables[0].Rows[0][5].ToString(); Updtxtone.Text = ds.Tables[0].Rows[0][6].ToString(); Updtxttwo.Text = ds.Tables[0].Rows[0][7].ToString(); } protected void btnUpdate_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(constr); conn.Open(); SqlCommand cmd = new SqlCommand("update Bizconnect.dbo.Bizconnect_Route_Price set Oneway_Price=" + Updtxtone.Text + ",Twoway_price=" + Updtxttwo.Text + " where Route_ID=" + Convert.ToInt32(Request.QueryString["Route_ID"].ToString()), conn); int result = cmd.ExecuteNonQuery(); conn.Close(); if (result == 1) { // ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('Data Edit Successfully !');</script>"); Response.Write("<script>window.close();</script>"); } } protected void btncancel_Click(object sender, EventArgs e) { } }
namespace SampleConsoleApplication { using System; public class Startup { public static void Main(string[] args) { SampleDataImporter.Create(Console.Out).Import(); } } }