コード例 #1
0
ファイル: frmNavQuery.cs プロジェクト: san90279/UK_OAS
        public frmNavQuery(QueryFieldCollection queryfields, InfoBindingSource bs, InfoNavigator nav)
        {
            //language = CliSysMegLag.GetClientLanguage();
            language = CliUtils.fClientLang;
            queryFields = queryfields;

            if (queryfields == null || queryfields.Count == 0)
            {
                DataColumnCollection dcc = ((InfoDataSet)bs.GetDataSource()).RealDataSet.Tables[bs.DataMember].Columns;
                colNum = dcc.Count;
                colName = new string[colNum];
                for (int j = 0; j < colNum; j++)
                {
                    colName[j] = dcc[j].ColumnName;
                }
            }
            else
            {
                colNum = queryfields.Count;
                colName = new string[colNum];
                for (int j = 0; j < colNum; j++)
                {
                    colName[j] = queryfields[j].FieldName;
                }
            }
            bSource = bs;
            infoNavigator = nav;
            InitializeComponent();
            InitializeQueryConditionItem();
        }
コード例 #2
0
ファイル: InfoNavigator.cs プロジェクト: san90279/UK_OAS
        protected virtual void DoViewQuery()
        {
            // (3 : 1 of 2) 在Query時: SetState(Querying);
            this.SetState("Querying");
            //string strQueryFields = _QueryFields;
            InfoBindingSource bSource = new InfoBindingSource();
            if (this.ViewBindingSource != null)
            {
                bSource = this.ViewBindingSource;
            }
            else if (this.BindingSource != null && this.ViewBindingSource == null)
            {
                bSource = this.BindingSource;
            }
            this.Focus();

            if (this.QueryMode == QueryModeType.Normal)
            {
                Form frmNavQuery = new frmNavQuery(this.QueryFields, bSource, this);
                frmNavQuery.ShowDialog();
            }
            else if (this.QueryMode == QueryModeType.ClientQuery)
            {
                if (this.QueryFields.Count > 0)
                {
                    if (cqform == null)
                    {
                        cqform = CopyQueryFileds(1);
                    }
                    string strwhere = string.Empty;
                    try
                    {
                        strwhere = cqform.Execute(false);
                        NavigatorQueryWhereEventArgs args = new NavigatorQueryWhereEventArgs(strwhere);
                        OnQueryWhere(args);
                        if (!args.Cancel)
                        {
                            strwhere = args.WhereString;
                            if (strwhere != null)
                            {
                                if (this.StatusStrip != null && this.StatusStrip.ShowProgress)
                                {
                                    this.StatusStrip.ShowProgressBar();
                                }
                                ((InfoDataSet)bSource.GetDataSource()).SetWhere(strwhere);
                                if (this.StatusStrip != null && this.StatusStrip.ShowProgress)
                                {
                                    this.StatusStrip.HideProgressBar();
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message);
                    }
                }
                else
                {
                    Form frmNavQuery = new frmNavQuery(this.QueryFields, bSource, this);
                    frmNavQuery.ShowDialog();
                }
            }
            else if (this.QueryMode == QueryModeType.AnyQuery)
            {
                if (aq == null)
                    aq = CopyAnyQueryFileds();
                String strwhere = aq.Execute(this, false);
                NavigatorQueryWhereEventArgs args = new NavigatorQueryWhereEventArgs(strwhere);
                OnQueryWhere(args);
                args.Cancel = !this.QuerySQLSend;

                if (!args.Cancel)
                {
                    strwhere = args.WhereString;
                    if (strwhere != null)
                    {
                        if (this.StatusStrip != null && this.StatusStrip.ShowProgress)
                        {
                            this.StatusStrip.ShowProgressBar();
                        }
                        ((InfoDataSet)bSource.GetDataSource()).SetWhere(strwhere);
                        if (this.StatusStrip != null && this.StatusStrip.ShowProgress)
                        {
                            this.StatusStrip.HideProgressBar();
                        }
                    }
                }
            }

            // (3 : 2 of 2) Query後: SetState(Browsed).
            this.SetState("Browsed");
        }