Пример #1
0
        public void Insert(GVCN gv)
        {
            StreamWriter sw = File.AppendText(filetxt);

            sw.WriteLine();
            sw.Write(gv.Magv + "#" + gv.Tengv + "#" + gv.Diachi + "#" + gv.Sdtgv);
            sw.Close();
        }
Пример #2
0
 public void Themgv(GVCN gv)
 {
     if (gv.Magv != "" && gv.Tengv != "" && gv.Diachi != "" && gv.Sdtgv != "")
     {
         gv.Tengv  = QLHS.Utility.CongCu.ChuanHoaXau(gv.Tengv);
         gv.Diachi = QLHS.Utility.CongCu.ChuanHoaXau(gv.Diachi);
         gvDA.Insert(gv);
     }
     else
     {
         throw new Exception(" Du lieu sai ");
     }
 }
Пример #3
0
        public List <GVCN> Timgv(GVCN gv)
        {
            List <GVCN> list = gvDA.GetAllData();
            List <GVCN> kq   = new List <GVCN>();

            if (gv.Magv == null && gv.Tengv == null)
            {
                return(kq = list);
            }
            if (gv.Magv != null && gv.Tengv == null)
            {
                for (int i = 0; i < list.Count; ++i)
                {
                    if (list[i].Magv == gv.Magv)
                    {
                        kq.Add(new GVCN(list[i]));
                    }
                }
            }
            else
            {
                if (gv.Magv == null && gv.Tengv != null)
                {
                    for (int i = 0; i < list.Count; ++i)
                    {
                        if (list[i].Tengv.IndexOf(gv.Tengv) >= 0)
                        {
                            kq.Add(new GVCN(list[i]));
                        }
                    }
                }
                else
                {
                    return(kq = null);
                }
            }
            return(kq);
        }
Пример #4
0
        public void Suagv(GVCN gv)
        {
            int         i;
            List <GVCN> list = gvDA.GetAllData();

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Magv == gv.Magv)
                {
                    break;
                }
            }
            if (i < list.Count)
            {
                list.RemoveAt(i);
                list.Add(gv, i);
                gvDA.Update(list);
            }
            else
            {
                throw new Exception(" Du lieu sai ");
            }
        }