Esempio n. 1
0
        public DataSet getDataSetDATA_TRX_Data(DataSet dsData)
        {
            DataSet dsRetrun = new DataSet();

            try
            {
                if (DSUtil.CheckRowCount(dsData))
                {
                    BISTel.PeakPerformance.Client.CommonUtil.GZip gZip = new BISTel.PeakPerformance.Client.CommonUtil.GZip();
                    string module_id    = string.Empty;
                    string module_alias = string.Empty;

                    foreach (DataRow drData in dsData.Tables[0].Rows)
                    {
                        using (StreamReader sr = gZip.DecompressForStream(drData["DATA_FILE"]))
                        {
                            this.ParseHeader(sr);
                            _llstLineInfo  = this.ParseContextLineInfo(sr, arrLineInfo);
                            _llstParamName = this.ParseContextLineInfo(sr, arrLineInfo);

                            //this.ParseContextLineInfo(sr);

                            //switch (ParseType)
                            //{
                            //    default:
                            //        break;
                            //}
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);

                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }

            return(dsRetrun);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_dtData"></param>
        /// <param name="_llstCondition"></param>
        /// <param name="bDataParsing"></param>
        /// <returns></returns>
        public DataSet DecompressDATA_TRX_DATA(DataTable _dtData, LinkedList _llstCondition, LinkedList _llstContextType, bool bDataParsing, bool includingToggleData)
        {
            DataSet       dsReturn = null;
            DataTable     dt       = new DataTable();
            CommonUtility _comUtil = new CommonUtility();

            try
            {
                if (_dtData != null && _dtData.Rows.Count > 0)
                {
                    dsReturn = new DataSet();
                    List <string> lstColumn = new List <string>();
                    List <string> lstData   = new List <string>();

                    foreach (DataColumn col in _dtData.Columns)
                    {
                        if (col.ColumnName.ToString() != COLUMN.FILE_DATA)
                        {
                            lstColumn.Add(col.ColumnName.ToString());
                        }
                    }

                    BISTel.PeakPerformance.Client.CommonUtil.GZip gZip = new BISTel.PeakPerformance.Client.CommonUtil.GZip();
                    int iIndex = 0;

                    foreach (DataRow drData in _dtData.Rows)
                    {
                        lstData.Clear();

                        for (int i = 0; i < lstColumn.Count; i++)
                        {
                            lstData.Add(drData[lstColumn[i]].ToString());
                        }

                        //using (StreamReader sr = gZip.DecompressForStream(drData[COLUMN.FILE_DATA]))
                        using (StreamReader sr = CommonUtility.ConvertBLOBToStreamReader(drData[COLUMN.FILE_DATA]))
                        {
                            this.ParseHeader(sr);
                            this.ParseContextLineInfo(iIndex++, sr, _llstContextType, lstColumn, lstData);
                            //MakeDataTable(this._llstLineInfo, this._dtDefault, drData, lstColumn, _llstContextType);

                            //this.ParseContextParamName(sr, drData,bDataParsing);


                            //foreach (DataColumn dc in this._dtDefault.Columns)
                            //{
                            //    if (dc.ColumnName == COLUMN.FILE_DATA ) continue;
                            //    if (!dt.Columns.Contains(dc.ColumnName.ToString()))
                            //        dt.Columns.Add(dc.ColumnName.ToString().ToUpper(), dc.DataType);
                            //}

                            //string sWhere  = _comUtil.NVL(_llstCondition[Definition.CONDITION_KEY_CONTEXT_KEY_LIST]);
                            //if (!string.IsNullOrEmpty(sWhere))
                            //{
                            //    DataRow[] drSelectParams = this._dtDefault.Select(sWhere);
                            //    foreach (DataRow dr in drSelectParams)
                            //        dt.ImportRow(dr);
                            //}
                            //else
                            //    dt.Merge(this._dtDefault);
                        }
                    }

                    DataTable     dtTable     = new DataTable();
                    int           iCol        = 0;
                    int           iLoopCount  = 0;
                    List <string> columnNames = new List <string>();

                    foreach (KeyValuePair <string, List <string[]> > keyval in _ColumnDatas)
                    {
                        if (iCol == 0)
                        {
                            iLoopCount = keyval.Value.Count;
                            iCol++;
                        }
                        dtTable.Columns.Add(keyval.Key);
                        columnNames.Add(keyval.Key);
                    }

                    dtTable.Columns.Add(Definition.CHART_COLUMN.ORDERINFILEDATA, typeof(int));
                    columnNames.Add(Definition.CHART_COLUMN.ORDERINFILEDATA);
                    dtTable.Columns.Add(Definition.CHART_COLUMN.TABLENAME);
                    columnNames.Add(Definition.CHART_COLUMN.TABLENAME);
                    dtTable.Columns.Add(Definition.COL_TOGGLE_YN);
                    columnNames.Add(Definition.COL_TOGGLE_YN);

                    for (int i = 0; i < iLoopCount; i++)
                    {
                        for (int iRow = 0; iRow < _DataCount[i]; iRow++)
                        {
                            string[] sColumnData = new string[columnNames.Count];

                            for (int iColCount = 0; iColCount < _ColumnDatas.Count; iColCount++)
                            {
                                if (_ColumnDatas[columnNames[iColCount]].Count > i)
                                {
                                    string[] sData = _ColumnDatas[columnNames[iColCount]][i];

                                    if (sData != null && sData.Length > iRow && sData[iRow] != "NaN")
                                    {
                                        sColumnData[iColCount] = sData[iRow];
                                    }
                                }
                            }

                            sColumnData[columnNames.Count - 3] = iRow.ToString();
                            sColumnData[columnNames.Count - 2] = Definition.TableName.USERNAME_DATA_SHORT;

                            dtTable.Rows.Add(sColumnData);
                        }
                    }

                    FillToggleColumn(dtTable);

                    if (!includingToggleData)
                    {
                        DeleteToggleOffData(dtTable);
                    }

                    dsReturn.Tables.Add(dtTable);

                    //dsRetrun.Tables.Add(dt);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);

                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }
            finally
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }

            return(dsReturn);
        }
Esempio n. 3
0
        private void bbtnStart_Click(object sender, EventArgs e)
        {
            BISTel.PeakPerformance.Client.CommonUtil.GZip gZip = new BISTel.PeakPerformance.Client.CommonUtil.GZip();
            FarPoint.Win.Spread.CellType.TextCellType     tc   = new FarPoint.Win.Spread.CellType.TextCellType();

            pgBarModel.Value        = 0;
            pgBarData.Value         = 0;
            pgBarDataTemp.Value     = 0;
            pgBarOOC.Value          = 0;
            pgBarModelContext.Value = 0;

            string _startDate = BISTel.eSPC.Page.Common.CommonPageUtil.StartDate(StartDate.Value.ToString());
            string _endDate   = BISTel.eSPC.Page.Common.CommonPageUtil.EndDate(EndDate.Value.ToString());

            if (this.bsprData.ActiveSheet.RowCount > 0)
            {
                if (this.srtLstProductID.Count > 0)
                {
                    pgBarModel.Maximum = this.bsprData.ActiveSheet.RowCount;

                    for (int i = 0; i < this.bsprData.ActiveSheet.RowCount; i++)
                    {
                        pgBarData.Value         = 0;
                        pgBarDataTemp.Value     = 0;
                        pgBarOOC.Value          = 0;
                        pgBarModelContext.Value = 0;

                        this.bsprBLOBData.ClearHead();
                        this.bsprBLOBData.AddHeadComplete();
                        this.bsprBLOBData.UseSpreadEdit       = false;
                        this.bsprBLOBData.AutoGenerateColumns = true;
                        this.bsprBLOBData.UseAutoSort         = false;

                        this.bsprTempTrxData.ClearHead();
                        this.bsprTempTrxData.AddHeadComplete();
                        this.bsprTempTrxData.UseSpreadEdit       = false;
                        this.bsprTempTrxData.AutoGenerateColumns = true;
                        this.bsprTempTrxData.UseAutoSort         = false;

                        this.bsprOOCTRXData.ClearHead();
                        this.bsprOOCTRXData.AddHeadComplete();
                        this.bsprOOCTRXData.UseSpreadEdit       = false;
                        this.bsprOOCTRXData.AutoGenerateColumns = true;
                        this.bsprOOCTRXData.UseAutoSort         = false;

                        this.bsprContextMSTData.ClearHead();
                        this.bsprContextMSTData.AddHeadComplete();
                        this.bsprContextMSTData.UseSpreadEdit       = false;
                        this.bsprContextMSTData.AutoGenerateColumns = true;
                        this.bsprContextMSTData.UseAutoSort         = false;

                        this.bsprData.ActiveSheet.Rows[i].BackColor = Color.Yellow;
                        Thread.Sleep(50);
                        Application.DoEvents();

                        string     _sModelConfigRawid = this.bsprData.ActiveSheet.Cells[i, 0].Text.ToString();
                        LinkedList lnkListTemp        = new LinkedList();
                        lnkListTemp.Add("MODEL_CONFIG_RAWID", _sModelConfigRawid);
                        lnkListTemp.Add("START_DTTS", _startDate);
                        lnkListTemp.Add("END_DTTS", _endDate);

                        #region DATA_TRX_SPC BLOB안에 PRODUCT_ID 바꾸기
                        DataSet _dsTemp = this._wsSPC.GetSPCBLOBData(lnkListTemp.GetSerialData());
                        this.bsprBLOBData.DataSource = _dsTemp;
                        if (_dsTemp.Tables[0].Rows.Count > 0)
                        {
                            pgBarData.Maximum = this.bsprBLOBData.ActiveSheet.RowCount;
                            this.bsprBLOBData.ActiveSheet.Cells[0, 0, this.bsprBLOBData.ActiveSheet.RowCount - 1, this.bsprBLOBData.ActiveSheet.ColumnCount - 1].CellType = tc;
                            for (int j = 0; j < this.bsprBLOBData.ActiveSheet.RowCount; j++)
                            {
                                string _sDataRawid = this.bsprBLOBData.ActiveSheet.Cells[j, 0].Text.ToString();
                                this.bsprBLOBData.ActiveSheet.Rows[j].BackColor = Color.Yellow;
                                Thread.Sleep(50);
                                Application.DoEvents();
                                //BLOB안에 DATA를 바꾸자.
                                object File_Data = _dsTemp.Tables[0].Rows[j][COLUMN.FILE_DATA];
                                //StreamReader sr = gZip.DecompressForStream(File_Data);
                                StreamReader  sr         = CommonUtility.ConvertBLOBToStreamReader(File_Data);
                                string        _sline     = string.Empty;
                                StringBuilder sbFileData = new StringBuilder();
                                while (sr.Peek() > -1)
                                {
                                    _sline = sr.ReadLine();
                                    if (_sline.IndexOf("PRODUCT_ID") == 0)
                                    {
                                        string[] strArrTemp = _sline.Split('\t');
                                        for (int k = 0; k < this.srtLstProductID.Count; k++)
                                        {
                                            string sTempKey   = this.srtLstProductID.GetKey(k).ToString();
                                            string sTempValue = this.srtLstProductID.GetByIndex(k).ToString();
                                            for (int idxTemp = 0; idxTemp < strArrTemp.Length; idxTemp++)
                                            {
                                                if (strArrTemp[idxTemp].Equals(sTempKey))
                                                {
                                                    strArrTemp[idxTemp] = sTempValue;
                                                }
                                            }
                                        }
                                        _sline = "";
                                        for (int idxTemp_1 = 0; idxTemp_1 < strArrTemp.Length; idxTemp_1++)
                                        {
                                            _sline += "\t" + strArrTemp[idxTemp_1];
                                        }
                                        _sline = _sline.Substring(1);
                                    }
                                    sbFileData.AppendLine(_sline);
                                }
                                string       _sFileData          = sbFileData.ToString();
                                byte[]       btBlob              = Encoding.Default.GetBytes(_sFileData);
                                MemoryStream msDestination       = new MemoryStream(btBlob.Length);
                                GZipStream   compressedzipStream = new GZipStream(msDestination, CompressionMode.Compress, true);
                                compressedzipStream.Write(btBlob, 0, btBlob.Length);
                                compressedzipStream.Close();
                                msDestination.Position = 0;
                                btBlob = new byte[msDestination.Length];
                                msDestination.Read(btBlob, 0, (int)msDestination.Length);
                                LinkedList fieldData = new LinkedList();
                                fieldData.Add("RAWID", _sDataRawid);
                                fieldData.Add("FILE_DATA", btBlob);
                                bool bResult = this._wsSPC.ModifySPCBLOBData(fieldData.GetSerialData());
                                if (!bResult)
                                {
                                    MSGHandler.DisplayMessage(MSGType.Error, "SPC_INFO_ERROR_PARSING", null, null);
                                    return;
                                }

                                this.bsprBLOBData.ActiveSheet.Rows[j].BackColor = Color.LightGreen;
                                pgBarData.Increment(1);
                                Thread.Sleep(50);
                                Application.DoEvents();
                            }
                        }
                        else
                        {
                            pgBarData.Maximum = 1;
                            pgBarData.Value   = 1;
                        }
                        #endregion

                        #region DATA_TEMP_TRX_SPC안에 PRODUCT_ID 바꾸기

                        DataSet _dsTempTrx = this._wsSPC.GetSPCTempTrxData(lnkListTemp.GetSerialData());
                        if (_dsTempTrx != null && _dsTempTrx.Tables != null && _dsTempTrx.Tables[0].Rows.Count > 0)
                        {
                            this.bsprTempTrxData.DataSource = _dsTempTrx;

                            pgBarDataTemp.Maximum = this.bsprTempTrxData.ActiveSheet.RowCount;
                            this.bsprTempTrxData.ActiveSheet.Cells[0, 0, this.bsprTempTrxData.ActiveSheet.RowCount - 1, this.bsprTempTrxData.ActiveSheet.ColumnCount - 1].CellType = tc;
                            for (int j = 0; j < this.bsprTempTrxData.ActiveSheet.RowCount; j++)
                            {
                                string _sDataRawid = this.bsprTempTrxData.ActiveSheet.Cells[j, 0].Text.ToString();
                                this.bsprTempTrxData.ActiveSheet.Rows[j].BackColor = Color.Yellow;
                                Thread.Sleep(50);
                                Application.DoEvents();
                                //CLOB안에 DATA를 바꾸자.
                                string sContext_List = _dsTempTrx.Tables[0].Rows[j][COLUMN.CONTEXT_LIST].ToString();
                                if (sContext_List.IndexOf("PRODUCT_ID") > -1)
                                {
                                    string[] strArrTemp = sContext_List.Split('\t');
                                    for (int idxTemp = 0; idxTemp < strArrTemp.Length; idxTemp++)
                                    {
                                        if (strArrTemp[idxTemp].Split('=').Length > 1)
                                        {
                                            if (strArrTemp[idxTemp].Split('=')[0].Equals("PRODUCT_ID"))
                                            {
                                                if (this.srtLstProductID.Contains(strArrTemp[idxTemp].Split('=')[1]))
                                                {
                                                    int    _idxOfKey  = this.srtLstProductID.IndexOfKey(strArrTemp[idxTemp].Split('=')[1]);
                                                    string sTempKey   = this.srtLstProductID.GetKey(_idxOfKey).ToString();
                                                    string sTempValue = this.srtLstProductID.GetByIndex(_idxOfKey).ToString();
                                                    strArrTemp[idxTemp] = strArrTemp[idxTemp].Replace(sTempKey, sTempValue);
                                                }
                                            }
                                            else if (strArrTemp[idxTemp].Split('=')[0].Equals("CONTEXT_KEY"))
                                            {
                                                string[] strContextKeyValueTemp = strArrTemp[idxTemp].Split('=')[1].Split(';');
                                                if (strContextKeyValueTemp.Length > 0)
                                                {
                                                    for (int _iTemp = 0; _iTemp < strContextKeyValueTemp.Length; _iTemp++)
                                                    {
                                                        if (this.srtLstProductID.Contains(strContextKeyValueTemp[_iTemp]))
                                                        {
                                                            strContextKeyValueTemp[_iTemp] = this.srtLstProductID[strContextKeyValueTemp[_iTemp]].ToString();
                                                        }
                                                    }
                                                    string _sTemp = "";
                                                    for (int _idx = 0; _idx < strContextKeyValueTemp.Length; _idx++)
                                                    {
                                                        _sTemp += ";" + strContextKeyValueTemp[_idx];
                                                    }
                                                    _sTemp = _sTemp.Substring(1);
                                                    strArrTemp[idxTemp] = "CONTEXT_KEY=" + _sTemp;
                                                }
                                            }
                                        }
                                    }

                                    sContext_List = "";
                                    for (int idxTemp_1 = 0; idxTemp_1 < strArrTemp.Length; idxTemp_1++)
                                    {
                                        sContext_List += "\t" + strArrTemp[idxTemp_1];
                                    }
                                    sContext_List = sContext_List.Substring(1);
                                }

                                LinkedList fieldData = new LinkedList();
                                fieldData.Add("RAWID", _sDataRawid);
                                fieldData.Add("CONTEXT_LIST", sContext_List);
                                bool bResult = this._wsSPC.ModifySPCTempTrxData(fieldData.GetSerialData());
                                if (!bResult)
                                {
                                    MSGHandler.DisplayMessage(MSGType.Error, "SPC_INFO_ERROR_PARSING", null, null);
                                    return;
                                }

                                this.bsprTempTrxData.ActiveSheet.Rows[j].BackColor = Color.LightGreen;
                                pgBarDataTemp.Increment(1);
                                Thread.Sleep(50);
                                Application.DoEvents();
                            }
                        }
                        else
                        {
                            pgBarDataTemp.Maximum = 1;
                            pgBarDataTemp.Value   = 1;
                        }
                        #endregion

                        #region OOC_TRX_SPC 안에 PRODUCT_ID 바꾸기

                        DataSet _dsTempOOCTrx = this._wsSPC.GetSPCOOCData(lnkListTemp.GetSerialData());
                        if (_dsTempOOCTrx != null && _dsTempOOCTrx.Tables != null && _dsTempOOCTrx.Tables[0].Rows.Count > 0)
                        {
                            this.bsprOOCTRXData.DataSource = _dsTempOOCTrx;

                            pgBarOOC.Maximum = this.bsprOOCTRXData.ActiveSheet.RowCount;
                            this.bsprOOCTRXData.ActiveSheet.Cells[0, 0, this.bsprOOCTRXData.ActiveSheet.RowCount - 1, this.bsprOOCTRXData.ActiveSheet.ColumnCount - 1].CellType = tc;
                            for (int j = 0; j < this.bsprOOCTRXData.ActiveSheet.RowCount; j++)
                            {
                                string _sDataRawid = this.bsprOOCTRXData.ActiveSheet.Cells[j, 0].Text.ToString();
                                this.bsprOOCTRXData.ActiveSheet.Rows[j].BackColor = Color.Yellow;
                                Thread.Sleep(50);
                                Application.DoEvents();
                                //CLOB안에 DATA를 바꾸자.
                                string sContext_List = _dsTempOOCTrx.Tables[0].Rows[j][COLUMN.CONTEXT_LIST].ToString();
                                if (sContext_List.IndexOf("PRODUCT_ID") > -1)
                                {
                                    string[] strArrTemp = sContext_List.Split('\t');
                                    for (int idxTemp = 0; idxTemp < strArrTemp.Length; idxTemp++)
                                    {
                                        if (strArrTemp[idxTemp].Split('=').Length > 1)
                                        {
                                            if (strArrTemp[idxTemp].Split('=')[0].Equals("PRODUCT_ID"))
                                            {
                                                if (this.srtLstProductID.Contains(strArrTemp[idxTemp].Split('=')[1]))
                                                {
                                                    int    _idxOfKey  = this.srtLstProductID.IndexOfKey(strArrTemp[idxTemp].Split('=')[1]);
                                                    string sTempKey   = this.srtLstProductID.GetKey(_idxOfKey).ToString();
                                                    string sTempValue = this.srtLstProductID.GetByIndex(_idxOfKey).ToString();
                                                    strArrTemp[idxTemp] = strArrTemp[idxTemp].Replace(sTempKey, sTempValue);
                                                }
                                            }
                                            else if (strArrTemp[idxTemp].Split('=')[0].Equals("CONTEXT_KEY"))
                                            {
                                                string[] strContextKeyValueTemp = strArrTemp[idxTemp].Split('=')[1].Split(';');
                                                if (strContextKeyValueTemp.Length > 0)
                                                {
                                                    for (int _iTemp = 0; _iTemp < strContextKeyValueTemp.Length; _iTemp++)
                                                    {
                                                        if (this.srtLstProductID.Contains(strContextKeyValueTemp[_iTemp]))
                                                        {
                                                            strContextKeyValueTemp[_iTemp] = this.srtLstProductID[strContextKeyValueTemp[_iTemp]].ToString();
                                                        }
                                                    }
                                                    string _sTemp = "";
                                                    for (int _idx = 0; _idx < strContextKeyValueTemp.Length; _idx++)
                                                    {
                                                        _sTemp += ";" + strContextKeyValueTemp[_idx];
                                                    }
                                                    _sTemp = _sTemp.Substring(1);
                                                    strArrTemp[idxTemp] = "CONTEXT_KEY=" + _sTemp;
                                                }
                                            }
                                        }
                                    }

                                    sContext_List = "";
                                    for (int idxTemp_1 = 0; idxTemp_1 < strArrTemp.Length; idxTemp_1++)
                                    {
                                        sContext_List += "\t" + strArrTemp[idxTemp_1];
                                    }
                                    sContext_List = sContext_List.Substring(1);
                                }

                                LinkedList fieldData = new LinkedList();
                                fieldData.Add("RAWID", _sDataRawid);
                                fieldData.Add("CONTEXT_LIST", sContext_List);
                                bool bResult = this._wsSPC.ModifySPCOOCData(fieldData.GetSerialData());
                                if (!bResult)
                                {
                                    MSGHandler.DisplayMessage(MSGType.Error, "SPC_INFO_ERROR_PARSING", null, null);
                                    return;
                                }

                                this.bsprOOCTRXData.ActiveSheet.Rows[j].BackColor = Color.LightGreen;
                                pgBarOOC.Increment(1);
                                Thread.Sleep(50);
                                Application.DoEvents();
                            }
                        }
                        else
                        {
                            pgBarOOC.Maximum = 1;
                            pgBarOOC.Value   = 1;
                        }
                        #endregion

                        #region MODEL_CONTEXT_MST_SPC 안에 PRODUCT_ID 바꾸기

                        DataSet _dsTempModelContext = this._wsSPC.GetSPCModelContextData(lnkListTemp.GetSerialData());
                        if (_dsTempModelContext != null && _dsTempModelContext.Tables != null && _dsTempModelContext.Tables[0].Rows.Count > 0)
                        {
                            this.bsprContextMSTData.DataSource = _dsTempModelContext;

                            pgBarModelContext.Maximum = this.bsprContextMSTData.ActiveSheet.RowCount;
                            this.bsprContextMSTData.ActiveSheet.Cells[0, 0, this.bsprContextMSTData.ActiveSheet.RowCount - 1, this.bsprContextMSTData.ActiveSheet.ColumnCount - 1].CellType = tc;
                            for (int j = 0; j < this.bsprContextMSTData.ActiveSheet.RowCount; j++)
                            {
                                string _sDataRawid = this.bsprContextMSTData.ActiveSheet.Cells[j, 0].Text.ToString();
                                this.bsprContextMSTData.ActiveSheet.Rows[j].BackColor = Color.Yellow;
                                Thread.Sleep(50);
                                Application.DoEvents();
                                //CONTEXT_VALUE안에 DATA를 바꾸자.
                                string   sContext_Value = _dsTempModelContext.Tables[0].Rows[j][COLUMN.CONTEXT_VALUE].ToString();
                                string[] strArrTemp     = sContext_Value.Split(';');
                                for (int idxTemp = 0; idxTemp < strArrTemp.Length; idxTemp++)
                                {
                                    if (this.srtLstProductID.Contains(strArrTemp[idxTemp]))
                                    {
                                        string sTempValue = this.srtLstProductID[strArrTemp[idxTemp]].ToString();
                                        strArrTemp[idxTemp] = sTempValue;
                                    }
                                }

                                sContext_Value = "";
                                for (int idxTemp_1 = 0; idxTemp_1 < strArrTemp.Length; idxTemp_1++)
                                {
                                    sContext_Value += ";" + strArrTemp[idxTemp_1];
                                }
                                sContext_Value = sContext_Value.Substring(1);

                                LinkedList fieldData = new LinkedList();
                                fieldData.Add("RAWID", _sDataRawid);
                                fieldData.Add("CONTEXT_VALUE", sContext_Value);
                                bool bResult = this._wsSPC.ModifySPCModelContextData(fieldData.GetSerialData());
                                if (!bResult)
                                {
                                    MSGHandler.DisplayMessage(MSGType.Error, "SPC_INFO_ERROR_PARSING", null, null);
                                    return;
                                }

                                this.bsprContextMSTData.ActiveSheet.Rows[j].BackColor = Color.LightGreen;
                                pgBarModelContext.Increment(1);
                                Thread.Sleep(50);
                                Application.DoEvents();
                            }
                        }
                        else
                        {
                            pgBarModelContext.Maximum = 1;
                            pgBarModelContext.Value   = 1;
                        }
                        #endregion

                        this.bsprData.ActiveSheet.Rows[i].BackColor = Color.LightGreen;
                        pgBarModel.Increment(1);
                        Thread.Sleep(50);
                        Application.DoEvents();
                    }
                }
                else
                {
                    MSGHandler.DisplayMessage(MSGType.Information, "SPC_INFO_NO_INFO_PROD_MAPPING", null, null);
                    return;
                }
            }
            else
            {
                MSGHandler.DisplayMessage(MSGType.Information, "Please search SPC Model first.");
                return;
            }
        }