コード例 #1
0
ファイル: CashOperations.cs プロジェクト: paradoxUA/webtest
        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
        }
コード例 #2
0
ファイル: NewPilot.cs プロジェクト: paradoxUA/webtest
        private void fillDiscountCards(int idPilot = -1)
        {
            cards_comboBox2.Items.Clear();

            ci = new comboBoxItem("[нет]",
                                  -1);

            cards_comboBox2.Items.Add(ci);
            cards_comboBox2.SelectedIndex = 0;

            IEnumerable <model.DiscountCard> cards;

            // режим редактирования
            if (idPilot > -1)
            {
                // получить все неназначенные и свою
                cards = (from ca in admin.model.getAllDiscountCards()
                         where
                         ca.owner == null || ca.idOwner == idPilot
                         select ca).OrderBy(m
                                            => m.Number);
            }
            else
            {
                // получить все неназначенные
                cards = admin.model.getAllDiscountCards().Where(m =>
                                                                m.owner == null).OrderBy(m => m.Number);
            }


            for (int i = 0; i < cards.Count(); i++)
            {
                ci = new comboBoxItem(cards.ElementAt(i).Number,
                                      cards.ElementAt(i).Id);

                cards_comboBox2.Items.Add(ci);
            }

            if (idPilot != -1)
            {
                model.DiscountCard userCard =
                    (from ca in admin.model.getAllDiscountCards()
                     where ca.idOwner == idPilot
                     select ca).Take(1).SingleOrDefault();

                if (userCard != null)
                {
                    ci.selectComboBoxValueById(cards_comboBox2, userCard.Id);
                }
            }
        }
コード例 #3
0
ファイル: Add.cs プロジェクト: paradoxUA/webtest
        // edit mode
        public Discount_Card_Add(AdminControl ad, int idCard)
        {
            InitializeComponent();

            this.Text = "Редактирование скидочной карты";
            admin     = ad;
            fillDiscountCardTypies();


            DiscountCard someCard = admin.model.getAllDiscountCards().Where(m => m.Id == idCard).Take(1).SingleOrDefault();

            if (someCard == null)
            {
                return;
            }

            fillOwners(true, Convert.ToInt32(someCard.idOwner));

            currentCardForEditMode = someCard;

            isEditMode = true;
            cardNumber_textBox1.Enabled = false;

            cardNumber_textBox1.Text = someCard.Number;

            if (someCard.idOwner != null)
            {
                ci.selectComboBoxValueById(owner_comboBox1,
                                           Convert.ToInt32(someCard.idOwner));
            }

            if (someCard.IdDiscountCardGroup != null)
            {
                ci.selectComboBoxValueById(cardGroup_comboBox1,
                                           Convert.ToInt32(someCard.IdDiscountCardGroup));
            }
        }
コード例 #4
0
        private void fillRaceModes()
        {
            List <Hashtable> data = parent.admin.model.GetAllRaceModes(" and is_deleted <> 1 ");

            for (int i = 0; i < data.Count; i++)
            {
                comboBoxItem someItem =
                    new comboBoxItem(Convert.ToString(data[i]["name"]),
                                     Convert.ToInt32(data[i]["id"]));

                raceMode_comboBox1.Items.Add(someItem);
            }

            comboBoxItem ci = new comboBoxItem("", -1);

            ci.selectComboBoxValueById(raceMode_comboBox1, Convert.ToInt32(parent.admin.Settings["default_race_mode_id"]));
        }
