示例#1
0
        public NewOrderForm()
        {
            InitializeComponent();

            metroButton14.UseCustomBackColor = true;
            metroButton14.BackColor          = Color.DimGray;
            SvobodMesta = new List <int>();

            //--------Добавление Button в массив-----
            TextBoxMesto.Text = "";
            ButtonMass        = new List <MetroButton>();
            ButtonMass.Add(metroButton2);
            ButtonMass.Add(metroButton3);
            ButtonMass.Add(metroButton4);
            ButtonMass.Add(metroButton5);
            ButtonMass.Add(metroButton6);
            ButtonMass.Add(metroButton7);
            ButtonMass.Add(metroButton8);
            ButtonMass.Add(metroButton9);
            ButtonMass.Add(metroButton10);
            ButtonMass.Add(metroButton11);
            ButtonMass.Add(metroButton12);
            ButtonMass.Add(metroButton13);
            ButtonMass.Add(metroButton1);
            //---------------------------------------
            marshruts = Routs.GetMarshruts();
            bilets    = TypeBilets.GetTypeBilets();

            for (int i = 0; i < bilets.Count; i++)
            {
                ComboBoxTypeBilet.Items.Add(bilets[i].name);
            }

            for (int i = 0; i < marshruts.Count; i++)
            {
                ComboBoxNewMarshrut.Items.Add(marshruts[i].name);
            }

            marshruts[0].GetPromPynkt();
            int j = marshruts[0].PromPynkt.Count - 1; // переменная для заполнения ComboBoxKyda

            for (int i = 0; i < marshruts[0].PromPynkt.Count; i++)
            {
                ComboBoxOtkyda.Items.Add(marshruts[0].PromPynkt[i].name);
                ComboBoxKyda.Items.Add(marshruts[0].PromPynkt[j].name);
                j--;
            }
            functions.ClearButtonSvMesta(ButtonMass);
        }
示例#2
0
        public ChangeOrderForm(int Id, DateTime date)
        {
            InitializeComponent();
            bilets = TypeBilets.GetTypeBilets();
            metroButton14.UseCustomBackColor = true;
            metroButton14.BackColor          = Color.DimGray;
            IdSetOrder = Id;
            //--------Добавление Button в массив-----
            ButtonMass = new List <MetroButton>();

            ButtonMass.Add(metroButton2);
            ButtonMass.Add(metroButton3);
            ButtonMass.Add(metroButton4);
            ButtonMass.Add(metroButton5);
            ButtonMass.Add(metroButton6);
            ButtonMass.Add(metroButton7);
            ButtonMass.Add(metroButton8);
            ButtonMass.Add(metroButton9);
            ButtonMass.Add(metroButton10);
            ButtonMass.Add(metroButton11);
            ButtonMass.Add(metroButton12);
            ButtonMass.Add(metroButton13);
            ButtonMass.Add(metroButton1);
            //---------------------------------------
            marshruts = Routs.GetMarshruts();

            order = Orders.GetOrder(Id.ToString());

            for (int i = 0; i < marshruts.Count; i++)
            {
                ComboBoxNewMarshrut.Items.Add(marshruts[i].name);
                marshruts[i].GetPromPynkt();
                if (marshruts[i].name == order.name_marsh)
                {
                    ComboBoxNewMarshrut.SelectedIndex = i;
                }
            }

            int j = marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt.Count - 1; // переменная для заполнения ComboBoxKyda

            for (int i = 0; i < marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt.Count; i++)
            {
                ComboBoxOtkyda.Items.Add(marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt[i].name);
                ComboBoxKyda.Items.Add(marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt[j].name);
                j--;
            }

            for (int i = 0; i < marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt.Count; i++)
            {
                if (marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt[i].name == order.otkyda)
                {
                    ComboBoxOtkyda.SelectedIndex = i;
                }
                if (marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt[i].name == order.kyda)
                {
                    ComboBoxKyda.SelectedIndex = marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt.Count - 1 - i;
                }
            }

            for (int i = 0; i < marshruts.Count; i++)
            {
                if (order.name_marsh == marshruts[i].name)
                {
                    IdMarsh = marshruts[i].id;
                    break;
                }
            }
            trips = Trips.GetTripsOnDate(date.ToString("yyyy-MM-dd"), marshruts[0].PromPynkt[ComboBoxOtkyda.SelectedIndex].id.ToString(), marshruts[0].PromPynkt[marshruts[0].PromPynkt.Count - ComboBoxKyda.SelectedIndex - 1].id.ToString(), IdMarsh.ToString());

            for (int i = 0; i < trips.Count; i++)
            {
                if (trips[i].id == order.id_poezdka)
                {
                    IndexTrip = i;
                }
                ComboBoxCar.Items.Add("Микроавтобус №" + (i + 1).ToString());
            }

            ComboBoxMesto.Items.Clear();
            mesta = Trips.GetMesta(trips[IndexTrip].id, marshruts[ComboBoxNewMarshrut.SelectedIndex].id, marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt[ComboBoxOtkyda.SelectedIndex].id, marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt[marshruts[ComboBoxNewMarshrut.SelectedIndex].PromPynkt.Count - 1 - ComboBoxKyda.SelectedIndex].id);
            functions.CheckSvMestaOnShema(mesta, ButtonMass, ComboBoxMesto);

            for (int i = 0; i < bilets.Count; i++)
            {
                ComboBoxTypeBilet.Items.Add(bilets[i].name);
            }

            for (int i = 0; i < marshruts.Count; i++)
            {
                ComboBoxNewMarshrut.Items.Add(marshruts[i].name);
            }


            ComboBoxStatus.Items.Add("Оформлен");
            ComboBoxStatus.Items.Add("Забронирован");
            ComboBoxStatus.Items.Add("Оплачен");
            ComboBoxStatus.Items.Add("Отменен");


            DateTimePicker.Value = date;
            LabelSvMest.Text     = "Свободных мест: " + trips[IndexTrip].coun_sv_mest;
            if (order.mesto == "13")
            {
                ComboBoxMesto.Items.Add("14");
                ComboBoxMesto.Text = "14";
            }
            else
            {
                ComboBoxMesto.Items.Add(order.mesto);
                ComboBoxMesto.Text = order.mesto;
            }
            TextBoxFio.Text        = order.fio;
            TextBoxCout.Text       = order.cost.ToString();
            TextBoxPhone.Text      = order.phone;
            ComboBoxTypeBilet.Text = order.type_bilet;
            ComboBoxStatus.Text    = functions.CheckStatus(order.status);
            ComboBoxCar.Text       = "Микроавтобус №" + (IndexTrip + 1).ToString();
        }
示例#3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.BronForm);
            //---Переменные для работы NAvigationView
            drawer      = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            navView     = FindViewById <NavigationView>(Resource.Id.nav_view);
            DrawerImage = FindViewById <ImageView>(Resource.Id.Button_menu);
            LoaderView  = FindViewById <RelativeLayout>(Resource.Id.LoaderView);
            LoaderImage = FindViewById <ImageView>(Resource.Id.LoaderImage);
            //---Переменные для работы Activity
            m1                 = FindViewById <Button>(Resource.Id.m1);
            m2                 = FindViewById <Button>(Resource.Id.m2);
            m3                 = FindViewById <Button>(Resource.Id.m3);
            m4                 = FindViewById <Button>(Resource.Id.m4);
            m5                 = FindViewById <Button>(Resource.Id.m5);
            m6                 = FindViewById <Button>(Resource.Id.m6);
            m7                 = FindViewById <Button>(Resource.Id.m7);
            m8                 = FindViewById <Button>(Resource.Id.m8);
            m9                 = FindViewById <Button>(Resource.Id.m9);
            m10                = FindViewById <Button>(Resource.Id.m10);
            m11                = FindViewById <Button>(Resource.Id.m11);
            m12                = FindViewById <Button>(Resource.Id.m12);
            m14                = FindViewById <Button>(Resource.Id.m14);
            ButtonBron         = FindViewById <Button>(Resource.Id.ButtonBron);
            SpinnerTypeTicket  = FindViewById <Spinner>(Resource.Id.SpinnerTypeTicket);
            SpinnerSpots       = FindViewById <Spinner>(Resource.Id.SpinnerSpots);
            TextViewSelectRout = FindViewById <TextView>(Resource.Id.TextViewSelectRout);
            TextViewData       = FindViewById <TextView>(Resource.Id.TextViewData);
            TextViewCost       = FindViewById <TextView>(Resource.Id.TextViewCost);
            TextViewPoStart    = FindViewById <TextView>(Resource.Id.TextViewPoStart);
            TextViewPoEnd      = FindViewById <TextView>(Resource.Id.TextViewPoEnd);
            EditTextFIO        = FindViewById <EditText>(Resource.Id.EditTextFIO);
            EditTextPhone      = FindViewById <EditText>(Resource.Id.EditTextPhone);
            FinishLayout       = FindViewById <RelativeLayout>(Resource.Id.FinishLayout);
            ButtonBronFinish   = FindViewById <Button>(Resource.Id.ButtonBronFinish);
            ButtonFullFinish   = FindViewById <Button>(Resource.Id.ButtonFullFinish);
            //----------------------------

            FinishLayout.Visibility = ViewStates.Invisible;
            ButtonBronFinish.Click += ButtonBronFinish_Click;
            ButtonFullFinish.Click += ButtonFullFinish_Click;;
            AnimationLoader         = (AnimationDrawable)LoaderImage.Drawable;
            AnimationLoader.Start();

            DrawerImage.Click += DrawerImage_Click;
            HeaderView         = LayoutInflater.From(this).Inflate(Resource.Layout.drawer_header, null, false);

            navView.AddHeaderView(HeaderView);
            navView.NavigationItemSelected += NavView_NavigationItemSelected;
            EditTextPhone.TextChanged      += EditTextPhone_TextChanged;
            ButtonBron.Click += ButtonBron_Click;

            RoutsID     = Intent.GetStringExtra("RoutsID");
            TripID      = Intent.GetStringExtra("TripID");
            TripDate    = Intent.GetStringExtra("TripDate");
            StartPOText = Intent.GetStringExtra("StartPOText");
            StartPOId   = Intent.GetStringExtra("StartPOId");
            EndPOText   = Intent.GetStringExtra("EndPOText");
            EndPOId     = Intent.GetStringExtra("EndPOId");

            TextViewPoStart.Text = StartPOText;
            TextViewPoEnd.Text   = EndPOText;

            //---Массив мест
            SpisokForSpinnerSpots = new List <int>();
            ObratPO = new List <IApi>();
            spots   = new List <Button>();
            spots.Add(m1);
            spots.Add(m2);
            spots.Add(m3);
            spots.Add(m4);
            spots.Add(m5);
            spots.Add(m6);
            spots.Add(m7);
            spots.Add(m8);
            spots.Add(m9);
            spots.Add(m10);
            spots.Add(m11);
            spots.Add(m12);
            spots.Add(m14);

            new Thread(new ThreadStart(delegate //поток для загрузки данных
            {
                bilets = TypeBilets.GetTypeBilets();
                routs  = Routs.GetMarshruts();
                foreach (var item in routs)
                {
                    if (item.id.ToString() == RoutsID)
                    {
                        SelectRout = item;
                        break;
                    }
                }
                GetsSpots = Trips.GetMesta(Convert.ToInt32(TripID), Convert.ToInt32(RoutsID), Convert.ToInt32(StartPOId), Convert.ToInt32(EndPOId));
                RunOnUiThread(() => CheckSvMestaOnShema(GetsSpots, spots, SpisokForSpinnerSpots));
                RunOnUiThread(() => SpinnerSpots.Adapter      = new SpotsAdapter(this, SpisokForSpinnerSpots));
                RunOnUiThread(() => SpinnerTypeTicket.Adapter = new TicketAdapter(this, bilets));
                cost = Prices.GetPrice(Convert.ToInt32(StartPOId), Convert.ToInt32(EndPOId), Convert.ToInt32(RoutsID));
                if (bilets[0].fix == 1)
                {
                    cost = bilets[0].cost.ToString();
                }
                else
                {
                    cost = (Convert.ToDouble(cost) * bilets[0].cost).ToString();
                }
                RunOnUiThread(() => TextViewCost.Text       = cost);
                RunOnUiThread(() => TextViewSelectRout.Text = SelectRout.name);
                RunOnUiThread(() => TextViewData.Text       = DateTime.ParseExact(TripDate, "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"));
                RunOnUiThread(() => AnimationLoader.Stop());
                RunOnUiThread(() => LoaderView.Visibility           = ViewStates.Invisible);
                RunOnUiThread(() => SpinnerTypeTicket.ItemSelected += SpinnerTypeTicket_ItemSelected);
            })).Start();
        }