예제 #1
0
        /// <summary>
        ///     设置属性窗口值
        /// </summary>
        /// <param name="ent"></param>
        public void SetPropertyGridEnt(PreWarningRules ent)
        {
            if (ent == null)
            {
                return;
            }
            _srcEnt = ent.DeepClone();

            _ruleCodeId.Value                  = ent.RuleId;
            _ruleCodeProp.Value                = ent.RuleCode;
            _ruleType.Value                    = ent.RuleType;
            _warningType.Value                 = ent.WarningType;
            _warningLevel.Value                = ent.WarningLevel;
            _suitableLocation.Value            = ent.SuitableLocation;
            _indicatorType.Value               = ent.IndicatorType;
            _operator.Value                    = ent.Operator;
            _dateProp.Value                    = ent.ModifyDate.ToString();
            _remarks.Value                     = ent.Remarks; //MARK FIELD
            _multiRulesBindingSingleRule.Value = ent.StrBindingSingleRuleName == null
                ? ""
                : ent.StrBindingSingleRuleName;
            _IsMultiRules.Value = ent.IsMultiRules ? "是" : "否";
            var htParams = ent.GetWarningParamsAndValues();
            var nParams  = 0;

            if (htParams != null)
            {
                nParams = htParams.Count;
            }
            _paramCnt.Value = nParams.ToString();
            //移除先前的参数
            var preCnt = _paramProp.Count;

            for (var i = 0; i < preCnt; i++)
            {
                _props.Remove(_paramProp[i]);
            }
            _paramProp.Clear();

            //规则参数
            if (htParams != null)
            {
                foreach (string tmpKey in htParams.Keys)
                {
                    var prop = new XProp();
                    prop.Category    = CATEGORY_RULE_PARAMS_TITLE;
                    prop.Name        = tmpKey;
                    prop.Description = "规则参数" + tmpKey;
                    prop.ReadOnly    = false;
                    prop.ProType     = typeof(string);
                    prop.Visible     = true;
                    prop.Converter   = null;
                    prop.Value       = htParams[tmpKey].ToString();
                    _props.Add(prop);
                    _paramProp.Add(prop);
                }
            }

            propertyGridRules.SelectedObject = _props;
        }
        /// <summary>
        /// 设定显示窗口的实体
        /// </summary>
        /// <param name="ent"></param>
        void SetPropertyGridEnt(UserGroupParameter ent)
        {
            if (ent == null)
            {
                return;
            }
            //深度克隆
            _srcEnt = ent.DeepClone();

            //设置只读属性为否,可以修改属性值
            _userGroupName.ReadOnly = false;
            _remarks.ReadOnly       = false;

            //设置个属性值
            _userGroupName.Value = ent.GroupName;
            _userCount.Value     = ent.UserCount;
            _remarks.Value       = ent.Remark;

            //删除旧信息
            int preCnt = _paramProp.Count;

            for (int i = 0; i < preCnt; i++)
            {
                _props.Remove(_paramProp[i]);
            }
            _paramProp.Clear();

            //添加新属性实体
            _propInfo.SelectedObject = _props;
        }
        private void SetPropertyGridEnt(UserParameter ent)
        {
            if (ent == null)
            {
                return;
            }
            _srcEnt = ent.DeepClone();
            _userLoginName.ReadOnly  = false;
            _userPassWord.ReadOnly   = false;
            _userGroup.ReadOnly      = false;
            _userDepartment.ReadOnly = false;
            _remarks.ReadOnly        = false;
            _userName.ReadOnly       = false;
            _userEmail.ReadOnly      = false;
            _userTel.ReadOnly        = false;
            _userPhone.ReadOnly      = false;
            _userPermission.ReadOnly = false;

            _userLoginName.Value = ent.LoginName;
            _userPassWord.Value  = ent.PassWord;

            _userGroup.ProType   = typeof(MyComboItemConvert);
            _userGroup.Converter = new MyComboItemConvert(_strGroupName);
            _userGroup.Value     = GetGroupIndex(ent.Group);
            //_userGroup. = ent.Group;

            _userDepartment.ProType   = typeof(MyComboItemConvert);
            _userDepartment.Converter = new MyComboItemConvert(_strDepartmentName);
            _userDepartment.Value     = GetDepartmentIndex(ent.Department);

            _userName.Value         = ent.Name;
            _userEmail.Value        = ent.Email;
            _userTel.Value          = ent.Tel;
            _userPhone.Value        = ent.Phone;
            _userPermission.ProType = typeof(LibCommon.Permission);

            _userPermission.Value = LibCommon.Permission.普通用户;
            if (ent.Permission == "管理员")
            {
                _userPermission.Value = LibCommon.Permission.管理员;
            }

            _remarks.Value = ent.Remark;
            int preCnt = _paramProp.Count;

            for (int i = 0; i < preCnt; i++)
            {
                _props.Remove(_paramProp[i]);
            }
            _paramProp.Clear();
            _propInfo.SelectedObject = _props;
        }