コード例 #1
0
        public void loadDevices(clsRepair repair)
        {
            clsDBDevice      dbDevice = new clsDBDevice();
            List <clsDevice> devices  = dbDevice.DeviceList();

            Int32 Index = 0;

            cmbPhoneModel.DisplayMember = "Model";
            cmbPhoneModel.ValueMember   = "ID";
            while (Index < devices.Count)
            {
                clsDevice device = devices[Index];
                cmbPhoneModel.Items.Add(device);
                if (repair != null && (repair.PhoneModel == device.Model.ToString()))
                {
                    cmbPhoneModel.SelectedItem = device;
                }
                Index++;   //move the index to the next record
            }
        }
コード例 #2
0
ファイル: frmDevices.cs プロジェクト: zeedurwesh/Mobile-Fix
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (lstDevices.SelectedItems.Count > 0)
            {
                ListViewItem selectedItem = lstDevices.SelectedItems[0];
                clsDevice    device       = (clsDevice)selectedItem.Tag;

                // Display a message box asking users if they
                // want to delete the selected Device.
                if (MessageBox.Show("Are you sure to Delete this Device " + device.Model + "?", "Delete Device",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                    == DialogResult.Yes)
                {
                    // code for deleting the record goes here
                    clsDBDevice dbDevice = new clsDBDevice();
                    dbDevice.DeleteDevice(device.ID);
                    loadDevices();
                }
            }
        }
コード例 #3
0
        public void loadDevices(clsProductRecord productRecord)
        {
            clsDBDevice      dbDevice = new clsDBDevice();
            List <clsDevice> devices  = dbDevice.DeviceList();

            Int32 Index = 0;

            cmbDeviceName.DisplayMember = "Model";
            cmbDeviceName.ValueMember   = "ID";
            while (Index < devices.Count)
            {
                clsDevice device = devices[Index];
                cmbDeviceName.Items.Add(device);
                if (productRecord != null && (productRecord.DeviceId == device.ID))
                {
                    cmbDeviceName.SelectedItem = device;
                }


                Index++; //move the index to the next record
            }
        }
コード例 #4
0
ファイル: frmDevices.cs プロジェクト: zeedurwesh/Mobile-Fix
        public void loadDevices()
        {
            clsDBDevice      dbDevice = new clsDBDevice();
            List <clsDevice> devices  = dbDevice.DeviceList();

            Int32 Index = 0;

            lstDevices.Items.Clear();
            while (Index < devices.Count)
            {
                clsDevice    device  = devices[Index];
                ListViewItem NewItem = new ListViewItem();
                NewItem.Text = device.Manufacture;
                NewItem.SubItems.Add(device.Model);

                NewItem.Tag = device;
                lstDevices.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                lstDevices.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                lstDevices.Items.Add(NewItem); //Add the item to ListView

                Index++;                       //move the index to the next record
            }
        }
コード例 #5
0
ファイル: frmAddDevice.cs プロジェクト: zeedurwesh/Mobile-Fix
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (isValid())
            {
                clsDevice device = new clsDevice();
                device.Manufacture = txtManufacture.Text;
                device.Model       = txtModel.Text;

                clsDBDevice fbs   = new clsDBDevice();
                Int32       added = 0;
                if (txtID.Text.Length > 0)
                {
                    device.ID = Convert.ToInt32(txtID.Text);
                    added     = fbs.UpdateDevice(device);
                }
                else
                {
                    added = fbs.InsertDevice(device);
                }

                if (added > 0)
                {
                    frmDevices.loadDevices();
                    Close();
                }
                else
                {
                    txtErrorMessage.Text    = "Could not added Device.";
                    txtErrorMessage.Visible = true;
                }
            }
            else
            {
                txtErrorMessage.Text    = "Specify valid values";
                txtErrorMessage.Visible = true;
            }
        }