예제 #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                //MessageBox.Show("En guardar");

                string rpta = "";
                if (this.txtTarea.Text == string.Empty)
                {
                    mensajeerror("Formulario incompleto");
                    this.iconoerror.SetError(this.txtTarea, "Ingresar Tarea");
                }
                else
                {
                    if (esnuevo)
                    {
                        rpta = NTiempo.insertartiempo(
                            this.txtTarea.Text.Trim().ToUpper(),
                            Convert.ToDateTime(this.dtFechaInicio.Value),
                            Convert.ToDateTime(this.dtFechaFin.Value),
                            this.txtObservaciones.Text.Trim());
                    }
                    else
                    {
                        MessageBox.Show("Entrando en else editar");
                        rpta = NTiempo.editartiempo(Convert.ToInt32(this.txtIdTiempo.Text),
                                                    this.txtTarea.Text.Trim(),
                                                    Convert.ToDateTime(this.dtFechaInicio.Value),
                                                    Convert.ToDateTime(this.dtFechaFin.Value),
                                                    this.txtObservaciones.Text.Trim());
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (esnuevo)
                        {
                            this.mensajeok("Se ha creado el Registro de tiempo satisfactoriamente");
                        }
                        else
                        {
                            this.mensajeok("Se ha editado el Registro de tiempo satisfactoriamente");
                        }
                    }
                    else
                    {
                        this.mensajeerror(rpta);
                    }

                    this.esnuevo  = false;
                    this.eseditar = false;
                    ModoVisualizar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.StackTrace);
            }
        }
예제 #2
0
        public void guardar()
        {
            string rpta = "";

            if (esnuevo)
            {
                //Console.WriteLine(comboboxTareaPersonal.SelectedItem.ToString()+"console");
                rpta = NTiempo.insertartiempo(
                    dtFecha.Value.ToString(), dtFechaInicio.Value.ToString(), dtFechaFin.Value.ToString(),
                    txtObservaciones.Text, comboboxAccion.SelectedItem.ToString(), comboboxTarea.SelectedItem.ToString(),
                    getTareaPersonal(),
                    DLoginStatico.usuario, booleanToInt(checkImputable.Checked), booleanToInt(checkImputado.Checked));
            }
            else
            {
                rpta = NTiempo.editartiempo(txtId.Text,
                                            dtFecha.Value.ToString(), dtFechaInicio.Value.ToString(), dtFechaFin.Value.ToString(),
                                            txtObservaciones.Text, comboboxAccion.SelectedItem.ToString(), comboboxTarea.SelectedItem.ToString(),
                                            getTareaPersonal(),
                                            DLoginStatico.usuario, booleanToInt(checkImputable.Checked), booleanToInt(checkImputado.Checked));
            }

            if (rpta.Equals("OK"))
            {
                if (esnuevo)
                {
                    this.mensajeok("Se ha creado el Registro de tiempo satisfactoriamente");
                }
                else
                {
                    this.mensajeok("Se ha editado el Registro de tiempo satisfactoriamente");
                }
            }
            else
            {
                this.mensajeerror(rpta);
            }
            FrmParent.frmparent.AbrirFormulario(new FrmTiempos());
        }