Beispiel #1
0
        //pb表达式转换为前台代码 Grid
        public void ConvertExpressionGrid(IList <PbExpressionImp> PbImps, string type, string colname, string tablename)
        {
            string expression = string.Empty;
            string temptype   = string.Empty;

            foreach (var PbImp in PbImps)
            {
                try
                {
                    temptype = type;
                    switch (PbImp.ExpressionType)
                    {
                    case PbExpressionType.ComputeFuncAndFillSpecificCol:
                    {
                        ComputeFuncFillSpecificColExp colExp = new ComputeFuncFillSpecificColExp(PbImp);
                        expression = colExp.GetCodeFromExpGrid(tableRelation, colRelation, colname, tablename);
                        break;
                    }

                    case PbExpressionType.ComputeSqlAndFillSpecificCol:
                    {
                        ComputeSqlFillSpecificColExp colExp = new ComputeSqlFillSpecificColExp(PbImp);
                        expression = colExp.GetCodeFromExpGrid(tableRelation, colRelation, colname, tablename);
                        break;
                    }

                    case PbExpressionType.ComputeExpAndDisBodyCol:
                    {
                        ComputeExpDisBodyColExp colExp = new ComputeExpDisBodyColExp(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation, colRelation, colname);
                        break;
                    }

                    case PbExpressionType.ExecuteSql:
                    {
                        ExecuteSqlExp colExp = new ExecuteSqlExp(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation);
                        break;
                    }

                    case PbExpressionType.BillHeadUniqueCheck:
                    {
                        BillHeadUniqueCheck colExp = new BillHeadUniqueCheck(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation, colRelation);
                        break;
                    }

                    case PbExpressionType.CheckBodyUnique:
                    {
                        CheckBodyUnique colExp = new CheckBodyUnique(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation);
                        break;
                    }

                    case PbExpressionType.BillValidation:
                    {
                        if (PbImp.Expression.Split(',').Length > 3)
                        {
                            BillValidationComplexExp colExp = new BillValidationComplexExp(PbImp);
                            expression = colExp.GetCodeFromExp(tableRelation, colRelation, colname);
                            temptype   = "BeforeSave";
                        }
                        else
                        {
                            if (PbImp.Expression.Split(',')[2] == "1")
                            {
                                temptype = "Normal";
                            }
                            else
                            {
                                temptype = "BeforeSave";
                            }
                            BillValidationExp colExp = new BillValidationExp(PbImp);
                            expression = colExp.GetCodeFromExp(tableRelation);
                        }
                        break;
                    }

                    case PbExpressionType.ComputeSqlAndFillSpecificBodyCol:
                    {
                        ComputeSqlFillSpecificBodyColExp colExp = new ComputeSqlFillSpecificBodyColExp(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation, colRelation, colname);
                        break;
                    }

                    case PbExpressionType.ComputeExpAndFillSpecificCol:
                    {
                        ComputeExpAndFillSpecificCol colExp = new ComputeExpAndFillSpecificCol(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation, colRelation, colname);
                        temptype   = "Normal";       //"Supcan"; comment by ljy 2016.12.10 事件暂时不支持函数
                        break;
                    }

                    case PbExpressionType.IsReadOnly:
                    {
                        IsReadOnlyExp colExp = new IsReadOnlyExp(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation, colRelation, colname);
                        break;
                    }

                    default:
                        break;
                    }
                }
                catch (Exception e)
                {
                    Logger.Error("ConvertExpression: type:" + PbImp.ExpressionType.ToString() + "\r\n" + e.StackTrace);
                }


                if (!string.IsNullOrEmpty(expression) && !expressions.ContainsKey(expression))
                {
                    expressions.Add(expression, temptype);
                }
            }
        }
Beispiel #2
0
        //pb表达式转换为前台代码
        public void ConvertExpression(IList <PbExpressionImp> PbImps, String type, string colname)
        {
            string expression = string.Empty;
            string temptype   = string.Empty;

            foreach (var PbImp in PbImps)
            {
                temptype = type;
                switch (PbImp.ExpressionType)
                {
                case PbExpressionType.ComputeFuncAndFillSpecificCol:
                {
                    ComputeFuncFillSpecificColExp colExp = new ComputeFuncFillSpecificColExp(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation);
                    break;
                }

                case PbExpressionType.ComputeSqlAndFillSpecificCol:
                {
                    ComputeSqlFillSpecificColExp colExp = new ComputeSqlFillSpecificColExp(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation);
                    break;
                }

                case PbExpressionType.ComputeExpAndDisBodyCol:
                {
                    ComputeExpDisBodyColExp colExp = new ComputeExpDisBodyColExp(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation);
                    break;
                }

                case PbExpressionType.ExecuteSql:
                {
                    ExecuteSqlExp colExp = new ExecuteSqlExp(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation);
                    break;
                }

                case PbExpressionType.BillHeadUniqueCheck:
                {
                    BillHeadUniqueCheck colExp = new BillHeadUniqueCheck(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation, colRelation);
                    break;
                }

                case PbExpressionType.CheckBodyUnique:
                {
                    CheckBodyUnique colExp = new CheckBodyUnique(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation);
                    break;
                }

                case PbExpressionType.BillValidation:
                {
                    if (PbImp.Expression.Split(',').Length > 3)
                    {
                        BillValidationComplexExp colExp = new BillValidationComplexExp(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation);
                        temptype   = "BeforeSave";
                    }
                    else
                    {
                        if (PbImp.Expression.Split(',')[2] == "1")
                        {
                            temptype = "Normal";
                        }
                        else
                        {
                            temptype = "BeforeSave";
                        }
                        BillValidationExp colExp = new BillValidationExp(PbImp);
                        expression = colExp.GetCodeFromExp(tableRelation);
                    }
                    break;
                }

                case PbExpressionType.ComputeSqlAndFillSpecificBodyCol:
                {
                    ComputeSqlFillSpecificBodyColExp colExp = new ComputeSqlFillSpecificBodyColExp(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation, colRelation, colname);
                    break;
                }

                case PbExpressionType.ComputeExpAndFillSpecificCol:
                {
                    ComputeExpAndFillSpecificCol colExp = new ComputeExpAndFillSpecificCol(PbImp);
                    expression = colExp.GetCodeFromExp(tableRelation);
                    temptype   = "Supcan";
                    break;
                }

                default:
                    break;
                }
                if (!string.IsNullOrEmpty(expression) && !expressions.ContainsKey(expression))
                {
                    expressions.Add(expression, temptype);
                }
            }
        }