예제 #1
0
        public AddPilot(RaceClass Race, AdminControl ad)
        {
            InitializeComponent();

            CurrRace = Race;
            admin    = ad;

            foundPilots_dataGridView3.DoubleBuffered(true);

            label3.Text = (CurrRace.RaceNum > ad.DopRace ? (CurrRace.RaceNum - ad.DopRace).ToString() + "a" : CurrRace.RaceNum.ToString());
            label5.Text = CurrRace.Date.ToString("dd MMMM");
            label4.Text = "Отправление в " + CurrRace.Hour + ":" + CurrRace.Minute;
            ad.ShowRacePilots(CurrRace.RaceID, otherRacers_dataGridView2); // Показать всех пилотов рейса

            if (foundPilots_dataGridView3.Rows.Count > 0)
            {
                foundPilots_dataGridView3.Rows[0].Selected = false;
            }

            //filter = PilotFilter();
            //Admin.ShowPilots(dataGridView3, filter); // Показать всех пилотов

            ad.ShowRaceKarts(comboBox1, CurrRace);
            label2.Visible = comboBox1.Visible = comboBox1.Items.Count > 1;

            // Скрываем форму с пилотами
            borderPanel2.Visible = toolStripButton3.Checked = otherRacers_dataGridView2.RowCount > 0;
            label12.Text         = otherRacers_dataGridView2.RowCount.ToString();

            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            toolStripButton4.PerformClick();
            ShowPilotName();

            checkBox2.Text = "Участник квалификации " + DateTime.Now.Last(DayOfWeek.Sunday).ToString("dd MMMM");
        }
예제 #2
0
        // бывает необходимость просто положить деньги на счёт пользователя или снять. А бывает, что нужно вернуть столько, сколько он заплатил за заезд
        // поэтому иногда надо знать id race data. для этого придуман флаг convertToIdUser. Если да, то из idRaceData надо получить id пилота
        public CorrectBallance(AdminControl ad, int idRaceData, bool DelPilotFromRace, RaceClass R = null)
        {
            InitializeComponent();
            idRecordInRaceData = idRaceData;
            admin = ad;
            Race  = R;

            if (DelPilotFromRace)
            {
                radioButton3.Visible = true;
                radioButton4.Visible = true;
                radioButton1.Visible = false;
                radioButton2.Visible = false;

                radioButton3.Checked = true;
                this.DelP            = DelPilotFromRace;
                textBox3.ReadOnly    = true;
                Sum = admin.model.getPaidAmount(idRecordInRaceData);

                button2.Enabled = true;
            }
            else
            {
                Sum = 0;
                radioButton3.Visible = false;
                radioButton4.Visible = false;
                radioButton1.Visible = true;
                radioButton2.Visible = true;

                radioButton1.Checked = true;
            }
            textBox3.Text = Sum.ToString();
            admin.model.Connect();
            LoadData(DelPilotFromRace);
        }
예제 #3
0
        public PrintResult1(RaceClass Race, AdminControl ad)
        {
            InitializeComponent();
            CurrentRace       = Race;
            admin             = ad;
            labelSmooth1.Text = "Заезд №" + (Race.RaceNum > admin.DopRace ? (Race.RaceNum - admin.DopRace).ToString() + "a" : Race.RaceNum.ToString());
            labelSmooth2.Text = Race.Date.ToString("dd MMMM yyyy") + " " + Race.Hour + ":" + Race.Minute;
            labelSmooth4.Text = "Трасса - " + Race.TrackName;

            numericUpDown1.Value = admin.model.GetRacePilots(CurrentRace.RaceID).Count();
        }
예제 #4
0
        public ChangeRace(AdminControl ad, string PID, string MID, RaceClass R)
        {
            InitializeComponent();
            admin    = ad;
            PilotID  = PID;
            MemberID = MID;
            Race     = R;
            LoadData();

            labelSmooth4.Text  = "№" + (Race.RaceNum > admin.DopRace ? (Race.RaceNum - admin.DopRace).ToString() + "a" : Race.RaceNum.ToString());
            labelSmooth4.Text += "   " + Race.Hour + ":" + Race.Minute;
        }
