public void CanRemoveNotExistingFirstAnLastChars(string source)
        {
            var res = CommonParser.RemoveFirstAndLast(source, '\'', '\'');

            Assert.False(string.IsNullOrEmpty(res));
            Assert.False(res.Contains("'"));
        }
Example #2
0
        private K PrepareResponse <T, K>(T request, HttpContext context, HttpRequest httpRequest, HttpResponse httpResponse)
            where T : ObsWebServiceRequest
            where K : ObsWebServiceResponse
        {
            K response;

            httpResponse.RequestUrl = httpRequest.GetUrlWithoutQuerys();
            IParser    iparser      = this.GetIParser(context);
            Type       responseType = typeof(K);
            MethodInfo info         = CommonUtil.GetParseMethodInfo(responseType, iparser);

            if (info != null)
            {
                response = info.Invoke(iparser, new object[] { httpResponse }) as K;
            }
            else
            {
                ConstructorInfo cinfo = responseType.GetConstructor(new Type[] { });
                response = cinfo.Invoke(null) as K;
            }
            if (response == null)
            {
                throw new ObsException(string.Format("Cannot parse HttpResponse to {0}", responseType), ErrorType.Sender, "Parse error", "");
            }
            CommonParser.ParseObsWebServiceResponse(httpResponse, response, this.httpClient.GetIHeaders(context));
            response.HandleObsWebServiceRequest(request);
            return(response);
        }
Example #3
0
        private IEnumerable <ClassInfo> ParseClassInfo(XElement clazzElement)
        {
            var clazz = new ClassInfo
            {
                ClassType = ParseClassType(clazzElement),
                ClassName = clazzElement.GetAttributeValue("name"),
                Extends   = clazzElement.TryGetAttributeValue("extends"),
            };

            var clazzProp = CommonParser.ParseProperty(clazz, clazzElement);

            clazzProp.Remove("extends");

            clazz.OwnProperty.AddAttributes(clazzProp);
            clazz.OwnProperty.TagName = clazzElement.Name.LocalName;
            if (clazz.ClassType != ClassType.SubClass)
            {
                clazz.OwnProperty.AddDefault("table", clazz.ClassName);
            }

            foreach (var element in clazzElement.Elements())
            {
                if (classTypes.ContainsKey(element.Name.LocalName))
                {
                    yield return(ParseClassInfo(element).FirstOrDefault());
                }
                else
                {
                    clazz.AddChildProperty(GetPropertyParser(element).Parse(clazz, element));
                }
            }

            yield return(clazz);
        }
