private void bSpread_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            BSpread bSpread = (BSpread)(sender);

            if (e.Column == 0)
            {
                if (e.Row == 0)
                {
                    if (Convert.ToBoolean(bSpread.ActiveSheet.Cells[e.Row, e.Column].Value))
                    {
                        for (int i = 1; i < bSpread.ActiveSheet.RowCount; i++)
                        {
                            if (bSpread.ActiveSheet.Cells[i, e.Column].CellType != null && bSpread.ActiveSheet.Cells[i, e.Column].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.CheckBoxCellType))
                            {
                                bSpread.ActiveSheet.Cells[i, e.Column].Value = 0;
                            }
                        }
                    }
                }
                else
                {
                    if (Convert.ToBoolean(bSpread.ActiveSheet.Cells[e.Row, e.Column].Value))
                    {
                        bSpread.ActiveSheet.Cells[0, e.Column].Value = false;
                    }
                }
            }
        }
Пример #2
0
        protected void UpdateRowColor(BSpread spread)
        {
            for (int j = 0; j < spread.Sheets.Count; j++)
            {
                int columnToggleYNIndex = -1;

                for (int i = 0; i < spread.Sheets[j].Columns.Count; i++)
                {
                    Column col = spread.Sheets[j].Columns.Get(i);
                    if (col.Label == Definition.COL_TOGGLE_YN)
                    {
                        columnToggleYNIndex = i;
                        break;
                    }
                }

                if (columnToggleYNIndex == -1)
                {
                    continue;
                }

                for (int i = 0; i < spread.Sheets[j].Rows.Count; i++)
                {
                    if (spread.Sheets[j].Cells[i, columnToggleYNIndex].Text == "Y")
                    {
                        spread.Sheets[j].Rows[i].BackColor = Color.LightGreen;
                    }
                }
            }
        }
Пример #3
0
 public void InitializeBSpread(BSpread bspread)
 {
     bspread.UseSpreadEdit       = false;
     bspread.AutoGenerateColumns = false;
     bspread.ActiveSheet.DefaultStyle.ResetLocked();
     bspread.UseEdit = true;
     bspread.ClearHead();
     bspread.Locked                  = true;
     bspread.UseHeadColor            = true;
     bspread.EditMode                = false;
     bspread.ActiveSheet.RowCount    = 0;
     bspread.ActiveSheet.ColumnCount = 0;
 }
Пример #4
0
        private string GetCodeString(BSpread _bSpread)
        {
            ArrayList alCheckRowIndex = null;
            string    sRtnValue       = string.Empty;

            alCheckRowIndex = this._bspreadutility.GetCheckedRowIndex(_bSpread, (int)enumMultiDataConditionPopup.SELECT);
            for (int i = 0; i < alCheckRowIndex.Count; i++)
            {
                sRtnValue += _bSpread.ActiveSheet.Cells[(int)alCheckRowIndex[i], 1].Text + ",";
            }

            if (!string.IsNullOrEmpty(sRtnValue))
            {
                sRtnValue = sRtnValue.Substring(0, sRtnValue.Length - 1);
            }
            return(sRtnValue);
        }
Пример #5
0
        private void bSpread1_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            if (e.Column != (int)enumMultiDataConditionPopup.SELECT)
            {
                return;
            }

            BSpread bsprData = sender as BSpread;

            if ((bool)bsprData.GetCellValue(e.Row, 0) == true)
            {
                for (int i = 0; i < bsprData.ActiveSheet.RowCount; i++)
                {
                    if (i == e.Row)
                    {
                        continue;
                    }
                    bsprData.ActiveSheet.Cells[i, 0].Value = 0;
                }
            }
        }
Пример #6
0
        internal void Compare(BSpread spread)
        {
            ArrayList checkedRows = spread.GetCheckedList(columnIndex["SELECT"]);

            if (!(parent is SPCModelCompareUC) || parent == null)
            {
                MSGHandler.DisplayMessage(MSGType.Warning, "Error");
                return;
            }

            ArrayList chartIDs = new ArrayList();

            foreach (int rowIndex in checkedRows)
            {
                chartIDs.Add(spread.ActiveSheet.GetText(rowIndex, columnIndex["CHART_ID"]));
            }

            LinkedList llCondition = new LinkedList("CHART_ID", chartIDs.ToArray(typeof(string)));

            ((SPCModelCompareUC)parent).Compare(llCondition);
        }
