コード例 #1
0
        public ArrayList LoadConditionList(Objects.Condition[] cs)
        {
            List <Interfaces.INeedTranslatedValue> iNeedTranslatedValueList = new List <QuickReportCore.Interfaces.INeedTranslatedValue>();
            List <Interfaces.INeedQuery>           iNeedQueryList           = new List <QuickReportCore.Interfaces.INeedQuery>();

            conditions             = cs;
            ucShouldShowList       = new ucReportCondition[conditions.Length];
            conditionValueProvidor = new Hashtable();
            for (int i = 0; i < conditions.Length; i++)
            {
                Objects.Condition c  = conditions[i];
                ucReportCondition uc = new ucReportCondition();
                uc.EnterCondition += new ucReportCondition.EnterConditionHandle(uc_EnterCondition);
                uc.Condition       = c;
                uc.TabIndex        = i;
                if (uc.EditControl is QuickReportCore.Interfaces.INeedTranslatedValue)
                {
                    iNeedTranslatedValueList.Add(uc.EditControl as QuickReportCore.Interfaces.INeedTranslatedValue);
                }
                if (uc.EditControl is QuickReportCore.Interfaces.INeedQuery)
                {
                    iNeedQueryList.Add(uc.EditControl as QuickReportCore.Interfaces.INeedQuery);
                }
                ucShouldShowList[i] = uc;
                conditionValueProvidor.Add(Managers.Functions.GetSQLCode(c.ID, QuickReportCore.Managers.Functions.SQLCodeType.Condition), uc);
            }
            ArrayList al = new ArrayList();

            al.Add(iNeedTranslatedValueList);
            al.Add(iNeedQueryList);
            return(al);
        }
コード例 #2
0
        private void LoadCondition(Objects.Condition condition)
        {
            if (condition.ConditionType.ID.Trim() == string.Empty)
            {
                return;
            }
            lbConditionName.Text = condition.Name;
            QuickReportCore.Objects.Condition.InputValueType inputType = (QuickReportCore.Objects.Condition.InputValueType)Enum.Parse(typeof(QuickReportCore.Objects.Condition.InputValueType), Condition.ConditionType.ID);
            IConditionValueUserControl = System.Activator.CreateInstance(QuickReportCore.Forms.frmConditionSetting.htIConditionValueUserControlList[inputType] as Type) as Interfaces.IConditionValue;
            IConditionValueUserControl.InitValue(condition);
            editControl = IConditionValueUserControl.EditControl;
            pnlReportCondition.Controls.Add(editControl);
            int x      = lbConditionName.Location.X + lbConditionName.Width;
            int y      = lbConditionName.Location.Y + controlYoffset;
            int width  = cmbOperator.Width;
            int height = cmbOperator.Height;

            if (IConditionValueUserControl.HideOperator)
            {
                width = 0;
                cmbOperator.Visible = false;
            }
            cmbOperator.SetBounds(x, y, width, height);
            x      = cmbOperator.Location.X + cmbOperator.Width + 5;
            y      = lbConditionName.Location.Y + controlYoffset + 1;
            width  = editControl.Width;
            height = editControl.Height;
            if (editControl is ComboBox)
            {
                editControl.SetBounds(x, y - 1, width, height);
            }
            else
            {
                editControl.SetBounds(x, y, width, height);
            }
            andOrUnShowSize = new Size(editControl.Location.X + editControl.Width + 10, Height);
            x      = editControl.Location.X + editControl.Width + 12;
            y      = lbConditionName.Location.Y + controlYoffset;
            width  = cmbAndOr.Width;
            height = cmbAndOr.Height;
            cmbAndOr.SetBounds(x, y, width, height);
            Size          = new Size(cmbAndOr.Location.X + cmbAndOr.Width + 10, Height);
            andOrShowSize = Size;
            InitOperators(IConditionValueUserControl.Operators);
            cmbOperator.Text = IConditionValueUserControl.DefaultOperator;
            if (cmbOperator.Visible)
            {
                cmbOperator.TabIndex = 0;
                editControl.TabIndex = 1;
                cmbAndOr.TabIndex    = 2;
            }
            else
            {
                editControl.TabIndex = 0;
                cmbAndOr.TabIndex    = 1;
            }
        }
