public List <NotificationsObjects> GetByUserID2(Guid UserID2)
        {
            var da = new eTrainingScheduleEntities().sp_tbl_Notifications_GetByUserID2(UserID2);
            List <NotificationsObjects> lis = new List <NotificationsObjects>();

            foreach (var item in da)
            {
                NotificationsObjects obj = new NotificationsObjects();
                obj.notificationsID = item.notificationsID;
                obj.UserId          = item.UserId;
                obj.Account1        = new AccountObject
                {
                    FullName = item.FullNameUser1
                };
                obj.title    = item.title;
                obj.Content  = item.Content;
                obj.status   = item.status;
                obj.UserId2  = item.UserId2;
                obj.Account1 = new AccountObject
                {
                    FullName = item.FullNameUser1
                };
                obj.StartDate = item.StartDate;
                obj.Isdeleted = item.Isdeleted;

                lis.Add(obj);
            }
            return(lis);
        }
        public NotificationsObjects GetByID(Guid ID)
        {
            NotificationsObjects obj = new NotificationsObjects();
            var da = new eTrainingScheduleEntities().sp_tbl_Notifications_GetByID(ID);

            foreach (var item in da)
            {
                obj.notificationsID = item.notificationsID;
                obj.UserId          = item.UserId;
                obj.UserId2         = item.UserId2;
                obj.Account1        = new AccountObject
                {
                    FullName = item.FullNameUser1
                };
                obj.title    = item.title;
                obj.Content  = item.Content;
                obj.status   = item.status;
                obj.Account2 = new AccountObject
                {
                    FullName = item.FullNameUser2
                };
                obj.StartDate = item.StartDate;
                obj.Isdeleted = item.Isdeleted;
            }
            return(obj);
        }
        public ActionResult Create_main(NotificationsObjects obj)
        {
            obj.notificationsID = Guid.NewGuid();
            obj.StartDate       = DateTime.Now;
            obj.Isdeleted       = false;
            obj.status          = false;
            var accout = new Models.Login().GetAccount();

            obj.UserId = accout.UserId;
            string        title   = "Thông báo";
            string        content = obj.Content;
            AccountObject obj1    = new AccountBCL().GetByUserId(obj.UserId2.GetValueOrDefault());
            string        email   = obj1.Email;
            //string email = "*****@*****.**";
            string bcc = "[email protected],[email protected],[email protected]";

            new SMTPHelper().sendMail(content, email, bcc, title);

            var b = new NotificationsBCL().INSERT(obj);

            if (b)
            {
                return(RedirectToAction("NotificationIndex", "NotificationsManage"));
            }
            else
            {
                ModelState.AddModelError("", "them moi that bai");
            }
            return(View());
        }
        public bool UPDATE(NotificationsObjects obj)
        {
            var da = new eTrainingScheduleEntities().sp_tbl_Notifications_UPDATE(obj.notificationsID, obj.UserId, obj.title,
                                                                                 obj.Content, obj.status, obj.UserId2, obj.StartDate, obj.Isdeleted
                                                                                 );

            return(true);
        }
 public bool UPDATE(NotificationsObjects obj)
 {
     return(new NotificationsDao().UPDATE(obj));
 }
 public bool INSERT(NotificationsObjects obj)
 {
     return(new NotificationsDao().INSERT(obj));
 }