示例#1
0
        private void CreateRowOperators(IInputData input, IOperateRight operateRight,
                                        IEnumerable <OperatorConfig> allOperators)
        {
            var rowOperators = from item in allOperators
                               where item.Position == OperatorPosition.Row
                               select new Operator(item, this, input, MainResolver.GetKeyFieldArray());
            DataTable operTable = rowOperators.CreateTable("RowOperator");

            if (operTable == null)
            {
                return;
            }

            DataSet.Tables.Add(operTable);

            string rightStr = string.Empty;

            if (operateRight == null)
            {
                var rowRights = from item in rowOperators
                                select item.Id;
                rightStr = string.Format(ObjectUtil.SysCulture, "|{0}|", string.Join("|", rowRights));
            }
            DataTable  table          = DataSet.Tables[FillTableName];
            DataColumn operatorColumn = table.Columns.Add("_OPERATOR_RIGHT");

            foreach (DataRow row in table.Rows)
            {
                if (operateRight == null)
                {
                    row[operatorColumn] = rightStr;
                }
                else
                {
                    var args = new OperateRightEventArgs(input.Style, input.SourceInfo.Source, row);
                    IEnumerable <string> rights = operateRight.GetOperator(args);
                    if (rights != null)
                    {
                        rightStr = string.Join("|", rights);
                        if (!string.IsNullOrEmpty(rightStr))
                        {
                            row[operatorColumn] = "|" + rightStr + "|";
                        }
                    }
                }
            }
        }
示例#2
0
 protected virtual void CreateListOperators(IInputData input, ref IOperateRight operateRight)
 {
     if (Operators != null)
     {
         IEnumerable <Operator> listOpertors = null;
         operateRight = Operators.Right.CreateObject();
         if (operateRight == null)
         {
             var allOpertors = Operators.Operators;
             if (allOpertors != null)
             {
                 listOpertors = from item in allOpertors
                                where item.Position == OperatorPosition.Global
                                select new Operator(item, this, input, MainResolver.GetKeyFieldArray());
             }
         }
         else
         {
             IEnumerable <string> rights = operateRight.GetOperator(
                 new OperateRightEventArgs(input.Style, input.SourceInfo.Source, null));
             var allOpertors = Operators.Operators;
             if (rights != null && allOpertors != null)
             {
                 listOpertors = from item in allOpertors
                                join right in rights on item.Id equals right
                                where item.Position == OperatorPosition.Global
                                select new Operator(item, this, input, MainResolver.GetKeyFieldArray());
             }
         }
         if (listOpertors != null)
         {
             DataTable table = listOpertors.CreateTable("ListOperator");
             if (table != null)
             {
                 DataSet.Tables.Add(table);
             }
         }
     }
 }