public void CellEventArgsWithNullLocation()
        {
            CellEventArgs args = new CellEventArgs(null);

            Assert.IsTrue(args.Cell == null);
            Assert.IsTrue(args.Loc == Location.Null);
        }
        public void CellEventArgsPropertiesSet()
        {
            Cell cell = new Cell(new Location(0, 0));
            CellEventArgs args = new CellEventArgs(cell);

            Assert.IsTrue(args.Cell == cell);
            Assert.IsTrue(args.Cell.Location == cell.Location);
            Assert.IsTrue(args.Loc == cell.Location);
        }
Exemple #3
0
 private void ultraGrid1_CellChange(object sender, CellEventArgs e)
 {
     if (e.Cell.Column.Key == "CHK")
     {
         if (Convert.ToBoolean(e.Cell.Value)==false)
         {
             e.Cell.Value = "True";
         }
     }
 }
 private void dgv_DanhSach_CellChange(object sender, CellEventArgs e)
 {
     try
     {
         if (e.Cell.Column.Key != "Chon") return;
         var b = bool.Parse(e.Cell.Row.Cells["Chon"].Text);
         e.Cell.Row.Appearance.BackColor = b ? Color.LightCyan : Color.White;
     }
     catch (Exception ex)
     {
         Log2File.LogExceptionToFile(ex);
     }
 }
 private void listaClickCellButton(object sender, CellEventArgs e)
 {
     if (e.Cell.Column.Key == "DeleteColumn" && e.Cell.Row.ListObject != null)
     {
         if (CommonMessages.DisplayConfirm("Sei sicuro di voler eliminare la attività?") == DialogResult.Yes)
         {
             var attDTO = (AttivitaDTO)e.Cell.Row.ListObject;
             if (attDTO.ID > 0)
             {
                 if (e.Cell.Row.Delete())
                     getPraticaService().DeleteAttivita(attDTO.ID);
             }
         }
     }
 }
 private void GrillaBancos_ClickCellButton(object sender, CellEventArgs e)
 {
     ItemSocioNegocioBanco Item = (ItemSocioNegocioBanco)e.Cell.Row.Tag;
     switch (e.Cell.Column.Key)
     {
         case colMoneda:
             FrmSelectedEntity FrmSeleccionarPanel = new FrmSelectedEntity();
             Moneda moneda = (Moneda)FrmSeleccionarPanel.GetSelectedEntity(typeof(Moneda), "Moneda");
             Item.Moneda = moneda;
             break;
         default:
             break;
     }
     this.MostrarBanco(e.Cell.Row);
 }
 private void GrillaDirecciones_CellChange(object sender, CellEventArgs e)
 {
     ItemSocioNegocioDireccion Item = (ItemSocioNegocioDireccion)e.Cell.Row.Tag;
     switch (e.Cell.Column.Key)
     {
         case colDireccion:
             Item.Direccion = Convert.ToString(e.Cell.Text);
             break;
         case colDirEntrega:
             Item.EsDireccionEntrega = Convert.ToBoolean(e.Cell.Text);
             break;
         case colDirFactura:
             Item.EsDireccionFacturacion = Convert.ToBoolean(e.Cell.Text);
             break;
         default:
             break;
     }
     this.MostrarDireccion(e.Cell.Row);
 }
Exemple #8
0
        private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
        {
            UltraGridRow ugr = this.ultraGrid1.ActiveRow;
            if (ugr == null) return;

            MessageBox.Show(ugr.Cells["FS_PointCode"].Text.Trim());
        }
