コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Vui lòng nhập xuất sứ !", "Thông báo");
                return;
            }
            DTO_Origin info = new DTO_Origin();

            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_Origin_Load(sender, e);
            endableAll(true);
            groupBox.Enabled         = false;
            dataGridView.CurrentCell = dataGridView.Rows[this.index].Cells[0];
        }
コード例 #2
0
 public void dropItem(DTO_Origin info)
 {
     string[] value =
     {
         info.Id.ToString()
     };
     dataOrigin.Detele(value);
 }
コード例 #3
0
 public void addItem(DTO_Origin info)
 {
     string[] value =
     {
         info.Name
     };
     dataOrigin.Insert(value);
 }
コード例 #4
0
 public void editItem(DTO_Origin info)
 {
     string[] value =
     {
         info.Name,
         info.Id.ToString()
     };
     dataOrigin.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_Origin info = new DTO_Origin();
         info.Id = Convert.ToInt32(txtId.Text);
         bus.dropItem(info);
         GUI_Origin_Load(sender, e);
     }
 }