Beispiel #1
0
        public static void SearchPlanInfo(string planID, out plan PLAN, out int plan_status, out string projectID)
        {
            MySqlConnection conn = new MySqlConnection(Conn);
            MySqlCommand    command;

            conn.Open();

            string sql = String.Format("select plan_name, plan_priority, plan_status, plan_project ,description,plan_manager from table_plan where plan_id = {0}", planID);

            command = new MySqlCommand(sql, conn);
            var reader = command.ExecuteReader();

            reader.Read();

            string plan_name     = reader["plan_name"].ToString();
            int    plan_priority = int.Parse(reader["plan_priority"].ToString());

            plan_status = int.Parse(reader["plan_status"].ToString());
            projectID   = reader["plan_project"].ToString();
            string description    = reader["description"].ToString();
            string plan_managerID = reader["plan_manager"].ToString();

            reader.Close();
            string sql2 = String.Format("select user_name from table_user_info where user_id = {0}", plan_managerID);

            command = new MySqlCommand(sql2, conn);
            var reader2 = command.ExecuteReader();

            reader2.Read();
            string plan_managerName = reader2["user_name"].ToString();

            // MessageBox.Show(plan_managerName);
            PLAN = new plan(plan_name, description, plan_managerName, plan_managerID, plan_priority);
            conn.Close();
        }
        private void InitiateInfos()
        {
            plan   p           = new plan("", "", "", "", 0);
            string projectID   = "";
            int    plan_status = 0;

            Global_Database.SearchPlanInfo(planID, out p, out plan_status, out projectID);

            MessageBox.Show(p.description);
            textBox_planName.Text           = p.name;
            comboBox_priority.SelectedIndex = p.priority;
            textBox_manageName.Text         = p.manager_name;
            textBox_manageName.ReadOnly     = true;
            textBox_managerID.Text          = p.manager_id;
            textBox_description.Text        = p.description;
            comboBox_priority.Enabled       = false;
        }