Exemple #9
0
 private void listaContiClickCellButton(object sender, CellEventArgs e)
 {
     if (e.Cell.Column.Key == "DeleteColumn")
         e.Cell.Row.Delete();
 }
        private void dgv_DanhSach_CellChange(object sender, CellEventArgs e)
        {
            if (e.Cell.Column.Key != "Chon") return;
            var b = bool.Parse(e.Cell.Row.Cells["Chon"].Text);
            if (b)
            {
                _tongsucchua = _tongsucchua + int.Parse(e.Cell.Row.Cells["SucChua"].Text);
                e.Cell.Row.Appearance.BackColor = Color.LightCyan;
            }
            else
            {
                e.Cell.Row.Appearance.BackColor = Color.White;
                _tongsucchua = _tongsucchua - int.Parse(e.Cell.Row.Cells["SucChua"].Text);
            }

            lbtong.Text = @"Tổng sức chứa: " + _tongsucchua + @" sinh viên.";
        }
Exemple #11
0
        private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
        {
            try
            {
                if (e.Cell.Column.Key.Equals("CHECKED"))
                {
                    if (Convert.ToBoolean(e.Cell.Value))
                    {
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_NUMBER"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GP_TOTALCOUNT"].Value;
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT"].Value;
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT_LL"].Value;

                        string strWeight = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value).Trim();

                        if (string.IsNullOrEmpty(strWeight) || strWeight == "0")
                        {
                            this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value;
                        }

                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, e.Cell.Row.Index, "FN_GPYS_NUMBER", true);
                    }
                    else
                    {
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_NUMBER"].Value = "";
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = ""; ;
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = "";
                    }
                }
                else if (e.Cell.Column.Key.Equals("FS_DJH") || e.Cell.Column.Key.Equals("FN_GPYS_WEIGHT"))
                {
                    string strValue = Convert.ToString(e.Cell.Value).Trim();

                    if (!Convert.ToBoolean(ultraGrid1.Rows[e.Cell.Row.Index].Cells["CHECKED"].Value) && !string.IsNullOrEmpty(strValue))
                    {
                        e.Cell.Value = "";
                        return;
                    }
                }
                else if (e.Cell.Column.Key.Equals("FN_GPYS_NUMBER"))
                {
                    string strCount = Convert.ToString(e.Cell.Value).Trim();

                    if (!Convert.ToBoolean(ultraGrid1.Rows[e.Cell.Row.Index].Cells["CHECKED"].Value) && !string.IsNullOrEmpty(strCount))
                    {
                        e.Cell.Value = "";
                        return;
                    }

                    string strCountLG = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GP_TOTALCOUNT"].Value).Trim();

                    if (string.IsNullOrEmpty(strCount))
                    {
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = "";
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = "";
                        return;
                    }

                    int iCount = 0;
                    int iCountLG = Convert.ToInt16(strCountLG);

                    if (!int.TryParse(strCount, out iCount))
                    {
                        MessageBox.Show("������������������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        e.Cell.Value = iCountLG.ToString();
                        return;
                    }

                    if (iCount <= 0)
                    {
                        MessageBox.Show("��������������㣡", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        e.Cell.Value = iCountLG.ToString();
                        return;
                    }

                    if (iCount > iCountLG)
                    {
                        MessageBox.Show("���������ܴ�����������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        e.Cell.Value = iCountLG.ToString();
                        return;
                    }

                    try
                    {
                        string strWeightLG = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT"].Value).Trim();

                        if (!string.IsNullOrEmpty(strWeightLG))
                        {
                            decimal dWeightYS = Convert.ToDecimal(strWeightLG);

                            decimal dWeight = Math.Round(iCount * dWeightYS / iCountLG, 3);

                            this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = dWeight.ToString();
                        }
                    }
                    catch { }

                    try
                    {
                        string strWeightLGLL = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT_LL"].Value).Trim();

                        if (!string.IsNullOrEmpty(strWeightLGLL))
                        {
                            decimal dWeightYS = Convert.ToDecimal(strWeightLGLL);

                            decimal dWeightLL = Math.Round(iCount * dWeightYS / iCountLG, 3);

                            this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = dWeightLL.ToString();

                            string strWeightSZ = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value).Trim();

                            if (string.IsNullOrEmpty(strWeightSZ) || strWeightSZ == "0")
                            {
                                this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = dWeightLL.ToString();
                            }
                        }
                    }
                    catch { }

                }
            }
            catch { }
        }
