private void AddTask_Loaded(object sender, RoutedEventArgs e)
        {
            if (taskID == 0)
            {
                typeList = new List <string>()
                {
                    "Анализ и проектирование", "Установка оборудования", "Техническое обслуживание и сопровождение"
                };
                TypeCB.ItemsSource = typeList;
                StatusTB.Text      = "Запланирована";
            }
            else
            {
                NameField.IsReadOnly       = true;
                DescTB.IsReadOnly          = true;
                ComplexityField.IsReadOnly = true;
                NeedTime.IsReadOnly        = true;
                AddBtn.IsEnabled           = false;
            }
            MySqlConnection conn = DBUtils.GetDBConnection();

            conn.Open();
            try
            {
                if (taskID == 0)
                {
                    List <string> perfList = new List <string>();
                    dbHandler     db       = new dbHandler();
                    executors = db.GetExecutors(conn, id);
                    foreach (KeyValuePair <int, string> keyValue in executors)
                    {
                        perfList.Add(keyValue.Value);
                    }
                    PerfCB.ItemsSource = perfList;
                }
                else
                {
                    GetTask(conn, taskID);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 2
0
        private void SalaryBtn_Click(object sender, RoutedEventArgs e)
        {
            MySqlConnection conn = DBUtils.GetDBConnection();

            conn.Open();
            try
            {
                dbHandler db = new dbHandler();
                coeffList = db.GetCoefficients(conn, id);
                executors = db.GetExecutors(conn, id);
                GetSalary(conn);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
Exemplo n.º 3
0
        private void Manager_Loaded(object sender, RoutedEventArgs e)
        {
            LoginLabel.Content    = "Ваш логин: " + login;
            FullNameLabel.Content = "ФИО Менеджера: " + fullName;

            var statusList = new List <string>()
            {
                "Любой статус", "Запланирована", "Выполняется", "Завершена", "Отменена"
            };

            StatusCB.ItemsSource = statusList;


            MySqlConnection conn = DBUtils.GetDBConnection();

            conn.Open();
            try
            {
                dbHandler db = new dbHandler();
                executors = db.GetExecutors(conn, id);
                ExecutorsCB.Items.Add("Все исполнители");
                foreach (KeyValuePair <int, string> keyValue in executors)
                {
                    ExecutorsCB.Items.Add(keyValue.Value);
                }
                GetTasks(conn);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }