示例#1
0
        public BaseClass(string strWebMethodName)
        {
            WebMethodName = strWebMethodName;
            strERRORNotFound = strERRORPrefix + "NOTFOUND";
            strUser = System.Environment.UserName;
            WebServices oWebService = new WebServices(0, dsn);
            Users oUser = new Users(0, dsn);
            boolCanRead = (oWebService.CanRead(strWebMethodName, oUser.GetId(strUser)));
            boolCanWrite = (oWebService.CanWrite(strWebMethodName, oUser.GetId(strUser)));
            if (HttpContext.Current.Request.IsLocal == false)
            {
                if (EventLog.SourceExists("ClearView") == false)
                {
                    EventLog.CreateEventSource("ClearView", "ClearView");
                    EventLog.WriteEntry("Application", String.Format("ClearView EventLog Created"), EventLogEntryType.Information);
                }
                oLog = new EventLog();
                oLog.Source = "ClearView";
                oLog.ModifyOverflowPolicy(OverflowAction.OverwriteAsNeeded, 0);
                oLog.MaximumKilobytes = long.Parse("16384");
            }
            else
            {
                // Just write to local application log for debugging
                oLog = new EventLog();
                oLog.Source = "Application";
                // Also, allow reading and writing
                boolCanRead = true;
                boolCanWrite = true;
            }

            oVariable = new Variables(intEnvironment);
        }
示例#2
0
        protected void btnLog_Click(object sender, EventArgs e)
        {
            try
            {
                Response.Write("1" + "<br/>");
                WebMethodName = "CreateDNSforPNC";
                Response.Write("1" + "<br/>");
                strERRORNotFound = strERRORPrefix + "NOTFOUND";
                Response.Write("1" + "<br/>");
                strUser = System.Environment.UserName;
                Response.Write("1" + "<br/>");
                WebServices oWebService = new WebServices(0, dsn);
                Response.Write(strUser + "<br/>");
                Users oUser = new Users(0, dsn);
                Response.Write(oUser.GetId(strUser).ToString() + "<br/>");
                boolCanRead = (oWebService.CanRead(WebMethodName, oUser.GetId(strUser)));
                Response.Write("1" + "<br/>");
                boolCanWrite = (oWebService.CanWrite(WebMethodName, oUser.GetId(strUser)));
                Response.Write("1" + "<br/>");
                if (HttpContext.Current.Request.IsLocal == false)
                {
                    if (EventLog.SourceExists("ClearView") == false)
                    {
                        EventLog.CreateEventSource("ClearView", "ClearView");
                        EventLog.WriteEntry("Application", String.Format("ClearView EventLog Created"), EventLogEntryType.Information);
                    }
                    oLog        = new EventLog();
                    oLog.Source = "ClearView";
                    oLog.ModifyOverflowPolicy(OverflowAction.OverwriteAsNeeded, 0);
                    oLog.MaximumKilobytes = long.Parse("16384");
                }
                else
                {
                    // Just write to local application log for debugging
                    oLog        = new EventLog();
                    oLog.Source = "Application";
                    // Also, allow reading and writing
                    boolCanRead  = true;
                    boolCanWrite = true;
                }

                Response.Write("1" + "<br/>");
                oVariable = new Variables(intEnvironment);
                Response.Write("No Problem!");
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }