public EditingModeForm(AuthorizationForm authorizationForm, ref LogicModel logicModel) { _authorizationForm = authorizationForm; _logicModel = logicModel; InitializeComponent(); RefreshTestList(); }
private static bool IsDataOrdered(LogicModel logicModel) { if (logicModel == null) { return(false); } if (logicModel.ExpressionsLogic == null) { return(false); } if (logicModel.ExpressionsLogic.OrderBy == null) { return(false); } if (logicModel.ExpressionsLogic.OrderBy.Expressions == null) { return(false); } if (logicModel.ExpressionsLogic.OrderBy.Expressions.Count == 0) { return(false); } return(true); }
protected override async Task SaveChanges() { if (!Validar()) { return; } LogicModel logicModel = new LogicModel(); try { if (_currentEntity.Id > 0) { await logicModel.UpdateModel(MapFromForm()); base.ShowInfo("Modelo modificado correctamente.", "Modificar Modelo."); } else { await logicModel.AddNewModel(MapFromForm()); base.ShowInfo("Modelo agregado correctamente.", "Modificar Modelo."); } if (Caller == ManagePhones.Util.Enums.CallerType.Panel) { Panels.ManageModels.Instancia.LoadData(); } this.Close(); } catch (LoggedException logex) { base.ShowError(logex.Message, "Modificar Modelo."); } }
protected void Page_Load(object sender, EventArgs e) { UserUtil.GotoLoginIfNoSuperadmin(); var tableID = DataConverter.ToNullableGuid(Request["TableID"]); var table = DataContext.LP_Tables.FirstOrDefault(n => n.ID == tableID); if (table == null) { return; } var converter = new TableEntityModelConverter(DataContext); var model = converter.Convert(table); var logic = new LogicModel { SourceID = model.ID, SourceType = "Table", }; var tableDataModel = new TableDataModel { Table = model, Logic = logic }; tableDataControl.Model = tableDataModel; }
public void ConvertDefaults(List <DefaultAssignment> defaults) { ProductModel pm = ModelWorkspace.CreateFromFile(pmxFile).ProductModel; var pmProductModelStructure = pm.ProductModelStructure; foreach (var defaultAssignment in defaults) { //var characteristic = _parseUtils.FindSelectionCriteriaCharacteristic( defaultAssignment.HierarchyElement ); //var precondition = _parseUtils.GeneratePrecondition( characteristic, defaultAssignment.HierarchyElement ); var model = defaultAssignment.Model; var coutry = defaultAssignment.Country; var variant = defaultAssignment.Variant; var defaultModel = new LogicModel(); defaultModel.AddRule("", "", ExprBld.IfThen( (ExprBld.Variables["Model"] == model) .And(ExprBld.Variables["coutry"] == coutry) .And(ExprBld.Variables["variant"] == variant), ExprBld.Variables[defaultAssignment.Assignment.Characteristic]) == defaultAssignment.Assignment.Value); var compiler = new Core.Compile.Compilation.Compiler(defaultModel); var defaultSolveData = compiler.CompileNddSolve(); var scopedDefaultData = new ScopedDefaultData(new[] { "model", "country", "variant" }, defaultSolveData); var packagedModelSerializer = new PackagedModelSerializer(); var packagedModel = packagedModelSerializer.LoadAsync(cameronPackage).Result.CopyAndInclude(scopedDefaultData); packagedModelSerializer.SaveAsync(cameronPackage, new[] { packagedModel }).Wait(); } }
public TestSolvingForm(ref LogicModel logicModel, PassingModeForm passingModeForm, int testIndex) : this() { _logicModel = logicModel; _passingModeForm = passingModeForm; _test = _logicModel.DataBase.GetTests()[testIndex]; _answers = new List <List <Answer> >(); if (_test.Questions.Count != 0) { Question currentQuestion = _test.Questions[_questionIndex]; lblQuestionNumber.Text = "Номер вопроса: " + 1; lblTestsNameValue.Text = currentQuestion.Task; for (int i = 1; i < 5; i++) { _answerIndex++; if (_answerIndex == currentQuestion.Answers.Count) { break; } else { SetAnswers(i); } } } }
public int TestDealCard(int turnCounter = 0) // used for testing purposes { if (tableSeats[turnCounter].cardValue >= 21 || tableSeats[turnCounter].isFrozen) { return(-1); } if (deckQ.Count <= 0) { CreateDeckQueue(); } CardObject c = deckQ.Dequeue(); //adds the cards into the list of cards at each seat tableSeats[turnCounter].seatCards.Add(c); //creates a card object from the prefab GameObject g = Instantiate(c.prefab, GetCardHolder(turnCounter)); tableSeats[turnCounter].IncrementCardsInPlay(); CardPool.Add(g); tableSeats[turnCounter].cardValue = LogicModel.Check21(tableSeats[turnCounter]); //checks and returns players total return(tableSeats[turnCounter].cardValue); }
public void QuadDown() // like double down except its 4x2 so you bet quads and have to get dealt two cards in a row { if (tableSeats[playerTurn].cardValue >= 21) { Debug.Log("Busted before second card could come out :("); return; } if (deckQ.Count <= 0) { CreateDeckQueue(); } tableSeats[playerTurn].quadDown = true; CardObject c = deckQ.Dequeue(); //creates a card object from the prefab GameObject g = Instantiate(c.prefab, GetCardHolder(playerTurn)); //adds the cards into the list of card objects and game objects at each seat tableSeats[playerTurn].seatCards.Add(c); tableSeats[playerTurn].CardGameObjects.Add(g); tableSeats[playerTurn].IncrementCardsInPlay(); CardPool.Add(g); tableSeats[playerTurn].cardValue = LogicModel.Check21(tableSeats[playerTurn]); }
public AuthorizationForm(LogicModel logicModel) { _logicModel = logicModel; _logicModel.DataBase.Load(); InitializeComponent(); listBoxSystemMode.SelectedIndex = 0; }
public void StartDealerTurn() { isPaused = true; FlipCard(tableSeats[0].CardGameObjects[0]); while (LogicModel.DealerDecision(tableSeats[0]) == "HIT") { if (deckQ.Count <= 0) { CreateDeckQueue(); } CardObject c = deckQ.Dequeue(); //creates a card object from the prefab GameObject g = Instantiate(c.prefab, GetCardHolder(0)); //adds the cards into the list of card objects and game objects at each seat tableSeats[0].seatCards.Add(c); tableSeats[0].CardGameObjects.Add(g); tableSeats[0].IncrementCardsInPlay(); CardPool.Add(g); } isPaused = false; incrementTurnCounter(); tableSeats[0].cardValue = LogicModel.Check21(tableSeats[0]); // EndGame(); CalculateBets(); game.uiManager.enableNewGame(); Debug.Log(LogicModel.DealerDecision(tableSeats[playerTurn])); }
public LogicModel CreateDefaultModel(IGrouping <string, DefaultAssignment> defaultAssignmentGroup, string variableFullName, VariableCollection variables) { var defaultModel = new LogicModel("defaultModel", null, variables); foreach (var defaultAssignment in defaultAssignmentGroup) { if (!ValuesInDomain(defaultAssignment, variables, variableFullName)) { Log.Warn($"value not in domain: {COUNTRY_VARIABLE} = {defaultAssignment.Country}"); continue; } var defaultExpr = ExprBld.IfThen( (ExprBld.Variables[MODEL_VARIABLE] == defaultAssignment.Model) .And(ExprBld.Variables[COUNTRY_VARIABLE] == defaultAssignment.Country) .And(ExprBld.Variables[VARIANT_VARIABLE] == defaultAssignment.Variant), ExprBld.Variables[variableFullName] == defaultAssignment.Assignment.Value ); var ruleDescription = $"{defaultAssignment.Model}.{defaultAssignment.Country}.{defaultAssignment.Variant}-{defaultAssignment.Assignment.Value}"; Log.Trace($"Adding default {ruleDescription}"); defaultModel.AddRule(ruleDescription, ruleDescription, defaultExpr); } return(defaultModel); }
public CreatingTestForm(ref LogicModel logicModel, EditingModeForm form, int index) { _form = form; _logicModel = logicModel; _index = index; InitializeComponent(); SetSource(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LogicModel logicModel = new LogicModel(); Application.Run(new AuthorizationForm(logicModel)); }
public void Stay() { if (isPaused) { return; } tableSeats[playerTurn].cardValue = LogicModel.Check21(tableSeats[playerTurn]); tableSeats[playerTurn].isFrozen = true; incrementTurnCounter(); }
public void TestLogicModelCase() { var logicModel = new LogicModel(); Assert.AreEqual(0, logicModel.X); Assert.AreEqual(0, logicModel.Y); Console.WriteLine($"Logic Model #1: {logicModel.X}, {logicModel.Y}"); logicModel = new LogicModel(1, 2); Assert.AreEqual(1, logicModel.X); Assert.AreEqual(2, logicModel.Y); Console.WriteLine($"Logic Model #2: {logicModel.X}, {logicModel.Y}"); }
public CreatingTestForm(ref LogicModel logicModel, EditingModeForm form) { _form = form; _logicModel = logicModel; _logicModel.TryAddTest( "Новый тест", new Question[] { new Question("Новый вопрос", new Answer[] { new Answer("Новый ответ", false) } , 0) }); _index = _logicModel.Author.GetTests.Length - 1; InitializeComponent(); SetSource(); }
public static void Execute(LogicModel model) { List <Chip> chips = model.Chips; Network powerGrid = new Network(); model.AddChip(new LogicReader(), powerGrid); model.AddChip(new LogicWriter(), powerGrid, chips.Last <LogicReader>().DataOutPort); powerGrid = new Network(); model.AddChip(new LogicReader(), powerGrid); model.AddChip(new LogicMemoryUnit(15)); model.AddChip(new MinMaxUnit(), powerGrid, chips.Last <LogicReader>().DataOutPort, chips.Last <LogicMemoryUnit>().DataOutPorts.First()); model.AddChip(new MathUnit() { Mode = MathMode.SUBTRACT }, powerGrid, chips.Last <LogicReader>().DataOutPort, chips.Last <MinMaxUnit>().DataOutPort); model.AddChip(new LogicMemoryUnit(1.5)); model.AddChip(new MathUnit() { Mode = MathMode.DIVIDE }, powerGrid, chips.Last <MathUnit>().DataOutPort, chips.Last <LogicMemoryUnit>().DataOutPorts.First()); model.AddChip(new LogicMemoryUnit(100)); model.AddChip(new MathUnit() { Mode = MathMode.MULTIPLY }, powerGrid, chips.First <LogicReader>().DataOutPort, chips.Last <LogicMemoryUnit>().DataOutPorts.First()); model.AddChip(new MinMaxUnit(), powerGrid, chips.Last <MathUnit>(c => c.Mode == MathMode.DIVIDE).DataOutPort, chips.Last <MathUnit>().DataOutPort); model.AddChip(new BatchWriter(), powerGrid, chips.Last <MinMaxUnit>().DataOutPort); }
public void MapToForm(Phone phone) { LogicModel logicModel = new LogicModel(); try { cbModelos.DataSource = logicModel.GetAll(); } catch (LoggedException logex) { base.ShowError(logex.Message, "Consultar Modelos."); } _currentEntity = phone; txtDescripcion.Text = phone.Descripcion; txtImei.Text = phone.Imei; cbModelos.SelectedItem = phone.Modelo; }
public void DoubleDown() { if (tableSeats[playerTurn].doubleDown) { incrementTurnCounter(); return; } if (!(game.betManager.myWallet.money >= tableSeats[playerTurn].tableBet)) { Debug.Log("Not enough funds to double down.."); return; } tableSeats[playerTurn].doubleDown = true; if (deckQ.Count <= 0) { CreateDeckQueue(); } CardObject c = deckQ.Dequeue(); //creates a card object from the prefab GameObject g = Instantiate(c.prefab, GetCardHolder(playerTurn)); //adds the cards into the list of card objects and game objects at each seat tableSeats[playerTurn].seatCards.Add(c); tableSeats[playerTurn].CardGameObjects.Add(g); tableSeats[playerTurn].IncrementCardsInPlay(); CardPool.Add(g); tableSeats[playerTurn].cardValue = LogicModel.Check21(tableSeats[playerTurn]); Debug.Log("doubled down!!"); game.betManager.DoubleBet(); incrementTurnCounter(); if (playerTurn == 0) { isPaused = true; StartDealerTurn(); return; } }
public void incrementTurnCounter() // increments player turn counter in game and this module { tableSeats[playerTurn].cardValue = LogicModel.Check21(tableSeats[playerTurn]); if (tableSeats[playerTurn].cardValue == 21) { Debug.Log("BlackJack!!"); playerTurn += 1; if (playerTurn >= numPlayers) { playerTurn = 0; } return; } if (playerTurn >= numPlayers) { playerTurn = 0; } else { playerTurn += 1; } }
public async override void LoadData() { logicModel = new LogicModel(); gridModelos.Rows.Clear(); try { IEnumerable <Modelo> listModelos = await logicModel.GetAll(); foreach (Modelo m in listModelos) { // IdModelo | IdMarca | Marca | Nombre | Descripcion // gridModelos.Rows.Add(m.Id, m.Marca.Id, m.Marca.Name, m.Nombre, m.Descripcion); } } catch (LoggedException logex) { base.ShowError(logex.Message, "Cargar Modelos"); } catch (Exception ex) { base.ShowError(ex.Message, "Cargar Modelos"); } }
public void Hit() { if (isPaused) { return; } if (deckQ.Count <= 0) { CreateDeckQueue(); } CardObject c = deckQ.Dequeue(); //creates a card object from the prefab GameObject g = Instantiate(c.prefab, GetCardHolder(playerTurn)); //adds the cards into the list of card objects and game objects at each seat tableSeats[playerTurn].seatCards.Add(c); tableSeats[playerTurn].CardGameObjects.Add(g); tableSeats[playerTurn].IncrementCardsInPlay(); CardPool.Add(g); tableSeats[playerTurn].cardValue = LogicModel.Check21(tableSeats[playerTurn]); if (tableSeats[playerTurn].cardValue >= 21 || tableSeats[playerTurn].isFrozen) { Debug.Log("Turn OVER!"); incrementTurnCounter(); if (playerTurn == 0) { isPaused = true; StartDealerTurn(); return; } } }
public PassingModeForm(AuthorizationForm authorizationForm, ref LogicModel logicModel) { _authorizationForm = authorizationForm; _logicModel = logicModel; InitializeComponent(); }
/// <summary> /// <see cref="IModelViewMediator"/> /// </summary> public void NotifyNewSessionRequest() { this.InEditingMode = false; LogicModel.ReStart(); this.DispatchNewRequest(); }
public QueryGenerator(PortalDataContext dbContext, LogicModel logicModel) { _dbContext = dbContext; _logicModel = logicModel; _sourceType = _logicModel.SourceType; _expressionsLogicModel = logicModel.ExpressionsLogic; if (_logicModel.SourceType == "Table") { var table = dbContext.LP_Tables.First(n => n.ID == _logicModel.SourceID); var converter = new TableEntityModelConverter(_dbContext); var model = converter.Convert(table); var columns = model.Columns; _querySource = GetCorrectName(model.Name); var allColumnsQuery = (from n in columns let m = GetCorrectName(n.Name) select new KeyValuePair <String, String>(n.Name, m)); _allColumns = allColumnsQuery.ToDictionary(); var primaryColumnsQuery = (from n in columns where n.IsPrimary let m = GetCorrectName(n.Name) select new KeyValuePair <String, String>(n.Name, m)); _primaryColumns = primaryColumnsQuery.ToDictionary(); var dbTypesQuery = (from n in columns let t = GetDataType(n.Type) let m = GetCorrectName(n.Name) select new KeyValuePair <String, SqlDbType>(m, t)); _dbTypes = dbTypesQuery.ToDictionary(); _outputColumns = GetOutputs().ToHashSet(); } else if (_logicModel.SourceType == "Logic") { var logic = dbContext.LP_Logics.First(n => n.ID == _logicModel.SourceID); var converter = new LogicEntityModelConverter(_dbContext); var model = converter.Convert(logic); var queryGen = new QueryGenerator(_dbContext, model); var selectQuery = queryGen.SelectQuery(true); _querySource = String.Format("({0})", selectQuery); var allColumnsQuery = (from n in queryGen.OutputColumns let m = GetCorrectName(n) select new KeyValuePair <String, String>(n, m)); _allColumns = allColumnsQuery.ToDictionary(); var dbTypesQuery = (from n in queryGen.OutputColumns let m = GetCorrectName(n) let t = queryGen.DbTypes[m] select new KeyValuePair <String, SqlDbType>(m, t)); _dbTypes = dbTypesQuery.ToDictionary(); _outputColumns = GetOutputs().ToHashSet(); } if (_primaryColumns == null || _primaryColumns.Count == 0) { _primaryColumns = _allColumns; } var allParamsQuery = (from n in _allColumns let p = String.Format("@v{0}", n.Key.ComputeCrc16()) select new KeyValuePair <String, String>(n.Value, p)); _allColumnsParams = allParamsQuery.ToDictionary(); var primaryParamsQuery = (from n in _primaryColumns let p = String.Format("@p{0}", n.Key.ComputeCrc16()) select new KeyValuePair <String, String>(n.Value, p)); _primaryColumnsParams = primaryParamsQuery.ToDictionary(); }
/// <summary> /// 测试用的 /// </summary> /// <returns></returns> public ActionResult GetItemCategory() { logic = new LogicModel(); return(PartialView(logic.GetItemCategories(HttpContext.Cache))); }