public static List <controlPeriodos> getAllYears() { List <controlPeriodos> listcontrolPeriodos = new List <controlPeriodos>(); string cs = ConfigurationManager.ConnectionStrings["AWA_ACCOUNTINGConnectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("Select * FROM AWA_CONTROL_PERIODOS", con); SqlParameter param = new SqlParameter(); //param.ParameterName = "@CUR_ID"; //param.Value = 116; //cmd.Parameters.Add(param); //param.ParameterName = "@SUCURSAL"; //param.Value = "QTT"; //cmd.Parameters.Add(param); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { controlPeriodos controlPeriodos = new controlPeriodos(); //estudiante.RNOTC_ID = Convert.ToInt32(rdr["RNOTC_ID"]); //controlPeriodos.Row = Convert.ToInt32(rdr["Row"]); controlPeriodos.Row = Convert.ToInt32(rdr["ID"]); controlPeriodos.year = Convert.ToInt32(rdr["year"]); controlPeriodos.periodo = Convert.ToInt32(rdr["periodo"]); controlPeriodos.activo = Convert.ToBoolean(rdr["activo"]); //colaborador.textoAlterno = Convert.ToString(rdr["civil"]); //colaborador.textoAlterno = Convert.ToString(rdr["funcion"]); //colaborador.relacion = Convert.ToString(rdr["relacion"]); listcontrolPeriodos.Add(controlPeriodos); } } return(listcontrolPeriodos); }
public static List <controlPeriodos> getAllColaboradores(int ID) { List <controlPeriodos> listcontrolPeriodos = new List <controlPeriodos>(); string cs = ConfigurationManager.ConnectionStrings["AWA_ACCOUNTINGConnectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("Select ROW_NUMBER() OVER(ORDER BY year ASC) AS Row,ID, year, periodo, estado FROM AWA_CONTROL_PERIODOS ", con); SqlParameter param = new SqlParameter(); //param.ParameterName = "@CUR_ID"; //param.Value = 116; //cmd.Parameters.Add(param); //param.ParameterName = "@SUCURSAL"; param.Value = ID; cmd.Parameters.Add(param); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { controlPeriodos controlPeriodos = new controlPeriodos(); controlPeriodos.Row = Convert.ToInt32(rdr["Row"]); controlPeriodos.Row = Convert.ToInt32(rdr["ID"]); controlPeriodos.year = Convert.ToInt32(rdr["year"]); controlPeriodos.periodo = Convert.ToInt32(rdr["periodo"]); controlPeriodos.activo = Convert.ToBoolean(rdr["activo"]); listcontrolPeriodos.Add(controlPeriodos); } } return(listcontrolPeriodos); }