Example #1
0
        protected void btnCreateUpdateLogTables_Click(object sender, EventArgs e)
        {
            TrackerTools _TT = new TrackerTools();

            _TT.ClearTrackerSessionErrorString();
            TrackerDb _TDB = new TrackerDb();

            // create LogTbl if it does not exist

            _TDB.CreateIfDoesNotExists(TrackerDb.SQLTABLENAME_LOGTBL);
            ltrlStatus.Visible = true;
            ltrlStatus.Text    = "Log table checked";
            if (_TT.IsTrackerSessionErrorString())
            {
                ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                _TT.ClearTrackerSessionErrorString();
            }

            // list all the users that are not added
            PersonsTbl    _PersonsTbl = new PersonsTbl();
            List <string> _SecurityUsersNotInPeopleTbl = _PersonsTbl.SecurityUsersNotInPeopleTbl();

            pnlSetClinetType.Visible = true;
            gvCustomerTypes.Visible  = false;
            gvResults.DataSource     = _SecurityUsersNotInPeopleTbl;
            ResultsTitleLabel.Text   = "Security Users not in People Table ";
            if (_TT.IsTrackerSessionErrorString())
            {
                ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                _TT.ClearTrackerSessionErrorString();
            }

            gvResults.DataBind();

            // create SectionTypesTbl if it does not exist
            if (_TDB.CreateIfDoesNotExists(TrackerDb.SQLTABLENAME_SECTIONTYPESTBL))
            {
                ltrlStatus.Text += "; Section Types table checked";
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
                // add sections that do
                SectionTypesTbl _SectionTypeTbl = new SectionTypesTbl();
                if (_SectionTypeTbl.InsertDefaultSections())
                {
                    ltrlStatus.Text += " - default sections added.";
                }
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
            }
            // create TransactionTypesTbl if it does not exists
            if (_TDB.CreateIfDoesNotExists(TrackerDb.SQLTABLENAME_TRANSACTIONTYPESTBL))
            {
                ltrlStatus.Text += "; Transaction Types table checked";
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
                // add Transactions that do
                TransactionTypesTbl _TransactionTypeTbl = new TransactionTypesTbl();
                if (_TransactionTypeTbl.InsertDefaultTransactions())
                {
                    ltrlStatus.Text += " - default Transactions added.";
                }
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
            }

            _TDB.Close();
        }