コード例 #1
0
        protected bool IsValidOperationBase(BaseValidatorType type, T t_from, T t_to)
        {
            /*
             * Create.
             */
            if (type == BaseValidatorType.Create)
            {
                string             strStateName = GetStateName(t_from);
                BaseStateFlowValid flow         = this.ListFlows
                                                  .Where(x => x.CurrentState == strStateName)
                                                  .FirstOrDefault();
                return(flow.IsStatePermitCreate);
            }

            /*
             * Edit.
             */
            if (type == BaseValidatorType.Update)
            {
                string             strStateName = GetStateName(t_from);
                BaseStateFlowValid flow         = this.ListFlows
                                                  .Where(x => x.CurrentState == strStateName)
                                                  .FirstOrDefault();
                return(flow.IsStatePermitEdit && flow.StatesNext.Contains(GetStateName(t_to)));
            }

            /*
             * Delete.
             */
            if (type == BaseValidatorType.Delete)
            {
                string             strStateName = GetStateName(t_from);
                BaseStateFlowValid flow         = this.ListFlows
                                                  .Where(x => x.CurrentState == strStateName)
                                                  .FirstOrDefault();
                return(flow.IsStatePermitDelete);
            }

            /*
             * Default.
             */
            return(false);
        }
コード例 #2
0
 public bool IsValidOperation(BaseValidatorType baseValidatorType, CustomerItem item1, CustomerItem item2)
 {
     return(base.IsValidOperationBase(baseValidatorType, item1, item2));
 }