Beispiel #1
0
        public ResultOperation Update(int ObjectTypeLU, Guid?ObjectID, string smtp, string port, string mailPassword, string email)
        {
            this.ObjectTypeLU = ObjectTypeLU;
            this.ObjectID     = ObjectID;
            this.SMTP         = smtp;
            this.Port         = port;
            this.MailPassword = mailPassword;
            this.Email        = email;
            ResultOperation resultOperation = new ResultOperation(this);

            if (!string.IsNullOrWhiteSpace(this.Email + this.MailPassword + this.SMTP))
            {
                if (string.IsNullOrWhiteSpace(this.Email))
                {
                    resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEmailAccount.Email), nameof(sysBpmsEmailAccount)));
                }
                if (string.IsNullOrWhiteSpace(this.SMTP))
                {
                    resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEmailAccount.SMTP), nameof(sysBpmsEmailAccount)));
                }
                if (string.IsNullOrWhiteSpace(this.Port))
                {
                    resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEmailAccount.Port), nameof(sysBpmsEmailAccount)));
                }
                if (string.IsNullOrWhiteSpace(this.MailPassword))
                {
                    resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEmailAccount.MailPassword), nameof(sysBpmsEmailAccount)));
                }
            }
            return(resultOperation);
        }
        public ResultOperation Update(Guid?processID, Guid?applicationPageID, string name, int varTypeLU, Guid?entityDefID, string fieldName, string query, int?filterTypeLU, string collection, Guid?dbConnectionID, string defaultValue, string whereClause, string orderByClause)
        {
            this.ProcessID         = processID;
            this.ApplicationPageID = applicationPageID;
            this.Name        = name;
            this.VarTypeLU   = varTypeLU;
            this.EntityDefID = entityDefID;
            this.FieldName   = fieldName;
            this.Query       = query;
            if (RelationTypeLU == (int)sysBpmsVariable.e_RelationTypeLU.Entity)
            {
                this.FilterTypeLU = applicationPageID.HasValue ? (int)sysBpmsVariable.e_FilterTypeLU.AllEntities : filterTypeLU;
            }
            this.DBConnectionID = dbConnectionID;
            this.Collection     = collection;
            this.DefaultValue   = defaultValue;
            this.WhereClause    = whereClause;
            this.OrderByClause  = orderByClause;

            ResultOperation resultOperation = new ResultOperation(this);

            if (string.IsNullOrWhiteSpace(this.Name))
            {
                resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariable.Name), nameof(sysBpmsVariable)));
            }
            switch ((sysBpmsVariable.e_RelationTypeLU) this.RelationTypeLU)
            {
            case sysBpmsVariable.e_RelationTypeLU.Entity:
                if (this.VarTypeLU != (int)sysBpmsVariable.e_VarTypeLU.Object &&
                    this.VarTypeLU != (int)sysBpmsVariable.e_VarTypeLU.List &&
                    string.IsNullOrWhiteSpace(this.FieldName))
                {
                    resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariable.FieldName), nameof(sysBpmsVariable)));
                }
                break;

            case sysBpmsVariable.e_RelationTypeLU.SqlQuery:
                if (string.IsNullOrWhiteSpace(this.Query))
                {
                    resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsVariable.Query), nameof(sysBpmsVariable)));
                }
                break;

            case sysBpmsVariable.e_RelationTypeLU.Local:
                if (this.VarTypeLU == (int)sysBpmsVariable.e_VarTypeLU.List && !this.Items.Any())
                {
                    resultOperation.AddError(LangUtility.Get("AtleastOneItem.Text", nameof(sysBpmsVariable)));
                }
                if (this.VarTypeLU == (int)sysBpmsVariable.e_VarTypeLU.List && this.Items.Any(c => string.IsNullOrWhiteSpace(c.Key) || string.IsNullOrWhiteSpace(c.Text)))
                {
                    resultOperation.AddError(LangUtility.Get("AllItemError.Text", nameof(sysBpmsVariable)));
                }
                break;
            }
            return(resultOperation);
        }
