Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sr"></param>
        /// <param name="_llstInfo"></param>
        /// <param name="arrValue"></param>
        private void ParseContextLineInfo(int index, StreamReader sr, LinkedList _llstContextType, List <string> lstColumn, List <string> lstData)
        {
            string line = string.Empty;

            string[] arrStr             = null;
            string[] arrInitStr         = null;
            string[] arrStrRaw          = null;
            string[] arrStrRefParamList = null;

            //this._dtDefault = new DataTable();
            this._llstLineInfo = new LinkedList();
            //SPCStruct.ContextTypeInfo mContextTypeInfo = null;

            try
            {
                for (int i = 0; i < arrLineInfo.Length + arrParamName.Length && sr.Peek() > -1; i++)
                {
                    string strKey     = "";
                    string strTempKey = "";

                    if (i < arrLineInfo.Length)
                    {
                        strKey     = arrLineInfo[i].ToString();
                        strTempKey = strKey;
                    }
                    else
                    {
                        strKey = arrParamName[i - arrLineInfo.Length].ToString();

                        if (strKey == "raw" && !isATT) //ATT와의 중복률 관련 refactoring, KBLEE
                        {
                            int _iTemp = lstColumn.IndexOf(Definition.CHART_COLUMN.PARAM_ALIAS);
                            strTempKey = lstData[_iTemp].ToString();
                        }
                        else
                        {
                            strTempKey = strKey;
                        }
                    }

                    if (string.IsNullOrEmpty(strTempKey))
                    {
                        continue;
                    }

                    //ATT와의 중복률 관련 refactoring, KBLEE
                    if (isATT)
                    {
                        if (strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.P_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.P_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.U_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.U_LSL)
                            )
                        {
                            line = sr.ReadLine();
                            continue;
                        }
                    }
                    else
                    {
                        //modified by enkim 2012.05.11 SPC-851
                        if (strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.STDDEV_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.STDDEV_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.RANGE_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.RANGE_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.MA_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.MA_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.MSD_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.MSD_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.MR_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.MR_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.EWMARANGE_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.EWMARANGE_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.EWMAMEAN_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.EWMAMEAN_LSL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.EWMASTDDEV_USL) ||
                            strTempKey.ToUpper().Equals(Definition.CHART_COLUMN.EWMASTDDEV_LSL)
                            )
                        {
                            line = sr.ReadLine();
                            continue;
                        }
                        //modified end SPC-851
                    }

                    line = sr.ReadLine();

                    if (line.IndexOf(strTempKey) > -1)
                    {
                        arrInitStr = line.Split('\t');

                        if (arrInitStr.Length == 1)
                        {
                            continue;
                        }

                        if (arrStrRaw != null && arrStrRaw.Length > 0)
                        {
                            if (arrInitStr.Length < arrStrRaw.Length + 1)
                            {
                                arrStr = new string[arrStrRaw.Length];

                                for (int _idxInit = 0; _idxInit < arrStrRaw.Length; _idxInit++)
                                {
                                    if (_idxInit < arrStrRaw.Length + 1 - arrInitStr.Length)
                                    {
                                        arrStr[_idxInit] = "";
                                    }
                                    else
                                    {
                                        arrStr[_idxInit] = arrInitStr[_idxInit - (arrStrRaw.Length - arrInitStr.Length)];
                                    }
                                }
                            }
                            else
                            {
                                arrStr = new string[arrInitStr.Length - 1];

                                for (int _idxInit = 1; _idxInit < arrInitStr.Length; _idxInit++)
                                {
                                    arrStr[_idxInit - 1] = arrInitStr[_idxInit];
                                }
                            }
                        }
                        else
                        {
                            arrStr = new string[arrInitStr.Length - 1];

                            for (int _idxInit = 1; _idxInit < arrInitStr.Length; _idxInit++)
                            {
                                arrStr[_idxInit - 1] = arrInitStr[_idxInit];
                            }
                        }

                        if (!isATT)
                        {
                            if (strKey == "raw")
                            {
                                arrStrRaw = (string[])arrStr.Clone();
                            }

                            if (strTempKey.Equals(Definition.BLOB_FIELD_NAME.REF_PARAM_LIST))
                            {
                                arrStrRefParamList = (string[])arrStr.Clone();
                            }
                            else if (strTempKey.Equals(Definition.BLOB_FIELD_NAME.REF_DATA))
                            {
                                LinkedList lnkLstParamList = new LinkedList();

                                for (int j = 0; j < arrStr.Length; j++)
                                {
                                    string[] strArrRefParamList = arrStrRefParamList[j].Split(';');
                                    string[] strArrRefDataList  = arrStr[j].Split('@')[0].Split(';');

                                    for (int k = 0; k < strArrRefParamList.Length; k++)
                                    {
                                        if (strArrRefParamList[k] == null || strArrRefParamList[k].Length == 0)
                                        {
                                            continue;
                                        }

                                        if (lnkLstParamList.Contains(strArrRefParamList[k]))
                                        {
                                            ArrayList arrLstRawData = (ArrayList)lnkLstParamList[strArrRefParamList[k]];
                                            int       _iArrCount    = arrLstRawData.Count;

                                            for (int m = 0; m < j - _iArrCount; m++)
                                            {
                                                arrLstRawData.Add(null);
                                            }

                                            arrLstRawData.Add(strArrRefDataList[k]);
                                            lnkLstParamList.Remove(strArrRefParamList[k]);
                                            lnkLstParamList.Add(strArrRefParamList[k], arrLstRawData);
                                        }
                                        else
                                        {
                                            ArrayList arrLstRawData = new ArrayList();

                                            for (int m = 0; m < j; m++)
                                            {
                                                arrLstRawData.Add(null);
                                            }

                                            arrLstRawData.Add(strArrRefDataList[k]);
                                            lnkLstParamList.Add(strArrRefParamList[k], arrLstRawData);
                                        }
                                    }
                                }

                                for (int j = 0; j < lnkLstParamList.Count; j++)
                                {
                                    string   strParamKey         = lnkLstParamList.GetKey(j).ToString();
                                    string[] strarrParamDataList = (string[])((ArrayList)lnkLstParamList.GetValue(j)).ToArray(typeof(string));

                                    if (_ColumnDatas.ContainsKey(strParamKey))
                                    {
                                        if (_ColumnDatas[strParamKey].Count == index)
                                        {
                                            _ColumnDatas[strParamKey].Add(strarrParamDataList);
                                        }
                                        else
                                        {
                                            int iColumnDatasCnt = _ColumnDatas[strParamKey].Count;

                                            for (int iColTemp = 0; iColTemp < index - iColumnDatasCnt; iColTemp++)
                                            {
                                                _ColumnDatas[strParamKey].Add(null);
                                            }

                                            _ColumnDatas[strParamKey].Add(strarrParamDataList);
                                        }
                                    }
                                    else
                                    {
                                        if (index > 0)
                                        {
                                            List <string[]> data = new List <string[]>();
                                            data.Add(null);

                                            for (int iEmp = 0; iEmp < index - 1; iEmp++)
                                            {
                                                data.Add(null);
                                            }

                                            data.Add(strarrParamDataList);
                                            _ColumnDatas.Add(strParamKey, data);
                                        }
                                        else
                                        {
                                            List <string[]> data = new List <string[]>();
                                            data.Add(strarrParamDataList);
                                            _ColumnDatas.Add(strParamKey, data);
                                        }
                                    }
                                }
                            }
                            else if (strTempKey.Equals(Definition.BLOB_FIELD_NAME.PARAM_LIST))
                            {
                                LinkedList lnkLstParamList = new LinkedList();

                                for (int j = 0; j < arrStr.Length; j++)
                                {
                                    string[] strArrParamList   = arrStr[j].Split(';');
                                    string[] strArrRawDataList = arrStrRaw[j].Split('@')[0].Split(';');

                                    for (int k = 0; k < strArrParamList.Length; k++)
                                    {
                                        if (strArrParamList[k] == null || strArrParamList[k].Length == 0 || string.IsNullOrEmpty(strArrRawDataList[k]))
                                        {
                                            continue;
                                        }

                                        if (lnkLstParamList.Contains(strArrParamList[k]))
                                        {
                                            ArrayList arrLstRawData = (ArrayList)lnkLstParamList[strArrParamList[k]];
                                            int       _iArrCount    = arrLstRawData.Count;

                                            for (int m = 0; m < j - _iArrCount; m++)
                                            {
                                                arrLstRawData.Add(null);
                                            }

                                            arrLstRawData.Add(strArrRawDataList[k]);
                                            lnkLstParamList.Remove(strArrParamList[k]);
                                            lnkLstParamList.Add(strArrParamList[k], arrLstRawData);
                                        }
                                        else
                                        {
                                            ArrayList arrLstRawData = new ArrayList();

                                            for (int m = 0; m < j; m++)
                                            {
                                                arrLstRawData.Add(null);
                                            }

                                            arrLstRawData.Add(strArrRawDataList[k]);
                                            lnkLstParamList.Add(strArrParamList[k], arrLstRawData);
                                        }
                                    }
                                }

                                for (int j = 0; j < lnkLstParamList.Count; j++)
                                {
                                    string   strParamKey         = lnkLstParamList.GetKey(j).ToString();
                                    string[] strarrParamDataList = (string[])((ArrayList)lnkLstParamList.GetValue(j)).ToArray(typeof(string));

                                    if (_ColumnDatas.ContainsKey(strParamKey))
                                    {
                                        if (_ColumnDatas[strParamKey].Count == index)
                                        {
                                            _ColumnDatas[strParamKey].Add(strarrParamDataList);
                                        }
                                        else
                                        {
                                            int iColumnDatasCnt = _ColumnDatas[strParamKey].Count;

                                            for (int iColTemp = 0; iColTemp < index - iColumnDatasCnt; iColTemp++)
                                            {
                                                _ColumnDatas[strParamKey].Add(null);
                                            }

                                            _ColumnDatas[strParamKey].Add(strarrParamDataList);
                                        }
                                    }
                                    else
                                    {
                                        if (index > 0)
                                        {
                                            List <string[]> data = new List <string[]>();
                                            data.Add(null);

                                            for (int iEmp = 0; iEmp < index - 1; iEmp++)
                                            {
                                                data.Add(null);
                                            }

                                            data.Add(strarrParamDataList);
                                            _ColumnDatas.Add(strParamKey, data);
                                        }
                                        else
                                        {
                                            List <string[]> data = new List <string[]>();
                                            data.Add(strarrParamDataList);
                                            _ColumnDatas.Add(strParamKey, data);
                                        }
                                    }
                                }
                            }
                        }

                        if (i == 0)
                        {
                            _DataCount.Add(arrStr.Length);

                            for (int k = 0; k < lstColumn.Count; k++)
                            {
                                string[] arrStrTemp = new string[arrStr.Length];

                                for (int j = 0; j < arrStrTemp.Length; j++)
                                {
                                    arrStrTemp[j] = lstData[k];
                                }

                                if (_ColumnDatas.ContainsKey(lstColumn[k]))
                                {
                                    if (_ColumnDatas[lstColumn[k]].Count == index)
                                    {
                                        _ColumnDatas[lstColumn[k]].Add(arrStrTemp);
                                    }
                                    else
                                    {
                                        int iColumnDatasCnt = _ColumnDatas[lstColumn[k]].Count;

                                        for (int iColTemp = 0; iColTemp < index - iColumnDatasCnt; iColTemp++)
                                        {
                                            _ColumnDatas[lstColumn[k]].Add(null);
                                        }

                                        _ColumnDatas[lstColumn[k]].Add(arrStrTemp);
                                    }
                                }
                                else
                                {
                                    if (index > 0)
                                    {
                                        List <string[]> data = new List <string[]>();
                                        data.Add(null);

                                        for (int iEmp = 0; iEmp < index - 1; iEmp++)
                                        {
                                            data.Add(null);
                                        }

                                        data.Add(arrStrTemp);
                                        _ColumnDatas.Add(lstColumn[k], data);
                                    }
                                    else
                                    {
                                        List <string[]> data = new List <string[]>();
                                        data.Add(arrStrTemp);
                                        _ColumnDatas.Add(lstColumn[k], data);
                                    }
                                }
                            }
                        }

                        if (!isATT)
                        {
                            if (_llstContextType[strKey] != null)
                            {
                                SPCStruct.ContextTypeInfo mContextTypeInfo = _llstContextType[strKey] as SPCStruct.ContextTypeInfo;
                                strKey = mContextTypeInfo.NAME.ToUpper();
                            }
                        }

                        if (_ColumnDatas.ContainsKey(strKey))
                        {
                            if (_ColumnDatas[strKey].Count == index)
                            {
                                _ColumnDatas[strKey].Add(arrStr);
                            }
                            else
                            {
                                int iColumnDatasCnt = _ColumnDatas[strKey].Count;

                                for (int iColTemp = 0; iColTemp < index - iColumnDatasCnt; iColTemp++)
                                {
                                    _ColumnDatas[strKey].Add(null);
                                }

                                _ColumnDatas[strKey].Add(arrStr);
                            }
                        }
                        else
                        {
                            if (index > 0)
                            {
                                List <string[]> data = new List <string[]>();
                                data.Add(null);

                                for (int iEmp = 0; iEmp < index - 1; iEmp++)
                                {
                                    data.Add(null);
                                }

                                data.Add(arrStr);
                                _ColumnDatas.Add(strKey, data);
                            }
                            else
                            {
                                List <string[]> data = new List <string[]>();
                                data.Add(arrStr);
                                _ColumnDatas.Add(strKey, data);
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
        }
Beispiel #2
0
        private void AddColumn(string[] arrContext, DataTable dtData, DataRow drData, LinkedList _llstContextType, bool bDataParsing)
        {
            string strKey          = string.Empty;
            string strContextKey   = string.Empty;
            string strContextValue = string.Empty;

            string[] arr         = null;
            string   _ref        = "ref_";
            string   param_alias = string.Empty;

            SPCStruct.ContextTypeInfo mContextTypeInfo = null;

            if (isATT) //ATT와의 중복률 관련 refactoring, KBLEE
            {
                for (int k = 0; k < arrContext.Length; k++)
                {
                    if (arrContext[k].IndexOf("=") > -1)
                    {
                        arr             = arrContext[k].Split('=');
                        strContextKey   = arr[0].ToUpper();
                        strContextValue = arr[1];

                        string strContextKey2 = strContextKey;

                        if (_llstContextType[strContextKey] != null)
                        {
                            mContextTypeInfo = _llstContextType[strContextKey] as SPCStruct.ContextTypeInfo;
                            strContextKey2   = mContextTypeInfo.NAME;
                        }

                        SetAddColumn(dtData, strContextKey, strContextValue, drData, strContextKey2, bDataParsing);
                    }
                }
            }
            else
            {
                for (int k = 0; k < arrContext.Length; k++)
                {
                    if (arrContext[k].IndexOf("=") > -1)
                    {
                        arr           = arrContext[k].Split('=');
                        strContextKey = arr[0].ToUpper();
                        //if (k == 0)
                        //    strContextKey = Definition.CHART_COLUMN.RAW;
                        strContextValue = arr[1];

                        if (strContextKey == Definition.BLOB_FIELD_NAME.PARAM_LIST.ToUpper())
                        {
                            SetAddColumn(dtData, strContextKey, strContextValue, drData, strContextKey, false);
                            AddColumnParamList(dtData, strContextValue, null, drData);
                        }
                        else if (strContextKey == Definition.BLOB_FIELD_NAME.REF_PARAM_LIST.ToUpper())
                        {
                            SetAddColumn(dtData, strContextKey, strContextValue, drData, strContextKey, false);
                            AddColumnParamList(dtData, strContextValue, _ref, drData);
                        }
                        else if (strContextKey == Definition.BLOB_FIELD_NAME.REF_DATA.ToUpper())
                        {
                            strKey = drData[Definition.BLOB_FIELD_NAME.REF_PARAM_LIST].ToString();
                            SetParamValue(dtData, strKey, strContextValue, drData, _ref);
                        }
                        else
                        {
                            param_alias = string.Empty;

                            if (dtData.Columns.Contains(Definition.CHART_COLUMN.PARAM_ALIAS))
                            {
                                param_alias = drData[Definition.CHART_COLUMN.PARAM_ALIAS].ToString();
                            }

                            if (param_alias.ToUpper() == strContextKey)
                            {
                                strContextKey = Definition.CHART_COLUMN.RAW;
                            }

                            string strContextKey2 = strContextKey;

                            if (_llstContextType[strContextKey] != null)
                            {
                                mContextTypeInfo = _llstContextType[strContextKey] as SPCStruct.ContextTypeInfo;
                                strContextKey2   = mContextTypeInfo.NAME;
                            }

                            SetAddColumn(dtData, strContextKey, strContextValue, drData, strContextKey2, bDataParsing);
                        }
                    }
                }
            }
        }