示例#1
0
        public DBHelper(string partnerName)
        {
            string ConnectionString;
            bool   dbtrace;

            try
            {
                ConnectionString = GetWebConfig(partnerName, out dbtrace);
            }
            catch (Exception e)
            {
                Exception WebConfigError = new Exception("WebConfigError: File format error", e);
                throw (WebConfigError);
            }

            if (ConnectionString == null)
            {
                Exception WebConfigContentsMissing = new Exception("WebConfigError: No ConnectionString matches Partner Name");
                throw (WebConfigContentsMissing);
            }

            try
            {
                db = new Database(ConnectionString);
            }
            catch (Exception e)
            {
                Exception WebConfigContentsError = new Exception("WebConfigError: Database connection failed", e);
                throw (WebConfigContentsError);
            }

            if (dbtrace)
            {
                try
                {
                    Wlsystem pkg = new Wlsystem(db);
                    pkg.StartLog("syncws", "IIS", "0");
                }
                catch (Exception e)
                {
                    Exception WebConfigContentsError = new Exception("WebConfigError: Failed to start logging", e);
                    throw (WebConfigContentsError);
                }
            }

            return;
        }
示例#2
0
        public WarehouseException(string alarmId, Database database, string localizationCode)
        {
            string nlangcod = "";

            this.alarmId = alarmId;
            alarmText    = "";

            // no conversion needed (?), only to uppercase
            nlangcod = localizationCode.ToUpper();

            try
            {
                Wlsystem pkg = new Wlsystem(database);
                pkg.Getalmtxt(alarmId, nlangcod, ref alarmText);
            }
            catch (Exception e)
            {
                alarmText = e.Message;
            }
        }