Exemplo n.º 1
0
        private void ButAdd_Click(object sender, RoutedEventArgs e)
        {
            SQLDataBase dataBase = new SQLDataBase();

            if (TextIsDate(BoxBirthday.Text))
            {
                if (BoxName.Text != string.Empty && BoxSum.Text != string.Empty)
                {
                    var temp = new SimpleLegalEnity(BoxName.Text, "Юридическое лицо",
                                                    DateTime.Parse(BoxBirthday.Text), decimal.Parse(BoxSum.Text));
                    Bank.Add(temp);
                    dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.Name}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}', N'{temp.reputation}',N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                    Close();
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены", "WARNING", MessageBoxButton.OK,
                                    MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show("Введите корректную дату создания", "WARNING", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     new Instance();
     Config.CheckAppSettings();
     SQLDataBase.Build();
     new Actions().LoadActionsIntoDB();
     //use args to set up framework properties like debugging and show console ect.
     try
     {
         //call the appropriate controller method, this may also be controled by argument
         new Controller(DefaultController);
     }
     catch (Exception ex)
     {
         ConsoleLogger.LogTestResults();
         ConsoleLogger.Log(ex);
         ConsoleLogger.Log();
     }
     finally
     {
         try {
             Driver.driver.Quit();
             Driver.service.Dispose();
             KillProcessByID(Driver.serviceId, true);
         }
         catch { }
     }
     //the command line command structure to call the framework would need to be well documented
 }
Exemplo n.º 3
0
        private void SQLupdate <T>(T client)
        {
            SQLDataBase dataBase = new SQLDataBase();
            string      sql      = string.Empty;

            if (client is SimpleNaturalClient)
            {
                var temp = client as SimpleNaturalClient;
                sql = $@"
UPDATE AllNaturalClients SET AmountOfMoney = {temp.AmountOfMoney} WHERE Id = {temp.ID}
";
            }
            else if (client is SimpleLegalEnity)
            {
                var temp = client as SimpleLegalEnity;
                sql = $@"
UPDATE AllLegalClients SET AmountOfMoney = {temp.AmountOfMoney} WHERE Id = {temp.ID}
";
            }
            else if (client is VipNaturalClient)
            {
                var temp = client as VipNaturalClient;
                sql = $@"
UPDATE AllVipNaturalClients SET AmountOfMoney = {temp.AmountOfMoney} WHERE Id = {temp.ID}
";
            }
            else if (client is VipLegalEnity)
            {
                var temp = client as VipLegalEnity;
                sql = $@"
UPDATE AllVipLegalClients SET AmountOfMoney = {temp.AmountOfMoney} WHERE Id = {temp.ID}
";
            }
            dataBase.sql_upgade(sql);
        }
Exemplo n.º 4
0
 private void Start()
 {
     if (gameLevelsInfo == null)
     {
         gameLevelsInfo = SQLDataBase.LoadLevels();
     }
 }
Exemplo n.º 5
0
 public static void ConfigDataBase()
 {
     if (!System.IO.File.Exists(@"C:\Users\alann\Videos\PIC\SQL\PIC.sqlite"))
     {
         SQLDataBase.CreateDataBase();
         SQLDataBase.CreateTable();
         SQLDataBase.RestoreUtterancesData();
     }
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            new Instance();
            Config.CheckAppSettings();
            SQLDataBase.Build();
            new ActionExamples().LoadActionsIntoDB();

            //////TEST CODE BELOW///////
            ActionExamples.Execute("Click");
            ActionExamples.Execute("SendText", new string[] { "I am writing all the text for this output." });
            ActionExamples.Execute("Update");
            Console.ReadLine();
        }
Exemplo n.º 7
0
 private async Task TryToTranslate(string txt)
 {
     await Task.Run(() =>
     {
         if (!String.IsNullOrEmpty(txt))
         {
             string videoPath;
             string speech  = txt.Remove(txt.Length - 1);
             string[] words = speech.Split(' ');
             int i          = 0;
             while (true)
             {
                 if (words.Length == 1)
                 {
                     videoPath = SQLDataBase.GetVideoPath(words[i]);
                     if (!String.IsNullOrEmpty(videoPath))
                     {
                         Enfileira(videoPath);
                     }
                     break;
                 }
                 if ((words.Length - 1) < i)
                 {
                     break;
                 }
                 if ((words.Length - 1) < i + 1)
                 {
                     videoPath = null;
                 }
                 else
                 {
                     videoPath = SQLDataBase.GetVideoPath(words[i] + ' ' + words[i + 1]);
                 }
                 if (String.IsNullOrEmpty(videoPath))
                 {
                     videoPath = SQLDataBase.GetVideoPath(words[i]);
                     if (!String.IsNullOrEmpty(videoPath))
                     {
                         Enfileira(videoPath);
                     }
                     i++;
                 }
                 else
                 {
                     Enfileira(videoPath);
                     i = i + 2;
                 }
             }
         }
     });
 }
Exemplo n.º 8
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(this.gameObject);

            OpenDB("LocalDataBase.s3db");
        }
        else
        {
            Destroy(this);
        }
    }
