예제 #1
0
        public List <CExigence> GetExigenceForProjet(int idProjet)
        {
            List <CExigence> listExigence = new List <CExigence>();

            connection.Open();
            SqlCommand myCommand = new SqlCommand();

            myCommand.Connection = connection;

            myCommand.CommandText = "SELECT [TExi_Id],[TExi_Description],[TExi_Type],[TExi_FK_TPro] FROM [TExigence] WHERE TExi_FK_TPro = @idProjet AND TExi_Actif = 1";
            myCommand.Parameters.Add(new SqlParameter("@idProjet", idProjet));

            SqlDataReader reader = myCommand.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    CExigence exigence = new CExigence((int)reader[0], reader[1].ToString(), (int)reader[2], (int)reader[3]);
                    listExigence.Add(exigence);
                }
            }
            else
            {
                Console.WriteLine("No rows found.");
            }
            reader.Close();

            connection.Close();

            return(listExigence);
        }
예제 #2
0
        public CExigence GetExigenceById(int id)
        {
            CExigence exigence = null;

            connection.Open();
            SqlCommand myCommand = new SqlCommand();

            myCommand.Connection = connection;

            myCommand.CommandText = "SELECT [TExi_Id],[TExi_Description],[TExi_Type],[TExi_FK_TPro] FROM [TExigence] WHERE TExi_Id = @TExi_Id AND TExi_Actif = 1";
            myCommand.Parameters.Add(new SqlParameter("@TExi_Id", id));

            SqlDataReader reader = myCommand.ExecuteReader();

            if (reader.HasRows)
            {
                reader.Read();
                exigence = new CExigence((int)reader[0], reader[1].ToString(), (int)reader[2], (int)reader[3]);
            }
            else
            {
                Console.WriteLine("No rows found.");
            }
            reader.Close();

            connection.Close();

            return(exigence);
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int       idProjet = int.Parse(Request.QueryString["idProjet"]);
            CProjet   projet   = daProjet.GetProjetById(idProjet);
            CExigence exigence = daExigence.GetExigenceById(ctrlIdExigence);

            idExi.InnerText = exigence.exi_id.ToString();
            if (exigence.exi_type.ToString() == "1")
            {
                typeExi.InnerText = "Fonctionnelle";
            }
            else if (exigence.exi_type.ToString() == "2")
            {
                typeExi.InnerText = "Données";
            }
            else if (exigence.exi_type.ToString() == "3")
            {
                typeExi.InnerText = "Preformance";
            }
            else if (exigence.exi_type.ToString() == "4")
            {
                typeExi.InnerText = "Interface utilisateur";
            }
            else if (exigence.exi_type.ToString() == "5")
            {
                typeExi.InnerText = "Qualité";
            }
            else if (exigence.exi_type.ToString() == "6")
            {
                typeExi.InnerText = "Services";
            }
            DescExi.InnerText = exigence.exi_description.ToString();
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int       idProjet = int.Parse(Request.QueryString["idProjet"]);
            CProjet   projet   = daProjet.GetProjetById(idProjet);
            CExigence exigence = daExigence.GetExigenceById(ctrlIdTache);

            idExi.InnerText = exigence.exi_id.ToString();

            DescExi.InnerText = exigence.exi_description.ToString();
        }
예제 #5
0
        protected void addButton_Click(object sender, EventArgs e)
        {
            string descExi = inDescExi.Value;
            string typeExi = inDropType.SelectedItem.Value;

            if (descExi != "" && Request.QueryString["idProjet"] != null)
            {
                CExigence nexExigence = new CExigence(descExi, int.Parse(typeExi), int.Parse(Request.QueryString["idProjet"]));
                daExigence.InsertExigence(nexExigence);
                MessageBox.Show("Ajout reussi");
                Response.Redirect(Request.RawUrl);
            }
            else
            {
                MessageBox.Show("Saisie invalide");
                Response.Redirect(Request.RawUrl);
            }
        }
예제 #6
0
        public bool InsertExigence(CExigence exigence)
        {
            bool bRet = false;

            connection.Open();
            SqlCommand myCommand = new SqlCommand();

            myCommand.Connection  = connection;
            myCommand.CommandText = "INSERT INTO TExigence ([TExi_Description],[TExi_Type],[TExi_FK_TPro]) VALUES (@TExi_Description,@TExi_Type,@TExi_FK_TPro)";
            myCommand.Parameters.Add(new SqlParameter("@TExi_Description", exigence.exi_description));
            myCommand.Parameters.Add(new SqlParameter("@TExi_Type", exigence.exi_type));
            myCommand.Parameters.Add(new SqlParameter("@TExi_FK_TPro", exigence.exi_projet));
            if (myCommand.ExecuteNonQuery() > 0)
            {
                bRet = true;
            }

            connection.Close();

            return(bRet);
        }