EndEdit() public method

public EndEdit ( ) : void
return void
Exemplo n.º 1
0
        private void mapControlToCommandGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            var Cell = mapControlToCommandGrid.Rows[e.RowIndex].Cells[e.ColumnIndex];
            var Row  = Cell.OwningRow;
            var Col  = Cell.OwningColumn;

            if (Col.IsDataBound && Col.Name == "CatCmdIdColumn")
            {
                if (mapControlToCommandGrid.CurrentCell.EditType == typeof(DataGridViewComboBoxEditingControl))
                {
                    DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)mapControlToCommandGrid[e.ColumnIndex, e.RowIndex];
                    cb.DataSource = catCmdsBindingSource;
                }
            }
            else if (Col.IsDataBound && Col.Name == "midiControlTypeColumn")
            {
                ControlType ctrlType    = (ControlType)Row.Cells["midiControlTypeColumn"].Value;
                CatCmd      CatCmdValue = (CatCmd)Row.Cells["CatCmdIdColumn"].Value;
                var         attr        = CatCmdDb.Get(CatCmdValue);
                if (attr.ControlType != ctrlType)
                {
                    System.Data.DataRowView obj = (System.Data.DataRowView)mapControlToCommandGrid.CurrentRow.DataBoundItem;
                    obj.BeginEdit();
                    obj.Row["CatCmdId"] = 0;
                    obj.EndEdit();
                }
            }
        }
 public static void EditarDT(DataRowView vistaFilaActual, Ventas entidad)
 {
     vistaFilaActual.BeginEdit();
     vistaFilaActual["IdPCVEN"] = entidad.IdPc.ToString();
     vistaFilaActual["FechaMSTK"] = entidad.Fecha.ToString();
     vistaFilaActual["IdClienteVEN"] = entidad.IdCliente.ToString();
     vistaFilaActual.EndEdit();
 }
