コード例 #1
0
ファイル: objects.cs プロジェクト: zgramana/mono
 static bool large_struct_test(Large a, Large b, Large c, Large d)
 {
     if (!a.check())
     {
         return(false);
     }
     if (!b.check())
     {
         return(false);
     }
     if (!c.check())
     {
         return(false);
     }
     if (!d.check())
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
        /// <summary>
        /// Creates a new pizza object.
        /// </summary>
        /// <param name="size">The size of the pizza.</param>
        /// <returns>A new pizza object.</returns>
        public static Pizza CreatePizza(PizzaSize size)
        {
            Pizza pizza = null;

            switch (size)
            {
            case PizzaSize.Large:
                pizza = new Large();
                break;

            case PizzaSize.Medium:
                pizza = new Medium();
                break;

            case PizzaSize.Small:
                pizza = new Small();
                break;
            }

            return(pizza);
        }
コード例 #3
0
        static Dev2DecisionCallbackHandler ShowDecisionDialogWindow(ModelItem mi, DecisionDesignerViewModel dataContext)
        {
            var large = new Large {
                DataContext = dataContext
            };
            var window = new ActivityDefaultWindow();

            if (Application.Current != null)
            {
                window.Style = Application.Current.TryFindResource("DecisionWindowStyle") as Style;
            }
            var contentPresenter = window.FindChild <ContentPresenter>();

            if (contentPresenter != null)
            {
                contentPresenter.Content = large;
            }

            window.SetEnableDoneButtonState(true);
            var parentContentPane = FindDependencyParent.FindParent <DesignerView>(mi?.Parent?.View);
            var dataContext1      = parentContentPane?.DataContext;

            if (dataContext1 != null && dataContext1.GetType().Name == "ServiceTestViewModel")
            {
                window.SetEnableDoneButtonState(false);
            }


            var showDialog = window.ShowDialog();

            window.SetEnableDoneButtonState(true);
            if (showDialog.HasValue && showDialog.Value)
            {
                var dev2DecisionCallbackHandler = new Dev2DecisionCallbackHandler();
                dataContext.GetExpressionText();
                dev2DecisionCallbackHandler.ModelData = dataContext.ExpressionText;
                return(dev2DecisionCallbackHandler);
            }
            return(null);
        }
コード例 #4
0
        protected QueryNRowsBenchmark(int rowCount)
        {
            int32Sql  = $"SELECT TOP {rowCount} Int32.Value FROM Int32";
            stringSql = $"SELECT TOP {rowCount} String.Value FROM String";
            largeSql  = $"SELECT TOP {rowCount} {string.Join(", ", Large.GetAllPropertyNames().Select(name => "[" + name + "]"))} FROM Large";

            if (rowCount == 1000000)
            {
                int32Sql  += " CROSS JOIN Multiply";
                stringSql += " CROSS JOIN Multiply";
                largeSql  += " CROSS JOIN Multiply";
            }
            else if (rowCount > 1000000)
            {
                throw new NotSupportedException();
            }


            int32Query  = new DbQuery(int32Sql);
            stringQuery = new DbQuery(stringSql);
            largeQuery  = new DbQuery(largeSql);
        }
コード例 #5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ExtraLarge != null)
         {
             hashCode = hashCode * 59 + ExtraLarge.GetHashCode();
         }
         if (Large != null)
         {
             hashCode = hashCode * 59 + Large.GetHashCode();
         }
         if (Standard != null)
         {
             hashCode = hashCode * 59 + Standard.GetHashCode();
         }
         if (GridView != null)
         {
             hashCode = hashCode * 59 + GridView.GetHashCode();
         }
         if (Small != null)
         {
             hashCode = hashCode * 59 + Small.GetHashCode();
         }
         if (Thumbnail != null)
         {
             hashCode = hashCode * 59 + Thumbnail.GetHashCode();
         }
         if (ExtraSmall != null)
         {
             hashCode = hashCode * 59 + ExtraSmall.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #6
0
        /// <summary>
        /// Creates a vehicle of a given state dependent on selected customer type(null,pri,bus). Has inputbox fault logic to stop the creation of bugged inputs
        /// </summary>
        private void create_vehicle_click(object sender, RoutedEventArgs e)
        {
            bool car_null_exception     = false;
            bool truck_null_exception   = false;
            bool car_format_exception   = false;
            bool truck_format_exception = false;
            bool error_found_truck      = false;
            bool error_found_car        = false;

            string car_boxes_empty_string    = "";
            string truck_boxes_empty_string  = "";
            string car_wrong_format_string   = "";
            string truck_wrong_format_string = "";

            //selected private
            #region
            if (select_combobox_customer.SelectedValue is Private || select_combobox_customer.SelectedValue == null)
            {
                //Test if text boxes in the car section are empty.
                if (string.IsNullOrEmpty(textbox_car_model.Text) == true ||
                    string.IsNullOrEmpty(textbox_car_license.Text) == true ||
                    string.IsNullOrEmpty(textbox_car_price.Text) == true ||
                    string.IsNullOrEmpty(textbox_car_colour.Text) == true)
                {
                    car_boxes_empty_string = "You have forgotten to fill in informationboxes in your car informations\n";
                    car_null_exception     = true;
                }

                //Test if text boxes in the car section are in the right format
                if (IsALLnumeric(textbox_car_price.Text, false) == false)
                {
                    car_wrong_format_string = "Your have format errors in your car informations\n";
                    car_format_exception    = true;
                }
                if ((car_null_exception ||
                     car_format_exception) == true)
                {
                    MessageBox.Show(car_boxes_empty_string +
                                    car_wrong_format_string);
                    error_found_car = true;
                }
            }

            //selected business
            if (select_combobox_customer.SelectedValue is Business || select_combobox_customer.SelectedValue == null)
            {
                //Test if text boxes in the truck section are empty
                if (string.IsNullOrEmpty(textbox_truck_model.Text) == true ||
                    string.IsNullOrEmpty(textbox_truck_license.Text) == true ||
                    string.IsNullOrEmpty(textbox_truck_rent.Text) == true ||
                    string.IsNullOrEmpty(textbox_truck_colour.Text) == true)
                {
                    truck_boxes_empty_string = "You have forgotten to fill in informationboxes in your truck informations \n";
                    truck_null_exception     = true;
                }
                //Test if text boxes in the truck section are in the right format
                if (IsALLnumeric(textbox_truck_rent.Text, false) == false)
                {
                    truck_wrong_format_string = "Your have format errors in your truck informations\n";
                    truck_format_exception    = true;
                }
            }
            //If any of the boxes were in the wrong format or empty,
            //then show the messagebox notifying the user and break the finalize action.
            if ((truck_null_exception ||
                 truck_format_exception) == true)
            {
                MessageBox.Show(truck_boxes_empty_string +
                                truck_wrong_format_string);
                error_found_truck = true;
            }

            #endregion
            // if no errors found then complete the finalize action and bring up the finalize window.

            //check if private customer and create contract.
            if (error_found_car == false)
            {
                if (select_combobox_customer.SelectedValue == null)
                {
                    if (combo_veh_size_small_item.IsSelected) //Remember to add size parameter
                    {
                        Small myveh = new Small(textbox_car_colour.Text,
                                                textbox_car_model.Text,
                                                Convert.ToInt32(textbox_car_price.Text),
                                                "in stock",
                                                textbox_car_license.Text);

                        mycardealer.AddVehicle(myveh);
                    }
                    if (combo_veh_size_large_item.IsSelected)
                    {
                        Large myveh = new Large(textbox_car_colour.Text,
                                                textbox_car_model.Text,
                                                Convert.ToInt32(textbox_car_price.Text),
                                                "in stock",
                                                textbox_car_license.Text);

                        mycardealer.AddVehicle(myveh);
                    }


                    MessageBox.Show("Car Added");
                    this.comboBox_Del_Vehicle.ItemsSource = mycardealer.VehicleList;
                }

                if (select_combobox_customer.SelectedValue is Private)
                {
                    if (combo_veh_size_small_item.IsSelected) //Remember to add size parameter
                    {
                        Small myveh = new Small(textbox_car_colour.Text,
                                                textbox_car_model.Text,
                                                Convert.ToInt32(textbox_car_price.Text),
                                                "sold",
                                                textbox_car_license.Text);

                        mycardealer.AddVehicle(myveh);
                        Private b = (Private)select_combobox_customer.SelectedValue;
                        mycardealer.DeleteCustomer(b.Address);
                        Contract gui_contract = new Contract(myveh, "contract");

                        b.AddContract(gui_contract);
                        mycardealer.AddCustomer(b);
                        //MessageBox.Show("ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD contract\n");
                    }

                    if (combo_veh_size_large_item.IsSelected)
                    {
                        Large myveh = new Large(textbox_car_colour.Text,
                                                textbox_car_model.Text,
                                                Convert.ToInt32(textbox_car_price.Text),
                                                "sold",
                                                textbox_car_license.Text);

                        mycardealer.AddVehicle(myveh);
                        Private b = (Private)select_combobox_customer.SelectedValue;
                        //Delete the customer without the contract
                        mycardealer.DeleteCustomer(b.Address);
                        Contract gui_contract = new Contract(myveh, "contract");
                        b.AddContract(gui_contract);
                        //Update the new customer with the contract
                        mycardealer.AddCustomer(b);
                    }
                    //       mycardealer.SaveCustomersToFile();

                    this.comboBox_del_customer.ItemsSource = mycardealer.LoadCustomers();
//__________
                    this.select_combobox_customer.ItemsSource = mycardealer.CustomerList;

                    MessageBox.Show(mycardealer.ToString());
                }

                mycardealer.SaveVehiclesToFile();
            }
            //check if business customer and create lease.
            if (error_found_truck == false)
            {
                if (select_combobox_customer.SelectedValue == null)
                {
                    Truck myveh = new Truck(textbox_truck_colour.Text,
                                            textbox_truck_model.Text,
                                            Convert.ToInt32(textbox_truck_rent.Text),
                                            "in stock",
                                            textbox_truck_license.Text);

                    mycardealer.AddVehicle(myveh);
                    MessageBox.Show(mycardealer.ToString());
                    //this.comboBox_Del_Vehicle.ItemsSource = mycardealer.VehicleList;
                }

                if (select_combobox_customer.SelectedValue is Business)
                {
                    Truck myveh = new Truck(textbox_truck_colour.Text,
                                            textbox_truck_model.Text,
                                            Convert.ToInt32(textbox_truck_rent.Text),
                                            "leased",
                                            textbox_truck_license.Text);

                    mycardealer.AddVehicle(myveh);
                    Business b = (Business)select_combobox_customer.SelectedValue;
                    mycardealer.DeleteCustomer(b.Address);
                    Leasing gui_contract = new Leasing(myveh,
                                                       "truckContract",
                                                       Convert.ToInt32(textbox_truck_rent.Text),
                                                       datepicker_truck_start.SelectedDate,
                                                       datepicker_truck_end.SelectedDate);
                    b.AddLease(gui_contract);
                    mycardealer.AddCustomer(b);
                    MessageBox.Show(mycardealer.ToString());
                }

                mycardealer.SaveVehiclesToFile();
                this.comboBox_Del_Vehicle.ItemsSource = mycardealer.VehicleList;
                MessageBox.Show(mycardealer.ToString());
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: tracigitit/CSharp
        static void Main(string[] args)
        {
            Large two = Large.One + 1;

            Console.WriteLine(two);
        }
コード例 #8
0
 public void LargeShouldThrowIfIndexOutOfBounds()
 {
     var func   = new Large();
     var args   = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(4, 1, 2, 3), 6);
     var result = func.Execute(args, _parsingContext);
 }
コード例 #9
0
ファイル: BuiltInFunctions.cs プロジェクト: user20112/EPPlus
 public BuiltInFunctions()
 {
     // Text
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["rept"]        = new Rept();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     Functions["char"]        = new CharFunction();
     Functions["exact"]       = new Exact();
     Functions["find"]        = new Find();
     Functions["fixed"]       = new Fixed();
     Functions["proper"]      = new Proper();
     Functions["search"]      = new Search();
     Functions["text"]        = new Text.Text();
     Functions["t"]           = new T();
     Functions["hyperlink"]   = new Hyperlink();
     Functions["value"]       = new Value();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["abs"]         = new Abs();
     Functions["asin"]        = new Asin();
     Functions["asinh"]       = new Asinh();
     Functions["cos"]         = new Cos();
     Functions["cosh"]        = new Cosh();
     Functions["power"]       = new Power();
     Functions["sign"]        = new Sign();
     Functions["sqrt"]        = new Sqrt();
     Functions["sqrtpi"]      = new SqrtPi();
     Functions["pi"]          = new Pi();
     Functions["product"]     = new Product();
     Functions["ceiling"]     = new Ceiling();
     Functions["count"]       = new Count();
     Functions["counta"]      = new CountA();
     Functions["countblank"]  = new CountBlank();
     Functions["countif"]     = new CountIf();
     Functions["countifs"]    = new CountIfs();
     Functions["fact"]        = new Fact();
     Functions["floor"]       = new Floor();
     Functions["sin"]         = new Sin();
     Functions["sinh"]        = new Sinh();
     Functions["sum"]         = new Sum();
     Functions["sumif"]       = new SumIf();
     Functions["sumifs"]      = new SumIfs();
     Functions["sumproduct"]  = new SumProduct();
     Functions["sumsq"]       = new Sumsq();
     Functions["stdev"]       = new Stdev();
     Functions["stdevp"]      = new StdevP();
     Functions["stdev.s"]     = new Stdev();
     Functions["stdev.p"]     = new StdevP();
     Functions["subtotal"]    = new Subtotal();
     Functions["exp"]         = new Exp();
     Functions["log"]         = new Log();
     Functions["log10"]       = new Log10();
     Functions["ln"]          = new Ln();
     Functions["max"]         = new Max();
     Functions["maxa"]        = new Maxa();
     Functions["median"]      = new Median();
     Functions["min"]         = new Min();
     Functions["mina"]        = new Mina();
     Functions["mod"]         = new Mod();
     Functions["average"]     = new Average();
     Functions["averagea"]    = new AverageA();
     Functions["averageif"]   = new AverageIf();
     Functions["averageifs"]  = new AverageIfs();
     Functions["round"]       = new Round();
     Functions["rounddown"]   = new Rounddown();
     Functions["roundup"]     = new Roundup();
     Functions["rand"]        = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["rank"]        = new Rank();
     Functions["rank.eq"]     = new Rank();
     Functions["rank.avg"]    = new Rank(true);
     Functions["quotient"]    = new Quotient();
     Functions["trunc"]       = new Trunc();
     Functions["tan"]         = new Tan();
     Functions["tanh"]        = new Tanh();
     Functions["atan"]        = new Atan();
     Functions["atan2"]       = new Atan2();
     Functions["atanh"]       = new Atanh();
     Functions["acos"]        = new Acos();
     Functions["acosh"]       = new Acosh();
     Functions["var"]         = new Var();
     Functions["varp"]        = new VarP();
     Functions["large"]       = new Large();
     Functions["small"]       = new Small();
     Functions["degrees"]     = new Degrees();
     // Information
     Functions["isblank"]    = new IsBlank();
     Functions["isnumber"]   = new IsNumber();
     Functions["istext"]     = new IsText();
     Functions["isnontext"]  = new IsNonText();
     Functions["iserror"]    = new IsError();
     Functions["iserr"]      = new IsErr();
     Functions["error.type"] = new ErrorType();
     Functions["iseven"]     = new IsEven();
     Functions["isodd"]      = new IsOdd();
     Functions["islogical"]  = new IsLogical();
     Functions["isna"]       = new IsNa();
     Functions["na"]         = new Na();
     Functions["n"]          = new N();
     // Logical
     Functions["if"]      = new If();
     Functions["iferror"] = new IfError();
     Functions["ifna"]    = new IfNa();
     Functions["not"]     = new Not();
     Functions["and"]     = new And();
     Functions["or"]      = new Or();
     Functions["true"]    = new True();
     Functions["false"]   = new False();
     // Reference and lookup
     Functions["address"]  = new Address();
     Functions["hlookup"]  = new HLookup();
     Functions["vlookup"]  = new VLookup();
     Functions["lookup"]   = new Lookup();
     Functions["match"]    = new Match();
     Functions["row"]      = new Row();
     Functions["rows"]     = new Rows();
     Functions["column"]   = new Column();
     Functions["columns"]  = new Columns();
     Functions["choose"]   = new Choose();
     Functions["index"]    = new RefAndLookup.Index();
     Functions["indirect"] = new Indirect();
     Functions["offset"]   = new Offset();
     // Date
     Functions["date"]             = new Date();
     Functions["today"]            = new Today();
     Functions["now"]              = new Now();
     Functions["day"]              = new Day();
     Functions["month"]            = new Month();
     Functions["year"]             = new Year();
     Functions["time"]             = new Time();
     Functions["hour"]             = new Hour();
     Functions["minute"]           = new Minute();
     Functions["second"]           = new Second();
     Functions["weeknum"]          = new Weeknum();
     Functions["weekday"]          = new Weekday();
     Functions["days360"]          = new Days360();
     Functions["yearfrac"]         = new Yearfrac();
     Functions["edate"]            = new Edate();
     Functions["eomonth"]          = new Eomonth();
     Functions["isoweeknum"]       = new IsoWeekNum();
     Functions["workday"]          = new Workday();
     Functions["networkdays"]      = new Networkdays();
     Functions["networkdays.intl"] = new NetworkdaysIntl();
     Functions["datevalue"]        = new DateValue();
     Functions["timevalue"]        = new TimeValue();
     // Database
     Functions["dget"]     = new Dget();
     Functions["dcount"]   = new Dcount();
     Functions["dcounta"]  = new DcountA();
     Functions["dmax"]     = new Dmax();
     Functions["dmin"]     = new Dmin();
     Functions["dsum"]     = new Dsum();
     Functions["daverage"] = new Daverage();
     Functions["dvar"]     = new Dvar();
     Functions["dvarp"]    = new Dvarp();
     //Finance
     Functions["pmt"] = new Pmt();
 }
コード例 #10
0
ファイル: WeiboPicture.cs プロジェクト: advorange/ImageDL
 /// <summary>
 /// Returns the string value of the large image.
 /// </summary>
 /// <returns></returns>
 public override string ToString() => Large.ToString();
コード例 #11
0
        public List <Large> HandwrittenLarge()
        {
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }

            using (var command = new SqlCommand(Sql, connection))
            {
                command.Parameters.Add(new SqlParameter("@p1", p1));
                command.Parameters.Add(new SqlParameter("@p2", p2));
                command.Parameters.Add(new SqlParameter("@p3", p3));
                command.Parameters.Add(new SqlParameter("@p4", p4));
                command.Parameters.Add(new SqlParameter("@p5", p5));
                command.Parameters.Add(new SqlParameter("@p6", p6));
                command.Parameters.Add(new SqlParameter("@p7", p7));
                command.Parameters.Add(new SqlParameter("@p8", p8));
                command.Parameters.Add(new SqlParameter("@p9", p9));
                command.Parameters.Add(new SqlParameter("@p10", p10));

                using (var reader = command.ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.SequentialAccess))
                {
                    var result = new List <Large>();

                    while (reader.Read())
                    {
                        var item = new Large
                        {
                            Boolean  = reader.GetBoolean(0),
                            Byte     = reader.GetByte(1),
                            DateTime = reader.GetDateTime(2),
                            Decimal  = reader.GetDecimal(3),
                            Double   = reader.GetDouble(4),
                            Guid     = reader.GetGuid(5),
                            Int16    = reader.GetInt16(6),
                            Int32    = reader.GetInt32(7),
                            Int64    = reader.GetInt64(8),
                            Single   = reader.GetFloat(9),
                            String   = reader.GetString(10)
                        };

                        if (reader.IsDBNull(11) == false)
                        {
                            item.NullableBoolean = reader.GetBoolean(11);
                        }

                        if (reader.IsDBNull(12) == false)
                        {
                            item.NullableByte = reader.GetByte(12);
                        }

                        if (reader.IsDBNull(13) == false)
                        {
                            item.NullableDateTime = reader.GetDateTime(13);
                        }

                        if (reader.IsDBNull(14) == false)
                        {
                            item.NullableDecimal = reader.GetDecimal(14);
                        }

                        if (reader.IsDBNull(15) == false)
                        {
                            item.NullableDouble = reader.GetDouble(15);
                        }

                        if (reader.IsDBNull(16) == false)
                        {
                            item.NullableGuid = reader.GetGuid(16);
                        }

                        if (reader.IsDBNull(17) == false)
                        {
                            item.NullableInt16 = reader.GetInt16(17);
                        }

                        if (reader.IsDBNull(18) == false)
                        {
                            item.NullableInt32 = reader.GetInt32(18);
                        }

                        if (reader.IsDBNull(19) == false)
                        {
                            item.NullableInt64 = reader.GetInt64(19);
                        }

                        if (reader.IsDBNull(20) == false)
                        {
                            item.NullableSingle = reader.GetFloat(20);
                        }

                        if (reader.IsDBNull(21) == false)
                        {
                            item.NullableString = reader.GetString(21);
                        }

                        result.Add(item);
                    }

                    return(result);
                }
            }
        }
コード例 #12
0
ファイル: Numerals.cs プロジェクト: aphorisme/literalifyTask
 /// <summary>
 /// Converts the large numeral to its denoting number.
 /// </summary>
 /// <param name="numeral">Numeral, which gets converted.</param>
 /// <returns>Denoted number.</returns>
 public static uint AsNumber(this Large numeral)
 {
     return((uint)Math.Pow(1000, (uint)numeral));
 }
コード例 #13
0
        public ActionResult CreatePizza(string size, string name, bool?bacon, bool?bbq, bool?cheese, bool?mushroom, bool?onion, bool?pepperoni, bool?pepper, bool?pineapple, bool?sausage, bool?shrimp, int amt, bool?deliver, InfoViewModel infoView)
        {
            bool isNum = IsNumber(amt);

            if (ModelState.IsValid && !string.IsNullOrEmpty(size) && isNum)
            {
                double totalCost;
                Pizza  aPizza = null;

                //Switch statement for the size of the pizza
                switch (size)
                {
                case "Small":
                    aPizza = new Small();
                    break;

                case "Medium":
                    aPizza = new Medium();
                    break;

                case "Large":
                    aPizza = new Large();
                    break;
                }

                //If the topping was selected then it is added to the pizza
                if (bacon == true)
                {
                    aPizza = new Bacon(aPizza);
                }

                if (bbq == true)
                {
                    aPizza = new BBQ(aPizza);
                }

                if (cheese == true)
                {
                    aPizza = new ExCheese(aPizza);
                }

                if (mushroom == true)
                {
                    aPizza = new Mushroom(aPizza);
                }

                if (onion == true)
                {
                    aPizza = new Onion(aPizza);
                }

                if (pepperoni == true)
                {
                    aPizza = new Pepperoni(aPizza);
                }

                if (pepper == true)
                {
                    aPizza = new Peppers(aPizza);
                }

                if (pineapple == true)
                {
                    aPizza = new Pineapple(aPizza);
                }

                if (sausage == true)
                {
                    aPizza = new Sausage(aPizza);
                }

                if (shrimp == true)
                {
                    aPizza = new Shrimp(aPizza);
                }


                //Created a variable to contain and manipulate the cost
                totalCost = aPizza.GetCost();

                infoView.Delivery = deliver;

                if (Session["cart"] == null)
                {
                    List <CartItem> cart = new List <CartItem>
                    {
                        new CartItem {
                            ID        = 1,
                            Pizza     = aPizza,
                            Quant     = amt,
                            ViewModel = infoView
                        }
                    };
                    Session["info"]  = infoView;
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }
                else
                {
                    List <CartItem> cart  = (List <CartItem>)Session["cart"];
                    int             index = IsExist(aPizza);
                    if (index != -1)
                    {
                        cart[index].Quant++;
                    }
                    else
                    {
                        int currentID = cart.Count();
                        cart.Add(new CartItem {
                            ID = currentID, Pizza = aPizza, Quant = amt, ViewModel = infoView
                        });
                    }

                    Session["info"]  = infoView;
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }



                //Method sends order to database
                //aConnection.InsertPizzaOrder(aPizza, totalCost, name, amt, deliver, addy, city, zip, time);

                //Adds everything to a ViewBag to send to confirmation page
                //ViewBag.APizza = aPizza;
                //ViewBag.Total = totalCost;
                //ViewBag.Name = name;
                //ViewBag.Amt = amt;
                //ViewBag.Deliver = deliver;
                //ViewBag.Addy = addy;
                //ViewBag.City = city;
                //ViewBag.Zip = zip;
                //ViewBag.Time = time;

                return(RedirectToAction("DisplayCart"));
            }
            else
            {
                if (string.IsNullOrEmpty(size))
                {
                    TempData["Amt"]  = "The amount must be a number";
                    TempData["Size"] = "A size must be selected";
                }

                return(View("CreatePizzaForm", infoView));
            }
        }
コード例 #14
0
        public ActionResult AddMorePizza(string size, string name, bool?bacon, bool?bbq, bool?cheese, bool?mushroom, bool?onion, bool?pepperoni, bool?pepper, bool?pineapple, bool?sausage, bool?shrimp, int amt)
        {
            if (!string.IsNullOrEmpty(size))
            {
                double totalCost;
                Pizza  aPizza = null;

                //Switch statement for the size of the pizza
                switch (size)
                {
                case "Small":
                    aPizza = new Small();
                    break;

                case "Medium":
                    aPizza = new Medium();
                    break;

                case "Large":
                    aPizza = new Large();
                    break;
                }

                //If the topping was selected then it is added to the pizza
                if (bacon == true)
                {
                    aPizza = new Bacon(aPizza);
                }

                if (bbq == true)
                {
                    aPizza = new BBQ(aPizza);
                }

                if (cheese == true)
                {
                    aPizza = new ExCheese(aPizza);
                }

                if (mushroom == true)
                {
                    aPizza = new Mushroom(aPizza);
                }

                if (onion == true)
                {
                    aPizza = new Onion(aPizza);
                }

                if (pepperoni == true)
                {
                    aPizza = new Pepperoni(aPizza);
                }

                if (pepper == true)
                {
                    aPizza = new Peppers(aPizza);
                }

                if (pineapple == true)
                {
                    aPizza = new Pineapple(aPizza);
                }

                if (sausage == true)
                {
                    aPizza = new Sausage(aPizza);
                }

                if (shrimp == true)
                {
                    aPizza = new Shrimp(aPizza);
                }


                //Created a variable to contain and manipulate the cost
                totalCost = aPizza.GetCost();

                if (Session["cart"] == null)
                {
                    List <CartItem> cart = new List <CartItem>
                    {
                        new CartItem {
                            ID        = 1,
                            Pizza     = aPizza,
                            Quant     = amt,
                            ViewModel = (InfoViewModel)Session["info"]
                        }
                    };
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }
                else
                {
                    List <CartItem> cart  = (List <CartItem>)Session["cart"];
                    int             index = IsExist(aPizza);
                    if (index != -1)
                    {
                        cart[index].Quant++;
                    }
                    else
                    {
                        int currentID = cart.Count();
                        cart.Add(new CartItem {
                            ID = currentID, Pizza = aPizza, Quant = amt, ViewModel = (InfoViewModel)Session["info"]
                        });
                    }
                    Session["cart"]  = cart;
                    Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant);
                }


                return(RedirectToAction("DisplayCart"));
            }
            else
            {
                if (string.IsNullOrEmpty(size))
                {
                    TempData["Amt"]  = "The amount must be a number";
                    TempData["Size"] = "A size must be selected";
                }

                return(View("AddMorePizzaForm"));
            }
        }
