Esempio n. 1
0
        public override SCustomer[] GetRewardsReport(
            Nullable <global::System.SByte> min_monthly_purchases,
            Nullable <global::System.Decimal> min_dollar_amount_purchased,
            int count_rewardees)
        {
            List <SCustomer> scustomerList = new List <SCustomer>();

            using (SakilaEntities entitities = new SakilaEntities())
            {
                ObjectParameter cntRewardees = new ObjectParameter("count_rewardees", count_rewardees);
                List <customer> contactList  = entitities.GetRewardsReport(min_monthly_purchases.Value, min_dollar_amount_purchased.Value, cntRewardees).ToList <customer>();
                count_rewardees = (int)cntRewardees.Value;

                simulator.PerformanceSimulation();

                for (int i = 0; i < contactList.Count; i++)
                {
                    SCustomer scustomer = new SCustomer();
                    scustomer = scustomer.Createcustomer(
                        contactList[i].customer_id,
                        contactList[i].store_id,
                        contactList[i].first_name,
                        contactList[i].last_name,
                        contactList[i].address_id,
                        contactList[i].active,
                        contactList[i].create_date,
                        contactList[i].last_update,
                        contactList[i].email
                        );
                    scustomerList.Add(scustomer);
                }
            }
            return(scustomerList.ToArray());
        }
        public SCustomer Createcustomer(global::System.Int32 customer_id, global::System.Byte store_id, global::System.String first_name, global::System.String last_name, global::System.Int32 address_id, global::System.Boolean active, global::System.DateTime create_date, global::System.DateTime last_update, string email)
        {
            SCustomer customer = new SCustomer();

            customer.customer_id = customer_id;
            customer.store_id    = store_id;
            customer.first_name  = first_name;
            customer.last_name   = last_name;
            customer.address_id  = address_id;
            customer.active      = active;
            customer.create_date = create_date;
            customer.last_update = last_update;
            customer.email       = email;
            return(customer);
        }
Esempio n. 3
0
 public override SCustomer GetCustomer(int id)
 {
     using (SakilaEntities dc = new SakilaEntities())
     {
         var model = from c in dc.customers
                     where c.customer_id == id
                     orderby (c.first_name)
                     select c;
         List<customer> contactList = model.ToList<customer>();
         if (contactList.Count > 0)
         {
             SCustomer scustomer = new SCustomer();
             simulator.PerformanceSimulation();
             scustomer = scustomer.Createcustomer(contactList[0].customer_id, contactList[0].store_id, contactList[0].first_name, contactList[0].last_name, contactList[0].address_id, contactList[0].active, contactList[0].create_date, contactList[0].last_update, contactList[0].email);
             return scustomer;
         }
     }
     throw new Exception("no data found");
 }
Esempio n. 4
0
        public override SCustomer GetCustomer(int id)
        {
            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from c in dc.customers
                            where c.customer_id == id
                            orderby(c.first_name)
                            select c;

                List <customer> contactList = model.ToList <customer>();
                if (contactList.Count > 0)
                {
                    SCustomer scustomer = new SCustomer();
                    simulator.PerformanceSimulation();
                    scustomer = scustomer.Createcustomer(contactList[0].customer_id, contactList[0].store_id, contactList[0].first_name, contactList[0].last_name, contactList[0].address_id, contactList[0].active, contactList[0].create_date, contactList[0].last_update, contactList[0].email);
                    return(scustomer);
                }
            }
            throw new Exception("no data found");
        }
Esempio n. 5
0
        public override SCustomer[] GetCustomersByText(string searchtext)
        {
            List <SCustomer> scustomerlist = new List <SCustomer>();

            simulator.PerformanceSimulation();

            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from c in dc.customers
                            where c.first_name.Contains(searchtext) || c.last_name.Contains(searchtext)
                            orderby(c.first_name)
                            select c;
                List <customer> contactList = model.ToList <customer>();
                for (int i = 0; i < contactList.Count; i++)
                {
                    SCustomer scustomer = new SCustomer();
                    scustomer = scustomer.Createcustomer(contactList[i].customer_id, contactList[i].store_id, contactList[i].first_name, contactList[i].last_name, contactList[i].address_id, contactList[i].active, contactList[i].create_date, contactList[i].last_update, contactList[i].email);
                    scustomerlist.Add(scustomer);
                }
            }
            return(scustomerlist.ToArray <SCustomer>());
        }
