private void RefreshData(String _idLoKhoan) { LoKhoan loKhoan = BS_LoKhoan.ThongTinLoKhoan(idHoChieu, _idLoKhoan); //hiển thị thông tin labelValue_MaHoChieu.Text = BS_HoChieu.HoChieu(loKhoan.MaHoChieu).TenHoChieu; labelValue_MaBanVe.Text = loKhoan.MaBanVe; labelValue_MaMayKhoan.Text = BS_MayKhoan.MayKhoan(loKhoan.MaMayKhoan).TenMayKhoan; labelValue_MaLK.Text = loKhoan.MaLoKhoan; comboBox_MayKhoan.DataSource = BS_MayKhoan.DanhSachMayKhoan(); comboBox_MayKhoan.DisplayMember = "TenMayKhoan"; comboBox_MayKhoan.Text = BS_MayKhoan.MayKhoan(loKhoan.MaMayKhoan).TenMayKhoan; //hiển thị thông số labelValue_DuongKinh.Text = (Math.Round(loKhoan.BanKinh * 2, 2)).ToString(); textBox_DuongKinh.Text = (Math.Round(loKhoan.BanKinh * 2, 2)).ToString(); labelValue_ChieuSauLK.Text = (Math.Round(loKhoan.ChieuSau, 2)).ToString(); textBox_ChieuSauLK.Text = (Math.Round(loKhoan.ChieuSau, 2)).ToString(); labelValue_HuongKhoan.Text = comboBox_HuongKhoan.Text = loKhoan.HuongKhoan; labelValue_ToaDoX.Text = textBox_ToaDoX.Text = (Math.Round(loKhoan.ToaDoX, 2)).ToString(); labelValue_ToaDoY.Text = textBox_ToaDoY.Text = (Math.Round(loKhoan.ToaDoY, 2)).ToString(); labelValue_Lt.Text = textBox1.Text = loKhoan.Lt.ToString(); labelValue_Lkk.Text = textBox2.Text = loKhoan.Lkk.ToString(); labelValue_L0.Text = textBox3.Text = loKhoan.L0.ToString(); labelValue_Lbua.Text = textBox4.Text = loKhoan.Lbua.ToString(); }
private void FormLoKhoan_Load(object sender, EventArgs e) { if (idHoChieu == null) { MessageBox.Show("Thông tin hộ chiếu chưa được lưu trong CSDL"); this.Close(); return; } if (BS_LoKhoan.ThongTinLoKhoan(idHoChieu, idLoKhoan).MaLoKhoan == null) { MessageBox.Show("Thông tin lỗ khoan chưa được lưu trong CSDL"); this.Close(); return; } ChangeView(false); }
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); }
public FormLoKhoan(String _idHoChieu, String _idLoKhoan) { InitializeComponent(); //add text control textLabel.Add(labelTitle1); textLabel.Add(labelTitle2); textLabel.Add(label_MaBanVe); textLabel.Add(label_MaLK); textLabel.Add(label_MaHoChieu); textLabel.Add(label_MaMayKhoan); textLabel.Add(label_DuongKinh); textLabel.Add(label_ChieuSauLK); textLabel.Add(label_HuongKhoan); textLabel.Add(label_ToaDoX); textLabel.Add(label_ToaDoY); //add value control valueLabel.Add(labelValue_MaBanVe); valueLabel.Add(labelValue_MaLK); valueLabel.Add(labelValue_MaHoChieu); valueLabel.Add(labelValue_MaMayKhoan); valueLabel.Add(labelValue_DuongKinh); valueLabel.Add(labelValue_ChieuSauLK); valueLabel.Add(labelValue_HuongKhoan); valueLabel.Add(labelValue_ToaDoX); valueLabel.Add(labelValue_ToaDoY); valueTextBox.Add(textBox_DuongKinh); valueTextBox.Add(textBox_ChieuSauLK); valueTextBox.Add(textBox_ToaDoX); valueTextBox.Add(textBox_ToaDoY); valueTextBox.Add(textBox1); valueTextBox.Add(textBox2); valueTextBox.Add(textBox3); valueTextBox.Add(textBox4); //add combobox control valueComboBox.Add(comboBox_MayKhoan); valueComboBox.Add(comboBox_HuongKhoan); //add button control buttonGroup.Add(buttonBack); buttonGroup.Add(buttonEdit); buttonGroup.Add(buttonUpdate); idHoChieu = _idHoChieu; idLoKhoan = _idLoKhoan; foreach (TextBox tx in valueTextBox) { tx.KeyPress += textBoxInput_KeyPress; tx.TextChanged += textBox_TextChanged; } comboBox_MaLK.DataSource = BS_LoKhoan.DanhSachLoKhoan(idHoChieu); comboBox_MaLK.DisplayMember = "MaLoKhoan"; comboBox_MaLK.Text = (BS_LoKhoan.ThongTinLoKhoan(idHoChieu, idLoKhoan)).MaLoKhoan; //UI this.BackColor = Properties.Settings.Default.FormBackgroundColor; this.MinimizeBox = false; this.MaximizeBox = false; label1.BackColor = ColorTranslator.FromHtml("#58D13D"); label2.BackColor = ColorTranslator.FromHtml("#3DD1A2"); label3.BackColor = ColorTranslator.FromHtml("#3DBDD1"); label4.BackColor = ColorTranslator.FromHtml("#3D65D1"); foreach (Button b in buttonGroup) { b.BackColor = Properties.Settings.Default.ButtonColor; b.FlatAppearance.BorderSize = 0; } foreach (Label l in textLabel) { l.ForeColor = Properties.Settings.Default.TextColor; } }