Пример #7
0
        internal void Filter(BSpread spread)
        {
            string conditionQuery = string.Empty;

            List <string> filteringColumns = new List <string>();

            foreach (DataColumn dc in this.dtSPCModelList.Columns)
            {
                if (!notContextColumnNames.Contains(dc.ColumnName.ToUpper()))
                {
                    filteringColumns.Add(dc.ColumnName);
                }
            }
            SpreadFilteringPopup filteringPopup = new SpreadFilteringPopup(this.dtSPCModelList, filteringColumns.ToArray());

            if (DialogResult.Cancel == filteringPopup.ShowDialog())
            {
                return;
            }

            conditionQuery = filteringPopup.ConditionQuery;

            List <string> checkedCartID = new List <string>(GetCheckedChartID(conditionQuery));

            for (int i = 0; i < spread.ActiveSheet.Rows.Count; i++)
            {
                if (checkedCartID.Contains(spread.ActiveSheet.Cells[i, columnIndex["CHART_ID"]].Text))
                {
                    spread.ActiveSheet.Rows[i].Visible = true;
                    continue;
                }

                if (spread.ActiveSheet.Cells[i, columnIndex["SELECT"]].Text == "True")
                {
                    spread.ActiveSheet.Cells[i, columnIndex["SELECT"]].Text = null;
                }

                spread.ActiveSheet.Rows[i].Visible = false;
            }
        }
Пример #8
0
        public void bSpreadModelList_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            if (e.Column != (int)SPCChartConditionContext.SELECT)
            {
                return;
            }
            BSpread bsprData = sender as BSpread;

            if ((bool)bsprData.GetCellValue(e.Row, (int)SPCChartConditionContext.SELECT) == true)
            {
                for (int i = 0; i < bsprData.ActiveSheet.RowCount; i++)
                {
                    if (i == e.Row)
                    {
                        continue;
                    }
                    bsprData.ActiveSheet.Cells[i, (int)SPCChartConditionContext.SELECT].Value = 0;
                }

                ArrayList alCheckRowIndex = this._bspreadutility.GetCheckedRowIndex(bsprData, 0);
                if (alCheckRowIndex.Count > 0)
                {
                    string sMainYN = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[0], (int)SPCChartConditionContext.MAIN_YN].Text;
                    this.mModelConfigRawID = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[0], (int)SPCChartConditionContext.MODEL_CONFIG_RAWID].Text;
                    if (sMainYN.Equals("Y"))
                    {
                        this.PROC_MainModelContext((int)alCheckRowIndex[0]);
                    }
                    else
                    {
                        for (int j = 1; j < this.bTabControl1.TabPages.Count; j++)
                        {
                            this.bTabControl1.TabPages.RemoveAt(j);
                        }
                    }
                }
            }
        }
Пример #9
0
        private void bSpreadContext_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            if (e.Column != (int)SPCChartConditionContext.SELECT)
            {
                return;
            }
            BSpread bsprData = sender as BSpread;

            if ((bool)bsprData.GetCellValue(e.Row, (int)SPCChartConditionContext.SELECT) == true)
            {
                string    sValue          = bsprData.ActiveSheet.Cells[e.Row, 1].Text;
                ArrayList alCheckRowIndex = this._bspreadutility.GetCheckedRowIndex(bsprData, 0);
                if (sValue == Definition.VARIABLE.STAR)
                {
                    for (int j = 0; j < alCheckRowIndex.Count; j++)
                    {
                        string sTarget = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[j], 1].Text;
                        if (sTarget != sValue)
                        {
                            bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[j], (int)SPCChartConditionContext.SELECT].Value = 0;
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < alCheckRowIndex.Count; j++)
                    {
                        string sTarget = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[j], 1].Text;
                        if (sTarget == Definition.VARIABLE.STAR)
                        {
                            bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[j], (int)SPCChartConditionContext.SELECT].Value = 0;
                        }
                    }
                }
            }
        }