예제 #5
0
        bool IsHalfModesEnabled = false; // разрешены ли заезды на половину времени заезда

        public CashOperations(int ID, RaceClass R, AdminControl ad, double sale = 0)
        {
            InitializeComponent();
            admin = ad;

            discountCard = null;

            PilotID = ID;
            User    = admin.model.GetPilot(PilotID);

            int idDefaultRaceMode = Convert.ToInt32(admin.Settings["default_race_mode_id"]);

            Race = R;
            int idGroup = Convert.ToInt32(User["gr"]);

            Sum = Convert.ToDouble(admin.GetPrice(admin.GetWeekDayNumber(R.Date),
                                                  Convert.ToInt32(R.Hour), idDefaultRaceMode, idGroup));//  R.RaceSum;


            //       ci = new comboBoxItem(null, -1);
            //       ci.selectComboBoxValueById(userSelectedMode_comboBox1, idDefaultRaceMode);
            // userSelectedMode_comboBox1.SelectedIndex = 0;

            labelSmooth1.Text           = "Полная стоимость билета - " + Sum.ToString() + " грн";
            cashFromPilot_textBox3.Text = priceForCurrentRace_textBox5.Text = Sum.ToString();
            certificateDiscount         = sale;

            LoadData();


            InSale      = labelSmooth5.Visible = userSelectedMode_comboBox1.Visible = Convert.ToBoolean(admin.Settings["racesale"] ?? false);
            sale_onelap = Convert.ToInt32(admin.Settings["sale_onelap"] ?? 0);
            sale_half   = Convert.ToInt32(admin.Settings["sale_half"] ?? 0);

            IsHalfModesEnabled = priceForHalfMode_label.Visible = halfModes_comboBox.Visible = Convert.ToBoolean(admin.Settings["halfModesEnabled"] ?? false);

            #region заполним список режимов заезда

            List <Hashtable> data = admin.model.GetAllRaceModes(" and is_deleted <> 1 ");
            halfModes_comboBox.Items.Clear();
            for (int i = 0; i < data.Count; i++)
            {
                comboBoxItem someItem =
                    new comboBoxItem(Convert.ToString(data[i]["name"]),
                                     Convert.ToInt32(data[i]["id"]));

                halfModes_comboBox.Items.Add(someItem);
            }

            ci.selectComboBoxValueById(halfModes_comboBox, idDefaultRaceMode);

            #endregion
        }
예제 #6
0
        private void print_check(int PilotID, RaceClass Race, int RCount)
        {
            PrintDialog MyPrintDialog = new PrintDialog();

            MyPrintDialog.AllowCurrentPage            = false;
            MyPrintDialog.AllowPrintToFile            = false;
            MyPrintDialog.AllowSelection              = false;
            MyPrintDialog.AllowSomePages              = false;
            MyPrintDialog.PrintToFile                 = false;
            MyPrintDialog.ShowHelp                    = false;
            MyPrintDialog.ShowNetwork                 = false;
            MyPrintDialog.PrinterSettings.PrinterName = admin.Settings["printer_check"].ToString();

            printDocument1.PrinterSettings               = MyPrintDialog.PrinterSettings;
            printDocument1.DefaultPageSettings           = MyPrintDialog.PrinterSettings.DefaultPageSettings;
            printDocument1.DefaultPageSettings.Landscape = false;
            printDocument1.DefaultPageSettings.Color     = false;
            printDocument1.PrinterSettings.Copies        = 1;
            printDocument1.DefaultPageSettings.Margins   = new Margins(0, 0, 0, 0);

            printDocument1.DocumentName = "Чек";

            Hashtable User = admin.model.GetPilot(PilotID);


            Data.PilotID  = User["id"].ToString();
            Data.Name     = User["name"].ToString();
            Data.SurName  = User["surname"].ToString();
            Data.Sum      = RCount.ToString() + " заездов";
            Data.RaceTime = Race.Hour + ":" + Race.Minute;
            Data.RaceDate = new DateTime(Race.Date.Year, Race.Date.Month, Race.Date.Day, 0, 0, 0);
            Data.NickName = User["nickname"].ToString();
            Data.OrgName  = "CrazyKarting";
            Data.RaceNum  = "Заезд " + (Race.RaceNum > admin.DopRace ? (Race.RaceNum - admin.DopRace).ToString() + "a" : Race.RaceNum.ToString());
            Data.PrintSum = true;
        }