public int eliminarConcepto(Conceptos c)
 {
     Command.CommandText = "delete from conceptos where id = @id";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("id", c.id);
     return Command.ExecuteNonQuery();
 }
 public object exentaConcepto(Conceptos c)
 {
     Command.CommandText = "select exento from conceptos where idempresa = @idempresa and noconcepto = @noconcepto and tipoconcepto = @tipoconcepto and periodo = @periodo";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("idempresa", c.idempresa);
     Command.Parameters.AddWithValue("noconcepto", c.noconcepto);
     Command.Parameters.AddWithValue("tipoconcepto", c.tipoconcepto);
     Command.Parameters.AddWithValue("periodo", c.periodo);
     object dato = Select(Command);
     return dato;
 }
 public int actualizaConcepto(Conceptos c)
 {
     Command.CommandText = "update conceptos set noconcepto = @noconcepto, concepto = @concepto, tipoconcepto = @tipoconcepto, formula = @formula, formulaexento = @formulaexento, gravado = @gravado, " +
         "exento = @exento, gruposat = @gruposat, visible = @visible, periodo = @periodo where id = @id";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("id", c.id);
     Command.Parameters.AddWithValue("noconcepto", c.noconcepto);
     Command.Parameters.AddWithValue("concepto", c.concepto);
     Command.Parameters.AddWithValue("tipoconcepto", c.tipoconcepto);
     Command.Parameters.AddWithValue("formula", c.formula);
     Command.Parameters.AddWithValue("formulaexento", c.formulaexento);
     Command.Parameters.AddWithValue("gravado", c.gravado);
     Command.Parameters.AddWithValue("exento", c.exento);
     Command.Parameters.AddWithValue("gruposat", c.gruposat);
     Command.Parameters.AddWithValue("visible", c.visible);
     Command.Parameters.AddWithValue("periodo", c.periodo);
     return Command.ExecuteNonQuery();
 }
 public object obtenerNoConcepto(Conceptos c)
 {
     Command.CommandText = "select noconcepto from Conceptos where formula = @formula and idempresa = @idempresa";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("formula", c.formula);
     Command.Parameters.AddWithValue("idempresa", c.idempresa);
     object dato = Select(Command);
     return dato;
 }
 public object obtenerFormulaExento(Conceptos c)
 {
     Command.CommandText = "select formulaexento from conceptos where noconcepto = @noconcepto and idempresa = @idempresa";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("noconcepto", c.noconcepto);
     Command.Parameters.AddWithValue("idempresa", c.idempresa);
     object dato = Select(Command);
     return dato;
 }
 public List<Conceptos> obtenerConceptosDeducciones(Conceptos c)
 {
     List<Conceptos> lstConcepto = new List<Conceptos>();
     DataTable dtConceptos = new DataTable();
     Command.CommandText = "select * from conceptos where idempresa = @idempresa and tipoconcepto = @tipoconcepto";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("idempresa", c.idempresa);
     Command.Parameters.AddWithValue("tipoconcepto", c.tipoconcepto);
     dtConceptos = SelectData(Command);
     for (int i = 0; i < dtConceptos.Rows.Count; i++)
     {
         Conceptos concepto = new Conceptos();
         concepto.id = int.Parse(dtConceptos.Rows[i]["id"].ToString());
         concepto.concepto = dtConceptos.Rows[i]["concepto"].ToString();
         concepto.noconcepto = int.Parse(dtConceptos.Rows[i]["noconcepto"].ToString());
         concepto.tipoconcepto = dtConceptos.Rows[i]["tipoconcepto"].ToString();
         concepto.formula = dtConceptos.Rows[i]["formula"].ToString();
         concepto.formulaexento = dtConceptos.Rows[i]["formulaexento"].ToString();
         concepto.gravado = bool.Parse(dtConceptos.Rows[i]["gravado"].ToString());
         concepto.exento = bool.Parse(dtConceptos.Rows[i]["exento"].ToString());
         concepto.gruposat = dtConceptos.Rows[i]["gruposat"].ToString();
         concepto.visible = bool.Parse(dtConceptos.Rows[i]["visible"].ToString());
         concepto.periodo = int.Parse(dtConceptos.Rows[i]["periodo"].ToString());
         lstConcepto.Add(concepto);
     }
     return lstConcepto;
 }
 public List<Conceptos> obtenerConceptoNomina(Conceptos c)
 {
     List<Conceptos> lstConcepto = new List<Conceptos>();
     DataTable dtConceptos = new DataTable();
     Command.CommandText = "select id, tipoconcepto from conceptos where noconcepto = @noconcepto and idempresa = @idempresa";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("noconcepto", c.noconcepto);
     Command.Parameters.AddWithValue("idempresa", c.idempresa);
     dtConceptos = SelectData(Command);
     for (int i = 0; i < dtConceptos.Rows.Count; i++)
     {
         Conceptos concepto = new Conceptos();
         concepto.id = int.Parse(dtConceptos.Rows[i]["id"].ToString());
         concepto.tipoconcepto = dtConceptos.Rows[i]["tipoconcepto"].ToString();
         lstConcepto.Add(concepto);
     }
     return lstConcepto;
 }
 public int insertaConcepto(Conceptos c)
 {
     Command.CommandText = "insert into conceptos (idempresa, noconcepto, concepto, tipoconcepto, formula, formulaexento, gravado, exento, gruposat, visible, periodo) " +
         "values (@idempresa, @noconcepto, @concepto, @tipoconcepto, @formula, @formulaexento, @gravado, @exento, @gruposat, @visible, @periodo)";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("idempresa",c.idempresa);
     Command.Parameters.AddWithValue("noconcepto", c.noconcepto);
     Command.Parameters.AddWithValue("concepto", c.concepto);
     Command.Parameters.AddWithValue("tipoconcepto", c.tipoconcepto);
     Command.Parameters.AddWithValue("formula",c.formula);
     Command.Parameters.AddWithValue("formulaexento", c.formulaexento);
     Command.Parameters.AddWithValue("gravado", c.gravado);
     Command.Parameters.AddWithValue("exento", c.exento);
     Command.Parameters.AddWithValue("gruposat", c.gruposat);
     Command.Parameters.AddWithValue("visible", c.visible);
     Command.Parameters.AddWithValue("periodo", c.periodo);
     return Command.ExecuteNonQuery();
 }
 public object existeNoConcepto(Conceptos c)
 {
     Command.CommandText = "select count(*) from conceptos where idempresa = @idempresa and noconcepto = @noconcepto";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("idempresa", c.idempresa);
     Command.Parameters.AddWithValue("noconcepto", c.noconcepto);
     object dato = Select(Command);
     return dato;
 }