Exemple #12
0
 private void listaVersamentiCellChange(object sender, CellEventArgs e)
 {
     if (e.Cell.Row.Band.Index == 0 && e.Cell.Column.Key == "IdConto")
         setSottoContoValueList(e.Cell.Row);
 }
Exemple #13
0
        private void listaRateClickCellButton(object sender, CellEventArgs e)
        {
            if (e.Cell.Column.Key == "DeleteColumn")
            {
                var authMessage = getRateCondominiService().IsAllowDeleteRata(int.Parse(e.Cell.Row.Cells["ID"].Value.ToString()));
                if (!string.IsNullOrEmpty(authMessage.FatalMessage))
                    CommonMessages.DisplayWarning("Non è possibile eliminare la rata:" + Environment.NewLine + authMessage.FatalMessage);
                else
                {
                    if (!(bool)e.Cell.Row.Cells["Eliminare"].Value)
                    {
                        e.Cell.Row.Cells["AssegnareAEntrante"].Value = false;
                        e.Cell.Row.Cells["Eliminare"].Value = true;
                        e.Cell.Row.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.True;
                        foreach (var cell in e.Cell.Row.Cells)
                            cell.Activation = Activation.NoEdit;
                    }
                    else
                    {
                        e.Cell.Row.Cells["Eliminare"].Value = false;
                        e.Cell.Row.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.False;

                        e.Cell.Row.Cells["AssegnareAEntrante"].Activation = Activation.AllowEdit;
                    }

                    setRiepilogoImporti();
                }
            }
        }
Exemple #14
0
        private void listaSpeseCellChange(object sender, CellEventArgs e)
        {
            if (e.Cell.Row.Band.Index == 1)
            {
                if (e.Cell.Column.Key == "AssegnareAUscente")
                {
                    if (e.Cell.Text.ToUpper() == "TRUE")
                    {
                        e.Cell.Row.Cells["ImportoSoggettoUscente"].Value = e.Cell.Row.Cells["ImportoSpesa"].Value;
                        e.Cell.Row.Cells["ImportoSoggettoEntrante"].Value = null;

                        e.Cell.Row.Cells["AssegnareAEntrante"].Value = false;
                    }
                    else
                        ripartizioneAGiorni(e.Cell.Row);

                    aggiornaTotaleSpesePersonali(e.Cell.Row);
                }
                else if (e.Cell.Column.Key == "AssegnareAEntrante")
                {
                    if (e.Cell.Text.ToUpper() == "TRUE")
                    {
                        e.Cell.Row.Cells["ImportoSoggettoEntrante"].Value = e.Cell.Row.Cells["ImportoSpesa"].Value;
                        e.Cell.Row.Cells["ImportoSoggettoUscente"].Value = null;

                        e.Cell.Row.Cells["AssegnareAUscente"].Value = false;
 }
                    else
                        ripartizioneAGiorni(e.Cell.Row);

                    aggiornaTotaleSpesePersonali(e.Cell.Row);
                }
            }
        }
    private String myCellClickOnAjax(object sender, CellEventArgs e)
{
    return "hello" + e.Cell.StringValue+".row:"+e.Cell.Row+",col:"+e.Cell.Column;
}
Exemple #16
0
        private void listaVersamentiClickCellButton(object sender, CellEventArgs e)
        {
            if (e.Cell.Column.Key == "NumeroDocumenti" && e.Cell.Row.Cells["Id"].Value != null)
            {
                try
                {
                    var versamentoDto = (VersamentoSoggettoDTO)e.Cell.Row.ListObject;

                    Func<VersamentoSoggettoDTO, DocumentoDTO, DocumentoDTO> loadCustomDati = (versamento, documento) => getVersamentiCondominiService().SetDocumentoVersamento(versamento, documento);
                    var formDocumenti = new DocumentiUI<VersamentoSoggettoDTO>(getVersamentiCondominiService().GetDocumentiByVersamento(versamentoDto), versamentoDto, versamentoDto.IdCondominio, loadCustomDati);
                    formDocumenti.ShowDialog(this);
                    formDocumenti.Dispose();
                }
                catch (Exception ex)
                {
                    
                    _log.Error("Errore durante la visualizzazione dei documenti legati ad un versamento - " + Utility.GetMethodDescription() + " - (NumDocumenti)", ex);
                }
            }
            else if (e.Cell.Column.Key == "DeleteColumn")
            {
                if (e.Cell.Band.Index == 0)
                {
                    var versamento = (VersamentoSoggettoDTO)e.Cell.Row.ListObject;
                    if (CommonMessages.DisplayConfirm("Sei sicuro che di voler eliminare il versamento di " + versamento.DescrizioneSoggetto + " per " + versamento.Importo.ToString("c") + "?") == DialogResult.Yes)
                    {
                        var authMessage = getVersamentiCondominiService().IsAllowDeleteVersamento(versamento);
                        if (string.IsNullOrEmpty(authMessage.FatalMessage))
                        {
                            var result = DialogResult.Yes;
                            if (!string.IsNullOrEmpty(authMessage.WarnMessage))
                                result = CommonMessages.DisplayConfirm("Attenzione:" + authMessage.WarnMessage + Environment.NewLine + "Vuoi confermare la eliminazione?");

                            if (result == DialogResult.Yes)
                            {
                                var messageDelete = getVersamentiCondominiService().DeleteVersamento(versamento);
                                if (string.IsNullOrEmpty(messageDelete))
                                {
                                    e.Cell.Row.Delete(false);
                                    CommonMessages.DisplayComplete("Il versamento è stato correttamente eliminato");
                                    cerca();
                                }
                                else
                                    CommonMessages.DisplayWarning("Si sono verificati i seguenti errori durante l'eliminazione del pagamento" + Environment.NewLine + Environment.NewLine + messageDelete);
                            }
                        }
                        else
                            CommonMessages.DisplayWarning("Non è ammessa la cancellazione del pagamento:" + Environment.NewLine + authMessage.FatalMessage);
                    }    
                }
            }
        }