コード例 #5
0
        public DayStatistic(AdminControl ad, int page)
        {
            InitializeComponent();


            admin = ad;

            #region pagelister для Журнала заездов

            Pages = new PageLister(pageNumber_toolStripComboBox, firstPage_toolStripButton11, previousPage_toolStripButton12, nextPage_toolStripButton9, lastPage_toolStripButton10);

            Pages.PageSize          = 25;
            Pages.CurrentPageNumber = 1;
            pageSize_toolStripComboBox2.SelectedIndex = pageSize_toolStripComboBox2.Items.IndexOf("25");

            #endregion


            tabControl1.SelectedIndex = page;

            // dateTimePicker1.Value = dateTimePicker2.Value = DateTime.Now.Date;
            ci = new comboBoxItem("", -1);
            tracks_comboBox1.Items.Add(ci);
            List <Hashtable> Tracks = admin.model.GetAllTracks();


            for (int i = 0; i < Tracks.Count; i++)
            {
                ci = new comboBoxItem(Convert.ToString(Tracks[i]["name"]),
                                      Convert.ToInt32(Tracks[i]["id"]));

                tracks_comboBox1.Items.Add(ci);
                // tracks_comboBox1.Items.Add(Tracks[i]["name"]);
            }

            ci.selectComboBoxValueById(tracks_comboBox1,
                                       Convert.ToInt32(ad.Settings["default_track"]));

            //  tracks_comboBox1.SelectedIndex = 0;

            /*
             * ci.selectComboBoxValueById(eventsInRacesJournal_comboBox,
             * Convert.ToInt32(ad.Settings["default_track"]));
             */

            //trackInRacesJournal_comboBox.SelectedIndex = 0;
            switch (page)
            {
            case 0: GetDaySatistic(); break;

            case 1: /*admin.ShowRaceJurnal(Pages, dataGridView1, dateTimePicker2.Value, dateTimePicker5.Value, eventsInRacesJournal_comboBox.SelectedIndex); RaceJurnalCalculate();*/ break;

            case 2: admin.ShowBestResults(top40_dataGridView, ci.getSelectedValue(tracks_comboBox1), top40Record_labelSmooth12, true);  break;

            case 3: GetAllUsersStatistic(); break;

            case 4: GetAllKartStatistic(); break;
            }


            if (!admin.IS_SUPER_ADMIN)
            {
                tabPage5.Parent = tabControl2_del;
                tabPage7.Parent = tabControl2_del;
                tabPage8.Parent = tabControl2_del;
            }
        }