Example #4
0
    internal static LatestInProfileUpdate?Parse(HtmlNode node, ListEntryType listEntryType)
    {
        var selector = listEntryType switch
        {
            ListEntryType.Anime => AnimeSelector,
            ListEntryType.Manga => MangaSelector,
            _ => throw new ArgumentOutOfRangeException(nameof(listEntryType), listEntryType, null)
        };
        var dataNode = node.SelectSingleNode(selector);

        if (dataNode == null)
        {
            return(null);
        }
        var hd = new HtmlDocument();

        hd.LoadHtml(dataNode.InnerHtml);
        dataNode = hd.DocumentNode;
        var link              = dataNode.SelectSingleNode("//a").Attributes["href"].Value;
        var id                = CommonParser.ExtractIdFromMalUrl(link);
        var dataText          = dataNode.SelectSingleNode("//div[1]/div[2]").InnerText.Trim();
        var splitted          = dataText.Split(Constants.DOT);
        var progressTypeValue = splitted[0].Trim();
        var scoreText         = splitted[1].Trim();
        var index             = progressTypeValue.IndexOfAny(Numbers);
        var progressValue     = 0;
        var progress          = GenericProgress.Unknown;

        if (index == -1)
        {
            progress = ProgressParser.Parse(progressTypeValue);
        }
        else
        {
            progress = ProgressParser.Parse(progressTypeValue.Substring(0, index - 1).Trim());
            var length = progressTypeValue.IndexOf('/') - index;
            if (length > 0)
            {
                progressValue = int.Parse(progressTypeValue.Substring(index, length));
            }
        }

        var score = 0;

        if (!scoreText.Contains('-'))
        {
            var scoreIndex = scoreText.LastIndexOf(' ');
            score = int.Parse(scoreText.Substring(scoreIndex));
        }

        return(new()
        {
            Id = id,
            Progress = progress,
            ProgressValue = progressValue,
            Score = score
        });
    }
}
Example #5
0
        protected void ProcessChannel(Channel channel)
        {
            //export data
            CommonParser <CanonChannelMonitor> export = ImportFactory.GetParser(
                (Canon.Data.Enums.ChannelTypeEnum)channel.InfoType,
                channel.ChannelId,
                channel.Url,
                CanonConfigManager.UploadDataFolder,
                channel.AdditionalCommand);

            export.Logger = logger;
            if (!export.ExportToDb())
            {
                return;
            }

            logger.Info(string.Format("Export to DB finished."));

            try
            {
                CanonChannelMapping map = new CanonChannelMapping(channel.ChannelId);

                map.CleanNotExistingProducts();

                map.UpdateRelevances();

                logger.Info(string.Format("Relevance points were updated."));

                map.MarkRecommendeedRelevances();

                logger.Info(string.Format("The best relevanced pairs were chosen."));

                //Create new mapping rules for all channels
                map.CreateNewMappingRules();
                logger.Info(string.Format("New mapping rules has been created."));

                //Update main monitor
                map.UpdateMonitor();
                logger.Info(string.Format("Main monitor has been updated."));
            }
            catch (Exception ex)
            {
                //into db log
                int id = CanonProductsLog.AddImportLog(ChannelLogEnum.ChannelError,
                                                       channel.ChannelId, export.TryedRecords, export.SuccessRecords);
                CanonProductsLog.AddImportErrorsLog(id, ChannelErrorEnum.ChannelMappingError, string.Empty);

                logger.Fatal(ex);
            }

            //into db log
            CanonProductsLog.AddImportLog(ChannelLogEnum.ImportOk,
                                          channel.ChannelId, export.TryedRecords, export.SuccessRecords);

            logger.Info(string.Format("Export finished: {0}, {1}, {2}",
                                      channel.ChannelId, channel.ChannelName, channel.Url));
        }
        public void Recurse_flag_is_honoured()
        {
            _fileSystemMocker.SetupFileExists(false);
            _fileSystemMocker.SetupGetFiles(new[] { "file1", "file2", "file3" }, true);
            _parser = new CommonParser(OneArgRecursive, _fileSystemMocker.Object);

            Assert.That(_parser.HasErrors, Is.False);

            Assert.That(_parser.FileSources.Count(), Is.EqualTo(3));
            _fileSystemMocker.VerifyGetFilesWasRecursive();
        }
        public void Arguments_that_are_existing_files_adds_to_FileSources()
        {
            _fileSystemMocker.SetupFileExists(true);
            _parser = new CommonParser(TwoArgs, _fileSystemMocker.Object);

            Assert.That(_parser.HasErrors, Is.False);

            Assert.That(_parser.FileSources.Count(), Is.EqualTo(2));
            CollectionAssert.Contains(_parser.FileSources, TwoArgs[0]);
            CollectionAssert.Contains(_parser.FileSources, TwoArgs[1]);
        }
        public void Arguments_that_are_NOT_existing_files_or_directories_sets_error_state()
        {
            _fileSystemMocker.SetupFileExists(false);
            _fileSystemMocker.SetupDirectoryExists(false);
            _parser = new CommonParser(TwoArgs, _fileSystemMocker.Object);

            Assert.That(_parser.HasErrors, Is.True);
            Assert.That(_parser.Errors.OfType <FileNotFoundException>().Count(), Is.EqualTo(2));

            Assert.That(_parser.FileSources.Any(), Is.False);
        }
        public void Arguments_that_are_folders_are_expanded_to_FileSources()
        {
            _fileSystemMocker.SetupFileExists(false);
            _fileSystemMocker.SetupDirectoryExists(true);
            _fileSystemMocker.SetupGetFiles(new[] { "file1", "file2", "file3" });
            _parser = new CommonParser(OneArg, _fileSystemMocker.Object);

            Assert.That(_parser.HasErrors, Is.False);

            Assert.That(_parser.FileSources.Count(), Is.EqualTo(3));
            CollectionAssert.DoesNotContain(_parser.FileSources, OneArg.Single());

            _fileSystemMocker.VerifyGetFilesWasNotRecursive();
        }
 public void No_arguments_sets_stdin_as_input_source()
 {
     _parser = new CommonParser(NoArgs, _fileSystemMocker.Object);
     Assert.That(_parser.HasErrors, Is.False);
     Assert.That(_parser.FileSources.Any(), Is.False);
 }
