Пример #1
0
 public Entity()
 {
     Project = new Project();
     ProjectId = 1;
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                project.IsValid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            if (RefreshProject())
            {
                ClearPathFiles();
                CreatePathFiles();

                var json = JsonConvert.SerializeObject(project);

                StreamWriter linhas = new StreamWriter(path_project_json);
                linhas.Write(json);
                linhas.Close();

                json = File.ReadAllText(path_project_json);

                project = JsonConvert.DeserializeObject<Project>(json);
                GenerateDataContext();
                GenerateDependencyInjection();

                foreach (Entity entidade in project.Entities)
                {
                    entidade.Project = project;
                    GenerateRepository(entidade);
                    GenerateDomainServices(entidade);
                    GenerateAppServices(entidade);
                    GenerateWebApiController(entidade);

                    if (project.UseAngularJs)
                    {
                        if (project.AngularJs.AngularCtrl)
                        {
                            GenerateAngularCtrl(entidade);
                            GenerateAngularIndexCrudPage(entidade);
                        }
                        if (project.AngularJs.AngularRepository)
                            GenerateAngularRepository(entidade);
                    }
                }

                if (project.UseWebApi)
                {
                    if (project.WebApi.UseConfiguration)
                    {
                        GenerateWebApiConfiguration();
                        GenerateUnity();
                        GenerateCompression();
                    }
                }

                if (project.UseAngularJs)
                {
                    if (project.AngularJs.AngularApp)
                        GenerateAngularApp();
                    if (project.AngularJs.AngularRoutes)
                        GenerateAngularRoutes();
                }

                MessageBox.Show("Generated code with Success in " + project.PathFiles + @"\CodeHelper\");
                Application.Exit();
            }
        }
Пример #3
0
        private void FormPrincipal_Load(object sender, EventArgs e)
        {

            if (path_project_json == "insert_your_path_here")
            {
                MessageBox.Show("Configure project.json path on the code...");
                Application.Exit();
            }
            else
            {
                string json = File.ReadAllText(path_project_json);

                project = JsonConvert.DeserializeObject<Project>(json);


                List<Entity> entidades = new List<Entity>();
                entidades.Add(new Entity() { Id = 1, Name = "Cliente", Plural = "Clientes", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 2, Name = "Cidade", Plural = "Cidades", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "Estado", Plural = "Estados", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "Agendamento", Plural = "Agendamentos", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "BaixaReceber", Plural = "BaixasReceber", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "ContaReceber", Plural = "ContasReceber", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "FormaBaixaReceber", Plural = "FormasBaixaReceber", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "Usuario", Plural = "Usuarios", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "Horario", Plural = "Horarios", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "Estudio", Plural = "Estudios", ProjectId = 1, Project = null });
                entidades.Add(new Entity() { Id = 1, Name = "ClienteSite", Plural = "ClientesSite", ProjectId = 1, Project = null });

                project.Entities = entidades;

                #region Project
                txtProjectName.Text = project.Name;
                txtProjectNamespace.Text = project.ProjectNamespace;
                var source = new BindingSource();
                source.DataSource = project.Entities.ToList();
                dbEntities.AutoGenerateColumns = false;
                dbEntities.DataSource = source;
                #endregion

                #region Architeture
                txtDomain.Text = project.DomainLayer;
                txtDataLayer.Text = project.InfraLayer;
                txtApplication.Text = project.ApplicationLayer;
                txtService.Text = project.ServiceLayer;
                txtPresentation.Text = project.PresentationLayer;
                txtCommon.Text = project.CommonLayer;
                txtDependencyInjection.Text = project.DependencyInjectionLayer;
                #endregion

                #region DomainLayer
                txtEntities.Text = project.EntitiesName;
                txtDomainServiceClass.Text = project.ServiceClass;
                txtDomainServiceSufix.Text = project.ServiceBase;
                txtDomainServicePlural.Text = project.ServicePlural;
                #endregion

                #region InfraLayer
                txtRepositoryClass.Text = project.RepositoryClass;
                txtRepositoryBase.Text = project.RepositoryBase;
                txtRepositoryPlural.Text = project.RepositoryPlural;
                txtDataContext.Text = project.DataContext;
                chkUnitOfWork.Checked = project.UnitOfWork;

                txtDefaultVarchar.Value = decimal.Parse(project.DefaultVarcharMaxLenght.ToString());
                txtFluentMapSufix.Text = project.FluentMappingClassName;
                chkRemovePluralizing.Checked = project.RemovePluralizingTableNameConvention;
                chkRemoveOneToMany.Checked = project.RemoveOneToManyCascadeDeleteConvention;
                chkRemoveManyToMany.Checked = project.RemoveManyToManyCascadeDeleteConvention;
                chkLazyLoading.Checked = project.LazyLoading;
                txtConString.Text = project.ConnectionStringName;
                #endregion

                #region ApplicationLayer
                txtApplicationClass.Text = project.ApplicationClass;
                txtApplicationBase.Text = project.ApplicationBase;
                txtApplicationPlural.Text = project.ApplicationPlural;
                #endregion

                #region Service Layer
                chkUseWebApi.Checked = project.UseWebApi;
                grpWebApi.Visible = (chkUseWebApi.Checked);
                chkWebApiConfig.Checked = project.WebApi.UseConfiguration;
                chkWebApiController.Checked = project.WebApi.UseController;
                chkCompression.Checked = project.WebApi.UseCompression;
                #endregion

                #region PresentationLayer
                chkUseAngular.Checked = project.UseAngularJs;
                chkAngularApp.Checked = project.AngularJs.AngularApp;
                chkAngularController.Checked = project.AngularJs.AngularCtrl;
                chkAngularRepository.Checked = project.AngularJs.AngularRepository;
                chkAngularRoutes.Checked = project.AngularJs.AngularRoutes;
                grpAngular.Visible = project.UseAngularJs;

                txtAppName.Text = project.AngularJs.AppName;
                txtServiceURL.Text = project.AngularJs.ServiceUrl;
                chkTokenAuth.Checked = project.AngularJs.TokenAuthentication;
                txtAuthRepository.Text = project.AngularJs.AuthenticationRepository;
                txtLoginUrl.Text = project.AngularJs.LoginURL;

                #endregion

                #region CommonLayer
                chkAssertion.Checked = project.AssectionConcern;
                #endregion

                #region Files
                txtPath.Text = project.PathFiles;
                #endregion
            }
        }
Пример #4
0
 public FormPrincipal()
 {
     InitializeComponent();
     project = new Project();
 }