Esempio n. 1
0
        /**
         * method refreshCustomerList
         * accepts a CustomerCollection and
         * fill the repeater with it.
         * Also refresh the Dashboard stats
         * NOTE: Not very efficient
         */
        protected void refreshCustomerList(CustomerCollection cc)
        {
            Repeater1.DataSource = cc;
            Repeater1.DataBind();

            //fill Dashboard values
            CustomerCollection cc2 = new CustomerCollection();

            //Odd
            if (!cc2.getCustomersOdd())
            {
                //error
                lblError.Text = cc.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBOdd.Text = cc2.Count.ToString();
            }

            //Even
            if (!cc2.getCustomerEven())
            {
                //error
                lblError.Text = cc.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBEven.Text = cc2.Count.ToString();
            }

            //Family
            int famResult = cc2.getCustomerFamily();
            if (famResult == -1)
            {
                //error
                lblError.Text = cc.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBFamily.Text = famResult.ToString();
            }

            //Contacts
            ContactCollection concol = new ContactCollection();
            if (! concol.getAllContactsToday())
            {
                //error
                lblError.Text = concol.errorMessage;
                lblError.Visible = true;
            }
            else
            {
                lblDBToday.Text = concol.Count.ToString();
            }
        }