Example #1
0
        private void populateDevice()
        {
            DaoDevice daoDevice = new DaoDevice();

            gvDevice.DataSource = daoDevice.getAllDevices();
            gvDevice.DataBind();
        }
Example #2
0
        public bool authenticate(string strUsername, string strPassword, string strDeviceImei)
        {
            DaoStaff  daoStaff          = new DaoStaff();
            DaoDevice daoDevice         = new DaoDevice();
            bool      blnAccountIsValid = daoStaff.authenticate(strUsername, strPassword);
            bool      blnDeviceIsValid  = daoDevice.getDeviceByImeiNumber(strDeviceImei) != null;

            return(blnAccountIsValid && blnDeviceIsValid);
        }
Example #3
0
        protected void gvDevice_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            DaoDevice daoDevice = new DaoDevice();
            int       rowIndex  = Convert.ToInt32(e.CommandArgument);
            int       id        = Convert.ToInt32(gvDevice.DataKeys[rowIndex].Values[0]);

            if (e.CommandName.Equals("DeleteDevice"))
            {
                daoDevice.deleteById(id);
            }
            populateDevice();
        }
Example #4
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            pnlCreateForm.Visible = false;
            pnlDevice.Visible     = true;

            DaoDevice daoDevice = new DaoDevice();
            Device    device    = new Device();

            device.ImeiNumber = txtImeiNumber.Text;
            if (ddlStaff.SelectedIndex != 0)
            {
                device.StaffId = Convert.ToInt32(ddlStaff.SelectedItem.Value);
            }
            daoDevice.insertOrUpdate(device);

            populateDevice();
        }