CapDemo.BL.RoundBL.AddRound C# (CSharp) Method

AddRound() public method

public AddRound ( Round Round ) : bool
Round CapDemo.DO.Round
return bool
        public bool AddRound(Round Round)
        {
            string query = "INSERT INTO [Round]([Competition_ID],[Round_Name])"
                           + " VALUES ('" + Round.IDCompetition+ "','" + Round.NameRound.Replace("'","''") + "')";
            if (ExistRound(Round) == true)
            {
                return false;
            }
            else
            {
                return DA.InsertDatabase(query);
            }
        }

Usage Example

Esempio n. 1
0
 //save competition
 public void saveRound()
 {
     if (txt_NameRound.Text.Trim() == "")
     {
         MessageBox.Show("Vui lòng nhập tên vòng thi.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         RoundBL RoundBL = new RoundBL();
         Round Round = new Round();
         Round.NameRound = txt_NameRound.Text.Trim();
         Round.IDCompetition = idCompetition;
         if (RoundBL.AddRound(Round) == true)
         {
             this.Close();
         }
         else
         {
             MessageBox.Show("Vòng thi này đã tồn tại trong cuộc thi "+ nameCompetition +".", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }