private void btnModifcar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(articulo) || !string.IsNullOrEmpty(descripcion)) { MessageBox.Show("Las opciones 'Modificar' y/o 'Borrar' no están disponibles cuando se usaron criterios de búsqueda", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dsStockMov.Tables[0].Rows.Count == 0) { return; } if (tipo == "movimientos") { frmStockMov frm = new frmStockMov(dsStockMov); frm.PK = dgvStockMov.CurrentRow.Cells["IdMovMSTK"].Value.ToString(); frm.ShowDialog(); } else { frmStockComp frm = new frmStockComp(dsStockMov); frm.PK = dgvStockMov.CurrentRow.Cells["IdMovMSTK"].Value.ToString(); frm.ShowDialog(); } }
private void StockCompensaciones_Click(object sender, EventArgs e) { frmStockComp newMDIChild = new frmStockComp(); newMDIChild.MdiParent = this; newMDIChild.Show(); }
public frmArticulos(ref frmStockComp f, DataTable tblArticulos) { InitializeComponent(); formStockComp = f; this.tblArticulos = tblArticulos; btnBorrar.Enabled = false; btnEditar.Enabled = false; btnGenerar.Enabled = false; }
// Constructor para frmStockComp public frmProgress(DataSet dt, string origen, string accion, frmStockComp instaciaStockComp) : this() { if (dt.DataSetName == "dsStockMov") { this.dsStockMov = dt; this.origen = origen; this.accion = accion; this.instaciaStockComp = instaciaStockComp; } }
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 btnModifcar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(articulo) || !string.IsNullOrEmpty(descripcion)) { MessageBox.Show("Las opciones 'Modificar' y/o 'Borrar' no están disponibles cuando se usaron criterios de búsqueda", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (dsStockMov.Tables[0].Rows.Count == 0) return; if (tipo == "movimientos") { frmStockMov frm = new frmStockMov(dsStockMov); frm.PK = dgvStockMov.CurrentRow.Cells["IdMovMSTK"].Value.ToString(); frm.ShowDialog(); } else { frmStockComp frm = new frmStockComp(dsStockMov); frm.PK = dgvStockMov.CurrentRow.Cells["IdMovMSTK"].Value.ToString(); frm.ShowDialog(); } }