Exemple #1
0
        public override BaseEdit CreateEditor()
        {
            BaseEdit edit = base.CreateEditor();

            (edit as XtraRegionEdit).ColumnEditCfgInfo = _ColumnEditCfgInfo;

            //注册XtraRegionEdit点击链接以后的时间,动态创建代理
            if (_ColumnEditCfgInfo.InvokeDataSourceDesc != null)
            {
                try {
                    InvokeDataSourceDescInfo invokeDataSourceDescInfo = _ColumnEditCfgInfo.InvokeDataSourceDesc;
                    string[] arrType   = invokeDataSourceDescInfo.Type.Split(new char[] { ',' });
                    string[] arrMethod = invokeDataSourceDescInfo.Method.Split(new char[] { ',' });
                    string[] arrParams = null;
                    if (arrMethod.Length > 1)
                    {
                        arrParams = arrMethod[1].Split(new char[] { ';' });
                    }
                    object obj = MB.Util.DllFactory.Instance.LoadObject(arrType[0], arrType[1]);
                    System.Reflection.MethodInfo methodInfo = obj.GetType().GetMethod(arrMethod[0]);

                    Action <RegionEditInfo> del = Delegate.CreateDelegate(typeof(Action <RegionEditInfo>), methodInfo) as Action <RegionEditInfo>;
                    (edit as XtraRegionEdit).AfterLinkIsClicked += del;
                }
                catch (Exception ex) {
                    MB.Util.TraceEx.Write(string.Format("XtraRepositoryItemRegionEdit 动态加载事件出错, {0}", ex.ToString()));
                }
            }
            return(edit);
        }
Exemple #2
0
        private void SetLinkBinding(InvokeDataSourceDescInfo invokeDataSourceDescInfo)
        {
            DataSet ds = getRegionSource(invokeDataSourceDescInfo);

            this.flowLayoutPanel.Controls.Clear();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                LinkLabel lnkRegion = new LinkLabel();
                lnkRegion.Margin    = new System.Windows.Forms.Padding(3, 3, 0, 0);
                lnkRegion.TextAlign = ContentAlignment.MiddleLeft;
                lnkRegion.Width     = 105;

                lnkRegion.Name = "lnkRegion" + ds.Tables[0].Rows[i]["CODE"].ToString();
                lnkRegion.Text = ds.Tables[0].Rows[i]["Name"].ToString();
                lnkRegion.Tag  = ds.Tables[0].Rows[i];

                lnkRegion.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkRegion_LinkClicked);
                this.flowLayoutPanel.Controls.Add(lnkRegion);
            }

            if (!_CurRegionType.RegionLevel.Equals(BEGIN_LEVEL))
            {
                LinkLabel lnkReturn = new LinkLabel();
                lnkReturn.Margin    = new System.Windows.Forms.Padding(3, 3, 0, 0);
                lnkReturn.TextAlign = ContentAlignment.MiddleLeft;
                lnkReturn.Width     = 105;

                lnkReturn.Name = "lnkReturn";
                lnkReturn.Text = "返回上一级";

                lnkReturn.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkReturn_LinkClicked);
                this.flowLayoutPanel.Controls.Add(lnkReturn);
            }
        }
Exemple #3
0
        private DataSet getRegionSource(InvokeDataSourceDescInfo invokeDataSourceDescInfo)
        {
            string[] arrType   = invokeDataSourceDescInfo.Type.Split(new char[] { ',' });
            string[] arrMethod = invokeDataSourceDescInfo.Method.Split(new char[] { ',' });
            string[] arrParams = null;
            if (arrMethod.Length > 1)
            {
                arrParams = arrMethod[1].Split(new char[] { ';' });
            }
            IClientRuleQueryBase clientRule = (IClientRuleQueryBase)MB.Util.DllFactory.Instance.LoadObject(arrType[0], arrType[1]);
            var     data = MyReflection.Instance.InvokeMethod(clientRule, arrMethod[0], arrParams);
            DataSet ds   = ((DataSet)data).Copy();

            return(ds);
        }
        private void SetComBoxBinding(ComboBox combBox, InvokeDataSourceDescInfo invokeDataSourceDescInfo)
        {
            string[] arrType   = invokeDataSourceDescInfo.Type.Split(new char[] { ',' });
            string[] arrMethod = invokeDataSourceDescInfo.Method.Split(new char[] { ',' });
            string[] arrParams = null;
            if (arrMethod.Length > 1)
            {
                arrParams = arrMethod[1].Split(new char[] { ';' });
            }
            IClientRuleQueryBase clientRule = (IClientRuleQueryBase)MB.Util.DllFactory.Instance.LoadObject(arrType[0], arrType[1]);
            var     data = MyReflection.Instance.InvokeMethod(clientRule, arrMethod[0], arrParams);
            DataSet ds   = ((DataSet)data).Copy();

            combBox.ValueMember   = "CODE";
            combBox.DisplayMember = "NAME";
            combBox.DataSource    = ds.Tables[0].DefaultView;
        }