//public void AddField(DataRow row, // short npp, string resName,string xlsName,bool isPrint, // string type, short size, bool isPos, // attrName attr=0,bool isActive = true) public void AddField(DataRow row) { attrName attr = (attrName)row["attr"]; bool isPrint = (bool)row["isPrint"]; idHead = (int)row["idHead"]; if (this.Count == 0) { printAllFields = false; } if ((row["resName"].ToString() == "*") && (attr == attrName.Const)) { if ((row["xlsName"].ToString() == "*") && isPrint) { printAllFields = true; } return; } FieldBase newField = null; switch (attr) { case attrName.Answer: newField = new FieldAnswer(row, this); break; case attrName.Const: newField = new FieldConst(row, this); break; case attrName.Expr: newField = new FieldExpr(row, this); break; case attrName.Func: newField = new FieldFunc(row, this); ((FieldFunc)newField).onInitProgressBar += this.onInitProgressBar; ((FieldFunc)newField).onStepProgressBar += this.onStepProgressBar; ((FieldFunc)newField).onHideProgressBar += this.onHideProgressBar; break; case attrName.System: newField = new FieldSystem(row, this); break; case attrName.Myltiply: newField = new FieldMultiply(row, this); break; default: newField = new FieldXls(row, this); break; } if (newField != null) { this.Add(newField); } }
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 ); } }