Exemplo n.º 1
0
        public FrmAdvanceQuery(UserInfo pUserInfoModel, AdvanceQueryInfo pTabMaster, List <AdvanceQueryInfo> pTabDetailList)
        {
            InitializeComponent();
            tabMaster     = pTabMaster;
            tabDetailList = pTabDetailList;


            this.LoginInfo = pUserInfoModel;
        }
Exemplo n.º 2
0
        private bool WfIniDataSource(AdvanceQueryInfo pAdvQueryInfo)
        {
            UltraGrid uGrid;

            try
            {
                uGrid = pAdvQueryInfo.UGrid;

                if (GlobalFn.varIsNull(pAdvQueryInfo.Key))
                {
                    WfShowErrorMsg("此查詢代碼,請檢核");
                    return(false);
                }
                var masterAzaList = BoMaster.OfGetAzaModels(pAdvQueryInfo.Key)
                                    .Where(p => p.aza05.ToUpper() == "Y")
                                    .ToList();
                if (masterAzaList == null)
                {
                    WfShowErrorMsg("無此查詢代碼,請檢核");
                    return(false);
                }
                else
                {
                    pAdvQueryInfo.ConditionList = new List <ConditionInfo>();
                    var detailAzaList = BoMaster.OfGetAzaModels(pAdvQueryInfo.Key)
                                        .Where(p => p.aza05.ToUpper() == "Y")
                                        .ToList();
                    foreach (aza_tb azaModel in detailAzaList)
                    {
                        pAdvQueryInfo.ConditionList.Add(new ConditionInfo()
                        {
                            TableName  = azaModel.aza01,
                            Condition  = "",
                            ColumnName = azaModel.aza03,
                            ColumnDesc = azaModel.aza04,
                            ColumnType = azaModel.aza08,
                            Value      = null,
                            orderSeq   = azaModel.aza06
                        }
                                                        );
                    }
                }
                //初始化主檔GRID
                uGrid.DataSource = new List <ConditionInfo>();
                uGrid.DataBind();
                WfSetGridHeader(uGrid);
                WfSetAppearance(uGrid);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(true);
        }
Exemplo n.º 3
0
        private void WfAdd(AdvanceQueryInfo pAdvQueryInfo)
        {
            UltraGrid uGrid;

            try
            {
                //lugrid = uGridMaster;
                uGrid = pAdvQueryInfo.UGrid;
                var addConditionInfo = new ConditionInfo();
                var idMax            = (from o in (uGrid.DataSource as List <ConditionInfo>)
                                        orderby o.id descending
                                        select o.id
                                        ).FirstOrDefault()
                ;

                addConditionInfo.id         = idMax + 1;
                addConditionInfo.TableName  = pAdvQueryInfo.ConditionList.FirstOrDefault().TableName;
                addConditionInfo.ColumnName = pAdvQueryInfo.UComboColumn.Value.ToString();
                addConditionInfo.ColumnDesc = pAdvQueryInfo.UComboColumn.Text;
                addConditionInfo.Condition  = pAdvQueryInfo.UComboCondition.Value.ToString();
                addConditionInfo.Value      = pAdvQueryInfo.UTextValue.Value;
                addConditionInfo.ColumnType = "";
                if (pAdvQueryInfo.RadioAnd.Checked == true)
                {
                    addConditionInfo.AndOr = "AND";
                }
                else
                {
                    addConditionInfo.AndOr = "OR";
                }

                (uGrid.DataSource as List <ConditionInfo>).Add(addConditionInfo);
                uGrid.DataBind();
                //直接定位在最後一列

                // 檢查要設定的 active 的 row 編號不可大於全部可見的 row 筆數
                if (uGrid.Rows.VisibleRowCount > 0)
                {
                    //lugrid.ActiveRow = lugrid.Rows.GetRowAtVisibleIndex(lugrid.Rows.VisibleRowCount - 1);
                    uGrid.ActiveRow = uGrid.Rows.GetRowWithListIndex(uGrid.Rows.VisibleRowCount - 1);
                }
                pAdvQueryInfo.UTextValue.Value = "";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        private bool WfBindingDataSource(AdvanceQueryInfo pAdvQueryInfo)
        {
            UltraGridColumn ugc;
            List <KeyValuePair <string, string> > columnList;
            List <KeyValuePair <string, string> > conditionList;
            List <KeyValuePair <string, string> > andOrList;

            try
            {
                columnList = new List <KeyValuePair <string, string> >();
                foreach (ConditionInfo conditionInfo in pAdvQueryInfo.ConditionList.OrderBy(p => p.orderSeq))
                {
                    columnList.Add(new KeyValuePair <string, string>(
                                       conditionInfo.ColumnName,
                                       conditionInfo.ColumnDesc
                                       ));
                }
                conditionList = WfGetConditionList();
                andOrList     = WfGetAndOrList();

                WfSetUcomboxDataSource(pAdvQueryInfo.UComboColumn, columnList);

                WfSetUcomboxDataSource(pAdvQueryInfo.UComboCondition, conditionList);
                //pAdvQueryInfo.UComboCondition.DropDownWidth = 80;
                pAdvQueryInfo.UComboCondition.DisplayLayout.Bands[0].Columns[1].Width  = 80;
                pAdvQueryInfo.UComboCondition.DisplayLayout.Bands[0].Columns[0].Hidden = true;
                pAdvQueryInfo.UComboCondition.PerformAction(UltraComboAction.FirstRow);

                #region Grid column binding
                ugc = pAdvQueryInfo.UGrid.DisplayLayout.Bands[0].Columns["condition"];
                WfSetGridValueList(ugc, conditionList);
                (ugc.ValueList as UltraDropDown).DisplayLayout.Bands[0].Columns[0].Hidden = true;
                (ugc.ValueList as UltraDropDown).DropDownWidth = 100;

                ugc = pAdvQueryInfo.UGrid.DisplayLayout.Bands[0].Columns["AndOr"];
                WfSetGridValueList(ugc, andOrList);
                (ugc.ValueList as UltraDropDown).DisplayLayout.Bands[0].Columns[0].Hidden = true;
                (ugc.ValueList as UltraDropDown).DropDownWidth = 100;
                #endregion
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
 private void WfCleanAll(AdvanceQueryInfo pAdvQueryInfo)
 {
     (pAdvQueryInfo.UGrid.DataSource as List <ConditionInfo>).Clear();
     pAdvQueryInfo.UGrid.DataBind();
 }
Exemplo n.º 6
0
        private bool WfIniTabPageUI(UltraTab pUTab, AdvanceQueryInfo pTabInfo)
        {
            Panel           panel;
            UltraGroupBox   UGroupBox;
            RadioButton     RadioAnd;
            RadioButton     RadioOr;
            UltraCombo      UComboColumn;
            UltraCombo      UComboCondition;
            UltraTextEditor UTextValue;
            UltraGrid       UGrid;

            try
            {
                //var pUTab = uTabControl.Tabs.Add("11");
                //pUTab.Text = "測試";
                panel        = new Panel();
                panel.Height = 100;
                panel.Dock   = DockStyle.Top;

                UGroupBox          = new UltraGroupBox();
                UGroupBox.Size     = new Size(160, 45);
                UGroupBox.Location = new Point(15, 10);
                UGroupBox.Text     = "且/或";
                if (GetStyleLibrary.FontControlNormal != null)
                {
                    UGroupBox.Font = GetStyleLibrary.FontControlNormal;
                }

                RadioAnd          = new RadioButton();
                RadioAnd.Checked  = true;
                RadioAnd.Size     = new Size(60, 20);
                RadioAnd.Location = new Point(20, 18);
                RadioAnd.Text     = "AND";
                if (GetStyleLibrary.FontControlNormal != null)
                {
                    RadioAnd.Font = GetStyleLibrary.FontControlNormal;
                }
                UGroupBox.Controls.Add(RadioAnd);

                RadioOr          = new RadioButton();
                RadioOr.Checked  = false;
                RadioOr.Size     = new Size(60, 20);
                RadioOr.Location = new Point(80, 18);
                RadioOr.Text     = "OR";
                if (GetStyleLibrary.FontControlNormal != null)
                {
                    RadioOr.Font = GetStyleLibrary.FontControlNormal;
                }
                UGroupBox.Controls.Add(RadioOr);
                panel.Controls.Add(UGroupBox);

                UComboColumn          = new UltraCombo();
                UComboColumn.Size     = new Size(160, 22);
                UComboColumn.Location = new Point(20, 60);
                if (GetStyleLibrary.FontControlNormal != null)
                {
                    UComboColumn.Font = GetStyleLibrary.FontControlNormal;
                }
                panel.Controls.Add(UComboColumn);

                UComboCondition          = new UltraCombo();
                UComboCondition.Size     = new Size(80, 22);
                UComboCondition.Location = new Point(190, 60);
                if (GetStyleLibrary.FontControlNormal != null)
                {
                    UComboCondition.Font = GetStyleLibrary.FontControlNormal;
                }
                panel.Controls.Add(UComboCondition);

                UTextValue          = new UltraTextEditor();
                UTextValue.Size     = new Size(260, 22);
                UTextValue.Location = new Point(280, 60);
                if (GetStyleLibrary.FontControlNormal != null)
                {
                    UTextValue.Font = GetStyleLibrary.FontControlNormal;
                }
                panel.Controls.Add(UTextValue);

                UGrid      = new UltraGrid();
                UGrid.Dock = DockStyle.Fill;

                pUTab.TabPage.Controls.Add(UGrid);
                pUTab.TabPage.Controls.Add(panel);

                //ref 到tab
                pTabInfo.UGroupBox       = UGroupBox;
                pTabInfo.RadioAnd        = RadioAnd;
                pTabInfo.RadioOr         = RadioOr;
                pTabInfo.UComboColumn    = UComboColumn;
                pTabInfo.UComboCondition = UComboCondition;
                pTabInfo.UTextValue      = UTextValue;
                pTabInfo.UGrid           = UGrid;

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }