//
 // GET: /My/
 public ActionResult Index(myModel myM, string myButton)
 {
     if (myButton == "+")
     {
         myM.resultFraction = myM.firstFraction + myM.secondFraction;
     }
     if (myButton == "-")
     {
         myM.resultFraction = myM.firstFraction - myM.secondFraction;
     }
     return(View(myM));
 }
示例#2
0
        public ActionResult Index(myModel myM, string myButton)
        {
            if (myButton == "+")
            {
                ViewBag.result = myM.num1 + myM.num2;
            }
            if (myButton == "-")
            {
                ViewBag.result = myM.num1 - myM.num2;
            }

            return(View());
        }
示例#3
0
        public JsonResult PlusMinusAction(string str)
        {
            JavaScriptSerializer myJavaScriptSerializer = new JavaScriptSerializer();
            myModel myM = (myModel)myJavaScriptSerializer.Deserialize(str, typeof(myModel));

            int result = 0;

            if (myM.action == "Plus")
            {
                result = myM.num1 + myM.num2;
            }
            if (myM.action == "Minus")
            {
                result = myM.num1 - myM.num2;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public ActionResult Index(myModel order)
        {
            String selectedType = Enum.GetName(typeof(myModel.SubType), order.subType);
            String selectedSize = Enum.GetName(typeof(myModel.SubSize), order.subSize);
            String selectedDeal = Enum.GetName(typeof(myModel.Deals), order.mealDeals);
            Double typePrice    = getTypePrice(selectedType);
            Double sizePrice    = getSizePrice(selectedSize);
            Double dealPrice    = getDealPrice(selectedDeal);
            Double subPrice     = typePrice * sizePrice;
            double beforeTax    = subPrice + dealPrice;
            double afterTax     = beforeTax * (1 + (TPS + TVQ));
            double taxAmount    = afterTax - beforeTax;

            ViewBag.type      = selectedType;
            ViewBag.size      = selectedSize;
            ViewBag.subPrice  = subPrice;
            ViewBag.deal      = selectedDeal;
            ViewBag.dealPrice = dealPrice;
            ViewBag.beforeTax = beforeTax;
            ViewBag.taxAmount = taxAmount;
            ViewBag.afterTax  = afterTax;
            return(View("Receipt"));
        }
示例#5
0
        static void Main(string[] args)
        {
            string line;

            // Read the file and display it line by line.
            System.IO.StreamReader file =
                new System.IO.StreamReader("test03.TXT");

            myModel context = new myModel();

            while ((line = file.ReadLine()) != null)
            {
                char[] temp = line.ToCharArray();
                if (checkFirstFormat(temp) == true)
                {
                    string index0_12  = String.Empty;
                    string index13_20 = String.Empty;
                    string index21_28 = String.Empty;

                    for (int i = 0; i < temp.Count(); i++)
                    {
                        if (i >= 0 && i <= 12)
                        {
                            index0_12 = index0_12 + temp[i];
                        }
                        else if (i >= 13 && i <= 20)
                        {
                            index13_20 = index13_20 + temp[i];
                        }
                        else if (i >= 21 && i <= 28)
                        {
                            index21_28 = index21_28 + temp[i];
                        }
                    }

                    // Console.WriteLine(index0_12 + " " + index13_20 + " " + index21_28);

                    if (index13_20 == "99999999")
                    {
                        DateTable data = new DateTable()
                        {
                            TickNumber = index0_12,
                            FlyingDay  = DateTime.MaxValue,
                            Birthday   = DateTime.ParseExact(index21_28, "yyyyMMdd", null)
                        };

                        context.DateTable.Add(data);
                        context.SaveChanges();
                    }
                    else
                    {
                        DateTable data = new DateTable()
                        {
                            TickNumber = index0_12,
                            FlyingDay  = DateTime.ParseExact(index13_20, "yyyyMMdd", null),
                            Birthday   = DateTime.ParseExact(index21_28, "yyyyMMdd", null)
                        };

                        context.DateTable.Add(data);
                        context.SaveChanges();
                    }
                }
            }


            var list = context.DateTable.ToList();

            foreach (var l in list)
            {
                Console.WriteLine(l.TickNumber + " " + l.FlyingDay.ToString("yyyy/MM/dd") + " " + l.Birthday.ToString("yyyy/MM/dd"));
            }


            file.Close();
            Console.ReadLine();
        }
示例#6
0
        public async Task <JsonResult> NextStepAction(int index, int empty, string background, string button)
        {
            myModel res = await Task.Run(() => NextStep(index, empty, background, button));

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Minus(myModel myM)
 {
     ViewBag.result = myM.num1 - myM.num2;
     return(View());
 }