Ejemplo n.º 1
0
        //Madan 09/29/03 - This method will be used to write the Error Logs to a XML file on disk
        public static void AddWebErrors(string AppName, string ComponentName, string MethodName, string ErrDesc)
        {
            DataSet dsXML   = new ERRORS();
            string  dstPath = "";

            dstPath  = Utilities.getDrivePathByLetter("ERRORLOG:");
            dstPath += "\\WebErrorLog.xml";

            try {
                // Create a file permission set indicating all of this method's intentions.
                FileIOPermission fp = new FileIOPermission(FileIOPermissionAccess.AllAccess, Path.GetFullPath(dstPath));
                fp.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Append, Path.GetFullPath(dstPath));

                // Verify that we can be granted all the permissions we'll need.
                fp.Demand();

                // Assert the desired permissions here.
                fp.Assert();

                if (System.IO.File.Exists(dstPath))
                {
                    dsXML.ReadXml(dstPath);
                }
                DataRow  Row        = dsXML.Tables["ErrorHistory"].NewRow();
                object[] myRowArray = new object[6];
                myRowArray[0] = System.Environment.MachineName;
                myRowArray[1] = AppName.Trim();
                myRowArray[2] = MethodName.Trim();
                myRowArray[3] = ComponentName.Trim();
                myRowArray[4] = ErrDesc.Trim();
                myRowArray[5] = System.DateTime.Now;
                Row.ItemArray = myRowArray;
                dsXML.Tables["ErrorHistory"].Rows.Add(Row);
                dsXML.AcceptChanges();
                dsXML.WriteXml(dstPath);
            }
            catch (System.Exception Excp) {
                Console.Write(Excp.Message);
            }
            finally {
                dsXML.Dispose();
            }
        }
Ejemplo n.º 2
0
        //Madan Saini 09/26/2006 - This Method will be used for Logging the successful Logins from Notes Login Screen.
        //Starting with - PegOiReview.
        public static void RecordLogin(string Username, string Email, string IPAddress, string WebsiteName)
        {
            DataSet dsXML   = new ERRORS();
            string  dstPath = "";

            dstPath  = Utilities.getDrivePathByLetter("ERRORLOG:");
            dstPath += "\\UserHistory.xml";

            try {
                // Create a file permission set indicating all of this method's intentions.
                FileIOPermission fp = new FileIOPermission(FileIOPermissionAccess.AllAccess, Path.GetFullPath(dstPath));
                fp.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Append, Path.GetFullPath(dstPath));
                // Verify that we can be granted all the permissions we'll need.
                fp.Demand();
                // Assert the desired permissions here.
                fp.Assert();
                //Now add the record to xml table for History
                if (System.IO.File.Exists(dstPath))
                {
                    dsXML.ReadXml(dstPath);
                    DataRow  Row        = dsXML.Tables["UserLogins"].NewRow();
                    object[] myRowArray = new object[5];
                    myRowArray[0] = Username.Trim().ToUpper();
                    myRowArray[1] = Email.Trim().ToLower();
                    myRowArray[2] = IPAddress.Trim();
                    myRowArray[3] = System.DateTime.Now;
                    myRowArray[4] = WebsiteName.Trim();
                    Row.ItemArray = myRowArray;
                    dsXML.Tables["UserLogins"].Rows.Add(Row);
                    dsXML.AcceptChanges();
                    dsXML.WriteXml(dstPath);
                }
            }
            catch (System.Exception ex) {
                GSA.R7BD.Utility.EventLog.WriteEntry("EventLog.cs", "GSA.R7BD.POIRBiz", "RecordLogin", "Error Occurred in RecordLogin procedure for User :"******" email: " + Email + ". The exception is: " + ex.Source + ex.Message, GSA.R7BD.Utility.EventLog.LogType.XMLFile);
            }
        }//end of this method