Exemplo n.º 3
0
        private bool UpdateRtInStationHead(DataRowView drInStationHead, DataRow drStationHead, DataRowView drEmp, DateTime detctime, int inOutFlag, string strDirectional)
        {
            drInStationHead.BeginEdit();
            drInStationHead["stationHeadID"] = drStationHead["stationHeadID"];
            drInStationHead["CsSetID"] = drEmp["CsSetID"];
            drInStationHead["CsTypeID"] = drEmp["CsTypeID"];
            drInStationHead["UserID"] = drEmp["UserID"];
            drInStationHead["InAntennaPlace"] = drStationHead["StationHeadPlace"];
            drInStationHead["InStationHeadTime"] = detctime;
            if (inOutFlag == 0)
            {
                drInStationHead["stationHeadTime"] = detctime;
            }
            drInStationHead["Directional"] = strDirectional;
            drInStationHead["inOutFlag"] = inOutFlag;
            drInStationHead.EndEdit();

            return UpdateRtInStationHead(drInStationHead);
        }
 private void ResetForm()
 {
     if (string.IsNullOrEmpty(PK) && !formClosing)
     {
         Random rand = new Random();
         int clave = rand.Next(-2000000000, 2000000000);
         lblNro.Text = clave.ToString();
         rowView = null;
         rowView = viewStockMov.AddNew();
         rowView["IdMovMSTK"] = clave.ToString();
         rowView["FechaMSTK"] = DateTime.Today;
         rowView["OrigenMSTK"] = 1;
         rowView["CompensaMSTK"] = 1;
         rowView.EndEdit();
         dateTimePicker1.DataBindings.Clear();
         cmbOrigen.DataBindings.Clear();
         cmbDestino.DataBindings.Clear();
         dateTimePicker1.DataBindings.Add("Text", rowView, "FechaMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
         cmbOrigen.DataBindings.Add("SelectedValue", rowView, "OrigenMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
         cmbDestino.DataBindings.Add("SelectedValue", rowView, "DestinoMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
         cargarCombos();
         foreach (DataRow row in tblStockMovDetalle.Rows)
         {
             row.Delete();
         }
         tblStockMovDetalle.AcceptChanges();
         cmbDestino.Focus();
     }
     if (!string.IsNullOrEmpty(PK)) Close();
 }
 private void frmStockMov_Load(object sender, EventArgs e)
 {
     this.CenterToScreen();
     this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
     instanciaStockComp = this;
     grabacionCorrecta = true;
     System.Drawing.Icon ico = Properties.Resources.icono_app;
     this.Icon = ico;
     this.ControlBox = true;
     this.MaximizeBox = false;
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.CausesValidation = true;
     dgvDatos.ShowCellErrors = true;
     cargarCombos();
     tblArticulos = BL.GetDataBLL.Articulos();
     tblArticulos.TableName = "Articulos";
     if (PK == "") //registro nuevo
     {
         tblStockMov = BL.StockMovBLL.GetTablaMov();
         tblStockMovDetalle = BL.StockMovBLL.GetTablaDetalle();
         tblStockMovDetalle.PrimaryKey = new DataColumn[] { tblStockMovDetalle.Columns["IdMSTKD"] };
         dsStockMov = new DataSet();
         dsStockMov.DataSetName = "dsStockMov";
         dsStockMov.Tables.Add(tblStockMov);
         dsStockMov.Tables.Add(tblStockMovDetalle);
         viewStockMov = new DataView(tblStockMov);
         viewStockMovDetalle = new DataView(tblStockMovDetalle);
         lblNro.ForeColor = System.Drawing.Color.DarkRed;
         Random rand = new Random();
         int clave = rand.Next(-2000000000, 2000000000);
         lblNro.Text = clave.ToString();
         rowView = viewStockMov.AddNew();
         rowView["IdMovMSTK"] = clave.ToString();
         rowView["FechaMSTK"] = DateTime.Today;
         rowView["OrigenMSTK"] = 1;
         rowView["CompensaMSTK"] = 1;
         rowView.EndEdit();
     }
     else // editar registros
     {
         tblStockMov = dsStockMov.Tables[0];
         tblStockMovDetalle = dsStockMov.Tables[1];
         tblStockMovDetalle.PrimaryKey = new DataColumn[] { tblStockMovDetalle.Columns["IdMSTKD"] };
         viewStockMov = new DataView(tblStockMov);
         viewStockMovDetalle = new DataView(tblStockMovDetalle);
         viewStockMov.RowFilter = "IdMovMSTK = '" + PK + "'";
         rowView = viewStockMov[0];
         viewStockMovDetalle.RowFilter = "IdMovMSTKD = '" + PK + "'";
         lblNro.Text = viewStockMov[0]["IdMovMSTK"].ToString();
         cmbOrigen.Enabled = false;
         cmbDestino.Enabled = false;
         dgvDatos.Enabled = true;
         cmbDestino.SelectedIndexChanged -= new EventHandler(this.validarMaestro);
     }
     dateTimePicker1.DataBindings.Add("Text", rowView, "FechaMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbOrigen.DataBindings.Add("SelectedValue", rowView, "OrigenMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbDestino.DataBindings.Add("SelectedValue", rowView, "DestinoMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
     rowView.CancelEdit();
     bindingSource1.DataSource = viewStockMovDetalle;
     bindingNavigator1.BindingSource = bindingSource1;
     dgvDatos.AutoGenerateColumns = false;
     AddColumns();
     dgvDatos.DataSource = bindingSource1;
     dgvDatos.AllowUserToOrderColumns = false;
     dgvDatos.EditMode = DataGridViewEditMode.EditOnKeystroke;
     dgvDatos.Enabled = false;
     cmbOrigen.Visible = false;
     btnArticulos.Enabled = false;
     this.dgvDatos.RowValidating += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.ValidarFila);
 }
        private void frmFondoCaja_Load(object sender, EventArgs e)
        {
            System.Drawing.Icon ico = Properties.Resources.icono_app;
            this.Icon = ico;
            #region comboLocal

            tblLocales = new DataTable();
            DataColumn IdPc = new DataColumn();
            IdPc.ColumnName = "IdPc";
            tblLocales.Columns.Add(IdPc);
            DataColumn NombreLOC = new DataColumn();
            NombreLOC.ColumnName = "NombreLOC";
            tblLocales.Columns.Add(NombreLOC);
            DataRow row = tblLocales.NewRow();
            row["IdPc"] = 1;
            row["NombreLOC"] = "JESUS MARIA";
            tblLocales.Rows.Add(row);
            cmbLocal.ValueMember = "IdPC";
            cmbLocal.DisplayMember = "NombreLOC";
            cmbLocal.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbLocal.DataSource = tblLocales;
            cmbLocal.SelectedValue = 1;

            #endregion

            fecha = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            dsFondoCaja = BL.FondoCajaBLL.CrearDataset(fecha, 1);
            tblFondoCaja = dsFondoCaja.Tables[1];
            viewFondoCaja = new DataView(tblFondoCaja);
            if (viewFondoCaja.Count == 0)
            {
                viewFondoCaja.RowStateFilter = DataViewRowState.Added;
                Random rand = new Random();
                int clave = rand.Next(1, 2000000000);
                lblClave.Text = clave.ToString();
                lblClave.ForeColor = System.Drawing.Color.DarkRed;
                rowView = viewFondoCaja.AddNew();
                rowView["IdFondoFONP"] = clave;
                rowView["FechaFONP"] = DateTime.Today;
                rowView["IdPcFONP"] = 1; // Jesus Maria
                rowView["ImporteFONP"] = 0;
                rowView.EndEdit();
            }
            else
            {
                rowView = viewFondoCaja[0];
            }
            lblClave.DataBindings.Add("Text", rowView, "IdFondoFONP", false, DataSourceUpdateMode.OnPropertyChanged);
            dateTimePicker1.DataBindings.Add("Text", rowView, "FechaFONP", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPcFONP", false, DataSourceUpdateMode.OnPropertyChanged);
            txtImporte.DataBindings.Add("Text", rowView, "ImporteFONP", false, DataSourceUpdateMode.OnPropertyChanged);
            txtImporte.Focus();
            txtImporte.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa);
        }
        private void frmTesoreriaMov_Load(object sender, EventArgs e)
        {
            System.Drawing.Icon ico = Properties.Resources.icono_app;
            this.Icon = ico;
            this.ControlBox = true;
            this.MaximizeBox = false;
            tblLocales = BL.LocalesBLL.CrearDataset();
            viewLocal = new DataView(tblLocales);
            viewLocal.RowFilter = "IdLocalLOC = '13'";  // Local 13 es Jesus Maria
            lstLocales.ValueMember = "IdLocalLOC";
            lstLocales.DisplayMember = "NombreLOC";
            lstLocales.DataSource = viewLocal;
            tblPcs = BL.PcsBLL.CrearDataset();
            string local = lstLocales.SelectedValue.ToString();
            viewPc = new DataView(tblPcs);
            viewPc.RowFilter = "IdPC = '1'"; // Pc 1 es caja1 de Jesus Maria
            viewPc.Sort = "Detalle ASC";
            lstPc.ValueMember = "IdPC";
            lstPc.DisplayMember = "Detalle";
            lstPc.DataSource = viewPc;
            this.lstLocales.SelectedValueChanged += new System.EventHandler(this.lstLocales_SelectedValueChanged);

            dsTesoreriaMov = BL.TesoreriaMovimientosBLL.CrearDataset();
            tblTesoreriaMov = dsTesoreriaMov.Tables[0];
            viewTesoreria = new DataView(tblTesoreriaMov);
            if (PK == "")
            {
                Random rand = new Random();
                int clave = rand.Next(1, 2000000000);
                lblClave.Text = clave.ToString();
                lblClave.ForeColor = System.Drawing.Color.DarkRed;

                viewTesoreria.RowStateFilter = DataViewRowState.Added;
                rowView = viewTesoreria.AddNew();
                rowView["IdMovTESM"] = clave.ToString();
                rowView["FechaTESM"] = DateTime.Today;
                rowView["IdPcTESM"] = 1;
                rowView.EndEdit();
            }
            else
            {
                lstLocales.SelectedValue = idLocal;
                lstPc.SelectedValue = idPc;
                lblClave.Text = PK;
                lblClave.ForeColor = System.Drawing.Color.DarkRed;
                viewTesoreria.RowFilter = "IdMovTESM = '" + PK + "'";
                rowView = viewTesoreria[0];
                txtDetalle.Focus();
            }
            dateTimePicker1.DataBindings.Add("Text", rowView, "FechaTESM", false, DataSourceUpdateMode.OnPropertyChanged);
            lstPc.DataBindings.Add("SelectedValue", rowView, "IdPcTESM", false, DataSourceUpdateMode.OnPropertyChanged);
            txtDetalle.DataBindings.Add("Text", rowView, "DetalleTESM", false, DataSourceUpdateMode.OnPropertyChanged);
            txtImporte.DataBindings.Add("Text", rowView, "ImporteTESM", false, DataSourceUpdateMode.OnPropertyChanged);
            txtImporte.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa);
        }
Exemplo n.º 8
0
        private void frmVentas_Load(object sender, EventArgs e)
        {
            this.StartPosition = FormStartPosition.CenterScreen;
            System.Drawing.Icon ico = Properties.Resources.icono_app;
            this.Icon = ico;
            this.ControlBox = true;
            this.MaximizeBox = false;
            instanciaVentas = this;
            this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
            this.ControlBox = true;
            this.MaximizeBox = false;
            this.CancelButton = btnSalir;
            btnSalir.Visible = false;
            dateTimePicker1.Visible = false;
            lblFecha.Text = DateTime.Today.ToLongDateString();
            lblTotal.ForeColor = System.Drawing.Color.DarkRed;
            ToolTip tooltipClientes = new ToolTip();
            tooltipClientes.SetToolTip(btnClientes, "Agregar nuevo cliente");
            ToolTip tooltipCupones = new ToolTip();
            tooltipCupones.SetToolTip(btnCupon, "Ingresar cupón de descuento");
            dsForaneos = BL.VentasBLL.CrearDatasetForaneos();
            tblLocales = dsForaneos.Tables[3];
            tblPcs = dsForaneos.Tables[4];
            CargarComboLocales();
            tblArticulos = dsForaneos.Tables[0];
            tblArticulos.TableName = "Articulos";
            var source = new AutoCompleteStringCollection();
            String[] stringArray =
                Array.ConvertAll<DataRow, String>(tblArticulos.Select(), delegate(DataRow row) { return (String)row["IdArticuloART"]; });
            source.AddRange(stringArray);
            txtArticulo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            txtArticulo.AutoCompleteCustomSource = source;
            txtArticulo.AutoCompleteSource = AutoCompleteSource.CustomSource;
            txtArticulo.BackColor = Color.White;
            txtDescripcion.BackColor = Color.White;
            txtDescripcion.TabStop = false;
            txtDescripcion.ReadOnly = true;
            txtCantidad.BackColor = Color.White;
            txtPrecio.BackColor = Color.White;
            tblFormasPago = dsForaneos.Tables[2];
            tblFormasPago.TableName = "FormasPago";
            cmbForma.ValueMember = "IdFormaPagoFOR";
            cmbForma.DisplayMember = "DescripcionFOR";
            cmbForma.DropDownStyle = ComboBoxStyle.DropDown;
            cmbForma.DataSource = tblFormasPago;
            cmbForma.SelectedValue = -1;
            cmbForma.BackColor = Color.White;

            AutoCompleteStringCollection formasColection = new AutoCompleteStringCollection();
            foreach (DataRow row in tblFormasPago.Rows)
            {
                formasColection.Add(Convert.ToString(row["DescripcionFOR"]));
            }
            cmbForma.AutoCompleteCustomSource = formasColection;
            cmbForma.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            cmbForma.AutoCompleteSource = AutoCompleteSource.CustomSource;
            txtCosto.Visible = false;
            grpInicial.CausesValidation = false;
            grpBotonera.CausesValidation = false;
            btnClientes.CausesValidation = false;
            btnCupon.CausesValidation = false;
            btnEditar.CausesValidation = false;
            btnBorrar.CausesValidation = false;
            btnArticulos.CausesValidation = false;

            lblNro.ForeColor = System.Drawing.Color.DarkRed;
            dsVentas = new DataSet();
            dsVentas.DataSetName = "dsVentas";
            if (tblVentas.DataSet == null)
            {
                dsVentas.Tables.Add(tblVentas);
                dsVentas.Tables.Add(tblVentasDetalle);
            }
            tblVentasDetalle.PrimaryKey = new DataColumn[] { tblVentasDetalle.Columns["IdDVEN"] };
            viewVentas = new DataView(tblVentas);
            viewDetalle = new DataView(tblVentasDetalle);
            bindingSource1.DataSource = viewDetalle;
            bindingNavigator1.BindingSource = bindingSource1;
            dgvDatos.ReadOnly = true;
            dgvDatos.AllowUserToAddRows = false;
            dgvDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dgvDatos.DataSource = viewDetalle;
            dgvDatos.AllowUserToOrderColumns = false;
            dgvDatos.Columns["IdDVEN"].Visible = false;
            dgvDatos.Columns["IdVentaDVEN"].Visible = false;
            dgvDatos.Columns["IdLocalDVEN"].Visible = false;
            dgvDatos.Columns["PrecioCostoDVEN"].Visible = false;
            dgvDatos.Columns["PrecioMayorDVEN"].Visible = false;
            dgvDatos.Columns["IdFormaPagoDVEN"].Visible = false;
            dgvDatos.Columns["NroCuponDVEN"].Visible = false;
            dgvDatos.Columns["NroFacturaDVEN"].Visible = false;
            dgvDatos.Columns["IdEmpleadoDVEN"].Visible = false;
            dgvDatos.Columns["LiquidadoDVEN"].Visible = false;
            dgvDatos.Columns["EsperaDVEN"].Visible = false;
            dgvDatos.Columns["DescripcionDVEN"].HeaderText = "Descripción";
            dgvDatos.Columns["CantidadDVEN"].Width = 55;
            dgvDatos.Columns["CantidadDVEN"].HeaderText = "Cantidad";
            dgvDatos.Columns["IdArticuloDVEN"].HeaderText = "Artículo";
            dgvDatos.Columns["PrecioPublicoDVEN"].Width = 100;
            dgvDatos.Columns["PrecioPublicoDVEN"].HeaderText = "Precio";
            dgvDatos.Columns["NroFacturaDVEN"].Width = 100;
            dgvDatos.Columns["NroFacturaDVEN"].HeaderText = "Nº fact.";
            dgvDatos.Columns.Remove("DevolucionDVEN");
            dgvDatos.Columns.Remove("IdFormaPagoDVEN");
            cmbFormaPago = new DataGridViewComboBoxColumn();
            cmbFormaPago.Name = "FormaPago";
            cmbFormaPago.HeaderText = "Forma de pago";
            cmbFormaPago.DataSource = tblFormasPago;
            cmbFormaPago.ValueMember = "IdFormaPagoFOR";
            cmbFormaPago.DisplayMember = "DescripcionFOR";
            cmbFormaPago.DataPropertyName = "IdFormaPagoDVEN";
            dgvDatos.Columns.Insert(7, cmbFormaPago);
            chkDevolucion = new DataGridViewCheckBoxColumn();
            chkDevolucion.Name = "DevolucionDVEN";
            chkDevolucion.Width = 40;
            chkDevolucion.HeaderText = "Dev.";
            chkDevolucion.DataPropertyName = "DevolucionDVEN";
            chkDevolucion.TrueValue = 1;
            chkDevolucion.FalseValue = 0;
            dgvDatos.Columns.Insert(12, chkDevolucion);
            if (PK == "") //registro nuevo
            {
                tblVentas.PrimaryKey = new DataColumn[] { tblVentas.Columns["IdVentaVEN"] };
                tblDetalleOriginal = tblVentasDetalle.Copy(); //tblDetalleOriginal se usa para controlar errores de guardado remoto por falta de internet
                Random rand = new Random();
                int clave = rand.Next(1, 2000000000);
                bool existe = true;
                while (existe == true)
                {
                    DataRow foundRow = dsVentas.Tables["Ventas"].Rows.Find(clave);
                    if (foundRow == null)
                    {
                        existe = false;
                    }
                    else
                    {
                        clave = rand.Next(1, 2000000000);
                    }
                }
                lblNro.Text = clave.ToString();
                viewVentas.RowStateFilter = DataViewRowState.Added;
                viewDetalle.RowStateFilter = DataViewRowState.Added;
                rowView = viewVentas.AddNew();
                rowView["IdVentaVEN"] = clave.ToString();
                rowView["FechaVEN"] = DateTime.Now;
                rowView["IdPCVEN"] = 1;
                rowView["NroCuponVEN"] = "00000000000";
                rowView.EndEdit();
            }
            else // editar registros
            {
                tblDetalleOriginal = tblVentasDetalle.Copy(); //tblDetalleOriginal se usa para controlar errores de guardado remoto por falta de internet
                viewVentas.RowFilter = "IdVentaVEN = '" + PK + "'";
                rowView = viewVentas[0];
                viewDetalle.RowFilter = "IdVentaDVEN = '" + PK + "'";
                lblNro.Text = viewVentas[0][0].ToString();
                cmbLocal.Enabled = false;
                // viewDetalleOriginal  se usa para registrar en tabla fallidas errores de guardado remoto por falta de internet
                viewDetalleOriginal = new DataView(tblDetalleOriginal);
                viewDetalleOriginal.RowFilter = "IdVentaDVEN = '" + PK + "'";
                lblTotal.Text = "$" + CalcularTotalOk().ToString();
            }
            dateTimePicker1.DataBindings.Add("Text", rowView, "FechaVEN", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPCVEN", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbCliente.DataBindings.Add("SelectedValue", rowView, "IdClienteVEN", false, DataSourceUpdateMode.OnPropertyChanged);
            txtCupon.DataBindings.Add("Text", rowView, "NroCuponVEN", false, DataSourceUpdateMode.OnPropertyChanged);
            rowView.CancelEdit();
            cmbCliente.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox);
            txtPrecio.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa);
            txtCantidad.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumeros);
            txtArticulo.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox);
            txtCantidad.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox);
            txtPrecio.Enter += new System.EventHandler(Utilitarios.SelTextoTextBox);
            txtArticulo.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab);
            txtCantidad.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab);
            txtPrecio.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab);
            cmbForma.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab);
            cmbForma.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox);
            chkDev.KeyDown += new System.Windows.Forms.KeyEventHandler(Utilitarios.EnterTab);
            if (!string.IsNullOrEmpty(PK)) //registro nuevo
            {
                tblVentas.AcceptChanges();
                tblVentasDetalle.AcceptChanges();
            }
            SetStateForm(FormState.insercion);
        }
 private void frmFondoCaja_Load(object sender, EventArgs e)
 {
     this.Location = new Point(50, 50);
     System.Drawing.Icon ico = Properties.Resources.icono_app;
     this.Icon = ico;
     this.ControlBox = true;
     this.MaximizeBox = false;
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     tblLocales = BL.GetDataBLL.Locales();
     viewLocal = new DataView(tblLocales);
     viewLocal.RowFilter = "IdLocalLOC <>'1' AND IdLocalLOC <>'2' AND IdLocalLOC <>'11' AND IdLocalLOC <>'12'";
     lstLocales.ValueMember = "IdLocalLOC";
     lstLocales.DisplayMember = "NombreLOC";
     lstLocales.DataSource = viewLocal;
     tblPcs = BL.GetDataBLL.Pc();
     string local = lstLocales.SelectedValue.ToString();
     viewPc = new DataView(tblPcs);
     viewPc.RowFilter = "IdLocalPC = '" + local + "'";
     viewPc.Sort = "Detalle ASC";
     lstPc.ValueMember = "IdPC";
     lstPc.DisplayMember = "Detalle";
     lstPc.DataSource = viewPc;
     viewFondoCaja = new DataView(tblFondoCaja);
     if (tblFondoCaja.Rows.Count == 0)
     {
         rowView = viewFondoCaja.AddNew();
         Random rand = new Random();
         int clave = rand.Next(-2000000000, 2000000000);
         rowView["IdFondoFONP"] = clave;
         rowView["FechaFONP"] = DateTime.Today;
         rowView.EndEdit();
     }
     else
     {
         viewFondoCaja.RowFilter = "IdFondoFONP = '" + PK + "'";
         rowView = viewFondoCaja[0];
         lstLocales.SelectedValue = rowView["IdLocalLOC"];
         lstPc.SelectedValue = rowView["IdPcFONP"];
     }
     dateTimePicker1.DataBindings.Add("Text", rowView, "FechaFONP", false, DataSourceUpdateMode.OnPropertyChanged);
     lstPc.DataBindings.Add("SelectedValue", rowView, "IdPcFONP", false, DataSourceUpdateMode.OnPropertyChanged);
     txtImporte.DataBindings.Add("Text", rowView, "ImporteFONP", false, DataSourceUpdateMode.OnPropertyChanged);
     if (lstPc.Items.Count > 0) lstPc.SetSelected(0, true);
     this.lstLocales.SelectedValueChanged += new System.EventHandler(this.lstLocales_SelectedValueChanged);
     this.AcceptButton = btnAceptar;
     txtImporte.Focus();
 }
