Example #1
0
        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 #2
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);
            }
        }
Example #3
0
        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();
        }
Example #4
0
        private i9Message DeleteIncident(i9Message requestMessage)
        {
            i9Message response = new i9Message();
            SQLAccess da       = new SQLAccess();

            LawIncidentMessage lim       = (LawIncidentMessage)i9Message.XMLDeserializeMessage(typeof(LawIncidentMessage), requestMessage.MsgBody);
            string             i9EventID = lim.i9EventID;

            string DeleteIncidentSql =
                " DELETE FROM i9LawIncident WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9PersonSMT WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Property WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Narrative WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9VehicleRecovery WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9VehicleTowed WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9AttachmentLink WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Attachment WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9AttachmentData WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Person WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Vehicle WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Location WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                " DELETE FROM i9Event WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine;

            //" DELETE FROM i9Offense WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
            //" DELETE FROM i9CADServiceCall WHERE i9EventID = " + SQLUtility.SQLString(i9EventID);


            //Stopwatch stopWatch = new Stopwatch();
            //stopWatch.Start();

            DeleteIncidentSql = SQLUtility.WrapInTransaction(DeleteIncidentSql);

            response.MsgBody = da.ExecuteSQL(DeleteIncidentSql).ToString();

            //stopWatch.Stop();
            //TimeSpan ts = stopWatch.Elapsed;
            //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
            //ts.Hours, ts.Minutes, ts.Seconds,
            //ts.Milliseconds / 10);
            //Console.WriteLine(elapsedTime);

            response.ErrorStatus.IsError = false;

            return(response);
        }
Example #5
0
        private i9Message EditIncident(i9Message requestMessage)
        {
            i9Message response = new i9Message();
            SQLAccess da       = new SQLAccess();

            LawIncidentMessage lim       = (LawIncidentMessage)i9Message.XMLDeserializeMessage(typeof(LawIncidentMessage), requestMessage.MsgBody);
            string             i9EventID = lim.i9EventID;

            string SQLIncident = " SELECT * FROM i9Event WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                                 " SELECT * FROM i9LawIncident WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                                 " SELECT * FROM i9Person WHERE i9ModuleSectionID = '" + i9ModuleSection.LawIncidentPerson.ToString() + "' AND i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                                 " SELECT * FROM i9Vehicle WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                                 " SELECT * FROM i9Location WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                                 " SELECT * FROM i9Property WHERE  i9EventID = " + SQLUtility.SQLString(i9EventID) + Environment.NewLine +
                                 " SELECT * FROM i9Offense WHERE  1=2 " + Environment.NewLine +
                                 " SELECT * FROM i9CADServiceCall WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9VehicleRecovery WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9VehicleTowed WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9AttachmentLink WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9Attachment WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9AttachmentData WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9Narrative WHERE i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9Person WHERE i9ModuleSectionID = '" + i9ModuleSection.LawIncidentPersonAKA.ToString() + "' AND i9EventID = " + SQLUtility.SQLString(i9EventID) +
                                 " SELECT * FROM i9PersonSMT WHERE i9EventID = " + SQLUtility.SQLString(i9EventID);

            Dictionary <string, string> tableMapping = new Dictionary <string, string>()
            {
                { "Table", "i9Event" },
                { "Table1", "i9LawIncident" },
                { "Table2", "i9Person" },
                { "Table3", "i9Vehicle" },
                { "Table4", "i9Location" },
                { "Table5", "i9Property" },
                { "Table6", "i9Offense" },
                { "Table7", "i9CADServiceCall" },
                { "Table8", "i9VehicleRecovery" },
                { "Table9", "i9VehicleTowed" },
                { "Table10", "i9AttachmentLink" },
                { "Table11", "i9Attachment" },
                { "Table12", "i9AttachmentData" },
                { "Table13", "i9Narrative" },
                { "Table14", "i9PersonAKA" },
                { "Table15", "i9PersonSMT" }
            };

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            response.MsgBodyDataSet = da.GetDataSet(SQLIncident, tableMapping);

            stopWatch.Stop();
            TimeSpan ts          = stopWatch.Elapsed;
            string   elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                 ts.Hours, ts.Minutes, ts.Seconds,
                                                 ts.Milliseconds / 10);

            Console.WriteLine(elapsedTime);

            response.MsgBodyDataSet.AcceptChanges();
            response.ErrorStatus.IsError = false;

            //===============================================================================
            //Retro fit older Events:
            //     Add i9Narrative to law incident if it does not exist
            //===============================================================================
            if (response.MsgBodyDataSet.Tables["i9Narrative"].Rows.Count <= 0)
            {
                DataRow dr = response.MsgBodyDataSet.Tables["i9Narrative"].NewRow();
                dr["i9EventID"]     = response.MsgBodyDataSet.Tables["i9Event"].Rows[0]["i9EventID"];
                dr["i9NarrativeID"] = Guid.NewGuid();
                response.MsgBodyDataSet.Tables["i9Narrative"].Rows.Add(dr);
            }

            return(response);
        }