Example #1
0
        private void bbtnButtonList_ButtonClick(string name)
        {
            if (this._tnCheckedComboNode != null && this._tnCheckedComboNode.Checked)
            {
                if (name == Definition.BUTTON_KEY_ADD)
                {
                    bsprGroupList.ContextMenuAction(name);
                    bsprGroupList.ActiveSheet.Cells[bsprGroupList.ActiveSheet.ActiveRowIndex, 3].Locked = true;

                    this.bsprGroupList_LeaveCell(this.bsprGroupList, new FarPoint.Win.Spread.LeaveCellEventArgs(this.bsprGroupList.ActiveSheet.ContainingViews[0], this.bsprGroupList.ActiveSheet.ParentRowIndex,
                                                                                                                this.bsprGroupList.ActiveSheet.ActiveColumnIndex, this.bsprGroupList.ActiveSheet.ActiveRowIndex, this.bsprGroupList.ActiveSheet.ActiveColumnIndex));

                    //DataRow row = this._dtGroup.NewRow();
                    //this._dtGroup.Rows.Add(row);
                }

                else if (name == Definition.BUTTON_KEY_SAVE)
                {
                    if (bsprGroupList.ActiveSheet.Rows.Count > 0)
                    {
                        bool bGroupName = ValidationGroupName();

                        if (!bGroupName)
                        {
                            return;
                        }

                        DataSet   dsSave   = bsprGroupList.GetSaveData();
                        DataTable dtModify = FindModifyGroupList();

                        if (dtModify != null && dtModify.Rows.Count > 0)
                        {
                            dsSave.Tables.Add(dtModify);
                        }

                        if (dsSave.Tables.Count > 0)
                        {
                            bool bcheckDuplicate = CheckGroupName(dsSave);

                            if (bcheckDuplicate)
                            {
                                LinkedList llParam = new LinkedList();
                                DataRow[]  dr      = _dsGroupList.Tables["SPC_MODEL_LEVEL"].Select(string.Format("GROUP_LEVEL = '{0}'", sLevelValue));

                                if (dr.Length > 0)
                                {
                                    llParam.Add(COLUMN.LOCATION_RAWID, sLocationRawID);
                                    llParam.Add(COLUMN.AREA_RAWID, sAreaRawID);
                                    llParam.Add(COLUMN.EQP_MODEL, sEQPModel);
                                    llParam.Add(COLUMN.USER_ID, _SessionData.UserId);

                                    if (_isMET)
                                    {
                                        llParam.Add(Definition.CONDITION_KEY_PARAM_TYPE_CD, "MET");
                                    }
                                    else
                                    {
                                        llParam.Add(Definition.CONDITION_KEY_PARAM_TYPE_CD, "TRS");
                                    }
                                }

                                EESProgressBar.ShowProgress(this, this._mlthandler.GetMessage(Definition.MSG_KEY_INFO_SAVING_DATA), true);

                                bool bResult = _wsSPC.SaveSPCGroupList(dsSave, llParam.GetSerialData());

                                EESProgressBar.CloseProgress(this);

                                if (!bResult)
                                {
                                    MSGHandler.DisplayMessage(MSGType.Information, MSGHandler.GetMessage(Definition.GENERAL_SAVE_FAIL));
                                    return;
                                }
                                else
                                {
                                    MSGHandler.DisplayMessage(MSGType.Information, MSGHandler.GetMessage(Definition.GENERAL_SAVE_SUCCESS));

                                    EESProgressBar.ShowProgress(this, this._mlthandler.GetMessage(Definition.LOADING_DATA), true);

                                    this._dsGroupList = _wsSPC.GetSPCModelGroupList(this._isMET);

                                    EESProgressBar.CloseProgress(this);
                                    this.SetData();
                                    this.bComboGroupList_SelectedIndexChanged(bComboGroupList, new EventArgs());
                                }
                            }
                        }
                        else
                        {
                            MSGHandler.DisplayMessage(MSGType.Information, MSGHandler.GetMessage(Definition.MSG_KEY_NO_CHANGE_DATA));
                            this.bsprGroupList.DataSource = this._dtGroup;
                            return;
                        }
                    }
                }
            }
        }