public void RunCommand(FieldManager fieldManager, string commandString) { if (commandString == null) { throw new ArgumentNullException("no command"); } ProcessCommand(fieldManager, commandString); }
void Start() { if (_instance == null) _instance = this; else Destroy(gameObject); InitList(); }
public Account(string name, Uri icon, FieldManager field) { Field = field; Name = name; Icon = icon; StatusSelecter = new List<CheckinStateViewModel>() { new CheckinStateViewModel(this, null, Controls.CloudStateType.Sunny, new Uri("/Resources/Wathers/sunny.png", UriKind.Relative), App.Current.Dispatcher), new CheckinStateViewModel(this, null, Controls.CloudStateType.Rainy, new Uri("/Resources/Wathers/rainy.png", UriKind.Relative), App.Current.Dispatcher), new CheckinStateViewModel(this, null, Controls.CloudStateType.Thunder, new Uri("/Resources/Wathers/thunder.png", UriKind.Relative), App.Current.Dispatcher), }; }
void Awake() { if ( Instance == null ) { Instance = this; DontDestroyOnLoad( this ); playerOne = GameObject.FindGameObjectWithTag( "Player One" ).transform; playerTwo = GameObject.FindGameObjectWithTag( "Player Two" ).transform; playerOneStart = GameObject.FindGameObjectWithTag( "Player One Start" ).transform.position; playerTwoStart = GameObject.FindGameObjectWithTag( "Player Two Start" ).transform.position; ball = GameObject.FindGameObjectWithTag( "Ball" ); } else if ( Instance != this ) { Destroy( this ); } }
private void ProcessAttackCommand(FieldManager fieldManager, string[] commandArguments) { if (fieldManager == null) { throw new ArgumentNullException("battleManager"); } if (commandArguments == null) { throw new ArgumentNullException(" no arguments"); } if (commandArguments.Length < 4) { throw new ArgumentException("Invalid number of arguments for attack command"); } CardId atackingCard = new CardId(commandArguments[0], (PlayerIndentifier)int.Parse(commandArguments[1])); CardId defendingCard = new CardId(commandArguments[2], (PlayerIndentifier)int.Parse(commandArguments[3])); fieldManager.Attack(atackingCard, defendingCard); }
void Update() { deltaSpawnTime += Time.deltaTime; if (deltaSpawnTime > spawnTIme) { deltaSpawnTime = 0.0f; //GameObject enemyObj = Instantiate(enemy) as GameObject; for (int i = 0; i < poolSize; ++i) { GameObject enemyObj = testPool[i]; if (enemyObj.activeSelf == true) { continue; } fm = FieldManager.GetInstance(); fm.inFieldEnemies.Add(testPool[i]); enemyObj.SetActive(true); break; } } }
private void ProcessCommand(FieldManager fieldManager, string commandString) { var commandSplitters = new char[] { ' ', '(', ')' }; var commandArguments = commandString.Split(commandSplitters, StringSplitOptions.RemoveEmptyEntries); var command = commandArguments[0]; if (!this.possibleComands.Contains(command)) { throw new ArgumentException(string.Format("Invalid command name \"{0}\"", command)); } if (command == "play") { ProcessPlayCommand(fieldManager, commandArguments.Skip(1).ToArray()); } else if (command == "attack") { ProcessAttackCommand(fieldManager, commandArguments.Skip(1).ToArray()); } else if (command == "switch") { ProcessSwitchCommand(fieldManager, commandArguments.Skip(1).ToArray()); } }
public void OnCollisionEnter(Collision collision) { if (collision.transform.gameObject.tag == "Ball") { if (PowerUpStrength != 1.0f) { FieldManager.GetInstance().Ball.PowerUp(PowerUpStrength); } SetLineDead(); bodyCol.enabled = false; SoundManager.GetInstance().PlayerOneShotBallLineHit(); Vector3 hitPos; foreach (ContactPoint point in collision.contacts) { if (point.thisCollider == bodyCol) { hitPos = point.point; transform.position = hitPos; } } } }
private void Child_Update() { if (!IsDirty) { return; } using (var dalManager = DalFactorySelfLoad.GetManager()) { var args = new DataPortalHookArgs(); OnUpdatePre(args); var dal = dalManager.GetProvider <IC08_RegionDal>(); using (BypassPropertyChecks) { dal.Update( Region_ID, Region_Name ); } OnUpdatePost(args); // flushes all pending data operations FieldManager.UpdateChildren(this); } }
public Continent(ITemplateManager templateManager, FieldManager fieldManager, ContinentTemplate template) { Template = template; _templateManager = templateManager; StartShipMoveField = fieldManager.Get(template.StartShipMoveFieldID); WaitField = fieldManager.Get(template.WaitFieldID); MoveField = fieldManager.Get(template.MoveFieldID); if (template.CabinFieldID.HasValue) { CabinField = fieldManager.Get(template.CabinFieldID.Value); } EndField = fieldManager.Get(template.EndFieldID); EndShipMoveField = fieldManager.Get(template.EndShipMoveFieldID); var now = DateTime.Now; NextBoarding = now .AddMinutes(now.Minute % Template.Term == 0 ? 0 : Template.Term - now.Minute % Template.Term) .AddMinutes(Template.Delay) .AddSeconds(-now.Second); ResetEvent(); }
public static PrivateData <Dictionary <ResourceId, Guid> > GetNumberApplicationField(string numberApplicationField) { return(new PrivateData <Dictionary <ResourceId, Guid> >( (session, test) => { return Task.Run(() => { var handler = new FieldManager(); var result = new Dictionary <ResourceId, Guid>(); foreach (ResourceId resource in Utils.Resources()) { var response = handler.GetFieldGuid(new[] { numberApplicationField }, new[] { (TestCoreFramework.Enums.ResourceType)(int) resource }); PrAssume.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not get field"); PrAssume.That(response.Result.Result.Count, PrIs.GreaterThan(0), "Can not get field"); var fields = response.Result.Result.Select(x => x.Id); result.Add(resource, fields.First()); } return result; }); }, (session, test, res) => Task.Run(() => { }))); }
private void LoadInfo() { fsStat.AllField = FieldManager.GetFields(typeof(Stat)); fsStat.SelectField = _srs.StatFields.Copy(); fsStat.LoadInfo(); //heads DataFieldAttribute fMaterialClass = new DataFieldAttribute { Description = "物料小类" }; DataFieldAttribute fDefinition = new DataFieldAttribute { Description = "物料名称" }; DataFieldAttribute fLotName = new DataFieldAttribute { Description = "批次名称" }; DataFieldAttribute fHut = new DataFieldAttribute { Description = "位置" }; DataFieldAttribute fProduceDate = new DataFieldAttribute { Description = "计划检测日期" }; //DataFieldAttribute fCheckCategory = new DataFieldAttribute { Description = "项目类型" }; DataFieldAttribute fSupplier = new DataFieldAttribute { Description = "供应商" }; DataFieldAttribute fInspector = new DataFieldAttribute { Description = "检验员" }; fsHead.AllField = new FieldCollection(); fsHead.AllField.AddRange(new DataFieldAttribute[] { fProduceDate, fMaterialClass, fDefinition, fHut, fLotName, fSupplier, fInspector }); fsHead.SelectField = _srs.HeadFields; fsHead.LoadInfo(); }
public IHttpActionResult Submit(int pollId) { try { var request = Context.AuthenticatedRequest; var pollInfo = PollManager.Repository.GetPollInfo(pollId); if (pollInfo == null) { return(null); } if (pollInfo.IsCaptcha) { var code = request.GetPostString("code"); var cookie = HttpContext.Current.Request.Cookies.Get("ss-poll:" + pollId); var cookieValue = cookie?.Value; if (string.IsNullOrEmpty(cookieValue) || !PollUtils.EqualsIgnoreCase(cookieValue, code)) { throw new Exception("提交失败,验证码不正确!"); } } var itemIds = request.GetPostString("itemIds").Split(',').Select(idStr => Convert.ToInt32(idStr)).ToList(); if (pollInfo.IsCheckbox) { if (pollInfo.CheckboxMin > 0 && itemIds.Count < pollInfo.CheckboxMin) { throw new Exception($"提交失败,最少需要选择{pollInfo.CheckboxMin}项!"); } if (pollInfo.CheckboxMax > 0 && itemIds.Count > pollInfo.CheckboxMax) { throw new Exception($"提交失败,最多只能选择{pollInfo.CheckboxMax}项!"); } } var logInfo = new LogInfo { PollId = pollInfo.Id, ItemIds = string.Join(",", itemIds), AddDate = DateTime.Now }; var attributes = request.GetPostObject <Dictionary <string, string> >("attributes"); var fieldInfoList = FieldManager.GetFieldInfoList(pollInfo.Id); foreach (var fieldInfo in fieldInfoList) { string value; attributes.TryGetValue(fieldInfo.Title, out value); logInfo.Set(fieldInfo.Title, value); } LogManager.Repository.Insert(pollInfo, logInfo); ItemManager.Repository.AddCount(pollInfo.Id, itemIds); var itemInfoList = ItemManager.GetItemInfoList(pollInfo.Id); var totalCount = itemInfoList.Sum(x => x.Count); var items = new List <object>(); foreach (var itemInfo in itemInfoList) { var percentage = "0%"; if (totalCount > 0) { percentage = Convert.ToDouble(itemInfo.Count / (double)totalCount).ToString("0.0%"); } items.Add(new { itemInfo.Id, itemInfo.PollId, itemInfo.Title, itemInfo.SubTitle, itemInfo.ImageUrl, itemInfo.Count, Percentage = percentage }); } return(Ok(new { TotalCount = totalCount, Items = items })); } catch (Exception ex) { return(InternalServerError(ex)); } }
// Use this for initialization void Start() { // if (GameObject.Find("GameManager").GetComponent<DataMessenger>().Mode == "easy") puyoColorNum = 4; // else puyoColorNum = 5; puyoColorNum = 5; FM = GetComponent <FieldManager>(); checkFrag = new bool[FM.W, FM.H]; connectNum = new int[FM.W, FM.H]; //初期適当に配置する for (int y = 0; y < FM.H; y++) { for (int x = 0; x < FM.W; x++) { FM.field[x, y] = Random.Range(1, puyoColorNum + 1); } } //連鎖しないようにフィールドいじる while (IsChain()) { } //それをもとにインスタンス化 ぷよにはColor Tagをつける for (int y = 0; y < FM.H; y++) { for (int x = 0; x < FM.W; x++) { GameObject puyo = Instantiate(FM.puyo, new Vector3(x, FM.H + y, 0), new Quaternion(0, 0, 0, 0)); int val = FM.field[x, y]; if (val == 1) { puyo.tag = "Red"; } else if (val == 2) { puyo.tag = "Green"; } else if (val == 3) { puyo.tag = "Blue"; } else if (val == 4) { puyo.tag = "Yellow"; } else if (val == 5) { puyo.tag = "Purple"; } else { puyo.tag = "No"; } // if (y >= 30) // { // puyo.tag = "No"; // // } FM.puyoList.Add(puyo); } } }
private void Awake() { render = GetComponent <SpriteRenderer>(); fieldManager = FieldManager.Instance; }
public void Init(InGameManager.IntervalTransferInfo transfer_info = null) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) Self self = null; if (transfer_info != null) { int i = 0; for (int count = transfer_info.playerInfoList.Count; i < count; i++) { InGameManager.IntervalTransferInfo.PlayerInfo playerInfo = transfer_info.playerInfoList[i]; Player player = null; CoopClient coopClient = null; if (MonoBehaviourSingleton <CoopManager> .IsValid() && !playerInfo.isSelf && playerInfo.coopClientId != 0) { coopClient = MonoBehaviourSingleton <CoopManager> .I.coopRoom.clients.FindByClientId(playerInfo.coopClientId); } if (playerInfo.isSelf) { player = CreatePlayer(0, playerInfo.createInfo, true, Vector3.get_zero(), 0f, playerInfo.transferInfo, null); if (player == null) { continue; } self = (player as Self); self.taskChecker = playerInfo.taskChecker; } else { bool flag = false; if (MonoBehaviourSingleton <CoopManager> .IsValid()) { if (MonoBehaviourSingleton <CoopManager> .I.coopRoom.isOfflinePlay) { flag = true; } else if (coopClient != null && coopClient.isLeave && MonoBehaviourSingleton <CoopManager> .I.isStageHost) { flag = true; } } if (flag || playerInfo.coopMode == StageObject.COOP_MODE_TYPE.NONE || playerInfo.coopMode == StageObject.COOP_MODE_TYPE.ORIGINAL) { player = CreatePlayer(playerInfo.id, playerInfo.createInfo, false, Vector3.get_zero(), 0f, playerInfo.transferInfo, null); if (player == null) { continue; } player.SetAppearPosGuest(Vector3.get_zero()); if (coopClient != null && playerInfo.isCoopPlayer) { coopClient.SetPlayerID(player.id); } } else { PlayerLoader.OnCompleteLoad callback = delegate(object o) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Player player2 = o as Player; player2.get_gameObject().SetActive(false); MonoBehaviourSingleton <StageObjectManager> .I.AddCacheObject(player2); }; player = CreatePlayer(playerInfo.id, playerInfo.createInfo, false, Vector3.get_zero(), 0f, playerInfo.transferInfo, callback); if (player == null) { continue; } if (coopClient != null) { coopClient.SetCachePlayer(player.id, playerInfo.isCoopPlayer); } } if (flag || playerInfo.isNpcController) { if (!(player.controller is NpcController)) { player.AddController <NpcController>(); } if (QuestManager.IsValidInGameDefenseBattle()) { player.DestroyObject(); } } } if (player.controller != null) { player.controller.SetEnableControll(false, ControllerBase.DISABLE_FLAG.BATTLE_START); } } } if (self == null) { self = CreateSelf(0, Vector3.get_zero(), 0f); if (self != null && self.controller != null) { self.controller.SetEnableControll(false, ControllerBase.DISABLE_FLAG.BATTLE_START); } } if (!(self == null)) { if (QuestManager.IsValidInGame() && !MonoBehaviourSingleton <InGameManager> .I.IsNeedInitBoss()) { self.SetAppearPosGuest(Vector3.get_zero()); } if (FieldManager.IsValidInGameNoQuest() || MonoBehaviourSingleton <QuestManager> .I.IsExplore() || MonoBehaviourSingleton <QuestManager> .I.IsWaveMatch()) { self.SetAppearPosField(); } } }
protected override void DataPortal_Insert() { //PLC写入下达任务 //throw new Exception("写入下达任务"); using (BypassPropertyChecks) { using (var cn = new MySqlConnection(AppUtility.AppUtil._LocalConnectionString)) { cn.Open(); using (var tran = cn.BeginTransaction()) { try { using (var cm = cn.CreateCommand()) { StringBuilder SQL = new StringBuilder(); SQL.Append("INSERT "); SQL.Append(" INTO T_SORTINGTASKISSUED "); SQL.Append(" ( "); SQL.Append(" ID,PLCFLAG,PLCTASKNO,SLOCATION,ORDERNUMBER "); SQL.Append(" ) "); SQL.Append(" VALUES "); SQL.Append(" ( "); SQL.Append(" @ID,@PLCFLAG,@PLCTASKNO,@SLOCATION,@ORDERNUMBER "); SQL.Append(" )"); cm.CommandText = SQL.ToString(); cm.Parameters.AddWithValue("@ID", ID); cm.Parameters.AddWithValue("@PLCFLAG", PLCFLAG); cm.Parameters.AddWithValue("@PLCTASKNO", PLCTASKNO); cm.Parameters.AddWithValue("@SLOCATION", SLOCATION); cm.Parameters.AddWithValue("@ORDERNUMBER", ORDERNUMBER); cm.ExecuteNonQuery(); } // update child objects FieldManager.UpdateChildren(this, tran); tran.Commit(); MonitorLog monitorLog = MonitorLog.NewMonitorLog(); monitorLog.LOGNAME = "PLC分拣任务下达"; monitorLog.LOGINFO = "PLCTASKNO:" + PLCTASKNO.PadRight(10); foreach (SortingTaskIssuedDetail sortingTaskIssuedDetail in SortingTaskIssuedDetails) { monitorLog.LOGINFO += sortingTaskIssuedDetail.LINEBOXCODE + ":" + sortingTaskIssuedDetail.ADDRESSCODE + ":" + sortingTaskIssuedDetail.QTY + " "; } monitorLog.LOGLOCATION = "PLC"; monitorLog.LOGTYPE = 0; monitorLog.Save(); } catch (Exception) { tran.Rollback(); throw; } } } } }
protected void DataPortal_Insert() { FieldManager.UpdateChildren(); }
void Init(int startX, int startY, float currentX, float currentY, List <List <Point> > maze, FieldManager fieldManager) { base.start_x = startX; base.start_y = startY; base.maze = maze; base.fieldManager = fieldManager; palyerCurrentX = currentX; palyerCurrentY = currentY; InitialDoorCount = 3; Vector3 startPlayerPos = fieldManager.wallMap.CellToWorld(new Vector3Int(startX + 1, startY + 1, 0)); startPlayerPos += new Vector3(0.5f, 0.5f, 0); fieldManager.plm.gameObject.GetComponent <Transform>().position = startPlayerPos; }
/// <summary> /// 유닛의 이동경로를 찾는 알고리즘. /// </summary> /// <param name="unit">이동 유닛</param> /// <param name="from">출발 위치</param> /// <param name="to">도착 위치</param> /// <returns></returns> public static List <Vector2Int> PathFindAlgorithm(Model.Unit agent, Vector2Int from, Vector2Int to) { if (FieldManager.GetTile(to) == null || FieldManager.GetTile(to).HasUnit()) { Debug.LogWarning("길찾기 알고리즘 오류"); return(null); } Node node = new Node(from, to); List <Node> frontier = new List <Node>(); // priority queue ordered by Path-Cost, with node as the only element List <Node> explored = new List <Node>(); // an empty set frontier.Add(node); while (true) { InfiniteLoopDebug.Run("Pathfind", "GetClosestReachableDest", 258); if (frontier.Count == 0) { Debug.Log("목적지에 갈수 있는 길이 존재하지 않습니다."); return(null); // 답이 없음. } node = Node.PopSmallestCostNode(frontier); frontier.Remove(node); if (node.unitPosition.Equals(to)) // goal test { return(Node.RebuildPath(node)); } explored.Add(node); // add node.State to explored foreach (var child in Node.GetAvilableNeighbor(agent, node)) { bool isExplored = false; foreach (var item in explored) { if (item.unitPosition == child.unitPosition) { isExplored = true; } } if (isExplored.Equals(true)) { continue; } bool isFrontiered = false; for (int i = frontier.Count - 1; i >= 0; i--) { if (frontier[i].unitPosition.Equals(child.unitPosition)) { isFrontiered = true; if (child.unitPosition == frontier[i].unitPosition && child.evaluationCost < frontier[i].evaluationCost) { frontier.Remove(frontier[i]); frontier.Add(child); } } } if (isFrontiered.Equals(false)) { frontier.Add(child); } } } }
protected override void DataPortal_Update() { bool cancel = false; OnUpdating(ref cancel); if (cancel) { return; } if (OriginalSuppId != SuppId) { // Insert new child. Supplier item = new Supplier { SuppId = SuppId, Name = Name, Status = Status, Addr1 = Addr1, Addr2 = Addr2, City = City, State = State, Zip = Zip, Phone = Phone }; item = item.Save(); // Mark editable child lists as dirty. This code may need to be updated to one-to-one relationships. foreach (Item itemToUpdate in Items) { itemToUpdate.Supplier = SuppId; } // Create a new connection. using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); FieldManager.UpdateChildren(this, connection); } // Delete the old. var criteria = new SupplierCriteria { SuppId = OriginalSuppId }; DataPortal_Delete(criteria); // Mark the original as the new one. OriginalSuppId = SuppId; OnUpdated(); return; } using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand("[dbo].[CSLA_Supplier_Update]", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@p_OriginalSuppId", this.OriginalSuppId); command.Parameters.AddWithValue("@p_SuppId", this.SuppId); command.Parameters.AddWithValue("@p_Name", ADOHelper.NullCheck(this.Name)); command.Parameters.AddWithValue("@p_Status", this.Status); command.Parameters.AddWithValue("@p_Addr1", ADOHelper.NullCheck(this.Addr1)); command.Parameters.AddWithValue("@p_Addr2", ADOHelper.NullCheck(this.Addr2)); command.Parameters.AddWithValue("@p_City", ADOHelper.NullCheck(this.City)); command.Parameters.AddWithValue("@p_State", ADOHelper.NullCheck(this.State)); command.Parameters.AddWithValue("@p_Zip", ADOHelper.NullCheck(this.Zip)); command.Parameters.AddWithValue("@p_Phone", ADOHelper.NullCheck(this.Phone)); //result: The number of rows changed, inserted, or deleted. -1 for select statements; 0 if no rows were affected, or the statement failed. int result = command.ExecuteNonQuery(); if (result == 0) { throw new DBConcurrencyException("The entity is out of date on the client. Please update the entity and try again. This could also be thrown if the sql statement failed to execute."); } LoadProperty(_originalSuppIdProperty, this.SuppId); } FieldManager.UpdateChildren(this, connection); } OnUpdated(); }
protected void DataPortal_Update() { FieldManager.UpdateAllChildren(); }
/// <summary> /// Applies skill effect to the game match /// </summary> /// <param name="manager"></param> /// <param name="skillsManager"></param> /// <param name="random"></param> /// <param name="match"></param> /// <param name="playerUserIndex"></param> public abstract List <EffectData> Apply(FieldManager manager, SkillsManager skillsManager, Random random, GameMatch match, int playerUserIndex);
private void Update() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if ((isDirection || MonoBehaviourSingleton <InGameManager> .I.graphicOptionType > 0) && (isDirection || MonoBehaviourSingleton <InGameManager> .I.graphicOptionType > 1 || !FieldManager.IsValidInGameNoQuest() || !isPlayer || isSelf)) { bool flag = false; if (isDirection || MonoBehaviourSingleton <InGameManager> .I.graphicOptionType >= 2) { flag = true; } if (stampNodes != null && stampNodes.Length > 0 && stampInfos != null && stampInfos.Length > 0 && (flag || CheckDistance())) { Vector3 position = _transform.get_position(); float y = position.y; int i = 0; for (int num = stampNodes.Length; i < num; i++) { StampNode stampNode = stampNodes[i]; if (stampNode.UpdateStamp(y) && enableAutoStampEffect) { StageObject.StampInfo stamp_info = (!(owner != null)) ? stampInfos[0] : ((owner.actionID != Character.ACTION_ID.ATTACK || stampInfos.Length < 2) ? stampInfos[0] : stampInfos[1]); PlayStampEffect(stamp_info, stampNode); } } } } }
public GameBuilder(FieldManager fieldManager) { this.fieldManager = fieldManager; }
private void ProcessPlayCommand(FieldManager fieldManager, string[] commandArguments) { CardId cardToPlay = new CardId(commandArguments[0], (PlayerIndentifier)int.Parse(commandArguments[1])); fieldManager.Play(cardToPlay); }
private void ProcessSwitchCommand(FieldManager fieldManager, string[] commandArguments) { CardId cardToSwitch = new CardId(commandArguments[0], (PlayerIndentifier)int.Parse(commandArguments[1])); fieldManager.Switch(cardToSwitch); }
void Awake() { hex = GetComponent <BattleHex>(); fieldManager = FindObjectOfType <FieldManager>(); }
void IManageProperties.SetProperty(IPropertyInfo propertyInfo, object newValue) { FieldManager.SetFieldData(propertyInfo, newValue); }
// Update is called once per frame void Awake() { FieldManager field = FieldManager.Instance; field.OnInitField.AddListener(FieldUpdate); }
List <object> IManageProperties.GetChildren() { return(FieldManager.GetChildren()); }
public IHttpActionResult Submit() { try { var request = Context.AuthenticatedRequest; var pollInfo = PollManager.GetPollInfo(request); if (pollInfo == null) { return(NotFound()); } if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(pollInfo.SiteId, PollUtils.PluginId)) { return(Unauthorized()); } var logId = request.GetPostInt("logId"); var logInfo = logId > 0 ? LogManager.Repository.GetLogInfo(logId) : new LogInfo { PollId = pollInfo.Id, AddDate = DateTime.Now }; var fieldInfoList = FieldManager.GetFieldInfoList(pollInfo.Id); foreach (var fieldInfo in fieldInfoList) { if (request.IsPostExists(fieldInfo.Title)) { var value = request.GetPostString(fieldInfo.Title); if (fieldInfo.FieldType == InputType.Date.Value || fieldInfo.FieldType == InputType.DateTime.Value) { var dt = PollUtils.ToDateTime(request.GetPostString(fieldInfo.Title)); logInfo.Set(fieldInfo.Title, dt.ToLocalTime()); } else { logInfo.Set(fieldInfo.Title, value); } } } if (logId == 0) { logInfo.Id = LogManager.Repository.Insert(pollInfo, logInfo); NotifyManager.SendNotify(pollInfo, fieldInfoList, logInfo); } else { LogManager.Repository.Update(logInfo); } return(Ok(new{})); } catch (Exception ex) { return(InternalServerError(ex)); } }
bool IManageProperties.FieldExists(Core.IPropertyInfo property) { return(FieldManager.FieldExists(property)); }
private void EndTurn() { FieldManager.PassMyTurn(this.playSide); gameController.SwitchCamera(gameController.GetNextPlayerID(this.playSide)); }
protected override void DataPortal_Update() { bool cancel = false; OnUpdating(ref cancel); if (cancel) { return; } const string commandText = "UPDATE [dbo].[Orders] SET [UserId] = @p_UserId, [OrderDate] = @p_OrderDate, [ShipAddr1] = @p_ShipAddr1, [ShipAddr2] = @p_ShipAddr2, [ShipCity] = @p_ShipCity, [ShipState] = @p_ShipState, [ShipZip] = @p_ShipZip, [ShipCountry] = @p_ShipCountry, [BillAddr1] = @p_BillAddr1, [BillAddr2] = @p_BillAddr2, [BillCity] = @p_BillCity, [BillState] = @p_BillState, [BillZip] = @p_BillZip, [BillCountry] = @p_BillCountry, [Courier] = @p_Courier, [TotalPrice] = @p_TotalPrice, [BillToFirstName] = @p_BillToFirstName, [BillToLastName] = @p_BillToLastName, [ShipToFirstName] = @p_ShipToFirstName, [ShipToLastName] = @p_ShipToLastName, [AuthorizationNumber] = @p_AuthorizationNumber, [Locale] = @p_Locale WHERE [OrderId] = @p_OrderId"; using (var connection = new SqlConnection(ADOHelper.ConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandText, connection)) { command.Parameters.AddWithValue("@p_OrderId", this.OrderId); command.Parameters.AddWithValue("@p_UserId", this.UserId); command.Parameters.AddWithValue("@p_OrderDate", this.OrderDate); command.Parameters.AddWithValue("@p_ShipAddr1", this.ShipAddr1); command.Parameters.AddWithValue("@p_ShipAddr2", ADOHelper.NullCheck(this.ShipAddr2)); command.Parameters.AddWithValue("@p_ShipCity", this.ShipCity); command.Parameters.AddWithValue("@p_ShipState", this.ShipState); command.Parameters.AddWithValue("@p_ShipZip", this.ShipZip); command.Parameters.AddWithValue("@p_ShipCountry", this.ShipCountry); command.Parameters.AddWithValue("@p_BillAddr1", this.BillAddr1); command.Parameters.AddWithValue("@p_BillAddr2", ADOHelper.NullCheck(this.BillAddr2)); command.Parameters.AddWithValue("@p_BillCity", this.BillCity); command.Parameters.AddWithValue("@p_BillState", this.BillState); command.Parameters.AddWithValue("@p_BillZip", this.BillZip); command.Parameters.AddWithValue("@p_BillCountry", this.BillCountry); command.Parameters.AddWithValue("@p_Courier", this.Courier); command.Parameters.AddWithValue("@p_TotalPrice", this.TotalPrice); command.Parameters.AddWithValue("@p_BillToFirstName", this.BillToFirstName); command.Parameters.AddWithValue("@p_BillToLastName", this.BillToLastName); command.Parameters.AddWithValue("@p_ShipToFirstName", this.ShipToFirstName); command.Parameters.AddWithValue("@p_ShipToLastName", this.ShipToLastName); command.Parameters.AddWithValue("@p_AuthorizationNumber", this.AuthorizationNumber); command.Parameters.AddWithValue("@p_Locale", this.Locale); using (var reader = new SafeDataReader(command.ExecuteReader())) { //RecordsAffected: The number of rows changed, inserted, or deleted. -1 for select statements; 0 if no rows were affected, or the statement failed. if (reader.RecordsAffected == 0) { throw new DBConcurrencyException("The entity is out of date on the client. Please update the entity and try again. This could also be thrown if the sql statement failed to execute."); } if (reader.Read()) { using (BypassPropertyChecks) { } } } } FieldManager.UpdateChildren(this, connection); } OnUpdated(); }
public static Guid GetSystemFieldId(ResourceId resourceId, string alias) { var handler = new FieldManager(); return(handler.GetFieldDetails($"{resourceId}.{alias}").Result.Values.FirstOrDefault().Key); }
public void DetaultCrudTest() { var fieldHandler = new FieldManager(); var fields = fieldHandler.GetFieldGuid(new[] { "P_Name", "P_Owner", "A_TestSingleLineText" }, new[] { Porters.TestCoreFramework.Enums.ResourceType.Client }) .Result.Result.ToDictionary(x => $"{char.ToUpper(x.Resource[0]) + x.Resource.Substring(1)}.{x.Alias}", x => (int)UuidUtil.GetId(x.Id)); //create var recordHandler = new RecordManager(); var request = RecordRequestComposer.ComposeCreateRequest() // creating a request object, using custom handlers .Append(item => item.ForResource(Porters.TestCoreFramework.Enums.ResourceType.Client) .WithField(fields["Client.P_Name"], "TestName -- CLIENT1") .WithField(fields["Client.P_Owner"], 1) .WithField(fields["Client.A_TestSingleLineText"], "TEST VALUE 1") .WithFieldSet(new Dictionary <int, object> { [fields["Client.P_Name"]] = "TestName -- CLIENT 5", [fields["Client.P_Owner"]] = 1, [fields["Client.A_TestSingleLineText"]] = "TEST VALUE 5" })) .Append(Porters.TestCoreFramework.Enums.ResourceType.Client, new Dictionary <int, object> { [fields["Client.P_Name"]] = "TestName -- CLIENT2", [fields["Client.P_Owner"]] = 1, [fields["Client.A_TestSingleLineText"]] = "TEST VALUE 2" }) .AppendMany(Porters.TestCoreFramework.Enums.ResourceType.Client, new Dictionary <int, object> { [fields["Client.P_Name"]] = "TestName -- CLIENT3", [fields["Client.P_Owner"]] = 1, [fields["Client.A_TestSingleLineText"]] = "TEST VALUE 3" }, new Dictionary <int, object> { [fields["Client.P_Name"]] = "TestName -- CLIENT4", [fields["Client.P_Owner"]] = 1, [fields["Client.A_TestSingleLineText"]] = "TEST VALUE 4" }) .Result; var response = recordHandler.WriteRecords(request); PrAssert.That(response, PrIs.SuccessfulResponse()); //read var res = recordHandler.ReadRecords( RecordRequestComposer.ComposeReadRequest() .ForResource(Porters.TestCoreFramework.Enums.ResourceType.Client) .WithIds(response.Result.Ids.SelectMany(x => x).ToArray()) .Fields("Client.P_Name", "Client.P_Id", "Client.A_TestSingleLineText") .Result); PrAssert.That(res.Result.Total, Is.EqualTo(5)); PrAssert.That(res.Result.Items, Is.All.Matches <Dictionary <string, object> >(x => !string.IsNullOrEmpty(x["Client.A_TestSingleLineText"].ToString()))); //update recordHandler.UpdateRecords( RecordRequestComposer.ComposeUpdateRequest().Append(item => item.ForResource(Porters.TestCoreFramework.Enums.ResourceType.Client) .Append(x => x.WithId(response.Result.Ids[0][0]).AppendField(fields["Client.A_TestSingleLineText"], "NewTestValue 1")) .Append(x => x.WithId(response.Result.Ids[1][0]).AppendFields(new Dictionary <int, object> { [fields["Client.A_TestSingleLineText"]] = "NewTestValue 2" }))).Result); LogHelper.LoggerForCurrentTest.Info("Records are updated without exceptions."); // example of how to access log //delete recordHandler.DeleteRecords( RecordRequestComposer.ComposeDeleteRequest(Porters.TestCoreFramework.Enums.ResourceType.Client, response.Result.Ids.SelectMany(x => x))); }
public TriggerContext(FieldManager field, ILogger logger) { Field = field; Logger = logger; }
public override void PlayerInit(FieldManager fieldManager) { Init(fieldManager.startX, start_y, fieldManager.startPlayerPos.x, fieldManager.startPlayerPos.y, fieldManager.maze, fieldManager); }