public DataTable GetData(DConceptos entiti) { DataTable dt = null; using (SqlConnection conect = RConexion.Getconectar()) { conect.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conect; cmd.CommandText = "SP_SHOW_CONCEPTOS"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@idmes", entiti.Id_mes); cmd.Parameters.AddWithValue("@idplanilla", entiti.Id_planilla); SqlDataReader reader = cmd.ExecuteReader(); using (dt = new DataTable()) { dt.Load(reader); reader.Close(); } } } return(dt); }
//METODO PARA ADD, UPDATE public string SaveChanges() { string message; using (DConceptos dcon = new DConceptos()) { try { dcon.Id_conceptos = Id_conceptos; dcon.Id_mes = Id_mes; dcon.Id_planilla = Id_planilla; dcon.HextraDiurna = HextraDiurna; dcon.HextraNocturna = HextraNocturna; dcon.FeriadoDomi = FeriadoDomi; dcon.BoniNoctur = BoniNoctur; dcon.PrimeroMayo = PrimeroMayo; dcon.Tarda = Tarda; dcon.Subsidi = Subsidi; dcon.Thoraex = Thoraex; dcon.Otroreinte = Otroreinte; dcon.Prest_aliment = Prest_aliment; dcon.Gratif = Gratif; dcon.Vaca = Vaca; dcon.Trunca = Trunca; dcon.Reinte_gratiboni = Reinte_gratiboni; dcon.Essa_vida = Essa_vida; dcon.Adela = Adela; dcon.Presta = Presta; dcon.Rentquinta = Rentquinta; dcon.Reten_judici = Reten_judici; dcon.Otrodescu = Otrodescu; dcon.Recarg_consu = Recarg_consu; switch (State) { case EntityState.Guardar: rconcep.SaveAddUpdate(dcon); message = "¡Guardado!"; break; default: message = "Error in Transaction!"; break; } } catch (Exception ex) { message = ex.Message; } finally { } } return(message); }
public int SaveAddUpdate(DConceptos entiti) { result = 0; using (SqlConnection conect = RConexion.Getconectar()) { conect.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conect; cmd.CommandText = "SP_RegistroConceptos"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id_conceptos", entiti.Id_conceptos); cmd.Parameters.AddWithValue("@id_mes", entiti.Id_mes); cmd.Parameters.AddWithValue("@id_planilla", entiti.Id_planilla); cmd.Parameters.AddWithValue("@hextraDiurna", entiti.HextraDiurna); cmd.Parameters.AddWithValue("@hextraNocturna", entiti.HextraNocturna); cmd.Parameters.AddWithValue("@feriadoDomi", entiti.FeriadoDomi); cmd.Parameters.AddWithValue("@boniNocturna", entiti.BoniNoctur); cmd.Parameters.AddWithValue("@primeromayo", entiti.PrimeroMayo); cmd.Parameters.AddWithValue("@tarda", entiti.Tarda); cmd.Parameters.AddWithValue("@subsi", entiti.Subsidi); cmd.Parameters.AddWithValue("@thoraex", entiti.Thoraex); cmd.Parameters.AddWithValue("@otroreinte", entiti.Otroreinte); cmd.Parameters.AddWithValue("@prest_aliment", entiti.Prest_aliment); cmd.Parameters.AddWithValue("@gratif", entiti.Gratif); cmd.Parameters.AddWithValue("@vaca", entiti.Vaca); cmd.Parameters.AddWithValue("@truncas", entiti.Trunca); cmd.Parameters.AddWithValue("@reinte_gratiboni", entiti.Reinte_gratiboni); cmd.Parameters.AddWithValue("@essa_vida", entiti.Essa_vida); cmd.Parameters.AddWithValue("@adela", entiti.Adela); cmd.Parameters.AddWithValue("@presta", entiti.Presta); cmd.Parameters.AddWithValue("@rentquinta", entiti.Rentquinta); cmd.Parameters.AddWithValue("@reten_judici", entiti.Reten_judici); cmd.Parameters.AddWithValue("@otrodescu", entiti.Otrodescu); cmd.Parameters.AddWithValue("@recarg_consu", entiti.Recarg_consu); result = cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); } } return(result); }
//METODO MOSTRAR public List <NConceptos> Getall() { DConceptos d = new DConceptos(); d.Id_mes = Id_mes; d.Id_planilla = Id_planilla; using (DataTable dt = rconcep.GetData(d)) { lista_concepto = new List <NConceptos>(); foreach (DataRow item in dt.Rows) { lista_concepto.Add(new NConceptos() { Id_conceptos = Convert.ToInt32(item[0]), HextraDiurna = Convert.ToBoolean(item[1]), HextraNocturna = Convert.ToBoolean(item[2]), FeriadoDomi = Convert.ToBoolean(item[3]), BoniNoctur = Convert.ToBoolean(item[4]), PrimeroMayo = Convert.ToBoolean(item[5]), Tarda = Convert.ToBoolean(item[6]), Subsidi = Convert.ToBoolean(item[7]), Thoraex = Convert.ToBoolean(item[8]), Otroreinte = Convert.ToBoolean(item[9]), Prest_aliment = Convert.ToBoolean(item[10]), Gratif = Convert.ToBoolean(item[11]), Vaca = Convert.ToBoolean(item[12]), Trunca = Convert.ToBoolean(item[13]), Reinte_gratiboni = Convert.ToBoolean(item[14]), Essa_vida = Convert.ToBoolean(item[15]), Adela = Convert.ToBoolean(item[16]), Presta = Convert.ToBoolean(item[17]), Rentquinta = Convert.ToBoolean(item[18]), Reten_judici = Convert.ToBoolean(item[19]), Otrodescu = Convert.ToBoolean(item[20]), Recarg_consu = Convert.ToBoolean(item[21]) }); } } return(lista_concepto); }
public static async Task <(string rpta, int id_concepto)> InsertarConcepto(Conceptos concepto) { DConceptos DConceptos = new DConceptos(); return(await DConceptos.InsertarConcepto(concepto)); }
public static async Task <(DataTable dtConceptos, string rpta)> BuscarConceptos(string tipo_busqueda, string texto_busqueda) { DConceptos DConceptos = new DConceptos(); return(await DConceptos.BuscarConceptos(tipo_busqueda, texto_busqueda)); }
public static async Task <string> EditarConcepto(int id_concepto, Conceptos concepto) { DConceptos DConceptos = new DConceptos(); return(await DConceptos.EditarConcepto(id_concepto, concepto)); }