Exemplo n.º 1
0
        private void fillDataFromIniFile()
        {
            if (teraDevice == null)
            {
                return;
            }
            string  sect = teraDevice.IniSectionName();
            IniFile file = new IniFile(Properties.Settings.Default.DeviceSettingsFileName);

            this.temperature = ServiceFunctions.convertToInt16(file.ReadOrWrite("Temperature", sect, this.Temperature.ToString()));
            this.voltage     = ServiceFunctions.convertToInt16(file.ReadOrWrite("Voltage", sect, this.Voltage.ToString()));
            setVoltageId();
            this.dischargeDelay        = ServiceFunctions.convertToInt16(file.ReadOrWrite("DischargeDelay", sect, this.DischargeDelay.ToString()));
            this.polarizationDelay     = ServiceFunctions.convertToInt16(file.ReadOrWrite("PolarizationDelay", sect, this.PolarizationDelay.ToString()));
            this.isCyclicMeasure       = file.ReadOrWrite("IsCyclicMeasure", sect, this.IsCyclicMeasure.ToString()).ToLower() == "true";
            this.cycleTimes            = ServiceFunctions.convertToInt16(file.ReadOrWrite("CycleTimes", sect, this.CycleTimes.ToString()));
            this.averagingTimes        = ServiceFunctions.convertToInt16(file.ReadOrWrite("AveragingTimes", sect, this.AveragingTimes.ToString()));
            this.externalCamDiam       = ServiceFunctions.convertToInt16(file.ReadOrWrite("ExternalCamDiam", sect, this.ExternalCamDiam.ToString()));
            this.internalCamDiam       = ServiceFunctions.convertToInt16(file.ReadOrWrite("InternalCamDiam", sect, this.InternalCamDiam.ToString()));
            this.bringingTypeId        = file.ReadOrWrite("BringingTypeId", sect, this.BringingTypeId.ToString());
            this.materialHeight        = ServiceFunctions.convertToInt16(file.ReadOrWrite("MaterialHeight", sect, this.MaterialHeight.ToString()));
            this.isDegreeViewMode      = file.ReadOrWrite("IsDegreeViewMode", sect, this.IsDegreeViewMode.ToString()).ToLower() == "true";
            this.minTimeToNorm         = ServiceFunctions.convertToInt16(file.ReadOrWrite("MinTimeToNorm", sect, this.MinTimeToNorm.ToString()));
            this.normaValue            = ServiceFunctions.convertToInt32(file.ReadOrWrite("NormaValue", sect, this.NormaValue.ToString()));
            this.materialId            = file.ReadOrWrite("MaterialId", sect, this.materialId.ToString());
            this.bringingLength        = ServiceFunctions.convertToInt16(file.ReadOrWrite("BringingLength", sect, this.bringingLength.ToString()));
            this.bringingLengthMeasure = file.ReadOrWrite("BringingLengthMeasure", sect, this.bringingLengthMeasure);
        }
        private void FillCoeffs()
        {
            string query = "SELECT temperature, coeff_val FROM isolation_material_tcoeffs WHERE isolation_material_id = {0}";

            query = String.Format(query, this.Id);
            DataTable dt = getFromDB(query);

            if (dt.Rows.Count > 0)
            {
                this.coeffs.Clear();
                this.temperatures.Clear();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.coeffs.Add(ServiceFunctions.convertToDecimal(dt.Rows[i]["coeff_val"]));
                    this.temperatures.Add(ServiceFunctions.convertToInt16(dt.Rows[i]["temperature"]));
                }
            }
        }