public static string set_HistoryModel(string noidung, LoginHistoryModel itemnew)
 {
     string ketqua = "";
     ketqua = noidung + itemnew.hoatdong + "*" + itemnew.date + "*" + itemnew.location + "*" + itemnew.Ipaddress + "#";
     return ketqua;
 }
        public void createnew_LoginHistory(string ten, int iduser)
        {
            LoginHistoryModel model1 = new LoginHistoryModel ();
            model1.hoatdong = ten;
            model1.date = Utilities.GetDate_Timezone() + " " + Utilities.GetClientTimeOffset()+":00";

            model1.Ipaddress=GetIPAddress();
            model1.location = GetLocation(model1.Ipaddress);
            EntityUser user = db.EntityUsers.Where(g=>g.Id== iduser).FirstOrDefault();
            string lichsu = user.Login_History;
            string ketqua = LoginHistoryModel.set_HistoryModel(lichsu, model1);
            user.Login_History = ketqua;
            db.SubmitChanges();
        }
 public static List<LoginHistoryModel> get_HistoryModel(string noidung)
 {
     List<LoginHistoryModel> ketqua=new List<LoginHistoryModel> ();
     if (noidung == "" || noidung==null)
         return ketqua;
     string [] mang = noidung.Split('#');
     for (int i = 0; i < mang.Length - 1; i++)
     {
         string[] item = mang[i].Split('*');
         if (item.Length == 4)
         {
             LoginHistoryModel l = new LoginHistoryModel();
             l.hoatdong = item[0];
             l.date = item[1];
             l.location = item[2];
             l.Ipaddress = item[3];
             ketqua.Add(l);
         }
     }
         return ketqua;
 }