Esempio n. 1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            Agregar AE = new Agregar(null);

            AE.TopLevel = false;
            AE.Dock     = DockStyle.None;
            Controls.Add(AE);
            AE.Location = new Point(50, 50);
            AE.BringToFront();
            AE.FormClosed += new FormClosedEventHandler(AE_FormClosed);
            AE.Show();
        }
Esempio n. 2
0
        private void tblEquiposFilter_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    CEEquipo equipo = new CEEquipo
                    {
                        equipoCodigo         = tblEquiposFilter.Rows[e.RowIndex].Cells["CODIGO"].Value.ToString(),
                        equipoDescripcion    = tblEquiposFilter.Rows[e.RowIndex].Cells["DESCRIPCION"].Value.ToString(),
                        proveedorDocumento   = tblEquiposFilter.Rows[e.RowIndex].Cells["PROVEEDOR_NIT"].Value.ToString(),
                        proveedorNombreCorto = tblEquiposFilter.Rows[e.RowIndex].Cells["PROVEEDOR"].Value.ToString(),

                        marca = new CEMarca
                        {
                            id          = Convert.ToInt32(tblEquiposFilter.Rows[e.RowIndex].Cells["MARCA_ID"].Value),
                            descripcion = tblEquiposFilter.Rows[e.RowIndex].Cells["MARCA_DESC"].Value.ToString()
                        },
                        modelo = new CEModelo
                        {
                            id          = Convert.ToInt32(tblEquiposFilter.Rows[e.RowIndex].Cells["MODELO_ID"].Value),
                            descripcion = tblEquiposFilter.Rows[e.RowIndex].Cells["MODELO_DESC"].Value.ToString()
                        },

                        equipoSerial = tblEquiposFilter.Rows[e.RowIndex].Cells["SERIAL"].Value.ToString(),
                        fechaIngreso = tblEquiposFilter.Rows[e.RowIndex].Cells["INGRESO"].Value.ToString(),
                        fechaSalida  = tblEquiposFilter.Rows[e.RowIndex].Cells["SALIDA"].Value.ToString(),
                        equipoEstado = tblEquiposFilter.Rows[e.RowIndex].Cells["ESTADO"].Value.ToString(),

                        proyecto = new CEProyecto
                        {
                            id = Convert.ToInt32(tblEquiposFilter.Rows[e.RowIndex].Cells["PROYECTO_ID"].Value)
                        },
                        sede = new CESede
                        {
                            id = Convert.ToInt32(tblEquiposFilter.Rows[e.RowIndex].Cells["SEDE_ID"].Value)
                        },
                        ubicacion = new CEUbicacion
                        {
                            id = Convert.ToInt32(tblEquiposFilter.Rows[e.RowIndex].Cells["UBICACION_ID"].Value)
                        },

                        numeroPuesto  = tblEquiposFilter.Rows[e.RowIndex].Cells["PUESTO"].Value.ToString(),
                        observacion   = tblEquiposFilter.Rows[e.RowIndex].Cells["OBSERVACION"].Value.ToString(),
                        fechaModifi   = tblEquiposFilter.Rows[e.RowIndex].Cells["FECHAMODIFI"].Value.ToString(),
                        usuarioModifi = tblEquiposFilter.Rows[e.RowIndex].Cells["USUMODIFI"].Value.ToString(),
                    };

                    if (EquipoMovimiento == null)
                    {
                        Agregar AE = new Agregar(equipo);
                        AE.TopLevel = false;
                        AE.Dock     = DockStyle.None;
                        Controls.Add(AE);
                        AE.Location = new Point(50, 50);
                        AE.BringToFront();
                        AE.FormClosed += new FormClosedEventHandler(AE_FormClosed);
                        AE.Show();
                    }
                    else
                    {
                        switch (EquipoMovimiento)
                        {
                        case "ASIGNAR":
                            IEquipoAsignar parent = this.Owner as IEquipoAsignar;
                            parent.AgregarEquipoAsignar(equipo);
                            break;

                        case "RECOGER":
                            IAgregarEqRec parent2 = this.Owner as IAgregarEqRec;
                            parent2.AgregarEquipoRecogida(equipo);
                            break;

                        case "PRESTAR":
                            IEquipoPrestar parent3 = this.Owner as IEquipoPrestar;
                            parent3.AgregarEquipoPrestar(equipo);
                            break;
                        }
                        Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se presento el siguiente error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }