private void find(LinkListStudent L)
        {
            int             id = Convert.ToInt32(txtID.Text);
            LinkListStudent p  = L;

            while (p != null)
            {
                if (p.ID == id)
                {
                    lbLastName.Text = p.lastName;
                    lbName.Text     = p.name;
                    //if (p.sex == true)
                    //{
                    //    lbSex.Text = "Nam";
                    //}
                    //else
                    //{
                    //    lbSex.Text = "Nữ";
                    //}
                    lbSex.Text = p.sex;
                    string date = string.Format("{0:dd/MM/yyyy}", p.birthDate);
                    lbBirthDate.Text = date;
                    lbType.Text      = p.type.ToString();
                    break;
                }
                else
                {
                    p = p.Next;
                }
            }
            if (p == null)
            {
                MessageBox.Show("Error,please check input", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
            }
        }
        public int count(LinkListFullInfo F, int type)
        {
            Console.OutputEncoding = Encoding.Unicode;
            LinkListStudent S = new LinkListStudent();

            S.loadListStudent(S);
            LinkListScore L = new LinkListScore();

            L.loadListScore(L);
            DateTime temp = DateTime.Now;
            int      typeset, dut;
            DateTime birthdate;
            string   rank = null;
            int      count = 0;
            double   mathScore, literatureScore, englishScore, totalScore, minScore;

            while (S != null && L != null)
            {
                typeset         = S.type;
                mathScore       = L.mathScore;
                literatureScore = L.literatureScore;
                englishScore    = L.englishScore;
                minScore        = scoreMin(L.mathScore, L.literatureScore, L.englishScore);
                if (S.type == 1)
                {
                    dut = 2;
                }
                else if (S.type == 2)
                {
                    dut = 1;
                }
                else
                {
                    dut = 3;
                }
                totalScore = L.mathScore + L.literatureScore + L.englishScore + dut;
                birthdate  = S.birthDate;
                if (mathScore == 0 || literatureScore == 0 || englishScore == 0)
                {
                    S = S.Next;
                    L = L.Next;
                    continue;
                }
                if (totalScore < 15 || minScore < 4)
                {
                    rank = "Trượt";
                    if (typeset == type)
                    {
                        count++;
                    }
                }


                S = S.Next;
                L = L.Next;
            }
            return(count);
        }
Beispiel #3
0
 public Boolean addStudent1(LinkListStudent p, int ID, string lastName, string name, string sex, DateTime birthDate, int type)
 {
     p.ID        = ID;
     p.lastName  = lastName;
     p.name      = name;
     p.sex       = sex;
     p.birthDate = birthDate;
     p.type      = type;
     return(true);
 }
        public LinkListFullInfo setStGioi(LinkListFullInfo F)
        {
            Console.OutputEncoding = Encoding.Unicode;
            LinkListStudent S = new LinkListStudent();

            S.loadListStudent(S);
            LinkListScore L = new LinkListScore();

            L.loadListScore(L);
            DateTime temp = DateTime.Now;
            int      ID, type, dut;
            DateTime birthdate;
            string   sex;
            string   lastName, name, rank = null;
            double   mathScore, literatureScore, englishScore, totalScore, minScore;

            while (S != null && L != null)
            {
                LinkListFullInfo p = new LinkListFullInfo();
                ID              = S.ID;
                lastName        = S.lastName;
                name            = S.name;
                sex             = S.sex;
                type            = S.type;
                mathScore       = L.mathScore;
                literatureScore = L.literatureScore;
                englishScore    = L.englishScore;
                minScore        = scoreMin(L.mathScore, L.literatureScore, L.englishScore);
                if (S.type == 1)
                {
                    dut = 2;
                }
                else if (S.type == 2)
                {
                    dut = 1;
                }
                else
                {
                    dut = 3;
                }
                totalScore = L.mathScore + L.literatureScore + L.englishScore + dut;
                birthdate  = S.birthDate;
                if (totalScore >= 24 && minScore >= 7)
                {
                    rank = "Giỏi";

                    addFullInfo(p, ID, lastName, name, sex, birthdate, mathScore, literatureScore, englishScore, minScore, totalScore, rank, type);
                    addFull(ref F, p);
                }
                S = S.Next;
                L = L.Next;
            }
            return(F);
        }
Beispiel #5
0
        public List <string> changest(LinkListStudent F)
        {
            List <string>   lines = new List <string>();
            LinkListStudent p     = F;
            string          date  = string.Format("{0:dd/MM/yyyy}", p.birthDate);

            while (p != null)
            {
                lines.Add(tabst(p.ID.ToString(), 3) + tabst(p.lastName, 15) + tabst(p.name, 10) + tabst(p.sex, 3) + tabst(date, 12) + p.type);
                p = p.Next;
            }
            return(lines);
        }
Beispiel #6
0
 public void addst(ref LinkListStudent L, LinkListStudent p)
 {
     if (L == null)
     {
         L = p;
     }
     else
     {
         LinkListStudent q = L;
         while (q.Next != null)
         {
             q = q.Next;
         }
         q.Next = p;
     }
 }
        private void FrmDelete_Load(object sender, EventArgs e)
        {
            LinkListStudent temp = new LinkListStudent();

            F = temp.loadListStudent(F);
            LinkListScore tempsc = new LinkListScore();

            sc     = tempsc.loadListScore(sc);
            datas  = F.changest(F);
            datas1 = sc.changesc(sc);
            foreach (string s in datas)
            {
                txtShowStudent.Text = string.Join(Environment.NewLine, datas);
            }
            foreach (string s in datas1)
            {
                txtShowScore.Text = string.Join(Environment.NewLine, datas1);
            }
        }
Beispiel #8
0
        public Boolean addStudent(LinkListStudent p, int ID, string lastName, string name, int sex, DateTime birthDate, int type)
        {
            p.ID       = ID;
            p.lastName = lastName;
            p.name     = name;
            string gender = String.Empty;

            if (sex == 1)
            {
                gender = "Nữ";
            }
            else
            {
                gender = "Nam";
            }
            p.sex       = gender;
            p.birthDate = birthDate;
            p.type      = type;
            return(true);
        }
        private static List <string> Change(LinkListStudent s, LinkListScore sc)
        {
            List <string>   lines = new List <string>();
            LinkListScore   p     = sc;
            LinkListStudent k     = s;

            while (p != null && k != null)
            {
                if (p.mathScore == 0 && p.literatureScore == 0 && p.englishScore == 0)
                {
                    k = k.Next;
                    continue;
                }
                string date = string.Format("{0:dd/MM/yyyy}", k.birthDate);
                lines.Add(Tab(p.id.ToString(), 3) + Tab(k.lastName, 15) + Tab(k.name, 10) + Tab(k.sex, 3) + Tab(date, 12) + Tab(p.mathScore.ToString(), 2) + Tab(p.literatureScore.ToString(), 2) + Tab(p.englishScore.ToString(), 2));
                p = p.Next;
                k = k.Next;
            }
            return(lines);
        }
Beispiel #10
0
        public LinkListStudent loadListStudent(LinkListStudent L)
        {
            List <string> lines = File.ReadAllLines("DanhSach.txt").ToList();
            List <string> datas = new List <string>();

            int      ID, type;
            string   lastName, name;
            DateTime birthDate;
            string   re;
            int      flag;

            for (int i = 0; i < lines.Count; i++)
            {
                if (i >= 12)
                {
                    datas.Add(lines[i]);
                }
            }

            foreach (var data in datas)
            {
                //Ghi nho cai nay
                LinkListStudent p = new LinkListStudent();
                ID       = Convert.ToInt32(data.Substring(0, 11));
                lastName = data.Substring(11, 15);
                name     = data.Substring(26, 7);
                re       = data.Substring(34, 2);
                flag     = Convert.ToInt32(re);
                //char[] date = data.Substring(35, 10).ToCharArray();
                string date = data.Substring(35, 10);

                birthDate = DateTime.Parse(date);
                //student.birthDate = entries[i + 6];
                type = Convert.ToInt32(data.Substring(46, 1));
                addStudent(p, ID, lastName, name, flag, birthDate, type);
                addst(ref L, p);
                //students.Add(student);
            }
            return(L);
        }
        private void BtnInput_Click(object sender, EventArgs e)
        {
            id_delete = Convert.ToInt32(txtInput.Text);
            LinkListStudent temp = new LinkListStudent();

            F = temp.loadListStudent(F);
            LinkListScore tempsc = new LinkListScore();

            sc     = tempsc.loadListScore(sc);
            F      = Deletestudent(F, id_delete);
            sc     = Deletescore(sc, id_delete);
            datas  = F.changest(F);
            datas1 = sc.changesc(sc);
            foreach (string s in datas)
            {
                txtShowStudent.Text = string.Join(Environment.NewLine, datas);
            }
            foreach (string s in datas1)
            {
                txtShowScore.Text = string.Join(Environment.NewLine, datas1);
            }
        }
        private LinkListStudent Deletestudent(LinkListStudent st, int ID)
        {
            LinkListStudent L    = null;
            LinkListStudent temp = new LinkListStudent();

            while (st != null && st.ID < ID)
            {
                LinkListStudent k = new LinkListStudent {
                    ID = st.ID, name = st.name, lastName = st.lastName, sex = st.sex, birthDate = st.birthDate, type = st.type
                };
                temp.addst(ref L, k);
                st = st.Next;
            }
            temp = st.Next;
            while (temp != null)
            {
                LinkListStudent k = new LinkListStudent {
                    ID = (temp.ID) - 1, name = temp.name, lastName = temp.lastName, sex = temp.sex, birthDate = temp.birthDate, type = temp.type
                };
                temp.addst(ref L, k);
                temp = temp.Next;
            }
            return(L);
        }
Beispiel #13
0
 public LinkListStudent()
 {
     ID       = type = 0;
     lastName = name = String.Empty;
     Next     = null;
 }
        private void BtnAddFront_Click(object sender, EventArgs e)
        {
            LinkListStudent temp = new LinkListStudent();

            F = temp.loadListStudent(F);
            LinkListStudent p          = new LinkListStudent();
            int             ID         = Convert.ToInt32(txtID.Text);
            string          lastName   = txtLastName.Text;
            string          name       = txtName.Text;
            string          sex        = txtSex.Text;
            int             type       = Convert.ToInt32(txtType.Text);
            DateTime        birthDate1 = dateTimePicker1.Value;

            LinkListStudent L = null;

            while (F != null && F.ID < ID)
            {
                LinkListStudent k = new LinkListStudent {
                    ID = F.ID, name = F.name, lastName = F.lastName, sex = F.sex, birthDate = F.birthDate, type = F.type
                };
                temp.addst(ref L, k);
                F = F.Next;
            }
            //temp.addst(ref L, F);
            temp.addStudent1(p, ID, lastName, name, sex, birthDate1, type);
            temp.addst(ref L, p);
            while (F != null)
            {
                LinkListStudent k = new LinkListStudent {
                    ID = F.ID + 1, name = F.name, lastName = F.lastName, sex = F.sex, birthDate = F.birthDate, type = F.type
                };
                temp.addst(ref L, k);
                F = F.Next;
            }

            LinkListScore tempsc = new LinkListScore();

            sc = tempsc.loadListScore(sc);
            LinkListScore P               = new LinkListScore();
            int           id              = Convert.ToInt32(txtID.Text);
            double        mathScore       = Convert.ToDouble(txtMathScore.Text);
            double        literatureScore = Convert.ToDouble(txtLiteratureScore.Text);
            double        englishScore    = Convert.ToDouble(txtEnglishScore.Text);
            LinkListScore Lsc             = null;

            while (sc != null && sc.id < id)
            {
                LinkListScore k = new LinkListScore {
                    id = sc.id, mathScore = sc.mathScore, literatureScore = sc.literatureScore, englishScore = sc.englishScore
                };
                sc.addS(ref Lsc, k);
                sc = sc.Next;
            }
            //temp.addst(ref L, F);
            sc.addScore(P, id, mathScore, literatureScore, englishScore);
            sc.addS(ref Lsc, P);
            while (sc != null)
            {
                LinkListScore k = new LinkListScore {
                    id = (sc.id) + 1, mathScore = sc.mathScore, literatureScore = sc.literatureScore, englishScore = sc.englishScore
                };
                sc.addS(ref Lsc, k);
                sc = sc.Next;
            }
            datas = Change(L, Lsc);
            foreach (string s in datas)
            {
                txtShow.Text = string.Join(Environment.NewLine, datas);
            }
        }
 private void FrmStudent_Load(object sender, EventArgs e)
 {
     L = load(L);
 }
        public LinkListFullInfo loadStudentType(LinkListFullInfo F, int type)
        {
            Console.OutputEncoding = Encoding.Unicode;
            LinkListStudent S = new LinkListStudent();

            S.loadListStudent(S);
            LinkListScore L = new LinkListScore();

            L.loadListScore(L);
            DateTime temp = DateTime.Now;
            int      ID, type1, dut;
            string   sex;
            string   lastName, name, rank = null;
            DateTime birthdate;
            double   mathScore, literatureScore, englishScore, totalScore, minScore;

            while (S != null && L != null)
            {
                if (S.type != type)
                {
                    S = S.Next;
                    L = L.Next;
                    continue;
                }
                else
                {
                    LinkListFullInfo p = new LinkListFullInfo();
                    ID              = S.ID;
                    lastName        = S.lastName;
                    name            = S.name;
                    sex             = S.sex;
                    type1           = S.type;
                    mathScore       = L.mathScore;
                    literatureScore = L.literatureScore;
                    englishScore    = L.englishScore;
                    minScore        = scoreMin(L.mathScore, L.literatureScore, L.englishScore);

                    if (S.type == 1)
                    {
                        dut = 2;
                    }
                    else if (S.type == 2)
                    {
                        dut = 1;
                    }
                    else
                    {
                        dut = 3;
                    }
                    birthdate  = S.birthDate;
                    totalScore = L.mathScore + L.literatureScore + L.englishScore + dut;
                    if (totalScore >= 24 && minScore >= 7)
                    {
                        rank = "Giỏi";
                    }
                    if (totalScore >= 21 && totalScore < 24)
                    {
                        if (minScore >= 6)
                        {
                            rank = "Khá";
                        }
                    }
                    if (totalScore >= 15 && totalScore < 21)
                    {
                        if (minScore >= 4)
                        {
                            rank = "Trung Bình";
                        }
                    }
                    if (totalScore < 15 || totalScore < 15 && minScore < 4 || minScore < 4)
                    {
                        rank = "Trượt";
                    }
                    addFullInfo(p, ID, lastName, name, sex, birthdate, mathScore, literatureScore, englishScore, minScore, totalScore, rank, type);
                    addFull(ref F, p);
                }
                S = S.Next;
                L = L.Next;
            }
            return(F);
        }