コード例 #1
0
        public int GetMostSellingName()
        {
            List <int> high     = new List <int>();
            int        maxvalue = int.MinValue;

            // int indes
            using (var context = new ApplesoftEntities())
            {
                for (int x = 1; x <= context.Stores.Count(); x++)
                {
                    count = context.cutomers.Where(o => o.storeID == x).Count();
                    high.Add(count);
                }

                foreach (var hi in high)
                {
                    if (hi > maxvalue)
                    {
                        maxvalue = hi;
                    }
                }
                if (high.IndexOf(maxvalue) == 0)
                {
                    return(high.IndexOf(maxvalue) + 1);
                }
                else
                {
                    return(high.IndexOf(maxvalue));
                }
            }
        }
コード例 #2
0
        public List <int> GetMostSelling()
        {
            List <int> tem = new List <int>();

            using (var context = new ApplesoftEntities())
            {
                for (int x = 1; x <= context.Stores.Count(); x++)
                {
                    count = context.cutomers.Where(o => o.storeID == x).Count();
                    tem.Add(count);
                }
            }

            return(tem);
        }
コード例 #3
0
        public IEnumerable <Store> GetStoreCustomer()
        {
            List <Store> tempss = new List <Store>();

            using (var context = new ApplesoftEntities())
            {
                for (int x = 1; x <= context.Stores.Count(); x++)
                {
                    context.cutomers.Where(o => o.storeID == x).Count();
                    var blog = context.Stores
                               .Where(b => b.storeID == x)
                               .FirstOrDefault();
                    tempss.Add(blog);

                    // tem.Add(count);
                }
            }
            return(tempss);
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: PeterMakwakwa/git
        private void button1_Click(object sender, EventArgs e)
        {
            //myspeechReader = new SpeechSynthesizer();
            myspeechReader.SpeakAsync("Woohoo!!!!!!!!!");

            LogFile(comboBox1.Text, DateTime.Now); // calling my logfile function

            // MessageBox.Show(comboBox1.SelectedIndex.ToString());

            var customers = new cutomer
            {
                storeID = comboBox1.SelectedIndex + 1,
                Dates   = DateTime.Now
            };

            if (comboBox1.SelectedIndex >= 0)
            {
                //apllesEntity.GetAll();
                var context = new ApplesoftEntities();

                if (comboBox1.SelectedIndex == 0)
                {
                    using (var unitofwork = new UnitOfWork(new ApplesoftEntities()))
                    {
                        unitofwork.customer.Add(customers);
                        unitofwork.Complete();
                    }
                }
                else
                {
                    using (var unitofwork = new UnitOfWork(new ApplesoftEntities()))
                    {
                        unitofwork.customer.Add(customers);
                        unitofwork.Complete();
                    }
                }
            }
        }
コード例 #5
0
 public Customers(ApplesoftEntities context)
     : base(context)
 {
 }
コード例 #6
0
ファイル: UnitOfWork.cs プロジェクト: PeterMakwakwa/git
 public UnitOfWork(ApplesoftEntities contxt)
 {
     context  = contxt;
     Store    = new ShopsRepository(context);
     customer = new Customers(context);
 }
コード例 #7
0
ファイル: ShopsRepository.cs プロジェクト: PeterMakwakwa/git
 public ShopsRepository(ApplesoftEntities context)
     : base(context)
 {
 }