Exemple #1
0
        public override void PageSearch(LinkedList llCondition)
        {
            if (llCondition[Definition.DynamicCondition_Search_key.SPCMODEL] == null ||
                ((DataTable)llCondition[Definition.DynamicCondition_Search_key.SPCMODEL]).Rows.Count == 0)
            {
                InitializePage();
                return;
            }

            DataTable     spcmodels   = (DataTable)llCondition[Definition.DynamicCondition_Search_key.SPCMODEL];
            List <string> modelRawids = new List <string>();

            foreach (DataRow dr in spcmodels.Rows)
            {
                modelRawids.Add(dr[Definition.CONDITION_SEARCH_KEY_VALUEDATA].ToString());
            }

            DataSet ds = this.controller.GetModelData(modelRawids.ToArray());

            if (DSUtil.GetResultInt(ds) != 0)
            {
                MSGHandler.DisplayMessage(MSGType.Error, DSUtil.GetResultMsg(ds));
                InitializePage();
                return;
            }

            BindingSpread();
        }
Exemple #2
0
        public override void PageSearch(LinkedList llCondition)
        {
            try
            {
                if (llCondition[Definition.DynamicCondition_Search_key.SPCMODEL] == null ||
                    ((DataTable)llCondition[Definition.DynamicCondition_Search_key.SPCMODEL]).Rows.Count == 0)
                {
                    InitializePage();
                    return;
                }

                lastestCondition = llCondition;

                DataTable     spcmodels   = (DataTable)llCondition[Definition.DynamicCondition_Search_key.SPCMODEL];
                List <string> modelRawids = new List <string>();
                foreach (DataRow dr in spcmodels.Rows)
                {
                    modelRawids.Add(dr[Definition.CONDITION_SEARCH_KEY_VALUEDATA].ToString());
                }

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

                AsyncCallHandler ach = new AsyncCallHandler(EESProgressBar.AsyncCallManager);

                object objDataSet = ach.SendWait(_ws, "GetATTSPCModelsData", new object[] { modelRawids.ToArray(), _bUseComma });

                EESProgressBar.CloseProgress(this);

                if (objDataSet != null)
                {
                    _ds = (DataSet)objDataSet;
                }
                else
                {
                    MSGHandler.DisplayMessage(MSGType.Warning, MSGHandler.GetMessage("INFORMATION_NODATA"));
                    return;
                }

                EESProgressBar.ShowProgress(this, MSGHandler.GetMessage("PROCESS_LOADING_PAGE_DATA"), false);

                spcModels = new Dictionary <string, BISTel.eSPC.Page.Common.SPCModel>();

                foreach (DataRow dr in _ds.Tables[BISTel.eSPC.Common.TABLE.MODEL_ATT_MST_SPC].Rows)
                {
                    BISTel.eSPC.Page.Common.SPCModel spcModel = new BISTel.eSPC.Page.Common.SPCModel
                    {
                        SPCModelRawID = dr[BISTel.eSPC.Common.COLUMN.RAWID].ToString(),
                        SPCModelName  = dr[BISTel.eSPC.Common.COLUMN.SPC_MODEL_NAME].ToString(),
                    };
                    spcModels.Add(spcModel.SPCModelRawID, spcModel);
                }

                foreach (var kvp in spcModels)
                {
                    DataRow[] drs = _ds.Tables[BISTel.eSPC.Common.TABLE.MODEL_CONFIG_ATT_MST_SPC].Select(BISTel.eSPC.Common.COLUMN.MODEL_RAWID + " = '" + kvp.Key + "'");
                    if (drs.Length == 0)
                    {
                        continue;
                    }

                    kvp.Value.SubModels = new List <BISTel.eSPC.Page.Common.SPCModel>();

                    foreach (DataRow dr in drs)
                    {
                        if (dr[BISTel.eSPC.Common.COLUMN.MAIN_YN].ToString().ToUpper() == "Y")
                        {
                            kvp.Value.ChartID     = dr[BISTel.eSPC.Common.COLUMN.RAWID].ToString();
                            kvp.Value.Version     = dr[BISTel.eSPC.Common.COLUMN.VERSION].ToString();
                            kvp.Value.IsMainModel = true;
                            continue;
                        }

                        BISTel.eSPC.Page.Common.SPCModel spcModel = new BISTel.eSPC.Page.Common.SPCModel
                        {
                            ChartID       = dr[BISTel.eSPC.Common.COLUMN.RAWID].ToString(),
                            SPCModelRawID = kvp.Value.SPCModelRawID,
                            SPCModelName  = kvp.Value.SPCModelName,
                            Version       = dr[BISTel.eSPC.Common.COLUMN.VERSION].ToString(),
                            IsMainModel   = false,
                            ParamType     = kvp.Value.ParamType
                        };
                        kvp.Value.SubModels.Add(spcModel);
                    }
                }


                if (DSUtil.GetResultInt(_ds) != 0)
                {
                    MSGHandler.DisplayMessage(MSGType.Error, DSUtil.GetResultMsg(_ds));
                    InitializePage();
                    return;
                }

                BindingSpread();
            }
            catch (Exception ex)
            {
                EESProgressBar.CloseProgress(this);
                if (ex is OperationCanceledException || ex is TimeoutException)
                {
                    MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true);
                }
                else
                {
                    LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
                    MSGHandler.DisplayMessage(MSGType.Error, ex.Message, null, null, true);
                }
                LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, ex);
            }
            finally
            {
                EESProgressBar.CloseProgress(this);
            }
        }