Exemple #1
0
        internal static int AddExistingModule(int moduleId, int tabId, string paneName, int position, string align, string container)
        {
            var objModules  = new DotNetNuke.Entities.Modules.ModuleController();
            var objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

            int UserId = PortalSettings.Current.UserId;

            var objModule = objModules.GetModule(moduleId, tabId, false);

            if (objModule != null)
            {
                // clone the module object ( to avoid creating an object reference to the data cache )
                var objClone = objModule.Clone();
                objClone.TabID        = PortalSettings.Current.ActiveTab.TabID;
                objClone.ModuleOrder  = position;
                objClone.PaneName     = paneName;
                objClone.Alignment    = align;
                objClone.ContainerSrc = container;

                int iNewModuleId = objModules.AddModule(objClone);
                //objEventLog.AddLog(objClone, PortalSettings.Current, UserId, "", DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.MODULE_CREATED);

                return(iNewModuleId);
            }

            return(-1);
        }
Exemple #2
0
        public static void AddLog(string Message, string stack, DotNetNuke.Entities.Modules.PortalModuleBase Module, System.Web.SessionState.HttpSessionState SS)
        {
            ELP = new DotNetNuke.Services.Log.EventLog.EventLogController();
            DotNetNuke.Services.Log.EventLog.LogTypeInfo LT = new DotNetNuke.Services.Log.EventLog.LogTypeInfo();
            LT.LogTypeDescription  = "Error en sistema...";
            LT.LogTypeFriendlyName = "Error en sistema...";
            LT.LogTypeKey          = "Dispensario";
            LT.LogTypeOwner        = "Administrador";

            DotNetNuke.Services.Log.EventLog.LogInfo LI = new DotNetNuke.Services.Log.EventLog.LogInfo();
            if (Module != null)
            {
                LI.LogPortalID = Module.PortalId;
                LI.LogUserID   = Module.UserId;
                LI.AddProperty("Usuario:", Module.UserInfo.Username);
            }
            else
            {
                LI.LogPortalID = 0;
                LI.LogUserID   = 1;
                LI.AddProperty("FromWebservice", "0000");
            }
            LI.LogTypeKey = "Dispensario";

            LI.AddProperty("Error", Message);
            LI.AddProperty("Stack", stack);

            if (SS != null)
            {
                for (int a = 0; a < SS.Count; a++)
                {
                    System.Web.Script.Serialization.JavaScriptSerializer JSC = new System.Web.Script.Serialization.JavaScriptSerializer();
                    string serializationtype = SS[a].GetType().Name;

                    string serialization = "";
                    //MAPA DE SERIALIZACIONES Y CASTEOS

                    if (serializationtype == "Paciente")
                    {
                        serialization = JSC.Serialize(SS[a] as Modelos.Paciente);
                    }
                    if (serializationtype == "String")
                    {
                        serialization = JSC.Serialize(SS[a] as String);
                    }

                    if (serialization == "")
                    {
                        serialization = "No se pudo serializar";
                    }



                    LI.AddProperty("From session Nro. " + a.ToString() + " and key " + SS.Keys[a] + " type [" + serializationtype + "] ", serialization);
                }
            }
            LI.BypassBuffering = true;

            ELP.AddLog(LI);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _startDate = FirstDayOfMonthFromDateTime(DateTime.Today.AddMonths(-12));
            _endDate   = LastDayOfMonthFromDateTime(DateTime.Today);
            if (!Page.IsPostBack)
            {
                //First Load Countries From Thads Search

                DSPortalsService.DSPortalsSoapClient dsw = new DSPortalsService.DSPortalsSoapClient();
                var ssoGUID      = UserInfo.Profile.GetPropertyValue("ssoGUID");
                var resp         = dsw.GetPortalsForUserJson(ssoGUID).Distinct();
                var thisInstance = StaffBrokerFunctions.GetSetting("DataserverURL", PortalId);
                if (String.IsNullOrEmpty(thisInstance))
                {
                    thisInstance = "-unknownLocation";
                }


                //    MyCountries.Items.Add(new ListItem("South Africa", "https://tntdataserver.com/dataserver/rsa/dataquery/dataqueryservice.asmx"));


                foreach (DSPortalsService.DataserverPortal p in resp.OrderByDescending(x => x.InstanceUri.Contains(thisInstance)).ThenBy(y => y.InstanceName))
                {
                    MyCountries.Items.Add(new ListItem(p.InstanceName, p.InstanceUri));
                }


                //MyCountries.Items.Add(new ListItem("devtest","https://tntdataserver.eu/dataserver/devtest/dataquery/dataqueryservice.asmx"));
                //MyCountries.Items.Add(new ListItem("AgapeAOA","https://tntdataserver.eu/dataserver/AgapeAOA/dataquery/dataqueryservice.asmx"));



                ////

                if (MyCountries.Items.Count > 0)
                {
                    MyCountries_SelectedIndexChanged(this, null);
                    lblMessage.Visible = false;
                }
                else
                {
                    lblMessage.Text = "We cannot find an tntDataserver account for you in any country. Please contact the countries in which you receive donations, as ask them to add your TheKey account to their dataserver.";
                    string Message = "No DataServer accounts for: " + UserInfo.DisplayName + "(" + UserId.ToString() + ") " + ssoGUID + "CountryCount:" + MyCountries.Items.Count.ToString() + ";" + (resp.Count()).ToString();
                    DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

                    objEventLog.AddLog("Accounts", Message, PortalSettings, UserId, Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);

                    lblMessage.Visible = true;
                }
            }



            //   InitializeValues();
        }
 private void logEvent(string logText)
 {
     if (!doLogging)
     {
         return;
     }
     //evLog.WriteEntry(logText);
     DotNetNuke.Services.Log.EventLog.EventLogController eCont = new DotNetNuke.Services.Log.EventLog.EventLogController();
     eCont.AddLog("QB Connector Message", logText, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT);
     return;
 }
Exemple #5
0
        public static void ADD(string message, PortalModuleBase MODULE)
        {
            DotNetNuke.Services.Log.EventLog.EventLogController ELC = new DotNetNuke.Services.Log.EventLog.EventLogController();

            if (MODULE != null)
            {
                ELC.AddLog(MODULE.UserInfo.DisplayName + " - " + MODULE.ModuleConfiguration.DesktopModule.FriendlyName, message, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);
            }
            else
            {
                ELC.AddLog("Alerta Sistem:", message, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);
            }
        }
        public string AddMasterItem(string token, int PortalId, int ClientType, int ClientId, string Title, string Filename, string Length, string Format)
        {
            //client type: -1:don't know, 0:Advertiser, 1:Agency
            //Format should be "HD" or "SD"
            AdminController aCont    = new AdminController();
            string          MasterId = "";
            string          Secret   = "fEE3txVQkUSXiAC16vPeqdTTUwOYh99w";

            if (token == Secret)
            {
                try
                {
                    MasterItemInfo master = new MasterItemInfo();
                    master.PortalId = PortalId;
                    if (ClientType == 0 && ClientId > -1)
                    {
                        master.AdvertiserId = ClientId;
                    }
                    master.Title      = Title;
                    master.Filename   = Filename;
                    master.Length     = Length;
                    master.PMTMediaId = aCont.GetNextMediaId(PortalId);
                    if (Format == "HD")
                    {
                        master.PMTMediaId += "H";
                    }
                    master.Id = aCont.Add_MasterItem(master);
                    if (ClientType == 1 && ClientId > -1)
                    {
                        aCont.Add_MasterItemAgency(master.Id, ClientId);
                    }
                    MasterId = master.PMTMediaId;
                }
                catch (Exception ex)
                {
                    DotNetNuke.Services.Log.EventLog.EventLogController eCont = new DotNetNuke.Services.Log.EventLog.EventLogController();
                    eCont.AddLog("Add MasterItem Failed", "Error: " + ex.Message, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT);
                    Exceptions.LogException(ex);
                    MasterId = ex.Message;
                }
            }
            else
            {
                MasterId = "Failed.";
            }
            return(MasterId);
        }
