Createcustomer() public method

public Createcustomer ( global customer_id, global store_id, global first_name, global last_name, global address_id, global active, global create_date, global last_update, string email ) : SCustomer
customer_id global
store_id global
first_name global
last_name global
address_id global
active global
create_date global
last_update global
email string
return SCustomer
Exemplo 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());
        }
Exemplo n.º 2
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");
 }
Exemplo 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");
        }
Exemplo n.º 4
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>());
        }
Exemplo n.º 5
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>());
        }
Exemplo n.º 6
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>();
        }
Exemplo n.º 7
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>();
 }
Exemplo n.º 8
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();
        }