Exemplo n.º 1
0
 private void GridConfig_CurrentCellEndEdit(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs e)
 {
     try
     {
     }
     catch (Exception w)
     {
         MessageBox.Show("errro al editar:" + w);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Method to handle end edit event for SfDataGrid.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OnSfGridCurrentCellEndEdit(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs args)
        {
            if (!isCurrentCellValueChanged)
            {
                return;
            }

            var rowIndex    = args.RowColumnIndex.RowIndex;
            var columnIndex = args.RowColumnIndex.ColumnIndex;

            var range = sfGrid.CoveredCells.GetCoveredCellInfo(rowIndex, columnIndex);

            sfGrid.RemoveRange(range);
            isEditted = true;
            sfGrid.GetVisualContainer().InvalidateMeasure();
        }
Exemplo n.º 3
0
        private void DataGridCxC_CurrentCellEndEdit(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs e)
        {
            try
            {
                SfDataGrid grid        = sender as SfDataGrid;
                int        columnindex = grid.ResolveToGridVisibleColumnIndex(e.RowColumnIndex.ColumnIndex);
                var        column      = grid.Columns[columnindex];

                if (column.MappingName == "cod_cta")
                {
                    DataRowView row = (DataRowView)dataGridCxC.SelectedItems[0];
                    //string valueold = row["cod_cta"].ToString(); ;

                    if (GetCuenta(row["cod_cta"].ToString().Trim()) == false)
                    {
                        MessageBox.Show("error no existe la cuenta");
                        row["cod_cta"] = valueOld;
                        return;
                    }

                    if (GetExistenciaTabla(LB_nombreInf.Text.Trim(), LB_nombreCon.Text.Trim(), row["cod_cta"].ToString().Trim()) == true)
                    {
                        MessageBox.Show("error la cuenta ya existe en el informe y el concepto");
                        row["cod_cta"] = valueOld;
                        return;
                    }

                    string id     = row["idrow"].ToString();
                    string cuenta = row["cod_cta"].ToString();
                    string query  = "update NIRel_Niif set cod_cta='" + cuenta + "' where idrow='" + id + "' ";
                    if (SiaWin.Func.SqlCRUD(query, idemp) == true)
                    {
                        row["nom_cta"] = SiaWin.Func.cmp("comae_cta", "cod_cta", "nom_cta", Convert.ToInt32(cuenta), idemp);
                    }
                }
            }
            catch (Exception w)
            {
                MessageBox.Show("error al editar!!@" + w);
            }
        }
Exemplo n.º 4
0
        private void GridConfig_CurrentCellEndEdit(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs e)
        {
            try
            {

                var reflector = this.GridConfig.View.GetPropertyAccessProvider();
                var rowData = GridConfig.GetRecordAtRowIndex(e.RowColumnIndex.RowIndex);
                string refer = reflector.GetValue(rowData, "cod_ref").ToString();
                var func = refe(refer);

                if (func.Item1)
                {

                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "can_rec")))
                        reflector.SetValue(rowData, "can_rec", 0);

                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "cantidad")))
                        reflector.SetValue(rowData, "cantidad", 0);

                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "cant_nr")))
                        reflector.SetValue(rowData, "cant_nr", 0);

                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "obs")))
                        reflector.SetValue(rowData, "obs", "Ninguna");

                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "r_h")))
                        reflector.SetValue(rowData, "r_h", 0);
                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "r_r")))
                        reflector.SetValue(rowData, "r_r", 0);
                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "r_t")))
                        reflector.SetValue(rowData, "r_t", 0);
                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "r_o")))
                        reflector.SetValue(rowData, "r_o", 0);


                    GridConfig.UpdateDataRow(e.RowColumnIndex.RowIndex);
                    GridConfig.UpdateLayout();
                    GridConfig.Columns["cod_ref"].AllowEditing = true;
                    GridConfig.Columns["can_rec"].AllowEditing = true;
                    GridConfig.Columns["cantidad"].AllowEditing = true;
                    GridConfig.Columns["cant_nr"].AllowEditing = true;
                    GridConfig.Columns["obs"].AllowEditing = true;
                    GridConfig.Columns["r_h"].AllowEditing = true;
                    GridConfig.Columns["r_r"].AllowEditing = true;
                    GridConfig.Columns["r_t"].AllowEditing = true;
                    GridConfig.Columns["r_o"].AllowEditing = true;
                }
                else
                {
                    reflector.SetValue(rowData, "cod_ref", "");
                    reflector.SetValue(rowData, "can_rec", 0);
                    reflector.SetValue(rowData, "cantidad", 0);
                    reflector.SetValue(rowData, "cant_nr", 0);
                    reflector.SetValue(rowData, "obs", "");
                    reflector.SetValue(rowData, "r_h", 0);
                    reflector.SetValue(rowData, "r_r", 0);
                    reflector.SetValue(rowData, "r_t", 0);
                    reflector.SetValue(rowData, "r_o", 0);

                    GridConfig.UpdateDataRow(e.RowColumnIndex.RowIndex);
                    GridConfig.UpdateLayout();
                    GridConfig.Columns["cod_ref"].AllowEditing = true;
                    GridConfig.Columns["can_rec"].AllowEditing = true;
                    GridConfig.Columns["cantidad"].AllowEditing = true;
                    GridConfig.Columns["cant_nr"].AllowEditing = true;
                    GridConfig.Columns["obs"].AllowEditing = true;
                    GridConfig.Columns["r_h"].AllowEditing = true;
                    GridConfig.Columns["r_r"].AllowEditing = true;
                    GridConfig.Columns["r_t"].AllowEditing = true;
                    GridConfig.Columns["r_o"].AllowEditing = true;
                }
            }
            catch (Exception w)
            {
                SiaWin.Func.SiaExeptionGobal(w);
                MessageBox.Show("error al editar:" + w);
            }
        }
        private void GridConfig_CurrentCellEndEdit(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellEndEditEventArgs e)
        {
            try
            {
                var reflector = this.GridConfig.View.GetPropertyAccessProvider();

                //if (GridConfig.View.IsCurrentBeforeFirst == true)return;

                if (Keyboard.IsKeyDown(Key.Up))
                {
                    return;
                }



                if (Keyboard.IsKeyDown(Key.Right) || Keyboard.IsKeyDown(Key.Tab) || Keyboard.IsKeyDown(Key.Return) || Keyboard.IsKeyDown(Key.Enter))
                {
                    if (GridConfig.View.IsCurrentBeforeFirst == true)
                    {
                        return;
                    }
                }



                var rowData = GridConfig.GetRecordAtRowIndex(e.RowColumnIndex.RowIndex);
                if (DBNull.Value.Equals(reflector.GetValue(rowData, "cod_ref")))
                {
                    return;
                }

                string refer = reflector.GetValue(rowData, "cod_ref").ToString();


                var func = refe(refer);
                if (func.Item1)
                {
                    reflector.SetValue(rowData, "nom_ref", func.Item2.Rows[0]["nom_ref"].ToString().Trim()).ToString();
                    double getCant = 1;

                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "cantidad")))
                    {
                        reflector.SetValue(rowData, "cantidad", 1);
                    }

                    getCant = Convert.ToDouble(reflector.GetValue(rowData, "cantidad"));
                    //if (getCant ==0) reflector.SetValue(rowData, "cantidad", 1);
                    double saldoin = Convert.ToDouble(SiaWin.Func.SaldoInv(func.Item2.Rows[0]["cod_ref"].ToString().Trim(), tx_bodega.Text, cod_empresa));
                    reflector.SetValue(rowData, "saldo", saldoin);
                    double fal = saldoin - getCant;
                    reflector.SetValue(rowData, "faltantes", fal >= 0 ? 0 : fal);
                    reflector.SetValue(rowData, "val_ref", Convert.ToDouble(func.Item2.Rows[0]["val_ref"].ToString()));
                    double sub = Convert.ToDouble(func.Item2.Rows[0]["val_ref"]) * getCant;
                    reflector.SetValue(rowData, "subtotal", sub);
                    GridConfig.UpdateDataRow(e.RowColumnIndex.RowIndex);
                    GridConfig.UpdateLayout();
                    GridConfig.Columns["nom_ref"].AllowEditing   = false;
                    GridConfig.Columns["cantidad"].AllowEditing  = true;
                    GridConfig.Columns["saldo"].AllowEditing     = false;
                    GridConfig.Columns["faltantes"].AllowEditing = false;
                    GridConfig.Columns["val_ref"].AllowEditing   = false;
                    GridConfig.Columns["subtotal"].AllowEditing  = false;
                    updateTot();
                    return;
                }
                else
                {
                    reflector.SetValue(rowData, "cod_ref", "");
                    reflector.SetValue(rowData, "nom_ref", "");
                    reflector.SetValue(rowData, "cantidad", 0);
                    reflector.SetValue(rowData, "saldo", 0);
                    reflector.SetValue(rowData, "faltantes", 0);
                    reflector.SetValue(rowData, "subtotal", 0);

                    GridConfig.UpdateDataRow(e.RowColumnIndex.RowIndex);
                    GridConfig.UpdateLayout();
                    GridConfig.Columns["nom_ref"].AllowEditing   = false;
                    GridConfig.Columns["cantidad"].AllowEditing  = true;
                    GridConfig.Columns["saldo"].AllowEditing     = false;
                    GridConfig.Columns["faltantes"].AllowEditing = false;
                    GridConfig.Columns["val_ref"].AllowEditing   = false;
                    GridConfig.Columns["subtotal"].AllowEditing  = false;
                    updateTot();
                    return;
                }
            }
            catch (Exception w)
            {
                SiaWin.Func.SiaExeptionGobal(w);
                MessageBox.Show("error al editar:" + w);
            }
        }