private void LL() { string sSQL = "select RealName,Sex,Area,Address,EMail,Tel from User_Info where UserSN=" + LoginInfo.UserID; string sSex = "1"; string sArea = string.Empty; using (IDataReader dr = DbHelp.Read(sSQL)) { if (dr.Read()) { this.cName.Text = dr["RealName"].ToString(); this.cEMail.Text = dr["EMail"].ToString(); this.cTel.Text = dr["Tel"].ToString(); this.cAddress.Text = dr["Address"].ToString(); sArea = dr["Area"].ToString(); this.cArea.Text = sArea; sSex = dr["Sex"].ToString(); } else { Message.Error("不存此用户"); } } this.cSex.Text = Bind.GetHtmlRadio(KeyPair.Sex, "cSex", sSex); GetClassPath1 acp = new GetClassPath1(); ClassPath cp = new ClassPath(PubData.GetDataTable("Pub_Area"), acp); cp.Exe(Fn.IsInt(sArea, 0)); this.cSelectSpanHidden.Text = acp.GetPath; }
public void Run() { var sb = new StringBuilder(); if (MaxPermSize != null) { sb.Append("-XX:MaxPermSize=" + MaxPermSize + " "); } sb.Append("-classpath "); sb.Append(String.Join(";", ClassPath.ToArray())); sb.Append(" "); sb.Append(MainClass); sb.Append(" "); sb.Append(Arguments); var args = sb.ToString(); Process = new Process { StartInfo = new ProcessStartInfo { FileName = @"C:\Program Files\Java\jdk1.7.0_25\bin\javaw.exe", Arguments = args, UseShellExecute = false } }; Process.StartInfo.RedirectStandardError = true; Process.StartInfo.RedirectStandardOutput = true; Process.Start(); Process.BeginOutputReadLine(); Process.BeginErrorReadLine(); Process.OutputDataReceived += (s, e) => Console.WriteLine(e.Data); Process.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data); Process.WaitForExit(); }
private static string WriteTestFileText(string solutionDirectory, ClassPath classPath, Entity entity, Feature feature, string projectBaseName) { var featureName = Utilities.AddEntityFeatureClassName(entity.Name); var testFixtureName = Utilities.GetIntegrationTestFixtureName(); var commandName = Utilities.CommandAddName(entity.Name); var testUtilClassPath = ClassPathHelper.IntegrationTestUtilitiesClassPath(solutionDirectory, projectBaseName, ""); var dtoUtilClassPath = ClassPathHelper.DtoClassPath(solutionDirectory, "", entity.Name, projectBaseName); var exceptionsClassPath = ClassPathHelper.ExceptionsClassPath(solutionDirectory, "", projectBaseName); var fakerClassPath = ClassPathHelper.TestFakesClassPath(solutionDirectory, "", entity.Name, projectBaseName); var parentFakerClassPath = ClassPathHelper.TestFakesClassPath(solutionDirectory, "", feature.ParentEntity, projectBaseName); var featuresClassPath = ClassPathHelper.FeaturesClassPath(solutionDirectory, featureName, entity.Plural, projectBaseName); return(@$ "namespace {classPath.ClassNamespace}; using {dtoUtilClassPath.ClassNamespace}; using {fakerClassPath.ClassNamespace}; using {parentFakerClassPath.ClassNamespace}; using {testUtilClassPath.ClassNamespace}; using {featuresClassPath.ClassNamespace}; using {exceptionsClassPath.ClassNamespace}; using FluentAssertions; using Microsoft.EntityFrameworkCore; using NUnit.Framework; using System.Threading.Tasks; using static {testFixtureName};
//private IMessage msgAjax = new MessageAjax(); protected void Page_Load(object sender, EventArgs e) { id = Req.GetID(); UserID = LoginInfo.UserID; cp = new ClassPath(PubData.GetDataTable("pub_area"), acp); string hid = Req.GetForm("hid"); if (hid == "1") { string cmd = Req.GetForm("cmd"); switch (cmd) { case "save": cb_ok(); break; case "del": cb_delete(); break; } Response.Write(msgAjax.ReturnMessage); Response.End(); } if (!this.IsPostBack) { LL(); BGList(); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpQualifiedName"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly node from which the C# node is created.</param> /// <param name="feature">The feature at the end of the path. Can be null.</param> /// <param name="discrete">The discrete at the end of the path. Can be null.</param> /// <param name="inheritBySideAttribute">Inherit the side-by-side attribute.</param> protected CSharpQualifiedName(ICSharpContext context, IQualifiedName source, ICSharpFeature feature, ICSharpDiscrete discrete, bool inheritBySideAttribute) : base(source) { Debug.Assert((feature != null && discrete == null) || (feature == null && discrete != null)); Feature = feature; Discrete = discrete; InheritBySideAttribute = inheritBySideAttribute; IsAttributeWithContract = feature is ICSharpAttributeFeature AsAttributeFeature && AsAttributeFeature.Source.EnsureList.Count > 0; foreach (IExpressionType Item in source.ValidResultTypePath.Item) { ICSharpClass ItemClass; if (Item.ValueType is IClassType AsClassType) { ItemClass = context.GetClass(AsClassType.BaseClass); } else { ItemClass = null; } ClassPath.Add(ItemClass); } }
public void JavaTypesAreMigratedAfterJetifierWithIntermediate() { var migratedAar = Utils.GetTempFilename(); var jetifier = new Jetifier(); jetifier.UseIntermediateFile = true; var result = jetifier.Jetify(SupportAar, migratedAar); Assert.True(result); var jar = ReadAarEntry(migratedAar, "classes.jar"); var classPath = new ClassPath(); classPath.Load(jar); var packages = classPath.GetPackages(); Assert.True(packages.Count > 0); Assert.Equal("com.xamarin.aarxercise", packages.Keys.FirstOrDefault()); var classes = packages["com.xamarin.aarxercise"]; var simpleFragment = classes.FirstOrDefault(c => c.ThisClass.Name.Value == "com/xamarin/aarxercise/SimpleFragment"); Assert.Equal("androidx/fragment/app/Fragment", simpleFragment.SuperClass.Name.Value); }
protected static void AssertXmlDeclaration(string classResource, string xmlResource, string documentationPath = null, JavaDocletType?javaDocletType = null) { var classPathBuilder = new ClassPath() { ApiSource = "class-parse", DocumentationPaths = new string[] { documentationPath, }, }; if (javaDocletType.HasValue) { classPathBuilder.DocletType = javaDocletType.Value; } classPathBuilder.Add(LoadClassFile(classResource)); var actual = new StringWriter(); classPathBuilder.ApiSource = "class-parse"; if (javaDocletType.HasValue) { classPathBuilder.DocletType = javaDocletType.Value; } classPathBuilder.SaveXmlDescription(actual); var expected = LoadString(xmlResource); Assert.AreEqual(expected, actual.ToString()); }
//订单详细信息 private void GetOrdInfo() { //pageMod = new Ord_InfoM(); string sSQL = "select Ticket_1_Number,Ticket_1_Price,UserName,RealName,FixTel,Tel,Area,Address,OrdNumber,TotalPrice,AddDate,Caption,Remark,Status,StatusPay,ToMinTime,ToMaxTime,(select PayName from Pay_Info where PaySN=a.FK_Pay) as pn from Ord_Info a where OrdSN=" + id + " and FK_User="******"Remark").ToString().Length == 0) // pageMod.Remark = "无"; ItemHandler kpOrd = new ItemHandler("OrderStatus"); pageStatusName = kpOrd.GetDircBit(int.Parse(d.Eval("Status").ToString())); pagePayName = d.Eval("pn").ToString(); //区域 GetClassPath1 acp = new GetClassPath1(); ClassPath cp = new ClassPath(PubData.GetDataTable("pub_area"), acp); cp.Exe(Convert.ToInt32(d.Eval("Area"))); pageAreaPath = acp.GetPath; pageTicket_1_Number = d.Eval("Ticket_1_Number").ToString(); pageTicket_1_Price = double.Parse(d.Eval("Ticket_1_Price").ToString()); pageTotalPrice = double.Parse(d.Eval("TotalPrice").ToString()); } else { msgG.Error("此订单不存在"); } }
private static string SeedRoles(ClassPath classPath, List <string> roles) { var roleSeeds = ""; foreach (var role in roles) { var newLine = role == roles.LastOrDefault() ? "" : $"{Environment.NewLine}"; roleSeeds += @$ " await roleManager.CreateAsync(new IdentityRole(Role.SuperAdmin.ToString()));{newLine}"; } return($@"namespace {classPath.ClassNamespace} {{ using Domain.Enums; using Microsoft.AspNetCore.Identity; using System.Threading.Tasks; public static class RoleSeeder {{ public static async Task SeedDemoRolesAsync(RoleManager<IdentityRole> roleManager) {{ //Seed Roles {roleSeeds} }} }} }}"); }
private static string WriteTestFileText(string solutionDirectory, ClassPath classPath, Entity entity, string projectBaseName) { var featureName = Utilities.DeleteEntityFeatureClassName(entity.Name); var testFixtureName = Utilities.GetIntegrationTestFixtureName(); var commandName = Utilities.CommandDeleteName(entity.Name); var fakeEntity = Utilities.FakerName(entity.Name); var fakeEntityVariableName = $"fake{entity.Name}One"; var lowercaseEntityName = entity.Name.LowercaseFirstLetter(); var lowercaseEntityPluralName = entity.Plural.LowercaseFirstLetter(); var pkName = entity.PrimaryKeyProperty.Name; var lowercaseEntityPk = pkName.LowercaseFirstLetter(); var testUtilClassPath = ClassPathHelper.IntegrationTestUtilitiesClassPath(solutionDirectory, projectBaseName, ""); var fakerClassPath = ClassPathHelper.TestFakesClassPath(solutionDirectory, "", entity.Name, projectBaseName); var featuresClassPath = ClassPathHelper.FeaturesClassPath(solutionDirectory, featureName, entity.Plural, projectBaseName); return(@$ "namespace {classPath.ClassNamespace} {{ using {fakerClassPath.ClassNamespace}; using {testUtilClassPath.ClassNamespace}; using FluentAssertions; using Microsoft.EntityFrameworkCore; using NUnit.Framework; using System.Threading.Tasks; using static {featuresClassPath.ClassNamespace}.{featureName};
private static string WriteTestFileText(string solutionDirectory, ClassPath classPath, Entity entity, string projectBaseName) { var featureName = Utilities.GetEntityListFeatureClassName(entity.Name); var testFixtureName = Utilities.GetIntegrationTestFixtureName(); var fakerClassPath = ClassPathHelper.TestFakesClassPath(solutionDirectory, "", entity.Name, projectBaseName); var dtoClassPath = ClassPathHelper.DtoClassPath(solutionDirectory, "", entity.Name, projectBaseName); var featuresClassPath = ClassPathHelper.FeaturesClassPath(solutionDirectory, featureName, entity.Plural, projectBaseName); var sortTests = ""; var filterTests = ""; foreach (var prop in entity.Properties.Where(e => e.CanSort && e.Type != "Guid").ToList()) { sortTests += GetEntitiesListSortedInAscOrder(entity, prop); sortTests += GetEntitiesListSortedInDescOrder(entity, prop); } foreach (var prop in entity.Properties.Where(e => e.CanFilter).ToList()) { filterTests += GetEntitiesListFiltered(entity, prop); } return(@$ "namespace {classPath.ClassNamespace} {{ using {dtoClassPath.ClassNamespace}; using {fakerClassPath.ClassNamespace}; using FluentAssertions; using NUnit.Framework; using System; using System.Linq; using System.Threading.Tasks; using static {featuresClassPath.ClassNamespace}.{featureName};
public override bool Execute() { Log.LogMessage("GenerateParameterNames Task"); Log.LogMessage(" ApiOutputFile: {0}", ApiOutputFile); Log.LogMessage(" GeneratedFile: {0}", GeneratedFile); Log.LogMessage(" SourceJars: {0}", string.Join(";", SourceJars.Select(x => x.ItemSpec))); Log.LogMessage(" TransformFiles: {0}", string.Join(";", TransformFiles.Select(x => x.ItemSpec))); var generatorParameters = new GeneratorParameters { ReservedPrefix = ReservedPrefix ?? string.Empty, ReservedSuffix = ReservedSuffix ?? string.Empty, ParameterCasing = (TextCasing)Enum.Parse(typeof(TextCasing), ParameterCasing, true), ForceMeaningfulParameterNames = ForceMeaningfulParameterNames }; // create the folder var dir = Path.GetDirectoryName(GeneratedFile.ItemSpec); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } // read the jar files var classPath = new ClassPath() { ApiSource = "class-parse" }; foreach (var jarFile in SourceJars) { if (ClassPath.IsJarFile(jarFile.ItemSpec)) { classPath.Load(jarFile.ItemSpec); } } // build up the object tree var metadataElement = classPath.ToXElement(); // remove any nodes that the user wants metadataElement = TransformXml(metadataElement); var packages = JavaPackage.Parse(metadataElement); var xParameters = packages.SelectMany(p => p.ToXElement(generatorParameters)); // create the new xml document var xDoc = new XDocument( new XElement("metadata", xParameters.ToArray())); // make sure we don't have anything not in the api.xml RemoveIgnoredApiXmlMembers(xDoc); // save xDoc.Save(GeneratedFile.ItemSpec); return(true); }
public void SetInnerClasses(IEnumerable <string> inners) { if (inners != null) { ClassPath = ClassPath.Remove(ClassPath.LastIndexOf('$')); InnerClassPaths = new List <string>(inners); HasInnerClasses = true; } }
private static string WriteTestFileText(string srcDirectory, ClassPath classPath, string projectBaseName) { var wrapperClassPath = ClassPathHelper.WrappersClassPath(srcDirectory, "", projectBaseName); return(@$ "namespace {classPath.ClassNamespace}; using {wrapperClassPath.ClassNamespace}; using FluentAssertions; using NUnit.Framework;
public static void Main(string [] args) { bool skipChanged = false; if (args.Length > 2) { if (args[0] == "--no-changed") { skipChanged = true; args = args.Skip(1).ToArray(); } } if (args.Length != 2) { PrintUsage(); return; } var jar1 = new ClassPath(args [0]); var jar2 = new ClassPath(args [1]); var packages1 = jar1.GetPackages(); var packages2 = jar2.GetPackages(); var commonPackages = HashSetDiffing(packages1, packages2, p => p.Key, (rt, items) => ReportConsole("packages", rt, items)); foreach (var package in commonPackages) { var commonTypes = HashSetDiffing(package.Item1.Value, package.Item2.Value, c => c.ThisClass.Name.Value, (rt, items) => ReportConsole("classes in package " + package.Item1.Key, rt, items)); foreach (var type in commonTypes) { Func <MethodInfo, bool> noSpecialMethods = mn => mn.Name.IndexOf("$", StringComparison.Ordinal) == -1; var commonMethods = HashSetDiffing(type.Item1.Methods.Where(noSpecialMethods), type.Item2.Methods.Where(noSpecialMethods), m => m.Name + " :: " + m.Descriptor, (rt, items) => ReportConsole("methods in class " + type.Item1.ThisClass.Name.Value, rt, items)); if (type.Item1.IsEnum) { continue; } if (!skipChanged) { var differingMethods = GetMethodsWithDifferingBodies(commonMethods).ToList(); if (differingMethods.Any()) { ReportConsole("methods in type " + type.Item1.ThisClass.Name.Value, ReportType.Changed, differingMethods); } } } } }
private void CurPath(int pClassID) { DataTable dtProClass = PubData.GetDataTable("pro_class"); GetClassPath gcp = new GetClassPath(GetURL.Pro.Class("{0}")); ClassPath cp = new ClassPath(dtProClass, gcp); cp.Exe(pClassID); this.curPath.Text = gcp.GetPath; }
private void CurPath(int pClassID) { DataTable dtClass = PubData.GetDataTable("TaoCan_Class"); GetClassPath gcp = new GetClassPath(GetURL.TaoCan.Class("{0}")); ClassPath cp = new ClassPath(dtClass, gcp); cp.Exe(pClassID); this.curPath.Text = " > <a href=\"" + GetURL.TaoCan.Default() + "\">营养套餐</a>" + gcp.GetPath; }
private void CurPath(int pClassID) { DataTable dtCaiPuClass = PubData.GetDataTable("caipu_class"); GetClassPath gcp = new GetClassPath(GetURL.CaiPu.Class("{0}")); ClassPath cp = new ClassPath(dtCaiPuClass, gcp); cp.Exe(pClassID); this.curPath.Text = " > <a href=\"" + GetURL.CaiPu.Default() + "\">烹饪课堂</a>" + gcp.GetPath; }
private static string CreateIntegrationTestFileText(ClassPath classPath, ApiTemplate template, Entity entity) { var assertString = ""; foreach (var prop in entity.Properties) { var newLine = prop == entity.Properties.LastOrDefault() ? "" : $"{Environment.NewLine}"; assertString += @$ " {entity.Name.LowercaseFirstLetter()}ById.{prop.Name}.Should().Be(fake{entity.Name}.{prop.Name});{newLine}"; } return(@$ "
private static string ReadRepositoryTestFileText(ClassPath classPath, Entity entity, string solutionName, string dbContextName) { var sortTests = ""; foreach (var prop in entity.Properties.Where(e => e.CanSort && e.Type != "Guid").ToList()) { sortTests += GetEntitiesListSortedInAscOrder(entity, prop, dbContextName); sortTests += GetEntitiesListSortedInDescOrder(entity, prop, dbContextName); } return(@$ "
private static string WriteTestFileText(string solutionDirectory, ClassPath classPath, string projectBaseName) { var testUtilClassPath = ClassPathHelper.FunctionalTestUtilitiesClassPath(solutionDirectory, projectBaseName, ""); return(@$ "namespace {classPath.ClassNamespace} {{ using {testUtilClassPath.ClassNamespace}; using FluentAssertions; using NUnit.Framework; using System.Net.Http; using System.Threading.Tasks;
private static string DeleteRepositoryTestFileText(ClassPath classPath, Entity entity, string solutionName, string dbContextName) { var assertString = ""; foreach (var prop in entity.Properties) { var newLine = prop == entity.Properties.LastOrDefault() ? "" : $"{Environment.NewLine}"; assertString += @$ " {entity.Name.LowercaseFirstLetter()}ById.{prop.Name}.Should().Be(fake{entity.Name}.{prop.Name});{newLine}"; } return(@$ "
private static string ReadRepositoryTestFileText(ClassPath classPath, ApiTemplate template, Entity entity) { var sortTests = ""; foreach (var prop in entity.Properties.Where(e => e.CanSort && e.Type != "Guid").ToList()) { sortTests += GetEntitiesListSortedInAscOrder(template, entity, prop); sortTests += GetEntitiesListSortedInDescOrder(template, entity, prop); } return(@$ "
private static string CreateHttpClientExtensionsText(ClassPath classPath) { return(@$ "namespace {classPath.ClassNamespace}; using Microsoft.AspNetCore.JsonPatch; using Newtonsoft.Json; using System.Dynamic; using System.Net; using System.Net.Http.Json; using System.Text; using System.Threading.Tasks;
public static string GetDtoFileText(ClassPath classPath, Entity entity, Dto dto) { if (dto == Dto.ReadParamaters) { return(DtoFileTextGenerator.GetReadParameterDtoText(classPath.ClassNamespace, entity, dto)); } else { return(DtoFileTextGenerator.GetDtoText(classPath, entity, dto)); } }
public static string GetDtoFileText(string solutionDirectory, ClassPath classPath, Entity entity, Dto dto, string projectBaseName) { if (dto == Dto.ReadParamaters) { return(DtoFileTextGenerator.GetReadParameterDtoText(solutionDirectory, classPath.ClassNamespace, entity, dto, projectBaseName)); } else { return(DtoFileTextGenerator.GetDtoText(classPath, entity, dto, projectBaseName)); } }
private static string WriteTestFileText(string solutionDirectory, ClassPath classPath, string projectBaseName) { var wrapperClassPath = ClassPathHelper.WrappersClassPath(solutionDirectory, "", projectBaseName); return(@$ "namespace {classPath.ClassNamespace} {{ using {wrapperClassPath.ClassNamespace}; using FluentAssertions; using NUnit.Framework; using System.Collections.Generic; using System.Linq;
public void ClassPathconstructorBuildsPropsCorrectly() { var dir = Path.Combine($"C:", "repos"); var topPath = Path.Combine($"Domain", "Entities"); var className = "class.cs"; var classPath = new ClassPath(dir, topPath, className); classPath.ClassDirectory.Should().Be(Path.Combine(dir, topPath)); classPath.FullClassPath.Should().Be(Path.Combine(classPath.ClassDirectory, className)); classPath.ClassNamespace.Should().Be(topPath.Replace(Path.DirectorySeparatorChar, '.')); }
private static string WriteTestFileText(string solutionDirectory, ClassPath classPath, string projectBaseName) { var servicesClassPath = ClassPathHelper.WebApiServicesClassPath(solutionDirectory, "", projectBaseName); return(@$ "namespace {classPath.ClassNamespace}; using {servicesClassPath.ClassNamespace}; using System.Security.Claims; using Bogus; using FluentAssertions; using Microsoft.AspNetCore.Http; using NSubstitute; using NUnit.Framework;
private static string UpdateIntegrationTestFileText(ClassPath classPath, Entity entity, string solutionDirectory, string solutionName, string dbContextName, List <Policy> policies) { var httpClientExtensionsClassPath = ClassPathHelper.HttpClientExtensionsClassPath(solutionDirectory, solutionName, $"HttpClientExtensions.cs"); var restrictedPolicies = Utilities.GetEndpointPolicies(policies, Endpoint.DeleteRecord, entity.Name); var hasRestrictedEndpoints = restrictedPolicies.Count > 0; var authOnlyTests = hasRestrictedEndpoints ? $@" {DeleteRecordEntityTestUnauthorized(entity)} {DeleteRecordEntityTestForbidden(entity)}" : ""; var authUsing = hasRestrictedEndpoints ? $@" using {httpClientExtensionsClassPath.ClassNamespace};" : ""; return(@$ "