Exemple #1
0
            public static void Member(MemberObject obj)
            {
                string update = "UPDATE members SET name=:name, last_name=:last_name, address=:address, postalcode=:postalcode, city=:city, province=:province, telephonenumber=:telephonenumber WHERE id=:memberid";

                OracleCommand cmd = new OracleCommand(update, GetConnection());

                cmd.Parameters.Add(new OracleParameter("name", obj.Name));
                cmd.Parameters.Add(new OracleParameter("last_name", obj.LastName));
                cmd.Parameters.Add(new OracleParameter("address", obj.Address));
                cmd.Parameters.Add(new OracleParameter("postalcode", obj.PostalCode));
                cmd.Parameters.Add(new OracleParameter("city", obj.City));
                cmd.Parameters.Add(new OracleParameter("province", obj.Province));
                cmd.Parameters.Add(new OracleParameter("telephonenumber", obj.TelNumber));
                cmd.Parameters.Add(new OracleParameter("memberid", obj.ID));

                cmd.ExecuteNonQuery();

                Database.Update.Members();
            }
 private void btn_Modify_Click(object sender, EventArgs e)
 {
     try
     {
         MemberObject oMember = new MemberObject();
         oMember.ID         = int.Parse(((DataRowView)this._bs.Current).Row["ID"].ToString());
         oMember.Name       = txb_Name.Text.ToString();
         oMember.LastName   = txb_LastName.Text.ToString();
         oMember.Address    = txb_Adress.Text.ToString();
         oMember.PostalCode = txb_PostalCode.Text.ToString().ToUpper();
         oMember.City       = txb_City.Text.ToString();
         oMember.Province   = cb_Provinces.Text.ToString();
         oMember.TelNumber  = txb_Telephone.Text.ToString();
         Database_Connector.Update.Member(oMember);
         MessageBox.Show("Modification fait!");
         this.Close();
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
Exemple #3
0
            public static void Member(MemberObject obj)
            {
                string insert = "INSERT INTO members VALUES (MEMBERID.NEXTVAL, :name, :last_name, :address, :postalcode, :city, :province, :telephonenumber)";

                OracleCommand cmd = new OracleCommand(insert, GetConnection());

                cmd.Parameters.Add(new OracleParameter("name", obj.Name));
                cmd.Parameters.Add(new OracleParameter("last_name", obj.LastName));
                cmd.Parameters.Add(new OracleParameter("address", obj.Address));
                cmd.Parameters.Add(new OracleParameter("postalcode", obj.PostalCode));
                cmd.Parameters.Add(new OracleParameter("city", obj.City));
                cmd.Parameters.Add(new OracleParameter("province", obj.Province));
                cmd.Parameters.Add(new OracleParameter("telephonenumber", obj.TelNumber));
                if (obj.Name == "" || obj.LastName == "" || obj.Address == "" || obj.PostalCode == "" || obj.City == "" || obj.Province == "" || obj.TelNumber == "")
                {
                    throw new Exception("Les champs ne doivent pas etre vides");
                }
                cmd.ExecuteNonQuery();
                CloseConnection();
                Database.Update.Members();
            }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                MemberObject oMember = new MemberObject();
                oMember.Name = txb_Name.Text.ToString();
                oMember.LastName = txb_LastName.Text.ToString();
                oMember.Address = txb_Adress.Text.ToString();
                oMember.PostalCode = txb_PostalCode.Text.ToString().ToUpper();
                oMember.City = txb_City.Text.ToString();
                oMember.Province = cb_Provinces.Text.ToString();
                oMember.TelNumber = txb_Telephone.Text.ToString();
                if (!IsCanadianZipCode(oMember.PostalCode))
                    throw new Exception("Le code postal est invalide. Le format est A8A8A8");
                Database_Connector.Insert.Member(oMember);
                MessageBox.Show("Ajout fait!");
                this.Close();

            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
 private void btn_Add_Click(object sender, EventArgs e)
 {
     try
     {
         MemberObject oMember = new MemberObject();
         oMember.Name       = txb_Name.Text.ToString();
         oMember.LastName   = txb_LastName.Text.ToString();
         oMember.Address    = txb_Adress.Text.ToString();
         oMember.PostalCode = txb_PostalCode.Text.ToString().ToUpper();
         oMember.City       = txb_City.Text.ToString();
         oMember.Province   = cb_Provinces.Text.ToString();
         oMember.TelNumber  = txb_Telephone.Text.ToString();
         if (!IsCanadianZipCode(oMember.PostalCode))
         {
             throw new Exception("Le code postal est invalide. Le format est A8A8A8");
         }
         Database_Connector.Insert.Member(oMember);
         MessageBox.Show("Ajout fait!");
         this.Close();
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
        private void btn_Modify_Click(object sender, EventArgs e)
        {
            try
            {
                MemberObject oMember = new MemberObject();
                oMember.ID = int.Parse(((DataRowView)this._bs.Current).Row["ID"].ToString());
                oMember.Name = txb_Name.Text.ToString();
                oMember.LastName = txb_LastName.Text.ToString();
                oMember.Address = txb_Adress.Text.ToString();
                oMember.PostalCode = txb_PostalCode.Text.ToString().ToUpper();
                oMember.City = txb_City.Text.ToString();
                oMember.Province = cb_Provinces.Text.ToString();
                oMember.TelNumber = txb_Telephone.Text.ToString();
                Database_Connector.Update.Member(oMember);
                MessageBox.Show("Modification fait!");
                this.Close();

            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
            public static void Member(MemberObject obj)
            {
                string update = "UPDATE members SET name=:name, last_name=:last_name, address=:address, postalcode=:postalcode, city=:city, province=:province, telephonenumber=:telephonenumber WHERE id=:memberid";

                OracleCommand cmd = new OracleCommand(update, GetConnection());

                cmd.Parameters.Add(new OracleParameter("name", obj.Name));
                cmd.Parameters.Add(new OracleParameter("last_name", obj.LastName));
                cmd.Parameters.Add(new OracleParameter("address", obj.Address));
                cmd.Parameters.Add(new OracleParameter("postalcode", obj.PostalCode));
                cmd.Parameters.Add(new OracleParameter("city", obj.City));
                cmd.Parameters.Add(new OracleParameter("province", obj.Province));
                cmd.Parameters.Add(new OracleParameter("telephonenumber", obj.TelNumber));
                cmd.Parameters.Add(new OracleParameter("memberid", obj.ID));

                cmd.ExecuteNonQuery();

                Database.Update.Members();
            }
            public static void Member(MemberObject obj)
            {
                string insert = "INSERT INTO members VALUES (MEMBERID.NEXTVAL, :name, :last_name, :address, :postalcode, :city, :province, :telephonenumber)";

                OracleCommand cmd = new OracleCommand(insert, GetConnection());

                cmd.Parameters.Add(new OracleParameter("name", obj.Name));
                cmd.Parameters.Add(new OracleParameter("last_name", obj.LastName));
                cmd.Parameters.Add(new OracleParameter("address", obj.Address));
                cmd.Parameters.Add(new OracleParameter("postalcode", obj.PostalCode));
                cmd.Parameters.Add(new OracleParameter("city", obj.City));
                cmd.Parameters.Add(new OracleParameter("province", obj.Province));
                cmd.Parameters.Add(new OracleParameter("telephonenumber", obj.TelNumber));
                if (obj.Name == "" || obj.LastName == "" || obj.Address == "" || obj.PostalCode == "" || obj.City == "" || obj.Province == "" || obj.TelNumber == "")
                    throw new Exception("Les champs ne doivent pas etre vides");
                cmd.ExecuteNonQuery();
                CloseConnection();
                Database.Update.Members();
            }