public static ADM_DAL.dsDropDownList.ModeloVehiculoLoadDropDownDataTable getModelosVehiculoDataTable(string claseId, string marcaId) { decimal d_claseId; decimal d_marcaId; ADM_DAL.dsDropDownList.ModeloVehiculoLoadDropDownDataTable dataTable = null; if (decimal.TryParse(claseId, out d_claseId)) { if (decimal.TryParse(marcaId, out d_marcaId)) { ModeloVehiculoLoadDropDownTableAdapter taa = new ModeloVehiculoLoadDropDownTableAdapter(); dataTable = taa.GetData(d_claseId, d_marcaId); } else { throw new System.FormatException("No se puede convertir el String Clase a un valor decimal"); } } else { throw new System.FormatException("No se puede convertir el String Clase a un valor decimal"); } return dataTable; }
public static OptionItem[] getModelosVehiculo(string claseId, string marcaId) { decimal d_claseId; decimal d_marcaId; ArrayList items = new ArrayList(); OptionItem FirsItem = new OptionItem(); FirsItem.text = "[ - Elija - ]"; FirsItem.value = "-1"; items.Add(FirsItem); if (decimal.TryParse(claseId, out d_claseId)) { if (decimal.TryParse(marcaId, out d_marcaId)) { ModeloVehiculoLoadDropDownTableAdapter taa = new ModeloVehiculoLoadDropDownTableAdapter(); try { ADM_DAL.dsDropDownList.ModeloVehiculoLoadDropDownDataTable dataTable = taa.GetData(d_claseId, d_marcaId); if (dataTable.Rows.Count > 0) { foreach (ADM_DAL.dsDropDownList.ModeloVehiculoLoadDropDownRow item in dataTable) { OptionItem aItem = new OptionItem(); aItem.text = item.modeloVehiculo; aItem.value = item.modeloVehiculoId.ToString(); items.Add(aItem); } } } catch (Exception ex) { LoggerFacade.LogException(ex); } } } return (OptionItem[])items.ToArray(Type.GetType("OptionItem")); }