コード例 #1
0
        void rgNotifications_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                this.CurrentRecipients.Clear();

                // Load the selected Notification
                EF.PointGeofenceNotification notification = _ds.GetPointGeofenceNotification((int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["NotificationId"]);

                this.NotificationID = notification.NotificationId;

                var notifictionUsers = _ds.GetPointGeofenceNotificationUsers(this.NotificationID);
                // Load the Notification Users
                foreach (var u in notifictionUsers)
                {
                    this.CurrentRecipients.Add(new UserLight()
                    {
                        UserName  = u.UserName,
                        Recipient = u.Recipient,
                        TypeId    = u.TypeId
                    });
                }

                // Set the WAP
                this.WeekActivePeriod                 = new WeekActivePeriod();
                this.WeekActivePeriod.Monday          = notification.WeekActivePeriod.Monday;
                this.WeekActivePeriod.MondaySecond    = notification.WeekActivePeriod.Monday2;
                this.WeekActivePeriod.Tuesday         = notification.WeekActivePeriod.Tuesday;
                this.WeekActivePeriod.TuesdaySecond   = notification.WeekActivePeriod.Tuesday2;
                this.WeekActivePeriod.Wednesday       = notification.WeekActivePeriod.Wednesday;
                this.WeekActivePeriod.WednesdaySecond = notification.WeekActivePeriod.Wednesday2;
                this.WeekActivePeriod.Thursday        = notification.WeekActivePeriod.Thursday;
                this.WeekActivePeriod.ThursdaySecond  = notification.WeekActivePeriod.Thursday2;
                this.WeekActivePeriod.Friday          = notification.WeekActivePeriod.Friday;
                this.WeekActivePeriod.FridaySecond    = notification.WeekActivePeriod.Friday2;
                this.WeekActivePeriod.Saturday        = notification.WeekActivePeriod.Saturday;
                this.WeekActivePeriod.SaturdaySecond  = notification.WeekActivePeriod.Saturday2;
                this.WeekActivePeriod.Sunday          = notification.WeekActivePeriod.Sunday;
                this.WeekActivePeriod.SundaySecond    = notification.WeekActivePeriod.Sunday2;

                UpdateUIToWAP();
                this.rgContacts.Rebind();

                this.txtNotificationTitle.Text      = notification.Description;
                this.chkNotificationEnabled.Checked = notification.IsEnabled;
                this.chkIncoming.Checked            = notification.Incoming;
                this.chkOutgoing.Checked            = notification.Outgoing;

                this.btnAddNotification.Text = "Update Notification";
            }

            if (e.CommandName == "Delete")
            {
                this.NotificationID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["NotificationId"];
                // need to prompt to ensure.

                _ds.DeletePointGeofenceNotification(this.NotificationID);
            }
        }
コード例 #2
0
        private void UpdateNotification()
        {
            GeoManagement client = new GeoManagement();

            EF.PointGeofenceNotification notification = client.GetPointGeofenceNotification(this.NotificationID);

            notification.WeekActivePeriod.Monday     = this.WeekActivePeriod.Monday;
            notification.WeekActivePeriod.Monday2    = this.WeekActivePeriod.MondaySecond;
            notification.WeekActivePeriod.Tuesday    = this.WeekActivePeriod.Tuesday;
            notification.WeekActivePeriod.Tuesday2   = this.WeekActivePeriod.TuesdaySecond;
            notification.WeekActivePeriod.Wednesday  = this.WeekActivePeriod.Wednesday;
            notification.WeekActivePeriod.Wednesday2 = this.WeekActivePeriod.WednesdaySecond;
            notification.WeekActivePeriod.Thursday   = this.WeekActivePeriod.Thursday;
            notification.WeekActivePeriod.Thursday2  = this.WeekActivePeriod.ThursdaySecond;
            notification.WeekActivePeriod.Friday     = this.WeekActivePeriod.Friday;
            notification.WeekActivePeriod.Friday2    = this.WeekActivePeriod.FridaySecond;
            notification.WeekActivePeriod.Saturday   = this.WeekActivePeriod.Saturday;
            notification.WeekActivePeriod.Saturday2  = this.WeekActivePeriod.SaturdaySecond;
            notification.WeekActivePeriod.Sunday     = this.WeekActivePeriod.Sunday;
            notification.WeekActivePeriod.Sunday2    = this.WeekActivePeriod.SundaySecond;
            client.UpdateWeekActivePeriod(notification.WeekActivePeriod);

            client.UpdatePointGeofenceNotification(this.NotificationID, txtNotificationTitle.Text, chkNotificationEnabled.Checked, chkIncoming.Checked, chkOutgoing.Checked, CurrentRecipients);

            this.txtContactDetail.Text          = String.Empty;
            this.txtNotificationName.Text       = String.Empty;
            this.txtNotificationTitle.Text      = String.Empty;
            this.chkNotificationEnabled.Checked = false;
            this.chkOutgoing.Checked            = false;
            this.chkIncoming.Checked            = false;
            CurrentRecipients.Clear();
            rgContacts.Rebind();

            rgNotifications.Rebind();

            this.WeekActivePeriod = null;
            CLearWAP();
        }