Esempio n. 1
0
        private void UpdateOperatorComboBox()
        {
            // Lấy thông tin Field được chọn
            var field = m_Condition.EditValue as ModuleFieldInfo;

            // Lấy các phép toán tương ứng với FieldType
            if (field != null)
            {
                var opField = FieldUtils.GetModuleFieldByID(
                    ParentModule.ModuleInfo.ModuleType,
                    field.ConditionType);

                m_ConditionGroupLayout.BeginUpdate();
                m_EditValueLayoutItem.BeginInit();

                if (m_Operator != null)
                {
                    m_OperatorLayoutItem.Control = null;
                    m_Operator.Parent            = null;
                }

                m_Operator = (ImageComboBoxEdit)ParentModule.CreateControl(opField);
                ParentModule.SetControlListSource(m_Operator);
            }

            m_OperatorLayoutItem.Control             = m_Operator;
            m_OperatorLayoutItem.TextVisible         = false;
            m_OperatorLayoutItem.SizeConstraintsType = SizeConstraintsType.Custom;
            m_OperatorLayoutItem.MinSize             =
                m_OperatorLayoutItem.MaxSize         = new Size(180, 1);

            m_EditValueLayoutItem.EndInit();
            m_ConditionGroupLayout.EndUpdate();

            ParentModule.SetControlDefaultValue(m_Operator);
        }
Esempio n. 2
0
        private void SetCurrentOption(XtraUserControl option)
        {
            var ctrl = option as Control;

            if (ctrl == null)
            {
                return;
            }

            // set the the LayoutItemControl Owner (LayoutGroupItem)
            LayoutControlGroup itemOwner = lciLayout;

            itemOwner.BeginUpdate();
            try
            {
                // remove the current LayoutItemControl
                if (lciLayout.Items.Count > 0)
                {
                    var item = itemOwner.Items[0] as LayoutControlItem;
                    if (item != null)
                    {
                        Control control = item.Control;
                        if (control != null)
                        {
                            control.Parent = null;
                        }
                        item.Dispose();
                    }
                }

                // add the new LayoutItemControl
                itemOwner.AddItem(string.Empty, ctrl).TextVisible = false;
            }
            finally
            {
                itemOwner.EndUpdate();
            }
        }