Example #11
0
        /// <summary>
        /// ex:
        /// ParseManager parseManager = new ParseManager();
        /// PbBillInfo billInfo = parseManager.ParseBillFile(@"F:\NG3\PowerBuilder\0000000069.ini");
        /// </summary>
        /// <param name="billInfo"> </param>
        /// <returns></returns>
        public static bool GenerateApp(PbBillInfo billInfo, ref string winType, string ucode)
        {
            string className = (ucode + billInfo.Name).Replace("pform", "aform");  //NG0001pform0000000008
            string title     = billInfo.Description;

            try
            {
                DbHelper.Open(); //ConnectionString

                //List gridPanel
                PbListFormParser PbListParser = new PbListFormParser();
                GridPanel        gridPanel    = PbListParser.GetGridInfo(billInfo);
                Toolbar          toolbar      = PbListParser.GetListToolbar(billInfo);

                //Edit
                PbEditFormParser pbEdit     = new PbEditFormParser(billInfo);
                List <string>    PanelNames = new List <string>();

                //记录所有的panel
                foreach (var set in pbEdit.FieldSets)
                {
                    foreach (var panel in set.Panels)
                    {
                        PanelNames.Add(panel.TableName);
                    }
                }

                foreach (var panel in pbEdit.GridPanels)
                {
                    PanelNames.Add(panel.TableName);
                }

                string area = "SUP";

                try
                {
                    #region list
                    AformListTemplate.ListOrEdit = "viewedit";
                    if (gridPanel.Columns.Count > 0)  //否则不生成列表界面
                    {
                        winType = "List";
                        CommonParser.Log("List界面开始生成.");

                        AformListTemplate.NameSpacePrefix = area;
                        AformListTemplate.NameSpaceSuffix = "CustomForm";
                        AformListTemplate.ClassName       = className;
                        AformListTemplate.PkPropertyname  = "phid";
                        AformListTemplate.ListOrEdit      = "viewlist";
                        AformListTemplate.Title           = title;
                        AformListTemplate.Area            = area;
                        AformListTemplate.gridPanel       = gridPanel;
                        AformListTemplate.Toolbar         = toolbar;
                        AformListTemplate.WriteEx(area);

                        CommonParser.Log("List界面生成成功.");
                    }
                    #endregion


                    #region edit
                    CommonParser.Log("Edit界面开始生成.");

                    AformEditTemplate.NameSpacePrefix = area;
                    AformEditTemplate.NameSpaceSuffix = "CustomForm";
                    AformEditTemplate.ClassName       = className;
                    AformEditTemplate.PkPropertyname  = "phid";
                    AformEditTemplate.ListOrEdit      = "viewedit";
                    AformEditTemplate.Title           = title;
                    AformEditTemplate.Area            = area;
                    AformEditTemplate.gridPanel       = gridPanel;
                    AformEditTemplate.fieldSets       = pbEdit.FieldSets;
                    AformEditTemplate.panels          = pbEdit.GridPanels;
                    AformEditTemplate.tableLayouts    = pbEdit.LayoutForm;
                    AformEditTemplate.PanelNames      = PanelNames;
                    AformEditTemplate.Expressions     = pbEdit.Expressions;
                    AformEditTemplate.Toolbar         = pbEdit.TB;
                    AformEditTemplate.WriteEx(area);

                    CommonParser.Log("Edit界面生成成功.");
                    #endregion
                }
                catch (Exception e)
                {
                    CommonParser.Log(e.Message);
                    //throw new Exception(e.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DbHelper.Close();//ConnectionString);
            }
            return(true);
        }
Example #12
0
        /// <summary>
        /// ex:
        /// ParseManager parseManager = new ParseManager();
        /// </summary>
        /// <param name="billInfo"> </param>
        /// <returns></returns>
        public static bool Generate(PbBillInfo billInfo, ref string winType, string extJsStr, string ucode)
        {
            string className    = ucode + billInfo.Name;                    //NG0001pform0000000008
            string pform        = billInfo.Name;                            //pform0000000008
            string eform        = pform.Replace("pform", "EFORM");          //EFORM0000000008
            string qform        = pform.Replace("pform", "w_eform_p_list"); //w_eform_p_list0000600008
            string title        = billInfo.Description;
            string istask       = billInfo.IsTask;
            string reltable     = billInfo.Reltable;
            bool   hasTab       = billInfo.PbTabInfos.Count > 0 ? true : false;
            string tableNameMst = billInfo.HeadInfo.TableName;


            DbHelper.Open();

            //List窗口 gridPanel
            PbListFormParser PbListParser = new PbListFormParser();
            GridPanel        gridPanel    = PbListParser.GetGridInfo(billInfo);
            Toolbar          toolbar      = PbListParser.GetListToolbar(billInfo);

            //Edit窗口 form grid
            PbEditFormParser pbEdit     = new PbEditFormParser(billInfo);
            List <String>    PanelNames = new List <string>();

            //记录所有的panel
            foreach (var set in pbEdit.FieldSets)
            {
                foreach (var panel in set.Panels)
                {
                    PanelNames.Add(panel.TableName);
                }
            }

            foreach (var panel in pbEdit.GridPanels)
            {
                PanelNames.Add(panel.TableName);
            }

            ////任务分解需求,拼grid属性集合json串并保存到p_form_m表,如{"p_form0000000010_d":"deptid,remarks;deptid A,remarks A;prc@sum,amt@sum"}
            //if (billInfo.IsTask == "1" && pbEdit.AllGrids.Count > 0)
            //{
            //    string grid_detail = "{";

            //    foreach (GridPanel grid in pbEdit.AllGrids)
            //    {
            //        if (!string.IsNullOrEmpty(grid.Subtotal))
            //        {
            //            grid_detail += "\"" + grid.TableName + "\":\"" + grid.Subtotal + "\",";
            //        }
            //    }

            //    grid_detail = grid_detail.TrimEnd(',') + "}";

            //    DbHelper.ExecuteNonQuery(string.Format("update p_form_m set grid_detail='{0}' where code='{1}'", grid_detail, billInfo.Code));
            //}


            string area = "SUP";

            #region list
            if (gridPanel.Columns.Count > 0)
            {
                winType = "List";

                CommonParser.Log("List界面开始生成.");
                //否则不生成
                PageListTemplate   PageListTemplate   = new PageListTemplate();
                PageListJsTemplate PageListJsTemplate = new PageListJsTemplate();
                PageListTemplate.NameSpacePrefix = area;
                PageListTemplate.NameSpaceSuffix = "CustomForm";
                PageListTemplate.ClassName       = className;
                PageListTemplate.Title           = title;
                PageListTemplate.WriteEx("SUP");

                PageListJsTemplate.NameSpacePrefix = area;
                PageListJsTemplate.NameSpaceSuffix = "CustomForm";
                PageListJsTemplate.ClassName       = className;
                PageListJsTemplate.EForm           = eform;
                PageListJsTemplate.PForm           = pform;
                PageListJsTemplate.QForm           = qform;
                PageListJsTemplate.IsTask          = istask;
                PageListJsTemplate.PkPropertyname  = "phid";
                PageListJsTemplate.Title           = title;
                PageListJsTemplate.Area            = area;
                PageListJsTemplate.gridPanel       = gridPanel;
                PageListJsTemplate.Toolbar         = toolbar;
                PageListJsTemplate.HasBlobdoc      = billInfo.HasBlobdoc;
                PageListJsTemplate.HasEppocx       = billInfo.HasEppocx;
                PageListJsTemplate.HasReport       = billInfo.HasReport;
                PageListJsTemplate.WriteEx("SUP");

                CommonParser.Log("List界面生成成功.");
            }
            #endregion


            #region edit
            CommonParser.Log("Edit界面开始生成.");

            PageEditTemplate  PageEditTemplate  = new PageEditTemplate();
            PageJsExtTemplate PageJsExtTemplate = new PageJsExtTemplate();
            PageEditTemplate.NameSpacePrefix = area;
            PageEditTemplate.NameSpaceSuffix = "CustomForm";
            PageEditTemplate.ClassName       = className;
            PageEditTemplate.Title           = title;
            PageEditTemplate.SumRowStyle     = billInfo.SumRowStyle;
            PageEditTemplate.NoSumRowStyle   = billInfo.NoSumRowStyle;
            PageEditTemplate.WriteEx("SUP");

            //扩展脚本生成
            PageJsExtTemplate.ClassName = className;
            PageJsExtTemplate.ExtJsStr  = extJsStr;
            PageJsExtTemplate.WriteEx("SUP");

            if (!hasTab)  //无tab页
            {
                PageEditJsTemplate PageEditJSTemplate = new PageEditJsTemplate();
                PageEditJSTemplate.NameSpacePrefix = area;
                PageEditJSTemplate.NameSpaceSuffix = "CustomForm";
                PageEditJSTemplate.ClassName       = className;
                PageEditJSTemplate.PForm           = pform;
                PageEditJSTemplate.EForm           = eform;
                PageEditJSTemplate.QForm           = qform;
                PageEditJSTemplate.IsTask          = istask;
                PageEditJSTemplate.Reltable        = reltable;
                PageEditJSTemplate.PkPropertyname  = "phid";
                PageEditJSTemplate.Title           = title;
                PageEditJSTemplate.Area            = area;
                PageEditJSTemplate.fieldSets       = pbEdit.FieldSets;
                PageEditJSTemplate.panels          = pbEdit.GridPanels;
                PageEditJSTemplate.AllGrids        = pbEdit.AllGrids;
                PageEditJSTemplate.tableLayouts    = pbEdit.LayoutForm;
                PageEditJSTemplate.PanelNames      = PanelNames;
                PageEditJSTemplate.Expressions     = pbEdit.Expressions;
                PageEditJSTemplate.Toolbar         = pbEdit.TB;
                PageEditJSTemplate.TableName       = tableNameMst;
                PageEditJSTemplate.BodyCmpCount    = billInfo.BodyCmpCount;
                PageEditJSTemplate.HasBlobdoc      = billInfo.HasBlobdoc;
                PageEditJSTemplate.HasEppocx       = billInfo.HasEppocx;
                PageEditJSTemplate.HasReport       = billInfo.HasReport;
                PageEditJSTemplate.FieldSetBlobdoc = pbEdit.FieldSetBlobdoc;
                PageEditJSTemplate.PictureBoxs     = pbEdit.PictureBoxs;
                PageEditJSTemplate.HasAsrGrid      = billInfo.AsrGridInfo.Visible ? "1" : "0";
                PageEditJSTemplate.AsrGrid         = pbEdit.AsrGrid;
                PageEditJSTemplate.HasWfGrid       = billInfo.WfGridInfo.Visible ? "1" : "0";
                PageEditJSTemplate.WfGrid          = pbEdit.WfGrid;
                PageEditJSTemplate.WriteEx("SUP");
            }
            else
            {
                //有tab页
                PageEditJsWithTabTemplate PageEditJsWithTabTemplate = new PageEditJsWithTabTemplate();
                PageEditJsWithTabTemplate.NameSpacePrefix = area;
                PageEditJsWithTabTemplate.NameSpaceSuffix = "CustomForm";
                PageEditJsWithTabTemplate.ClassName       = className;
                PageEditJsWithTabTemplate.PForm           = pform;
                PageEditJsWithTabTemplate.EForm           = eform;
                PageEditJsWithTabTemplate.QForm           = qform;
                PageEditJsWithTabTemplate.IsTask          = istask;
                PageEditJsWithTabTemplate.PkPropertyname  = "phid";
                PageEditJsWithTabTemplate.Title           = title;
                PageEditJsWithTabTemplate.Area            = area;
                PageEditJsWithTabTemplate.fieldSets       = pbEdit.FieldSets;
                PageEditJsWithTabTemplate.panels          = pbEdit.GridPanels;
                PageEditJsWithTabTemplate.AllGrids        = pbEdit.AllGrids;
                PageEditJsWithTabTemplate.tabInfos        = pbEdit.tabinfos;
                PageEditJsWithTabTemplate.tableLayouts    = pbEdit.LayoutForm;
                PageEditJsWithTabTemplate.PanelNames      = PanelNames;
                PageEditJsWithTabTemplate.Expressions     = pbEdit.Expressions;
                PageEditJsWithTabTemplate.Toolbar         = pbEdit.TB;
                PageEditJsWithTabTemplate.TableName       = tableNameMst;
                PageEditJsWithTabTemplate.BodyCmpCount    = billInfo.BodyCmpCount;
                PageEditJsWithTabTemplate.HasBlobdoc      = billInfo.HasBlobdoc;
                PageEditJsWithTabTemplate.HasEppocx       = billInfo.HasEppocx;
                PageEditJsWithTabTemplate.HasReport       = billInfo.HasReport;
                PageEditJsWithTabTemplate.FieldSetBlobdoc = pbEdit.FieldSetBlobdoc;
                PageEditJsWithTabTemplate.PictureBoxs     = pbEdit.PictureBoxs;
                PageEditJsWithTabTemplate.HasAsrGrid      = billInfo.AsrGridInfo.PbBaseTextInfos.Count > 0 ? "1" : "0";
                PageEditJsWithTabTemplate.AsrGrid         = pbEdit.AsrGrid;
                PageEditJsWithTabTemplate.HasWfGrid       = billInfo.WfGridInfo.PbBaseTextInfos.Count > 0 ? "1" : "0";
                PageEditJsWithTabTemplate.WfGrid          = pbEdit.WfGrid;
                PageEditJsWithTabTemplate.WriteEx("SUP");
            }
            CommonParser.Log("Edit界面生成成功.");
            #endregion

            DbHelper.Close();

            return(true);
        }
Example #13
0
        public void GetNamesFromStringReturnsArray(int count, string namesString)
        {
            var res = CommonParser.GetNames(namesString);

            Assert.AreEqual(count, res.Length);
        }
Example #14
0
        public void GetNamesFromEmptyStringReturnsEmptyArray()
        {
            var res = CommonParser.GetNames(string.Empty);

            Assert.AreEqual(0, res.Length);
        }
Example #15
0
 public void GetNamesFromNullThrowsException()
 {
     Assert.Throws <ArgumentNullException>(() => {
         CommonParser.GetNames(null);
     });
 }
Example #16
0
        /// <summary>
        /// 生成web自定义表单;
        /// </summary>
        /// <param name="buildPara"></param>
        /// <returns></returns>
        public string BuildCustomForm(BuildParameter buildPara)
        {
            string winType = "Edit";
            string ucode   = string.Empty;

            if (string.IsNullOrEmpty(buildPara.Id))
            {
                throw new Exception("Id不能为空!");
            }

            var fileName = BuildFile(buildPara.Id, ref ucode); //得到ini文件内容和帐套号
            var extJsStr = BuildExtJs(buildPara.Id);

            //p_form_m表中ucode可能不对,比如帐套是其他地方还原过来的,这里取默认帐套号
            if (!string.IsNullOrEmpty(ucode))
            {
                ucode = AppInfoBase.DbName;  //如NG0002
            }

            var type = buildPara.Type;  //web:网页自定义表单,app:移动自定义表单

            if (string.IsNullOrEmpty(type))
            {
                type = "web";
            }

            buildPara.AssemblyPath = AppDomain.CurrentDomain.BaseDirectory + "bin\\";
            buildPara.CsFilePath   = AppDomain.CurrentDomain.BaseDirectory + "CustomFormTemp\\";

            //获取设计器生成ini文件内容
            PbBillInfo billInfo = new PbBillInfo();

            billInfo = CommonParser.GetBillBase(fileName);

            // 生成前端代码;
            var clientGen = new ClientGen.Generator();

            if (type == "app")
            {
                if (!ClientGen.Generator.GenerateApp(billInfo, ref winType, ucode))
                {
                    throw new Exception("前端代码生成失败!");
                }
            }
            else
            {
                if (!ClientGen.Generator.Generate(billInfo, ref winType, extJsStr, ucode))
                {
                    throw new Exception("前端代码生成失败!");
                }
            }


            // 生成服务端代码;
            bool isGenerateCsFile = true;  //是否生成cs文件

            if (string.IsNullOrEmpty(buildPara.CsFilePath))
            {
                isGenerateCsFile = false;
            }

            if (type == "app")
            {
                if (!ServerGen.Generator.GenerateApp(billInfo, buildPara.AssemblyPath, isGenerateCsFile, buildPara.CsFilePath, ucode))
                {
                    throw new Exception("服务端代码生成失败!");
                }
            }
            else
            {
                if (!ServerGen.Generator.Generate(billInfo, buildPara.AssemblyPath, isGenerateCsFile, buildPara.CsFilePath, ucode))
                {
                    throw new Exception("服务端代码生成失败!");
                }
            }


            if (!ServerGen.Generator.Generate(billInfo, buildPara.AssemblyPath, isGenerateCsFile, buildPara.CsFilePath, ucode))
            {
                throw new Exception("服务端代码生成失败!");
            }



            //begin 增加一个菜单
            string configPath   = HttpContext.Current.Request.PhysicalApplicationPath + "\\NG3Config\\MainNavigation.xml";
            string menuName     = ucode + (type == "app" ? "aform" : "pform") + buildPara.Id + winType;
            string menuText     = menuName + " - " + billInfo.Description;
            string menuTabTitle = billInfo.Description;

            DataSet ds = new DataSet();

            ds.ReadXml(configPath);

            DataRow[] drs = ds.Tables["TreeNode"].Select("Text='" + menuText + "'");

            if (drs == null || drs.Length < 1)
            {
                DataRow dr = ds.Tables["TreeNode"].NewRow();
                dr["NavigateUrl"]      = "/Custom/SUP/" + menuName;
                dr["Text"]             = menuText;
                dr["TabTitle"]         = menuTabTitle;
                dr["UserType"]         = "system,developer,translator";
                dr["TreeNodeGroup_Id"] = "0";
                ds.Tables["TreeNode"].Rows.Add(dr);
                ds.WriteXml(configPath);
            }
            //end 增加一个菜单


            //// 返回URL链接;
            //var ip = string.IsNullOrEmpty(buildPara.Port) ? buildPara.Host : string.Format("{0}:{1}", buildPara.Host, buildPara.Port);
            //return string.Format(@"http://{0}/SUP/pform{1}List", ip, buildPara.Id);

            //返回生成业务点;
            return(string.Format(@"自定义表单pform{0}生成成功", buildPara.Id));
        }