Exemple #7
0
        private static void sqlDependency_OnChange(object sender, SqlNotificationEventArgs e)
        {
            if (e.Info == SqlNotificationInfo.Insert)
            {
                var cntrl = new DotNetNuke.Services.Log.EventLog.EventLogController();

                int records   = 0;
                int pageSize  = 10;
                int pageIndex = 0;

                // Get DNN Logs
                //var dnnLogs = cntrl.GetLogs(PortalId, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT.ToString(), pageSize, pageIndex, ref records);

                // else try manually
                var props = new DotNetNuke.Services.Log.EventLog.LogProperties();
                props.Deserialize("<LogProperties><LogProperty><PropertyName>Install Package:</PropertyName><PropertyValue>CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - Script</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Begin Sql execution</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Providers\\DataProviders\\SqlDataProvider\\00.00.01.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Providers\\\\DataProviders\\SqlDataProvider\\00.00.01.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Executing 00.00.01.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Start Sql execution: 00.00.01.SqlDataProvider file</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>End Sql execution: 00.00.01.SqlDataProvider file</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Providers\\DataProviders\\SqlDataProvider\\Uninstall.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Providers\\DataProviders\\SqlDataProvider\\Uninstall.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Finished Sql execution</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - Script</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - ResourceFile</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Expanding Resource file</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Edit.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Edit.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - License.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - License.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - module.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - module.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - ReleaseNotes.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - ReleaseNotes.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Settings.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Settings.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - View.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - View.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - App_LocalResources\\Edit.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - App_LocalResources/Edit.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - App_LocalResources\\Settings.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - App_LocalResources/Settings.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - App_LocalResources\\View.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - App_LocalResources/View.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Documentation\\Documentation.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Documentation/Documentation.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Documentation\\Documentation.html</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Documentation/Documentation.html</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Resource Files created</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - ResourceFile</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - Module</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Module registered successfully - CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - Module</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - Assembly</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Assembly registered - bin\\CCFileExplorer.dll</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - bin\\CCFileExplorer.dll</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - bin\\CCFileExplorer.dll</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - Assembly</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Installation committed</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Installation successful. - CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Deleted temporary install folder</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Installation successful.</PropertyValue></LogProperty></LogProperties>");

                var dnnLog = new DotNetNuke.Services.Log.EventLog.LogInfo()
                {
                    LogGUID         = Guid.NewGuid().ToString()
                    , LogTypeKey    = "HOST_ALERT"
                    , LogConfigID   = "95"
                    , LogUserID     = 0
                    , LogUserName   = "******"
                    , LogPortalID   = 0
                    , LogPortalName = null
                    , LogCreateDate = DateTime.UtcNow
                    , LogServerName = "Cass"
                    , LogProperties = props
                };
                var dnnLogs = new List <DotNetNuke.Services.Log.EventLog.LogInfo>()
                {
                    dnnLog
                };


                // Convert to EventLogs
                var logs = dnnLogs.Where(log => log.LogCreateDate >= SinceDate).Select(x => new EventLog(x)).ToList();
                // Broadcast
                LogHubController.Instance.BroadcastLogs(logs);

                SinceDate = DateTime.UtcNow;
            }

            //Call the RegisterNotification method again
            RegisterDependency();
        }
        private static void sqlDependency_OnChange(object sender, SqlNotificationEventArgs e)
        {
            if (e.Info == SqlNotificationInfo.Insert)
            {
                var cntrl = new DotNetNuke.Services.Log.EventLog.EventLogController();

                int records = 0;
                int pageSize = 10;
                int pageIndex = 0;

                // Get DNN Logs
                //var dnnLogs = cntrl.GetLogs(PortalId, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT.ToString(), pageSize, pageIndex, ref records);

                // else try manually
                var props = new DotNetNuke.Services.Log.EventLog.LogProperties();
                props.Deserialize("<LogProperties><LogProperty><PropertyName>Install Package:</PropertyName><PropertyValue>CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - Script</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Begin Sql execution</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Providers\\DataProviders\\SqlDataProvider\\00.00.01.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Providers\\\\DataProviders\\SqlDataProvider\\00.00.01.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Executing 00.00.01.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Start Sql execution: 00.00.01.SqlDataProvider file</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>End Sql execution: 00.00.01.SqlDataProvider file</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Providers\\DataProviders\\SqlDataProvider\\Uninstall.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Providers\\DataProviders\\SqlDataProvider\\Uninstall.SqlDataProvider</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Finished Sql execution</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - Script</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - ResourceFile</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Expanding Resource file</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Edit.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Edit.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - License.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - License.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - module.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - module.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - ReleaseNotes.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - ReleaseNotes.txt</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Settings.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Settings.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - View.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - View.ascx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - App_LocalResources\\Edit.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - App_LocalResources/Edit.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - App_LocalResources\\Settings.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - App_LocalResources/Settings.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - App_LocalResources\\View.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - App_LocalResources/View.ascx.resx</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Documentation\\Documentation.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Documentation/Documentation.css</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - Documentation\\Documentation.html</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - Documentation/Documentation.html</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Resource Files created</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - ResourceFile</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - Module</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Module registered successfully - CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - Module</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Starting Installation - Assembly</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Assembly registered - bin\\CCFileExplorer.dll</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Creating backup of previous version - bin\\CCFileExplorer.dll</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Created - bin\\CCFileExplorer.dll</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Component installed successfully - Assembly</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Installation committed</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Installation successful. - CCFileExplorer</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Deleted temporary install folder</PropertyValue></LogProperty><LogProperty><PropertyName>Info:</PropertyName><PropertyValue>Installation successful.</PropertyValue></LogProperty></LogProperties>");

                var dnnLog = new DotNetNuke.Services.Log.EventLog.LogInfo() {
                    LogGUID = Guid.NewGuid().ToString()
                   ,LogTypeKey = "HOST_ALERT"
                   ,LogConfigID = "95"
                   ,LogUserID = 0
                   ,LogUserName ="******"
                   ,LogPortalID = 0
                   ,LogPortalName = null
                   ,LogCreateDate = DateTime.UtcNow
                   ,LogServerName = "Cass"
                   ,LogProperties = props
                };
                var dnnLogs = new List<DotNetNuke.Services.Log.EventLog.LogInfo>(){dnnLog};

                // Convert to EventLogs
                var logs = dnnLogs.Where(log => log.LogCreateDate >= SinceDate).Select(x => new EventLog(x)).ToList();
                // Broadcast
                LogHubController.Instance.BroadcastLogs(logs);

                SinceDate = DateTime.UtcNow;
            }

            //Call the RegisterNotification method again
            RegisterDependency();
        }
        /// <summary>
        /// WebMethod - authenticate()
        /// To verify username and password for the web connector that is trying to connect
        /// Signature: public string[] authenticate(string strUserName, string strPassword)
        ///
        /// IN:
        /// string strUserName
        /// string strPassword
        ///
        /// OUT:
        /// string[] authReturn
        /// Possible values:
        /// string[0] = ticket
        /// string[1]
        /// - "" = use current company file
        /// - "none" = no further request/no further action required
        /// - "nvu" = not valid user
        /// - "use this string as the company file path" = use this company file
        /// string[2] - (optional) contains the number of seconds to wait before
        /// the next update.
        /// string[3] - (optional) contains the number of seconds to be used as the
        /// MinimumRunEveryNSeconds time.
        ///
        /// The third and fourth elements allow you to to reduce QBWC updates during
        /// peak activity, basically telling QBWC clients not to update so frequently
        /// (the third element) or permanently resetting the minimum update time at the
        /// QBWC client (the fourth element).
        /// </summary>
        public string[] authenticate(string strUserName, string strPassword)
        {
            string evLogTxt = "WebMethod: authenticate() has been called by QBWebconnector";

            evLogTxt = evLogTxt + "Parameters received:";
            evLogTxt = evLogTxt + "string strUserName = "******"string strPassword = "******"QBPassword"];

            evLogTxt = evLogTxt + "Password locally stored = " + pwd;
            if (strUserName.ToUpper().Trim().Equals(ConfigurationManager.AppSettings["QBUserName"]) &&
                strPassword.ToUpper().Trim().Equals(pwd.ToUpper()))
            {
                // An empty string for authReturn[1] means asking QBWebConnector
                // to connect to the company file that is currently openned in QB
                authReturn[1] = "";
            }
            else
            {
                authReturn[1] = "nvu";
            }
            // You could also return "none" to indicate there is no work to do
            // or a company filename in the format C:\full\path o\company.qbw
            // based on your program logic and requirements.
            evLogTxt = evLogTxt + "Return values: ";
            evLogTxt = evLogTxt + "string[] authReturn[0] = " + authReturn[0].ToString();
            evLogTxt = evLogTxt + "string[] authReturn[1] = " + authReturn[1].ToString();
            DotNetNuke.Services.Log.EventLog.EventLogController eCont = new DotNetNuke.Services.Log.EventLog.EventLogController();
            eCont.AddLog("QB Connector Message", evLogTxt, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT);
            return(authReturn);
        }
        public async void RunReportsAsync(int PortalId, string baseUrl)
        {
            AdminController   aCont   = new AdminController();
            List <ReportInfo> reports = aCont.Get_ReportsByPortalId(PortalId);
            string            summary = "";

            foreach (ReportInfo report in reports)
            {
                summary += "Report ID: " + report.Id.ToString() + ", title: " + report.ReportName + ", Email to: " + report.EmailTo;
                if (report.isActive)
                {
                    List <TaskInfo> tasks = new List <TaskInfo>();
                    if (report.ReportType == 3)
                    {
                        tasks = getReportTasks(PortalId, report);
                    }
                    if ((report.ReportType == 3 && tasks.Count > 0) || report.ReportType == 1 || report.ReportType == 2)
                    {
                        bool sent = false;
                        if (report.Frequency == "daily" && DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday)
                        {
                            aCont.SendReport(report, baseUrl, true);
                            sent = true;
                        }
                        else if (report.Frequency == "weekly")
                        {
                            DateTime today = DateTime.Now;
                            TimeSpan t     = today - report.FirstReportDate;
                            if (t.TotalDays % 7 == 0)
                            {
                                aCont.SendReport(report, baseUrl, true);
                                sent = true;
                            }
                        }
                        else if (report.Frequency == "monthly")
                        {
                            DateTime today = DateTime.Now;
                            if (today.Day == report.FirstReportDate.Day)
                            {
                                aCont.SendReport(report, baseUrl, true);
                                sent = true;
                            }
                        }
                        if (sent)
                        {
                            summary += " sent. ";
                        }
                        else
                        {
                            summary += " not sent. ";
                        }
                    }
                    else
                    {
                        summary += " not sent. ";
                    }
                }
                else
                {
                    summary += " not sent. ";
                }
            }
            DotNetNuke.Services.Log.EventLog.EventLogController eCont = new DotNetNuke.Services.Log.EventLog.EventLogController();
            eCont.AddLog("Reports Summary", summary, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT);
        }
        public HttpResponseMessage SaveModule(DTO.ModuleDetails module)
        {
            var apiResponse = new DTO.ApiResponse <int>();

            try
            {
                int iPosition = -1;
                switch (module.Position.ToUpper())
                {
                case "TOP":
                    iPosition = 0;
                    break;

                case "ABOVE":
                    if (string.IsNullOrEmpty(module.ModuleInstance) == false)
                    {
                        iPosition = int.Parse(module.ModuleInstance) - 1;
                    }
                    break;

                case "BELOW":
                    if (string.IsNullOrEmpty(module.ModuleInstance) == false)
                    {
                        iPosition = int.Parse(module.ModuleInstance) + 1;
                    }
                    break;

                case "BOTTOM":
                    iPosition = -1;
                    break;
                }

                if (module.CreateAs == "copy")
                {
                    if (module.Container == "-1")
                    {
                        module.Container = string.Empty;
                    }

                    Common.AddModuleCopy(module.ModuleId, module.PageId, iPosition, module.Location, module.Container);
                    apiResponse.Success = true;
                }
                else if (module.CreateAs == "link")
                {
                    if (module.Container == "-1")
                    {
                        module.Container = string.Empty;
                    }

                    Common.AddExistingModule(module.ModuleId, module.PageId, module.Location, iPosition, "", module.Container);
                    apiResponse.Success = true;
                }
                else
                {
                    List <int> lstNewModules = new List <int>();

                    var objTabPermissions       = PortalSettings.ActiveTab.TabPermissions;
                    var objPermissionController = new DotNetNuke.Security.Permissions.PermissionController();
                    var objModules = new DotNetNuke.Entities.Modules.ModuleController();

                    var objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();
                    int j           = 0;

                    try
                    {
                        DotNetNuke.Entities.Modules.DesktopModuleInfo desktopModule = null;
                        if (!DotNetNuke.Entities.Modules.DesktopModuleController.GetDesktopModules(PortalSettings.PortalId).TryGetValue(module.Module, out desktopModule))
                        {
                            apiResponse.Message = "desktopModuleId";
                            return(Request.CreateResponse(HttpStatusCode.OK, apiResponse));
                        }
                    }
                    catch (Exception ex)
                    {
                        //LogException(ex);
                    }

                    int UserId = UserInfo.UserID;

                    foreach (var objModuleDefinition in DotNetNuke.Entities.Modules.Definitions.ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(module.Module).Values)
                    {
                        var objModule = new DotNetNuke.Entities.Modules.ModuleInfo();
                        objModule.Initialize(PortalSettings.PortalId);

                        objModule.PortalID = PortalSettings.PortalId;
                        objModule.TabID    = PortalSettings.ActiveTab.TabID;

                        objModule.ModuleOrder = iPosition;
                        if (string.IsNullOrEmpty(module.Title) == true)
                        {
                            objModule.ModuleTitle = objModuleDefinition.FriendlyName;
                        }
                        else
                        {
                            objModule.ModuleTitle = module.Title;
                        }

                        if (!string.IsNullOrEmpty(module.Container) && module.Container != "-1")
                        {
                            objModule.ContainerSrc = module.Container;
                        }

                        objModule.PaneName    = module.Location;
                        objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                        if (objModuleDefinition.DefaultCacheTime > 0)
                        {
                            objModule.CacheTime = objModuleDefinition.DefaultCacheTime;
                            if (PortalSettings.DefaultModuleId > Null.NullInteger && PortalSettings.DefaultTabId > Null.NullInteger)
                            {
                                var defaultModule = objModules.GetModule(PortalSettings.DefaultModuleId, PortalSettings.DefaultTabId, true);
                                if ((defaultModule != null))
                                {
                                    objModule.CacheTime = defaultModule.CacheTime;
                                }
                            }
                        }

                        switch (module.Visibility)
                        {
                        case 0:
                            objModule.InheritViewPermissions = true;
                            break;

                        case 1:
                            objModule.InheritViewPermissions = false;
                            break;

                        case 2:
                            objModule.InheritViewPermissions = false;
                            break;

                        case 3:
                            objModule.InheritViewPermissions = false;
                            break;

                        case 4:
                            objModule.InheritViewPermissions = false;
                            break;
                        }

                        // get the default module view permissions
                        var arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");

                        // get the permissions from the page
                        foreach (DotNetNuke.Security.Permissions.TabPermissionInfo objTabPermission in objTabPermissions)
                        {
                            if (objTabPermission.PermissionKey == "VIEW" && module.Visibility == 0)
                            {
                                //Don't need to explicitly add View permisisons if "Same As Page"
                                continue;
                            }

                            // get the system module permissions for the permissionkey
                            var arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
                            // loop through the system module permissions
                            for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++)
                            {
                                // create the module permission
                                DotNetNuke.Security.Permissions.PermissionInfo objSystemModulePermission = null;
                                objSystemModulePermission = (DotNetNuke.Security.Permissions.PermissionInfo)arrSystemModulePermissions[j];
                                if (objSystemModulePermission.PermissionKey == "VIEW" && module.Visibility == 1 && objTabPermission.PermissionKey != "EDIT")
                                {
                                    //Only Page Editors get View permissions if "Page Editors Only"
                                    continue;
                                }

                                var objModulePermission = Common.AddModulePermission(objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);

                                // ensure that every EDIT permission which allows access also provides VIEW permission
                                if (objModulePermission.PermissionKey == "EDIT" & objModulePermission.AllowAccess)
                                {
                                    var objModuleViewperm = Common.AddModulePermission(objModule, (DotNetNuke.Security.Permissions.PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true);
                                }
                            }

                            //Get the custom Module Permissions,  Assume that roles with Edit Tab Permissions
                            //are automatically assigned to the Custom Module Permissions
                            if (objTabPermission.PermissionKey == "EDIT")
                            {
                                var arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);

                                // loop through the custom module permissions
                                for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++)
                                {
                                    // create the module permission
                                    DotNetNuke.Security.Permissions.PermissionInfo objCustomModulePermission = null;
                                    objCustomModulePermission = (DotNetNuke.Security.Permissions.PermissionInfo)arrCustomModulePermissions[j];

                                    Common.AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
                                }
                            }
                        }

                        objModule.AllTabs = false;
                        //objModule.Alignment = align;

                        apiResponse.CustomObject = objModules.AddModule(objModule);
                        apiResponse.Success      = true;
                    }
                }
            }
            catch (Exception err)
            {
                apiResponse.Success = false;
                apiResponse.Message = err.Message;

                Exceptions.LogException(err);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, apiResponse));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _startDate = FirstDayOfMonthFromDateTime(DateTime.Today.AddMonths(-12));
             _endDate = LastDayOfMonthFromDateTime(DateTime.Today);
             if (!Page.IsPostBack)
             {
                //First Load Countries From Thads Search

                 DSPortalsService.DSPortalsSoapClient dsw = new DSPortalsService.DSPortalsSoapClient();
                 var ssoGUID = UserInfo.Profile.GetPropertyValue("ssoGUID");
                 var resp = dsw.GetPortalsForUserJson(ssoGUID ).Distinct();
               var thisInstance = StaffBrokerFunctions.GetSetting("DataserverURL", PortalId);
               if (String.IsNullOrEmpty(thisInstance)) thisInstance = "-unknownLocation";

               //    MyCountries.Items.Add(new ListItem("South Africa", "https://tntdataserver.com/dataserver/rsa/dataquery/dataqueryservice.asmx"));

                 foreach (DSPortalsService.DataserverPortal  p in resp.OrderByDescending(x => x.InstanceUri.Contains(thisInstance)).ThenBy(y => y.InstanceName ))
                 {
                      MyCountries.Items.Add(new ListItem(p.InstanceName , p.InstanceUri ));

                 }

                //MyCountries.Items.Add(new ListItem("devtest","https://tntdataserver.eu/dataserver/devtest/dataquery/dataqueryservice.asmx"));
                //MyCountries.Items.Add(new ListItem("AgapeAOA","https://tntdataserver.eu/dataserver/AgapeAOA/dataquery/dataqueryservice.asmx"));

                 ////

                 if (MyCountries.Items.Count > 0)
                 {
                     MyCountries_SelectedIndexChanged(this, null);
                     lblMessage.Visible = false;
                 }
                 else
                 {
                     lblMessage.Text = "We cannot find an tntDataserver account for you in any country. Please contact the countries in which you receive donations, as ask them to add your TheKey account to their dataserver.";
                     string Message="No DataServer accounts for: " + UserInfo.DisplayName + "(" + UserId.ToString() + ") " + ssoGUID + "CountryCount:" + MyCountries.Items.Count.ToString() + ";" + (resp.Count()).ToString();
                     DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

                     objEventLog.AddLog("Accounts", Message, PortalSettings, UserId, Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);

                     lblMessage.Visible = true;
                 }

             }

              //   InitializeValues();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            openAddCountry.ToolTip = Translate("btnAddCountryTooltip");
            lblNew.Text = Translate("lblNew");
            _startDate = FirstDayOfMonthFromDateTime(DateTime.Today.AddMonths(-12));
            _endDate = LastDayOfMonthFromDateTime(DateTime.Today);

            if (!Page.IsPostBack)
            {
                //First Load Countries From Thads Search

               DSPU.DSPortalUsers dspus = new DSPU.DSPortalUsers();
                ssoGUID = UserInfo.Profile.GetPropertyValue("ssoGUID");
                var resp =  dspus.GetPortalsForUser("CASAUTH", "thecatsaysmeow3", ssoGUID);

                //DSPortalsService.DSPortalsSoapClient dsw = new DSPortalsService.DSPortalsSoapClient();

                //var resp = dsw.GetPortalsForUserJson(ssoGUID).Distinct();
                var thisInstance = StaffBrokerFunctions.GetSetting("DataserverURL", PortalId);
                if (String.IsNullOrEmpty(thisInstance)) thisInstance = "-unknownLocation";

                //    MyCountries.Items.Add(new ListItem("South Africa", "https://tntdataserver.com/dataserver/rsa/dataquery/dataqueryservice.asmx"));

                ////MyCountries.Items.Add(new ListItem("Bulgaria Test", "https://tntdataserver.eu/dataserver/bgr/dataquery/dataqueryservice.asmx"));

                foreach (var p in resp.OrderByDescending(x => x.PortalUri.Contains(thisInstance)).ThenBy(y => y.PortalName))
                {
                    MyCountries.Items.Add(new ListItem(p.PortalName, p.PortalUri));

                }

                MinistryView.MinistryViewDataContext dm = new MinistryView.MinistryViewDataContext();

                var addCountries = from c in dm.MinistryView_UserCountryProfiles where c.GUID == ssoGUID select new { c.UserCountryProfileId, c.MinistryView_AdditionalCountry.CountryName };
                foreach (var row in addCountries)
                {
                    MyCountries.Items.Add(new ListItem(row.CountryName, "ADD" + row.UserCountryProfileId));
                }

                //MyCountries.Items.Add(new ListItem("devtest","https://tntdataserver.eu/dataserver/devtest/dataquery/dataqueryservice.asmx"));
                //MyCountries.Items.Add(new ListItem("AgapeAOA","https://tntdataserver.eu/dataserver/AgapeAOA/dataquery/dataqueryservice.asmx"));

                ////

                if (MyCountries.Items.Count > 0)
                {
                    MyCountries_SelectedIndexChanged(this, null);
                    lblMessage.Visible = false;
                }
                else
                {
                    lblMessage.Text = Translate("lblMessage");
                    string Message = "No DataServer accounts for: " + UserInfo.DisplayName + "(" + UserId.ToString() + ") " + ssoGUID + "CountryCount:" + MyCountries.Items.Count.ToString() + ";" + (resp.Count()).ToString();
                    DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

                    objEventLog.AddLog("Accounts", Message, PortalSettings, UserId, Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);

                    lblMessage.Visible = true;
                    accordion.Visible = false;
                    divBalance.Visible = false;
                    IncExpGraph.Visible = false;
                }

            }

            //   InitializeValues();
        }