Пример #10
0
        public void bbtnOK_Click(object sender, EventArgs e)
        {
            try
            {
                ArrayList alCheckRowIndex = this._bspreadutility.GetCheckedRowIndex(this.bSpreadModelList, 0);
                if (alCheckRowIndex.Count == 0)
                {
                    MSGHandler.DisplayMessage(MSGType.Warning, "SPC_INFO_CHOOSE_ITEM_FOR_TARGET", null, null);
                    return;
                }
                else if (alCheckRowIndex.Count > 1)
                {
                    MSGHandler.DisplayMessage(MSGType.Warning, "SPC_INFO_CANT_SELECT_MORE_THAN_ONE", null, null);
                    return;
                }

                int iRow = (int)alCheckRowIndex[0];
                this.strucContextinfo.MODEL_CONFIG_RAWID = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.MODEL_CONFIG_RAWID].Text;
                this.strucContextinfo.PARAM_ALIAS        = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.PARAM_ALIAS].Text;
                this.strucContextinfo.MAIN_YN            = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.MAIN_YN].Text;
                this.strucContextinfo.DEFAULT_CHART_LIST = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.DEFAULT_CHART_LIST].Text;

                this.strucContextinfo.AREA       = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.AREA].Text;
                this.strucContextinfo.AREA_RAWID = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.AREA_RAWID].Text;
                this.strucContextinfo.EQP_MODEL  = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.EQP_MODEL].Text;

                string sRESTRICT_SAMPLE_DAYS = this.bSpreadModelList.ActiveSheet.Cells[iRow, (int)SPCChartConditionContext.RESTRICT_SAMPLE_DAYS].Text;
                this.strucContextinfo.RESTRICT_SAMPLE_DAYS = string.IsNullOrEmpty(sRESTRICT_SAMPLE_DAYS) ? Definition.RESTRICT_SAMPLE_DAYS : int.Parse(sRESTRICT_SAMPLE_DAYS);


                int iCol = ((int)SPCChartConditionContext.MAIN_YN) + 1;
                this.strucContextinfo.llstContext = new LinkedList();
                this.strucContextinfo.llstContext.Clear();
                foreach (DataRow dr in this.mDTContextKey.Rows)
                {
                    string sContextKey = dr[COLUMN.CONTEXT_KEY].ToString();
                    string sValue      = this.bSpreadModelList.ActiveSheet.Cells[iRow, iCol++].Text;
                    if (!string.IsNullOrEmpty(sValue))
                    {
                        this.strucContextinfo.llstContext.Add(sContextKey, sValue);
                    }
                }

                this.strucContextinfo.llstCustomContext = new LinkedList();
                if (this.strucContextinfo.MAIN_YN.Equals("Y"))
                {
                    Control.ControlCollection ctrl = this.bTabControl1.TabPages[this.bTabControl1.TabPages.Count - 1].Controls;
                    BSpread _bSpread = null;
                    this.strucContextinfo.llstCustomContext.Clear();
                    for (int i = 0; i < this.strucContextinfo.llstContext.Count; i++)
                    {
                        string sKey         = this.strucContextinfo.llstContext.GetKey(i).ToString();
                        string sValue       = this.strucContextinfo.llstContext.GetValue(i).ToString();
                        string sControlName = "bSpreadContext_" + sKey;
                        string sCustomValue = string.Empty;
                        bool   bFlag        = false;

                        for (int j = 0; j < ctrl.Count; j++)
                        {
                            if (ctrl[j].Name == sControlName)
                            {
                                bFlag           = true;
                                _bSpread        = ctrl[j] as BSpread;
                                alCheckRowIndex = this._bspreadutility.GetCheckedRowIndex(_bSpread, 0);
                                for (int k = 0; k < alCheckRowIndex.Count; k++)
                                {
                                    sCustomValue += _bSpread.ActiveSheet.Cells[(int)alCheckRowIndex[k], 1].Text + ";";
                                }
                                if (!string.IsNullOrEmpty(sCustomValue))
                                {
                                    sCustomValue = sCustomValue.Substring(0, sCustomValue.Length - 1);
                                }
                                break;
                            }
                        }

                        if (bFlag)
                        {
                            if (!string.IsNullOrEmpty(sCustomValue))
                            {
                                //if (sCustomValue != sValue)
                                this.strucContextinfo.llstCustomContext.Add(sKey, sCustomValue);
                            }
                        }
                    }
                }
                this.ButtonResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
        private void bbtnOK_Click(object sender, EventArgs e)
        {
            ArrayList alTempContextKeys        = new ArrayList();
            ArrayList alTempContextValues      = new ArrayList();
            ArrayList alTempCheckContextValues = new ArrayList();

            int idx = this.bTabControl1.Controls.Count;

            for (int i = 0; i < this.bTabControl1.Controls.Count; i++)
            {
                TabPage tabPage = (TabPage)this.bTabControl1.Controls[i];
                BSpread bSpread = null;
                if (tabPage.Controls.Count > 1)
                {
                    bSpread = (BSpread)tabPage.Controls[tabPage.Controls.Count - 1];
                }
                else
                {
                    bSpread = (BSpread)tabPage.Controls[0];
                }



                alTempContextKeys.Add(bSpread.ActiveSheet.ColumnHeader.Cells[0, 1].Text);
                string strTemp = "";

                for (int k = 0; k < bSpread.ActiveSheet.RowCount; k++)
                {
                    if (bSpread.ActiveSheet.Cells[k, 0].CellType != null &&
                        bSpread.ActiveSheet.Cells[k, 0].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.CheckBoxCellType))
                    {
                        if (Convert.ToBoolean(bSpread.ActiveSheet.Cells[k, 0].Value))
                        {
                            if (k == 0)
                            {
                                strTemp = ";*";
                                break;
                            }
                            else
                            {
                                if (alTempCheckContextValues.Contains(bSpread.ActiveSheet.Cells[k, 1].Text))
                                {
                                    continue;
                                }
                                else
                                {
                                    strTemp += ";" + bSpread.ActiveSheet.Cells[k, 1].Text;
                                    alTempCheckContextValues.Add(bSpread.ActiveSheet.Cells[k, 1].Text);
                                }
                            }
                        }
                    }
                }
                if (strTemp.Length > 0)
                {
                    strTemp = strTemp.Substring(1);
                }

                alTempContextValues.Add(strTemp);
            }

            this._sSelectedContextKeys = alTempContextKeys;
            if (this._bContext)
            {
                this._sSelectedContextValues = alTempContextValues;
            }
            else
            {
                this._sSelectedExcludeValues = alTempContextValues;
            }

            this.DialogResult = DialogResult.OK;
        }
        private void InitializeBSpread(ref BSpread bSpread, string strContextKey)
        {
            if (this._arrLstDBContextKeys.Contains(strContextKey))
            {
                int idxTemp = this._arrLstDBContextKeys.IndexOf(strContextKey);

                string strTempTableName         = _dsContextKey.Tables[0].Rows[idxTemp]["TABLE_NAME"].ToString();
                string strTempColumnName        = _dsContextKey.Tables[0].Rows[idxTemp]["COLUMN_NAME"].ToString();
                string strTempDisplayColumnName = _dsContextKey.Tables[0].Rows[idxTemp]["DISPLAY_COLUMNS"].ToString();
                string strTempConditionName     = _dsContextKey.Tables[0].Rows[idxTemp]["WHERE_CONDITION"].ToString();
                string strTempConditionValue    = this._sLineRawID + "," + this._sAreaRawID + "," + this._sEQPModel;

                if (strTempDisplayColumnName.Trim().Length > 0)
                {
                    bSpread.ActiveSheet.ColumnCount = 2 + strTempDisplayColumnName.Split(',').Length;
                }
                else
                {
                    bSpread.ActiveSheet.ColumnCount = 2;
                }


                bSpread.ActiveSheet.Columns[0, bSpread.ActiveSheet.ColumnCount - 1].Locked = true;

                DataSet _dsTemp = this._wsSPC.GetSPCContextValueList(strTempTableName, strTempColumnName, strTempDisplayColumnName, strTempConditionName, strTempConditionValue);
                DataRow _drTemp = _dsTemp.Tables[0].NewRow();
                _drTemp[strTempColumnName] = "ALL(*)";
                _dsTemp.Tables[0].Rows.InsertAt(_drTemp, 0);

                if (bSpread.ActiveSheet.RowCount < _dsTemp.Tables[0].Rows.Count)
                {
                    bSpread.ActiveSheet.RowCount = _dsTemp.Tables[0].Rows.Count;
                }

                bSpread.ActiveSheet.ColumnHeader.Cells[0, 1].Text = strContextKey;
                bSpread.ActiveSheet.ColumnHeader.Cells[0, 0].Text = "SELECT";

                bSpread.ActiveSheet.Columns[1].DataField = _dsTemp.Tables[0].Columns[0].ColumnName;
                if (_dsTemp.Tables[0].Columns.Count > 1)
                {
                    for (int j = 1; j < _dsTemp.Tables[0].Columns.Count; j++)
                    {
                        bSpread.ActiveSheet.Columns[j + 1].DataField          = _dsTemp.Tables[0].Columns[j].ColumnName;
                        bSpread.ActiveSheet.ColumnHeader.Cells[0, j + 1].Text = _dsTemp.Tables[0].Columns[j].ColumnName;
                    }
                }
                bSpread.ActiveSheet.Cells[0, 0, _dsTemp.Tables[0].Rows.Count - 1, 0].CellType = ct;
                bSpread.ActiveSheet.Cells[0, 0, _dsTemp.Tables[0].Rows.Count - 1, 0].Locked   = false;

                bSpread.ActiveSheet.DataSource = _dsTemp;

                //기존에 선택되어 있던 value list가 있을 경우 binding한다. (* 일 경우 전체 선택한다.)
                int    idxTempKey          = this._sSelectedContextKeys.IndexOf(strContextKey);
                string strTempContextValue = "";
                if (this._bContext)
                {
                    strTempContextValue = this._sSelectedContextValues[idxTempKey].ToString();
                }
                else
                {
                    strTempContextValue = this._sSelectedExcludeValues[idxTempKey].ToString();
                }

                if (strTempContextValue == "*")
                {
                    bSpread.ActiveSheet.Cells[0, 0].Value = true;
                }
                else if (strTempContextValue.Length > 0)
                {
                    string[]  strArrTempContextValue = strTempContextValue.Split(';');
                    ArrayList alTempContextValue     = new ArrayList(strArrTempContextValue);
                    for (int k = 1; k < bSpread.ActiveSheet.RowCount; k++)
                    {
                        if (alTempContextValue.Contains(bSpread.ActiveSheet.Cells[k, 1].Text) &&
                            bSpread.ActiveSheet.Cells[k, 0].CellType != null &&
                            bSpread.ActiveSheet.Cells[k, 0].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.CheckBoxCellType))
                        {
                            bSpread.ActiveSheet.Cells[k, 0].Value = true;
                        }
                    }
                }

                for (int cIdx = 0; cIdx < bSpread.ActiveSheet.Columns.Count; cIdx++)
                {
                    if (cIdx == 0)
                    {
                        bSpread.ActiveSheet.Columns[cIdx].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
                    }
                    else
                    {
                        bSpread.ActiveSheet.Columns[cIdx].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
                    }
                }

                bSpread.ActiveSheet.Columns[0, bSpread.ActiveSheet.ColumnCount - 1].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;

                //int iWidth = 0;

                //for (int cIdx = 0; cIdx < bSpread.ActiveSheet.Columns.Count; cIdx++)
                //{
                //    bSpread.ActiveSheet.Columns[cIdx].Width = bSpread.ActiveSheet.Columns[cIdx].GetPreferredWidth();
                //    iWidth += Convert.ToInt32(bSpread.ActiveSheet.Columns[cIdx].GetPreferredWidth());
                //}

                //if (this.ContentsAreaMinWidth < iWidth)
                //{
                //    this.ContentsAreaMinWidth = iWidth + 100;
                //}

                //if (this.ContentsAreaMinWidth > 950)
                //{
                //    this.ContentsAreaMinWidth = 950;
                //}
            }
            else
            {
                bSpread.ActiveSheet.ColumnCount          = 2;
                bSpread.ActiveSheet.Columns[0, 1].Locked = true;
                bSpread.ActiveSheet.RowCount             = 1;

                bSpread.ActiveSheet.ColumnHeader.Cells[0, 1].Text = strContextKey;
                bSpread.ActiveSheet.ColumnHeader.Cells[0, 0].Text = "SELECT";

                bSpread.ActiveSheet.Cells[0, 0].CellType = ct;
                bSpread.ActiveSheet.Cells[0, 0].Locked   = false;

                bSpread.ActiveSheet.Cells[0, 1].Text = "ALL(*)";

                //기존에 선택되어 있던 value list가 있을 경우 binding한다. (* 일 경우 전체 선택한다.)
                int    idxTempKey          = this._sSelectedContextKeys.IndexOf(strContextKey);
                string strTempContextValue = "";
                if (this._bContext)
                {
                    strTempContextValue = this._sSelectedContextValues[idxTempKey].ToString();
                }
                else
                {
                    strTempContextValue = this._sSelectedExcludeValues[idxTempKey].ToString();
                }

                if (strTempContextValue == "*")
                {
                    bSpread.ActiveSheet.Cells[0, 0].Value = true;
                }
                else if (strTempContextValue.Length > 0)
                {
                    string[]  strArrTempContextValue = strTempContextValue.Split(';');
                    ArrayList alTempContextValue     = new ArrayList(strArrTempContextValue);
                    for (int k = 1; k < bSpread.ActiveSheet.RowCount; k++)
                    {
                        if (alTempContextValue.Contains(bSpread.ActiveSheet.Cells[k, 1].Text) &&
                            bSpread.ActiveSheet.Cells[k, 0].CellType != null &&
                            bSpread.ActiveSheet.Cells[k, 0].CellType.GetType() == typeof(FarPoint.Win.Spread.CellType.CheckBoxCellType))
                        {
                            bSpread.ActiveSheet.Cells[k, 0].Value = true;
                        }
                    }
                }

                for (int cIdx = 0; cIdx < bSpread.ActiveSheet.Columns.Count; cIdx++)
                {
                    if (cIdx == 0)
                    {
                        bSpread.ActiveSheet.Columns[cIdx].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
                    }
                    else
                    {
                        bSpread.ActiveSheet.Columns[cIdx].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
                    }
                }

                bSpread.ActiveSheet.Columns[0, bSpread.ActiveSheet.ColumnCount - 1].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;

                //int iWidth = 0;

                //for (int cIdx = 0; cIdx < bSpread.ActiveSheet.Columns.Count; cIdx++)
                //{
                //    bSpread.ActiveSheet.Columns[cIdx].Width = bSpread.ActiveSheet.Columns[cIdx].GetPreferredWidth();
                //    iWidth += Convert.ToInt32(bSpread.ActiveSheet.Columns[cIdx].GetPreferredWidth());
                //}

                //if (this.ContentsAreaMinWidth < iWidth)
                //{
                //    this.ContentsAreaMinWidth = iWidth + 100;
                //}

                //if (this.ContentsAreaMinWidth > 950)
                //{
                //    this.ContentsAreaMinWidth = 950;
                //}
            }
        }