Esempio n. 6
0
        public override SCustomer[] GetCustomersByText(string searchtext)
        {
            List <SCustomer> scustomerlist = new List <SCustomer>();

            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from c in dc.customers
                            where c.first_name.Contains(searchtext) || c.last_name.Contains(searchtext)
                            orderby(c.first_name)
                            select c;
                List <customer> contactList = model.ToList <customer>();
                foreach (customer cust in contactList)
                {
                    //high freq sql calls again and again to reconstruct object, terrible pattern
                    //this should increase the sql calls by a magnitude of 2 orders (in a production environment)
                    var mymodel = from c in dc.customers
                                  where c.customer_id == cust.customer_id
                                  select c;
                    List <customer> slowcustomerlist = mymodel.ToList <customer>();
                    customer        locCust          = slowcustomerlist[0];
                    SCustomer       scustomer        = new SCustomer();
                    scustomer = scustomer.Createcustomer(
                        locCust.customer_id,
                        locCust.store_id,
                        locCust.first_name,
                        locCust.last_name,
                        locCust.address_id,
                        locCust.active,
                        locCust.create_date,
                        locCust.last_update,
                        locCust.email);
                    scustomerlist.Add(scustomer);
                }
            }
            simulator.PerformanceSimulation();
            return(scustomerlist.ToArray <SCustomer>());
        }
Esempio n. 7
0
        public override SCustomer[] GetCustomers()
        {
            List<SCustomer> scustomerlist = new List<SCustomer>();

            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from c in dc.customers
                            orderby (c.first_name)
                            select c;
                List<customer> contactList = model.ToList<customer>();

                simulator.PerformanceSimulation();

                for (int i = 0; i < contactList.Count; i++)
                {
                    SCustomer scustomer = new SCustomer();
                    scustomer = scustomer.Createcustomer(contactList[i].customer_id, contactList[i].store_id, contactList[i].first_name, contactList[i].last_name, contactList[i].address_id, contactList[i].active, contactList[i].create_date, contactList[i].last_update, contactList[i].email);
                    scustomerlist.Add(scustomer);
                }
            }
            return scustomerlist.ToArray<SCustomer>();
        }
Esempio n. 8
0
 public override SCustomer[] GetCustomersByText(string searchtext)
 {
     List<SCustomer> scustomerlist = new List<SCustomer>();
     using (SakilaEntities dc = new SakilaEntities())
     {
         var model = from c in dc.customers
                     where c.first_name.Contains(searchtext) || c.last_name.Contains(searchtext)
                     orderby (c.first_name)
                     select c;
         List<customer> contactList = model.ToList<customer>();
         foreach  (customer cust in contactList)
         {
             //high freq sql calls again and again to reconstruct object, terrible pattern
             //this should increase the sql calls by a magnitude of 2 orders (in a production environment)
             var mymodel = from c in dc.customers
                         where c.customer_id == cust.customer_id
                         select c;
             List<customer> slowcustomerlist = mymodel.ToList<customer>();
             customer locCust = slowcustomerlist[0];
             SCustomer scustomer = new SCustomer();
             scustomer = scustomer.Createcustomer(
                 locCust.customer_id,
                 locCust.store_id,
                 locCust.first_name,
                 locCust.last_name,
                 locCust.address_id,
                 locCust.active,
                 locCust.create_date,
                 locCust.last_update,
                 locCust.email);
             scustomerlist.Add(scustomer);
         }
     }
     simulator.PerformanceSimulation();
     return scustomerlist.ToArray<SCustomer>();
 }
Esempio n. 9
0
        public override SCustomer[] GetRewardsReport(
                                            Nullable<global::System.SByte> min_monthly_purchases,
                                            Nullable<global::System.Decimal> min_dollar_amount_purchased,
                                            int count_rewardees)
        {
            List<SCustomer> scustomerList = new List<SCustomer>();
            using (SakilaEntities entitities = new SakilaEntities())
            {
                ObjectParameter cntRewardees = new ObjectParameter("count_rewardees", count_rewardees);
                List<customer> contactList = entitities.GetRewardsReport(min_monthly_purchases.Value, min_dollar_amount_purchased.Value, cntRewardees).ToList<customer>();
                count_rewardees = (int)cntRewardees.Value;

                simulator.PerformanceSimulation();

                for (int i = 0; i < contactList.Count; i++)
                {
                    SCustomer scustomer = new SCustomer();
                    scustomer = scustomer.Createcustomer(
                                                        contactList[i].customer_id,
                                                        contactList[i].store_id,
                                                        contactList[i].first_name,
                                                        contactList[i].last_name,
                                                        contactList[i].address_id,
                                                        contactList[i].active,
                                                        contactList[i].create_date,
                                                        contactList[i].last_update,
                                                        contactList[i].email
                                                        );
                    scustomerList.Add(scustomer);
                }
            }
            return scustomerList.ToArray();
        }
 public SCustomer Createcustomer(global::System.Int32 customer_id, global::System.Byte store_id, global::System.String first_name, global::System.String last_name, global::System.Int32 address_id, global::System.Boolean active, global::System.DateTime create_date, global::System.DateTime last_update, string email)
 {
     SCustomer customer = new SCustomer();
     customer.customer_id = customer_id;
     customer.store_id = store_id;
     customer.first_name = first_name;
     customer.last_name = last_name;
     customer.address_id = address_id;
     customer.active = active;
     customer.create_date = create_date;
     customer.last_update = last_update;
     customer.email = email;
     return customer;
 }