Exemple #17
0
 private void listaRateAfterCellUpdate(object sender, CellEventArgs e)
 {
     try
     {
         if (e.Cell.Column.Key == "AssegnareAEntrante" || e.Cell.Column.Key == "AssegnareAEntrante" || e.Cell.Column.Key == "Importo")
         {
             if (e.Cell.Column.Key == "AssegnareAEntrante" || e.Cell.Column.Key == "AssegnareAEntrante")
             {
                 listaRate.UpdateData();
                 listaRate.PerformAction(UltraGridAction.ExitEditMode);
             }
             setRiepilogoImporti();
         }
     }
     catch (Exception ex)
     {
         
         _log.Error("Errore inaspettato nella lettura del riepilogo degli importi - " + Utility.GetMethodDescription(), ex);
     }
 }
        private void listaLettureAfterCellUpdate(object sender, CellEventArgs e)
        {
            if (e.Cell.Row.IsDataRow && e.Cell.Row.ListObject is LetturaContatoreDTO)
            {

            }
        }
Exemple #19
0
 private void ugItemAccion_ClickCellButton(object sender, CellEventArgs e)
 {
     ItemAccion Item = (ItemAccion)e.Cell.Row.Tag;
     switch (e.Cell.Column.Key)
     {
         case colEnsamblado:
             FrmSelectedEntity FrmSeleccionar = new FrmSelectedEntity();
             Item.Ensamblado = (Ensamblado)FrmSeleccionar.GetSelectedEntity(typeof(Ensamblado), "Ensamblado");
             break;
         default:
             break;
     }
     this.MostrarItem(e.Cell.Row);
 }
