コード例 #1
0
ファイル: Common.cs プロジェクト: changtraicantinh/testfsoft
 /// <summary>
 /// Write log
 /// </summary>
 /// <param name="content">Log content</param>
 public static void WriteLog(string content)
 {
     using (QLNHEntities db = new QLNHEntities())
     {
         db.LogErrors.Add(new LogError()
         {
             Content = content,
             Created = DateTime.Now
         });
         db.SaveChanges();
     }
 }
コード例 #2
0
ファイル: Common.cs プロジェクト: changtraicantinh/testfsoft
        /// <summary>
        /// Ghi log he thong
        /// </summary>
        /// <param name="ChucNang">Chuc nang</param>
        /// <param name="HanhDong">Hanh Dong</param>
        /// <param name="DoiTuong">Doi tuong</param>
        /// <param name="NoiDung">Noi dung</param>
        /// <returns></returns>
        public static bool NhatKiHeThong(string ChucNang, string HanhDong, string DoiTuong, string NoiDung)
        {
            bool status  = true ;
            try
            {
                using (var db = new QLNHEntities())
                {
                    var adminId = (int)HttpContext.Current.Session["admss"];
                    var adminEmail = (string)HttpContext.Current.Session["admssemail"];
                    var nhatki = new ANhatKyHeThong();
                    nhatki.NguoiDung = (string)HttpContext.Current.Session["admssemail"];
                    nhatki.ThoiGian  = DateTime.Now;
                    nhatki.ChucNang = ChucNang;
                    nhatki.HanhDong = HanhDong;
                    nhatki.DoiTuong = DoiTuong;
                    nhatki.NoiDung = NoiDung;
                    db.ANhatKyHeThongs.Add(nhatki);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                WriteLog(ex.Message + "\n" + ex.StackTrace);
                status = false;
            }

            return status;
        }