Exemplo n.º 1
0
        private void Menu_Load(object sender, EventArgs e)
        {
            hideSubMenu();
            NHANVIEN nv = Ham.tv.NHANVIENs.Where(x => x.MaNhanVien == Ham.currentUser).SingleOrDefault();

            if (nv == null)
            {
                label_MaNhanVien.Text = "Khách";
                label_HoVaTen.Text    = "Khách";
            }
            else
            {
                label_MaNhanVien.Text        = nv.MaNhanVien;
                label_HoVaTen.Text           = nv.HoVaTen;
                pictureBox_Anh.ImageLocation = nv.Anh == null? Ham.defaultNVImage : nv.Anh;
            }
            Ham.openFormInPanel(new TrangChu(), panel_Content);


            if (DateTime.Now.Day == Ham.lastDaySendReminder.Day && DateTime.Now.Month == Ham.lastDaySendReminder.Month)
            {
            }
            else
            {
                IEnumerable <MUONTRA> allMuon = Ham.tv.MUONTRAs.ToList();
                foreach (var item in allMuon)
                {
                    if ((int)(DateTime.Now - (DateTime)item.NgayHenTra).TotalDays == 7 || (int)(DateTime.Now - (DateTime)item.NgayHenTra).TotalDays == 3 || (int)(DateTime.Now - (DateTime)item.NgayHenTra).TotalDays == 1)
                    {
                        Ham.sendEmailRemindMuon(item.MaMuonTra);
                    }
                }
                var allLastestTDG = Ham.tv.THEDOCGIAs
                                    .GroupBy(x => x.MaDocGia)
                                    .Select(g => new { MaDocGia = g.Key, HanMoi = g.Max(x => x.HanMoi) })
                                    .ToList();
                foreach (var item in allLastestTDG)
                {
                    if ((int)(DateTime.Now - (DateTime)item.HanMoi).TotalDays == 7 || (int)(DateTime.Now - (DateTime)item.HanMoi).TotalDays == 3 || (int)(DateTime.Now - (DateTime)item.HanMoi).TotalDays == 1)
                    {
                        Ham.sendEmailRemindTheDocGia(item.MaDocGia);
                    }
                }
                Ham.lastDaySendReminder = DateTime.Now;
            }
        }
Exemplo n.º 2
0
 private void DangNhap_Load(object sender, EventArgs e)
 {
     Ham.sendEmailRemindTheDocGia("DG1");
 }