Exemple #20
0
 private void ultraGrid1_CellChange(object sender, CellEventArgs e)
 {
     try
     {
         if (e.Cell.Column.Key.Equals("CHECKED") || e.Cell.Column.Key.Equals("FN_GPYS_NUMBER") ||
             e.Cell.Column.Key.Equals("FN_GPYS_WEIGHT") || e.Cell.Column.Key.Equals("FS_DJH"))
         {
             this.ultraGrid1.UpdateData();
         }
     }
     catch { }
 }
Exemple #21
0
 private void ugItemAccion_CellChange(object sender, CellEventArgs e)
 {
     ItemAccion Item = (ItemAccion)e.Cell.Row.Tag;
     switch (e.Cell.Column.Key)
     {
         case colNombre:
             Item.Nombre = Convert.ToString(e.Cell.Text);
             this.ActualizarCombos();
             break;
         case colClase:
             Item.Clase = Convert.ToString(e.Cell.Text);
             break;
         case colParametro:
             Item.Parametro = Convert.ToString(e.Cell.Text);
             break;
         case colExito:
             Item.Exito = e.Cell.ValueList.GetValue(e.Cell.ValueList.SelectedItemIndex).ToString();
             break;
         case colError:
             Item.Error = e.Cell.ValueList.GetValue(e.Cell.ValueList.SelectedItemIndex).ToString();
             break;
         default:
             break;
     }
     this.MostrarItem(e.Cell.Row);
 }
Exemple #22
0
 private void listaContiAfterCellUpdate(object sender, CellEventArgs e)
 {
     if (e.Cell.Row.Band.Index == 0)
     {
         switch (e.Cell.Column.Key)
         {
             case "IdConto":
                 setSottoContoValueList(e.Cell.Row);
                 break;
             case "ImportoDare":
                 e.Cell.Row.Cells["ImportoAvere"].Value = null;
                 break;
             case "ImportoAvere":
                 e.Cell.Row.Cells["ImportoDare"].Value = null;
                 break;
             case "IdFornitore":
                 var dataSource = sceltaFornitoreCombo1.GetDataSource();
                 if(dataSource != null && dataSource.Count > 0)
                     fornitoreListaDTOBindingSource.DataSource = dataSource;
                 break;
         }
     }
 }
