Ejemplo n.º 1
0
        private int InsertDataPhach1(int?id)
        {
            var       listDanhSachThi = db.DanhSachThis.Where(m => m.IdKyThi == id).ToList();
            DataTable table           = new DataTable();

            table.Columns.Add("SoPhach", typeof(string));
            table.Columns.Add("IdDanhSachThi", typeof(double));
            table.Columns.Add("IdKyThi", typeof(int));
            string[] arrCode = proLogic.GenBeatcodeWithQuantity(listDanhSachThi.Count, 5);
            for (int i = 0; i < arrCode.Length; i++)
            {
                table.Rows.Add(arrCode[i].ToString(), Convert.ToDouble(listDanhSachThi[i].IdDanhSachThi), id);
            }
            //copy du lieu
            CopyDataByBulk(table);
            //var countPhach = db.DanhSachPhachs.Where(m => m.IdKyThi == id).Select(m => m.SoPhach).Distinct().ToList().Count;
            var countPhach = table.Rows.Count;

            return(countPhach);
        }