Ejemplo n.º 1
0
 private MB.WinBase.IFace.IBaseDataBindingEdit getDirectnessBaseEdit(Control ctl)
 {
     if (ctl.Parent == null)
     {
         return(null);
     }
     MB.WinBase.IFace.IBaseDataBindingEdit baseEdit = ctl.Parent as MB.WinBase.IFace.IBaseDataBindingEdit;
     if (baseEdit != null)
     {
         return(baseEdit);
     }
     else
     {
         return(getDirectnessBaseEdit(ctl.Parent));
     }
 }
Ejemplo n.º 2
0
        private void setNullValue()
        {
            //先判断上级控件
            MB.WinBase.IFace.IBaseDataBindingEdit editForm = getDirectnessBaseEdit(this) as MB.WinBase.IFace.IBaseDataBindingEdit;
            if (editForm == null)
            {
                editForm = this.ParentForm as MB.WinBase.IFace.IBaseDataBindingEdit;
            }

            if (editForm != null)
            {
                object mainEntity = editForm.CurrentEditEntity;
                foreach (MB.WinBase.Common.EditCtlDataMappingInfo info in _ColumnEditCfgInfo.EditCtlDataMappings)
                {
                    MB.Util.MyReflection.Instance.InvokePropertyForSet(mainEntity, info.ColumnName, null);
                }
            }
        }
Ejemplo n.º 3
0
        //创建查询过滤对象
        private void createFilterObjectData()
        {
            System.Windows.Forms.Control parentHoster = MB.WinBase.ShareLib.Instance.GetInvokeDataHosterControl(this.Parent);
            if (parentHoster != null)
            {
                _FrmDataAssistant = MB.WinBase.ObjectDataFilterAssistantHelper.Instance.CreateDataAssistantObject(this, _ColumnEditCfgInfo, parentHoster);
            }
            else
            {
                MB.WinBase.IFace.IBaseDataBindingEdit editForm = getDirectnessBaseEdit(this) as MB.WinBase.IFace.IBaseDataBindingEdit;
                if (editForm == null)
                {
                    editForm = this.ParentForm as MB.WinBase.IFace.IBaseDataBindingEdit;
                }
                object currentEditEntity = null;
                if (editForm != null)
                {
                    currentEditEntity = editForm.CurrentEditEntity;
                }

                if (_ClientRule == null)
                {
                    parentHoster = MB.WinBase.ShareLib.Instance.GetControlParentForm(this.Parent);
                    IForm frm = parentHoster as IForm;
                    if (frm != null)
                    {
                        _ClientRule = frm.ClientRuleObject;
                    }
                }
                _FrmDataAssistant = MB.WinBase.ObjectDataFilterAssistantHelper.Instance.CreateDataAssistantObject(this, currentEditEntity, _ColumnEditCfgInfo, _ClientRule);
            }
            if (_FrmDataAssistant != null)
            {
                _FrmDataAssistant.MaxSelectRows       = this._ColumnEditCfgInfo.MaxSelectRows;
                _FrmDataAssistant.MultiSelect         = this.MultiSelect;
                _FrmDataAssistant.QueryObject         = _QueryObject;
                _FrmDataAssistant.AfterGetObjectData += new MB.WinBase.IFace.GetObjectDataAssistantEventHandle(assistant_AfterGetObjectData);
            }
        }
Ejemplo n.º 4
0
        //设置选择行的值
        private void setSelectValue(IList rows, bool isKeyDown)
        {
            //先判断上级控件
            MB.WinBase.IFace.IBaseDataBindingEdit editForm = getDirectnessBaseEdit(this) as MB.WinBase.IFace.IBaseDataBindingEdit;
            if (editForm == null)
            {
                editForm = this.ParentForm as MB.WinBase.IFace.IBaseDataBindingEdit;
            }

            if (editForm != null)
            {
                object mainEntity = editForm.CurrentEditEntity;
                try
                {
                    if (rows != null && rows.Count > 0)
                    {
                        foreach (MB.WinBase.Common.EditCtlDataMappingInfo info in _ColumnEditCfgInfo.EditCtlDataMappings)
                        {
                            object dataObject = rows[0];

                            object val = null;
                            if (!string.IsNullOrEmpty(info.SourceColumnName))
                            {
                                val = MB.Util.MyReflection.Instance.InvokePropertyForGet(rows[0], info.SourceColumnName);
                            }
                            object valDesc = MB.Util.MyReflection.Instance.InvokePropertyForGet(mainEntity, info.ColumnName);
                            if (val != null)
                            {
                                if ((valDesc == null || string.Compare(val.ToString(), valDesc.ToString(), true) != 0))
                                {
                                    MB.Util.MyReflection.Instance.InvokePropertyForSet(mainEntity, info.ColumnName, val.ToString());
                                }
                            }
                            else
                            {
                                MB.Util.MyReflection.Instance.InvokePropertyForSet(mainEntity, info.ColumnName, null);
                            }
                        }
                    }
                    else
                    {
                        if (!isKeyDown)
                        {
                            foreach (MB.WinBase.Common.EditCtlDataMappingInfo info in _ColumnEditCfgInfo.EditCtlDataMappings)
                            {
                                MB.Util.MyReflection.Instance.InvokePropertyForSet(mainEntity, info.ColumnName, null);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new MB.Util.APPException("请检查EditCtlDataMappingInfo 的Mapping 信息是否正确 ", MB.Util.APPMessageType.SysErrInfo, ex);
                }
            }
            else
            {
                if (rows != null && rows.Count > 0)
                {
                    this.btnEdit.Text = convertToString(rows, true);
                }
                else
                if (!isKeyDown)
                {
                    this.btnEdit.Text = string.Empty;
                }
            }
        }