Ejemplo n.º 1
0
        protected void Application_Error()
        {
            try
            {
                //Response.Write("Ending");
                DatabaseHandler.DefaultDatabaseHandlerObject.rollBackTransaction();
            }
            catch { }

            try
            {
                DatabaseHandler.DefaultDatabaseHandlerObject.Dispose();
            }
            catch { }

            try
            {
                Exception ex = Context.Error;

                if (ex != null)
                {
                    Infolog.writeToEventLog(ex, InfoType.Error);
                    //if (AppFramework.AppClasses.Session.User != null)
                    //{
                    //    Context.ClearError();
                    //    Response.Redirect("~/Menu/Dashboard");
                    //}
                }
            }
            catch { }
        }
Ejemplo n.º 2
0
        public override void setupWindowsClient()
        {
            setup();

            String assemblyLocation = Util.getDirectoryPath(Assembly.GetExecutingAssembly().Location);

            string clientconfigfilename = assemblyLocation + "\\clientconfig.cfg";

            String[] configLines = File.ReadAllLines(clientconfigfilename);

            if (AppSettings.Servers.Count == 0)
            {
                using (TimedLock.Lock(AppSettings.Servers))
                {
                    if (AppSettings.Servers.Count == 0)
                    {
                        String   iplist   = configLines[0].Trim();
                        String[] ips      = iplist.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
                        String   portlist = configLines[1].Trim();
                        String[] ports    = portlist.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);

                        for (int i = 0; i < ips.Length; i++)
                        {
                            AppSettings.Servers.Add(new AppFramework.AppClasses.AppSettings.ServerIPAndPort(ips[i], int.Parse(ports[i])));
                        }
                    }
                }
            }

            try
            {
                MySqlDatabaseHandler dbHandler = new MySqlDatabaseHandler();
            }
            catch (Exception e)
            {
                Infolog.writeToEventLog(e, InfoType.Error);
                if (System.Threading.Thread.CurrentThread.GetApartmentState() == System.Threading.ApartmentState.STA)
                {
                    MessageBox.Show("Unable to establish server connection to server. Please view event logs for further details");
                }
                Environment.Exit(205);
            }
        }