Exemplo n.º 9
0
    public void ColorUnlockResponse(bool option)
    {
        if (option)
        {
            PlayerStatsistics.NewColorUnlocked();
            Destroy(firstColorList.transform.GetChild(colorSelected).transform.GetChild(0).gameObject);
            Destroy(secondColorList.transform.GetChild(colorSelected).transform.GetChild(0).gameObject);
            PlayerPrefsManager.SetPlayerPoints(PlayerPrefsManager.GetPlayerPoints() - colorCost);
            SQLDataBase.SaveShopItem(10, colorSelected);
            playerPoints.text = "Points: " + PlayerPrefsManager.GetPlayerPoints();
        }

        colorUnlockPanel.SetActive(false);
    }
Exemplo n.º 10
0
    private void Start()
    {
        if (shopItems == null)
        {
            shopItems = SQLDataBase.LoadShopItems();
        }

        skinInfo          = GameSettings.Instance.skinInfo[mechanicID];
        playerPoints.text = "Points: " + PlayerPrefsManager.GetPlayerPoints();

        firstSelect.SetParent(firstColorList.transform);
        secondSelect.SetParent(secondColorList.transform);

        SetColorsList();
        LoadSkins();
        Invoke("SetSelectionsPos", 0.1f);
    }
Exemplo n.º 11
0
    public static void AchievementCollected(int achievID)
    {
        if (Instance.achievements[achievID - 1].collected)
        {
            return;
        }

        Instance.achievPanel.SetActive(true);
        Text[] texts = Instance.achievPanel.GetComponentsInChildren <Text>();
        texts[0].text = Instance.achievements[achievID - 1].name;
        texts[1].text = Instance.achievements[achievID - 1].description;

        Instance.animator.SetTrigger("ShowAchiev");
        Instance.Invoke("HideAchievementPanel", Instance.achievShowTime);

        SQLDataBase.SaveAchievement(achievID);
    }
