//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 String initFilds() { string result = String.Empty; FullName = xlsName; try { xlsName = FieldFunc.getFuncName(FullName); string[] param = FullName.Split('('); NameVal1 = param[1].Split(',')[0].Trim(); Type = Type.GetType(String.Format( "System.{0}", param[1].Split(',')[1].Split(')')[0].Trim() )); NameVal2 = param[2].Split(',')[0].Trim(); Type2 = Type.GetType(String.Format( "System.{0}", param[2].Split(',')[1].Split(')')[0].Trim() )); } catch (Exception e) { result = e.Source; } return(result); }
public ParamAnswer(string paramName, string outName, FieldFunc ownField, FieldBase field) : this(paramName, outName, ownField) { if (field != null) { Field = field; ((FieldAnswer)field).Param = this; } }
public ParamToSql(string paramName, string outName, FieldFunc ownField, FieldBase field) : base(paramName, outName, ownField) { Field = field; if (field.GetType() == typeof(FieldMultiply)) { XlsExist = true; } else { XlsExist = Field.Exist; } }
public FieldSystem(DataRow row, Scan scan) : base(row, scan) { if (xlsName == Scan.ROW_ID) { isField = true; isRowId = true; Type = Type.GetType("System.Int32"); } else if ((ResName.Length >= Scan.SHEMA.Length) && (ResName.Substring(0, Scan.SHEMA.Length) == Scan.SHEMA)) { isShema = true; funcName = FieldFunc.getFuncName(xlsName); } }
public ParamSys(string paramName, string outName, FieldFunc ownField) : base(paramName, outName, ownField) { Service = true; if (!Enum.IsDefined(typeof(serviseFields), outName)) { Error = String.Format("not a system field", outName); } else { XlsExist = true; if (outName == serviseFields.IP.ToString()) { SysValue = Scan.GetLocalIPByte(); strValue = Scan.GetLocalIPAddress(true); } } }
public ParamBase(string paramName, string outName, FieldFunc ownField) : this(paramName, outName) { OwnField = ownField; }
public ParamToSql(string paramName, string outName, FieldFunc ownField) : base(paramName, outName, ownField) { }
// public ParamGroup(string sqlParam, string tmplParam, public ParamGroup(string sqlParam, string tmplPatam, GroupNames paramGroup, List <FieldBase> fields, FieldFunc ownField) { string[] sqlArray = sqlParam.Split(')')[0].Split(new Char[] { ' ', ',' }); string[] paramArray = tmplPatam.Split(new Char[] { ' ', ',', ')' }); GroupName = paramGroup.ToString(); for (int i = 0; i < sqlArray.Length; i++) { if (i >= paramArray.Length) { msgError += String.Format(";missed param. {0}", sqlArray[i]); if (GroupNames.outPar != paramGroup) { AllFound = false; } break; } string resName = paramArray[i]; if (paramGroup == GroupNames.outPar) { resName = String.Format("{0}.{1}", ownField.ResName, resName); } FieldBase field = fields.Find(x => (x.ResName == resName) & (x.Attr != attrName.Myltiply)); if (field == null) { var multyFiels = fields.FindAll(x => x.Attr == attrName.Myltiply); field = multyFiels.Find(x => (x as FieldMultiply).NameVal1 == resName | (x as FieldMultiply).NameVal2 == resName); } bool isSystem = !paramArray[i].Any(Char.IsLower); if ((field == null) && !isSystem) { msgError += String.Format(";missed field {0}", paramArray[i]); if (GroupNames.outPar != paramGroup) { AllFound = false; } continue; } ParamBase newParam = null; switch (paramGroup) { case GroupNames.outPar: newParam = new ParamAnswer(paramArray[i], sqlArray[i], ownField, field); break; default: if (isSystem) { newParam = new ParamSys(paramArray[i], sqlArray[i], ownField); } else { newParam = new ParamToSql(paramArray[i], sqlArray[i], ownField, field); } break; } if (newParam != null) { Add(newParam); } } if ((paramGroup != GroupNames.outPar) && AllFound) { foreach (ParamBase param in this) { if (!param.XlsExist) { AllFound = false; break; } } } }
public ParamAnswer(string paramName, string outName, FieldFunc ownField) : base(paramName, outName, ownField) { }