Esempio n. 1
0
        public bool UpdateVolumes(VolumeList volumes, int periodTy, int periodID, bool IsCurrent)
        {
            //need to decide if we're going to do partial loads/deltas

            if (Configuration == null)
            {
                throw new Exception("Configuration object not set up");
            }

            if (Configuration.VolumeConfig == null)
            {
                throw new Exception("Volume Configuration not set up");
            }


            VolumeConfiguration config = Configuration.VolumeConfig;
            int bucketCount            = config.VolumeFields.Count;

            SqlConnection conn = GetConnection();
            IDataReader   rd   = null;

            try
            {
                BeginTrace("UpdateVolumes");

                volumes.Clear();

                SqlCommand cmd = GetVolumeCommand(conn, config, periodTy, periodID);

                rd = cmd.ExecuteReader();

                while (rd.Read())
                {
                    Volume sv = new Volume(bucketCount);

                    PopulateVolumeFromReader(rd, sv, config);

                    Customer c = null;
                    if (Customers.TryGetValue(sv.CustomerID, out c) && IsCurrent)
                    {
                        c.Volume = sv;
                    }
                    volumes.Add(rd.GetInt32(0), sv);
                }
                EndTrace("UpdateVolumes", $"PeriodVolume Refresh PeriodTy {periodTy}, PeriodID {periodID}");
            }
            finally
            {
                if (rd != null)
                {
                    rd.Close();
                }
                ReturnConnection(conn);
            }
            return(true);
        }
Esempio n. 2
0
 public void Initialize()
 {
     UnilevelTree = new Tree();
     EnrollerTree = new Tree();
     BinaryTree   = new Tree();
     Customers    = new CustomerList()
     {
         Modified = new DateTime(2000, 1, 1)
     };
     Orders = new OrderList()
     {
         Modified = new DateTime(2000, 1, 1)
     };
     Volumes         = new VolumeList();
     PreviousVolumes = new VolumeList();
 }