コード例 #15
0
ファイル: objects.cs プロジェクト: kumpera/mono
	static bool large_struct_test (Large a, Large b, Large c, Large d)
	{
		if (!a.check ()) return false;
		if (!b.check ()) return false;
		if (!c.check ()) return false;
		if (!d.check ()) return false;
		return true;
	}
コード例 #16
0
 public BuiltInFunctions()
 {
     // Text
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["rept"]        = new Rept();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     Functions["concat"]      = new Concat();
     Functions["textjoin"]    = new Textjoin();
     Functions["char"]        = new CharFunction();
     Functions["exact"]       = new Exact();
     Functions["find"]        = new Find();
     Functions["fixed"]       = new Fixed();
     Functions["proper"]      = new Proper();
     Functions["search"]      = new Search();
     Functions["text"]        = new Text.Text();
     Functions["t"]           = new T();
     Functions["hyperlink"]   = new Hyperlink();
     Functions["value"]       = new Value(CultureInfo.CurrentCulture);
     Functions["trim"]        = new Trim();
     Functions["clean"]       = new Clean();
     Functions["unicode"]     = new Unicode();
     Functions["unichar"]     = new Unichar();
     Functions["numbervalue"] = new NumberValue();
     Functions["dollar"]      = new Dollar();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["aggregate"]       = new Aggregate();
     Functions["abs"]             = new Abs();
     Functions["asin"]            = new Asin();
     Functions["asinh"]           = new Asinh();
     Functions["acot"]            = new Acot();
     Functions["acoth"]           = new Acoth();
     Functions["cos"]             = new Cos();
     Functions["cot"]             = new Cot();
     Functions["coth"]            = new Coth();
     Functions["cosh"]            = new Cosh();
     Functions["csc"]             = new Csc();
     Functions["csch"]            = new Csch();
     Functions["power"]           = new Power();
     Functions["gcd"]             = new Gcd();
     Functions["lcm"]             = new Lcm();
     Functions["sec"]             = new Sec();
     Functions["sech"]            = new SecH();
     Functions["sign"]            = new Sign();
     Functions["sqrt"]            = new Sqrt();
     Functions["sqrtpi"]          = new SqrtPi();
     Functions["pi"]              = new Pi();
     Functions["product"]         = new Product();
     Functions["ceiling"]         = new Ceiling();
     Functions["ceiling.precise"] = new CeilingPrecise();
     Functions["ceiling.math"]    = new CeilingMath();
     Functions["iso.ceiling"]     = new IsoCeiling();
     Functions["combin"]          = new Combin();
     Functions["combina"]         = new Combina();
     Functions["permut"]          = new Permut();
     Functions["permutationa"]    = new Permutationa();
     Functions["count"]           = new Count();
     Functions["counta"]          = new CountA();
     Functions["countblank"]      = new CountBlank();
     Functions["countif"]         = new CountIf();
     Functions["countifs"]        = new CountIfs();
     Functions["fact"]            = new Fact();
     Functions["factdouble"]      = new FactDouble();
     Functions["floor"]           = new Floor();
     Functions["floor.precise"]   = new FloorPrecise();
     Functions["floor.math"]      = new FloorMath();
     Functions["radians"]         = new Radians();
     Functions["roman"]           = new Roman();
     Functions["sin"]             = new Sin();
     Functions["sinh"]            = new Sinh();
     Functions["sum"]             = new Sum();
     Functions["sumif"]           = new SumIf();
     Functions["sumifs"]          = new SumIfs();
     Functions["sumproduct"]      = new SumProduct();
     Functions["sumsq"]           = new Sumsq();
     Functions["sumxmy2"]         = new Sumxmy2();
     Functions["sumx2my2"]        = new SumX2mY2();
     Functions["sumx2py2"]        = new SumX2pY2();
     Functions["seriessum"]       = new Seriessum();
     Functions["stdev"]           = new Stdev();
     Functions["stdeva"]          = new Stdeva();
     Functions["stdevp"]          = new StdevP();
     Functions["stdevpa"]         = new Stdevpa();
     Functions["stdev.s"]         = new StdevDotS();
     Functions["stdev.p"]         = new StdevDotP();
     Functions["subtotal"]        = new Subtotal();
     Functions["exp"]             = new Exp();
     Functions["log"]             = new Log();
     Functions["log10"]           = new Log10();
     Functions["ln"]              = new Ln();
     Functions["max"]             = new Max();
     Functions["maxa"]            = new Maxa();
     Functions["median"]          = new Median();
     Functions["min"]             = new Min();
     Functions["mina"]            = new Mina();
     Functions["mod"]             = new Mod();
     Functions["mode"]            = new Mode();
     Functions["mode.sngl"]       = new ModeSngl();
     Functions["mround"]          = new Mround();
     Functions["multinomial"]     = new Multinomial();
     Functions["average"]         = new Average();
     Functions["averagea"]        = new AverageA();
     Functions["averageif"]       = new AverageIf();
     Functions["averageifs"]      = new AverageIfs();
     Functions["round"]           = new Round();
     Functions["rounddown"]       = new Rounddown();
     Functions["roundup"]         = new Roundup();
     Functions["rand"]            = new Rand();
     Functions["randbetween"]     = new RandBetween();
     Functions["rank"]            = new Rank();
     Functions["rank.eq"]         = new RankEq();
     Functions["rank.avg"]        = new RankAvg();
     Functions["percentile"]      = new Percentile();
     Functions["percentile.inc"]  = new PercentileInc();
     Functions["percentile.exc"]  = new PercentileExc();
     Functions["quartile"]        = new Quartile();
     Functions["quartile.inc"]    = new QuartileInc();
     Functions["quartile.exc"]    = new QuartileExc();
     Functions["percentrank"]     = new Percentrank();
     Functions["percentrank.inc"] = new PercentrankInc();
     Functions["percentrank.exc"] = new PercentrankExc();
     Functions["quotient"]        = new Quotient();
     Functions["trunc"]           = new Trunc();
     Functions["tan"]             = new Tan();
     Functions["tanh"]            = new Tanh();
     Functions["atan"]            = new Atan();
     Functions["atan2"]           = new Atan2();
     Functions["atanh"]           = new Atanh();
     Functions["acos"]            = new Acos();
     Functions["acosh"]           = new Acosh();
     Functions["covar"]           = new Covar();
     Functions["covariance.p"]    = new CovarianceP();
     Functions["covariance.s"]    = new CovarianceS();
     Functions["var"]             = new Var();
     Functions["vara"]            = new Vara();
     Functions["var.s"]           = new VarDotS();
     Functions["varp"]            = new VarP();
     Functions["varpa"]           = new Varpa();
     Functions["var.p"]           = new VarDotP();
     Functions["large"]           = new Large();
     Functions["small"]           = new Small();
     Functions["degrees"]         = new Degrees();
     Functions["odd"]             = new Odd();
     Functions["even"]            = new Even();
     // Information
     Functions["isblank"]    = new IsBlank();
     Functions["isnumber"]   = new IsNumber();
     Functions["istext"]     = new IsText();
     Functions["isnontext"]  = new IsNonText();
     Functions["iserror"]    = new IsError();
     Functions["iserr"]      = new IsErr();
     Functions["error.type"] = new ErrorType();
     Functions["iseven"]     = new IsEven();
     Functions["isodd"]      = new IsOdd();
     Functions["islogical"]  = new IsLogical();
     Functions["isna"]       = new IsNa();
     Functions["na"]         = new Na();
     Functions["n"]          = new N();
     Functions["type"]       = new TypeFunction();
     // Logical
     Functions["if"]      = new If();
     Functions["ifs"]     = new Ifs();
     Functions["maxifs"]  = new MaxIfs();
     Functions["minifs"]  = new MinIfs();
     Functions["iferror"] = new IfError();
     Functions["ifna"]    = new IfNa();
     Functions["not"]     = new Not();
     Functions["and"]     = new And();
     Functions["or"]      = new Or();
     Functions["true"]    = new True();
     Functions["false"]   = new False();
     Functions["switch"]  = new Switch();
     Functions["xor"]     = new Xor();
     // Reference and lookup
     Functions["address"]  = new Address();
     Functions["hlookup"]  = new HLookup();
     Functions["vlookup"]  = new VLookup();
     Functions["lookup"]   = new Lookup();
     Functions["match"]    = new Match();
     Functions["row"]      = new Row();
     Functions["rows"]     = new Rows();
     Functions["column"]   = new Column();
     Functions["columns"]  = new Columns();
     Functions["choose"]   = new Choose();
     Functions["index"]    = new RefAndLookup.Index();
     Functions["indirect"] = new Indirect();
     Functions["offset"]   = new Offset();
     // Date
     Functions["date"]             = new Date();
     Functions["datedif"]          = new DateDif();
     Functions["today"]            = new Today();
     Functions["now"]              = new Now();
     Functions["day"]              = new Day();
     Functions["month"]            = new Month();
     Functions["year"]             = new Year();
     Functions["time"]             = new Time();
     Functions["hour"]             = new Hour();
     Functions["minute"]           = new Minute();
     Functions["second"]           = new Second();
     Functions["weeknum"]          = new Weeknum();
     Functions["weekday"]          = new Weekday();
     Functions["days"]             = new Days();
     Functions["days360"]          = new Days360();
     Functions["yearfrac"]         = new Yearfrac();
     Functions["edate"]            = new Edate();
     Functions["eomonth"]          = new Eomonth();
     Functions["isoweeknum"]       = new IsoWeekNum();
     Functions["workday"]          = new Workday();
     Functions["workday.intl"]     = new WorkdayIntl();
     Functions["networkdays"]      = new Networkdays();
     Functions["networkdays.intl"] = new NetworkdaysIntl();
     Functions["datevalue"]        = new DateValue();
     Functions["timevalue"]        = new TimeValue();
     // Database
     Functions["dget"]     = new Dget();
     Functions["dcount"]   = new Dcount();
     Functions["dcounta"]  = new DcountA();
     Functions["dmax"]     = new Dmax();
     Functions["dmin"]     = new Dmin();
     Functions["dsum"]     = new Dsum();
     Functions["daverage"] = new Daverage();
     Functions["dvar"]     = new Dvar();
     Functions["dvarp"]    = new Dvarp();
     //Finance
     Functions["cumipmt"]    = new Cumipmt();
     Functions["cumprinc"]   = new Cumprinc();
     Functions["dollarde"]   = new DollarDe();
     Functions["dollarfr"]   = new DollarFr();
     Functions["ddb"]        = new Ddb();
     Functions["effect"]     = new Effect();
     Functions["fvschedule"] = new FvSchedule();
     Functions["pduration"]  = new Pduration();
     Functions["rri"]        = new Rri();
     Functions["pmt"]        = new Pmt();
     Functions["ppmt"]       = new Ppmt();
     Functions["ipmt"]       = new Ipmt();
     Functions["ispmt"]      = new IsPmt();
     Functions["pv"]         = new Pv();
     Functions["fv"]         = new Fv();
     Functions["npv"]        = new Npv();
     Functions["rate"]       = new Rate();
     Functions["nper"]       = new Nper();
     Functions["nominal"]    = new Nominal();
     Functions["irr"]        = new Irr();
     Functions["mirr"]       = new Mirr();
     Functions["xirr"]       = new Xirr();
     Functions["sln"]        = new Sln();
     Functions["syd"]        = new Syd();
     Functions["xnpv"]       = new Xnpv();
     Functions["coupdays"]   = new Coupdays();
     Functions["coupdaysnc"] = new Coupdaysnc();
     Functions["coupdaybs"]  = new Coupdaybs();
     Functions["coupnum"]    = new Coupnum();
     Functions["coupncd"]    = new Coupncd();
     Functions["couppcd"]    = new Couppcd();
     Functions["price"]      = new Price();
     Functions["yield"]      = new Yield();
     Functions["yieldmat"]   = new Yieldmat();
     Functions["duration"]   = new Duration();
     Functions["disc"]       = new Disc();
     //Engineering
     Functions["bitand"]       = new BitAnd();
     Functions["bitor"]        = new BitOr();
     Functions["bitxor"]       = new BitXor();
     Functions["bitlshift"]    = new BitLshift();
     Functions["bitrshift"]    = new BitRshift();
     Functions["convert"]      = new ConvertFunction();
     Functions["bin2dec"]      = new Bin2Dec();
     Functions["bin2hex"]      = new Bin2Hex();
     Functions["bin2oct"]      = new Bin2Oct();
     Functions["dec2bin"]      = new Dec2Bin();
     Functions["dec2hex"]      = new Dec2Hex();
     Functions["dec2oct"]      = new Dec2Oct();
     Functions["hex2bin"]      = new Hex2Bin();
     Functions["hex2dec"]      = new Hex2Dec();
     Functions["hex2oct"]      = new Hex2Oct();
     Functions["oct2bin"]      = new Oct2Bin();
     Functions["oct2dec"]      = new Oct2Dec();
     Functions["oct2hex"]      = new Oct2Hex();
     Functions["delta"]        = new Delta();
     Functions["erf"]          = new Erf();
     Functions["erf.precise"]  = new ErfPrecise();
     Functions["erfc"]         = new Erfc();
     Functions["erfc.precise"] = new ErfcPrecise();
     Functions["besseli"]      = new BesselI();
     Functions["besselj"]      = new BesselJ();
     Functions["besselk"]      = new BesselK();
     Functions["bessely"]      = new BesselY();
 }
コード例 #17
0
ファイル: objects.cs プロジェクト: kumpera/mono
	public static int test_2_large_struct_pass ()
	{
		Large a, b, c, d;
		a = new Large ();
		b = new Large ();
		c = new Large ();
		d = new Large ();
		a.populate ();
		b.populate ();
		c.populate ();
		d.populate ();
		if (large_struct_test (a, b, c, d))
			return 2;
		return 0;
	}
コード例 #18
0
 private static void sub1(Large para)
 {
 }