public List <BJRecord> GetBookByIDMAIN(int IDMAIN, Bases fund) { if (fund == Bases.BJSCC) { DA.SelectCommand.CommandText = "select A.*,B.PLAIN from BJSCC..DATAEXT A " + " left join BJSCC..DATAEXTPLAIN B on A.ID = B.IDDATAEXT where A.IDMAIN = " + IDMAIN; } else { DA.SelectCommand.CommandText = "select A.*,B.PLAIN from BJSCC..DATAEXT A " + " left join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT where A.IDMAIN = " + IDMAIN; } DS = new DataSet(); DA.Fill(DS, "t"); List <BJRecord> Book = new List <BJRecord>(); BJRecord rec; foreach (DataRow r in DS.Tables["t"].Rows) { rec = new BJRecord(); rec.ID = (int)r["ID"]; rec.IDDATA = (int)r["IDDATA"]; rec.IDINLIST = (int)r["IDINLIST"]; rec.IDMAIN = IDMAIN; rec.MNFIELD = (int)r["MNFIELD"]; rec.MSFIELD = r["MSFIELD"].ToString(); rec.PLAIN = r["PLAIN"].ToString(); rec.SORT = r["SORT"].ToString(); rec.Fund = fund; Book.Add(rec); } return(Book); }
private void ScanServerCommandExecuted(object obj) { try { var server = new Server(TelegramSetting.ServerPath, TelegramSetting.ServerAdminUserName, TelegramSetting.ServerAdminPass); foreach (var serverBaseName in server.GetBases()) { if (Bases.FirstOrDefault(b => b.Title == serverBaseName) is null) { var base1C = new Base { Title = serverBaseName, Folder = Path.Combine(TelegramSetting.ServerPath, serverBaseName), User = "******", IsRepository = true, IsServer = true }; db.AddEntity(base1C); } } } catch (Exception e) { MessageBox.Show(e.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="T:StatusQuoBaseball.Gameplay.Game"/> class. /// </summary> /// <param name="venue">Venue</param> /// <param name="roadTeam">Team</param> /// <param name="homeTeam">Team</param> /// <param name="gameTime">string</param> /// <param name="maxInnings">int</param> /// <param name="isSeasonMode">bool</param> public Game(Venue venue, Team roadTeam, Team homeTeam, string gameTime, int maxInnings, bool isSeasonMode = false) { this.venue = venue; this.scoreboard = new Scoreboard(this, roadTeam, homeTeam); this.roadTeam = roadTeam; this.homeTeam = homeTeam; this.roadTeam.Game = this; this.homeTeam.Game = this; this.roadTeam.TeamActionEventHandled += OnTeamActionEventHandled; this.homeTeam.TeamActionEventHandled += OnTeamActionEventHandled; this.gameTime = gameTime; this.isSeasonMode = isSeasonMode; if (this.isSeasonMode) { this.id = $"Game {gamesPlayedInSeason + 1} "; } else { this.id = "Game "; } this.id += $"{DateTime.Now.ToLongDateString()} {DateTime.Now.ToLongTimeString()} {this.roadTeam} v {this.homeTeam}@{this.gameTime}"; BuildToString(); this.innings = new List <Inning>(); this.maxInnings = maxInnings; this.bases = new Bases(); this.bases.runScoredEventHandled += OnRunScored; }
// Constructor call public override IMember CreateInstance(IArgumentSet args) { var builtins = DeclaringModule.Interpreter.ModuleResolution.BuiltinsModule; // Specializations switch (Name) { case "list": return(PythonCollectionType.CreateList(builtins, args)); case "dict": { // self, then contents var contents = args.Values <IMember>().Skip(1).FirstOrDefault(); return(new PythonDictionary(builtins, contents)); } case "tuple": { var contents = args.Values <IMember>(); return(PythonCollectionType.CreateTuple(builtins, contents)); } } // Metaclasses return type, not instance. if (Bases.MaybeEnumerate().Any(b => b.Name == "type" && b.DeclaringModule.ModuleType == ModuleType.Builtins)) { return(this); } return(new PythonInstance(this)); }
private void MoveOver(ResponseObservation observation, List <Action> actions) { var over = observation.Observation.RawData.Units.Where(d => d.UnitType == UnitTypes.OVERLORD && d.Alliance == Alliance.Self && d.Orders.Count() == 0).FirstOrDefault(); if (over == null) { return; } var newBase = Bases.Where(b => !b.Taken && !b.OverSent).OrderBy(b => b.DistanceToMain).FirstOrDefault(); if (newBase == null) { return; } newBase.OverSent = true; var command = new ActionRawUnitCommand { AbilityId = 1, TargetWorldSpacePos = new Point2D { X = newBase.Position.X, Y = newBase.Position.Y }, }; command.UnitTags.Add(over.Tag); command.QueueCommand = true; actions.Add(new Action { ActionRaw = new ActionRaw { UnitCommand = command } }); }
private void BuildHata(ResponseObservation observation, List <Action> actions) { if (observation.Observation.PlayerCommon.Minerals < 300) { return; } if (Bases.Where(b => b.Taken).Count() > 2) { return; } var newBase = GetBaseForPool(); var command = new ActionRawUnitCommand { AbilityId = 1152, TargetWorldSpacePos = new Point2D { X = newBase.Position.X, Y = newBase.Position.Y }, QueueCommand = true }; command.UnitTags.Add(GetBuldingDrone(observation).Tag); actions.Add(new Action { ActionRaw = new ActionRaw { UnitCommand = command } }); }
/// <summary> /// Forces the system to valuate the object type and adds it to the Bases /// </summary> /// <param name="basis">the item to value</param> /// <returns>the new value</returns> public decimal MakeValuation(IInanimateTemplate basis) { IEconomicBasis basi = Bases.FirstOrDefault(bas => bas.ItemType == basis); if (basi != null) { return(basi.Basis * basi.Adjustment); } int newBaseValue = basis.Name.Length; if (basis.Qualities.Any()) { newBaseValue += Math.Max(1, basis.Qualities.Sum(quality => quality.Value)); } EconomicBasis newBasis = new EconomicBasis() { Adjustment = 1, Basis = newBaseValue, ItemType = basis, Trend = 1 }; Bases.Add(newBasis); return(newBasis.Basis * newBasis.Adjustment); }
private void diseñarDgPersonal() { Bases.DiseñoDG(ref dgPersonal); Bases.DiseñoDGEliminar(ref dgPersonal); PanelPaginado.Visible = true; dgPersonal.Columns["idPersonal"].Visible = false; dgPersonal.Columns["idCargo"].Visible = false; }
public static void Initialize() { Bases.Add("Stockpile", new BuildingBase(BuildingType.Stockpile, "Stockpile", new Point(64), Art.Textures["Stockpile"], -1)); Bases.Add("Forge", new BuildingBase(BuildingType.Forge, "Forge", new Point(64), Art.Textures["Forge"], 25)); Bases.Add("Smelter", new BuildingBase(BuildingType.Smelter, "Smelter", new Point(64), Art.Textures["Smelter"], 25)); Bases.Add("Windmill", new BuildingBase(BuildingType.Windmill, "Windmill", new Point(64), Art.Textures["Windmill"], 25)); Bases.Add("Bakery", new BuildingBase(BuildingType.Bakery, "Bakery", new Point(64), Art.Textures["Bakery"], 25)); }
private void DiseñarDtvPersonal() { Bases.DiseñoDtv(ref datalistadoPersonal); Bases.DiseñoDtvEliminar(ref datalistadoPersonal); PanelPaginado.Visible = true; datalistadoPersonal.Columns[2].Visible = false; datalistadoPersonal.Columns[7].Visible = false; }
private void designDtvPersonal() { Bases.DesignDtv(ref dataListadoPersonal); Bases.DesignDtvEliminar(ref dataListadoPersonal); panelPaginado.Visible = true; dataListadoPersonal.Columns[2].Visible = false; dataListadoPersonal.Columns[7].Visible = false; }
public static void Initialize() { Bases.Add("Tree", new ResourceNodeBase("Tree", new Point(32), Art.Textures["Tree"], ResourceNodeType.Tree)); Bases.Add("Iron Rock", new ResourceNodeBase("Iron Rock", new Point(32), Art.Textures["Iron Rock"], ResourceNodeType.IronRock)); Bases.Add("Sticks", new ResourceNodeBase("Sticks", new Point(32), Art.Textures["Sticks"], ResourceNodeType.Sticks)); Bases.Add("Coal Rock", new ResourceNodeBase("Coal Rock", new Point(32), Art.Textures["Coal Rock"], ResourceNodeType.CoalRock)); Bases.Add("Farm", new ResourceNodeBase("Farm", new Point(64), Art.Textures["Farm"], ResourceNodeType.Farm)); }
public ActionResult DeleteConfirmed(int id) { Bases bases = db.Bases.Find(id); db.Bases.Remove(bases); db.SaveChanges(); return(RedirectToAction("Index")); }
private void diseñarDgvUsuarios() { Bases.DiseñoDG(ref dgUsuario); Bases.DiseñoDGEliminar(ref dgUsuario); dgUsuario.Columns["idUsuario"].Visible = false; dgUsuario.Columns["clave"].Visible = false; dgUsuario.Columns["icono"].Visible = false; }
internal CXXRecordDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind) { _bases = new Lazy <IReadOnlyList <CXXBaseSpecifier> >(() => CursorChildren.OfType <CXXBaseSpecifier>().ToList()); _ctors = new Lazy <IReadOnlyList <CXXConstructorDecl> >(() => Methods.OfType <CXXConstructorDecl>().ToList()); _destructor = new Lazy <CXXDestructorDecl>(() => Methods.OfType <CXXDestructorDecl>().SingleOrDefault()); _friends = new Lazy <IReadOnlyList <FriendDecl> >(() => Decls.OfType <FriendDecl>().ToList()); _methods = new Lazy <IReadOnlyList <CXXMethodDecl> >(() => Decls.OfType <CXXMethodDecl>().ToList()); _vbases = new Lazy <IReadOnlyList <CXXBaseSpecifier> >(() => Bases.Where((@base) => @base.IsVirtual).ToList()); }
public Number MakeNumber(string num, Bases _base) { switch (_base) { case Bases.Hex: return new HexNumber(num); case Bases._Decimal: return new DecimalNumber(num); case Bases.Binary: return new BinaryNumber(num); default: return null; } }
private void InitHatas(ResponseObservation observation) { FindBaseLocations(observation); SetBasePosionsByMinerals(); var hatas = observation.Observation.RawData.Units.Where(d => d.UnitType == UnitTypes.HATCHERY && d.Alliance == Alliance.Self).ToList(); if (hatas.Count() != Bases.Where(b => b.Taken).Count()) { foreach (var h in hatas) { foreach (var b in Bases) { if (Dist.Distance(b.Position, h.Pos) < 5) { b.Taken = true; b.Position = h.Pos; b.BaseId = h.Tag; } } } } if (MainBase == 0 && hatas != null) { MainBase = hatas.FirstOrDefault().Tag; } //if (hatas.Count() > 1 || hatas.Count() == 0) // return; var minDist = float.MaxValue; var bas = Bases[0]; foreach (var b in Bases) { var dist = Dist.Distance(b.Position, hatas[0].Pos); if (dist < minDist) { minDist = dist; bas = b; } } bas.BaseId = hatas[0].Tag; foreach (var b in Bases) { if (b.BaseId == MainBase) { continue; } b.DistanceToMain = Dist.Distance(hatas[0].Pos, b.Position); } }
public void BasesTest() { var bases = new Bases(); // All bases should be null (not occupied by players) foreach (var b in bases.Occupied) { Assert.IsNull(b); } }
public ActionResult Edit([Bind(Include = "Id_Base,Base")] Bases bases) { if (ModelState.IsValid) { db.Entry(bases).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bases)); }
public override int GetHashCode() { unchecked { int hash = Outs.GetHashCode(); hash += (hash * 57) + RunsScored.GetHashCode(); hash += (hash * 57) + Bases.GetHashCode(); return(hash); } }
public void MineralOptimizationByNikita(ResponseObservation observation, List <Action> actions) { var hatas = observation.Observation.RawData.Units.Where(d => d.UnitType == UnitTypes.HATCHERY && d.Alliance == Alliance.Self).ToList(); if (hatas.Count() < 2) { return; } foreach (var h in hatas) { if (h.AssignedHarvesters <= h.IdealHarvesters) { continue; } var boringHata = observation.Observation.RawData.Units.Where(d => d.UnitType == UnitTypes.HATCHERY && d.Alliance == Alliance.Self && d.IdealHarvesters > d.AssignedHarvesters).FirstOrDefault(); if (boringHata == null) { return; } var drones = observation.Observation.RawData.Units.Where(d => d.UnitType == UnitTypes.DRONE && d.Alliance == Alliance.Self); foreach (var d in drones) { if (IsNeightbors(d, h) && d.Orders.Where(a => a.AbilityId == 1183).Any()) { var bse = Bases.Where(b => b.BaseId == boringHata.Tag).FirstOrDefault(); Unit mineralSent = GetClosestMineral(observation, boringHata.Pos); var command = new ActionRawUnitCommand { AbilityId = 1183, TargetWorldSpacePos = new Point2D { X = mineralSent.Pos.X, Y = mineralSent.Pos.Y }, QueueCommand = true, TargetUnitTag = mineralSent.Tag }; command.UnitTags.Add(d.Tag); actions.Add(new Action { ActionRaw = new ActionRaw { UnitCommand = command } }); return; } } } }
public ActionResult Create([Bind(Include = "Id_Base,Base")] Bases bases) { if (ModelState.IsValid) { db.Bases.Add(bases); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bases)); }
public UMLClass(string stereoType, string @namespace, bool isAbstract, string name, IEnumerable <UMLDataType> baseClasses, params UMLInterface[] interfaces) : base(name, @namespace, interfaces) { StereoType = stereoType; if (baseClasses is not null) { Bases.AddRange(baseClasses); } IsAbstract = isAbstract; }
public override IMember Index(IPythonInstance instance, IArgumentSet args) { var defaultReturn = base.Index(instance, args); var fromBases = Bases .MaybeEnumerate() .Select(b => b.Index(instance, args)) .Except(new[] { defaultReturn, UnknownType }) .FirstOrDefault(); return(fromBases ?? defaultReturn); }
private void BuscarCargos() { DataTable dt = new DataTable(); Dcargos funcion = new Dcargos(); funcion.buscarCargos(ref dt, txtCargo.Text); datalistadoCargos.DataSource = dt; Bases.DiseñoDtv(ref datalistadoCargos); datalistadoCargos.Columns[1].Visible = false; datalistadoCargos.Columns[3].Visible = false; datalistadoCargos.Visible = true; }
private void buscarCargo() { CargoController funcion = new CargoController(); DataTable dt = new DataTable(); funcion.buscarCargo(txtCargo.Text, ref dt); dgListadoCargos.DataSource = dt; Bases.DiseñoDG(ref dgListadoCargos); dgListadoCargos.Columns[1].Visible = false; dgListadoCargos.Columns[3].Visible = false; dgListadoCargos.Visible = true; }
// GET: Bases/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Bases bases = db.Bases.Find(id); if (bases == null) { return(HttpNotFound()); } return(View(bases)); }
public IPythonType CreateSpecificType(IArgumentSet args, IPythonModule declaringModule, LocationInfo location = null) { location = location ?? LocationInfo.Empty; // Get declared generic parameters of the class, i.e. list of Ts in Generic[T1, T2, ...] var genericClassParameters = Bases.OfType <IGenericClassParameter>().ToArray(); // Optimistically use the first one // TODO: handle optional generics as class A(Generic[_T1], Optional[Generic[_T2]]) var genericClassParameter = genericClassParameters.FirstOrDefault(); // Create map of names listed in Generic[...] in the class definition. // We will be filling the map with specific types, if any provided. var genericTypeDefinitions = genericClassParameter?.TypeDefinitions ?? Array.Empty <IGenericTypeDefinition>(); var genericClassTypeParameters = genericTypeDefinitions.ToDictionary(td => td.Name, td => td); var specificClassTypeParameters = new Dictionary <string, IPythonType>(); var newBases = new List <IPythonType>(); // Arguments passed are those of __init__ or it is a copy constructor. // They do not necessarily match all of the declared generic parameters. // Some generic parameters may be used to specify method return types or // method arguments and do not appear in the constructor argument list. // Figure out whatever specific types we can from the arguments. foreach (var a in args.Arguments) { // The argument may either match generic type definition of be a specific type // created off generic type. Consider '__init__(self, v: _T)' and // 'class A(Generic[K, V], Mapping[K, V])'. if (a.Type is IGenericTypeDefinition argTypeDefinition) { // Parameter is annotated as generic type definition. Check if its generic type // name matches any of the generic class parameters. I.e. if there is // an argument like 'v: _T' we need to check if class has matching Generic[_T]. if (genericClassTypeParameters.ContainsKey(argTypeDefinition.Name)) { // TODO: Check if specific type matches generic type definition constraints and report mismatches. // Assign specific type. if (a.Value is IMember m && m.GetPythonType() is IPythonType pt) { specificClassTypeParameters[argTypeDefinition.Name] = pt; } else { // TODO: report supplied parameter is not a type. } } else { // TODO: report generic parameter name mismatch. } }
private protected CXXRecordDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind, expectedDeclKind) { if ((CX_DeclKind.CX_DeclKind_LastCXXRecord < handle.DeclKind) || (handle.DeclKind < CX_DeclKind.CX_DeclKind_FirstCXXRecord)) { throw new ArgumentException(nameof(handle)); } _bases = new Lazy <IReadOnlyList <CXXBaseSpecifier> >(() => CursorChildren.OfType <CXXBaseSpecifier>().ToList()); _ctors = new Lazy <IReadOnlyList <CXXConstructorDecl> >(() => Methods.OfType <CXXConstructorDecl>().ToList()); _destructor = new Lazy <CXXDestructorDecl>(() => Methods.OfType <CXXDestructorDecl>().SingleOrDefault()); _friends = new Lazy <IReadOnlyList <FriendDecl> >(() => Decls.OfType <FriendDecl>().ToList()); _methods = new Lazy <IReadOnlyList <CXXMethodDecl> >(() => Decls.OfType <CXXMethodDecl>().ToList()); _vbases = new Lazy <IReadOnlyList <CXXBaseSpecifier> >(() => Bases.Where((@base) => @base.IsVirtual).ToList()); }
private void confimarSalida() { AsistenciasModel parametros = new AsistenciasModel(); AsistenciasController funcion = new AsistenciasController(); parametros.idPersonal = idPersonal; parametros.fechaSalida = DateTime.Now; parametros.horas = Bases.DateDiff(Bases.DateInterval.Hour, fechaRegistro, DateTime.Now); if (funcion.modificarAsistencia(parametros) == true) { txtAviso.Text = "SALIDA REGISTRADA"; txtIdentificacion.Clear(); txtIdentificacion.Focus(); } }
public void Bases_EmptyTest() { var bases = new Bases(); // Bases should be empty Assert.AreEqual(true, bases.Empty); // Put a player on first var player = new BinaryBaseball.Common.Player(); bases.Occupied[0] = player; // Should NOT be empty Assert.AreEqual(false, bases.Empty); }
// Перевод в другую систему счисление, в зависимости от основания (Шаблонный метод) public Number ToAnotherSystem(Bases _base) { switch (_base) { case Bases._Decimal: { return ToDecimal(); } case Bases.Binary: { return ToBinary(); } case Bases.Hex: { return ToHex(); } default: return null; } }
public string ToAnotherSystem(string num, Bases curBase, Bases needBase) { if (num.Contains('-')) return '-' + factory.MakeNumber(num.Remove(0, 1), curBase).ToAnotherSystem(needBase).ToString(); else return factory.MakeNumber(num, curBase).ToAnotherSystem(needBase).ToString(); }
public Number MakeNum(string num, Bases _base) { return factory.MakeNumber(num, _base); }