예제 #1
0
 public override bool Execute(ICodeBase codeBase)
 {
     foreach (var item in this.Rows)
     {
         codeBase.ControlHelper.SetValue(item.ControlId, DCBaseModel.GetValue(codeBase, item.Value, item.ValueType, DCBaseModel.e_ConvertType.String));
     }
     return(true);
 }
        public static object GetValue(ICodeBase codeBase, string value, e_ValueType valueType,
                                      DCBaseModel.e_ConvertType e_Convert, bool allowNull = true)
        {
            switch (valueType)
            {
            case e_ValueType.Static:
                return(DCBaseModel.GetConverted(value, e_Convert, allowNull));

            case e_ValueType.Control:
                return(DCBaseModel.GetConverted(codeBase.ControlHelper.GetValue(value), e_Convert, allowNull));

            case e_ValueType.Parameter:
                return(DCBaseModel.GetConverted(codeBase.UrlHelper.GetParameter(value), e_Convert, allowNull));

            case e_ValueType.Variable:
                return(DCBaseModel.GetConverted(codeBase.VariableHelper.GetValue(value), e_Convert, allowNull));

            case e_ValueType.SysParameter:
                switch (value)
                {
                case "GetCurrentUserID":
                    return(DCBaseModel.GetConverted(codeBase.GetCurrentUserID, e_Convert, allowNull));

                case "GetCurrentUserName":
                    return(DCBaseModel.GetConverted(codeBase.GetCurrentUserName, e_Convert, allowNull));

                case "GetThreadID":
                    return(DCBaseModel.GetConverted(codeBase.GetThreadID, e_Convert, allowNull));

                case "GetThreadUserID":
                    return(DCBaseModel.GetConverted(codeBase.GetThreadUserID, e_Convert, allowNull));
                }
                break;
            }
            return(null);
        }
        public override bool Execute(ICodeBase codeBase)
        {
            bool result = true;

            foreach (var item in this.Rows)
            {
                DCBaseModel.e_ConvertType e_FirstSideConvert = e_ConvertType.String;
                switch (item.FirstConditionType)
                {
                case e_ValueType.Variable:
                    e_FirstSideConvert = DCBaseModel.GetVariableConvertType(item.FirstConditionValue, codeBase.GetProcessID, codeBase.GetApplicationPageID, codeBase.GetUnitOfWork);
                    break;
                }
                object firstValue  = DCBaseModel.GetValue(codeBase, item.FirstConditionValue, item.FirstConditionType, e_FirstSideConvert);
                object SecondValue = DCBaseModel.GetValue(codeBase, item.SecondConditionValue, item.SecondConditionType, e_FirstSideConvert);

                switch (e_FirstSideConvert)
                {
                case e_ConvertType.String:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToStringObjNull() == SecondValue.ToStringObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerAndEqualThan:
                        result = (firstValue.ToStringObjNull() == SecondValue.ToStringObjNull()) || (firstValue != null && firstValue.ToStringObjNull().CompareTo(SecondValue.ToStringObjNull()) >= 0);
                        break;

                    case DCRowConditionModel.e_OperationType.LowerAndEqualThan:
                        result = firstValue == null || firstValue.ToStringObjNull().CompareTo(SecondValue.ToStringObjNull()) <= 0;
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerThan:

                        result = firstValue != null && firstValue.ToStringObjNull().CompareTo(SecondValue.ToStringObjNull()) == 1;
                        break;

                    case DCRowConditionModel.e_OperationType.LowerThan:
                        result = (firstValue == null && SecondValue != null) || (firstValue != null && firstValue.ToStringObjNull().CompareTo(SecondValue.ToStringObjNull()) == -1);
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToStringObjNull() != SecondValue.ToStringObjNull();
                        break;

                    default: break;
                    }
                    break;

                case e_ConvertType.Integer:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToIntObjNull() == SecondValue.ToIntObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerAndEqualThan:
                        result = firstValue.ToIntObjNull() >= SecondValue.ToIntObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerAndEqualThan:
                        result = firstValue.ToIntObjNull() <= SecondValue.ToIntObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerThan:
                        result = firstValue.ToIntObjNull() > SecondValue.ToIntObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerThan:
                        result = firstValue.ToIntObjNull() < SecondValue.ToIntObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToIntObjNull() != SecondValue.ToIntObjNull();
                        break;

                    default: break;
                    }
                    break;

                case e_ConvertType.Decimal:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToDecimalObjNull() == SecondValue.ToDecimalObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerAndEqualThan:
                        result = firstValue.ToDecimalObjNull() >= SecondValue.ToDecimalObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerAndEqualThan:
                        result = firstValue.ToDecimalObjNull() <= SecondValue.ToDecimalObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerThan:
                        result = firstValue.ToDecimalObjNull() > SecondValue.ToDecimalObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerThan:
                        result = firstValue.ToDecimalObjNull() < SecondValue.ToDecimalObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToDecimalObjNull() != SecondValue.ToDecimalObjNull();
                        break;

                    default: break;
                    }
                    break;

                case e_ConvertType.DateTime:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToDateTimeObjNull() == SecondValue.ToDateTimeObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerAndEqualThan:
                        result = firstValue.ToDateTimeObjNull() >= SecondValue.ToDateTimeObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerAndEqualThan:
                        result = firstValue.ToDateTimeObjNull() <= SecondValue.ToDateTimeObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerThan:
                        result = firstValue.ToDateTimeObjNull() > SecondValue.ToDateTimeObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerThan:
                        result = firstValue.ToDateTimeObjNull() < SecondValue.ToDateTimeObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToDateTimeObjNull() != SecondValue.ToDateTimeObjNull();
                        break;

                    default: break;
                    }
                    break;

                case e_ConvertType.Boolean:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToBoolObjNull() == SecondValue.ToBoolObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToBoolObjNull() != SecondValue.ToBoolObjNull();
                        break;

                    default: result = false; break;
                    }
                    break;

                case e_ConvertType.Uniqueidentifier:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToGuidObjNull() == SecondValue.ToGuidObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToGuidObjNull() != SecondValue.ToGuidObjNull();
                        break;

                    default: result = false; break;
                    }
                    break;

                case e_ConvertType.Long:
                    switch (item.OperationType)
                    {
                    case DCRowConditionModel.e_OperationType.Equal:
                        result = firstValue.ToLongObjNull() == SecondValue.ToLongObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerAndEqualThan:
                        result = firstValue.ToLongObjNull() >= SecondValue.ToLongObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerAndEqualThan:
                        result = firstValue.ToLongObjNull() <= SecondValue.ToLongObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.BiggerThan:
                        result = firstValue.ToLongObjNull() > SecondValue.ToLongObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.LowerThan:
                        result = firstValue.ToLongObjNull() < SecondValue.ToLongObjNull();
                        break;

                    case DCRowConditionModel.e_OperationType.NotEqual:
                        result = firstValue.ToLongObjNull() != SecondValue.ToLongObjNull();
                        break;

                    default: break;
                    }
                    break;
                }
                if (this.EvaluateType == e_EvaluateType.And && !result)
                {
                    break;
                }
                if (this.EvaluateType == e_EvaluateType.Or && result)
                {
                    break;
                }
            }
            return(result);
        }
예제 #4
0
 public object GetRendered(ICodeBase codeBase, DCBaseModel.e_ConvertType e_Convert)
 {
     return(DCBaseModel.GetValue(codeBase, this.Value, this.ValueType, e_Convert));
 }