public static List <SelectListItem> GetPositionRate(int?defaultValue, int?type) { List <SelectListItem> list = new List <SelectListItem>(); var data = new PositionRateRepository().GetPositionRate(type); foreach (var item in data) { SelectListItem select = new SelectListItem(); select.Value = item.MpID.ToString(); select.Text = " (" + (type.ToString() == "1" ? item.MpID.ToString().PadLeft(3, '0') : item.MpID.ToString().PadLeft(4, '0')) + ") " + item.PoName; select.Selected = defaultValue.HasValue ? (item.MpID == defaultValue ? true : false) : false; list.Add(select); } return(list); }
public static List <SelectListItem> GetSectionManPower(int?type, int?divid, int?depid, int?defaultValue) { List <SelectListItem> list = new List <SelectListItem>(); var data = new PositionRateRepository().GetSectionManPower(type, divid, depid); foreach (var item in data) { SelectListItem select = new SelectListItem(); select.Value = item.SecID.ToString(); select.Text = item.SecName; select.Selected = defaultValue.HasValue ? (item.SecID == defaultValue ? true : false) : false; list.Add(select); } return(list); }