Пример #1
0
        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);
            }
        }
        public override void InitFromSnippetsParms(SnippetsParms snippetsParms)
        {
            ClassName = snippetsParms.GetParmStr(ClassNameParm);
            GenerateReportController = snippetsParms.GetParmBool(GenerateReportControllerParm);
            GenerateReportDP         = snippetsParms.GetParmBool(GenerateReportDPParm);
            ReportDPTableName        = snippetsParms.GetParmStr(ReportDPTableNameParm);
            if (String.IsNullOrWhiteSpace(ReportDPTableName))
            {
                ReportDPTableName = "TableTemDB";
            }
            ReportDPTableVarName = AxHelper.GetVarNameFromType(ReportDPTableName);
            string baseStr = ClassName;

            if (ClassName.ToLower().EndsWith("contract"))
            {
                baseStr = ClassName.Substring(0, ClassName.Length - "contract".Length);
            }
            ClassNameDP         = $"{baseStr}DP";
            ClassNameController = $"{baseStr}Controller";

            List <List <string> > parmList = snippetsParms.GetParmListSeparated(ParametersParmName);

            FieldsList = new List <DataContractBuilderVar>();
            GroupsList = new List <DataContractBuilderVar>();
            int groupNum = 0;

            IsAnyMandatory = false;

            Dictionary <string, int> groutPosDict = new Dictionary <string, int>();

            foreach (List <string> subList in parmList)
            {
                DataContractBuilderVar builderVar = new DataContractBuilderVar();

                string item = subList[0];
                if (item[item.Length - 1] == MandatoryPropertySym)//check mandatory
                {
                    builderVar.IsMandatory = true;
                    builderVar.Type        = item.Remove(item.Length - 1).Trim();
                }
                else
                {
                    builderVar.IsMandatory = false;
                    builderVar.Type        = item;
                }

                if (String.IsNullOrEmpty(builderVar.Type))
                {
                    throw new Exception("Type should be specified");
                }

                if (subList.Count > 1 && !String.IsNullOrWhiteSpace(subList[1]))  //check var name
                {
                    builderVar.Name = subList[1];
                }
                else
                {
                    builderVar.Name = AxHelper.GetVarNameFromType(builderVar.Type);
                }
                if (subList.Count > 2 && !String.IsNullOrWhiteSpace(subList[2]))
                {
                    builderVar.Label = subList[2];
                }
                if (subList.Count > 3 && !String.IsNullOrWhiteSpace(subList[3]))
                {
                    builderVar.LabelHelp = subList[3];
                }
                if (subList.Count > 4 && !String.IsNullOrWhiteSpace(subList[4]))
                {
                    builderVar.GroupName = subList[4];
                }
                if (subList.Count > 5 && !String.IsNullOrWhiteSpace(subList[5]))
                {
                    builderVar.GroupLabel = subList[5];
                }

                //calculate
                if (!groutPosDict.ContainsKey(builderVar.GroupName))
                {
                    groutPosDict.Add(builderVar.GroupName, 0);
                    if (!String.IsNullOrWhiteSpace(builderVar.GroupName))
                    {
                        groupNum++;
                        var varGr = new DataContractBuilderVar
                        {
                            GroupName       = builderVar.GroupName,
                            GroupLabel      = builderVar.GroupLabel,
                            PositionInGroup = groupNum
                        };
                        GroupsList.Add(varGr);
                    }
                }
                groutPosDict[builderVar.GroupName]++;
                if (builderVar.IsMandatory)
                {
                    IsAnyMandatory = true;
                }

                builderVar.PositionInGroup = groutPosDict[builderVar.GroupName];

                FieldsList.Add(builderVar);
            }
        }
Пример #3
0
 public void InitFromSnippetsParms(SnippetsParms snippetsParms)
 {
     Table1Var  = snippetsParms.GetParmStr(Table1VarParm);
     Table2Var  = snippetsParms.GetParmStr(Table2VarParm);
     IsUseQuery = snippetsParms.GetParmBool(IsUseQueryParm);
 }