コード例 #3
0
        public int ShowConditions(List <QuickReportCore.Objects.Condition> list)
        {
            pnlConditions.SuspendLayout();
            GobalConditionList = new List <QuickReportCore.Objects.Condition>();
            Hashtable newUcConditionControls = new Hashtable();
            int       timer = 0;

            for (int i = 0; i < list.Count; i++)
            {
                if (!ucConditionObjectControls.Contains(list[i].ID))
                {
                    ucConditionObject uc = new ucConditionObject();
                    uc.ActivateOn           += new ucConditionObject.ActivateHandle(uc_ActivateOn);
                    uc.ConditionShowChanged += new ucConditionObject.ConditionShowChangedHandle(uc_ConditionShowChanged);
                    uc.Condition             = list[i];
                    uc.Condition.SortId      = timer;
                    uc.InitFormConditionEditor(f);
                    timer++;
                    ucConditionObjectControls.Add(list[i].ID, uc);
                    newUcConditionControls.Add(list[i].ID, uc);
                }
                else
                {
                    if (!newUcConditionControls.Contains(list[i].ID))
                    {
                        Objects.Condition tempCondition = (ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition.Clone();
                        tempCondition.Name   = list[i].Name;
                        tempCondition.SortId = timer;
                        (ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition = tempCondition;
                        timer++;
                        newUcConditionControls.Add(list[i].ID, ucConditionObjectControls[list[i].ID]);
                    }
                }
                if ((ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition.Use)
                {
                    GobalConditionList.Add((ucConditionObjectControls[list[i].ID] as ucConditionObject).Condition);
                }
            }
            ucConditionObjectControls = newUcConditionControls;
            pnlConditions.Controls.Clear();
            foreach (DictionaryEntry de in ucConditionObjectControls)
            {
                pnlConditions.Controls.Add(de.Value as Control);
                int i = (de.Value as ucConditionObject).Condition.SortId;
                if (i == 0)
                {
                    (de.Value as ucConditionObject).Location = new Point(leftMargin, topMargin);
                }
                else
                {
                    (de.Value as ucConditionObject).Location = new Point(leftMargin, topMargin + (ucConditionObjectControls[list[i].ID] as ucConditionObject).Height * i + eatchMargin * i);
                }
            }
            pnlConditions.ResumeLayout();
            return(1);
        }
コード例 #4
0
        private ToolStripMenuItem NewToolStripMenuItemOfCondition(Objects.Condition condition)
        {
            ToolStripMenuItem t = new ToolStripMenuItem();

            condition.ID = Managers.Functions.GetSQLCode(condition.ID, QuickReportCore.Managers.Functions.SQLCodeType.Condition);
            t.Name       = condition.ID;
            t.Text       = condition.Name;
            t.Tag        = condition;
            return(t);
        }
コード例 #5
0
        public void MoveObject(MoveOrder order)
        {
            if (ucConditionObjectActivated == null)
            {
                return;
            }
            Objects.Condition tempCondition = ucConditionObjectActivated.Condition.Clone();
            Point             tempLocation  = ucConditionObjectActivated.Location;
            ucConditionObject tempUc        = null;

            if (order == MoveOrder.Up)
            {
                if (ucConditionObjectActivated.Condition.SortId == 0)
                {
                    return;
                }
                tempUc = FindUcByConditionSortID(ucConditionObjectActivated.Condition.SortId - 1);
                ucConditionObjectActivated.Location = tempUc.Location;
                tempUc.Location = tempLocation;
                ucConditionObjectActivated.Condition.SortId -= 1;
                tempUc.Condition.SortId += 1;
            }
            else if (order == MoveOrder.Down)
            {
                if (ucConditionObjectActivated.Condition.SortId == ucConditionObjectControls.Count - 1)
                {
                    return;
                }
                tempUc = FindUcByConditionSortID(ucConditionObjectActivated.Condition.SortId + 1);
                ucConditionObjectActivated.Location = tempUc.Location;
                tempUc.Location = tempLocation;
                ucConditionObjectActivated.Condition.SortId += 1;
                tempUc.Condition.SortId -= 1;
            }
            if (tempUc == null)
            {
                return;
            }
            pnlConditions.ScrollControlIntoView(ucConditionObjectActivated);
            if (HaveBeenChanged != null)
            {
                HaveBeenChanged(this, null);
            }
        }
コード例 #6
0
        private void Save()
        {
            Hashtable htColumnsShowsNew = new Hashtable();

            for (int i = 0; i < fpColumnShows_Sheet1.RowCount; i++)
            {
                string         id = fpColumnShows_Sheet1.Cells[i, 0].Text;
                Objects.Column c  = htColumnsShows[id] as Objects.Column;
                if (c == null)
                {
                    c = htColumnsUnShows[id] as Objects.Column;
                }
                Objects.Column newC = c.Clone();
                newC.SortId = i;
                htColumnsShowsNew.Add(newC.ID, newC);
            }
            Hashtable htColumnsUnShowsNew = new Hashtable();

            for (int i = 0; i < fpColumnUnShows_Sheet1.RowCount; i++)
            {
                string         id = fpColumnUnShows_Sheet1.Cells[i, 0].Text;
                Objects.Column c  = htColumnsShows[id] as Objects.Column;
                if (c == null)
                {
                    c = htColumnsUnShows[id] as Objects.Column;
                }
                Objects.Column newC = c.Clone();
                newC.SortId = i;
                htColumnsUnShowsNew.Add(newC.ID, newC);
            }
            Hashtable htConditionsShowsNew = new Hashtable();

            for (int i = 0; i < fpConditionShows_Sheet1.RowCount; i++)
            {
                string            id = fpConditionShows_Sheet1.Cells[i, 0].Text;
                Objects.Condition c  = htConditionsShows[id] as Objects.Condition;
                if (c == null)
                {
                    c = htConditionsUnShows[id] as Objects.Condition;
                }
                Objects.Condition newC = c.Clone();
                newC.SortId = i;
                htConditionsShowsNew.Add(newC.ID, newC);
            }
            Hashtable htConditionsUnShowsNew = new Hashtable();

            for (int i = 0; i < fpConditionUnShows_Sheet1.RowCount; i++)
            {
                string            id = fpConditionUnShows_Sheet1.Cells[i, 0].Text;
                Objects.Condition c  = htConditionsShows[id] as Objects.Condition;
                if (c == null)
                {
                    c = htConditionsUnShows[id] as Objects.Condition;
                }
                Objects.Condition newC = c.Clone();
                newC.SortId = i;
                htConditionsUnShowsNew.Add(newC.ID, newC);
            }
            if (OnSave != null)
            {
                OnSave(htColumnsShowsNew, htColumnsUnShowsNew, htConditionsShowsNew, htConditionsUnShowsNew);
            }
            Close();
        }