コード例 #6
0
        // покажем настройки на форме
        private void LoadSettings()
        {
            fillRaceModes();

            // настройки транспондеров
            string path = "transetts.xml";

            if (File.Exists(path))
            {
                DataSet ds = new DataSet();

                ds.ReadXml(path);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    dataGridView1.Rows.Add(row.ItemArray);
                    if (row.ItemArray[0].ToString().Trim().Length > 0)
                    {
                        comboBox3.Items.Add(row.ItemArray[0]);
                    }
                }
            }

            loadDbList();

            Hashtable sett = parent.admin.model.LoadSettings();

            // Закладка Общие настройки
            numericUpDown4.Value   = Convert.ToInt32(sett["time_start"]);
            numericUpDown5.Value   = Convert.ToInt32(sett["time_end"]);
            checkBox1.Checked      = Convert.ToBoolean(sett["time_wrap"]);
            numericUpDown1.Value   = Convert.ToInt32(sett["wrap_pos"]);
            checkBox8.Checked      = Convert.ToBoolean(sett["show_events"]);
            numericUpDown1.Enabled = checkBox1.Checked;
            checkBox6.Checked      = Convert.ToBoolean(sett["enter_password"]);
            numericUpDown7.Value   = Convert.ToInt32(sett["sertificat_day"]);
            checkBox9.Checked      = Convert.ToBoolean(sett["card_user"]);
            checkBox10.Checked     = Convert.ToBoolean(sett["beep_system"] ?? false);
            checkBox11.Checked     = Convert.ToBoolean(sett["beep_windows"] ?? false);
            showUniqueBestResults_checkBox.Checked = Convert.ToBoolean(sett["uniquebestres"] ?? false);


            // Закладка оборудование
            comboBox1.SelectedIndex = comboBox1.Items.IndexOf(sett["rs232_port"]);
            comboBox3.SelectedIndex = comboBox3.Items.IndexOf(sett["decoder"]);
            comboBox4.SelectedIndex = comboBox4.Items.IndexOf(sett["printer_result"]);
            comboBox5.SelectedIndex = comboBox5.Items.IndexOf(sett["printer_check"]);
            checkBox2.Checked       = Convert.ToBoolean(sett["print_check"]);

            // Закладка Гонка
            checkBox3.Checked = Convert.ToBoolean(sett["stop_on_pause"]);
            checkBox4.Checked = Convert.ToBoolean(sett["start_after_detection"]);
            checkBox5.Checked = Convert.ToBoolean(sett["print_result"]);
            checkBox7.Checked = Convert.ToBoolean(sett["show_zero_lap"]);
            minimumLapTime_numericUpDown2.Value = Convert.ToInt32(sett["noise_time"]);
            numericUpDown3.Value = Convert.ToInt32(sett["track_length"]);
            //numericUpDown6.Value = Convert.ToInt32(sett["race_time"]);

            // время гонки по умолчанию
            // заполнить список с временами гонки

            if (sett["default_race_mode_id"] != null)
            {
                comboBoxItem ci = new comboBoxItem("", -1);
                ci.selectComboBoxValueById(defaultRaceMode_comboBox6, Convert.ToInt32(sett["default_race_mode_id"]));
            }
            // defaultRaceMode_comboBox6.SelectedValue = sett["default_race_mode_id"];


            try
            {
                textBox1.Text = sett["fuel_on_lap"].ToString();
            }
            catch (Exception ex)
            {
            }

            comboBox2.SelectedIndex = comboBox2.Items.IndexOf(parent.admin.model.GetTrackName(sett["default_track"].ToString()));


            if (Convert.ToBoolean(sett["warm_subtract"]) == true)
            {
                checkBox14.Checked = true;
            }
            else
            {
                checkBox14.Checked = false;
            }

            numericUpDown8.Value = Convert.ToInt32(sett["warm_time"] ?? 0);

            // connection string
            Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);

            connectionString_textBox9.Text = config.AppSettings.Settings["crazykartConnectionString"].Value;

            //Закладка временных скидок
            isTimeDiscountsAvailable_checkBox13.Checked = Convert.ToBoolean(sett["racesale"] ?? false);
            numericUpDown9.Value  = Convert.ToInt32(sett["sale_onelap"] ?? 0);
            numericUpDown10.Value = Convert.ToInt32(sett["sale_half"] ?? 0);

            isHalfModesEnabled_checkBox.Checked = Convert.ToBoolean(sett["halfModesEnabled"] ?? false);

            // Анонсер
            if (sett["images_for_anonser"] != null)
            {
                anonserImagesFolder_textBox9.Text = sett["images_for_anonser"].ToString();
            }
            else
            {
                anonserImagesFolder_textBox9.Text = "";
            }

            if (sett["sponsors_images_for_anonser"] != null)
            {
                sponsorsImagesFolder_textBox9.Text = sett["sponsors_images_for_anonser"].ToString();
            }
            else
            {
                sponsorsImagesFolder_textBox9.Text = "";
            }

            nextRacePilotsTimer_numericUpDown11.Value =
                Convert.ToInt32(sett["anonser_nextRacePilotsTimer"]);                                       // Показывает пилотов следующего рейса

            raceLoadTimer_numericUpDown12.Value      = Convert.ToInt32(sett["anonser_raceLoadTimer"]);      // Показывает загрузку рейса
            bestResultTimer_numericUpDown13.Value    = Convert.ToInt32(sett["anonser_bestResultTimer"]);    // Показывает лучший результат
            currentResultTimer_numericUpDown14.Value = Convert.ToInt32(sett["anonser_currentResultTimer"]); // время по кругам
            anonserImageRotator_numericUpDown2.Value = Convert.ToInt32(sett["anonser_imageRotateTimer"]);   // смена картинки, когда нет заезда

            sponsorsImagesRotator_numericUpDown2.Value = Convert.ToInt32(sett["sponsors_images_rotate_timer"]);
            sponsorsImagesFolder_textBox9.Text         = Convert.ToString(sett["sponsors_images_for_anonser"]);



            List <string> SettFromFile = parent.admin.LoadSettings();

            if (SettFromFile.Count > 0)
            {
                string[] MySQLData = parent.admin.ParseMySQLConfig(SettFromFile[0]);

                textBox2.Text = MySQLData[0];
                textBox3.Text = MySQLData[1];
                textBox4.Text = MySQLData[2];
                textBox5.Text = MySQLData[3];
                textBox6.Text = MySQLData[4];
            }
        }