Example #1
0
        private TrackerTools.ContactPreferedItems SetPrepAndDeliveryValues(long pCustomerID)
        {
            DateTime     _DeliveryDate = DateTime.Now.Date;
            TrackerTools _TT           = new classes.TrackerTools(); // . from TrackerDotNet.classes.

            DateTime _dtNextRoastDay = _TT.GetNextRoastDateByCustomerID(pCustomerID, ref _DeliveryDate);

            TrackerTools.ContactPreferedItems _ContactPreferedItems = _TT.RetrieveCustomerPrefs(pCustomerID);

            // set dates
            tbxRoastDate.Text      = String.Format("{0:d}", _dtNextRoastDay);
            tbxRequiredByDate.Text = String.Format("{0:d}", _DeliveryDate);
            // make sure the default delivery person can delvier on that day
            PersonsTbl _Person     = new PersonsTbl();
            int        _DeliveryBy = _Person.IsNormalDeliveryDoW(_ContactPreferedItems.DeliveryByID, (int)(_DeliveryDate.DayOfWeek) + 1) ?
                                     _ContactPreferedItems.DeliveryByID : TrackerTools.CONST_DEFAULT_DELIVERYBYID;

            // ad a note if we changed it
            if (!_DeliveryBy.Equals(_ContactPreferedItems.DeliveryByID))
            {
                tbxNotes.Text += ((tbxNotes.Text.Length > 0) ? " " : "") + "!!!default delivery person changed due to DoW calculation";
            }
            if (ddlToBeDeliveredBy.Items.FindByValue(_DeliveryBy.ToString()) != null)
            {
                ddlToBeDeliveredBy.SelectedValue = _DeliveryBy.ToString();
            }
            if (_ContactPreferedItems.RequiresPurchOrder)
            {
                tbxPurchaseOrder.Text = TrackerTools.CONST_POREQUIRED;
            }

            return(_ContactPreferedItems);
        }
Example #2
0
        public string GetPersonsNameFromID(string pPersonsID)
        {
            string _Name      = "anon";
            int    _PersonsID = 0;

            if (!Int32.TryParse(pPersonsID, out _PersonsID))
            {
                _PersonsID = 0;
            }
            PersonsTbl _Person = new PersonsTbl();

            if (_PersonsID > 0)
            {
                _Name = _Person.PersonsNameFromID(_PersonsID);
            }

            return(_Name);
        }
Example #3
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();
        }