コード例 #1
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();
     }
 }
コード例 #2
0
ファイル: AddDays.cs プロジェクト: ChrisIwnd/StandAlone
 /// <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();
     }
 }
コード例 #3
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();
     }
 }
コード例 #4
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();
     }
 }
コード例 #5
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();
     }
 }