public frmInfo(ENTEquipo equi)
        {
            InitializeComponent();
            this.CenterToScreen();

            pf = new printForm(this);

            txtId.Text = equi.id.ToString();
            txtMar.Text = equi.marca;
            txtMod.Text = equi.modelo;
            txtColor.Text = equi.color;
            txtObs.Text = equi.obser;
            txtPrecio.Text = equi.precio.ToString();
            dtpFecIng.Value = Convert.ToDateTime(equi.fechaIng);

            if (equi.fechaEnt == "")
            {
                lblFecEnt.Text = "No Entregado";
                dtpFecEnt.Visible = false;
            }
            else
            {
                dtpFecEnt.Value = Convert.ToDateTime(equi.fechaEnt);
            }

            chbArreglado.Checked = equi.arreglado;
            chbPagado.Checked = equi.pagado;
            chbEntregado.Checked = equi.entregado;

            xfot = equi.foto;
            orgfoto = equi.foto;

            pbFoto.ImageLocation = equi.foto;
            pbFoto.SizeMode = PictureBoxSizeMode.StretchImage;

            cli = GESCliente.buscarIdCliente(equi.id_cliente);
            object[] fil = { cli.id, cli.nombre, cli.direccion, cli.telefono };
            dataGridView1.Rows.Add(fil);
        }
 private void btnNuevo_Click_1(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentRow != null)
     {
         Int32 xid = Convert.ToInt32(Convert.ToString(dataGridView1.CurrentRow.Cells["id"].Value));
         equi = new ENTEquipo(0, txtMar.Text, txtMod.Text, txtColor.Text, xfot, dtpFecIng.Value.ToString(), dtpFecIng.Value.ToString(), chbPagado.Checked, false, false, float.Parse(txtPrecio.Text), txtObs.Text, xid);
         GESEquipo.nuevo(equi);
         img.Save(@"imagenes/" + imagename);
         this.Close();
     }
     else
     {
         mostrarMensaje("Seleccione una Columna");
     }
 }
Beispiel #3
0
        public void actualizarTabla()
        {
            DataTable dt = GESEquipo.obtener();

            lisEqui.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                equi = new ENTEquipo
                    (
                    Convert.ToInt32(dr["id"].ToString()),
                    dr["marca"].ToString(),
                    dr["modelo"].ToString(),
                    dr["color"].ToString(),
                    dr["foto"].ToString(),
                    dr["fechaIng"].ToString(),
                    dr["fechaEnt"].ToString(),
                    pag = (Convert.ToInt32(dr["pagado"].ToString()) == 1) ? true : false,
                    arre = (Convert.ToInt32(dr["arreglado"].ToString()) == 1) ? true : false,
                    arre = (Convert.ToInt32(dr["entregado"].ToString()) == 1) ? true : false,
                    float.Parse(dr["precio"].ToString()),
                    dr["obser"].ToString(),
                    Convert.ToInt32(dr["id_cliente"].ToString())
                    );
                lisEqui.Add(equi);
            }

            dataGridView1.Rows.Clear();
            foreach (ENTEquipo pre in lisEqui)
            {
                object[] fil = { pre.id,pre.marca,pre.modelo,pre.color,pre.foto,pre.fechaIng,pre.fechaEnt,pre.arreglado,pre.entregado, pre.pagado,pre.precio};
                dataGridView1.Rows.Add(fil);
            }
        }
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            String fechaEntrega="";
            if (chbEntregado.Checked)
            {
                fechaEntrega=dtpFecEnt.Value.ToString();
            }

            ent = new ENTEquipo(Convert.ToInt32(txtId.Text)
                , txtMar.Text
                , txtMod.Text
                , txtColor.Text
                , xfot
                , dtpFecIng.Value.ToString()
                , fechaEntrega
                , chbPagado.Checked
                , chbArreglado.Checked
                , chbEntregado.Checked
                , float.Parse(txtPrecio.Text)
                , txtObs.Text
                , 666
                );
            GESEquipo.actualizarEquipo(ent);
            if (actualizarFoto)
            {
                img.Save(@"imagenes/" + imagename);
                System.IO.File.Delete(orgfoto);
            }
            this.Close();
        }