void IncidentEntry_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_LawIncidentType != null)
                return;

            ClearReportViewer();

            m_LawIncidentType = new LawIncidentType();

            if (String.IsNullOrEmpty(i9EventID))
            {
                i9Message responseMsg = i9MessageManager.SendMessage(MobileMessageType.Incident, LawType.Incident_New, "incidentEntry");
                if (responseMsg.ErrorStatus.IsError)
                {
                    MessageBox.Show("Error creating a new incident.");
                    return;
                }
                else
                {
                    m_LawIncidentType.oDataSet = responseMsg.MsgBodyDataSet;
                }
            }
            else
            {
                i9Message Msg = new i9Message();
                Msg.ToBizLayer = MobileMessageType.Incident;
                Msg.ToBizLayerMsgType = LawType.Incident_Edit;
                Msg.From = "IncidentEntry";

                LawIncidentMessage incidentMsg = new LawIncidentMessage();
                incidentMsg.i9EventID = i9EventID;
                Msg.MsgBody = i9Message.XMLSerializeMessage(incidentMsg.GetType(), incidentMsg);  

                i9Message responseMsg = i9MessageManager.SendMessage(Msg);
                if (responseMsg.ErrorStatus.IsError)
                {
                    MessageBox.Show("Error opening the incident record.");
                    return;
                }
                else
                {
                    m_LawIncidentType.oDataSet = responseMsg.MsgBodyDataSet;
                }
            }

            DataBindIncident(); 
        }
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Delete Law Incident Report?", "Delete?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.No) != MessageBoxResult.Yes)
            {
                //don't delete report
                return;
            }

            //Send a message to the server to delete the report:
            i9Message Msg = new i9Message();
            Msg.ToBizLayer = MobileMessageType.Incident;
            Msg.ToBizLayerMsgType = LawType.Incident_Delete;
            Msg.From = "IncidentEntry";

            LawIncidentMessage incidentMsg = new LawIncidentMessage();
            incidentMsg.i9EventID = i9EventID;
            Msg.MsgBody = i9Message.XMLSerializeMessage(incidentMsg.GetType(), incidentMsg);

            i9Message responseMsg = i9MessageManager.SendMessage(Msg);
            if (responseMsg.ErrorStatus.IsError)
            {
                MessageBox.Show("Error deleting law incident");
                return;
            }
            else
            {
                if (CloseIncident != null)
                    CloseIncident(this.i9EventID, this.i9Guid);
            }
        }
Example #3
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (SearchResultsDataTable == null)
                return;

            if (IncidentListView.SelectedItems.Count <= 0)
                return;

            DataRowView selectedStockObject = IncidentListView.SelectedItems[0] as DataRowView;
            if (selectedStockObject == null)
            {
                //don't delete incident report
                return;
            }

            DataRow dr = selectedStockObject.Row;
            string i9EventID = dr["i9EventID"].ToString();

            if (MessageBox.Show("Delete Law Incident Report?", "Delete?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.No) != MessageBoxResult.Yes)
            {
                //don't delete report
                return;
            }

            //Send a message to the server to delete the report:
            i9Message Msg = new i9Message();
            Msg.ToBizLayer = MobileMessageType.Incident;
            Msg.ToBizLayerMsgType = LawType.Incident_Delete;
            Msg.From = "IncidentEntry";

            LawIncidentMessage incidentMsg = new LawIncidentMessage();
            incidentMsg.i9EventID = i9EventID;
            Msg.MsgBody = i9Message.XMLSerializeMessage(incidentMsg.GetType(), incidentMsg);

            i9Message responseMsg = i9MessageManager.SendMessage(Msg);
            if (responseMsg.ErrorStatus.IsError)
            {
                MessageBox.Show("Error deleting law incident");
                return;
            }
            else
            {
                ICollectionView cv = CollectionViewSource.GetDefaultView(SearchResultsDataTable);
                SearchResultsDataTable.DefaultView.Delete(cv.CurrentPosition);
            }
        }