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(); }
private void TableNameTextBox_Validated(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(TableNameTextBox.Text)) { FormNameTextBox.Text = TableNameTextBox.Text; _parms.FormName = FormNameTextBox.Text; TableVarNameTextBox.Text = AxHelper.GetVarNameFromType(TableNameTextBox.Text.Trim()); _parms.TableVarName = TableVarNameTextBox.Text; if (!_parms.IsExternalEDT) { PrimaryKeyEDTTextBox.Text = $@"{TableNameTextBox.Text}Id"; _parms.PrimaryKeyEdtName = PrimaryKeyEDTTextBox.Text; } FieldNameTextBox.Text = $@"{AxHelper.UppercaseWords(TableVarNameTextBox.Text)}Id"; _parms.KeyFieldName = FieldNameTextBox.Text; } }
void SrcParmMethod(DataContractBuilderVar parmVar) { string mName = $"parm{AxHelper.UppercaseWords(parmVar.Name)}"; CodeGenerate.SetMethodName(mName); CodeGenerate.AppendLine("["); CodeGenerate.IndentIncrease(); CodeGenerate.ProcessLastSym(","); CodeGenerate.Append($"DataMemberAttribute(identifierStr({AxHelper.UppercaseWords(parmVar.Name)}))"); if (!String.IsNullOrEmpty(parmVar.Label)) { CodeGenerate.ProcessLastSym(","); CodeGenerate.Append($"SysOperationLabelAttribute(literalstr(\"{parmVar.Label}\"))"); } if (!String.IsNullOrEmpty(parmVar.LabelHelp)) { CodeGenerate.ProcessLastSym(","); CodeGenerate.Append($"SysOperationHelpTextAttribute(literalstr(\"{parmVar.LabelHelp}\"))"); } if (!String.IsNullOrEmpty(parmVar.GroupName)) { CodeGenerate.ProcessLastSym(","); CodeGenerate.Append($"SysOperationGroupMemberAttribute('{parmVar.GroupName}')"); } if (parmVar.PositionInGroup > 0) { CodeGenerate.ProcessLastSym(","); CodeGenerate.Append($"SysOperationDisplayOrderAttribute('{parmVar.PositionInGroup.ToString()}')"); } CodeGenerate.AppendLine("").IndentDecrease(); CodeGenerate.AppendLine("]"); 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(); }