Exemple #14
0
 public void logEvent(string evLogTxt)
 {
     DotNetNuke.Services.Log.EventLog.EventLogController eCont = new DotNetNuke.Services.Log.EventLog.EventLogController();
     eCont.AddLog("QB Log Event", "QB Event Log: " + evLogTxt, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT);
 }
        public Int32 AddNewModule(string title, int desktopModuleId, TabInfo ActiveTab, string paneName, int position, ViewPermissionType permissionType, string align)
        {
            int ModuleId = 0;
            TabPermissionCollection objTabPermissions       = ActiveTab.TabPermissions;
            PermissionController    objPermissionController = new PermissionController();
            ModuleController        objModules = new ModuleController();

            DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();
            int j;

            try
            {
                DesktopModuleInfo desktopModule = null;
                if (!DesktopModuleController.GetDesktopModules(BSkin.PortalSettings.PortalId).TryGetValue(desktopModuleId, out desktopModule))
                {
                    throw new ArgumentException("desktopModuleId");
                }
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
            }
            int UserId = -1;

            if (BSkin.Request.IsAuthenticated)
            {
                UserInfo objUserInfo = UserController.GetCurrentUserInfo();
                UserId = objUserInfo.UserID;
            }
            foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values)
            {
                ModuleInfo objModule = new ModuleInfo();
                objModule.Initialize(BSkin.PortalSettings.PortalId);
                objModule.PortalID    = BSkin.PortalSettings.PortalId;
                objModule.TabID       = ActiveTab.TabID;
                objModule.ModuleOrder = position;
                if (String.IsNullOrEmpty(title))
                {
                    objModule.ModuleTitle = objModuleDefinition.FriendlyName;
                }
                else
                {
                    objModule.ModuleTitle = title;
                }
                objModule.PaneName    = paneName;
                objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                if (objModuleDefinition.DefaultCacheTime > 0)
                {
                    objModule.CacheTime = objModuleDefinition.DefaultCacheTime;
                    if (BSkin.PortalSettings.DefaultModuleId > Null.NullInteger && BSkin.PortalSettings.DefaultTabId > Null.NullInteger)
                    {
                        ModuleInfo defaultModule = objModules.GetModule(BSkin.PortalSettings.DefaultModuleId, BSkin.PortalSettings.DefaultTabId, true);
                        if (defaultModule != null)
                        {
                            objModule.CacheTime = defaultModule.CacheTime;
                        }
                    }
                }
                switch (permissionType)
                {
                case ViewPermissionType.View:
                    objModule.InheritViewPermissions = true;
                    break;

                case ViewPermissionType.Edit:
                    objModule.InheritViewPermissions = false;
                    break;
                }
                ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");
                foreach (TabPermissionInfo objTabPermission in objTabPermissions)
                {
                    if (objTabPermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.View)
                    {
                        continue;
                    }
                    ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
                    for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++)
                    {
                        PermissionInfo objSystemModulePermission;
                        objSystemModulePermission = (PermissionInfo)arrSystemModulePermissions[j];
                        if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.Edit && objTabPermission.PermissionKey != "EDIT")
                        {
                            continue;
                        }
                        ModulePermissionInfo objModulePermission = AddModulePermission(objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
                        if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess)
                        {
                            ModulePermissionInfo objModuleViewperm = AddModulePermission(objModule, (PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true);
                        }
                    }
                    if (objTabPermission.PermissionKey == "EDIT")
                    {
                        ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);
                        for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++)
                        {
                            PermissionInfo objCustomModulePermission;
                            objCustomModulePermission = (PermissionInfo)arrCustomModulePermissions[j];
                            AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
                        }
                    }
                }


                objModule.AllTabs   = false;
                objModule.Alignment = align;
                ModuleId            = objModules.AddModule(objModule);
            }
            return(ModuleId);
        }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            openAddCountry.ToolTip = Translate("btnAddCountryTooltip");
            lblNew.Text            = Translate("lblNew");
            _startDate             = FirstDayOfMonthFromDateTime(DateTime.Today.AddMonths(-12));
            _endDate = LastDayOfMonthFromDateTime(DateTime.Today);


            if (!Page.IsPostBack)
            {
                //First Load Countries From Thads Search

                DSPU.DSPortalUsers dspus = new DSPU.DSPortalUsers();
                ssoGUID = UserInfo.Profile.GetPropertyValue("ssoGUID");
                var resp = dspus.GetPortalsForUser("CASAUTH", "thecatsaysmeow3", ssoGUID);



                //DSPortalsService.DSPortalsSoapClient dsw = new DSPortalsService.DSPortalsSoapClient();

                //var resp = dsw.GetPortalsForUserJson(ssoGUID).Distinct();
                var thisInstance = StaffBrokerFunctions.GetSetting("DataserverURL", PortalId);
                if (String.IsNullOrEmpty(thisInstance))
                {
                    thisInstance = "-unknownLocation";
                }


                //    MyCountries.Items.Add(new ListItem("South Africa", "https://tntdataserver.com/dataserver/rsa/dataquery/dataqueryservice.asmx"));

                ////MyCountries.Items.Add(new ListItem("Bulgaria Test", "https://tntdataserver.eu/dataserver/bgr/dataquery/dataqueryservice.asmx"));

                foreach (var p in resp.OrderByDescending(x => x.PortalUri.Contains(thisInstance)).ThenBy(y => y.PortalName))
                {
                    MyCountries.Items.Add(new ListItem(p.PortalName, p.PortalUri));
                }

                MinistryView.MinistryViewDataContext dm = new MinistryView.MinistryViewDataContext();

                var addCountries = from c in dm.MinistryView_UserCountryProfiles where c.GUID == ssoGUID select new { c.UserCountryProfileId, c.MinistryView_AdditionalCountry.CountryName };
                foreach (var row in addCountries)
                {
                    MyCountries.Items.Add(new ListItem(row.CountryName, "ADD" + row.UserCountryProfileId));
                }



                //MyCountries.Items.Add(new ListItem("devtest","https://tntdataserver.eu/dataserver/devtest/dataquery/dataqueryservice.asmx"));
                //MyCountries.Items.Add(new ListItem("AgapeAOA","https://tntdataserver.eu/dataserver/AgapeAOA/dataquery/dataqueryservice.asmx"));



                ////

                if (MyCountries.Items.Count > 0)
                {
                    MyCountries_SelectedIndexChanged(this, null);
                    lblMessage.Visible = false;
                }
                else
                {
                    lblMessage.Text = Translate("lblMessage");
                    string Message = "No DataServer accounts for: " + UserInfo.DisplayName + "(" + UserId.ToString() + ") " + ssoGUID + "CountryCount:" + MyCountries.Items.Count.ToString() + ";" + (resp.Count()).ToString();
                    DotNetNuke.Services.Log.EventLog.EventLogController objEventLog = new DotNetNuke.Services.Log.EventLog.EventLogController();

                    objEventLog.AddLog("Accounts", Message, PortalSettings, UserId, Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);

                    lblMessage.Visible  = true;
                    accordion.Visible   = false;
                    divBalance.Visible  = false;
                    IncExpGraph.Visible = false;
                }
            }



            //   InitializeValues();
        }