Esempio n. 3
0
        private void InitializeQuery()
        {
            List <Sys_Schema> sys_Schemas = InitializeField();

            if (gds.SelectedIndex < 0)
            {
                return;
            }
            GroupControl grid;

            if (gds.EditValue != null && gds.EditValue.GetType() == typeof(GroupControl))
            {
                grid = (GroupControl)gds.EditValue;
                LayoutControl eLayoutControl = (LayoutControl)iDesignerHost.CreateComponent(typeof(LayoutControl), "lyc");
                grid.Controls.Add(eLayoutControl);
                eLayoutControl.BeginUpdate();
                LayoutControlGroup eLayoutControlGroup = new LayoutControlGroup();
                eLayoutControlGroup.BeginUpdate();
                eLayoutControl.Dock     = System.Windows.Forms.DockStyle.Fill;
                eLayoutControl.Location = new System.Drawing.Point(2, 21);
                eLayoutControl.Name     = "eLayoutControl";
                eLayoutControl.Root     = eLayoutControlGroup;
                eLayoutControl.Size     = new System.Drawing.Size(1000, 500);
                eLayoutControl.TabIndex = 0;
                eLayoutControl.Text     = "QueryLayout";
                eLayoutControlGroup.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
                eLayoutControlGroup.GroupBordersVisible         = false;
                eLayoutControlGroup.Size        = new Size(1000, 500);
                eLayoutControlGroup.Location    = new Point(0, 0);
                eLayoutControlGroup.Name        = "eLayoutControlGroup";
                eLayoutControlGroup.TextVisible = false;
                List <BaseLayoutItem> baseLayoutItems = new List <BaseLayoutItem>();
                int curLeft = 0;
                int curTop  = 0;
                foreach (Sys_Schema sys_Schema in sys_Schemas)
                {
                    try
                    {
                        string   gn       = string.Format("f{0}", sys_Schema.FieldName);
                        BaseEdit baseEdit = null;
                        if (sys_Schema.SqlDbType.Equals("bit"))
                        {
                            baseEdit      = (CheckEdit)iDesignerHost.CreateComponent(typeof(CheckEdit), gn);
                            baseEdit.Text = string.Empty;
                        }
                        else if (sys_Schema.SqlDbType.Equals("datetime"))
                        {
                            baseEdit = (DateEdit)iDesignerHost.CreateComponent(typeof(DateEdit), gn);
                        }
                        else
                        {
                            baseEdit = (TextEdit)iDesignerHost.CreateComponent(typeof(TextEdit), gn);
                        }
                        baseEdit.Width = 250;
                        baseEdit.Properties.Appearance.Options.UseTextOptions = true;
                        LayoutControlItem eLayoutControlItem = new LayoutControlItem();
                        eLayoutControlItem.Location = new System.Drawing.Point(curLeft, curTop);
                        eLayoutControlItem.Name     = "oli_" + sys_Schema.FieldName;
                        eLayoutControlItem.Text     = sys_Schema.Description;
                        eLayoutControlItem.Size     = new Size(baseEdit.Width, baseEdit.Height);
                        eLayoutControlItem.Control  = baseEdit;
                        baseLayoutItems.Add(eLayoutControlItem);
                        curLeft += baseEdit.Width;
                        if (curLeft >= eLayoutControlGroup.Width)
                        {
                            curLeft = 0;
                            curTop += baseEdit.Height;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                if (curLeft < eLayoutControlGroup.Width && curLeft > 0)
                {
                    EmptySpaceItem emptySpaceItem = new EmptySpaceItem();
                    emptySpaceItem.AllowHotTrack = false;
                    emptySpaceItem.Location      = new System.Drawing.Point(curLeft, curTop);
                    emptySpaceItem.Name          = "oli_Space";
                    emptySpaceItem.Size          = new System.Drawing.Size(eLayoutControlGroup.Width - curLeft, 24);
                    baseLayoutItems.Add(emptySpaceItem);
                }
                EmptySpaceItem emptyBottom = new EmptySpaceItem();
                emptyBottom.AllowHotTrack = false;
                emptyBottom.Location      = new System.Drawing.Point(0, curTop + 24);
                emptyBottom.Name          = "oli_Space";
                emptyBottom.Size          = new System.Drawing.Size(eLayoutControlGroup.Width, 24);
                baseLayoutItems.Add(emptyBottom);
                eLayoutControlGroup.Items.AddRange(baseLayoutItems.ToArray());
                eLayoutControlGroup.EndUpdate();
                eLayoutControl.EndUpdate();
            }
        }
Esempio n. 4
0
        public UISearchGroup(ucModule parentModule, LayoutControlGroup parentLayoutGroup)
        {
            ParentModule      = parentModule;
            ModuleInfo        = parentModule.ModuleInfo;
            ParentLayoutGroup = parentLayoutGroup;
            SearchLayout      = (LayoutControl)parentLayoutGroup.Owner;

            Groups     = new List <UISearchGroup>();
            Conditions = new List <UISearchCondition>();

            LayoutGroup = new LayoutControlGroup();

            SearchLayout.BeginUpdate();
            parentLayoutGroup.BeginUpdate();

            m_EditUse = new CheckEdit();
            // GetFields: ModID = ModuleTypeID, Group = SQL_EXPRESSION
            var fieldSqlLogic =
                FieldUtils.GetModuleFields(
                    ModuleInfo.ModuleType,
                    CODES.DEFMODFLD.FLDGROUP.SQL_EXPRESSION
                    )[0];

            //
            m_SQLLogic = (ImageComboBoxEdit)parentModule.CreateControl(fieldSqlLogic);
            parentModule.SetControlListSource(m_SQLLogic);
            parentModule.SetControlDefaultValue(m_SQLLogic);

            m_AddGroup     = new SimpleButton();
            m_AddCondition = new SimpleButton();
            m_DeleteGroup  = new SimpleButton();

            SearchLayout.Controls.AddRange(new Control[] { m_EditUse, m_SQLLogic, m_AddGroup, m_AddCondition, m_DeleteGroup });

            (m_EditUseLayoutItem = LayoutGroup.AddItem("Use Condition", m_EditUse)).BeginInit();
            (m_MainSeparator = (SimpleSeparator)LayoutGroup.AddItem(new SimpleSeparator(), m_EditUseLayoutItem, InsertType.Bottom)).BeginInit();
            (m_SQLLogicLayoutItem = LayoutGroup.AddItem("Group Type", m_SQLLogic, m_EditUseLayoutItem, InsertType.Right)).BeginInit();
            (m_SQLLogicEmptySpace = (EmptySpaceItem)LayoutGroup.AddItem(new EmptySpaceItem(LayoutGroup), m_SQLLogicLayoutItem, InsertType.Right)).BeginInit();
            (m_DeleteGroupLayoutItem = LayoutGroup.AddItem("Delete Group", m_DeleteGroup, m_SQLLogicEmptySpace, InsertType.Right)).BeginInit();
            (m_AddGroupLayoutItem = LayoutGroup.AddItem("Add Group", m_AddGroup, m_DeleteGroupLayoutItem, InsertType.Right)).BeginInit();
            (m_AddConditionLayoutItem = LayoutGroup.AddItem("Add Condition", m_AddCondition, m_AddGroupLayoutItem, InsertType.Right)).BeginInit();

            // m_chkEditUse
            m_EditUse.Text              = "";
            m_EditUse.Checked           = true;
            m_EditUse.EditValueChanged += CheckEditUse_CheckedChanged;

            // m_btnDeleteGroup
            parentModule.Language.FormatButton(m_DeleteGroup, "btnDeleteGroupCondition");
            m_DeleteGroup.Click += DeleteGroupCondition_Click;

            // m_btnAddGroup
            parentModule.Language.FormatButton(m_AddGroup, "btnAddGroupCondition");
            m_AddGroup.Click += AddGroupCondition_Click;

            // m_btnAddCondition
            parentModule.Language.FormatButton(m_AddCondition, "btnAddCondition");
            m_AddCondition.Click += AddConditionButton_Click;

            // LayoutGroup
            LayoutGroup.Padding      = new DevExpress.XtraLayout.Utils.Padding(9, 2, 2, 2);
            LayoutGroup.TextLocation = DevExpress.Utils.Locations.Left;
            LayoutGroup.Text         = " ";

            // m_layout_chkEditUse
            m_EditUseLayoutItem.TextVisible             = false;
            m_EditUseLayoutItem.SizeConstraintsType     = SizeConstraintsType.Custom;
            m_EditUseLayoutItem.ControlAlignment        = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_EditUseLayoutItem.MinSize     =
                m_EditUseLayoutItem.MaxSize = new Size(20, 24);

            // m_layout_cboSQLLogic
            m_SQLLogicLayoutItem.TextVisible            = false;
            m_SQLLogicLayoutItem.SizeConstraintsType    = SizeConstraintsType.Custom;
            m_SQLLogicLayoutItem.ControlAlignment       = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_SQLLogicLayoutItem.MinSize     =
                m_SQLLogicLayoutItem.MaxSize = new Size(240, 24);

            // m_layout_btnDeleteGroup
            m_DeleteGroupLayoutItem.TextVisible         = false;
            m_DeleteGroupLayoutItem.SizeConstraintsType = SizeConstraintsType.Custom;
            m_DeleteGroupLayoutItem.ControlAlignment    = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_DeleteGroupLayoutItem.MinSize             =
                m_DeleteGroupLayoutItem.MaxSize         = new Size(140, 24);

            // m_layout_cboSQLLogic
            m_AddGroupLayoutItem.TextVisible            = false;
            m_AddGroupLayoutItem.SizeConstraintsType    = SizeConstraintsType.Custom;
            m_AddGroupLayoutItem.ControlAlignment       = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea = false;
            m_AddGroupLayoutItem.MinSize     =
                m_AddGroupLayoutItem.MaxSize = new Size(140, 24);

            // m_layout_cboSQLLogic
            m_AddConditionLayoutItem.TextVisible         = false;
            m_AddConditionLayoutItem.SizeConstraintsType = SizeConstraintsType.Custom;
            m_AddConditionLayoutItem.ControlAlignment    = ContentAlignment.MiddleCenter;
            m_EditUseLayoutItem.FillControlToClientArea  = false;
            m_AddConditionLayoutItem.MinSize             =
                m_AddConditionLayoutItem.MaxSize         = new Size(110, 24);

            m_MainSeparator.FillControlToClientArea = false;
            m_MainSeparator.SizeConstraintsType     = SizeConstraintsType.Default;

            m_EditUseLayoutItem.EndInit();
            m_SQLLogicLayoutItem.EndInit();
            m_SQLLogicEmptySpace.EndInit();
            m_DeleteGroupLayoutItem.EndInit();
            m_AddGroupLayoutItem.EndInit();
            m_AddConditionLayoutItem.EndInit();
            m_MainSeparator.EndInit();

            parentLayoutGroup.Add(LayoutGroup);

            if (ConditionModule.ConditionLayoutGroup == parentLayoutGroup)
            {
                parentLayoutGroup.AddItem(new EmptySpaceItem(), LayoutGroup, InsertType.Bottom);
                m_DeleteGroupLayoutItem.Visibility = LayoutVisibility.Never;
            }

            parentLayoutGroup.EndUpdate();
            SearchLayout.EndUpdate();
        }