private List <SelectListItem> GetLeaveType() { MTSHRDataLayer.Leave data = new MTSHRDataLayer.Leave(); List <SelectListItem> leavetype = new List <SelectListItem>(); try { DataTable leavenamelist = data.ReadLeavePolicy(); leavetype.Add(new SelectListItem() { Value = "", Text = "---- Select Leave type----" }); for (int i = 0; i < leavenamelist.Rows.Count; i++) { leavetype.Add(new SelectListItem() { Value = leavenamelist.Rows[i]["LEAVE_CODE"].ToString(), Text = leavenamelist.Rows[i]["LEAVE_TYPE"].ToString() }); } } catch (Exception exec) { BaseExceptionHandler.HandleException(ref exec); } return(leavetype); }
public ActionResult ReadLeavePolicy() { MTSHRDataLayer.Leave data = new MTSHRDataLayer.Leave(); var result = JsonConvert.SerializeObject(data.ReadLeavePolicy()); return(Json(result, JsonRequestBehavior.AllowGet)); }