コード例 #1
0
ファイル: Program.cs プロジェクト: Jeffiy/DesignPatterns
        static void Main(string[] args)
        {
            UnitedNationsSecurityCouncil UNSC = new UnitedNationsSecurityCouncil();

            USA c1 = new USA(UNSC);
            Iraq c2 = new Iraq(UNSC);

            UNSC.Country1 = c1;
            UNSC.Country2 = c2;

            c1.Declare("不准研制核武器,否则要发动战争!");
            c2.Declare("我们没研制核武器,也不怕侵略。");
        }
コード例 #2
0
ファイル: frmspel.cs プロジェクト: Jarondev/Inlevingsspel
        static void InitialiseerLanden()
        {
            for (int i = 0; i < frmselecteren.LandHoeveelheid; i++)
            {
                int landID = Array.IndexOf(frmselecteren.isLand, true);
                switch (landID)
                {
                case 0:
                    Landen[i] = new Duitsland(i);
                    break;

                case 1:
                    Landen[i] = new USA(i);
                    break;

                case 2:
                    Landen[i] = new China(i);
                    break;

                case 3:
                    Landen[i] = new UK(i);
                    break;

                case 4:
                    Landen[i] = new Congo(i);
                    break;

                case 5:
                    Landen[i] = new Vietnam(i);
                    break;

                case 6:
                    Landen[i] = new Nigeria(i);
                    break;

                case 7:
                    Landen[i] = new Peru(i);
                    break;
                }
                frmselecteren.isLand[landID] = false;
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Russia c1 = new Russia();

            c1.Prn();
            USA c2 = new USA();

            c2.Prn();
            France c3 = new France();

            c3.Prn();

            double p1, p2, p3;

            p1 = c1.GetPopolation();
            p2 = c2.GetPopolation();
            p3 = c3.GetPopolation();

            double max;

            max = 0;

            if (p1 > p2 && p1 > p3)
            {
                max = p1;
                Console.WriteLine($"Столица с наибольшим населением - {max} - Москва");
            }

            if (p2 > p1 && p2 > p3)
            {
                max = p2;
                Console.WriteLine($"Столица с наибольшим населением - {max} - Вашингтон");
            }

            if (p3 > p2 && p3 > p1)
            {
                max = p3;
                Console.WriteLine($"Столица с наибольшим населением - {max} - Париж");
            }
        }
コード例 #4
0
    public static void Main(string[] args)
    {
        while (true)
        {
            Console.WriteLine("1.India");
            Console.WriteLine("2.USA");
            Console.WriteLine("3.UK");
            Console.WriteLine("4.UAE");
            Console.WriteLine("5.Exit");
            Console.WriteLine("Enter your choice");
            int ch = int.Parse(Console.ReadLine());
            switch (ch)
            {
            case 1:
            {
                Console.WriteLine("1. India to USA");
                Console.WriteLine("2. India to UK");
                Console.WriteLine("3. India to UAE");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of India : ");
                    currency1 = double.Parse(Console.ReadLine());
                    indobj    = new India(currency1);
                    usaobj    = indobj;
                    Console.WriteLine("India -> USA = " + indobj.currency + " -> " + usaobj.currency);
                    break;

                case 2:
                    Console.Write("\nEnter Currency of India : ");
                    currency1 = double.Parse(Console.ReadLine());
                    indobj    = new India(currency1);
                    ukobj     = indobj;

                    Console.WriteLine("India -> UK = " + indobj.currency + " -> " + ukobj.currency);
                    break;

                case 3:
                    Console.Write("\nEnter Currency of India : ");
                    currency1 = double.Parse(Console.ReadLine());
                    indobj    = new India(currency1);
                    uaeobj    = indobj;

                    Console.WriteLine("India -> UAE" + indobj.currency + " -> " + uaeobj.currency);
                    break;

                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 2:
            {
                Console.WriteLine("1. USA to India");
                Console.WriteLine("2. USA to UK");
                Console.WriteLine("3. USA to UAE");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of USA : ");
                    currency1 = double.Parse(Console.ReadLine());
                    usaobj    = new USA(currency1);
                    indobj    = (India)usaobj;
                    Console.WriteLine("USA -> India" + usaobj.currency + " -> " + indobj.currency);
                    break;

                case 2:
                    Console.Write("\nEnter Currency of USA : ");
                    currency1 = double.Parse(Console.ReadLine());
                    usaobj    = new USA(currency1);
                    ukobj     = usaobj;
                    Console.WriteLine("USA -> UK" + usaobj.currency + " -> " + ukobj.currency);
                    break;

                case 3:
                    Console.Write("\nEnter Currency of USA : ");
                    currency1 = double.Parse(Console.ReadLine());
                    usaobj    = new USA(currency1);
                    uaeobj    = (UAE)usaobj;
                    Console.WriteLine("USA -> UAE" + usaobj.currency + " -> " + uaeobj.currency);
                    break;

                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 3:
            {
                Console.WriteLine("1. UK to India");
                Console.WriteLine("2. UK to USA");
                Console.WriteLine("3. UK to UAE");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of UK : ");
                    currency1 = double.Parse(Console.ReadLine());
                    ukobj     = new UK(currency1);
                    indobj    = (India)ukobj;
                    Console.WriteLine("UK -> India" + ukobj.currency + " -> " + indobj.currency);
                    break;

                case 2:
                    Console.Write("\nEnter Currency of UK : ");
                    currency1 = double.Parse(Console.ReadLine());
                    ukobj     = new UK(currency1);
                    usaobj    = (USA)ukobj;
                    Console.WriteLine("UK -> US" + ukobj.currency + " -> " + usaobj.currency);
                    break;

                case 3:
                    Console.Write("\nEnter Currency of UK : ");
                    currency1 = double.Parse(Console.ReadLine());
                    ukobj     = new UK(currency1);
                    uaeobj    = (UAE)ukobj;
                    Console.WriteLine("UK -> UAE" + ukobj.currency + "-> " + uaeobj.currency);
                    break;

                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 4:
            {
                Console.WriteLine("1. UAE to india");
                Console.WriteLine("2. UAE to USA");
                Console.WriteLine("3. UAE to UK");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of UAE : ");
                    currency1 = double.Parse(Console.ReadLine());
                    uaeobj    = new UAE(currency1);
                    indobj    = (India)uaeobj;
                    Console.WriteLine("UAE -> India" + uaeobj.currency + " ->" + indobj.currency + " Indian Rupee");
                    break;



                case 2:
                    Console.Write("\nEnter Currency of UAE : ");
                    currency1 = double.Parse(Console.ReadLine());
                    uaeobj    = new UAE(currency1);
                    usaobj    = uaeobj;
                    Console.WriteLine("UAE -> US" + uaeobj.currency + " -> " + usaobj.currency + " US Dollar");
                    break;


                case 3:
                    Console.Write("\nEnter Currency of UAE : ");
                    currency1 = double.Parse(Console.ReadLine());
                    uaeobj    = new UAE(currency1);
                    ukobj     = uaeobj;
                    Console.WriteLine("UAE -> UK" + uaeobj.currency + " -> " + ukobj.currency + " British Pound");
                    break;


                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 5:
            {
                Environment.Exit(0);
            } break;
            }
        }
    }
コード例 #5
0
 public DataTable ConocerUsuarioE(int emplead)
 {
     return(USA.GetDataConocerUsuario(emplead));
 }
コード例 #6
0
        //[HttpPost]
        public async Task <IActionResult> Order(int id, int InputQty) //Trying to get the InputQty here with the ItemId
        {
            //if (id == null)
            //{
            //    return NotFound();
            //}

            USA obj = new USA();

            obj.ShowItemId = id;
            obj.InputQty   = InputQty;

            string path    = Directory.GetCurrentDirectory();
            var    builder = new ConfigurationBuilder()
                             .SetBasePath(path)
                             .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
            IConfiguration config = builder.Build();
            string         sqlConnectionString = config.GetConnectionString("OrderContext");
            string         sql = "OrderItemUpdate";

            var item = await _context.USA
                       //.Where(q => q.InputQty == qty)
                       .FirstOrDefaultAsync(u => u.ShowItemId == id);

            //if (item.AvaiForSaleQty != 0 && item.AvaiForSaleQty - item.OrderQuantity >= 0)
            //{
            using (var connection = new SqlConnection(sqlConnectionString))
            {
                try
                {
                    connection.Open();
                    DynamicParameters parameter = new DynamicParameters();
                    parameter.Add("@ShowItemId", item.ShowItemId, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@CompanyId", item.companyId, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@ItemId", item.itemId, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@PlanSeqId", item.planSeqId, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@ItemDescription", item.itemDescription, DbType.String, ParameterDirection.Input);
                    parameter.Add("@OrderQuantity", item.orderQuantity, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@OrderSldTdy", item.orderSldTdy, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@PlannedMinutesQty", item.plannedMinutesQty, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@ActualMinutesQty", item.actualMinutesQty, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@NetworkId", item.networkId, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@AvaiForSaleQty", item.avaiForSaleQty, DbType.Int32, ParameterDirection.Input);
                    parameter.Add("@ShowDate", item.showDate, DbType.String, ParameterDirection.Input);
                    parameter.Add("@ShowCd", item.showCd, DbType.String, ParameterDirection.Input);
                    parameter.Add("@InputQty", obj.InputQty, DbType.Int32, ParameterDirection.Input);
                    connection.Execute(sql, parameter, commandType: CommandType.StoredProcedure);
                    //return RedirectToAction(nameof(Index));
                }
                catch (SqlException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                connection.Close();
            }
            return(RedirectToAction(nameof(Index)));

            //else
            //{
            //    ViewBag.Message("Inventory too low for amount ordered.");
            //    return View();
            //}
        }
コード例 #7
0
        private async void BtnGuardarDimensiones_Clicked(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.AppSettings["ipServer"];

            try
            {
                var USAV           = USA.Text;
                var UKV            = UK.Text;
                var EUROV          = EURO.Text;
                var CMV            = CM.Text;
                var CategoriaSizeV = pickerCategoriaSizes.SelectedIndex + 1;


                if (string.IsNullOrEmpty(USAV))
                {
                    await DisplayAlert("Validacion", "Ingrese el Size de USA", "Aceptar");

                    USA.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(UKV))
                {
                    await DisplayAlert("Validacion", "Ingrese el Size de UK", "Aceptar");

                    UK.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(EUROV))
                {
                    await DisplayAlert("Validacion", "Ingrese el Size de EURO", "Aceptar");

                    EURO.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(CMV))
                {
                    await DisplayAlert("Validacion", "Ingrese el Size por CM", "Aceptar");

                    CM.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(CategoriaSizeV.ToString()))
                {
                    await DisplayAlert("Validacion", "Seleccione la Categoria del Sizes", "Aceptar");

                    pickerCategoriaSizes.Focus();
                    return;
                }

                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(connectionString);

                var sizes = new Sizes()
                {
                    SizeID          = 0,
                    USA             = USAV,
                    UK              = UKV,
                    EURO            = EUROV,
                    CM              = CMV,
                    CategoriaSizeID = CategoriaSizeV
                };

                //Convetir a Json
                var           json          = JsonConvert.SerializeObject(sizes);
                StringContent stringContent = new StringContent(json, Encoding.UTF8, "application/json");

                //Ejecutar el api el introduces el metodo
                var request = await client.PostAsync("/api/Size/registrar", stringContent);

                if (request.IsSuccessStatusCode)
                {
                    var responseJson = await request.Content.ReadAsStringAsync();

                    var respuesta = JsonConvert.DeserializeObject <Request>(responseJson);

                    //Status
                    if (respuesta.status)
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "Sizes registrado correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "Sizes no pudo registrarse correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                }
                else
                {
                    await MaterialDialog.Instance.AlertAsync(message : "Error",
                                                             title : "Error",
                                                             acknowledgementText : "Aceptar");
                }
            }
            catch (Exception ex)
            {
                await MaterialDialog.Instance.AlertAsync(message : ex.Message,
                                                         title : "Error",
                                                         acknowledgementText : "Aceptar");
            }
            await Navigation.PushAsync(new Dimensiones.GestionarDimensiones());
        }
コード例 #8
0
 public static int GetMarketId(this USA value)
 {
     return((int)value);
 }
コード例 #9
0
 public void CountryCompareTo()
 {
     Assert.AreEqual(-1, UK.CompareTo(USA));
     Assert.AreEqual(0, UK.CompareTo(UK));
     Assert.AreEqual(1, USA.CompareTo(UK));
 }
コード例 #10
0
        static void ShowContinentalUSA()
        {
            var usa = USA.Create2013USA();

            DisplayTestImage(usa.DrawContinentalUSA(), "usa_continental");
        }