コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Vui lòng nhập tên hãng!", "Thông báo");
                return;
            }

            DTO_Producer info = new DTO_Producer();

            info.Name = txtName.Text;

            if (this.action == "add")
            {
                bus.addItem(info);
            }

            if (this.action == "edit")
            {
                info.Id = Convert.ToInt32(txtId.Text);
                bus.editItem(info);
            }

            foreach (DataGridViewRow row in dataGridView.SelectedRows)
            {
                this.index = row.Index;
            }

            GUI_Producer_Load(sender, e);
            endableAll(true);
            groupBox.Enabled         = false;
            dataGridView.CurrentCell = dataGridView.Rows[this.index].Cells[0];
        }
コード例 #2
0
 public void dropItem(DTO_Producer info)
 {
     string[] value =
     {
         info.Id.ToString()
     };
     dataProducer.Delete(value);
 }
コード例 #3
0
 public void addItem(DTO_Producer info)
 {
     string[] value =
     {
         info.Name
     };
     dataProducer.Insert(value);
 }
コード例 #4
0
 public void editItem(DTO_Producer info)
 {
     string[] value =
     {
         info.Name,
         info.Id.ToString()
     };
     dataProducer.Update(value);
 }
コード例 #5
0
 private void btnDrop_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có muốn xóa ?", "Thông báo !", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
     {
         DTO_Producer info = new DTO_Producer();
         info.Id = Convert.ToInt32(txtId.Text);
         bus.dropItem(info);
         GUI_Producer_Load(sender, e);
     }
 }