Пример #1
0
        public static List <TransportatiionTable> PrintfData()
        {
            TransportatiionModel context = new TransportatiionModel();
            var list = context.TransportatiionTable.ToList();

            return(list);
        }
Пример #2
0
        public static List <string> SetCombox_2()
        {
            TransportatiionModel context = new TransportatiionModel();
            var           listTest       = context.TransportatiionTable.ToList();
            var           data           = listTest.GroupBy((x) => x.EndState);
            List <string> list           = new List <string>();

            foreach (var d in data)
            {
                list.Add(d.Key);
            }
            return(list);
        }
Пример #3
0
 public static void SetData()
 {
     SetList();
     foreach (var index in listTest)
     {
         try
         {
             TransportatiionModel context = new TransportatiionModel();
             context.TransportatiionTable.Add(index);
             context.SaveChanges();
         }
         catch
         {
         }
     }
 }
Пример #4
0
        public static void CheckBoxCheck(bool radio1, bool check1, bool check2, string combox1, string combox2)
        {
            Discount = 0;
            Price    = 0;
            TransportatiionTable v;
            TransportatiionModel context = new TransportatiionModel();
            var listTest = context.TransportatiionTable.ToList();

            if (radio1)
            {
                v = listTest.FirstOrDefault((x) => x.StartState == combox1 && x.EndState == combox2);
            }
            else
            {
                v = listTest.FirstOrDefault((x) => x.EndState == combox1 && x.StartState == combox2);
            }
            if (check1 && check2)
            {
                Discount = 0.81M;
                Price    = v.Price * 2;
            }
            else if (check1 || check2)
            {
                Discount = 0.9M;
                if (check1)
                {
                    Price = v.Price * 2;
                }
                else if (check2)
                {
                    Price = v.Price;
                }
            }
            else
            {
                Discount = 1;
                Price    = v.Price;
            }
        }
Пример #5
0
        public static List <string> SelectIndexChange(bool radio1, string combox1)
        {
            List <string>        list1   = new List <string>();
            TransportatiionModel context = new TransportatiionModel();
            var listTest = context.TransportatiionTable.ToList();

            if (radio1)
            {
                var data = listTest.Where((x) => x.StartState == combox1);
                foreach (var d in data)
                {
                    list1.Add(d.EndState);
                }
            }
            else
            {
                var data = listTest.Where((x) => x.EndState == combox1);
                foreach (var d in data)
                {
                    list1.Add(d.StartState);
                }
            }
            return(list1);
        }