Exemplo 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);
        }
Exemplo n.º 2
0
        public void setData(DataGridViewRow dgvr)
        {
            txtTimestamp.Text = dgvr.Cells["Timestamp"].Value.ToString();
            txtLogLevel.Text  = dgvr.Cells["Log Level"].Value.ToString();
            txtFileName.Text  = dgvr.Cells["File Name"].Value.ToString();
            txtClass.Text     = dgvr.Cells["Class"].Value.ToString();
            txtMethod.Text    = dgvr.Cells["Method"].Value.ToString();
            txtType.Text      = dgvr.Cells["Type"].Value.ToString();
            rtbRawData.Text   = App.Prj.showBytes(Encoding.ASCII.GetBytes(dgvr.Cells["Log Data"].Value.ToString()));
            string logKey = dgvr.Cells["logKey"].Value.ToString();

            logKey = logKey.Substring(0, logKey.LastIndexOf("-"));
            string logID = dgvr.Cells["logID"].Value.ToString();

            string prjKey = dgvr.Cells["prjKey"].Value.ToString();


            List <DataTable> dts = App.Prj.getRecord(logKey, logID, prjKey, dgvr.Cells["Log Data"].Value.ToString());

            txtFieldData.Text = "";
            string stateType = "";
            int    fieldNum  = -1;
            int    timerNum  = 0;

            foreach (DataTable dt in dts)
            {
                if (dt.Rows.Count > 0)
                {
                    for (int rowNum = 0; rowNum < dt.Rows.Count; rowNum++)
                    {
                        // if the row data is for a
                        if (dt.Rows[rowNum][2].ToString() == "I")
                        {
                            txtFieldData.Text = dt.Columns[3].ColumnName + " = " + dt.Rows[0][3].ToString();
                        }
                        // if the row data is for a State
                        if (dt.Rows[rowNum][2].ToString() == "S")
                        {
                            for (fieldNum = 3; fieldNum < dt.Columns.Count - 5; fieldNum++)
                            {
                                if (fieldNum == 3)
                                {
                                    txtFieldData.Text += dt.Columns[fieldNum].ColumnName + " = " + dt.Rows[rowNum][fieldNum].ToString() + " ";
                                }
                                else
                                {
                                    txtFieldData.Text += dt.Rows[rowNum][fieldNum].ToString() + " ";
                                }
                                // what state type is it?
                                if (fieldNum == 4)
                                {
                                    stateType = dt.Rows[rowNum][fieldNum].ToString();
                                }
                            }
                            stateRec stRec = new stateRec();
                            stRec.StateNumber  = dt.Rows[rowNum][3].ToString();
                            stRec.StateType    = dt.Rows[rowNum][4].ToString();
                            stRec.Val1         = dt.Rows[rowNum][5].ToString();
                            stRec.Val2         = dt.Rows[rowNum][6].ToString();
                            stRec.Val3         = dt.Rows[rowNum][7].ToString();
                            stRec.Val4         = dt.Rows[rowNum][8].ToString();
                            stRec.Val5         = dt.Rows[rowNum][9].ToString();
                            stRec.Val6         = dt.Rows[rowNum][10].ToString();
                            stRec.Val7         = dt.Rows[rowNum][11].ToString();
                            stRec.Val8         = dt.Rows[rowNum][12].ToString();
                            txtFieldData.Text += System.Environment.NewLine;
                            txtFieldData.Text += System.Environment.NewLine;
                            txtFieldData.Text += stRec.getInfo(stRec);
                        }
                        // if the row data is for a FIT
                        if (dt.Rows[rowNum][2].ToString() == "F")
                        {
                            FitRec    fitRec = new FitRec();
                            DataTable fitdt  = fitRec.getDescription();

                            for (fieldNum = 3; fieldNum < dt.Columns.Count - 5; fieldNum++)
                            {
                                if (fieldNum == 3)
                                {
                                    txtFieldData.Text += @"==================================================" + System.Environment.NewLine;
                                    txtFieldData.Text += dt.Columns[fieldNum].ColumnName.ToUpper() + " = " + dt.Rows[rowNum][fieldNum].ToString() + System.Environment.NewLine;
                                    txtFieldData.Text += @"==================================================" + System.Environment.NewLine;
                                }
                                else
                                {
                                    txtFieldData.Text += dt.Columns[fieldNum].ColumnName.ToUpper() + " = " + dt.Rows[rowNum][fieldNum].ToString() + "\t\t" + fitdt.Rows[fieldNum - 3][3].ToString().Trim() + System.Environment.NewLine;
                                }
                            }
                        }
                        // if the row data is for a
                        if (dt.Rows[rowNum][2].ToString() == "C")
                        {
                            EnhancedParamsRec paramRec   = new EnhancedParamsRec();
                            DataTable         paramRecDt = paramRec.getDescription();
                            string            optionDesc = "";

                            if (dt.Rows[rowNum][5].ToString() == "1")
                            {
                                if (rowNum == 0)
                                {
                                    txtFieldData.Text += @"==================================================" + System.Environment.NewLine;
                                    txtFieldData.Text += @"OPTIONS" + System.Environment.NewLine;
                                    txtFieldData.Text += @"==================================================" + System.Environment.NewLine;
                                }
                                txtFieldData.Text += dt.Columns[3].ColumnName.ToUpper() + " " + dt.Rows[rowNum][3].ToString() + " = " + dt.Rows[rowNum][4].ToString();
                                optionDesc         = getOptionDescription(paramRecDt, "O" + dt.Rows[rowNum][3].ToString());
                                txtFieldData.Text += "\t" + optionDesc + System.Environment.NewLine;
                            }
                            if (dt.Rows[rowNum][5].ToString() == "2")
                            {
                                if (timerNum == 0)
                                {
                                    txtFieldData.Text += @"==================================================" + System.Environment.NewLine;
                                    txtFieldData.Text += @"TIMERS" + System.Environment.NewLine;
                                    txtFieldData.Text += @"==================================================" + System.Environment.NewLine;
                                    timerNum           = 1;
                                }
                                txtFieldData.Text += dt.Columns[3].ColumnName.ToUpper() + " " + dt.Rows[rowNum][3].ToString() + " = " + dt.Rows[rowNum][4].ToString();
                                optionDesc         = getOptionDescription(paramRecDt, "T" + dt.Rows[rowNum][3].ToString());
                                txtFieldData.Text += "\t" + optionDesc + System.Environment.NewLine;
                            }
                        }
                        // if the row data is for a Transaction Reply
                        if (dt.Rows[rowNum][2].ToString() == "R")
                        {
                            DataTable tReplyDt = new TReply().getDescription();
                            int       x        = 0;
                            for (int field = 3; field <= dt.Rows[rowNum].ItemArray.Length - 3; field++)
                            {
                                if (field == 24)
                                {
                                    if (dts[1].Rows.Count > 0)
                                    {
                                        txtFieldData.Text += getPrinterData(dts[1]);
                                    }
                                    continue;
                                }
                                if (field == 62)
                                {
                                    if (dts[2].Rows.Count > 0)
                                    {
                                        txtFieldData.Text += getCheckProccessing(dts[2]);
                                    }
                                    continue;
                                }
                                string fieldContent = dt.Rows[rowNum].ItemArray[field].ToString().Trim();
                                if (fieldContent == "")
                                {
                                    continue;
                                }
                                else
                                {
                                    string optionDesc = getOptionDescription(tReplyDt, field.ToString("00"));
                                    txtFieldData.Text += optionDesc + " = ";
                                    txtFieldData.Text += fieldContent;
                                    txtFieldData.Text += System.Environment.NewLine;
                                }
                            }
                        }
                        // if the row data is for a Transaction Request
                        if (dt.Rows[rowNum][2].ToString() == "T")
                        {
                            DataTable tReqDt = new TRec().getDescription();
                            int       x      = 0;
                            for (int field = 3; field <= dt.Rows[rowNum].ItemArray.Length - 3; field++)
                            {
                                if (field == 42)
                                {
                                    if (dts[1].Rows.Count > 0)
                                    {
                                        txtFieldData.Text += getTreqOptions(dts[1]);
                                    }
                                    continue;
                                }
                                if (field == 62)
                                {
                                    if (dts[2].Rows.Count > 0)
                                    {
                                        txtFieldData.Text += getTreqCurrencies(dts[2]);
                                    }
                                    if (dts[3].Rows.Count > 0)
                                    {
                                        txtFieldData.Text += getTreqCheques(dts[3]);
                                    }

                                    continue;
                                }

                                string fieldContent = dt.Rows[rowNum].ItemArray[field].ToString().Trim();
                                if (fieldContent == "")
                                {
                                    continue;
                                }
                                else
                                {
                                    string optionDesc = getOptionDescription(tReqDt, field.ToString("00"));
                                    txtFieldData.Text += optionDesc + " = ";
                                    txtFieldData.Text += fieldContent;
                                    txtFieldData.Text += System.Environment.NewLine;
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
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;
            }
        }