Пример #13
0
        private void bSpread_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
        {
            BSpread bsprData = sender as BSpread;

            ///
            DataSet ds = (DataSet)bsprData.DataSource;

            if (ds.Tables[0].Columns.Contains(Definition.STEP_DATAMAPPING.BASE))
            {
                if (e.Column == (int)enumMultiDataConditionPopup.BASE && (bool)bsprData.GetCellValue(e.Row, (int)enumMultiDataConditionPopup.BASE) == true)
                {
                    for (int i = 0; i < bsprData.ActiveSheet.RowCount; i++)
                    {
                        if (i == e.Row)
                        {
                            continue;
                        }
                        bsprData.ActiveSheet.Cells[i, (int)enumMultiDataConditionPopup.BASE].Value = false;
                    }
                }
            }

            ///

            if (e.Column != (int)enumMultiDataConditionPopup.SELECT)
            {
                return;
            }

            if ((bool)bsprData.GetCellValue(e.Row, (int)enumMultiDataConditionPopup.SELECT) == true)
            {
                if (bsprData.Name == this.bSpreadStepMet.Name ||
                    (bsprData.Name == this.bSpreadItem.Name && !this.bProbe))
                {
                    for (int i = 0; i < bsprData.ActiveSheet.RowCount; i++)
                    {
                        if (i == e.Row)
                        {
                            continue;
                        }
                        bsprData.ActiveSheet.Cells[i, (int)enumMultiDataConditionPopup.SELECT].Value = 0;
                    }
                }

                ArrayList alCheckRowIndex = this._bspreadutility.GetCheckedRowIndex(bsprData, (int)enumMultiDataConditionPopup.SELECT);
                if (alCheckRowIndex.Count > 0)
                {
                    if (bsprData.Name == this.bSpreadStepMet.Name)
                    {
                        if (alCheckRowIndex.Count > 1)
                        {
                            MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("FDC_ALLOW_SINGLE_SELECTED_ROW"));
                            return;
                        }

                        this._sOperation     = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[0], 1].Text;
                        this._sOperationDesc = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[0], 2].Text;

                        this.PROC_BindItem();
                        //if(this.bProbe)
                        this.PROC_BindSubData();
                    }
                    else if (bsprData.Name == this.bSpreadItem.Name)
                    {
                        if (!this.bProbe)
                        {
                            if (alCheckRowIndex.Count > 1)
                            {
                                MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("FDC_ALLOW_SINGLE_SELECTED_ROW"));
                                return;
                            }

                            this._sParamItem = bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[0], 1].Text;
                            this.PROC_BindSubData();
                        }
                    }
                    else if (bsprData.Name == this.bSpreadSelect.Name)
                    {
                        //this.PROC_BindSubItem(this.SPC_PARAM_TYPE_EVS, bsprData.ActiveSheet.Cells[(int)alCheckRowIndex[0], 1].Text);
                    }
                }
            }
            else
            {
                if (bsprData.Name == this.bSpreadStepMet.Name)
                {
                    this._sOperation = string.Empty;
                    this.PROC_BindItem();
                }
            }
        }
        private void InitializeBTabControl()
        {
            for (int i = 0; i < this._sSelectedContextKeys.Count; i++)
            {
                TabPage tabPage = new TabPage(this._sSelectedContextKeys[i].ToString());
                BSpread bSpread = new BSpread();
                FarPoint.Win.Spread.SheetView bSpread_Sheet1 = new FarPoint.Win.Spread.SheetView();

                bSpread_Sheet1.Reset();
                bSpread_Sheet1.SheetName = "Sheet1";

                bSpread.About = "3.0.2005.2005";
                bSpread.AccessibleDescription = "";
                bSpread.AllowNewRow           = true;
                bSpread.AutoClipboard         = false;
                bSpread.AutoGenerateColumns   = false;
                bSpread.BssClass             = "";
                bSpread.ClickPos             = new System.Drawing.Point(0, 0);
                bSpread.ColFronzen           = 0;
                bSpread.ComboEnable          = true;
                bSpread.DataAutoHeadings     = false;
                bSpread.DataSet              = null;
                bSpread.DateToDateTimeFormat = false;
                bSpread.DefaultDeleteValue   = true;
                bSpread.DisplayColumnHeader  = true;
                bSpread.DisplayRowHeader     = true;
                bSpread.Dock                      = System.Windows.Forms.DockStyle.Fill;
                bSpread.EditModeReplace           = true;
                bSpread.FilterVisible             = false;
                bSpread.HeadHeight                = 20F;
                bSpread.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
                bSpread.IsCellCopy                = false;
                bSpread.IsMultiLanguage           = false;
                bSpread.IsReport                  = false;
                bSpread.Key           = "";
                bSpread.Location      = new System.Drawing.Point(3, 3);
                bSpread.Name          = "bSpread";
                bSpread.RowFronzen    = 0;
                bSpread.RowInsertType = BISTel.PeakPerformance.Client.BISTelControl.InsertType.Current;
                bSpread.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { bSpread_Sheet1 });
                bSpread.Size                    = new System.Drawing.Size(550, 283);
                bSpread.StyleID                 = null;
                bSpread.TabIndex                = 0;
                bSpread.UseAutoSort             = false;
                bSpread.UseCheckAll             = false;
                bSpread.UseCommandIcon          = false;
                bSpread.UseFilter               = false;
                bSpread.UseGeneralContextMenu   = false;
                bSpread.UseHeadColor            = false;
                bSpread.UseOriginalEvent        = false;
                bSpread.UseSpreadEdit           = true;
                bSpread.UseWidthMemory          = true;
                bSpread.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
                bSpread.WhenDeleteUseModify     = false;

                bSpread.ClearHead();
                bSpread.AddHeadComplete();
                bSpread.UseFilter           = false;
                bSpread.FilterVisible       = true;
                bSpread.UseSpreadEdit       = false;
                bSpread.AutoGenerateColumns = false;
                bSpread.IsMultiLanguage     = false;
                this.InitializeBSpread(ref bSpread, this._sSelectedContextKeys[i].ToString());
                bSpread.ButtonClicked += new FarPoint.Win.Spread.EditorNotifyEventHandler(bSpread_ButtonClicked);
                bSpread.Dock           = DockStyle.Fill;


                tabPage.Controls.Add(bSpread);

                this.bTabControl1.Controls.Add(tabPage);
            }
        }