Exemple #23
0
        private void contiClickCellButton(object sender, CellEventArgs e)
        {
            // ===========================================
            //  Delete Column
            // ===========================================
            if (e.Cell.Column.Key == "DeletedColumn")
            {
                if (e.Cell.Band.Key == "ContoDTO")
                {
                    if (e.Cell.Row.ListObject != null)
                    {
                        var conto = (ContoDTO)e.Cell.Row.ListObject;
                        if (!conto.Deleted)
                        {
                            if (CommonMessages.DisplayConfirm("Sei sicuro di voler cancellare il conto " + conto.DescrizioneCompleta + "?") == DialogResult.Yes)
                            {
                                if (_contiDaAggiornare.Contains(conto))
                                    _contiDaAggiornare.Remove(conto);

                                if (conto.ID > 0)
                                {
                                    var message = getPianoContiService().DeleteConto(conto, _esercizio);
                                    if (!string.IsNullOrEmpty(message))
                                        CommonMessages.DisplayWarning("Il conto non può essere eliminato:" + Environment.NewLine + message);
                                    else
                                    {
                                        e.Cell.Row.Appearance.ForeColor = Color.LightGray;
                                        conto.Deleted = true;
                                    }
                                }
                                else
                                    e.Cell.Row.Delete(false);
                            }
                        }
                        else
                        {
                            if (CommonMessages.DisplayConfirm("Sei sicuro di voler ripristinare il conto " + conto.DescrizioneCompleta + "?") == DialogResult.Yes)
                            {
                                if (_contiDaAggiornare.Contains(conto))
                                    _contiDaAggiornare.Remove(conto);

                                if (conto.ID > 0)
                                {
                                    var message = getPianoContiService().RipristinaConto(conto, _esercizio);
                                    if (!string.IsNullOrEmpty(message))
                                        CommonMessages.DisplayWarning("Si sono verificati degli errori inattesi durante il ripristino del conto:" + Environment.NewLine + message);
                                    else
                                    {
                                        e.Cell.Row.Appearance.ForeColor = Color.Black;
                                        conto.Deleted = false;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (e.Cell.Band.Key == "SottoConti")
                {
                    if (e.Cell.Row.ListObject != null)
                    {
                        var sottoConto = (SottoContoDTO)e.Cell.Row.ListObject;
                        if (e.Cell.Row.Delete())
                        {
                            var conto = (ContoDTO)e.Cell.Row.ParentRow.ListObject;
                            conto.SottoConti.Remove(sottoConto);

                            if (sottoConto.ID > 0)
                                getPianoContiService().DeleteSottoConto(sottoConto, _esercizio);
                        }
                    }
                }
            }

            // ===========================================
            //  Clear Esercizio
            // ===========================================
            if (e.Cell.Column.Key == "ClearEsercizio")
            {
                if (e.Cell.Band.Key == "ContoDTO")
                {
                    if (e.Cell.Row.ListObject != null)
                    {
                        var conto = (ContoDTO)e.Cell.Row.ListObject;
                        conto.IdEsercizio = null;
                        _contiDaAggiornare.Add(conto);
                    }
                }
            }

            // ===========================================
            //  Clear Contatore
            // ===========================================
            if (e.Cell.Column.Key == "ClearContatore")
            {
                if (e.Cell.Band.Key == "ContoDTO")
                {
                    if (e.Cell.Row.ListObject != null)
                    {
                        var conto = (ContoDTO)e.Cell.Row.ListObject;
                        conto.IdContatore = null;
                        _contiDaAggiornare.Add(conto);
                    }
                }
            }
        }
        void dettaglioSpesaAfterCellUpdate(object sender, CellEventArgs e)
        {
            dettaglioSpesa.AfterCellUpdate -= dettaglioSpesaAfterCellUpdate;
            if (e.Cell.Column.Key == "AliquotaIva")
                e.Cell.Row.Cells["ImportoIva"].Value = null;
            else if (e.Cell.Column.Key == "ImportoLordo")
                e.Cell.Row.Cells["Imponibile"].Value = null;
            else if (e.Cell.Column.Key == "Imponibile")
                e.Cell.Row.Cells["ImportoLordo"].Value = null;

            if(e.Cell.Column.Key != "Descrizione")
                calcolaImportiRiga(e.Cell);

            dettaglioSpesa.AfterCellUpdate += dettaglioSpesaAfterCellUpdate;
        }
 private void listaMovimentiAfterCellUpdate(object sender, CellEventArgs e)
 {
     if (e.Cell.Row.IsDataRow && e.Cell.Column.Key == "SelectColumn")
         listaMovimenti.UpdateData();
 }
Exemple #26
0
 private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
 {
     try
     {
         if ((e.Cell.Column.Key.Equals("FD_ZC_ENTERDATETIME") || e.Cell.Column.Key.Equals("FD_ZZ_DATE")) && e.Cell.Column.CellActivation == Activation.AllowEdit)
         {
             e.Cell.Value = DateTime.Now;
         }
     }
     catch { }
 }
 private void listaMovimentiCellChange(object sender, CellEventArgs e)
 {
     if (e.Cell.Row.IsDataRow && e.Cell.Column.Key == "SelectColumn")
         listaMovimenti.PerformAction(UltraGridAction.ExitEditMode);
 }
 private void GrillaContactos_CellChange(object sender, CellEventArgs e)
 {
     ItemSocioNegocioContacto Item = (ItemSocioNegocioContacto)e.Cell.Row.Tag;
     switch (e.Cell.Column.Key)
     {
         case colContactoNombre:
             Item.Nombre = Convert.ToString(e.Cell.Text);
             break;
         case colContactoCargo:
             Item.Cargo = Convert.ToString(e.Cell.Text);
             break;
         case colContactoTelefono:
             Item.Telefono = Convert.ToString(e.Cell.Text);
             break;
         case colContactoCorreo:
             Item.Correo = Convert.ToString(e.Cell.Text);
             break;
         default:
             break;
     }
     this.MostrarContacto(e.Cell.Row);
 }
        private void listaMovimentiClickCellButton(object sender, CellEventArgs e)
        {
            var movimento = (MovimentiBancariDTO)e.Cell.Row.ListObject;

            if (e.Cell.Column.Key == "OpenMovimentoForm")
            {
                _driver = new DriverContabilizzazioneMovimentoBancario();
                if (_driver.Contabilizza(movimento))
                    ((List<MovimentiBancariDTO>)movimentiBancariDtoBindingSource.DataSource).Remove(movimento);
            }
        }
 private void GrillaBancos_CellChange(object sender, CellEventArgs e)
 {
     ItemSocioNegocioBanco Item = (ItemSocioNegocioBanco)e.Cell.Row.Tag;
     switch (e.Cell.Column.Key)
     {
         case colBancoDescripcion:
             Item.Descripcion = Convert.ToString(e.Cell.Text);
             break;
         default:
             break;
     }
     this.MostrarBanco(e.Cell.Row);
 }
Exemple #31
0
        // This event is called each time a Cell is updated in the grid, and is
        // called after Insert and Delete rows events.
        // We have the real value of the cell at this point, so we have to
        // find the row of the cell and updateIt.
        // Note that the cell updated can belong to a row added to the grid, and
        // in this case the row will not be found in the DataSet but in the
        // NewRows (_newDataRows) collection
        private void grid_UpdateCellBatch(object sender, CellEventArgs e)
        {
            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", ">>");
            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Row Key" + e.Cell.Row.Key);
            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Row DataKey" + e.Cell.Row.DataKey);
            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Row Index " + e.Cell.Row.Index);
            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Column Index " + e.Cell.Column.Index);
            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Cell Value " + e.Cell.Text);
            if (_ds == null || _ds.Tables.Count == 0)
            {
                ObtainDataSet();
            }
            DataRow nrow = null;

            //>> LDR 2004.07.26
            //			if (e.Cell.Row.DataKey == null)
            //			{
            //				// Search in the hashtable for the new key
            //				nrow = (DataRow)_newDataRows[e.Cell.Row.Cells.FromKey("GUID").Value.ToString()];
            //			}
            //			else
            //			{
            //				// try to find row containing the changed key
            //				string[] svPks = new string[_pk.Length];
            //				if (_pk.Length > 1)
            //				{
            //					for (int aux = 0; aux < _pk.Length; aux++)
            //					{
            //						svPks[aux] = ((Array)e.Cell.Row.DataKey).GetValue(aux).ToString();
            //					}
            //				}
            //				else
            //				{
            //					svPks[0] = (string)e.Cell.Row.DataKey.ToString();
            //				}
            //
            //				nrow = GetRowByPk(svPks);
            //				if (nrow == null)
            //					throw new System.Exception ("Original row not found in DataSet! key = " + e.Cell.Row.DataKey.ToString());
            //			}
            if (_pk.Length > 1)
            {
                TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "PK Length > 1");
                bool noKey = false;
                for (int aux = 0; aux < _pk.Length; aux++)
                {
                    noKey = noKey || (((Array)e.Cell.Row.DataKey).GetValue(aux) == null);
                }

                if (noKey)
                {
                    TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "NO KEY");
                    // Search in the hashtable for the new key
                    nrow = (DataRow)_newDataRows[e.Cell.Row.Cells.FromKey("GUID").Value.ToString()];
                }
                else
                {
                    TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "WE HAVE KEY");
                    // try to find row containing the changed key
                    string[] svPks = new string[_pk.Length];
                    for (int aux = 0; aux < _pk.Length; aux++)
                    {
                        svPks[aux] = ((Array)e.Cell.Row.DataKey).GetValue(aux).ToString();
                    }

                    nrow = GetRowByPk(svPks);
                    if (nrow == null)
                    {
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "We have a key BUT we have not found in Data Set");
                        nrow = (DataRow)_newDataRows[e.Cell.Row.Cells.FromKey("GUID").Value.ToString()];
                    }
                    else
                    {
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "We have a key AND we have not found in Data Set");
                    }
                }
            }
            else
            {
                TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "PK Length <= 1");
                if (e.Cell.Row.DataKey == null)
                {
                    // If e.Cell.Row.DataKey == null ==> Is a New Record
                    // Search in the hashtable for the new key
                    TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Search in the hashtable for the new key");
                    nrow = (DataRow)_newDataRows[e.Cell.Row.Cells.FromKey("GUID").Value.ToString()];
                }
                else
                {
                    // If e.Cell.Row.DataKey == null ==> Is a New Record or is an update

                    // try to find row containing the changed key
                    TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "try to find row containing the changed key");
                    string[] svPks = new string[_pk.Length];
                    svPks[0] = (string)e.Cell.Row.DataKey.ToString();
                    nrow     = GetRowByPk(svPks);

                    if (nrow == null)
                    {
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "We have NOT found the primary Key ==> The Row NOT exists");
                        //orc 2005.02.08 throw new System.Exception ("Original row not found in DataSet! key = " + e.Cell.Row.DataKey.ToString());
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Search in the newDataRows");
                        if (_newDataRows != null)
                        {
                            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "_newDataRows is NOT NULL");
                            if (e.Cell.Row.Cells.FromKey("GUID").Value != null)
                            {
                                TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "FromKey.Value != null");
                                if (_newDataRows.ContainsKey(e.Cell.Row.Cells.FromKey("GUID").Value.ToString()))
                                {
                                    TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "ContainsKey == TRUE");
                                    nrow = (DataRow)_newDataRows[e.Cell.Row.Cells.FromKey("GUID").Value.ToString()];
                                }
                                else
                                {
                                    TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "ContainsKey == FALSE");
                                    throw new System.Exception("You can not Update Primary Key");
                                }
                            }
                            else
                            {
                                throw new System.Exception("You can not Update Primary Key");
                            }
                        }
                        else
                        {
                            throw new System.Exception("You can not Update Primary Key");
                        }

                        if (nrow == null)
                        {
                            throw new System.Exception("Original row not found in DataSet! key = " + e.Cell.Row.DataKey.ToString());
                        }
                        else
                        {
                            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Is a New Record and we have changed key");
                        }
                    }
                    else
                    {
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "We have found the primary Key ==> The Row exists");
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Column Index : " + e.Cell.Column.Index);
                        TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "Primary Key : " + _grid.Columns.FromKey(_pk[0]).Index);
                        //if( e.Cell.Row.Cells.FromKey("GUID").Value.ToString() != nrow.GetHashCode().ToString())
                        if (e.Cell.Column.Index == _grid.Columns.FromKey(_pk[0]).Index)
                        {
                            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "We have modified PK and this PK exists!!");
                            throw new System.Exception("You can not Update Primary Key");
                        }
                        else
                        {
                            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "The row exists and PK is NOT modified");
                        }
                    }
                }
            }
            //<< LDR 2004.07.26

            //>> LDR 2004.07.29
            //if (e.Cell.Value == null)
            if ((e.Cell.Value == null) || (string.Format("{0}", e.Cell.Value) == "-999999"))
            //<< LDR 2004.07.29
            {
                nrow[e.Cell.Column.Key] = DBNull.Value;
            }
            else
            {
                nrow[e.Cell.Column.Key] = e.Cell.Value;
            }

            _lbModifyGrid = "Modify";

            TraceUWGC("UltraWebGridController::grid_UpdateCellBatch", "<<");
        }