/// <summary> /// Khi thay đổi giá trị rate tiến hành kiểm tra /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { int a = 0; bool kt = Int32.TryParse(txtrate.Text, out a); if (a < 20000) { lblKT.Text = "Value not null and value >= 20000vnd"; lblKT.ForeColor = Color.Red; txtrate.Focus(); lblKT.Visible = true; } else { if (lblKT.Visible == true) { lblKT.Visible = false; } ad.Rate = a; AdminBO adbo = new AdminBO(); int kq = adbo.UpdateThongTin(ad); if (kq > 0) { lblpql.Text = string.Format("{0:0,0}$", (costPQL / ad.Rate)); lblpkt.Text = string.Format("{0:0,0}$", (costPKT / ad.Rate)); lblrate.Text = string.Format("{0:0,0}vnd/$", ad.Rate); pnedit.Visible = false; } else { MessageBox.Show("Không thực hiện được", "Error"); } } }
private void btnDone_Click(object sender, EventArgs e) { pninfo.Visible = true; pnac.Visible = false; btnDone.Visible = false; AdminBO adbo = new AdminBO(); int kq = adbo.UpdateThongTin(ad); if (kq != 0) { MessageBox.Show("Success", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("fail", "Update", MessageBoxButtons.OK, MessageBoxIcon.Error); } }