Esempio n. 1
0
        public List <DataTable> getRecord(string logKey, string logID, string projectKey, string recValue)
        {
            List <typeRec> typeList = new List <typeRec>();

            string[]         tmpTypes;
            int              recCount  = 0;
            string           recType   = "";
            DataTable        dataTable = new DataTable();
            List <DataTable> dts       = new List <DataTable>();

            foreach (string recordType in App.Prj.RecordTypes)
            {
                if (recValue.Contains(recordType))
                {
                    if (recCount == 0 || recCount == 1)
                    {
                        recType = recCount.ToString("00");
                    }
                    else
                    {
                        tmpTypes = recValue.Split((char)0x1c);

                        foreach (string subRecordType in App.Prj.SubRecordTypes)
                        {
                            if (tmpTypes[3] == subRecordType)
                            {
                                recType = subRecordType;
                                break;
                            }
                        }
                    }
                    break;
                }
                recCount++;
            }
            switch (recType)
            {
            case "00":
                TRec tr = new TRec();
                dts = tr.getRecord(logKey, logID, projectKey);
                break;

            case "01":
                TReply treply = new TReply();
                dts = treply.getRecord(logKey, logID, projectKey);
                break;

            case "11":
                screenRec scrRec = new screenRec();
                break;

            case "12":
                stateRec staRec = new stateRec();
                dts = staRec.getRecord(logKey, logID, projectKey);
                break;

            case "13":
                configParamsRec cpRec = new configParamsRec();
                break;

            case "15":
                FitRec fitRec = new FitRec();
                dts = fitRec.getRecord(logKey, logID, projectKey);
                break;

            case "16":
                ConfigIdRec cir = new ConfigIdRec();
                dts = cir.getRecord(logKey, logID, projectKey);
                break;

            case "1A":
                EnhancedParamsRec epRec = new EnhancedParamsRec();
                dts = epRec.getRecord(logKey, logID, projectKey);
                break;

            case "1B":
                //writeMAC(typeList);
                break;

            case "1C":
                DateAndTimeRec dt = new DateAndTimeRec();
                break;

            case "1E":
                //writeDispenser(typeList);
                break;

            case "42":
                ExtEncryptionRec xer = new ExtEncryptionRec();
                break;
            }
            return(dts);
        }
Esempio n. 2
0
        public void getData(string regExStr, string recordType, string logID)
        {
            string sql = @"SELECT logkey,id,group8 from [logger].[dbo].[loginfo] " +
                         "WHERE group8 like '" + regExStr + "' " +
                         "AND logID =" + logID;
            Dictionary <string, string> data = readData(sql);

            string[]       dataTypes = null;
            List <typeRec> typeList  = new List <typeRec>();

            string[] tmpTypes;

            foreach (KeyValuePair <string, string> rec in data)
            {
                // tmpTypes = rec.Value.Split((char)0x1c);

                if (recordType == "00" || recordType == "01")
                {
                    typeRec r = new typeRec();
                    r.typeIndex   = rec.Key;
                    r.typeContent = rec.Value;
                    typeList.Add(r);
                }



                tmpTypes = rec.Value.Split((char)0x1c);

                if (tmpTypes[3] == recordType)
                {
                    int    myInd    = tmpTypes[0].Length + tmpTypes[1].Length + tmpTypes[2].Length + tmpTypes[3].Length;
                    string typeData = rec.Value.Substring(myInd + 4, rec.Value.Length - (myInd + 4));

                    dataTypes = typeData.Split((char)0x1c);

                    foreach (string item in dataTypes)
                    {
                        typeRec r = new typeRec();
                        r.typeIndex   = rec.Key;
                        r.typeContent = item;
                        typeList.Add(r);
                    }
                }
            }
            switch (recordType)
            {
            case "00":
                TRec tr = new TRec();
                if (tr.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }

                break;

            case "01":
                TReply treply = new TReply();
                if (treply.writeData(typeList, Key, logID))
                {
                    // set screen bit to true
                    setBitToTrue(recordType, logID);
                }
                break;

            case "11":
                screenRec scrRec = new screenRec();
                if (scrRec.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "12":
                stateRec staRec = new stateRec();
                if (staRec.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "13":
                configParamsRec cpRec = new configParamsRec();
                if (cpRec.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "15":
                FitRec fitRec = new FitRec();
                if (fitRec.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "16":
                ConfigIdRec cir = new ConfigIdRec();
                if (cir.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "1A":
                EnhancedParamsRec epRec = new EnhancedParamsRec();
                if (epRec.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "1B":
                //writeMAC(typeList);
                break;

            case "1C":
                DateAndTimeRec dt = new DateAndTimeRec();
                if (dt.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;

            case "1E":
                //writeDispenser(typeList);
                break;

            case "42":
                ExtEncryptionRec xer = new ExtEncryptionRec();
                if (xer.writeData(typeList, Key, logID))
                {
                    setBitToTrue(recordType, logID);
                }
                break;
            }
        }