Beispiel #1
0
 public int update(NovedadEntity nove)
 {
     MyLog4Net.Instance.getCustomLog(this.GetType()).Info("Actualizando: " + nove.IdLiquidacion + " " + nove.Legajo + " " + nove.Codigo);
     try
     {
         StringBuilder sql = new StringBuilder();
         sql.Append(" UPDATE ");
         sql.Append(this.tabla);
         sql.Append(" SET");
         sql.Append(" valor = '");
         sql.Append(nove.Valor);
         sql.Append("' WHERE ");
         sql.Append(" idLiquidacion = ");
         sql.Append(nove.IdLiquidacion);
         sql.Append(" and legajo = ");
         sql.Append(nove.Legajo);
         sql.Append(" and codigo = ");
         sql.Append(nove.Codigo);
         return(Model.DB.ejecutarProceso(Model.TipoComando.Texto, sql.ToString()));
     }
     catch (Exception ex)
     {
         MyLog4Net.Instance.getCustomLog(this.GetType()).Error("update(). " + ex.Message, ex);
         throw;
     }
 }
Beispiel #2
0
        public int delete(NovedadEntity nove)
        {
            MyLog4Net.Instance.getCustomLog(this.GetType()).Info("Eliminado id: " + nove.IdLiquidacion + " " + nove.Legajo + " " + nove.Codigo);
            StringBuilder sql = new StringBuilder();

            sql.Append("DELETE");
            sql.Append(" FROM ");
            sql.Append(this.tabla);
            sql.Append(" WHERE ");
            sql.Append(" idLiquidacion = ");
            sql.Append(nove.IdLiquidacion);
            sql.Append(" and legajo = ");
            sql.Append(nove.Legajo);
            sql.Append(" and codigo = ");
            sql.Append(nove.Codigo);
            try
            {
                return(Model.DB.ejecutarProceso(Model.TipoComando.Texto, sql.ToString()));
            }
            catch (Exception ex)
            {
                MyLog4Net.Instance.getCustomLog(this.GetType()).Error("delete(). " + ex.Message, ex);
                throw;
            }
        }
Beispiel #3
0
 public int insert(NovedadEntity nove)
 {
     MyLog4Net.Instance.getCustomLog(this.GetType()).Info("Agregando: " + nove.IdLiquidacion + " " + nove.Legajo + " " + nove.Codigo);
     try
     {
         StringBuilder sql = new StringBuilder();
         sql.Append(" INSERT INTO ");
         sql.Append(this.tabla);
         sql.Append(" VALUES(");
         sql.Append(nove.IdLiquidacion);
         sql.Append(", ");
         sql.Append(nove.Legajo);
         sql.Append(", ");
         sql.Append(nove.Codigo);
         sql.Append(", '");
         sql.Append(nove.Valor);
         sql.Append("')");
         return(Model.DB.ejecutarProceso(Model.TipoComando.Texto, sql.ToString()));
     }
     catch (Exception ex)
     {
         MyLog4Net.Instance.getCustomLog(this.GetType()).Error("insert(). " + ex.Message, ex);
         throw;
     }
 }
Beispiel #4
0
        private NovedadEntity make(IDataReader reader)
        {
            NovedadEntity nove = new NovedadEntity(int.Parse(reader["idLiquidacion"].ToString()), int.Parse(reader["legajo"].ToString()), int.Parse(reader["codigo"].ToString()));

            nove.Valor = reader["valor"].ToString();
            return(nove);
        }
Beispiel #5
0
 public int delete(NovedadEntity nove)
 {
     using (NovedadData novedadData = new NovedadData())
     {
         return(novedadData.delete(nove));
     }
 }
Beispiel #6
0
 public int insert(NovedadEntity nove)
 {
     using (var novedadesData = new NovedadData())
     {
         return(novedadesData.insert(nove));
     }
 }
Beispiel #7
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            nove = consunove.getById(int.Parse(this.cmbLiquidacion.SelectedValue.ToString()), int.Parse(Controles.consultaCampoRenglon(this.dgvNovedades, 1)), double.Parse(Controles.consultaCampoRenglon(this.dgvNovedades, 3)));
            novedadEntityBindingSource.DataSource = nove;

            if (Convert.ToInt32(Controles.consultaCampoRenglon(this.dgvNovedades, 1)) > 0 && Varios.confirmaEliminarRegistro())
            {
                consunove.delete(nove);
                MessageBox.Show("el registro se elimino con éxito");
                this.btnCancelar_Click(sender, e);
                this.actualizarGrillaNovedades();
            }
        }
Beispiel #8
0
 /// <summary>
 /// Inserta o Actualiza nueva novedad
 /// </summary>
 /// <returns></returns>
 public int grabar(NovedadEntity nove)
 {
     using (NovedadData novedadData = new NovedadData())
     {
         if (novedadData.getById(nove.IdLiquidacion, nove.Legajo, nove.Codigo) == null)
         {
             return(novedadData.insert(nove));
         }
         else
         {
             return(novedadData.update(nove));
         }
     }
 }
Beispiel #9
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            nove = new NovedadEntity(int.Parse(this.cmbLiquidacion.SelectedValue.ToString()), 0, 0);
            novedadEntityBindingSource.DataSource = nove;

            this.txtLegajo.Text             = "";
            this.txtLegajo.Enabled          = true;
            this.cmbEmpleados.SelectedValue = -1;
            this.cmbEmpleados.Enabled       = true;
            //si esta habilitado rb por novedad, habilito cmbNovedad
            this.cmbNovedad.Enabled = this.rbPorNovedad.Enabled;
            this.txtValor.Text      = "";
            this.txtValor.Enabled   = true;
            this.txtLegajo.Focus();
            this.btnEliminar.Enabled = false;
            this.btnCerrar.Enabled   = false;
            this.btnAgregar.Enabled  = false;
            this.btnGrabar.Enabled   = true;
            this.btnCancelar.Enabled = true;
            this.gbConsultas.Enabled = false;
        }