Ejemplo n.º 1
0
        private SOARolePropertyRowCollection MergeActivityRowPropertiesByOperators(IEnumerable <string> operators)
        {
            SOARolePropertyRowCollection result = new SOARolePropertyRowCollection();

            int index      = 0;
            int activitySN = this.Values.GetValue(SOARolePropertyDefinition.ActivitySNColumn, 0);

            foreach (string op in operators)
            {
                SOARolePropertyRow newRow = new SOARolePropertyRow(this, 0);

                if (this.GetPropertyDefinitions().MatrixType == WfMatrixType.ActivityMatrix)
                {
                    SOARolePropertyValue pv = newRow.Values.Find(v => string.Compare(v.Column.Name, SOARolePropertyDefinition.ActivitySNColumn, true) == 0);

                    if (pv == null)
                    {
                        pv = new SOARolePropertyValue(this.GetPropertyDefinitions()[SOARolePropertyDefinition.ActivitySNColumn]);
                        newRow.Values.Add(pv);
                    }

                    pv.Value = string.Format("{0}.{1:0000}", activitySN, ++index);
                }

                newRow.OperatorType = SOARoleOperatorType.User;
                newRow.Operator     = op;

                result.Add(newRow);
            }

            return(result);
        }
        private static string PrepareRowSql(string roleID, SOARolePropertyRow row)
        {
            InsertSqlClauseBuilder builder = ORMapping.GetInsertSqlClauseBuilder(row);

            builder.AppendItem("ROLE_ID", roleID);

            return("INSERT INTO WF.ROLE_PROPERTIES_ROWS" + builder.ToSqlString(TSqlBuilder.Instance));
        }
        private static string PrepareValueSql(string roleID, SOARolePropertyRow row, SOARolePropertyValue propValue)
        {
            InsertSqlClauseBuilder builder = ORMapping.GetInsertSqlClauseBuilder(propValue);

            builder.AppendItem("ROLE_ID", roleID);
            builder.AppendItem("PROPERTIES_ROW_ID", row.RowNumber);
            builder.AppendItem("PROPERTY_NAME", propValue.Column.Name);

            return("INSERT INTO WF.ROLE_PROPERTIES_CELLS" + builder.ToSqlString(TSqlBuilder.Instance));
        }
Ejemplo n.º 4
0
        private SOARolePropertyRowCollection MergeActivityRowPropertiesByRows(SOARolePropertyRowCollection subExtractedRows)
        {
            SOARolePropertyRowCollection result = new SOARolePropertyRowCollection();

            foreach (SOARolePropertyRow subRow in subExtractedRows)
            {
                SOARolePropertyRow newRow = new SOARolePropertyRow(this.Role);

                newRow.Values.CopyFrom(this.Values);
                newRow.OperatorType = subRow.OperatorType;
                newRow.Operator     = subRow.Operator;

                result.Add(newRow);
            }

            return(result);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 从一个已经存在的行构造
        /// </summary>
        /// <param name="templateRow"></param>
        /// <param name="rowNumber"></param>
        public SOARolePropertyRow(SOARolePropertyRow templateRow, int rowNumber)
        {
            templateRow.NullCheck("templateRow");

            this.Role         = templateRow.Role;
            this.RowNumber    = rowNumber;
            this.OperatorType = templateRow.OperatorType;
            this.Operator     = templateRow.Operator;

            foreach (SOARolePropertyValue srv in templateRow.Values)
            {
                SOARolePropertyValue newSrv = new SOARolePropertyValue(srv.Column);

                newSrv.Value = srv.Value;

                this.Values.Add(newSrv);
            }
        }
Ejemplo n.º 6
0
        private static OguDataCollection <IUser> CalculateRowOperators()
        {
            OguDataCollection <IUser> result = new OguDataCollection <IUser>();

            if (ObjectContextCache.Instance.ContainsKey("RoleMatrixCurrentRow"))
            {
                SOARolePropertyRow row = (SOARolePropertyRow)ObjectContextCache.Instance["RoleMatrixCurrentRow"];

                SOARolePropertyRowCollection rows = new SOARolePropertyRowCollection();
                rows.Add(row);

                SOARolePropertyRowUsersCollection rowsUsers = rows.GenerateRowsUsers();

                rowsUsers.ForEach(ru => result.CopyFrom(ru.Users));
            }

            return(result);
        }
        /// <summary>
        /// 根据RoleID加载行信息
        /// </summary>
        /// <param name="roleID"></param>
        /// <param name="role"></param>
        /// <param name="definition">列定义</param>
        /// <returns></returns>
        public SOARolePropertyRowCollection LoadByRoleID(string roleID, IRole role, SOARolePropertyDefinitionCollection definition)
        {
            roleID.CheckStringIsNullOrEmpty("roleID");
            definition.NullCheck("definition");

            StringBuilder strB = new StringBuilder();

            strB.AppendFormat("SELECT * FROM WF.ROLE_PROPERTIES_ROWS WHERE {0} ORDER BY ROW_NUMBER", roleID.ToRoleIDCriteria());

            strB.Append(TSqlBuilder.Instance.DBStatementSeperator);

            strB.AppendFormat("SELECT * FROM WF.ROLE_PROPERTIES_CELLS WHERE {0} ORDER BY PROPERTIES_ROW_ID", roleID.ToRoleIDCriteria());

            SOARolePropertyRowCollection result = new SOARolePropertyRowCollection(role);

            using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Suppress))
            {
                DataSet ds = DbHelper.RunSqlReturnDS(strB.ToString(), GetConnectionName());
                Dictionary <int, SOARolePropertyValueCollection> propertyValues = SOARolePropertyValueCollection.LoadAndGroup(ds.Tables[1].DefaultView, definition);

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    SOARolePropertyRow property = new SOARolePropertyRow(role);

                    ORMapping.DataRowToObject(row, property);

                    SOARolePropertyValueCollection values = null;

                    if (propertyValues.TryGetValue(property.RowNumber, out values))
                    {
                        property.Values.CopyFrom(values);
                    }

                    result.Add(property);
                }
            }

            return(result);
        }
 public SOARolePropertyRowUsers(SOARolePropertyRow rolePropertyRow)
 {
     Row = rolePropertyRow;
 }
Ejemplo n.º 9
0
 public SOARolePropertyRowRoles(SOARolePropertyRow rolePropertyRow)
 {
     Row = rolePropertyRow;
 }