public ResultOperation Update(Guid gatewayID, Guid?sequenceFlowID, string Code)
        {
            this.GatewayID      = gatewayID;
            this.SequenceFlowID = sequenceFlowID;
            this.Code           = Code;
            ResultOperation resultOperation = new ResultOperation(this);

            if (string.IsNullOrWhiteSpace(this.Code))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsCondition.Code), nameof(sysBpmsCondition)));
            }
            if (!this.SequenceFlowID.HasValue)
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsCondition.SequenceFlowID), nameof(sysBpmsCondition)));
            }
            return(resultOperation);
        }
        public ResultOperation Update(Guid id, Guid dependentVariableId, string dependentPropertyName, Guid?toVariableID, string toPropertyName, string description)
        {
            this.ID = id;
            this.DependentVariableID   = dependentVariableId;
            this.DependentPropertyName = dependentPropertyName;
            this.ToVariableID          = toVariableID;
            this.ToPropertyName        = toPropertyName;
            this.Description           = description;

            ResultOperation resultOperation = new ResultOperation(this);

            if (string.IsNullOrWhiteSpace(this.DependentPropertyName))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariableDependency.DependentPropertyName), nameof(sysBpmsVariableDependency)));
            }
            if (this.ToVariableID.ToGuidObj() == Guid.Empty)
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariableDependency.ToVariableID), nameof(sysBpmsVariableDependency)));
            }
            return(resultOperation);
        }
Пример #3
0
        public ResultOperation Update(Guid ID, string Name, string DataSource, string InitialCatalog, string UserID, string Password, bool IntegratedSecurity)
        {
            this.ID                 = ID;
            this.Name               = Name.ToStringObj();//not null in sql;
            this.DataSource         = DataSource;
            this.InitialCatalog     = InitialCatalog;
            this.UserID             = UserID.ToStringObj();   //not null in sql
            this.Password           = Password.ToStringObj(); //not null in sql
            this.IntegratedSecurity = IntegratedSecurity;

            ResultOperation resultOperation = new ResultOperation(this);

            if (string.IsNullOrWhiteSpace(this.InitialCatalog))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsDBConnection.InitialCatalog), nameof(sysBpmsDBConnection)));
            }
            if (string.IsNullOrWhiteSpace(this.DataSource))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsDBConnection.DataSource), nameof(sysBpmsDBConnection)));
            }

            return(resultOperation);
        }
 public virtual void IsValid(ResultOperation resultOperation)
 {
 }
        public ResultOperation Update(string displayName, string name, string designXML, bool isActive, List <EntityPropertyModel> properties)
        {
            this.DisplayName = displayName;
            if (this.ID == Guid.Empty)
            {
                this.Name = name.ToStringObj().Trim();
            }
            this.DesignXML  = designXML;
            this.IsActive   = isActive;
            this.Properties = properties;

            ResultOperation resultOperation = new ResultOperation(this);

            if ((this.Properties == null || !this.Properties.Any()))
            {
                resultOperation.AddError(LangUtility.Get("AtLeastOnePropert.Text", nameof(sysBpmsEntityDef)));
            }
            if (this.Name.ToLower().StartsWith("sys") ||
                this.Name.ToLower().EndsWith("model") ||
                this.Name.ToLower().EndsWith("vm") ||
                this.Name.ToLower().EndsWith("html"))
            {
                resultOperation.AddError(LangUtility.Get("NameError.Text", nameof(sysBpmsEntityDef)));
            }
            foreach (var Item in this.Properties)
            {
                Item.Name = Item.Name.ToStringObj().Trim();
                if (string.IsNullOrWhiteSpace(Item.Name))
                {
                    resultOperation.AddError(SharedLang.GetReuired("PropertyName.Text", nameof(sysBpmsEntityDef)));
                }

                if (Item.Name.ToLower() == "id" ||
                    Item.Name.ToLower() == "variablename" ||
                    Item.Name.ToLower() == this.Name ||
                    Item.Name.ToLower().Contains(".") ||
                    Item.Name.ToLower().Contains("__"))
                {
                    resultOperation.AddError(LangUtility.Get("PropertyNameError.Text", nameof(sysBpmsEntityDef)));
                }

                if (Item.IsActive && this.Properties.Any(c => c.ID != Item.ID && c.Name == Item.Name))
                {
                    resultOperation.AddError(LangUtility.Get("SameProperty.Text", nameof(sysBpmsEntityDef)));
                }
            }
            if (string.IsNullOrWhiteSpace(this.DisplayName))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEntityDef.DisplayName), nameof(sysBpmsEntityDef)));
            }
            if (string.IsNullOrWhiteSpace(this.Name))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEntityDef.Name), nameof(sysBpmsEntityDef)));
            }
            if (this.Name.Split(' ').Count() > 1 || this.Name.Contains("-"))
            {
                resultOperation.AddError("Name is not valid (do not use space or - in your name)");
            }

            return(resultOperation);
        }
Пример #6
0
        public ResultOperation Update(string roleName, Guid?specificDepartmentId, int?ownerTypeLU, string userID, string rule)
        {
            ResultOperation resultOperation = new ResultOperation();

            this.OwnerTypeLU = ownerTypeLU;
            this.UserID      = userID;
            this.RoleName    = roleName;
            this.Rule        = rule;
            if (this.OwnerTypeLU.HasValue)
            {
                switch ((e_OwnerTypeLU)this.OwnerTypeLU)
                {
                case e_OwnerTypeLU.User:
                    switch ((UserTaskRuleModel.e_UserAccessType) this.UserTaskRuleModel.AccessType)
                    {
                    case UserTaskRuleModel.e_UserAccessType.Static:
                        if (string.IsNullOrWhiteSpace(this.UserID))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsTask.UserID), nameof(sysBpmsTask)));
                        }
                        break;

                    case UserTaskRuleModel.e_UserAccessType.Variable:
                        if (string.IsNullOrWhiteSpace(this.UserTaskRuleModel.Variable))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(UserTaskRuleModel.Variable), nameof(sysBpmsTask)));
                        }
                        this.UserID = null;
                        break;
                    }
                    this.RoleName = string.Empty;
                    break;

                case e_OwnerTypeLU.Role:
                    switch ((UserTaskRuleModel.e_RoleAccessType) this.UserTaskRuleModel.AccessType)
                    {
                    case UserTaskRuleModel.e_RoleAccessType.Static:
                        if (string.IsNullOrWhiteSpace(this.RoleName))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsTask.RoleName), nameof(sysBpmsTask)));
                        }
                        this.SetRoleDepartment(this.RoleName, specificDepartmentId);
                        break;

                    case UserTaskRuleModel.e_RoleAccessType.Variable:
                        this.RoleName = string.Empty;
                        if (string.IsNullOrWhiteSpace(this.UserTaskRuleModel.Variable))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(UserTaskRuleModel.Variable), nameof(sysBpmsTask)));
                        }
                        break;

                    case UserTaskRuleModel.e_RoleAccessType.CorrespondentRole:
                        this.RoleName = string.Empty;
                        if (string.IsNullOrWhiteSpace(this.UserTaskRuleModel.RoleCode))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsTask.RoleName), nameof(sysBpmsTask)));
                        }
                        if (!this.UserTaskRuleModel.UserType.HasValue)
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsTask.UserID), nameof(sysBpmsTask)));
                        }
                        break;
                    }
                    this.UserID = null;
                    break;
                }
            }
            return(resultOperation);
        }