private async void NotificationGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (NotificationGridView.CurrentRow?.DataBoundItem is NotificationModel currentNumber)
            {
                if (!currentNumber.IsRead)
                {
                    await Task.Run(() =>
                    {
                        currentNumber.IsRead = _notificationService.UpdateReadNotification(currentNumber.Id);
                        Principal?.UpdatedUnreadNotification();
                    });

                    NotificationGridView.Refresh();
                }

                if (currentNumber.IsSuccess || (currentNumber.Message?.ToLower().Contains(ApplicationConstant.NotificationError) ?? false))
                {
                    DownloadWeightBtn.Enabled = true;
                    if (currentNumber.Message?.ToLower().Contains(ApplicationConstant.NotificationError) ?? false)
                    {
                        DownloadWeightBtn.Text = "Download Log";
                    }
                    else
                    {
                        DownloadWeightBtn.Text = "Download Model";
                    }
                }
                else
                {
                    DownloadWeightBtn.Enabled = false;
                }
            }
        }
        private async void NotificationGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
        {
            if (NotificationGridView.CurrentRow?.DataBoundItem is NotificationModel currentNumber)
            {
                if (!currentNumber.IsRead)
                {
                    await Task.Run(() =>
                    {
                        currentNumber.IsRead = _notificationService.UpdateReadNotification(currentNumber.Id);
                        Principal?.UpdatedUnreadNotification();
                    });

                    NotificationGridView.Refresh();
                }
            }
        }
예제 #3
0
 protected void NotificationSave_Click(object sender, EventArgs e)
 {
     try
     {
         db.Configuration.LazyLoadingEnabled = false;
         var Notification_Ids = NotificationGridView.GetSelectedFieldValues("Notification_Show_Id");
         db.Database.ExecuteSqlCommand("Delete Notification_Employee where Employee_Id = " + EmployeeId);
         for (int i = 0; i < Notification_Ids.Count; i++)
         {
             Notification_Employee Notif_Empl = db.Notification_Employee.Create();
             Notif_Empl.Employee_Id         = EmployeeId;
             Notif_Empl.NotificationShow_Id = int.Parse(Notification_Ids[i].ToString());
             db.Notification_Employee.Add(Notif_Empl);
         }
         db.SaveChanges();
         Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "HideTheModel(); notify('top', 'right', 'fa fa-check', 'success', 'animated fadeInRight', 'animated fadeOutRight','  Save Status : ','  The Update Notification was Sucessfully saved in system ! ');", true);
         /* Add it to log file */
         LogData = "data:" + JsonConvert.SerializeObject(Notification_Ids, logFileModule.settings);
         logFileModule.logfile(10, "تعديل تنبيهات موظف", "update Notification Employee", LogData);
     }
     catch { }
 }