public List<clsImpuestos> consulta() { try { List<clsImpuestos> lista = new List<clsImpuestos>(); CuentasPorPagarEntities ent = new CuentasPorPagarEntities(); var con = from w in ent.Impuesto select w; foreach (var item in con) { clsImpuestos clas = new clsImpuestos(); clas.IdImpuesto = item.IdImpuesto; clas.Descripcion = item.Descripcion; clas.FechaRegistro = item.FechaRegistro; clas.IdEstado = item.Estado; clas.naturAcree = item.NatureAcree; clas.Porcentaje = item.Porcentaje; clas.IdUsuario = item.IdUsuario; clas.IdEmpresa = item.IdEmpresa; lista.Add(clas); } return lista; } catch (Exception) { return null; } }
public clsImpuestos CalcularImp(int indice) { using (CuentasPorPagarEntities ent = new CuentasPorPagarEntities()) { var x = (from q in ent.Impuesto where q.IdImpuesto == indice select q).First(); clsImpuestos impues = new clsImpuestos(); impues.Porcentaje = x.Porcentaje; return impues; } }
public Boolean Eliminar(clsImpuestos Imp) { try { using (CuentasPorPagarEntities ent = new CuentasPorPagarEntities()) { var x = (from q in ent.Impuesto where q.IdImpuesto == Imp.IdImpuesto select q).First(); ent.DeleteObject(x); ent.SaveChanges(); } return true; } catch (Exception ex) { return false; } }
public Boolean Guardar(clsImpuestos Imp) { try { int id = getIdSiguiente(); using (CuentasPorPagarEntities ent = new CuentasPorPagarEntities()) { Impuesto impu = new Impuesto() { IdImpuesto = id, Descripcion = Imp.Descripcion, FechaRegistro = DateTime.Today, // Medio.FechaRegistro, Estado = Imp.IdEstado, NatureAcree = Imp.naturAcree, IdEmpresa = Imp.IdEmpresa, IdUsuario = Imp.IdUsuario, }; ent.AddToImpuesto(impu); ent.SaveChanges(); } return true; } catch (Exception ex) { return false; } }
public void Modificar(clsImpuestos Imp) { using (CuentasPorPagarEntities ent = new CuentasPorPagarEntities()) { var x = (from q in ent.Impuesto where q.IdImpuesto == Imp.IdImpuesto select q).First(); x.Descripcion = Imp.Descripcion; x.FechaRegistro = Imp.FechaRegistro; x.Estado = Imp.IdEstado; x.NatureAcree = Imp.naturAcree; x.IdEmpresa = Imp.IdEmpresa; x.IdUsuario = Imp.IdUsuario; ent.SaveChanges(); } }