Beispiel #1
0
    public static void GhiQuanLy(XL_QUANLY QuanLy)
    {
        var XuLy        = new JavaScriptSerializer();
        var ChuoiLuuTru = XuLy.Serialize(QuanLy);
        var DuongDan    = $"{ThuMucQuanLy.FullName}\\{QuanLy.MaSo}.json";

        File.WriteAllText(DuongDan, ChuoiLuuTru);
    }
Beispiel #2
0
    public static List <XL_QUANLY> DocDanhSachQuanLy()
    {
        List <XL_QUANLY> DanhSachQuanLy = new List <XL_QUANLY>();

        ThuMucQuanLy.GetFiles("*.json").ToList().ForEach(TapTin =>
        {
            var DuongDan    = TapTin.FullName;
            var ChuoiLuuTru = File.ReadAllText(DuongDan);
            var XuLy        = new JavaScriptSerializer();
            var QuanLy      = new XL_QUANLY();
            QuanLy          = (XL_QUANLY)XuLy.Deserialize(ChuoiLuuTru, QuanLy.GetType());
            DanhSachQuanLy.Add(QuanLy);
        });
        return(DanhSachQuanLy);
    }