Пример #1
0
        /// <summary>
        /// When the client select the rating from the combo box, press the Delete button
        /// to delete it. Then the system show up a message that warning him if he
        /// is sure for this action. If the client press YES then the system execute the
        /// querry and delete the rating. Else the system will do nothig.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this rating?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dialogResult == DialogResult.Yes)
            {
                DCom.Exec(String.Format(SqlDelete, CmbRatings.SelectedValue));

                MessageBox.Show("DELETE COMPLETE");
                Close();
            }
            else if (dialogResult == DialogResult.No)
            {
                MessageBox.Show("DELETE CANSEL");
            }
        }
Пример #2
0
 /// <summary>
 /// Finally when the client made the changes that he wants the program checks if all the fields
 /// all fields are fill. If all fields are fill then the program exec the apropriate querry for the
 /// update of the province, else show a error message.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnEdit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxProvinceName.Text))
     {
         MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (DCom.CountCheck("province", "Province_Name", TbxProvinceName.Text) == true)
     {
         MessageBox.Show("THE USERNAME ALREADY EXIST", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DCom.Exec(String.Format(SqlUpdate, TbxProvinceName.Text, comboBoxptovince.SelectedValue));
         MessageBox.Show("Edit Complete");
         Close();
     }
 }
Пример #3
0
 /// <summary>
 /// This state is when the client press the button to add a record.
 /// Before it goes to add the record it checks if all the fields are completed.
 /// After that checks if the province already exists.
 /// Then add the record in database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxAdd.Text))
     {
         MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (DCom.CountCheck("days", "Name", TbxAdd.Text) == true)
     {
         MessageBox.Show("THE DAY ALREADY EXIST", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DCom.Exec(String.Format(SqlInsert, TbxAdd.Text));
         MessageBox.Show("ADD COMPLETE");
         Close();
     }
 }
Пример #4
0
 private void BtnEdit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxName.Text) || string.IsNullOrEmpty(CmbProvince.Text))
     {
         MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (DCom.CountCheck("municipality", "Municipality_Name", TbxName.Text) == true)
     {
         MessageBox.Show("THE MUNICIPALITY ALREADY EXIST", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DCom.Exec(String.Format(SqlUpdate, TbxName.Text, CmbProvince.SelectedValue, CmbMunicipality_Name.SelectedValue));
         MessageBox.Show("Edit Complete");
         Close();
     }
 }
Пример #5
0
 /// <summary>
 /// This state is when the client press the button to add a record.
 /// Before it goes to add the record it checks if all the fields are completed.
 /// After that checks if the username already exists.
 /// Then add the record in database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Addbtn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxMunicipality.Text) || string.IsNullOrEmpty(CmbMunicipality.Text))
     {
         MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (DCom.CountCheck("municipality", "Municipality_Name", TbxMunicipality.Text) == true)
     {
         MessageBox.Show("THE NAME ALREADY EXIST", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DCom.Exec(String.Format(SqlExec, this.TbxMunicipality.Text, this.CmbMunicipality.SelectedValue));
         MessageBox.Show("ADD COMPLETE");
         Close();
     }
 }
Пример #6
0
 /// <summary>
 /// Finally when the client made the changes that he wants the program checks if all the fields
 /// all fields are fill. If all fields are fill then the program exec the apropriate querry for the
 /// update of the user, else show a error message.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnEdit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxFirstName.Text) || string.IsNullOrWhiteSpace(TbxLastName.Text) ||
         string.IsNullOrWhiteSpace(TbxUsername.Text) || string.IsNullOrWhiteSpace(TbxEmail.Text) ||
         string.IsNullOrWhiteSpace(TbxTelephone.Text) || string.IsNullOrEmpty(CmbTypes.Text))
     {
         MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (DCom.CountCheck("users", "username", TbxUsername.Text) == true)
     {
         MessageBox.Show("THE USERNAME ALREADY EXIST", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DCom.Exec(String.Format(SqlUpdate, TbxFirstName.Text, TbxLastName.Text, TbxUsername.Text, TbxTelephone.Text, TbxEmail.Text, CmbTypes.SelectedValue, CmbUser.SelectedValue));
         MessageBox.Show("Edit Complete");
         Close();
     }
 }