Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #3
0
        private i9Message SaveDynamicEntryAdmin(i9Message mRequestMessage)
        {
            SQLAccess da       = new SQLAccess();
            i9Message response = new i9Message();

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

            return(response);
        }
Exemple #4
0
        private i9Message PersonnelAdd(i9Message requestMessage)
        {
            i9Message response = new i9Message();

            SQLAccess da       = new SQLAccess();
            string    BlankSQL = " Select * FROM i9SysPersonnel where 1 = 2 ";

            Dictionary <string, string> tableMapping = new Dictionary <string, string>()
            {
                { "Table", "i9SysPersonnel" }
            };

            DataSet   ds       = da.GetDataSet(BlankSQL, tableMapping);
            DataTable PersonDT = ds.Tables["i9SysPersonnel"];
            DataRow   NewRD    = PersonDT.NewRow();

            NewRD["i9SysPersonnelID"] = Guid.NewGuid();
            NewRD["FirstName"]        = "@NewFirst";
            NewRD["LastName"]         = "@NewLast " + DateTime.Now.ToString("MM/dd/yyyy hh:mm");
            NewRD["i9AgencyID"]       = requestMessage.MsgBody.ToString();
            NewRD["BadgeNumber"]      = DateTime.Now.ToString("MMddyyyyhhmm");
            NewRD["Enabled"]          = 1;
            PersonDT.Rows.Add(NewRD);

            string i9SysPersonnelID = NewRD["i9SysPersonnelID"].ToString();

            if (da.SaveDataTable(ds.Tables["i9SysPersonnel"]) <= 0)
            {
                //unable to save new personnel
                response.MsgBody              = "";
                response.ErrorStatus.IsError  = true;
                response.ErrorStatus.ErrorMsg = "Unable to add new user";

                return(response);
            }


            requestMessage.ToBizLayerMsgType = AdminType.SysPer_PersonGet;
            requestMessage.MsgBody           = i9SysPersonnelID;

            return(PersonnelGet(requestMessage));
        }
Exemple #5
0
        /// <summary>
        /// Sync Module Manager To DB
        /// </summary>
        private void SyncModuleManagerToDB()
        {
            SQLAccess da = new SQLAccess();

            //DataTable dt = da.GetDataTable("SELECT * FROM i9Module WHERE ModuleKey = " + SQLUtility.SQLString(mi.i9ModuleID), "i9Module");
            DataTable dt = da.GetDataTable("SELECT * FROM i9Module", "i9Module");

            for (int i = 0; i < ModuleManager.Instance.Modules.Length - 1; i++)
            {
                ModuleItem mi = ModuleManager.Instance.Modules[i];

                bool found = false;

                if (mi.ModuleName.ToUpper() == "CRIME WATCH")
                {
                    Console.Write("");
                }


                if (mi.ModuleName.ToUpper() == "LOGIN" ||
                    mi.ModuleName.ToUpper() == "MAIN" ||
                    mi.ModuleName.ToUpper() == "MAIN MENU" ||
                    mi.ModuleName.ToUpper() == "SPLASH SCREEN")
                {
                    continue;
                }
                else
                {
                    foreach (DataRow ModuleRow in dt.Rows)
                    {
                        if (ModuleRow["ModuleName"].ToString().ToUpper() == mi.ModuleName.ToUpper())
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found == false)
                    {
                        //Why am I adding a row if the table is blank this is strange
                        DataRow NewModuleRow = dt.NewRow();
                        NewModuleRow["ClassName"]      = mi.ClassName;
                        NewModuleRow["ModuleName"]     = mi.ModuleName;
                        NewModuleRow["Section"]        = mi.Section;
                        NewModuleRow["PopupPage"]      = mi.PopupPage;
                        NewModuleRow["DesktopEnabled"] = mi.DesktopEnabled;
                        NewModuleRow["MobileEnabled"]  = mi.MobileEnabled;
                        NewModuleRow["ModuleType"]     = mi.ModuleType;
                        NewModuleRow["ModuleKey"]      = mi.i9ModuleID;
                        NewModuleRow["i9ModuleID"]     = Guid.NewGuid();
                        NewModuleRow["FileName"]       = mi.FileName;
                        dt.Rows.Add(NewModuleRow);
                    }
                }
            }

            if (dt.DataSet.HasChanges())
            {
                da.SaveDataTable(dt);
            }
        }
Exemple #6
0
        private i9Message CreateUser(i9Message requestMessage)
        {
            i9Message response = new i9Message();

            string            CodeSetName        = requestMessage.MsgBody;
            CreateUserMessage oCreateUserMessage = (CreateUserMessage)i9Message.XMLDeserializeMessage(typeof(CreateUserMessage), requestMessage.MsgBody);

            SQLAccess da  = new SQLAccess();
            string    SQL = " Select * FROM i9SysPersonnel WHERE Email = " + SQLUtility.SQLString(oCreateUserMessage.Email) + " ";

            Dictionary <string, string> tableMapping = new Dictionary <string, string>()
            {
                { "Table", "i9SysPersonnel" }
            };

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

            if (ds.Tables["i9SysPersonnel"].Rows.Count > 0)
            {
                response.ErrorStatus.ErrorMsg = "Email already exists in system";
                response.ErrorStatus.IsError  = true;
                return(response);
            }
            else
            {
                DataRow dr = ds.Tables["i9SysPersonnel"].NewRow();

                dr["FirstName"] = oCreateUserMessage.FirstName;
                dr["LastName"]  = oCreateUserMessage.LastName;

                dr["DateTimeInserted"] = DateTime.Now;
                dr["DateTimeUpdated"]  = DateTime.Now;

                dr["Password"]         = oCreateUserMessage.Password;
                dr["Email"]            = oCreateUserMessage.Email;
                dr["BadgeNumber"]      = oCreateUserMessage.Email;
                dr["i9SysPersonnelID"] = Guid.NewGuid();
                dr["ActivationGuid"]   = Guid.NewGuid();
                dr["Enabled"]          = 1;
                dr["DemoUser"]         = 1;
                dr["OfficerORI"]       = "";
                dr["Officer"]          = oCreateUserMessage.FirstName + ", " + oCreateUserMessage.LastName;

                if (oCreateUserMessage.i9AgencyID == Guid.Empty)
                {
                    dr["i9AgencyID"] = "53A05F38-FC9C-4260-B939-CB1F3998C4D4";
                }
                else
                {
                    dr["i9AgencyID"] = oCreateUserMessage.i9AgencyID;
                }

                ds.Tables["i9SysPersonnel"].Rows.Add(dr);

                da.SaveDataTable(ds.Tables["i9SysPersonnel"]);

                //===============================================================
                //  Send Email Confirmation
                //===============================================================
                //string EmailMessage = "";
                //string EmailSubject = "Invert911 Activation Confirmation";
                //string EmailFrom = "*****@*****.**";
                //string EmailTo = oCreateUserMessage.Email;

                //EmailUtility.SendEmail(EmailTo,EmailFrom,EmailSubject, EmailMessage);
            }

            response.ErrorStatus.IsError = false;
            return(response);
        }