/// <summary> /// Valida si una entidad de tipo ChargeTo coincide con los filtros /// </summary> /// <param name="newChargeTo">Objeto a validar</param> /// <returns>true. Si se muestra | false. Nose muestra</returns> /// <history> /// [emoguel] created 18/03/2016 /// </history> private bool ValidateFilters(ChargeTo newChargeTo) { if (_nStatus != -1) { if (newChargeTo.ctIsCxC != Convert.ToBoolean(_nStatus)) { return(false); } } if (!string.IsNullOrWhiteSpace(_chargeToFilter.ctID)) { if (_chargeToFilter.ctID != newChargeTo.ctID) { return(false); } } if (_chargeToFilter.ctPrice > 0) { if (newChargeTo.ctPrice == _chargeToFilter.ctPrice) { return(false); } } return(true); }
/// <summary> /// Muestra la ventada Charge To ReadOnly /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { ChargeTo chargeTo = (ChargeTo)dtgChargeTo.SelectedItem; frmChargeToDetail frmChargeToDetail = new frmChargeToDetail(); frmChargeToDetail.Owner = this; frmChargeToDetail.mode = ((_blnEdit == true) ? EnumMode.Edit : EnumMode.ReadOnly); frmChargeToDetail.oldChargeTo = chargeTo; if (frmChargeToDetail.ShowDialog() == true) { List <ChargeTo> lstCargeTos = (List <ChargeTo>)dtgChargeTo.ItemsSource; int nIndex = 0; if (!ValidateFilters(frmChargeToDetail.chargeTo)) { lstCargeTos.Remove(chargeTo);//quitamos el registro de la lista } else { ObjectHelper.CopyProperties(chargeTo, frmChargeToDetail.chargeTo); lstCargeTos.Sort((x, y) => string.Compare(x.ctID, y.ctID));//Ordenamos la lista nIndex = lstCargeTos.IndexOf(chargeTo); } dtgChargeTo.Items.Refresh();//Refrescamos el grid GridHelper.SelectRow(dtgChargeTo, nIndex); StatusBarReg.Content = lstCargeTos.Count + " Carge Tos."; } }
private IEnumerator ImpactCharge() { yield return(new WaitForSeconds(1)); GameManager._instance.healthSystem.Damage(brute.ChargePower); brute.HitRemaningForCharge = brute.HitForCharge; timerAttack = timeBetweenTwoCac; chargeTo = ChargeTo.None; bruteAnimator.SetBool("HasImpact", false); }
private void Start() { chargeTo = ChargeTo.None; timerCharge = -1; timerImmobile = -1; timerAttack = -1; brute = new AICharacter(life, cacPower, chargePower, hitForCharge, hitForCharge, walkSpeed, chargeSpeed); raycaster = GetComponent <CharacterRaycaster>(); spriteRenderer = GetComponentInChildren <SpriteRenderer>(); pastaLoot = GetComponentsInChildren <PastaCollectible>(true); }
/// <summary> /// Evento para validar los cambios de una celda en el grid /// </summary> /// <history> /// [vipacheco] 30/Junio/2016 Created /// </history> private async void grdExchange_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (!bandCancel) { dtgExchange.CellEditEnding -= grdExchange_CellEditEnding; DataGrid dataGrid = sender as DataGrid; ComboBox comboBox = e.EditingElement as ComboBox; GiftsReceiptDetail giftsReceiptDetail = dataGrid.Items.CurrentItem as GiftsReceiptDetail; // Validamos la celda bool HasErrorValidate = await ReceiptsGifts.ValidateEdit(dataGrid, giftsReceiptDetail, true, _currentCell); // Si se cancela la edicion if (!HasErrorValidate) { ChargeTo pChargeTo = frmHost._lstChargeTo.Where(x => x.ctID.ToUpper() == "MARKETING").Single(); LeadSource pLeadSource = cboLeadSource.SelectedItem as LeadSource; ReceiptsGifts.AfterEdit(ref dtgExchange, _Guest.guID, row: ref giftsReceiptDetail, pCell: _currentCell, pUseCxCCost: useCxCCost, pIsExchange: _isExchangeReceipt, pChargeTo: pChargeTo, pLeadSourceID: pLeadSource.lsID, pTxtTotalCost: txtTotalGiftsExchange, pTxtgrCxCGifts: txtgrcxcGifts, pTxtTotalCxC: txtTotalCxC, pTxtgrCxCAdj: txtgrcxcAdj, pTxtgrMaxAuthGifts: txtMaxAuthGifts, pLblgrMaxAuthGifts: txbMaxAuthGiftsCaption); CalculateTotalGifts(); txbMaxAuthGiftsCaption.Visibility = Visibility.Visible; txtMaxAuthGifts.Visibility = Visibility.Visible; // Verificamos si se actualiza los costs CxC if (_applicationAdj) { txtgrcxcGifts.Text = txtTotalCost.Text; decimal cxcGifts = string.IsNullOrEmpty(txtgrcxcGifts.Text) ? 0 : Convert.ToDecimal(txtgrcxcGifts.Text.TrimStart('$')); decimal cxcAdj = string.IsNullOrEmpty(txtgrcxcAdj.Text) ? 0 : Convert.ToDecimal(txtgrcxcAdj.Text.TrimStart('$')); txtTotalCxC.Text = string.Format("{0:C2}", cxcAdj + cxcGifts); } } else { e.Cancel = true; } dtgExchange.CellEditEnding += grdExchange_CellEditEnding; } // Verificamos si se puso en modo lectura la celda if (_currentCell.Column.IsReadOnly) { _currentCell.Column.IsReadOnly = false; } }
private void Charge() { Vector3 movement = Vector3.zero; // Init charge if (chargeTo.Equals(ChargeTo.None)) { if (PlayerUtils.PlayerTransform.position.x < this.transform.position.x) { chargeTo = ChargeTo.Left; } else { chargeTo = ChargeTo.Right; } } // Update info charge if (chargeTo.Equals(ChargeTo.Left) && PlayerUtils.PlayerTransform.position.x < this.transform.position.x) { movement = new Vector3(-chargeSpeed, gravity); } else if (chargeTo.Equals(ChargeTo.Right) && PlayerUtils.PlayerTransform.position.x > this.transform.position.x) { movement = new Vector3(chargeSpeed, gravity); } // Play or stop charge if (movement.Equals(Vector3.zero)) { brute.HitRemaningForCharge = brute.HitForCharge; chargeTo = ChargeTo.None; timerCharge = timeToStopAfterCharge; bruteAnimator.SetBool("IsCharging", false); } else { movement *= Time.deltaTime; raycaster.Move(movement); } }
/// <summary> /// Llena el dataset con la lista de chargeTo /// </summary> /// <history> /// [Emoguel] created 02/03/2016 /// </history> protected async void LoadChargeTo(ChargeTo chargeTo = null) { try { status.Visibility = Visibility.Visible; int nIndex = 0; List <ChargeTo> lstChargeTo = await BRChargeTos.GetChargeTos(_chargeToFilter, _nStatus); dtgChargeTo.ItemsSource = lstChargeTo; if (chargeTo != null && lstChargeTo.Count > 0) { chargeTo = lstChargeTo.FirstOrDefault(ch => ch.ctID == chargeTo.ctID); nIndex = lstChargeTo.IndexOf(chargeTo); } GridHelper.SelectRow(dtgChargeTo, nIndex); StatusBarReg.Content = lstChargeTo.Count + " Charge To."; status.Visibility = Visibility.Collapsed; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Devuelve la lista de chargeTo /// </summary> /// <param name="chargeTo">Entidad que contiene los filtros adicionales, puede ser null</param> /// <param name="nCxC">-1.Todos | 0. CxC=falso | 1. CxC=true</param> /// <returns>Lista de Charge To</returns> /// <history> /// [Emoguel] created 01/03/2016 /// [emoguel] modified 17/03/2016--->Se agregó la validacion null del objeto /// [aalcocer] 25/05/2016 Modified. Se agregó asincronía /// </history> public static async Task <List <ChargeTo> > GetChargeTos(ChargeTo chargeTo = null, int nCxC = -1) { List <ChargeTo> lstCharge = new List <ChargeTo>(); await Task.Run(() => { using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString())) { var query = from c in dbContext.ChargeTos select c; if (nCxC != -1) //Filtra por CxC { bool blnCxc = Convert.ToBoolean(nCxC); query = query.Where(c => c.ctIsCxC == blnCxc); } if (chargeTo != null) //Si se recibió objeto { if (!string.IsNullOrWhiteSpace(chargeTo.ctID)) //Filtra por ID { query = query.Where(c => c.ctID == chargeTo.ctID); } if (chargeTo.ctPrice > 0) //Filtra por Price { query = query.Where(c => c.ctPrice == chargeTo.ctPrice); } } lstCharge = query.OrderBy(c => c.ctID).ToList(); } }); return(lstCharge); }
/// <summary> /// Recarga los datos del datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRef_Click(object sender, RoutedEventArgs e) { ChargeTo chargeTo = (ChargeTo)dtgChargeTo.SelectedItem; LoadChargeTo(chargeTo); }