Exemplo n.º 1
0
        public void guardarTarea()
        {
            try
            {
                string rpta = "";


                if (esnuevo)
                {
                    rpta = NTarea.insertartarea(
                        txtTituloTarea.Text,
                        Convert.ToInt32(txtEstimado.Text),
                        this.comboboxProyecto.SelectedItem.ToString(),
                        comboboxPrioridad.SelectedItem.ToString(),
                        comboboxEstado.SelectedItem.ToString(),
                        comboboxAplicacion.SelectedItem.ToString(),
                        txtDeteccion.Text,
                        comboboxModulo.SelectedItem.ToString(),
                        txtReferencia.Text,
                        txtVSolucion.Text,
                        txtHistoria.Text,
                        txtDescripcionTarea.Text,
                        txtResolucion.Text,
                        comboboxTDeteccion.SelectedItem.ToString(),
                        comboboxSolucion.SelectedItem.ToString(),
                        comboboxTVerificacion.SelectedItem.ToString(),
                        Convert.ToDateTime(dtFDeteccion.Value),
                        Convert.ToDateTime(dtFSolucion.Value),
                        Convert.ToDateTime(dtFVerificacion.Value)
                        );
                }
                else
                {
                    rpta = NTarea.editarTarea(
                        this.txtIdTarea.Text,
                        txtTituloTarea.Text,
                        Convert.ToInt32(txtEstimado.Text),
                        this.comboboxProyecto.SelectedItem.ToString(),
                        comboboxPrioridad.SelectedItem.ToString(),
                        comboboxEstado.SelectedItem.ToString(),
                        comboboxAplicacion.SelectedItem.ToString(),
                        txtDeteccion.Text,
                        comboboxModulo.SelectedItem.ToString(),
                        txtReferencia.Text,
                        txtVSolucion.Text,
                        txtHistoria.Text,
                        txtDescripcionTarea.Text,
                        txtResolucion.Text,
                        comboboxTDeteccion.SelectedItem.ToString(),
                        comboboxSolucion.SelectedItem.ToString(),
                        comboboxTVerificacion.SelectedItem.ToString(),
                        Convert.ToDateTime(dtFDeteccion.Value),
                        Convert.ToDateTime(dtFSolucion.Value),
                        Convert.ToDateTime(dtFVerificacion.Value));
                }

                if (rpta.Equals("OK"))
                {
                    if (esnuevo)
                    {
                        this.mensajeok("Se ha creado la tarea satisfactoriamente");
                    }
                    else
                    {
                        this.mensajeok("Se ha editado la tarea satisfactoriamente");
                    }
                }
                else
                {
                    this.mensajeerror(rpta);
                }
                botones();
                FrmTarea tarea = new FrmTarea();
                FrmParent.frmparent.lanzarNuevoElemento(tarea);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Console.WriteLine(comboboxProyecto.SelectedItem.ToString());
            Console.WriteLine(comboboxEstado.SelectedItem.ToString());;
            Console.WriteLine(this.lTecnico.Text);
            //Console.WriteLine(Convert.ToInt32(this.txtIdTarea.Text));
            Console.WriteLine(this.txtTituloTarea.Text.Trim().ToUpper());
            Console.WriteLine(this.txtDescripcionTarea.Text.Trim());
            Console.WriteLine(Convert.ToDateTime(this.dtFechaTarea.Value));
            Console.WriteLine(this.txtObservacionesTarea.Text.Trim());

            try
            {
                string rpta = "";


                if (this.txtTituloTarea.Text == string.Empty)
                {
                    mensajeerror("Formulario incompleto");
                    //this.iconoerror.SetError(this.txtTituloTarea, "Ingresar Título");
                }
                else
                {
                    if (esnuevo)
                    {
                        rpta = NTarea.insertartarea(
                            this.txtTituloTarea.Text.Trim().ToUpper(),
                            this.txtDescripcionTarea.Text.Trim(),
                            this.txtObservacionesTarea.Text.Trim(),
                            Convert.ToDateTime(this.dtFechaTarea.Value),
                            this.comboboxEstado.SelectedItem.ToString(),
                            this.lTecnico.Text,
                            this.comboboxProyecto.SelectedItem.ToString()
                            );
                    }
                    else
                    {
                        //TODO falta por acabar, salta error
                        rpta = NTarea.editarTarea(
                            Convert.ToInt32(this.txtIdTarea.Text),
                            this.txtTituloTarea.Text.Trim().ToUpper(),
                            this.txtDescripcionTarea.Text.Trim(),
                            this.txtObservacionesTarea.Text.Trim(),
                            Convert.ToDateTime(this.dtFechaTarea.Value),
                            this.comboboxEstado.SelectedItem.ToString(),
                            this.lTecnico.Text,
                            this.comboboxProyecto.SelectedItem.ToString()
                            );
                        // rpta = NTarea.editarTarea(Convert.ToInt32(this.txtIdTarea.Text), this.txtTituloTarea.Text.Trim().ToUpper(), this.txtDescripcionTarea.Text.Trim(), this.txtObservacionesTarea.Text.Trim(), this.comboboxEstado.SelectedValue, Convert.ToDateTime(this.dtFechaTarea.Value));
                        //rpta = NProyecto.editarproyecto(
                        //    Convert.ToInt32(this.txtIdProyecto.Text),
                        //    this.txtTituloProyecto.Text.Trim().ToUpper(),
                        //    this.txtObservacionesProyecto.Text.Trim(),
                        //    this.dtFechaProyecto.Value);
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (esnuevo)
                        {
                            this.mensajeok("Se ha creado el proyecto satisfactoriamente");
                        }
                        else
                        {
                            this.mensajeok("Se ha editado el proyecto satisfactoriamente");
                        }
                    }
                    else
                    {
                        this.mensajeerror(rpta);
                    }
                    botonesVisible(false);
                    botones();
                    this.limpiar();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.StackTrace);
            }
        }