Пример #15
0
 /// <summary>
 /// It restore cell values of spread using by backup data
 /// </summary>
 /// <param name="bspread">bspread which will be restored</param>
 /// <param name="rowIndex">start row index</param>
 /// <param name="columnIndex">start column index</param>
 /// <param name="backupData">back up object made by GetBackUpDataForPasting function</param>
 public void Rollback(BSpread bspread, int rowIndex, int columnIndex, object[,] backupData)
 {
     bspread.ActiveSheet.SetArray(rowIndex, columnIndex, backupData);
 }
Пример #16
0
 /// <summary>
 /// It returns cell values which can be used by Rollback function after pasting clipboard.
 /// </summary>
 /// <param name="bspread">bspread which will be back up</param>
 /// <param name="rowIndex">start row index</param>
 /// <param name="columnIndex">start column index</param>
 /// <returns>back up object</returns>
 public object[,] GetBackUpDataForPasting(BSpread bspread, int rowIndex, int columnIndex)
 {
     int[] range = GetCellRangeOfClipboard();
     return(bspread.ActiveSheet.GetArray(rowIndex, columnIndex, range[0],
                                         range[1]));
 }
Пример #17
0
        private void InitializeBSpreadContxt(string sName, DataTable _dt)
        {
            bool bDesc = false;

            bSpreadContext_Sheet1 = new FarPoint.Win.Spread.SheetView();
            bSpreadContext_Sheet1.Reset();
            bSpreadContext_Sheet1.SheetName = "Sheet1";

            bSpreadContext      = new BSpread();
            bSpreadContext.Name = "bSpreadContext_" + sName;
            bSpreadContext.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { bSpreadContext_Sheet1 });
            bSpreadContext.UseSpreadEdit       = false;
            bSpreadContext.AutoGenerateColumns = false;
            bSpreadContext.ActiveSheet.DefaultStyle.ResetLocked();
            bSpreadContext.UseEdit = true;
            bSpreadContext.ClearHead();
            bSpreadContext.Locked                    = true;
            bSpreadContext.UseHeadColor              = true;
            bSpreadContext.EditMode                  = false;
            bSpreadContext.ActiveSheet.RowCount      = 0;
            bSpreadContext.ActiveSheet.ColumnCount   = 0;
            bSpreadContext.VerticalScrollBarPolicy   = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
            bSpreadContext.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
            bSpreadContext.ButtonClicked            += new FarPoint.Win.Spread.EditorNotifyEventHandler(bSpreadContext_ButtonClicked);

            bSpreadContext.DataSource = null;
            bSpreadContext.ClearHead();

            //SPC-777 Louis ContextMenu 삭제;
            bSpreadContext.UseGeneralContextMenu = false;

            //if (sName == Definition.CHART_COLUMN.OPERATION_ID || sName == Definition.CHART_COLUMN.MEASURE_OPERATION_ID) bDesc = true;

            //if (bDesc)
            //{
            //    bSpreadContext.ActiveSheet.ColumnCount = 3;
            //    bSpreadContext.Width = 300;
            //}
            //else
            //{
            //    bSpreadContext.ActiveSheet.ColumnCount = 2;
            //    bSpreadContext.Width = 180;
            //}

            bSpreadContext.AddHead((int)SPCChartConditionContext.SELECT, this._mlthandler.GetVariable(Definition.SpreadHeaderColKey.V_SELECT), COLUMN.SELECT, 40, 20, null, null, null, ColumnAttribute.Null, ColumnType.CheckBox, null, null, null, false, true);
            bSpreadContext.AddHead(1, sName, COLUMN.CONTEXT_VALUE, 80, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);

            if (bDesc)
            {
                bSpreadContext.AddHead(2, COLUMN.DESCRIPTION, COLUMN.DESCRIPTION, 120, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);
            }

            bSpreadContext.DataSource = _dt;

            this.bSpreadContext.Width = 40;

            for (int i = 0; i < bSpreadContext.ActiveSheet.Columns.Count; i++)
            {
                float _fSpreadWidth = bSpreadContext.ActiveSheet.Columns[i].GetPreferredWidth();
                this.bSpreadContext.ActiveSheet.Columns[i].Width = _fSpreadWidth;
                this.bSpreadContext.Width += (int)_fSpreadWidth;
            }
        }