private void button2_Click(object sender, EventArgs e) { if (OldDept_ID.Equals("NONE")) { Alert.Show("Bạn không được sửa mặt hàng này", Color.Red); return; } if (OldDept_ID != txtDeptID.Text) { DataTable tmp = get_service.GetAllDepartmentsByDeptId(txtDeptID.Text, StaticClass.storeId); DataTable tmp1 = get_service.GetInventoryByItemNum(StaticClass.storeId, txtDeptID.Text); if (tmp.Rows.Count > 0 || tmp1.Rows.Count > 0) { Alert.Show("Mã đã tồn tại", Color.Red); txtDeptID.Text = OldDept_ID; return; } } DataRowView item = (DataRowView)cmbCate.SelectedItem; get_service.UpdateDepartment(OldDept_ID, txtDeptID.Text, StaticClass.storeId, item.Row[0].ToString(), txtDeptDesc.Text, getType(), checkBox1.Checked, textBox1.Text, checkBox2.Checked, checkBox3.Checked, checkBox4.Checked, Convert.ToDouble(creTextBox1.Text), Convert.ToInt32(creTextBox2.Text), StaticClass.stationId, "", 0, "", StaticClass.BackColor, StaticClass.ForeColor); departs = get_service.GetAllDepartments2(StaticClass.storeId); ckb_Sua.Checked = false; Alert.Show("Bạn đã thay đổi thành công", Color.Blue); }