public void Insert(GVCN gv) { StreamWriter sw = File.AppendText(filetxt); sw.WriteLine(); sw.Write(gv.Magv + "#" + gv.Tengv + "#" + gv.Diachi + "#" + gv.Sdtgv); sw.Close(); }
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 "); } }
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); }
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 "); } }