public List <deptModels> getListDepts() { List <deptModels> depts = new List <deptModels>(); string query = string.Format("" + "SELECT IdDEpt," + "NamaDept " + "FROM mDept " + "ORDER BY NamaDept"); DataTable dt = new DataTable(); dbAccess.strConn = conn; dt = dbAccess.GetDataTable(query); foreach (DataRow row in dt.Rows) { depts.Add( new deptModels { IdDept = Convert.ToString(row["IdDept"]), NamaDept = Convert.ToString(row["NamaDept"]) }); } return(depts); }
//=========================> Action <========================= public List <MasterAction> GetListActions() { List <MasterAction> Result = new List <MasterAction>(); string Query = @"SELECT * FROM tbl_action WHERE ActionID <> '0' ORDER BY ActionID"; DataTable dt = new DataTable(); dbAccess.strConn = conn; dt = dbAccess.GetDataTable(Query); foreach (DataRow dr in dt.Rows) { Result.Add( new MasterAction { ActionID = Convert.ToString(dr["ActionID"]), Name = Convert.ToString(dr["Name"]), Description = Convert.ToString(dr["Description"]) }); } return(Result); }