private void ultraGrid1_BeforeRowUpdate(object sender, CancelableRowEventArgs e) { if (e.Row.IsAddRow && _IsEnterKeyDown) { _IsEnterKeyDown = false; ultraButton1.PerformClick(); } }
private void grdItems_BeforeRowUpdate(object sender, CancelableRowEventArgs e) { if (e.Row.Cells["itemId"].Value.ToString().Length == 0 || e.Row.Cells["sizeId"].Value.ToString().Length == 0 || e.Row.Cells["locId"].Value.ToString().Length == 0) { e.Cancel = true; } }
private void ultraGrid1_BeforeRowUpdate(object sender, CancelableRowEventArgs e) { // Use the BeforeEnterEditMode event to position the edit controls UltraGridRow row = this.ultraGrid1.ActiveRow; // This should be impossible, but its good practice to check // to make sure there is an active cell before continuing if (row == null) { return; } // Get the UIElement associated with the active cell, which we will // need so we can get the size and location of the cell if (row.Cells["FoodTypeID"].Value.ToString() == "" || row.Cells["LossTypeID"].Value.ToString() == "") { e.Cancel = true; return; // let user to change food/loss type } DataTable ds = (DataTable)this.ultraGrid1.DataSource; //DataColumn[] keys = new DataColumn[1]; //keys[0] = ds.Columns["FoodTypeID"]; //ds.PrimaryKey = keys; DataRow[] foundRows = ds.Select("FoodTypeID = '" + row.Cells["FoodTypeID"].Value.ToString() + " ' AND LossTypeID = '" + row.Cells["LossTypeID"].Value.ToString() + "'"); if (foundRows.Length > 0) { if (foundRows.Length == 1 && (foundRows[0]["ID"].ToString() == row.Cells["ID"].Value.ToString()) && row.Cells["FakeID"].Value.ToString() != "") { return; //this is row update } MessageBox.Show("This Combination of " + //VWA4Common.VWACommon.WasteProfile + "Food and Loss already exists!", "Data Entry Error"); //row.Selected = true; e.Cancel = true; return; // let user to change food/loss type } //this.ultraGrid1.UpdateData(); }
private void listaVersamenti_BeforeRowUpdate(object sender, CancelableRowEventArgs e) { var versamento = e.Row.ListObject as VersamentoSoggettoDTO; if (versamento != null) { //var messageDataList = getMovimentoContabileService().IsAllowDataRegistrazione(new List<int> {versamento.IdCondominio}, versamento.IdEsercizio, versamento.DataPagamento.GetValueOrDefault()); //if (messageDataList.Count > 0) //{ // var messageData = $"La data di registrazione {versamento.DataPagamento.GetValueOrDefault():d} non è ammessa:{Environment.NewLine}"; // messageData = messageDataList.Aggregate(messageData, (current, mess) => current + (mess + Environment.NewLine)); // CommonMessages.DisplayWarning(messageData); // e.Cancel = true; // versamento.DataPagamento = e.Row.Cells["DataPagamento"].OriginalValue as DateTime?; //} } }
private void listaOrdineGiorno_BeforeRowUpdate(object sender, CancelableRowEventArgs e) { if (groupNuovoPuntoOdG.Enabled && IsEditingMode && _assembleaService.IsConvocazioneEnable(_assemblea) == string.Empty) { if (listaOrdineGiorno.ActiveRow != null) { var editOrdineGiorno = (OrdineGiornoAssembleaDTO)listaOrdineGiorno.ActiveRow.ListObject; e.Cancel = !savePuntoOrdineGiorno(editOrdineGiorno, true); } } }
private void listaBeforeRowUpdate(object sender, CancelableRowEventArgs e) { var dto = e.Row.ListObject as EsercizioDTO; if (dto != null) { if (e.Row.Cells["DataChiusura"].Value != null && e.Row.Cells["DataChiusura"].Value != DBNull.Value) { var dataApertura = (DateTime)e.Row.Cells["DataApertura"].Value; var dataChiusura = (DateTime)e.Row.Cells["DataChiusura"].Value; if (dataChiusura <= dataApertura) { CommonMessages.DisplayWarning($"La data di chiusura {dataChiusura:d} non può essere inferiore alla data di apertura {dataApertura:d}"); e.Row.Cells["DataChiusura"].Value = e.Row.Cells["DataChiusura"].OriginalValue; e.Row.Cells["DataApertura"].Value = e.Row.Cells["DataApertura"].OriginalValue; } } } }
// private ContattoDTO getNewContatto(string tipo, string valore) // { // /*switch (tipo) // { // case "Telefono": // return new Telefono(valore, _businessEntity.TipoRiferimento); // // case "Cellulare": // return new Cellulare(valore, _businessEntity.TipoRiferimento); // // case "Email": // return new Email(valore, _businessEntity.TipoRiferimento); // // case "Fax": // return new Fax(valore, _businessEntity.TipoRiferimento); // // default: // return new Telefono(valore, _businessEntity.TipoRiferimento); // }*/ // // var DaCancellare = new ContattoDTO(); // // return DaCancellare; // } #endregion Private Methods #region Validation private void listaBeforeRowUpdate(object sender, CancelableRowEventArgs e) { if (e.Row.IsDataRow) { if (e.Row.GetCellValue("TipoContatto") == null) { CommonMessages.DisplayWarning("Scegliere un tipo"); e.Cancel = true; } else if (e.Row.GetCellValue("TipoContatto").ToString().ToLower().Contains("email")) { if (e.Row.GetCellValue("Valore") != null) { var valore = e.Row.GetCellValue("Valore").ToString(); if (!Conversione.IsEmail(valore)) { CommonMessages.DisplayWarning($"L'indirizzo email '{valore}' non è formalmente valido"); e.Cancel = true; } } } } }