Exemplo n.º 10
0
 private void frmProgress_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (!grabacionCorrecta)
     {
         tblStockMovDetalle.RejectChanges();
         Close();
         return;
     }
     if (string.IsNullOrEmpty(PK) && !formClosing)
     {
         Random rand = new Random();
         int clave = rand.Next(-2000000000, 2000000000);
         lblNro.Text = clave.ToString();
         rowView = null;
         rowView = viewStockMov.AddNew();
         rowView["IdMovMSTK"] = clave.ToString();
         rowView["FechaMSTK"] = DateTime.Today;
         rowView["OrigenMSTK"] = -1;
         rowView["DestinoMSTK"] = -1;
         rowView["CompensaMSTK"] = 0;
         rowView.EndEdit();
         dateTimePicker1.DataBindings.Clear();
         cmbOrigen.DataBindings.Clear();
         cmbDestino.DataBindings.Clear();
         dateTimePicker1.DataBindings.Add("Text", rowView, "FechaMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
         cmbOrigen.DataBindings.Add("SelectedValue", rowView, "OrigenMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
         cmbDestino.DataBindings.Add("SelectedValue", rowView, "DestinoMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
         cmbOrigen.SelectedIndexChanged -= new EventHandler(ValidarOrigenDestino);
         cmbDestino.SelectedIndexChanged -= new EventHandler(ValidarOrigenDestino);
         cargarCombos();
         foreach (DataRow row in tblStockMovDetalle.Rows)
         {
             row.Delete();
         }
         tblStockMovDetalle.AcceptChanges();
         cmbOrigen.Focus();
         cmbOrigen.DroppedDown = true;
     }
     if (!string.IsNullOrEmpty(PK)) Close();
 }
Exemplo n.º 11
0
 /// <summary>
 /// Запускает форму для редактирования строки.
 /// </summary>
 /// <param name="source"></param>
 private void EditRow(DataRowView source)
 {
     source.BeginEdit();
     Editor.ReBindControlsToDataRow(source);
     if (Editor.ShowDialog() == DialogResult.OK)
     {
         source.EndEdit();
     }
     else
     {
         source.CancelEdit();
     }
 }
Exemplo n.º 12
0
 private void frmVentas_Load(object sender, EventArgs e)
 {
     System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator = ",";
     System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator = ",";
     this.CenterToScreen();
     instanciaVentas = this;
     this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
     System.Drawing.Icon ico = Properties.Resources.icono_app;
     this.Icon = ico;
     this.ControlBox = true;
     this.MaximizeBox = false;
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     CargarComboLocales();
     grpABM.Enabled = false;
     tblArticulos = BL.GetDataBLL.Articulos();
     tblArticulos.TableName = "Articulos";
     var source = new AutoCompleteStringCollection();
     String[] stringArray =
         Array.ConvertAll<DataRow, String>(tblArticulos.Select(), delegate(DataRow row) { return (String)row["IdArticuloART"]; });
     source.AddRange(stringArray);
     txtArticulo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
     txtArticulo.AutoCompleteCustomSource = source;
     txtArticulo.AutoCompleteSource = AutoCompleteSource.CustomSource;
     txtArticulo.BackColor = Color.White;
     txtDescripcion.BackColor = Color.White;
     txtDescripcion.TabStop = false;
     txtDescripcion.ReadOnly = true;
     txtCantidad.BackColor = Color.White;
     txtPrecio.BackColor = Color.White;
     tblFormasPago = BL.GetDataBLL.FormasPago();
     cmbForma.ValueMember = "IdFormaPagoFOR";
     cmbForma.DisplayMember = "DescripcionFOR";
     cmbForma.DropDownStyle = ComboBoxStyle.DropDown;
     cmbForma.DataSource = tblFormasPago;
     cmbForma.SelectedValue = -1;
     cmbForma.BackColor = Color.White;
     AutoCompleteStringCollection formasPagoColection = new AutoCompleteStringCollection();
     foreach (DataRow row in tblFormasPago.Rows)
     {
         formasPagoColection.Add(Convert.ToString(row["DescripcionFOR"]));
     }
     cmbForma.AutoCompleteCustomSource = formasPagoColection;
     cmbForma.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
     cmbForma.AutoCompleteSource = AutoCompleteSource.CustomSource;
     cmbForma.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox);
     lblCosto.Visible = false;
     txtCosto.Visible = false;
     grpVentas.CausesValidation = false;
     dateTimePicker1.CausesValidation = false;
     cmbLocal.CausesValidation = false;
     cmbCliente.CausesValidation = false;
     btnClientes.CausesValidation = false;
     btnEditar.CausesValidation = false;
     btnBorrar.CausesValidation = false;
     btnArticulos.CausesValidation = false;
     dsVentas = new DataSet();
     dsVentas.DataSetName = "dsVentas";
     if (tblVentas.DataSet == null)
     {
         dsVentas.Tables.Add(tblVentas);
         dsVentas.Tables.Add(tblVentasDetalle);
     }
     tblVentasDetalle.PrimaryKey = new DataColumn[] { tblVentasDetalle.Columns["IdDVEN"] };
     viewVentas = new DataView(tblVentas);
     viewDetalle = new DataView(tblVentasDetalle);
     viewDetalle.Sort = "OrdenarDVEN ASC";
     bindingSource1.DataSource = viewDetalle;
     bindingNavigator1.BindingSource = bindingSource1;
     dgvDatos.ReadOnly = true;
     dgvDatos.AllowUserToAddRows = false;
     dgvDatos.AllowUserToOrderColumns = false;
     dgvDatos.DataSource = bindingSource1;
     dgvDatos.Columns["IdDVEN"].Visible = false;
     dgvDatos.Columns["IdVentaDVEN"].Visible = false;
     dgvDatos.Columns["IdLocalDVEN"].Visible = false;
     dgvDatos.Columns["PrecioCostoDVEN"].Visible = false;
     dgvDatos.Columns["PrecioMayorDVEN"].Visible = false;
     dgvDatos.Columns["IdFormaPagoDVEN"].Visible = false;
     dgvDatos.Columns["NroCuponDVEN"].Visible = false;
     dgvDatos.Columns["IdEmpleadoDVEN"].Visible = false;
     dgvDatos.Columns["LiquidadoDVEN"].Visible = false;
     dgvDatos.Columns["EsperaDVEN"].Visible = false;
     dgvDatos.Columns["OrdenarDVEN"].Visible = false;
     dgvDatos.Columns["CantidadDVEN"].Width = 55;
     dgvDatos.Columns["CantidadDVEN"].HeaderText = "Cantidad";
     dgvDatos.Columns["IdArticuloDVEN"].HeaderText = "Artículo";
     dgvDatos.Columns["DescripcionDVEN"].HeaderText = "Descripción";
     dgvDatos.Columns["PrecioPublicoDVEN"].Width = 100;
     dgvDatos.Columns["PrecioPublicoDVEN"].HeaderText = "Precio";
     dgvDatos.Columns["PrecioPublicoDVEN"].DefaultCellStyle.Format = "C2";
     dgvDatos.Columns["NroFacturaDVEN"].Width = 100;
     dgvDatos.Columns["NroFacturaDVEN"].HeaderText = "Nº fact.";
     dgvDatos.Columns.Remove("DevolucionDVEN");
     dgvDatos.Columns.Remove("IdFormaPagoDVEN");
     DataGridViewComboBoxColumn cmbFormaPago = new DataGridViewComboBoxColumn();
     cmbFormaPago.Name = "FormaPago";
     cmbFormaPago.HeaderText = "Forma de pago";
     cmbFormaPago.DataSource = tblFormasPago;
     cmbFormaPago.ValueMember = "IdFormaPagoFOR";
     cmbFormaPago.DisplayMember = "DescripcionFOR";
     cmbFormaPago.DataPropertyName = "IdFormaPagoDVEN";
     dgvDatos.Columns.Insert(7, cmbFormaPago);
     DataGridViewCheckBoxColumn chkDevolucion = new DataGridViewCheckBoxColumn();
     chkDevolucion.Name = "DevolucionDVEN";
     chkDevolucion.Width = 40;
     chkDevolucion.HeaderText = "Dev.";
     chkDevolucion.DataPropertyName = "DevolucionDVEN";
     chkDevolucion.TrueValue = 1;
     chkDevolucion.FalseValue = 0;
     dgvDatos.Columns.Insert(12, chkDevolucion);
     dgvDatos.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
     lblTotal.Text = "$ 0";
     if (PK == "") //registro nuevo
     {
         lblNro.ForeColor = System.Drawing.Color.DarkRed;
         Random rand = new Random();
         int clave = rand.Next(-2000000000, 2000000000);
         lblNro.Text = clave.ToString();
         rowView = viewVentas.AddNew();
         rowView["IdVentaVEN"] = clave.ToString();
         rowView["FechaVEN"] = dateTimePicker1.Value;
         rowView.EndEdit();
       //  SetStateForm(FormState.inicial);
     }
     else // editar registros
     {
         viewVentas.RowFilter = "IdVentaVEN = '" + PK + "'";
         rowView = viewVentas[0];
         rowView.BeginEdit();
         viewDetalle.RowFilter = "IdVentaDVEN = '" + PK + "'";
         lblNro.Text = viewVentas[0][0].ToString();
         cmbLocal.Enabled = false;
         lblTotal.Text = "$ " + CalcularTotal();
         dateTimePicker1.TabStop = false;
         cmbLocal.TabStop = false;
         cmbCliente.Focus();
         SetStateForm(FormState.inicial);
     }
     dateTimePicker1.DataBindings.Add("Text", rowView, "FechaVEN", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbLocal.DataBindings.Add("SelectedValue", rowView, "IdPCVEN", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbCliente.DataBindings.Add("SelectedValue", rowView, "IdClienteVEN", false, DataSourceUpdateMode.OnPropertyChanged);
     rowView.CancelEdit();
     ToolTip tooltip = new ToolTip();
     tooltip.SetToolTip(btnClientes, "Agregar nuevo cliente");
     cmbLocal.SelectedIndexChanged += new EventHandler(this.ValidarMaestro);
     cmbCliente.Validating += new System.ComponentModel.CancelEventHandler(BL.Utilitarios.ValidarComboBox);
     txtPrecio.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumerosConComa);
     txtCantidad.KeyPress += new KeyPressEventHandler(BL.Utilitarios.SoloNumeros);
     txtArticulo.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox);
     txtCantidad.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox);
     txtPrecio.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox);
     cmbForma.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox);
     txtArticulo.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
     txtCantidad.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
     txtPrecio.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
     cmbForma.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
     chkDev.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
 }
 private void frmStockMov_Load(object sender, EventArgs e)
 {
     this.CenterToScreen();
     System.Drawing.Icon ico = Properties.Resources.icono_app;
     this.Icon = ico;
     this.ControlBox = true;
     this.MaximizeBox = false;
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     tblStockMov = BL.StockMovBLL.GetTablaMov();
     tblStockMovDetalle = BL.StockMovBLL.GetTablaDetalle();
     DataColumn col = new DataColumn();
     col.ColumnName = "Precio";
     tblStockMovDetalle.Columns.Add(col);
     dsStockMov = new DataSet();
     dsStockMov.DataSetName = "dsStockMov";
     dsStockMov.Tables.Add(tblStockMov);
     dsStockMov.Tables.Add(tblStockMovDetalle);
     tblStockEntradas = tblStockMov.Clone();
     tblEntradasDetalle = tblStockMovDetalle.Clone();
     viewStockMov = new DataView(tblStockEntradas);
     viewStockMovDetalle = new DataView(tblEntradasDetalle);
     lblNro.ForeColor = System.Drawing.Color.DarkRed;
     Random rand = new Random();
     idMov = rand.Next(-2000000000, 2000000000);
     lblNro.Text = idMov.ToString();
     viewStockMov.RowStateFilter = DataViewRowState.Added;
     rowView = viewStockMov.AddNew();
     rowView["IdMovMSTK"] = idMov.ToString();
     rowView["OrigenMSTK"] = 1;
     rowView["FechaMSTK"] = DateTime.Today;
     rowView["CompensaMSTK"] = 0;
     rowView.EndEdit();
     dgvDatos.Enabled = false;
     dateTimePicker1.DataBindings.Add("Text", rowView, "FechaMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbOrigen.DataBindings.Add("SelectedValue", rowView, "OrigenMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
     cmbDestino.DataBindings.Add("SelectedValue", rowView, "DestinoMSTK", false, DataSourceUpdateMode.OnPropertyChanged);
     rowView.CancelEdit();
     bindingSource1.DataSource = viewStockMovDetalle;
     bindingNavigator1.BindingSource = bindingSource1;
     dgvDatos.DataSource = bindingSource1;
     dgvDatos.AllowUserToOrderColumns = false;
     dgvDatos.EditMode = DataGridViewEditMode.EditOnKeystroke;
     dgvDatos.Columns["IdArticuloMSTKD"].HeaderText = "Código";
     dgvDatos.Columns["IdArticuloMSTKD"].SortMode = DataGridViewColumnSortMode.NotSortable;
     dgvDatos.Columns["DescripcionART"].HeaderText = "Descripción";
     dgvDatos.Columns["DescripcionART"].SortMode = DataGridViewColumnSortMode.NotSortable;
     dgvDatos.Columns["IdMovMSTKD"].Visible = false;
     dgvDatos.Columns["IdMSTKD"].Visible = false;
     dgvDatos.Columns["CompensaMSTKD"].Visible = false;
     dgvDatos.Columns["OrigenMSTKD"].Visible = false;
     dgvDatos.Columns["DestinoMSTKD"].Visible = false;
     dgvDatos.Columns["Precio"].Visible = false;
     dgvDatos.Columns["CantidadMSTKD"].Width = 100;
     dgvDatos.Columns["CantidadMSTKD"].HeaderText = "Cantidad";
     dgvDatos.Columns["CantidadMSTKD"].SortMode = DataGridViewColumnSortMode.NotSortable;
     tblArticulos = BL.GetDataBLL.Articulos();
     tblArticulos.TableName = "Articulos";
     dgvDatos.Columns[3].Width = 500;
     dgvDatos.Columns[3].ReadOnly = true;
     dgvDatos.Enabled = false;
     btnArticulos.Enabled = false;
     cmbDestino.Focus();
 }