public async Task <IActionResult> PutMainUnit(int id, MainUnit main) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != main.Id) { return(BadRequest()); } _context.Entry(main).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MainUnitExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
void _AniMenu(int id) { for (int i = 0; i < AniPlayList.Count; i++) { if (GUI.Button(new Rect(5, 20 + (i * 26), 150, 25), AniPlayList[i].ToString())) { //< 애니메이션 실행 StopCoroutine("AttackCombo"); MainUnit.transform.localPosition = center; if (MainUnit.PlayAnim(AniPlayList[i])) { (MainUnit as Pc).rootMotion.Play(MainUnit.Animator.CurrentAnimState, true); AniActive = true; //< 이펙트도 실행 if (MainUnit.GetAniData(AniPlayList[i]) != null) { string StartEffect = MainUnit.GetAniData(AniPlayList[i]).effect; MainUnit.SpawnSkillEffect(StartEffect, MainUnit.Animation[MainUnit.Animator.GetAnimName(AniPlayList[i])].speed, MainUnit.transform, MainUnit.GetAniData(AniPlayList[i]).childEffect == 0 ? null : MainUnit.transform, null); } } } } if (GUI.Button(new Rect(5, 20 + ((AniPlayList.Count + 1) * 26), 150, 25), "어택 콤보")) { AniActive = true; StartCoroutine("AttackCombo"); } }
void Update() { if (AuotoIdle && AniActive && !MainUnit.Animator.Animation.isPlaying) { AniActive = false; MainUnit.transform.localPosition = center; MainUnit.PlayAnim(eAnimName.Anim_idle); } if (Input.GetAxis("Mouse ScrollWheel") < 0) { if (MainUnit == null) { return; } Camera.main.transform.localPosition -= (MainUnit.transform.position - Camera.main.transform.position).normalized * 0.5f; } if (Input.GetAxis("Mouse ScrollWheel") > 0) { if (MainUnit == null) { return; } Camera.main.transform.localPosition += (MainUnit.transform.position - Camera.main.transform.position).normalized * 0.5f; } }
private void LoginUI_UserNametextBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { SystemAccess aSystemAcces = new SystemAccess(); if (dt.Rows[0][0].ToString() != LoginUI_UserNametextBox2.Text || dt.Rows[0][1].ToString() != LoginUI_Password_textBox1.Text) { rongUserAccess_Notification_label135.Text = "Wrong 'UserName' OR 'Password' "; } else { if (temp == 8) { UIDefiner = temp; this.Close(); } else { MainUnit aMainUnit = new MainUnit(); aMainUnit.Show(); this.Hide(); } } } else { } }
public int CancelPaymentDAL(Payment aPayment) { MainUnit aMainUnit = new MainUnit(); int a = 2; SqlConnection connection = DBConnection.OpenConnection(); string GetLASTpayment_Query = " SELECT * FROM PaymentLedger Where CID=" + aPayment.CID + " and Description='Payment' and PaymentDate=(select MAX(PaymentDate) from PaymentLedger where CID=" + aPayment.CID + " and Description='Payment')"; SqlCommand Action = new SqlCommand(GetLASTpayment_Query, connection); DataTable dTable = new DataTable(); SqlDataAdapter Sda = new SqlDataAdapter(); Sda.SelectCommand = Action; Sda.Fill(dTable); if (dTable.Rows.Count != 0) { aPayment.Due = aPayment.Due + float.Parse(dTable.Rows[0][2].ToString()); string DeleteLASTpayment_and_getpreviouslastPayment_Query = "Delete PaymentLedger Where CID=" + aPayment.CID + " and Description='Payment' and PaymentDate=(select MAX(PaymentDate) from PaymentLedger where CID=" + aPayment.CID + " and Description='Payment')"; SqlCommand Action1 = new SqlCommand(DeleteLASTpayment_and_getpreviouslastPayment_Query, connection); int Result = Action1.ExecuteNonQuery(); DataTable dTable1 = new DataTable(); SqlDataAdapter Sda1 = new SqlDataAdapter(); Sda1.SelectCommand = Action; Sda.Fill(dTable1); if (dTable1.Rows.Count != 0) { aPayment.LastPayment = float.Parse(dTable1.Rows[0][2].ToString()); aPayment.PaymentStatus = aMainUnit.PaymentStatusDetect(aPayment.Due.ToString()); aPayment.DateTime = dTable.Rows[0][1].ToString(); a = 1; } else { string queryTogetDateOfAdvance = "SELECT * FROM PaymentLedger Where CID=" + aPayment.CID + " and PaymentDate=(select MAX(PaymentDate) from PaymentLedger where CID=" + aPayment.CID + " and Description !='Payment' and Description !='Payment_DEL_DIS')"; SqlCommand ActionTogetDateOfAdvance = new SqlCommand(queryTogetDateOfAdvance, connection); DataTable dTableTogetDateOfAdvance = new DataTable(); SqlDataAdapter SdaTogetDateOfAdvance = new SqlDataAdapter(); SdaTogetDateOfAdvance.SelectCommand = ActionTogetDateOfAdvance; SdaTogetDateOfAdvance.Fill(dTableTogetDateOfAdvance); aPayment.LastPayment = float.Parse(dTableTogetDateOfAdvance.Rows[0][2].ToString()); aPayment.PaymentStatus = aMainUnit.PaymentStatusDetect(aPayment.Due.ToString()); aPayment.DateTime = dTableTogetDateOfAdvance.Rows[0][1].ToString(); a = 1; } string query = "UPDATE Payment SET PaymentDate ='" + aPayment.DateTime + "', Due =" + aPayment.Due + ", LastPayment =" + aPayment.LastPayment + ", PaymentStatus ='" + aPayment.PaymentStatus + "' where CID=" + aPayment.CID + ""; SqlCommand Action2 = new SqlCommand(query, connection); Action2.ExecuteNonQuery(); return(a); } else { return(a); } }
public string ToLongString() { if (MainUnit != null) { return(string.Format("Group [{0}] {1} lead by {2} ({3} units)", Id, Name, MainUnit.ToString(), _units.Count)); } else { return("Group " + Id + " " + Name); } }
public void SplitGroup(List <string> unitIdList) { if (unitIdList == null || unitIdList.Count == 0) { return; } var wp = new Waypoint(); var newGroup = new Group(); var activeWaypoint = MainUnit.GetActiveWaypoint(); if (activeWaypoint != null) { wp = activeWaypoint.Clone(); } else { wp = new Waypoint(MainUnit.Position.Offset(new PositionOffset(0, 1000, 0))); } // Cache the owner player as the group might be marked for deletion if only one unit is remaining after splitting from group. Player ownerPlayer = OwnerPlayer; foreach (var id in unitIdList) { var unit = ownerPlayer.GetUnitById(id); if (unit != null) { unit.SetDirty(GameConstants.DirtyStatus.UnitChanged); unit.FormationPositionId = string.Empty; RemoveUnit(unit); if (wp != null) { unit.MovementOrder = new MovementOrder(wp); } newGroup.AddUnit(unit); } } ownerPlayer.AddGroup(newGroup); SetDirty(GameConstants.DirtyStatus.UnitChanged); newGroup.SetDirty(GameConstants.DirtyStatus.NewlyCreated); if (Formation != null) { newGroup.Formation = Formation.Clone(); } newGroup.AutoAssignUnitsToFormation(); newGroup.Name = Name + " (2)"; GameManager.Instance.Log.LogDebug( string.Format("Group.SplitGroup: Group {0} split. New group formed: {1}.", ToString(), newGroup.ToString())); var splitMsg = new GameStateInfo(GameConstants.GameStateInfoType.GroupHasBeenSplit, this.Id, newGroup.Id); ownerPlayer.Send(splitMsg); newGroup.RemoveIfSingleUnit(); }
public bool CancelDeliveryDAL(Payment aPayment, OrderDetails aOrderDetails) { SqlConnection connection = DBConnection.OpenConnection(); string query1 = "Select SUM(Received) from PaymentLedger where CID=" + aOrderDetails.CID + " and [Description] NOT Like '%Payment_DEL%'"; SqlCommand action = new SqlCommand(query1, connection); DataTable dTable = new DataTable(); SqlDataAdapter Sda = new SqlDataAdapter(); Sda.SelectCommand = action; Sda.Fill(dTable); if (dTable.Rows.Count > 0) { aPayment.Due = aPayment.TotalBill - float.Parse(dTable.Rows[0][0].ToString()); } string queryToGetLastPayment = "Select* from PaymentLedger where CID = " + aOrderDetails.CID + " and [Description] NOT Like '%Payment_DEL%' and PaymentDate=(select MAX(PaymentLedger.PaymentDate) from PaymentLedger where CID = " + aOrderDetails.CID + " and [Description] NOT Like '%Payment_DEL%')"; SqlCommand actionToGetLastPayment = new SqlCommand(queryToGetLastPayment, connection); DataTable dTableToGetLastPayment = new DataTable(); SqlDataAdapter SdaToGetLastPayment = new SqlDataAdapter(); SdaToGetLastPayment.SelectCommand = actionToGetLastPayment; SdaToGetLastPayment.Fill(dTableToGetLastPayment); aPayment.LastPayment = float.Parse(dTableToGetLastPayment.Rows[0][2].ToString()); MainUnit aMainUnit = new MainUnit(); aPayment.PaymentStatus = aMainUnit.PaymentStatusDetect(aPayment.Due.ToString()); string queryTogetDateOfLastPayment = " SELECT * FROM PaymentLedger Where CID=" + aOrderDetails.CID + " and [Description] NOT Like '%Payment_DEL%' and PaymentDate=(select MAX(PaymentDate) from PaymentLedger where CID=" + aOrderDetails.CID + " and [Description] Not Like '%Payment_DEL%')"; SqlCommand ActionTogetDateOfLastPayment = new SqlCommand(queryTogetDateOfLastPayment, connection); DataTable dTableTogetDateOfLastPayment = new DataTable(); SqlDataAdapter SdaTogetDateOfLastPayment = new SqlDataAdapter(); SdaTogetDateOfLastPayment.SelectCommand = ActionTogetDateOfLastPayment; SdaTogetDateOfLastPayment.Fill(dTableTogetDateOfLastPayment); aPayment.DateTime = dTableTogetDateOfLastPayment.Rows[0][1].ToString(); string query = "UPDATE Payment SET PaymentDate ='" + aPayment.DateTime + "',ProductCharge=" + aPayment.ProductCharge + ", TotalBill =" + aPayment.TotalBill + ", Due =" + aPayment.Due + ", Discount =" + aPayment.Discount + ", LastPayment =" + aPayment.LastPayment + ", PaymentStatus ='" + aPayment.PaymentStatus + "' where CID=" + aOrderDetails.CID + " UPDATE OrderDetails SET FinalVori =NULL, FinalAna =NULL, FinalRoti =NULL, FinalPoint =NULL, FinalWeight =NULL, OrderStatus ='" + aOrderDetails.OrderStatus + "' where CID=" + aOrderDetails.CID + ""; query += " DELETE PaymentLedger WHERE CID=" + aOrderDetails.CID + " and [Description] Like '%Payment_DEL%'"; SqlCommand Action = new SqlCommand(query, connection); int Result = Action.ExecuteNonQuery(); if (Result > 0) { return(true); } else { return(false); } }
Shoot _shoot; // OPTIONAL, see flipping code void Start() { _flipCooldown = 0; _navAgent = GetComponent <NavMeshAgent>(); _selectable = GetComponent <Selectable>(); _spriteRenderer = GetComponent <SpriteRenderer>(); _animator = GetComponent <Animator>(); _shoot = GetComponent <Shoot>(); // Try to get the default main unit var mainUnitEnt = GameObject.Find("MainUnit"); if (mainUnitEnt != null) { MainUnit = mainUnitEnt.GetComponent <MainUnit>(); } }
public bool CheckMainUnit(MainUnit main) { var check = _context.mainUnits.Where(p => p.Code == main.Code).FirstOrDefault(); if (check == null) { return(false); } if (check.LogicModifiedDate != main.LogicModifiedDate) { main.Id = check.Id; check.Name = main.Name; check.Code = main.Code; check.LogicModifiedDate = main.LogicModifiedDate; _ = PutMainUnit(check.Id, check); } return(true); }
public async Task <ActionResult <MainUnit> > PostMainUnit(MainUnit mainUnit) { _context.mainUnits.Add(mainUnit); _context.Database.OpenConnection(); try { _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.mainUnits ON"); _context.SaveChanges(); _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.mainUnits OFF"); } finally { _context.Database.CloseConnection(); } await _context.SaveChangesAsync(); return(CreatedAtAction("GetMainUnits", new { id = mainUnit.Id }, mainUnit)); }
public IActionResult Get() { var query = from h in context.Lg00101Orfiche join y in context.Lg00101Orfline on h.Logicalref equals y.Ordficheref join r in context.Lg001Clcard on h.Clientref equals r.Logicalref join x in context.Lg001Items on y.Stockref equals x.Logicalref join q in context.Lg001Unitsetf on y.Usref equals q.Logicalref join z in context.Lg001Unitsetl on y.Uomref equals z.Logicalref join w in context.Lg001Specodes.Where(p => p.Spetyp1 == 1) on x.Specode equals w.Specode into ej from w in ej.DefaultIfEmpty() join e in context.Lg001Specodes.Where(p => p.Spetyp2 == 1) on x.Specode2 equals e.Specode into ed from e in ed.DefaultIfEmpty() join a in context.Lg001Specodes.Where(p => p.Spetyp3 == 1) on x.Specode3 equals a.Specode into ey from a in ey.DefaultIfEmpty() join b in context.Lg001Specodes.Where(p => p.Spetyp4 == 1) on x.Specode4 equals b.Specode into ek from b in ek.DefaultIfEmpty() join g in context.Lg001Specodes.Where(p => p.Spetyp5 == 1) on x.Specode5 equals g.Specode into eo from g in eo.DefaultIfEmpty() select new { Logicalref = h.Logicalref, Sipdetay = y.Logicalref, Main = new { MainCode = q.Code, MainName = q.Name, MainLogicalRef = q.Logicalref, MainCreatedTime = q.CapiblockCreadeddate, MainModifiedTime = q.CapiblockModifieddate }, Alt = new { AltCode = z.Code, AltName = z.Name, AltId = z.Logicalref, AltMainID = z.Unitsetref }, Item = new { ItemId = x.Logicalref, ItemCode = x.Code, ItemName = x.Name, ItemColor = w.Definition, ItemFloor = e.Definition, ItemPattern = a.Definition, ItemRope = b.Definition, ItemStrike = g.Definition, ItemCreatedTime = x.CapiblockCreadeddate, ItemModifiedTime = x.CapiblockModifieddate }, Client = new { ClientId = r.Logicalref, ClientName = r.Definition, ClientCode = r.Code }, Order = new { orderId = h.Logicalref, FicheNo = h.Ficheno, clientid = r.Logicalref }, Orderdetail = new { OrderId = h.Logicalref, amount = y.Amount, altunitId = z.Logicalref, itemId = x.Logicalref }, Ficheno = h.Ficheno, Date = h.Date, Time = h.Time, Stockref = y.Stockref, specode1 = w.Definition, specode2 = e.Definition, specode3 = a.Definition, specode4 = b.Definition, specode5 = g.Definition, Musteri = h.Clientref, musterino = r.Code, birim = y.Usref }; foreach (var item in query) { //client oluşturma ClientsController clientsController = new ClientsController(_context); Client client = new Client(); client.Name = item.Client.ClientName; client.ClientCode = item.Client.ClientCode; client.Id = item.Client.ClientId; clientsController.PostClient(client); //item oluşturma ItemsController itemsController = new ItemsController(_context); Item item1 = new Item(); item1.Id = item.Item.ItemId; item1.Code = item.Item.ItemCode; item1.Name = item.Item.ItemName; item1.Color = item.Item.ItemColor; item1.Floor = item.Item.ItemFloor; item1.Pattern = item.Item.ItemPattern; item1.Rope = item.Item.ItemRope; item1.Strike = item.Item.ItemStrike; item1.LogicCreatedDate = item.Item.ItemCreatedTime; item1.LogicModifiedDate = item.Item.ItemModifiedTime; itemsController.PostItem(item1); //mainunit MainUnitsController mainUnit = new MainUnitsController(_context); MainUnit main = new MainUnit(); main.Code = item.Main.MainCode.ToString(); main.Name = item.Main.MainName; main.Id = item.Main.MainLogicalRef; main.LogicCreatedDate = item.Main.MainCreatedTime; main.LogicModifiedDate = item.Main.MainModifiedTime; mainUnit.PostMainUnit(main); //altUnit AltUnitsController altUnit = new AltUnitsController(_context); AltUnit alt = new AltUnit(); alt.Id = item.Alt.AltId; alt.Code = item.Alt.AltCode; alt.Name = item.Alt.AltName; alt.MainUnitId = item.Alt.AltMainID; //altUnit.PostAltUnit(alt); altUnit.PostAltUnit(alt); //order OrdersController order1 = new OrdersController(_context); Order order = new Order(); order.Id = item.Order.orderId; order.FicheNo = item.Order.FicheNo; order.ClientId = item.Order.clientid; order.Statu = 0; order1.PostOrder(order); //orderdetail OrderDetailsController orderDetail = new OrderDetailsController(_context); OrderDetail orderd = new OrderDetail(); orderd.OrderId = item.Orderdetail.OrderId; orderd.Amount = item.Orderdetail.amount; orderd.AltUnitId = item.Orderdetail.altunitId; orderd.ItemId = item.Orderdetail.itemId; orderDetail.PostOrderDetail(orderd); } return(Ok(query)); }
public void AutoAssignUnitsToFormation() { var newMainUnitAssigned = false; BaseUnit oldMainUnit = null; if (MainUnit != null && (MainUnit.IsMarkedForDeletion || MainUnit.HitPoints < 1)) { oldMainUnit = MainUnit; newMainUnitAssigned = true; GameManager.Instance.Log.LogDebug( string.Format("AutoAssignUnitsToFormation: Group {0} mainunit {1} has been destroyed and is removed.", ToString(), this.MainUnit.ToShortString())); RemoveUnit(MainUnit); MainUnit = null; //Remember: getter automatically assigns new MainUnit! } if (_units.Count == 0 || MainUnit == null) { GameManager.Instance.Log.LogDebug( string.Format("AutoAssignUnitsToFormation: Group {0} has no units and is being deleted.", ToString())); IsMarkedForDeletion = true; return; } if (newMainUnitAssigned) { try { MainUnit.SetDirty(GameConstants.DirtyStatus.UnitChanged); SetDirty(GameConstants.DirtyStatus.UnitChanged); GameManager.Instance.Log.LogDebug( string.Format("AutoAssignUnitsToFormation: Group {0} has been assigned a new mainunit {1}.", ToString(), this.MainUnit.ToShortString())); if (MainUnit.MovementOrder is MovementFormationOrder) { MainUnit.MovementOrder = new MovementOrder(); if (oldMainUnit.MovementOrder != null) //take over movementorders of old main unit { MainUnit.MovementOrder = oldMainUnit.MovementOrder; } } } catch (Exception ex) { GameManager.Instance.Log.LogError( string.Format("Group {0} has no main unit and automatic assignment failed: {1}", ToString(), ex.Message)); return; } } if (Formation == null || Formation.FormationPositions == null || Formation.FormationPositions.Count == 0) //load default formation { try { if (MainUnit is AircraftUnit) { Formation = GameManager.Instance.GameData.GetFormationById(GameConstants.FORMATION_AIRCRAFT_DEFAULT).Clone(); } else { Formation = GameManager.Instance.GameData.GetFormationById(GameConstants.FORMATION_SURFACE_DEFAULT).Clone(); } //TODO: MORE, like for subs or mixed groups? } catch (Exception ex) { GameManager.Instance.Log.LogError( string.Format("AutoAssignUnitsToFormation(): Failed to load default formation for Group {0}." + ex.Message)); return; } } //Mainunit should always have the first FormationPosition! MainUnit.FormationPositionId = Formation.FormationPositions[0].Id; Formation.FormationPositions[0].AssignedUnitId = MainUnit.Id; //Ok, we now have a formation. Assign units that do not have a formation position to a sensible pos. //First, ensure all unit positions are valid foreach (var u in _units) { if (!string.IsNullOrEmpty(u.FormationPositionId)) { var fpos = Formation.GetFormationPositionById(u.FormationPositionId); if (fpos == null) { u.FormationPositionId = string.Empty; //if it doesn't exist, clear it } else { fpos.AssignedUnitId = u.Id; } } } var unassignedUnits = from u in _units where string.IsNullOrEmpty(u.FormationPositionId) select u; foreach (var unit in unassignedUnits) { var fPos = Formation.GetPositionForUnit(unit.UnitType, unit.RoleList); if (fPos != null) { unit.FormationPositionId = fPos.Id; fPos.AssignedUnitId = unit.Id; } else { var newFormPos = Formation.CreateNewPositionForUnit(unit.UnitType); newFormPos.AssignedUnitId = unit.Id; unit.FormationPositionId = newFormPos.Id; } unit.SetUnitFormationOrder(); } CheckIfGroupIsStaging(); }