Example #1
0
        private bool SaveData()
        {
            if (PersonnelDetailDS != null)
            {
                if (PersonnelDetailDS.HasChanges() == false)
                {
                    return(true);
                }

                // Validation of application
                PersonValidate(PersonnelDetailDS);

                //Peronnel Data Table
                i9Message responseMsg = i9MessageManager.SendMessage(MobileMessageType.Admin, AdminType.SysPer_PersonSave, "PersonnelPage", PersonnelDetailDS);
                if (responseMsg.ErrorStatus.IsError)
                {
                    LogManager.Instance.LogMessage(responseMsg.ErrorStatus);
                    MessageBox.Show("Unable to save personnel detail, please try again.", "Personnel", MessageBoxButton.OK, MessageBoxImage.Information);
                    return(false);
                }
                else
                {
                    PersonnelDetailDS.AcceptChanges();
                }


                UpdatePersonnelGrid();
            }
            return(true);
        }
Example #2
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if (AgencyComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select an Agency.", "Personnel", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            ComboBoxItem SelectCbi  = (ComboBoxItem)AgencyComboBox.SelectedItem;
            string       i9AgencyID = SelectCbi.Tag.ToString();

            //string TestAgencyID = AgencyComboBox.SelectedValue.ToString();
            i9Message responseMsg = i9MessageManager.SendMessage(MobileMessageType.Admin, AdminType.SysPer_PersonAdd, "PersonnelPage", typeof(string), i9AgencyID);

            if (responseMsg.ErrorStatus.IsError)
            {
                LogManager.Instance.LogMessage(responseMsg.ErrorStatus);
                MessageBox.Show("Unable to add a personnel, please try again.", "Personnel", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            else
            {
                RefreshPersonnel();
            }
        }
Example #3
0
        private void LoadPersonnelDetailData(string PersonnelID)
        {
            i9Message RequestMessage = new i9Message();

            RequestMessage.MsgBody           = PersonnelID;
            RequestMessage.ToBizLayer        = MobileMessageType.Admin;
            RequestMessage.ToBizLayerMsgType = AdminType.SysPer_PersonGet;

            i9Message responseMsg = i9MessageManager.SendMessage(RequestMessage);

            if (responseMsg.ErrorStatus.IsError)
            {
                LogManager.Instance.LogMessage(responseMsg.ErrorStatus);
                MessageBox.Show("Unable to get peronnel, please try again.", "Personnel", MessageBoxButton.OK, MessageBoxImage.Information);

                this.DataContext = null;
                return;
            }

            if (responseMsg.HasTables())
            {
                PersonnelDetailDS = responseMsg.MsgBodyDataSet;
                this.DataContext  = PersonnelDetailDS.Tables["i9SysPersonnel"].DefaultView;
            }
            else
            {
                this.DataContext = null;
            }
        }
Example #4
0
        /// <summary>
        /// Process Mobile Message
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <returns></returns>
        public i9Message ProcessMobileMessage(i9Message requestMessage)
        {
            i9Message responseMessage = new i9Message();

            switch (requestMessage.ToBizLayerMsgType)
            {
            case SecurityType.Security_PersonnelGroupsGet:
                responseMessage = Security_GetPersonnelGroups(requestMessage);
                break;

            case SecurityType.Security_PersonnelGroupsSave:
                responseMessage = Security_SavePersonnelGroups(requestMessage);
                break;

            case SecurityType.Security_SecurityGroupsGet:
                responseMessage = Security_GetSecurityGroups(requestMessage);
                break;

            case SecurityType.Security_SecurityGroupSave:
                responseMessage = Security_SaveGroupItems(requestMessage);
                break;

            case SecurityType.Security_PersonnelGroupTaskGet:
                responseMessage = Security_PersonnelGroupTaskGet(requestMessage);
                break;

            default:
                responseMessage.ErrorStatus.IsError  = true;
                responseMessage.ErrorStatus.ErrorMsg = "Unknown Message Type(" + DateTime.Now.ToString() + "): " + requestMessage.ToBizLayerMsgType;
                ServiceLogManager.LogThis("Unkown message type in the Security business layer :  " + requestMessage.ToBizLayerMsgType, LogEventType.Info, "", "");
                break;
            }
            return(responseMessage);
        }
Example #5
0
        private i9Message Security_GetSecurityGroups(i9Message requestMessage)
        {
            i9Message response = new i9Message();
            SQLAccess da       = new SQLAccess();
            string    SQL      = " Select * FROM i9SecurityGroup order by SecurityGroupName ASC" + Environment.NewLine +
                                 " Select * FROM i9Agency order by AgencyName " + Environment.NewLine +
                                 " Select * FROM i9Module order by Section ASC, ModuleName ASC " + Environment.NewLine +
                                 " Select * FROM i9SecurityTask Order By TaskName ASC " + Environment.NewLine +
                                 " Select * FROM i9SecurityGroupModule " + Environment.NewLine +
                                 " Select * FROM i9SecurityGroupTask ";

            Dictionary <string, string> tableMapping = new Dictionary <string, string>()
            {
                { "Table", "i9SecurityGroup" },
                { "Table1", "i9Agency" },
                { "Table2", "i9Module" },
                { "Table3", "i9SecurityTask" },
                { "Table4", "i9SecurityGroupModule" },
                { "Table5", "i9SecurityGroupTask" },
            };

            DataSet ds = da.GetDataSet(SQL, tableMapping);

            response.MsgBodyDataSet = ds;

            return(response);
        }
Example #6
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (PersonnelListView.SelectedValue == null)
            {
                return;
            }

            DataRowView SelectedDrv = (DataRowView)PersonnelListView.SelectedItem;
            string      PersonnelID = SelectedDrv["i9SysPersonnelID"].ToString();

            i9Message RequestMessage = new i9Message();

            RequestMessage.MsgBody           = PersonnelID;
            RequestMessage.ToBizLayer        = MobileMessageType.Admin;
            RequestMessage.ToBizLayerMsgType = AdminType.SysPer_PersonDelete;

            i9Message responseMsg = i9MessageManager.SendMessage(RequestMessage);

            if (responseMsg.ErrorStatus.IsError)
            {
                LogManager.Instance.LogMessage(responseMsg.ErrorStatus);
                MessageBox.Show("Unable to delete peronnel, please try again.", "Personnel", MessageBoxButton.OK, MessageBoxImage.Information);

                this.DataContext = null;
                return;
            }

            RefreshPersonnel();
        }
Example #7
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (AgencyListDS != null)
            {
                if (AgencyListDS.HasChanges() == false)
                {
                    return;
                }

                // Validation of application
                //Validate(AgencyListDS);


                //Peronnel Data Table
                i9Message responseMsg = i9MessageManager.SendMessage(MobileMessageType.Agency, AgencyType.Agency_Save, "AgencyPage", AgencyListDS);
                if (responseMsg.ErrorStatus.IsError)
                {
                    LogManager.Instance.LogMessage(responseMsg.ErrorStatus);
                    MessageBox.Show("Unable to save agency information, please try again.", "Agency", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                else
                {
                    AgencyListDS.AcceptChanges();
                }
            }
            return;
        }
Example #8
0
        public i9Message ProcessMobileMessage(i9Message mMessage)
        {
            i9Message response = new i9Message();

            response.ErrorStatus.SetError(true, "un-processed message", new Exception());
            return(response);
        }
Example #9
0
        /// <summary>
        /// Get Next Table Key from Main Database.
        /// </summary>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public i9Message NextTableKey(i9Message requestMessage)
        {
            string TableName = requestMessage.MsgBody;
            //int KeyValue = 0;
            i9Message response = new i9Message();

            SQLAccess cda = new SQLAccess();
            string    sql = @" BEGIN TRAN T1 " +
                            " SELECT * FROM i9TableKey WHERE TableName = " + SQLUtility.SQLString(TableName) + " " + Environment.NewLine +
                            "  Update i9TableKey Set KeyValue = KeyValue + 1  WHERE TableName = " + SQLUtility.SQLString(TableName) + " " + Environment.NewLine +
                            " COMMIT TRAN T1 ";
            DataSet ds = cda.GetDataSet(sql, "i9TableKey");

            if (ds != null)
            {
                //if (ds.Tables.Count > 0)
                //    if (ds.Tables[0].Rows.Count > 0)
                //        KeyValue = Convert.ToInt32(ds.Tables["i9TableKey"].Rows[0]["KeyValue"].ToString());
                response.MsgBodyDataSet = ds;
                return(response);
            }
            else
            {
                throw new Exception("Unable to get the next table key for: " + TableName);
            }
        }
Example #10
0
        private i9Message PersonnelSave(i9Message requestMessage)
        {
            i9Message ResponseMessage = new i9Message();

            try
            {
                if (requestMessage.MsgBodyDataSet != null)
                {
                    if (requestMessage.MsgBodyDataSet.Tables.Count > 0)
                    {
                        SQLAccess da = new SQLAccess();

                        //TODO:  Need to wrap this in a transaction

                        da.SaveDataTable(requestMessage.MsgBodyDataSet.Tables["i9SysPersonnel"]);
                        da.SaveDataTable(requestMessage.MsgBodyDataSet.Tables["i9SysPersonnelAddress"]);
                        da.SaveDataTable(requestMessage.MsgBodyDataSet.Tables["i9SysPersonnelAssignment"]);
                        da.SaveDataTable(requestMessage.MsgBodyDataSet.Tables["i9SysPersonnelPhone"]);

                        ResponseMessage.ErrorStatus.IsError = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceLogManager.LogThis("Error saving dataset", LogEventType.Error, ex, "", "");
                ResponseMessage.ErrorStatus.IsError  = true;
                ResponseMessage.ErrorStatus.ErrorMsg = ex.Message;
            }

            return(ResponseMessage);
        }
Example #11
0
        /// <summary>
        /// CodeGetCodeListAdmin
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <returns></returns>
        private i9Message CodeGetCodeListAdmin(i9Message requestMessage)
        {
            //-------------------------------------------------------------------
            //Testing
            //SELECT CodeName, CodeValue  FROM i9Code group by CodeName, CodeValue having count (*) > 1 order by CodeName
            //-------------------------------------------------------------------

            i9Message response = new i9Message();
            SQLAccess da       = new SQLAccess();
            string    SQL      = //" Select * FROM i9Code order by CodeSetName "+ Environment.NewLine +
                                 " Select CodeSetName, i9AgencyID FROM i9Code Group By CodeSetName, i9AgencyID order by CodeSetName " + Environment.NewLine +
                                 " Select * from i9Agency order by AgencyName ";

            Dictionary <string, string> tableMapping = new Dictionary <string, string>()
            {
                //{"Table", "i9Code"},
                { "Table", "i9Code" },
                { "Table1", "i9Agency" },
            };

            DataSet ds = da.GetDataSet(SQL, tableMapping);

            response.MsgBodyDataSet = ds;

            return(response);
        }
Example #12
0
        private static i9Message SendMessageAsync(i9Message MobileMsg)
        {
            i9Message ReturnMessage = new i9Message();

            try
            {
                //Security Information to the Message.
                MobileMsg.MessageSecurity.MachineName      = Environment.MachineName;
                MobileMsg.MessageSecurity.MachineUserName  = Environment.UserName;
                MobileMsg.MessageSecurity.IPAddress        = "???";
                MobileMsg.MessageSecurity.LoginPersonnelID = ""; // SettingManager.Instance.LoginPersonnelID;
                MobileMsg.MessageSecurity.AgencyID         = ""; // SettingManager.Instance.AgencyID;

                string TextMsg          = MobileMsg.XMLSerializeMessage();
                string ReturnXMLMessage = "";

                Ii9MessageManager oIi9MessageManager = new InvertService.BusinessLib.i9MessageManagerBLL();
                ReturnXMLMessage = oIi9MessageManager.ProcessMobileMessage(TextMsg);

                ReturnMessage = (i9Message)i9Message.XMLDeserializeMessage(typeof(i9Message), ReturnXMLMessage);
            }
            catch (Exception ex)
            {
                ReturnMessage.ErrorStatus.IsError  = true;
                ReturnMessage.ErrorStatus.ErrorMsg = "Error: " + ex.GetBaseException().Message + Environment.NewLine + "  StackTrace:  " + ex.GetBaseException().StackTrace;
                //LogManager.Instance.LogMessage("Error in the MessageManager.SendMessage", ex);
                ServiceLogManager.LogThis("", LogEventType.Error, ex, "", "");
            }

            return(ReturnMessage);
        }
Example #13
0
        /// <summary>
        /// Process Mobile Message
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <returns></returns>
        public i9Message ProcessMobileMessage(i9Message requestMessage)
        {
            i9Message responseMessage = new i9Message();

            switch (requestMessage.ToBizLayerMsgType)
            {
            case AgencyType.Agency_GetList:
                responseMessage = GetList(requestMessage);
                break;

            case AgencyType.Agency_Delete:
                responseMessage = DeleteAgency(requestMessage);
                break;

            case AgencyType.Agency_GetDetail:
                responseMessage = GetDetail(requestMessage);
                break;

            case AgencyType.Agency_Save:
                responseMessage = AgencySave(requestMessage);
                break;

            default:
                responseMessage.ErrorStatus.IsError  = true;
                responseMessage.ErrorStatus.ErrorMsg = "Unknown Message Type(" + DateTime.Now.ToString() + "): " + requestMessage.ToBizLayerMsgType;
                ServiceLogManager.LogThis("Unkown message type in the Agency business layer :  " + requestMessage.ToBizLayerMsgType, LogEventType.Info, "", "");
                break;
            }

            return(responseMessage);
        }
Example #14
0
        private i9Message GetEntireTable(i9Message RequestMessage)
        {
            string TableName = RequestMessage.MsgBody;

            i9Message response    = new i9Message();
            string    sql         = "SELECT * FROM " + TableName;
            string    personnelID = RequestMessage.MessageSecurity.LoginPersonnelID;

            switch (TableName.ToUpper())
            {
            case "i9SysPersonnel":
                //Leave out the password from the result set.
                sql = "SELECT BadgeNumber, i9SysPersonnelID, FirstName, LastName, MiddleName, OfficerORI, Officer FROM i9SysPersonnel";
                break;

            //case "i9SecurityGroupTask":
            //    sql = "SELECT * FROM i9SecurityGroupTask WHERE i9SysPersonnelID = " + SQLUtility.SQLString(personnelID);
            //    break;

            //case "i9SecurityGroupModule":
            //    sql = "SELECT * FROM i9SecurityGroupModule WHERE i9SysPersonnelID = " + SQLUtility.SQLString(personnelID);
            //    break;

            default:
                sql = "SELECT * FROM " + TableName;
                break;
            }

            DataSet ss = new SQLAccess().GetDataSet(sql, TableName);

            response.MsgBodyDataSet = ss;
            return(response);
        }
Example #15
0
        private i9Message SaveIncident(i9Message mMessage)
        {
            i9Message     response = new i9Message();
            DataSet       ds       = mMessage.MsgBodyDataSet;
            StringBuilder sbSQL    = new StringBuilder();

            SQLGenerator SqlGen = new SQLGenerator();

            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Event"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9LawIncident"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9CADServiceCall"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Offense"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Person"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Vehicle"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Location"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Property"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9VehicleRecovery"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9VehicleTowed"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Narrative"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9PersonAKA"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9PersonSMT"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9AttachmentLink"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9Attachment"]));
            sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9AttachmentData"]));

            SQLAccess sqla = new SQLAccess();
            string    SQL  = SQLUtility.WrapInTransaction(sbSQL.ToString());

            sqla.ExecuteSQL(SQL);

            return(response);
        }
Example #16
0
        protected void LoginButton_Click(Object sender, EventArgs e)
        {
            LoginMessage LoginMsg = new LoginMessage();

            LoginMsg.UserName = this.UserName.Text;
            LoginMsg.Password = Password.Text;

            //i9MessageManager.mIi9MessageManager = new InvertService.BusinessLib.i9MessageManagerBLL();
            i9Message responseMsg = i9MessageManagerBLL.SendMessage(MobileMessageType.Admin, AdminType.Login, "LoginPage", LoginMsg.GetType(), LoginMsg);

            if (responseMsg.ErrorStatus.IsError)
            {
                FailureText.Text = responseMsg.ErrorStatus.ErrorMsg;
                return;
            }

            if (responseMsg.MsgBodyDataSet.Tables[0].Rows.Count <= 0)
            {
                FailureText.Text = "Wrong user name or password, please try again.";

                return;
            }

            //Go To Main Window
            Session.Add("Login", "true");
            Session.Add("Badge", responseMsg.MsgBodyDataSet.Tables["i9SysPersonnel"].Rows[0]["BadgeNumber"].ToString());
            Session.Add("LoginDataSet", responseMsg.MsgBodyDataSet);

            Response.Redirect("~/");
        }
Example #17
0
        private void LoadData()
        {
            if (DynamicEntryControlsListBox.Items.Count > 0)
            {
                return;
            }

            //i9DynamicEntry
            DynamicEntryControlsListBox.Items.Clear();

            i9Message ReturnMsg = i9MessageManager.SendMessage(MobileMessageType.Admin, AdminType.DynamicEntry_GetDynamicEntryAdmin, "DynamicEntryAdminPage");

            if (ReturnMsg.ErrorStatus.IsError)
            {
                LogManager.Instance.LogMessage("DynamicEntryAdminPage", "LoadData", "Error:  " + ReturnMsg.ErrorStatus.ErrorMsg);
            }
            else
            {
                this.DynamicEntryDS = ReturnMsg.MsgBodyDataSet;
                foreach (DataRow dr in this.DynamicEntryDS.Tables["i9DynamicEntry"].Rows)
                {
                    ListBoxItem lbi = new ListBoxItem();
                    lbi.Content = dr["ModuleSection"].ToString();
                    DynamicEntryControlsListBox.Items.Add(lbi);
                }
            }
        }
Example #18
0
        public int NextServerTableKey(string TableName)
        {
            int KeyValue = 0;

            i9Message responseMsg = i9MessageManager.SendMessage(MobileMessageType.Admin, AdminType.Utility_NextServerTableKey, this.GetType().Name, typeof(string), TableName);

            if (responseMsg.ErrorStatus.IsError)
            {
                throw new Exception("Unable to get the next Server table key for: " + TableName);
            }
            else
            {
                DataSet ds = responseMsg.MsgBodyDataSet;
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            KeyValue = Convert.ToInt32(ds.Tables[0].Rows[0]["KeyValue"].ToString());
                        }
                    }

                    return(KeyValue);
                }
                else
                {
                    throw new Exception("Unable to get the next table key for: " + TableName);
                }
            }
        }
Example #19
0
        private void LoadCodeDetailData(string CodeSetName)
        {
            i9Message RequestMessage = new i9Message();

            RequestMessage.MsgBody           = CodeSetName;
            RequestMessage.ToBizLayer        = MobileMessageType.Admin;
            RequestMessage.ToBizLayerMsgType = AdminType.Code_GetCodeDetail_Admin;

            i9Message responseMsg = i9MessageManager.SendMessage(RequestMessage);

            if (responseMsg.ErrorStatus.IsError)
            {
                LogManager.Instance.LogMessage(responseMsg.ErrorStatus);
                //AppCommand.SendCommand(AppCommandType.Error, AppSubCommandType.DisplayError, "");
                MessageBox.Show("Unable to get codes, please try again.", "Codes", MessageBoxButton.OK, MessageBoxImage.Information);

                this.DataContext = null;
                return;
            }

            if (responseMsg.HasTables())
            {
                CodeDetailDataTable = responseMsg.MsgBodyDataSet.Tables[0];
                this.DataContext    = CodeDetailDataTable.DefaultView;
            }
            else
            {
                this.DataContext = null;
            }
        }
Example #20
0
        private i9Message AgencySave(i9Message requestMessage)
        {
            i9Message ResponseMessage = new i9Message();

            try
            {
                if (requestMessage.MsgBodyDataSet != null)
                {
                    if (requestMessage.MsgBodyDataSet.Tables.Count > 0)
                    {
                        SQLAccess da = new SQLAccess();
                        da.SaveDataTable(requestMessage.MsgBodyDataSet.Tables["i9Agency"]);
                        ResponseMessage.ErrorStatus.IsError = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceLogManager.LogThis("Error saving dataset", LogEventType.Error, ex, "", "");
                ResponseMessage.ErrorStatus.IsError  = true;
                ResponseMessage.ErrorStatus.ErrorMsg = ex.Message;
            }

            return(ResponseMessage);
        }
Example #21
0
        private void SaveData()
        {
            if (this.DynamicEntryDS.HasChanges() == false)
            {
                ErrorMsgLabel.Content = "No changes to save";
                return;
            }

            //********************************************************************************
            // Save i9DynamicEntryConfig:
            //********************************************************************************
            i9Message ReturnMsg = i9MessageManager.SendMessage(MobileMessageType.Admin, AdminType.DynamicEntry_SaveDynamicEntryAdmin, "DynamicEntryAdminPage", this.DynamicEntryDS);

            if (ReturnMsg.ErrorStatus.IsError)
            {
                //Display error message to user.
                ErrorMsgLabel.Content = "Error Saving data." + ReturnMsg.ErrorStatus.ErrorMsg;
                //ErrorMsgLabel.Foreground = Brush.

                //Log error message to user.
                LogManager.Instance.LogMessage("DynamicEntryAdminPage", "SaveData", "Error:  " + ReturnMsg.ErrorStatus.ErrorMsg);
                return;
            }
            else
            {
                this.DynamicEntryDS.AcceptChanges();
                ErrorMsgLabel.Content = "Changes to saved";
            }
        }
Example #22
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 #23
0
        private i9Message Security_SaveGroupItems(i9Message requestMessage)
        {
            i9Message ResponseMessage = new i9Message();

            try
            {
                if (requestMessage.MsgBodyDataSet != null)
                {
                    if (requestMessage.MsgBodyDataSet.Tables.Count > 0)
                    {
                        StringBuilder sbSQL  = new StringBuilder();
                        SQLGenerator  SqlGen = new SQLGenerator();
                        DataSet       ds     = requestMessage.MsgBodyDataSet;

                        sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9SecurityGroup"]));
                        sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9SecurityGroupModule"]));
                        sbSQL.Append(SqlGen.DataTableSQL(ds.Tables["i9SecurityGroupTask"]));

                        SQLAccess sqla = new SQLAccess();
                        string    SQL  = SQLUtility.WrapInTransaction(sbSQL.ToString());
                        sqla.ExecuteSQL(SQL);

                        ResponseMessage.ErrorStatus.IsError = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceLogManager.LogThis("Error saving dataset", LogEventType.Error, ex, "", "");
                ResponseMessage.ErrorStatus.IsError  = true;
                ResponseMessage.ErrorStatus.ErrorMsg = ex.Message;
            }

            return(ResponseMessage);
        }
Example #24
0
        private i9Message SaveDynamicEntryAdmin(i9Message mRequestMessage)
        {
            SQLAccess da       = new SQLAccess();
            i9Message response = new i9Message();

            da.SaveDataTable(mRequestMessage.MsgBodyDataSet.Tables["i9DynamicEntryConfig"]);

            return(response);
        }
Example #25
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //Set the UI to read only
            Messagelabel.Content     = "";
            OKButton.IsEnabled       = false;
            CancelButton.IsEnabled   = true;
            SettingsButton.IsEnabled = false;

            //send message
            LoginMessage LoginMsg = new LoginMessage();

            LoginMsg.UserName = this.UserNameTextBox.Text;
            LoginMsg.Password = PasswordTextBox.Password;

            i9Message responseMsg = i9MessageManager.SendMessage(MobileMessageType.Admin, AdminType.Login, "LoginPage", LoginMsg.GetType(), LoginMsg);

            if (responseMsg.ErrorStatus.IsError)
            {
                Messagelabel.Content = responseMsg.ErrorStatus.ErrorMsg +
                                       Environment.NewLine + responseMsg.ErrorStatus.ErrorException +
                                       Environment.NewLine + DateTime.Now.ToString();

                OKButton.IsEnabled       = true;
                CancelButton.IsEnabled   = true;
                SettingsButton.IsEnabled = true;

                return;
            }

            if (responseMsg.MsgBodyDataSet == null || responseMsg.MsgBodyDataSet.Tables[0].Rows.Count <= 0)
            {
                Messagelabel.Content = "Wrong user name or password, please try again.";

                OKButton.IsEnabled       = true;
                CancelButton.IsEnabled   = true;
                SettingsButton.IsEnabled = true;

                return;
            }

            //Save Login Information
            SettingManager.Instance.LoginDataSet = responseMsg.MsgBodyDataSet;

            MainWindow.mMainWindow.StatusBarItemUserName = "******" + UserNameTextBox.Text;
            MainWindow.mMainWindow.StatusBarItemMessage  = "";

            if (LaunchMobileTerminalCheckBox.IsChecked == false || LaunchMobileTerminalCheckBox.IsChecked == null)
            {
                ModuleManager.Instance.NavigateTo(this, "SplashPage");
                //ModuleManager.Instance.NavigateTo(this, "MainMenuPage");
            }
            else
            {
                ModuleManager.Instance.NavigateTo(this, "MobileTerminalPage");
            }
        }
Example #26
0
        public static i9Message SendMessage(string ToBizLayer, string ToBizLayerMsgType, string From)
        {
            i9Message MobileMsg = new i9Message();

            MobileMsg.ToBizLayer        = ToBizLayer;
            MobileMsg.ToBizLayerMsgType = ToBizLayerMsgType;
            MobileMsg.From = From;

            return(SendMessage(MobileMsg));
        }
Example #27
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 #28
0
        public static i9Message SendMessage(string ToBizLayer, string ToBizLayerMsgType, string From, DataSet MsgDataSet)
        {
            i9Message MobileMsg = new i9Message();

            MobileMsg.ToBizLayer        = ToBizLayer;
            MobileMsg.ToBizLayerMsgType = ToBizLayerMsgType;
            MobileMsg.From           = From;
            MobileMsg.MsgBodyDataSet = MsgDataSet;

            return(SendMessage(MobileMsg));
        }
Example #29
0
        private i9Message SearchIncident(i9Message mMessage)
        {
            i9Message response = new i9Message();
            SQLAccess da       = new SQLAccess();

            string SQLIncident = " SELECT i.i9LawIncidentID, i.i9EventID, i.IncidentNumber, i.SupplementNumber, i.StatusCode, i.IncidentReportDate, i.ORI, 'N3,V1,P4', a.AgencyName " +
                                 " FROM i9LawIncident i join i9Agency a on i.i9AgencyID = a.i9AgencyID   ";

            response.MsgBodyDataSet = da.GetDataSet(SQLIncident, "i9LawIncident");
            return(response);
        }
Example #30
0
        private i9Message DeleteAgency(i9Message requestMessage)
        {
            string    AgencyID = requestMessage.MsgBody.ToString();
            i9Message response = new i9Message();
            SQLAccess da       = new SQLAccess();
            string    SQL      = "DELETE FROM i9Agency WHERE i9AgencyID = " + SQLUtility.SQLString(AgencyID) + " ";

            int UpdatedRows = da.ExecuteSQL(SQL);

            response.MsgBody = UpdatedRows.ToString();

            return(response);
        }