private void buttonUpdate_Click(object sender, EventArgs e) { LoKhoan updated = gridViewMain.GetFocusedRow() as LoKhoan; updated.BanKinh = double.Parse(textBoxBanKinh.Text); updated.ChieuSau = double.Parse(textBoxChieuSau.Text); updated.Lt = double.Parse(textBoxLt.Text); updated.Lkk = double.Parse(textBoxLkk.Text); updated.L0 = double.Parse(textBoxL0.Text); updated.Lbua = double.Parse(textBoxLbua.Text); if (comboBox_HuongKhoan.Text != String.Empty) { updated.HuongKhoan = comboBox_HuongKhoan.Text; } if (comboBox_MayKhoan.Text != String.Empty) { updated.MaMayKhoan = (comboBox_MayKhoan.SelectedValue as MayKhoan).MaMayKhoan; } try { BS_LoKhoan.CapNhatLoKhoan(updated); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_LoKhoan(); }
private void buttonUpdate_Click(object sender, EventArgs e) { List <LoKhoan> danhSachLoKhoan = BS_LoKhoan.DanhSachLoKhoan(idHoChieu); foreach (LoKhoan value in danhSachLoKhoan) { if (comboBox_MayKhoan.SelectedItem != null) { value.MaMayKhoan = (comboBox_MayKhoan.SelectedItem as MayKhoan).MaMayKhoan; } if (textBox_DuongKinh.Text != String.Empty) { value.BanKinh = double.Parse(textBox_DuongKinh.Text) / 2; } if (textBox_ChieuSauLK.Text != String.Empty) { value.ChieuSau = double.Parse(textBox_ChieuSauLK.Text); } if (comboBox_HuongKhoan.Text != String.Empty) { value.HuongKhoan = comboBox_HuongKhoan.Text; } if (textBox1.Text != String.Empty) { value.Lt = double.Parse(textBox1.Text); } if (textBox2.Text != String.Empty) { value.Lkk = double.Parse(textBox2.Text); } if (textBox3.Text != String.Empty) { value.L0 = double.Parse(textBox3.Text); } if (textBox4.Text != String.Empty) { value.Lbua = double.Parse(textBox4.Text); } } MyGetData(BS_LoKhoan.CapNhatLoKhoan(danhSachLoKhoan)); this.Close(); }
private void buttonUpdate_Click(object sender, EventArgs e) { LoKhoan loKhoan = BS_LoKhoan.ThongTinLoKhoan(idHoChieu, (comboBox_MaLK.SelectedItem as LoKhoan).MaLoKhoan); if (comboBox_MayKhoan.SelectedItem != null) { loKhoan.MaMayKhoan = (comboBox_MayKhoan.SelectedItem as MayKhoan).MaMayKhoan; } loKhoan.BanKinh = double.Parse(textBox_DuongKinh.Text) / 2; loKhoan.ChieuSau = double.Parse(textBox_ChieuSauLK.Text); loKhoan.HuongKhoan = comboBox_HuongKhoan.Text; loKhoan.ToaDoX = double.Parse(textBox_ToaDoX.Text); loKhoan.ToaDoY = double.Parse(textBox_ToaDoY.Text); loKhoan.Lt = double.Parse(textBox1.Text); loKhoan.Lkk = double.Parse(textBox2.Text); loKhoan.L0 = double.Parse(textBox3.Text); loKhoan.Lbua = double.Parse(textBox4.Text); BS_LoKhoan.CapNhatLoKhoan(loKhoan); ChangeView(false); RefreshData((comboBox_MaLK.SelectedItem as LoKhoan).MaLoKhoan); }