Example #1
0
 public RegionService(ICountryService countryService, ICodeGeneratorService codeGenService, IRegionRepository regionRepository, IBaseEntityRepository <Region> baseEntityRepository) : base(baseEntityRepository)
 {
     _baseEntityRepository = baseEntityRepository;
     _regionRepository     = regionRepository;
     _codeGenService       = codeGenService;
     _countryService       = countryService;
 }
Example #2
0
 public EleDuplicateController(ApplicationDbContext context, UserManager <UserInfo> userManager, IAppSession Session, ICodeGeneratorService codeGeneratorService)
 {
     this.context              = context;
     this.userManager          = userManager;
     this.Session              = Session;
     this.codeGeneratorService = codeGeneratorService;
 }
Example #3
0
 public AnchorService(ICodeGeneratorService codeGeneratorService, UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, IPasswordGeneratorService codeGenerator, IAnchorRepository anchorRepository, IBaseEntityRepository <Anchor> baseEntityRepository) : base(baseEntityRepository)
 {
     _userManager          = userManager;
     _roleManager          = roleManager;
     _anchorRepository     = anchorRepository;
     _baseEntityRepository = baseEntityRepository;
     _codeGenerator        = codeGenerator;
     _codeGeneratorService = codeGeneratorService;
 }
Example #4
0
 public LcdaController(ILcdaService lcdaService,
                       ICodeGeneratorService codeGeneratorService,
                       IUserService userService,
                       IUserLcdaService userLcdaService)
 {
     _lcdaService           = lcdaService;
     _codeGenerationService = codeGeneratorService;
     _userService           = userService;
     _userLcdaService       = userLcdaService;
 }
Example #5
0
        public override void GenerateCode(ICodeGeneratorService codeGenSvc)
        {
            codeGenSvc.BeginIf(Code);
            TrueInstructions.GenerateCode(codeGenSvc);

            if (FalseInstructions.HasInstructions)
            {
                codeGenSvc.Else();
                FalseInstructions.GenerateCode(codeGenSvc);
            }

            codeGenSvc.EndIf();
        }
        public void SetUp()
        {
            _connectionString = "Data Source=ky1-vrt-msqld1.ky.cafepress.com;" +
                                "Initial Catalog=transit;User ID=cpdba;Password=ithinkgreen";

            _modelPropertyControllerMock = new Mock <IModelPropertyController>(MockBehavior.Strict);
            _dbSysUtilsMock = new Mock <IDbSysUtils>(MockBehavior.Strict);

            _target = new TableModelGenerator(_connectionString, _modelPropertyControllerMock.Object, _dbSysUtilsMock.Object);

            _testTables = new List <string>(
                new[]
            {
                "RATE_GROUP_DEF"
            }
                );
            _testModelProperties = new List <ModelProperty>
            {
                new ModelProperty
                {
                    PropertyDataType = "int",
                    PropertyName     = "RATE_GROUP_CODE",
                    IsNullable       = false
                },
                new ModelProperty
                {
                    PropertyDataType = "int",
                    PropertyName     = "SERVICE_LEVEL_NO",
                    IsNullable       = false
                },
                new ModelProperty
                {
                    PropertyDataType = "string",
                    PropertyName     = "RATE_GROUP_DESCRIPTION",
                    IsNullable       = false
                },
                new ModelProperty
                {
                    PropertyDataType = "string",
                    PropertyName     = "USER_ID",
                    IsNullable       = false
                },
                new ModelProperty
                {
                    PropertyDataType = "DateTimeOffset",
                    PropertyName     = "RECORD_INSERT_TIMESTAMP",
                    IsNullable       = false
                }
            };
            _dbObjectName = "GET_RATE_GROUP_BY_GROUP_CODE";
        }
