private List <string> obtenerPeriodos() { try { List <string> per = new List <string>(); PeriodosController controller = new PeriodosController(); List <PeriodosModel> periodos = controller.ConnectGET(); foreach (PeriodosModel temp in periodos) { per.Add(temp.FechaInicial.ToShortDateString() + " - " + temp.FechaFinal.ToShortDateString()); } return(per); } catch (Exception ex) { throw ex; } }
public string obtenerPeriodosModificar() { try { StringBuilder sb = new StringBuilder(); PeriodosController controller = new PeriodosController(); List <PeriodosModel> periodos = controller.ConnectGET(); foreach (PeriodosModel item in periodos) { string periodo = item.FechaInicial.ToShortDateString() + " - " + item.FechaFinal.ToShortDateString(); sb.Append(string.Format("'{0}':'{1}',", item.Numero, periodo)); } return("{" + sb.ToString() + "}"); } catch (Exception ex) { throw ex; } }
private string obtenerUnPeriodo(string id) { try { PeriodosController controller = new PeriodosController(); List <PeriodosModel> periodos = controller.ConnectGET(); foreach (PeriodosModel item in periodos) { if (item.Numero.Equals(id)) { return(item.FechaInicial.ToShortDateString() + " - " + item.FechaFinal.ToShortDateString()); } } return("Sin Nombre"); } catch (Exception ex) { throw ex; } }