Пример #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            DBThietBi dbThietBi = new DBThietBi();

            dbThietBi.removeDevice(txtmaThietBi.Text);
            dbThietBi.updateGridData(dataGridThietBi);
            resetTxt();
        }
Пример #2
0
        public FThietBi()
        {
            InitializeComponent();
            DBThietBi dbThietBi = new DBThietBi();

            dbThietBi.updateGridData(dataGridThietBi);
            DBNhomThietBi ntb = new DBNhomThietBi();

            ntb.updateComboBoxIdOnly(cbBoxDeviceGroup);
        }
Пример #3
0
        private void updateDB(bool isNewDevice)
        {
            ThietBi thietBi = new ThietBi();

            thietBi.deviceID      = txtmaThietBi.Text;
            thietBi.deviceName    = txttenThietBi.Text;
            thietBi.startDate     = dtPickStartDate.Value;
            thietBi.endDate       = dtPickEndDate.Value;
            thietBi.position      = txtviTri.Text;
            thietBi.warranty      = dtPickWarranty.Value;
            thietBi.LOG           = txtLOG.Text;
            thietBi.status        = txtTinhTrang.Text;
            thietBi.deviceIDGroup = cbBoxDeviceGroup.GetItemText(cbBoxDeviceGroup.SelectedItem);

            if (txtTangSuat.Text == "")
            {
                txtTangSuat.Text = "0";
            }
            else
            {
                thietBi.tangSuat = Convert.ToInt32(txtTangSuat.Text);
            }

            thietBi.model   = txtModel.Text;
            thietBi.serial  = txtSerial.Text;
            thietBi.hangsx  = txtHangsx.Text;
            thietBi.lanCuoi = dtPickerLanCuoi.Value;

            if (thietBi.deviceID.Equals("") || thietBi.deviceName.Equals("") || thietBi.deviceIDGroup.Equals(""))
            {
                MessageBox.Show(this, "Vui Long Dien Ma, Ten Va Nhom Thiet Bi", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            DBThietBi dbThietBi = new DBThietBi();

            if (isNewDevice)
            {
                dbThietBi.addNewDevice(thietBi, false);
            }
            else
            {
                dbThietBi.addNewDevice(thietBi, true);
            }
            dbThietBi.updateGridData(dataGridThietBi);
        }