Example #7
0
 public UserController(IUserService userService,
                       ITemplateService templateService,
                       IConfiguration configuration,
                       IVerificationService verificationService,
                       ICodeGeneratorService codeGeneratorService,
                       IEmailService emailService)
 {
     _userService           = userService;
     _configuration         = configuration;
     _verificationService   = verificationService;
     _codeGenerationService = codeGeneratorService;
     _templateService       = templateService;
     _emailService          = emailService;
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ICodeGeneratorService codeGenerator, ICodeAccessService accessService, IOptions <ProjectOptions> options)
        {
            _codeGenerator = codeGenerator;
            _accessService = accessService;
            _options       = options.Value;

            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Use(async(context, next) =>
            {
                if (!_accessService.IsGeneratedCodeExists())
                {
                    var codes = _codeGenerator.GenerateMany(_options.CodesCount);
                    _accessService.Write(codes);
                }
                await next.Invoke();
            });

            //app.UseCodeGeneratorMiddleware();

            //app.UseMvc();

            app.Run(async(context) =>
            {
                string path = context.Request.Path;
                if (path.Contains("/api/code/"))
                {
                    int id;
                    if (int.TryParse(path.Substring(path.LastIndexOf('/') + 1), out id))
                    {
                        await context.Response.WriteAsync(_accessService.Get(id));
                    }
                }
                else
                {
                    await context.Response.WriteAsync("Error");
                }
            });
            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hey hey/!");
            //});
        }
        /// <summary>
        /// 点击生成按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGenerator_Click(object sender, EventArgs e)
        {
            IList <TableInfo> tables = new List <TableInfo>();

            foreach (DataGridViewRow row in dgvTable.Rows)
            {
                DataGridViewCheckBoxCell checkCell = row.Cells[2] as DataGridViewCheckBoxCell;
                if (checkCell.Value != null && Convert.ToBoolean(checkCell.Value))
                {
                    tables.Add(row.DataBoundItem as TableInfo);
                }
            }

            if (tables.Count == 0)
            {
                MessageBox.Show("请勾选要生成的表");
                return;
            }

            FunctionType[] functionTypes = GetFunctionTypes();
            if (functionTypes.Length == 0)
            {
                MessageBox.Show("请勾选要生成的功能项");
                return;
            }

            if (string.IsNullOrWhiteSpace(txtNamespacePfx.Text))
            {
                MessageBox.Show("命名空间前辍不能为空");
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            ICodeGeneratorService generatorService = AutofacTool.Resolve <ICodeGeneratorService>();
            ReturnInfo <bool>     returnInfo       = generatorService.Generator(tables, functionTypes, txtNamespacePfx.Text, dgvTable.Tag.ToString());

            Cursor.Current = Cursors.Default;
            if (returnInfo.Success())
            {
                MessageBox.Show("生成成功");
            }
            else
            {
                MessageBox.Show(returnInfo.Msg);
            }
        }
 public AuthController(IUserService userService,
                       IEncryptionService encryptionService,
                       ITemplateService templateService,
                       IJwtService jwtService, IAuthService authService,
                       IVerificationService verificationService,
                       IConfiguration configuration,
                       IEmailService emailService, ICodeGeneratorService codeGenerationService)
 {
     _userService           = userService;
     _encryptionService     = encryptionService;
     _jwtService            = jwtService;
     _authService           = authService;
     _templateService       = templateService;
     _verificationService   = verificationService;
     _configuration         = configuration;
     _emailService          = emailService;
     _codeGenerationService = codeGenerationService;
 }
Example #11
0
 public override void GenerateCode(ICodeGeneratorService codeGenSvc)
 {
     codeGenSvc.Statement(Code);
 }
 public ControllersConvention(ICodeGeneratorService codeGeneratorService, IModelFactory factory)
 {
     this.codeGeneratorService = codeGeneratorService;
     this.factory = factory;
 }
Example #13
0
 public UnitTestsConvention(ICodeGeneratorService codeGeneratorService, IModelFactory factory)
 {
     this.codeGeneratorService = codeGeneratorService;
     this.factory = factory;
 }
Example #14
0
 public ViewsConvention(ICodeGeneratorService codeGeneratorService, IModelFactory factory)
 {
     this.factory = factory;
     this.codeGeneratorService = codeGeneratorService;
 }
 public CodeGeneratorController(Destiny.Core.Flow.CodeGenerator.ICodeGenerator codeGenerator, ICodeGeneratorService codeGeneratorService)
 {
     _codeGenerator        = codeGenerator;
     _codeGeneratorService = codeGeneratorService;
 }
 public GeneratedViewModelsConvention(ICodeGeneratorService codeGeneratorService)
 {
     this.codeGeneratorService = codeGeneratorService;
 }
Example #17
0
 public EntityTypeService(ICodeGeneratorService codeGen, IBaseEntityRepository <EntityType> baseRepository) : base(baseRepository)
 {
     _baseRepository = baseRepository;
     _codeGen        = codeGen;
 }
Example #18
0
 public ViewsConvention(ICodeGeneratorService codeGeneratorService, IModelFactory factory)
 {
     this.factory = factory;
     this.codeGeneratorService = codeGeneratorService;
 }
Example #19
0
        /// <summary>
        /// handles the flow of user selection for code generator/reader
        /// </summary>
        /// <param name="codeReaderService"></param>
        /// <param name="codeGeneratorService"></param>
        /// <param name="configuration"></param>
        /// <param name="userSelection"></param>

        public static void ProcessUserSelection(ICodeReaderService codeReaderService, ICodeGeneratorService codeGeneratorService,
                                                IConfigurationRoot configuration, ConsoleKeyInfo userSelection, ILogger logger)
        {
            switch (userSelection.KeyChar)
            {
            case '1':
                codeReaderService.ReadCode(configuration, logger);
                break;

            case '2':
                codeGeneratorService.GenerateCode(configuration, logger);
                break;

            default:
                break;
            }
        }
Example #20
0
 public CountryService(ICodeGeneratorService codeGenerator, ICountryRepository countryRepository, IBaseEntityRepository <Country> baseEntityRepository) : base(baseEntityRepository)
 {
     _baseEntityRepository = baseEntityRepository;
     _countryRepository    = countryRepository;
     _codeGenerator        = codeGenerator;
 }
Example #21
0
 public CatalogService(IAnchorService anchorService, ICodeGeneratorService codeGeneratorService, IBaseRepository <Catalog> baseRepository) : base(baseRepository)
 {
     _baseRepository       = baseRepository;
     _codeGeneratorService = codeGeneratorService;
     _anchorService        = anchorService;
 }
Example #22
0
 public OrderList(IMapper mapper, ICodeGeneratorService codeGeneratorService, IOrdersDbContext orderDbContext)
 {
     _mapper               = mapper;
     _orderDbContext       = orderDbContext;
     _codeGeneratorService = codeGeneratorService;
 }
Example #23
0
 public void GenerateCode(ICodeGeneratorService codeGenSvc)
 {
     instructions.ForEach(inst => inst.GenerateCode(codeGenSvc));
 }
        /// <summary>
        /// 点击生成按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGenerator_Click(object sender, EventArgs e)
        {
            var param = new CodeGeneratorParamInfo();

            try
            {
                param.Tables = new List <TableInfo>();
                foreach (DataGridViewRow row in dgvTable.Rows)
                {
                    DataGridViewCheckBoxCell checkCell = row.Cells[2] as DataGridViewCheckBoxCell;
                    if (checkCell.Value != null && Convert.ToBoolean(checkCell.Value))
                    {
                        param.Tables.Add(row.DataBoundItem as TableInfo);
                    }
                }

                if (param.Tables.Count == 0)
                {
                    MessageBox.Show("请勾选要生成的表");
                    return;
                }

                param.FunctionTypes = GetFunctionTypes();
                if (param.FunctionTypes.Length == 0)
                {
                    MessageBox.Show("请勾选要生成的功能项");
                    return;
                }

                if (string.IsNullOrWhiteSpace(txtNamespacePfx.Text))
                {
                    MessageBox.Show("命名空间前辍不能为空");
                    return;
                }
                param.NamespacePfx = txtNamespacePfx.Text;

                switch (cbxPKType.SelectedItem.ToString())
                {
                case "字符串":
                    param.PkType = PrimaryKeyType.STRING;

                    break;

                case "Guid":
                    param.PkType = PrimaryKeyType.GUID;

                    break;

                case "雪花算法":
                    param.PkType = PrimaryKeyType.SNOWFLAKE;

                    break;
                }
                param.Type     = dgvTable.Tag.ToString();
                param.IsTenant = cbxIsTenant.Checked;

                Cursor.Current = Cursors.WaitCursor;
                ICodeGeneratorService generatorService = AutofacTool.Resolve <ICodeGeneratorService>();
                ReturnInfo <bool>     returnInfo       = generatorService.Generator(param);
                Cursor.Current = Cursors.Default;
                if (returnInfo.Success())
                {
                    MessageBox.Show("生成成功");
                }
                else
                {
                    MessageBox.Show(returnInfo.Msg);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #25
0
 public SupplierService(ICodeGeneratorService codeGeneratorService, IBaseEntityRepository <Supplier> baseEntityRepository, ISupplierRepository supplierRepository) : base(baseEntityRepository)
 {
     _supplierRepository   = supplierRepository;
     _baseEntityRepository = baseEntityRepository;
     _codeGeneratorService = codeGeneratorService;
 }
Example #26
0
 public PartialViewModelsConvention(ICodeGeneratorService codeGeneratorService)
 {
     this.codeGeneratorService = codeGeneratorService;
 }
Example #27
0
 public abstract void GenerateCode(ICodeGeneratorService codeGenSvc);
Example #28
0
 public CodeGeneratorController(ICodeGeneratorService codeGeneratorService, ILogger <LookupController> logger)
 {
     this.codeGeneratorService = codeGeneratorService;
     _logger = logger;
 }
Example #29
0
 public override void GenerateCode(ICodeGeneratorService codeGenSvc)
 {
     codeGenSvc.BeginFor(Code);
     LoopInstructions.GenerateCode(codeGenSvc);
     codeGenSvc.EndFor();
 }
Example #30
0
 public UnitTestsConvention(ICodeGeneratorService codeGeneratorService, IModelFactory factory)
 {
     this.codeGeneratorService = codeGeneratorService;
     this.factory = factory;
 }
Example #31
0
 public ProductManager(IProductDal productDal, ICodeGeneratorService codeGeneratorService)
 {
     _productDal           = productDal;
     _codeGeneratorService = codeGeneratorService;
 }
 public ControllersConvention(ICodeGeneratorService codeGeneratorService, IModelFactory factory)
 {
     this.codeGeneratorService = codeGeneratorService;
     this.factory = factory;
 }