예제 #1
0
 public async void SetStationInfo()
 {
     await Task.Factory.StartNew(() =>
     {
         Dispatcher.Invoke(() => RadioName.BeginAnimation(Label.OpacityProperty, AnimDown));          //NOT WORKING
         Dispatcher.Invoke(() => RadioArtist.BeginAnimation(Label.OpacityProperty, AnimDown));        //NOT WORKING
         Dispatcher.Invoke(() => RadioSongName.BeginAnimation(Label.OpacityProperty, AnimDown));      //NOT WORKING
         Dispatcher.Invoke(() => RadioInfo.BeginAnimation(Label.OpacityProperty, AnimDown));          //NOT WORKING
         Dispatcher.Invoke(() => RadioLogo.BeginAnimation(Image.OpacityProperty, AnimDown));          //NOT WORKING
     })
     .ContinueWith((prevTask) =>
     {
         prevTask.Wait();
         Dispatcher.Invoke(() => ClearStationInfo());
         Dispatcher.Invoke(() => RadioName.Content     = StationToPlay.StationName);
         Dispatcher.Invoke(() => RadioArtist.Content   = StationToPlay.TrackArtist);
         Dispatcher.Invoke(() => RadioSongName.Content = StationToPlay.TrackName);
         Dispatcher.Invoke(() => RadioInfo.Content     = StationToPlay.ChannelInfo);
         Dispatcher.Invoke(() => RadioLogo.Source      = StationToPlay.TrackPicture);
     })
     .ContinueWith((prevTask) =>
     {
         prevTask.Wait();
         Dispatcher.Invoke(() => RadioName.BeginAnimation(Label.OpacityProperty, AnimHigh));
         Dispatcher.Invoke(() => RadioArtist.BeginAnimation(Label.OpacityProperty, AnimHigh));
         Dispatcher.Invoke(() => RadioSongName.BeginAnimation(Label.OpacityProperty, AnimHigh));
         Dispatcher.Invoke(() => RadioInfo.BeginAnimation(Label.OpacityProperty, AnimHigh));
         Dispatcher.Invoke(() => RadioLogo.BeginAnimation(Image.OpacityProperty, AnimHigh));
     });
 }
        public ActionResult AddToOrder(FormCollection form)
        {
            if (Session["CartID"] == null)
            {
                return(RedirectToAction("Index", "FundOverview"));
            }
            List <ShoppingCart> cartList          = new List <ShoppingCart>();
            List <string>       checkRecordIDList = new List <string>();

            foreach (var RadioName in form.AllKeys)
            {
                string recordId = RadioName.Split('_')[1];

                if (!checkRecordIDList.Contains(recordId))
                {
                    checkRecordIDList.Add(recordId);
                }
            }
            foreach (var recordId in checkRecordIDList)
            {
                ShoppingCart shoppingcart = (from shop in db.ShoppingCart
                                             where shop.RecordID == recordId && shop.IsOrdered == false
                                             select shop).FirstOrDefault();

                shoppingcart.IsOrdered = true;
                cartList.Add(shoppingcart);
            }
            foreach (var RadioName in form.AllKeys)
            {
                string recordId = RadioName.Split('_')[1];
                foreach (ShoppingCart items in cartList)
                {
                    if (items.RecordID == recordId)
                    {
                        string value       = form[RadioName];
                        string controlName = RadioName.Split('_')[0];


                        switch (controlName)
                        {
                        case "currencyA":
                            var bankAccount = from a in fbc.GetAll()
                                              where a.TradeCurrencyCode == value
                                              select a.BankAccountID;
                            foreach (var account in bankAccount)
                            {
                                items.BankAccountID = account;
                            }

                            break;

                        case "textA":
                            int result = 0;
                            if (int.TryParse(value, out result))
                            {
                                items.TradePrice = result;
                                items.Amount     = result + (result * items.FundGoods.ChargeFee.ChargeFeePercentage / 100);
                            }

                            break;

                        case "date":
                            items.ChargeDateCode = value;

                            break;

                        case "currencyB":
                            var bankAccount2 = from a in fbc.GetAll()
                                               where a.TradeCurrencyCode == value
                                               select a.BankAccountID;
                            foreach (var account in bankAccount2)
                            {
                                items.BankAccountID = account;
                            }

                            break;

                        case "textB":
                            int result2 = 0;
                            if (int.TryParse(value, out result2))
                            {
                                items.TradePrice        = result2;
                                items.TradePricePerTime = result2 + (result2 * items.FundGoods.ChargeFee.ChargeFeePercentage / 100);
                            }

                            break;
                        }
                    }
                }

                db.SaveChanges();
            }


            return(RedirectToAction("CreatOrder"));
        }