Beispiel #3
0
        public ResultOperation Update(int typeLU, string refElementID, string ConfigurationXML, int?subType, bool?cancelActivity, Guid?messageTypeID)
        {
            this.TypeLU                   = typeLU;
            this.ConfigurationXML         = ConfigurationXML;
            this.SubTypeMessageEventModel = subTypeMessageEventModel;
            this.SubType                  = subType;
            this.RefElementID             = refElementID;
            this.CancelActivity           = cancelActivity;
            this.MessageTypeID            = messageTypeID;
            ResultOperation resultOperation = new ResultOperation(this);

            switch ((sysBpmsEvent.e_TypeLU) this.TypeLU)
            {
            case sysBpmsEvent.e_TypeLU.IntermediateThrow:
                if (this.SubTypeMessageEventModel.Type == (int)SubTypeMessageEventModel.e_Type.Email)
                {
                    if (!string.IsNullOrWhiteSpace(
                            this.SubTypeMessageEventModel.Email?.From +
                            this.SubTypeMessageEventModel.Email?.To +
                            this.SubTypeMessageEventModel.Email?.Content))
                    {
                        if (string.IsNullOrWhiteSpace(this.SubTypeMessageEventModel.Email.From))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(SubTypeEmailEventModel.From), nameof(SubTypeEmailEventModel)));
                        }
                        if (string.IsNullOrWhiteSpace(this.SubTypeMessageEventModel.Email.To))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(SubTypeEmailEventModel.To), nameof(SubTypeEmailEventModel)));
                        }
                        if (string.IsNullOrWhiteSpace(this.SubTypeMessageEventModel.Email.Content))
                        {
                            resultOperation.AddError(SharedLang.GetReuired(nameof(SubTypeEmailEventModel.Content), nameof(SubTypeEmailEventModel)));
                        }
                    }
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(this.SubTypeMessageEventModel.Key))
                    {
                        resultOperation.AddError(SharedLang.GetReuired(nameof(SubTypeMessageEventModel.Key), nameof(Domain.SubTypeMessageEventModel)));
                    }
                    if (!this.MessageTypeID.HasValue)
                    {
                        resultOperation.AddError(SharedLang.GetReuired(nameof(sysBpmsEvent.MessageTypeID), nameof(sysBpmsEvent)));
                    }
                }
                break;

            default:
                break;
            }
            return(resultOperation);
        }
Beispiel #4
0
 public override void IsValid(ResultOperation resultOperation)
 {
     if (this.IsRequired && string.IsNullOrWhiteSpace(this.Value?.ToStringObj()))
     {
         resultOperation.AddError(string.Format("کاربر گرامی مقدار فیلد {0} الزامی میباشد", this.Label));
     }
 }
 public override void IsValid(ResultOperation resultOperation)
 {
     if (!this.Value.ToBoolObj())
     {
         resultOperation.AddError("کاربر گرامی کد امنیتی نا معتبر میباشد.");
     }
 }
Beispiel #6
0
 public override void IsValid(ResultOperation resultOperation)
 {
     if (!this.Validate())
     {
         resultOperation.AddError("Incorrect CAPTCHA");
     }
 }
        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(string designJson)
        {
            this.DesignJson = designJson;
            ResultOperation resultOperation = new ResultOperation();

            if (this.DesignJson != null && this.DesignJson.LastIndexOf("\"subtype\":\"threadTaskDescription\"") != this.DesignJson.IndexOf("\"subtype\":\"threadTaskDescription\""))
            {
                resultOperation.AddError(LangUtility.Get("DescriptionError.Text", nameof(sysBpmsDynamicForm)));
            }
            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);
        }
Beispiel #10
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 ResultOperation Update(string name, bool isActive, List <MessageTypeParamsModel> paramsXML)
        {
            paramsXML = paramsXML?.Where(c => !string.IsNullOrWhiteSpace(c.Name)).ToList();
            ResultOperation resultOperation = new ResultOperation();

            this.Name      = name;
            this.IsActive  = isActive;
            this.ParamsXML = paramsXML.BuildXml() ?? "";
            if (paramsXML?.GroupBy(c => c.Name).Any(c => c.Count() > 1) ?? false)
            {
                resultOperation.AddError(LangUtility.Get("SameName.Text", nameof(sysBpmsMessageType)));
            }
            return(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);
        }
Beispiel #13
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);
        }