Beispiel #1
0
        public void InitResTable(Scan scan)
        {
            var resField = scan.FindAll(x => x.IsPrint & x.IsActive);

            ResTable = new DataTable();
            foreach (FieldXls field in resField)
            {
                if (field.Attr == attrName.Field)
                {
                    ResTable.Columns.Add(field.ResName, typeof(String));
                }
                else if ((field.Attr == attrName.Answer) & (field.ResName.IndexOf(".") > 0))
                {
                    ResTable.Columns.Add(field.ResName.Split('.')[1], typeof(String));
                }
            }
        }
Beispiel #2
0
        public void initSQLParameter(List <FieldBase> fields) //parseSQLParameter
        {
            if (FunctionName == "")
            {
                return;
            }

            string[] nameSplit = xlsName.Split('(');

            var fieldSystem = Scan.FindAll(x => (x.Attr == attrName.System));

            FieldSystem field = null;

            if (fieldSystem != null)
            {
                field = (FieldSystem)fieldSystem.Find(x => ((FieldSystem)x).isShema & (((FieldSystem)x).funcName == FunctionName));
            }

            DataTable impStructure = null;

            if (field != null)
            {
                string[] shema = field.XlsName.Split('(');
                impStructure = getShema();

                for (int i = 0; i < Enum.GetNames(typeof(GroupNames)).Length; i++)
                {
                    string fieldName = ((GroupNames)i).ToString();
                    if (i == 0)
                    {
                        DataRow row = impStructure.Rows.Add();
                        row[fieldName] = tabName;
                    }
                    else
                    {
                        impStructure.Rows[0][fieldName] = shema[i].Split(')')[0];
                    }
                }
            }
            else
            {
                impStructure = SQLFunction.getFuncDescription(FunctionName);
            }

            if (impStructure.Rows.Count == 0)
            {
                return;
            }
            SQLTableName = impStructure.Rows[0][SqlParam[GroupNames.inTable]].ToString(); // impStructure[1][index].Trim();

            if (impStructure.Columns.Contains(SqlParam[GroupNames.tabFields]))
            {
                ParamsField = new ParamGroup(
                    impStructure.Rows[0][SqlParam[GroupNames.tabFields]].ToString(),
                    nameSplit[1].Trim(),
                    GroupNames.tabFields,
                    Scan.FindAll(x => ((x.Attr == attrName.Field) || (x.Attr == attrName.Const) || (x.Attr == attrName.Myltiply)) && x.IsActive),
                    this
                    );
            }

            if (impStructure.Columns.Contains(SqlParam[GroupNames.inPar]))
            {
                ParamsIn = new ParamGroup(
                    impStructure.Rows[0][SqlParam[GroupNames.inPar]].ToString(),
                    nameSplit[2].Trim(),
                    GroupNames.inPar,
                    Scan.FindAll(x => ((x.Attr == attrName.Field) || (x.Attr == attrName.Const)) && x.IsActive),
                    this
                    );
            }

            if (impStructure.Columns.Contains(SqlParam[GroupNames.outPar]))
            {
                ParamsOut = new ParamGroup(
                    impStructure.Rows[0][SqlParam[GroupNames.outPar]].ToString(),
                    nameSplit[3].Trim(),
                    GroupNames.outPar,
                    Scan.FindAll(x => (x.Attr == attrName.Answer) && x.IsActive),
                    this
                    );
            }
        }