private void FindMaterialofAula() { CheckForIllegalCrossThreadCalls = false; this._objMaterialofAula = this._cAsignarMaterial.Find(this._codMaterial, Convert.ToInt32(this.dgvListado.CurrentRow.Cells[0].Value)); if (this._objMaterialofAula != null) { this.cboSalones.SelectedValue = this.dgvListado.CurrentRow.Cells[0].Value.ToString(); this.txtDescripcion.Text = this.dgvListado.CurrentRow.Cells[3].Value.ToString(); this.txtCategoria.Text = this._objMaterialofAula.Category.Name; this.txtMarca.Text = this._objMaterialofAula.Marca.Name; this.txtModelo.Text = this._objMaterialofAula.Model; this.btnbuscar.Enabled = true; this.pgsLoad.Visible = false; this.cboSalones.Enabled = false; this.btnAgregar.Enabled = true; this.panelMain.Enabled = true; this.txtDescripcion.Focus(); this.nudCantidad.Enabled = true; } else { this.pgsLoad.Visible = false; MetroMessageBox.Show(this, this._cAsignarMaterial.MsgExeption, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this._hilo.Abort(); }
private void SubmitInsertOrUpdate() { CheckForIllegalCrossThreadCalls = false; if (!this._gotoModify) { int codigo = this._cMaterial.Insert(); if (codigo > 0) { this.pgsLoad.Visible = false; object[] d = new object[4] { codigo, this._cMaterial.DataMaterial.Description + "" + "_" + this._cMaterial.DataMarca.Name + "" + "_" + this._cMaterial.DataMaterial.Model , this._cMaterial.DataCategoria.Name, DateTime.Now.ToString("yy-mm-dd") }; this._data.Tables["ListaMaterial"].Rows.Add(d); this.tabpageMain.SelectedTab = this.tabpagMaterial; MetroMessageBox.Show(this, "El Material a sido registrado correctamente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Question); this.dgvListado.DataSource = this._data.Tables["ListaMaterial"]; this.ResetControls(); this.tabpageMain.SelectedTab = this.tabpagMaterial; } else { this.pgsLoad.Visible = false; MetroMessageBox.Show(this, "Error al intentar registrar Material", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.tabpageMain.SelectedTab = this.tabpagRegistro; this.panelRegister.Enabled = false; this._objMaterial = new tMaterial(); } } else { if (this._cMaterial.Update(this._codMaterial)) { this.dgvListado.CurrentRow.Cells[1].Value = this._objMaterial.Description + "" + "_" + this._objMaterial.Marca.Name + "" + "_" + this._objMaterial.Model; this.dgvListado.CurrentRow.Cells[2].Value = this._objMaterial.Category.Name; this.dgvListado.CurrentRow.Cells[3].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.pgsLoad.Visible = false; MetroMessageBox.Show(this, "El Material a sido Modificado correctamente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Question); this.ResetControls(); this.tabpageMain.SelectedTab = this.tabpagMaterial; } else { this.pgsLoad.Visible = false; MetroMessageBox.Show(this, "Error al intentar Modificar el Modeficar", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.tabpageMain.SelectedTab = this.tabpagRegistro; this._objMaterial = new tMaterial(); } } this._hilo.Abort(); }
void RefreshMarcaAndCategory( tMaterial material ) { //Actualizando lista de marcas DataRow[] rowMarca = this._data.Tables["ListaMarca"].Select( "Codigo='" + material.Marca.Codigo + "'" ); if ( !rowMarca.Any() ) { object[] newMarca = new object[3] { material.Marca.Codigo, material.Marca.Name, material.ModifiedDate }; this._data.Tables["ListaMarca"].Rows.Add( newMarca ); } //Actualizando Lista de Categorias DataRow[] rowCategory = this._data.Tables["listaCategoria"].Select( "Codigo='" + material.Category.Codigo + "'" ); if ( !rowCategory.Any() ) { object[] newCategory = new object[3] { material.Category.Codigo, material.Category.Name, material.ModifiedDate }; this._data.Tables["listaCategoria"].Rows.Add( newCategory ); } }
private void FindMaterial() { CheckForIllegalCrossThreadCalls = false; this._objMaterial = this._cMaterial.Find(this._codMaterial); if (this._objMaterial != null) { this.txtDescripcion.Text = this._objMaterial.Description; this.cboCategoria.Text = this._objMaterial.Category.Name; this.cboMarca.Text = this._objMaterial.Marca.Name; this.txtModelo.Text = this._objMaterial.Model; this.txtCostoReparacion.Text = Convert.ToString(this._objMaterial.RestorationCost); this.txtObservaciones.Text = this._objMaterial.Observation; this.pgsLoad.Visible = false; this.panelRegister.Enabled = true; this.panelSearch.Enabled = true; this.txtDescripcion.Focus(); this.lblValidateCategoria.Visible =false; } else { this.pgsLoad.Visible = false; MetroMessageBox.Show(this, this._cMaterial.MsERegistrarMaterial, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this._hilo.Abort(); }