public override void InitFromSnippetsParms(SnippetsParms snippetsParms) { ClassName = snippetsParms.GetParmStr(ClassNameParm); ClassDescription = snippetsParms.GetParmStr(DescriptionParmName); QueryTable = snippetsParms.GetParmStr(QueryTableParmName); ExternalTable = snippetsParms.GetParmStr(ExternalTableNameParmName); IsAddFileUpload = snippetsParms.GetParmBool(AddFileUploadParmName); IsCreateMenuItem = snippetsParms.GetParmBool(CreateMenuItemParmName); if (ExternalTable != "") { ExternalTableVar = new RunBaseBuilderVar(); ExternalTableVar.Type = ExternalTable; ExternalTableVar.Name = $"caller{ExternalTable}"; } List <List <string> > parmList = snippetsParms.GetParmListSeparated(ParametersParmName); FieldsList = new List <RunBaseBuilderVar>(); foreach (List <string> subList in parmList) { RunBaseBuilderVar runBaseBuilderVars = new RunBaseBuilderVar(); string item = subList[0]; if (item[item.Length - 1] == MandatoryPropertySym)//check mandatory { runBaseBuilderVars.IsMandatory = true; runBaseBuilderVars.Type = item.Remove(item.Length - 1).Trim(); } else { runBaseBuilderVars.IsMandatory = false; runBaseBuilderVars.Type = item; } if (String.IsNullOrEmpty(runBaseBuilderVars.Type)) { throw new Exception("Type should be specified"); } if (subList.Count > 1 && !String.IsNullOrWhiteSpace(subList[1])) //check var name { runBaseBuilderVars.Name = subList[1]; } else { runBaseBuilderVars.Name = AxHelper.GetVarNameFromType(runBaseBuilderVars.Type); } if (subList.Count > 2 && !String.IsNullOrWhiteSpace(subList[2])) { runBaseBuilderVars.Label = subList[2]; } if (subList.Count > 3 && !String.IsNullOrWhiteSpace(subList[3])) { runBaseBuilderVars.LabelHelp = subList[3]; } runBaseBuilderVars.DlgName = $"dlg{AxHelper.UppercaseWords(runBaseBuilderVars.Name)}"; FieldsList.Add(runBaseBuilderVars); } }
void SrcParmMethod(RunBaseBuilderVar parmVar) { string mName = $"parm{AxHelper.UppercaseWords(parmVar.Name)}"; CodeGenerate.SetMethodName(mName); CodeGenerate.AppendLine($"public {parmVar.Type} {mName}({parmVar.Type} _{parmVar.Name} = {parmVar.Name})"); CodeGenerate.BeginBlock(); CodeGenerate.AppendLine($"{parmVar.Name} = _{parmVar.Name};"); CodeGenerate.AppendLine($"return {parmVar.Name};"); CodeGenerate.EndBlock(); }