Exemplo n.º 12
0
        /// <summary>
        /// Оформление кредита
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButCredit_Click(object sender, RoutedEventArgs e)
        {
            SQLDataBase dataBase = new SQLDataBase();

            if (BoxCountMonth.Text != string.Empty && BoxSum.Text != string.Empty && BoxTestTime.Text != string.Empty)
            {
                try
                {
                    if (item is SimpleNaturalClient)
                    {
                        var temp = item as SimpleNaturalClient;
                        (item as SimpleNaturalClient).Credit(decimal.Parse(BoxSum.Text), int.Parse(BoxCountMonth.Text),
                                                             DateTime.Now, DateTime.Now.AddMonths(int.Parse(BoxTestTime.Text)));
                        using (var cmd = new SqlCommand($@"UPDATE AllNaturalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckDebt] = @CheckDebt WHERE Id = {temp.ID}", dataBase.connection))
                        {
                            dataBase.connection.Open();
                            cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value = temp.AmountOfMoney;
                            cmd.Parameters.Add("@CheckDebt", SqlDbType.Decimal).Value     = temp.CheckDebt;
                            cmd.ExecuteNonQuery();
                        }
                    }

                    if (item is SimpleLegalEnity)
                    {
                        var temp = item as SimpleLegalEnity;
                        (item as SimpleLegalEnity).Credit(decimal.Parse(BoxSum.Text), int.Parse(BoxCountMonth.Text),
                                                          DateTime.Now, DateTime.Now.AddMonths(int.Parse(BoxTestTime.Text)));
                        using (var cmd = new SqlCommand($@"UPDATE AllLegalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckDebt] = @CheckDebt WHERE Id = {temp.ID}", dataBase.connection))
                        {
                            dataBase.connection.Open();
                            cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value = temp.AmountOfMoney;
                            cmd.Parameters.Add("@CheckDebt", SqlDbType.Decimal).Value     = temp.CheckDebt;
                            cmd.ExecuteNonQuery();
                        }
                    }

                    if (item is VipNaturalClient)
                    {
                        var temp = item as VipNaturalClient;
                        (item as VipNaturalClient).Credit(decimal.Parse(BoxSum.Text), int.Parse(BoxCountMonth.Text),
                                                          DateTime.Now, DateTime.Now.AddMonths(int.Parse(BoxTestTime.Text)));
                        using (var cmd = new SqlCommand($@"UPDATE AllVipNaturalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckDebt] = @CheckDebt WHERE Id = {temp.ID}", dataBase.connection))
                        {
                            dataBase.connection.Open();
                            cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value = temp.AmountOfMoney;
                            cmd.Parameters.Add("@CheckDebt", SqlDbType.Decimal).Value     = temp.CheckDebt;
                            cmd.ExecuteNonQuery();
                        }
                    }

                    if (item is VipLegalEnity)
                    {
                        var temp = item as VipLegalEnity;
                        (item as VipLegalEnity).Credit(decimal.Parse(BoxSum.Text), int.Parse(BoxCountMonth.Text),
                                                       DateTime.Now, DateTime.Now.AddMonths(int.Parse(BoxTestTime.Text)));
                        using (var cmd = new SqlCommand($@"UPDATE AllVipLegalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckDebt] = @CheckDebt WHERE Id = {temp.ID}", dataBase.connection))
                        {
                            dataBase.connection.Open();
                            cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value = temp.AmountOfMoney;
                            cmd.Parameters.Add("@CheckDebt", SqlDbType.Decimal).Value     = temp.CheckDebt;
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
                catch (AgeExceptions exception)
                {
                    MessageBox.Show(exception.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Stop);
                }
                finally
                {
                    Close();
                }
            }
            else
            {
                MessageBox.Show("НЕ ВСЕ ПОЛЯ ЗАПОЛНЕНЫ", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Открытие Вклада
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButAddCapit_Click(object sender, RoutedEventArgs e)
        {
            SQLDataBase dataBase = new SQLDataBase();

            if (BoxCountMonth.Text == string.Empty || BoxSum.Text == string.Empty)
            {
                MessageBox.Show("Не все поля заполнены!", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            DateTime time = DateTime.Today;

            time = time.AddMonths(-int.Parse(BoxCountMonth.Text));

            if (item is SimpleNaturalClient)
            {
                if (((item as SimpleNaturalClient).AmountOfMoney - decimal.Parse(BoxSum.Text)) < 0)
                {
                    MessageBox.Show("НУЖНО БОЛЬШЕ ЗОЛОТА", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    var temp = item as SimpleNaturalClient;
                    Contribution(capit, item as SimpleNaturalClient, int.Parse(BoxCountMonth.Text),
                                 decimal.Parse(BoxSum.Text));
                    using (var cmd = new SqlCommand($@"UPDATE AllNaturalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckContribution] = @CheckContribution WHERE Id = {temp.ID}", dataBase.connection))
                    {
                        dataBase.connection.Open();
                        cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value     = temp.AmountOfMoney;
                        cmd.Parameters.Add("@CheckContribution", SqlDbType.Decimal).Value = temp.CheckContribution;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            else if (item is SimpleLegalEnity)
            {
                if ((item as SimpleLegalEnity).AmountOfMoney - decimal.Parse(BoxSum.Text) < 0)
                {
                    MessageBox.Show("НУЖНО БОЛЬШЕ ЗОЛОТА", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    var temp = item as SimpleLegalEnity;
                    Contribution(capit, item as SimpleLegalEnity, int.Parse(BoxCountMonth.Text),
                                 decimal.Parse(BoxSum.Text));
                    using (var cmd = new SqlCommand($@"UPDATE AllLegalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckContribution] = @CheckContribution WHERE Id = {temp.ID}", dataBase.connection))
                    {
                        dataBase.connection.Open();
                        cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value     = temp.AmountOfMoney;
                        cmd.Parameters.Add("@CheckContribution", SqlDbType.Decimal).Value = temp.CheckContribution;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            else if (item is VipNaturalClient)
            {
                if (((item as VipNaturalClient).AmountOfMoney - decimal.Parse(BoxSum.Text)) < 0)
                {
                    MessageBox.Show("НУЖНО БОЛЬШЕ ЗОЛОТА", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    var temp = item as VipNaturalClient;
                    Contribution(capit, item as VipNaturalClient, int.Parse(BoxCountMonth.Text),
                                 decimal.Parse(BoxSum.Text));
                    using (var cmd = new SqlCommand($@"UPDATE AllVipNaturalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckContribution] = @CheckContribution WHERE Id = {temp.ID}", dataBase.connection))
                    {
                        dataBase.connection.Open();
                        cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value     = temp.AmountOfMoney;
                        cmd.Parameters.Add("@CheckContribution", SqlDbType.Decimal).Value = temp.CheckContribution;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            else if (item is VipLegalEnity)
            {
                if (((item as VipLegalEnity).AmountOfMoney - decimal.Parse(BoxSum.Text)) < 0)
                {
                    MessageBox.Show("НУЖНО БОЛЬШЕ ЗОЛОТА", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    var temp = item as VipLegalEnity;
                    Contribution(capit, item as VipLegalEnity, int.Parse(BoxCountMonth.Text),
                                 decimal.Parse(BoxSum.Text));
                    using (var cmd = new SqlCommand($@"UPDATE AllVipLegalClients SET  [AmountOfMoney] = @AmountOfMoney, [CheckContribution] = @CheckContribution WHERE Id = {temp.ID}", dataBase.connection))
                    {
                        dataBase.connection.Open();
                        cmd.Parameters.Add("@AmountOfMoney", SqlDbType.Decimal).Value     = temp.AmountOfMoney;
                        cmd.Parameters.Add("@CheckContribution", SqlDbType.Decimal).Value = temp.CheckContribution;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            Close();
        }
Exemplo n.º 14
0
 public static void SaveLevelToDataBase(int LevelID)
 {
     SQLDataBase.SaveLevel(Instance.gameLevelsInfo[LevelID]);
 }
Exemplo n.º 15
0
        /// <summary>
        /// Запуск процесса генерации сотрудников
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButGoToMass_Click(object sender, RoutedEventArgs e)
        {
            List <string> Client_FirstNames = new List <string>();

            Client_FirstNames = LoadNames("../../../resources/Names.txt");
            List <string> Client_LastNames = new List <string>();

            Client_LastNames = LoadNames("../../../resources/LastNames.txt");
            int count_workers = 0;

            try
            {
                count_workers = int.Parse(RandomBox.Text); //количество рабочих
            }
            catch (FormatException)
            {
                count_workers = default(int);
                MessageBox.Show("Неверный формат, можно вводить только цифры!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            Random      r           = new Random();
            Random      random_spec = new Random(); //специальность
            Random      random_name = new Random();
            Random      random_dep  = new Random();
            SQLDataBase dataBase    = new SQLDataBase();

            while (count_workers > 0)
            {
                int count = Bank.Count;
                switch (random_spec.Next(1, 5))
                {
                case 1:
                {
                    var temp = new SimpleNaturalClient($"{Client_FirstNames[random_name.Next(Client_FirstNames.Count)]}",
                                                       $"{Client_LastNames[random_name.Next(Client_LastNames.Count)]}",
                                                       "Физический",
                                                       DateTime.Now.AddYears(-r.Next(16, 80)), (decimal)r.Next(20000, 2000000));
                    Bank.Add(temp);
                    dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.FirstName}', N'{temp.LastName}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}', N'{temp.reputation}',
N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                    break;
                }

                case 2:
                {
                    var temp = new SimpleLegalEnity($"{Client_FirstNames[random_name.Next(Client_FirstNames.Count)]}",
                                                    "Юридический",
                                                    DateTime.Now.AddYears(-r.Next(18, 80)), (decimal)r.Next(20000, 2000000));
                    Bank.Add(temp);
                    dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.Name}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}', N'{temp.reputation}',N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                    break;
                }

                case 3:
                {
                    var temp = new VipNaturalClient($"{Client_FirstNames[random_name.Next(Client_FirstNames.Count)]}",
                                                    $"{Client_LastNames[random_name.Next(Client_LastNames.Count)]}",
                                                    "VIP",
                                                    DateTime.Now.AddYears(-r.Next(18, 80)), (decimal)r.Next(20000, 2000000));

                    Bank.Add(temp);
                    dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.FirstName}', N'{temp.LastName}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}',
N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                    break;
                }

                case 4:
                {
                    var temp = new VipLegalEnity($"{Client_FirstNames[random_name.Next(Client_FirstNames.Count)]}",
                                                 "VIP",
                                                 DateTime.Now.AddYears(-r.Next(16, 80)), (decimal)r.Next(20000, 2000000));

                    Bank.Add(temp);
                    dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.Name}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}', N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                    break;
                }

                default:
                    break;
                }
                count_workers--;
            }
            MessageBox.Show("Готово", "Complite", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            Close();
        }
Exemplo n.º 16
0
        /// <summary>
        /// Добавить клиента
        /// </summary>
        private void AddClient()
        {
            SQLDataBase dataBase = new SQLDataBase();

            if (RadioNatural.IsChecked == true)
            {
                if (TextIsDate(BoxBirthday.Text))
                {
                    if (BoxFirstName.Text != string.Empty && BoxLastName.Text != string.Empty &&
                        BoxBirthday.Text != string.Empty && BoxSumNatur.Text != string.Empty)
                    {
                        var temp = new VipNaturalClient(BoxFirstName.Text, BoxLastName.Text, "VIP",
                                                        DateTime.Parse(BoxBirthday.Text), decimal.Parse(BoxSumNatur.Text));
                        Bank.Add(temp);
                        dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.FirstName}', N'{temp.LastName}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}',
N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Не все поля введены!", "WARNING", MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("введите дату в формате dd.MM.yyyy", "WARNING", MessageBoxButton.OK,
                                    MessageBoxImage.Warning);
                }
            }
            else
            {
                if (TextIsDate(BoxCreateDate.Text))
                {
                    if (BoxName.Text != string.Empty &&
                        BoxCreateDate.Text != string.Empty && BoxSumLegal.Text != string.Empty)
                    {
                        var temp = new VipLegalEnity(BoxName.Text, "VIP",
                                                     DateTime.Parse(BoxCreateDate.Text), decimal.Parse(BoxSumLegal.Text));
                        Bank.Add(temp);
                        dataBase.GoToDataBase(dataBase.CreateSQL(temp) + $@"
(
{temp.ID}, N'{temp.Name}', '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}', N'{temp.Department}', {temp.AccountNumber},
{temp.AmountOfMoney}, {temp.CheckContribution}, {temp.CheckDebt}
)
");
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Не все поля введены!", "WARNING", MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("введите дату в формате dd.MM.yyyy", "WARNING", MessageBoxButton.OK,
                                    MessageBoxImage.Warning);
                }
            }
        }
Exemplo n.º 17
0
 public foo(SQLDataBase sqlDataBase)
 {
     _sqlDataBase = sqlDataBase;
 }
Exemplo n.º 18
0
 void Start()
 {
     achievements = SQLDataBase.LoadAchievements();
 }
Exemplo n.º 19
0
 public static void SkinChanged(int mechanicID)
 {
     SQLDataBase.SaveSkinInfo(Instance.skinInfo[mechanicID]);
 }
Exemplo n.º 20
0
        /// <summary>
        /// Редактировать клиента
        /// </summary>
        private void EditClient()
        {
            SQLDataBase dataBase = new SQLDataBase();
            string      sql      = string.Empty;

            if (RadioNatural.IsChecked == true)
            {
                if (TextIsDate(BoxBirthday.Text))
                {
                    if (BoxFirstName.Text != string.Empty && BoxLastName.Text != string.Empty &&
                        BoxBirthday.Text != string.Empty)
                    {
                        if (item is SimpleNaturalClient)
                        {
                            var temp = item as NaturalClient;
                            Bank.Edit(item as NaturalClient, BoxFirstName.Text, BoxLastName.Text,
                                      GetAge(BoxBirthday.Text));
                            sql = $@"
UPDATE AllNaturalClients SET [FirstName] = N'{temp.FirstName}', [LastName] = N'{temp.LastName}', 
[DateOfBirth] = '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}' 
WHERE Id = {temp.ID}
" + "\n";
                            dataBase.sql_upgade(sql);
                        }
                        else
                        {
                            var temp = item as VipNaturalClient;
                            Bank.Edit(item as VipNaturalClient, BoxFirstName.Text, BoxLastName.Text,
                                      GetAge(BoxBirthday.Text));
                            sql = $@"
UPDATE AllVipNaturalClients SET [FirstName] = N'{temp.FirstName}', [LastName] = N'{temp.LastName}', 
[DateOfBirth] = '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}'
WHERE Id = {temp.ID}
" + "\n";
                            dataBase.sql_upgade(sql);
                        }
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Не все поля введены!", "WARNING", MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("введите дату в формате dd.MM.yyyy", "WARNING", MessageBoxButton.OK,
                                    MessageBoxImage.Warning);
                }
            }
            else
            {
                if (TextIsDate(BoxCreateDate.Text))
                {
                    if (BoxName.Text != string.Empty &&
                        BoxCreateDate.Text != string.Empty)
                    {
                        if (item is SimpleLegalEnity)
                        {
                            var temp = item as SimpleLegalEnity;
                            Bank.Edit(item as SimpleLegalEnity, BoxName.Text, GetAge(BoxCreateDate.Text));
                            sql = $@"
UPDATE AllLegalClients SET [Name] = N'{temp.Name}', 
[DateOfBirth] = '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}'
WHERE Id = {temp.ID}
" + "\n";
                            dataBase.sql_upgade(sql);
                        }
                        else
                        {
                            var temp = item as VipLegalEnity;
                            Bank.Edit(item as VipLegalEnity, BoxName.Text, GetAge(BoxCreateDate.Text));
                            sql = $@"
UPDATE AllVipLegalClients SET [Name] = N'{temp.Name}', 
[DateOfBirth] = '{Convert.ToDateTime(temp.DateofBirth).ToString("yyyy-MM-dd")}'
WHERE Id = {temp.ID}
" + "\n";
                            dataBase.sql_upgade(sql);
                        }
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Не все поля введены!", "WARNING", MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("введите дату в формате dd.MM.yyyy", "WARNING", MessageBoxButton.OK,
                                    MessageBoxImage.Warning);
                }
            }
        }
Exemplo n.º 21
0
 private static void GetSkinInfo()
 {
     Instance.skinInfo = SQLDataBase.LoadSkins();
 }