Пример #1
0
        public firmware[] GetAllfirmwares()
        {
            DataSet   ds          = new DataSet();
            ArrayList firmwarearr = new ArrayList();
            string    cmdStr      = "SELECT * FROM [firmwaretbl]";

            using (OleDbCommand command = new OleDbCommand(cmdStr))
            {
                ds = GetMultipleQuery(command);
            }

            DataTable dt = new DataTable();

            try
            {
                dt = ds.Tables[0];
            }
            catch
            {
            }
            foreach (DataRow tType in dt.Rows)
            {
                firmware firmware = new firmware();
                //firmware frimware = new firmware();
                firmware.Id         = int.Parse(tType[0].ToString());
                firmware.BinaryFile = tType[1].ToString();
                //package.FirmwareList = tType[2].ToString();
                firmware.firmwareType = tType[2].ToString();

                firmwarearr.Add(firmware);
            }
            return((firmware[])firmwarearr.ToArray(typeof(firmware)));
        }
Пример #2
0
        //firmware functions
        private firmware[] Getfirmware(string cmdStr)
        {
            DataSet   ds       = new DataSet();
            ArrayList firmware = new ArrayList();

            using (OleDbCommand command = new OleDbCommand(cmdStr))
            {
                ds = GetMultipleQuery(command);
            }
            DataTable dt = new DataTable();

            try
            {
                dt = ds.Tables[0];
            }
            catch { }
            foreach (DataRow tType in dt.Rows)
            {
                firmware firm = new firmware();
                firm.Id = int.Parse(tType[0].ToString());

                firmware.Add(firm);
            }
            return((firmware[])firmware.ToArray(typeof(firmware)));
        }
Пример #3
0
        public void deleteFirmware(firmware deleteFirmware)
        {
            string cmdStr = "DELETE FROM firmwaretbl WHERE user ='******'";

            using (OleDbCommand command = new OleDbCommand(cmdStr))
            {
                base.ExecuteSimpleQuery(command);
            }
        }
Пример #4
0
        public void addfirmware(firmware firm1)
        {
            string cmdStr = "INSERT INTO Firmwaretbl ([id],binaryfile,firmwaretype)VALUES(@id,@binaryfile,@firmwaretype)";

            using (OleDbCommand command = new OleDbCommand(cmdStr))
            {
                command.Parameters.AddWithValue("@id", firm1.Id);
                command.Parameters.AddWithValue("@binaryFile", firm1.BinaryFile);
                command.Parameters.AddWithValue("@firmwaretype", firm1.firmwareType);
                base.ExecuteSimpleQuery(command);
            }
        }
Пример #5
0
        public void UpdateFirmware(firmware updateFirmware)
        {
            //query to update the user fields by take the name
            string cmdStr = "UPDATE [firmwaretbl] SET  BinaryFile=@BinaryFile WHERE id=@id";

            using (OleDbCommand command = new OleDbCommand(cmdStr))
            {
                //update user fields to the database
                command.Parameters.AddWithValue("@BinaryFile", updateFirmware.BinaryFile);
                command.Parameters.AddWithValue("@id", updateFirmware.Id);
                base.ExecuteSimpleQuery(command);
            }
        }