private void KhoiTaoTapL1() { List <int> listMaHoa = new List <int>(); foreach (var mh in Program.listMahoa) { listMaHoa.Add(mh.maHoa); //Console.WriteLine("So ma hoa: "+mh.maHoa); } model.TapL tapl = new model.TapL(); tapl.Lable = "Tập L1"; List <string> tempList = new List <string>(); int dem = 0; foreach (int number in listMaHoa) { tempList.Add(number.ToString()); dem = list.Where(temp => temp.Equals(number)) .Select(temp => temp) .Count(); tapl.Add(new List <string>(tempList), dem); tempList.Clear(); dem = 0; } Program.listTapL.Add(tapl); TapLToListView(tapl); }
private void TapF_To_TapL(List <string> listSTR) { List <string> tempSTR = new List <string>(); List <string> tempList = new List <string>(); model.TapL tapl = new model.TapL(); tapl.Lable = "Tập L" + ((k + 2).ToString()); tempSTR.AddRange(listSTR.Distinct()); tempSTR.Sort(); int count = 0; foreach (string findValue in tempSTR) { count = listSTR.Where(temp => temp.Equals(findValue)) .Select(temp => temp) .Count(); //Console.WriteLine("Find Value: "+findValue+" : "+count); if ((count * 100) / SoUngVien >= Program.minSup) { tempList.Add(findValue); tapl.Add(new List <string>(tempList), count); tempList.Clear(); } } Program.listTapL.Add(tapl); TapLToListView(tapl); listToTapL.Clear(); }
private void TapF_To_TapL(List <string> listSTR) { List <string> tempSTR = new List <string>(); bool checkLNull = true; model.TapL tapl = new model.TapL(); tapl.Lable = "Tập L" + ((k + 2).ToString()); tempSTR.AddRange(listSTR.Distinct()); tempSTR.Sort(); int count = 0; foreach (string findValue in tempSTR) { count = listSTR.Where(temp => temp.Equals(findValue)) .Select(temp => temp) .Count(); //Console.WriteLine("Find Value: "+findValue+" : "+count); if ((count * 100) / SoUngVien >= Program.minSup) { checkLNull = false; tapl.Add(findValue, count); } } if (checkLNull == true) { MessageBox.Show("Thuật toán kết thúc!"); Form3 frm = new Form3(k); frm.ShowDialog(); k--; return; } Program.listTapL.Add(tapl); TapLToListView(tapl); listToTapL.Clear(); }