Example #1
0
        public void Startup(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            _logger = serviceProvider.GetRequiredService <ILogger>();

            _engine = serviceProvider.GetRequiredService <IClientEngine>();

            _networking = serviceProvider.GetRequiredService <ClientNetworking>();

            _entities = serviceProvider.GetRequiredService <ClientEntities>();

            _clientUI = new ImGuiInterface(_logger, _engine, this);

            _renderer = new Renderer.Renderer(
                _engine.GameWindow,
                _logger,
                _engine.FileSystem,
                _engine.CommandContext,
                _engine.UserInterface.WindowManager.InputSystem,
                _engine.Time,
                this,
                Framework.Path.EnvironmentMaps,
                Framework.Path.Shaders);

            _engine.GameWindow.Resized += _renderer.WindowResized;

            _entities.Startup(_renderer);
        }
Example #2
0
        public void Modificar(Personas personas)
        {
            using (ClientEntities DB = new ClientEntities())
            {
                Client_Table client = DB.Client_Table.Where(x => x.Client_Id == profile_.id_profile).First();

                client.Name      = personas.Nombre;
                client.LastName  = personas.Apellido;
                client.Birthday  = personas.nacimiento;
                client.ProfileID = profile_.id_profile;



                DB.Entry(client).State = System.Data.Entity.EntityState.Modified;
                DB.SaveChanges();

                Profile_Table profile = DB.Profile_Table.Find(profile_.id_profile);
                {
                    profile.Profiel_Description = personas.Description;
                    profile.Profiel_Name        = personas.Description;
                };
                DB.Entry(profile).State = System.Data.Entity.EntityState.Modified;
                DB.SaveChanges();
            };
        }
Example #3
0
        public ClientEntities Init()
        {
            var options = new DbContextOptions <ClientEntities>();

            //options.UseSqlServer("data source=.;initial catalog=MAINTENANCE;integrated security=True;MultipleActiveResultSets=True;", providerOptions => providerOptions.CommandTimeout(60))
            //       .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
            return(dbContext ?? (dbContext = new ClientEntities(options)));
        }
Example #4
0
        protected override void Execute()
        {
            var em = ClientEntities.Find(ClientEntity);

            if (em != null)
            {
                var evm = UIModel.Views.CreateBaseView(em.EntityType);
                Label = evm.Label;
            }
        }
Example #5
0
        // GET: View_1
        public ActionResult Index()
        {
            List <View_1> viewresult = new List <View_1>();

            using (var db = new ClientEntities())
            {
                viewresult = db.View_1.ToList();
            }

            return(View(viewresult));
        }
Example #6
0
        public static DbContext CreateDbContext()
        {
            DbContext dbContext = (DbContext)CallContext.GetData("dbContext");

            if (dbContext == null)
            {
                dbContext = new ClientEntities();
                CallContext.SetData("dbContext", dbContext);
            }
            return(dbContext);
        }
Example #7
0
        protected override void Execute()
        {
            if (!RafyEnvironment.Location.IsWebUI)
            {
                throw new InvalidOperationException("此命令只在 Web 模式下可用。");
            }

            var entityType = ClientEntities.Find(this.EntityType).EntityType;

            this.code = RF.Concrete <AutoCodeInfoRepository>().GetOrCreateAutoCode(entityType);
        }
 internal void Read(EntityViewMeta evm)
 {
     this.Id = GetRuntimeUniqueId(evm);
     if (evm.GroupBy != null) this.GroupBy = evm.GroupBy.Name;
     if (evm is WebEntityViewMeta)
     {
         this.PageSize = evm.AsWebView().PageSize;
     }
     this.EntityType = ClientEntities.GetClientName(evm.EntityType);
     if (!string.IsNullOrEmpty(evm.ExtendView)) this.ViewName = evm.ExtendView;
 }
Example #9
0
        protected override void ConfigView()
        {
            View.DomainName("岗位用户").DisableEditing();

            View.UseDefaultCommands().UseCommand("Rafy.rbac.cmd.LookupSelectAddOrgPositionUser")
            .HasLabel("选择用户")
            .SetExtendedProperty("targetClass", ClientEntities.GetClientName(typeof(User)));
            View.RemoveCommands(WebCommandNames.Add);

            View.Property(OrgPositionUser.View_CodeProperty).HasLabel("编码").ShowIn(ShowInWhere.List);
            View.Property(OrgPositionUser.View_NameProperty).HasLabel("名称").ShowIn(ShowInWhere.List);
        }
 public static ClientEntities.OrderDetail ToClientEntity(this OrderDetail detail, ClientEntities.Order order)
 {
     if (detail == null) return null;
     return new ClientEntities.OrderDetail
     {
         OrderDetailId = detail.OrderDetailId,
         OrderId = detail.OrderId,
         ProductId = detail.ProductId,
         Quantity = detail.Quantity,
         UnitPrice = detail.UnitPrice,
         Order = order
     };
 }
Example #11
0
        public virtual ViewConfigurationModel GetBy(ViewConfigurationModelNameCriteria criteria)
        {
            Type entityType = ClientEntities.Find(criteria.EntityType).EntityType;

            var evm = UIModel.Views.Create(entityType, criteria.ViewName);

            var m = new ViewConfigurationModel();

            m.Read(evm);
            (m as IDirtyAware).MarkSaved();

            return(m);
        }
Example #12
0
        public void agregar_client(Personas persona)
        {
            using (ClientEntities DB = new ClientEntities())
            {
                Client_Table cliete = new Client_Table();

                cliete.Name      = persona.Nombre;
                cliete.LastName  = persona.Apellido;
                cliete.Birthday  = persona.nacimiento;
                cliete.ProfileID = profile_.id_profile;
                DB.Client_Table.Add(cliete);
                DB.SaveChanges();
            }
        }
Example #13
0
        public List <Personas> Encontrar()
        {
            using (ClientEntities DB = new ClientEntities())
            {
                var list = DB.Client_Table.Where(x => x.Client_Id == profile_.id_profile).Select(x => new Personas
                {
                    Nombre     = x.Name,
                    Apellido   = x.LastName,
                    nacimiento = x.Birthday
                }).ToList();

                return(list);
            }
        }
Example #14
0
        public void Borrar(Personas personas)
        {
            using (ClientEntities DB = new ClientEntities())
            {
                var elimanar = DB.Client_Table.Find(personas.id);

                DB.Client_Table.Remove(elimanar);
                DB.SaveChanges();

                var eliminar_profile = DB.Profile_Table.Find(personas.id);
                DB.Profile_Table.Remove(eliminar_profile);
                DB.SaveChanges();
            }
        }
Example #15
0
        public override void Execute(LogicalView view)
        {
            var blocks = UIModel.AggtBlocks.GetDefinedBlocks("ViewConfigurationModel模块界面");

            var ui = AutoUI.AggtUIFactory.GenerateControl(blocks);

            ui.MainView.DataLoader.LoadDataAsync(() =>
            {
                var model = RF.Concrete <ViewConfigurationModelRepository>()
                            .GetBy(new ViewConfigurationModelNameCriteria
                {
                    EntityType = ClientEntities.GetClientName(view.EntityType),
                    ViewName   = view.Meta.ExtendView
                });

                return(model);
            });

            App.Windows.ShowWindow(ui.Control, w =>
            {
                w.Title = "定制".Translate() + " " + view.Meta.Label.Translate();
                w.WindowClosedByUser += (o, e) =>
                {
                    if (e.Button == WindowButton.Yes)
                    {
                        //先执行保存。
                        ui.MainView.Commands[WPFCommandNames.SaveBill].TryExecute();

                        if (!App.Windows.HasPopup)
                        {
                            var res = App.MessageBox.Show("重新打开当前模块以使设置生效?".Translate(), MessageBoxButton.YesNo);
                            if (res == MessageBoxResult.Yes)
                            {
                                var ws = App.Current.Workspace;
                                var aw = ws.ActiveWindow;
                                if (aw != null && ws.TryRemove(aw))
                                {
                                    App.Current.OpenModuleOrAlert(aw.Title);
                                }
                            }
                        }
                        else
                        {
                            App.MessageBox.Show("下次打开此弹出窗口时生效。".Translate(), MessageBoxButton.OK);
                        }
                    }
                };
            });
        }
Example #16
0
 public List <Personas> Datos()
 {
     using (ClientEntities DB = new ClientEntities())
     {
         var listado = DB.Client_Table.Join(DB.Profile_Table, x => x.ProfileID, y => y.Id_Profiel, (x, y) => new { x, y }).Select(x => new Personas
         {
             id          = x.x.Client_Id,
             Nombre      = x.x.Name,
             Apellido    = x.x.LastName,
             nacimiento  = x.x.Birthday,
             profile     = x.y.Profiel_Name,
             Description = x.y.Profiel_Description
         }).ToList();
         return(listado);
     }
 }
Example #17
0
        protected BlockConfigKey GetInputKey()
        {
            if (!string.IsNullOrEmpty(this.Model))
            {
                var key = new BlockConfigKey
                {
                    EntityType = ClientEntities.Find(this.Model).EntityType,
                    ExtendView = this.ViewName,
                    Type = RafyEnvironment.BranchProvider.HasBranch ? BlockConfigType.Customization : BlockConfigType.Config
                };

                var dv = ViewConfigurationModel.ViewNameProperty.GetMeta(typeof(ViewConfigurationModel)).DefaultValue;
                if (key.ExtendView == dv) { key.ExtendView = null; }

                return key;
            }

            return null;
        }
Example #18
0
        public void agregar_profile(Personas personas)
        {
            using (ClientEntities DB = new ClientEntities())
            {
                Profile_Table profile = new Profile_Table();

                profile.Profiel_Name        = personas.profile;
                profile.Profiel_Description = personas.Description;
                DB.Profile_Table.Add(profile);
                DB.SaveChanges();

                Profile_Table listado = DB.Profile_Table.Where(x => x.Profiel_Description == personas.Description).First();

                profile_.id_profile = listado.Id_Profiel;

                Action <Personas> action = agregar_client;
                action(personas);
            }
        }
Example #19
0
        internal static ComboListConfig CreateComboList(EntityPropertyViewMeta property)
        {
            var comboList = new ComboListConfig();

            comboList.model = ClientEntities.GetClientName(property.SelectionViewMeta.SelectionEntityType);

            var title = property.SelectionViewMeta.RefTypeDefaultView.TitleProperty;

            if (title != null)
            {
                comboList.displayField = title.Name;
            }

            var dsp = property.SelectionViewMeta.DataSourceProperty;

            if (dsp != null)
            {
                comboList.dataSourceProperty = dsp.Name;
            }

            return(comboList);
        }
Example #20
0
        private void ConvertToClientMeta(WebEntityViewMeta evm, ClientEntityViewMeta clientMeta, bool?isDetail)
        {
            clientMeta.model    = ClientEntities.GetClientName(evm.EntityType);
            clientMeta.viewName = evm.ExtendView;
            clientMeta.label    = evm.Label;

            if (isDetail.GetValueOrDefault(this.Option.isDetail))
            {
                clientMeta.formConfig = CreateFormConfig(evm);
            }
            else
            {
                clientMeta.gridConfig = CreateGridConfig(evm);

                if (evm.EntityMeta.IsTreeEntity)
                {
                    clientMeta.storeConfig = new TreeStoreConfig();
                }
                else
                {
                    var groupBy = evm.GroupBy;
                    if (groupBy != null)
                    {
                        var n = groupBy.Name;
                        if (groupBy.IsReference)
                        {
                            n = EntityModelGenerator.LabeledRefProperty(n);
                        }
                        clientMeta.groupBy = n;
                    }

                    clientMeta.storeConfig = new StoreConfig
                    {
                        pageSize = evm.PageSize
                    };
                }
            }
        }
Example #21
0
        /// <summary>
        /// 把实体列表对应的 json 转换为 EntityList 对象。
        /// </summary>
        /// <param name="jEntityList"></param>
        /// <param name="repository">如果没有显式指定 Repository,则会根据 json 中的 _model 属性来查找对应的实体仓库。</param>
        /// <param name="resultEntityList">如果显式指定 Repository,则会把转换的实体对象都加入到这个列表中。</param>
        /// <returns></returns>
        internal static EntityList JsonToEntity(JObject jEntityList, EntityRepository repository = null, EntityList resultEntityList = null)
        {
            if (repository == null)
            {
                var modelProperty = jEntityList.Property("_model");
                if (modelProperty == null)
                {
                    throw new NotSupportedException("实体列表对应的 Json 应该有 _model 属性。");
                }
                var model        = modelProperty.Value.CastTo <JValue>().Value.CastTo <string>();
                var clientEntity = ClientEntities.Find(model);
                repository = RF.Find(clientEntity.EntityType);
            }

            ListReader reader = repository.SupportTree ? new TreeEntityListReader() : new EntityListReader() as ListReader;

            reader.Repository       = repository;
            reader.ChangeSet        = jEntityList;
            reader.ResultEntityList = resultEntityList;

            reader.Read();

            return(reader.ResultEntityList);
        }
 public BranchRepository(ClientEntities _dataContext) : base(_dataContext)
 {
 }
Example #23
0
 protected RepositoryBase(ClientEntities _dataContext)
 {
     //DbFactory = dbFactory;
     dataContext = _dataContext;
     dbSet       = DbContext.Set <T>();
 }
 /// <summary>
 /// 导航面板查询
 /// </summary>
 /// <param name="criteria"></param>
 protected EntityList FetchBy(ViewConfigurationModelNameCriteria criteria)
 {
     Type entityType = ClientEntities.Find(criteria.EntityType).EntityType;
     return this.DA_GetByEntity(entityType, criteria.ViewName);
 }
 public ClientNetworking(IEngineModels engineModels, GameClient gameClient, ClientEntities entities)
 {
     _engineModels = engineModels ?? throw new ArgumentNullException(nameof(engineModels));
     _gameClient   = gameClient ?? throw new ArgumentNullException(nameof(gameClient));
     _entities     = entities ?? throw new ArgumentNullException(nameof(entities));
 }
Example #26
0
 protected override void ToJson(LiteJsonWriter json)
 {
     json.WriteProperty("model", ClientEntities.GetClientName(model));
     json.WriteProperty("total", total);
     json.WriteProperty("entities", entities);
 }
 public ClientEntities Init()
 {
     return(clientEntitiesDB ?? (clientEntitiesDB = new ClientEntities()));
 }
Example #28
0
 public ClientEntityList(EntityDictionary entityDictionary, int maxClients, ClientEntities entities)
     : base(entityDictionary, maxClients)
 {
     _entities = entities ?? throw new ArgumentNullException(nameof(entities));
 }
Example #29
0
        public HttpResponseMessage UpdateCliente(ClientEntities model)
        {
            var Httpresponse = new HttpResponseMessage();

            try
            {
                var id = GetEmployeeId();

                if (!id.HasValue)
                {
                    Httpresponse     = new HttpResponseMessage(HttpStatusCode.Unauthorized);
                    response.Code    = HttpStatusCode.Unauthorized;
                    response.Message = "Authorization has been denied for this request.";
                    response.Result  = null;

                    Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response));
                    Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                    return(Httpresponse);
                }
                else
                {
                    if (model == null)
                    {
                        Httpresponse = new HttpResponseMessage(HttpStatusCode.BadGateway);
                        return(Httpresponse);
                    }
                    else
                    {
                        var client = context.Client.FirstOrDefault(x => x.State == ConstantHelper.Status.ACTIVE && x.ClientId == model.clientId);

                        client.ClientId   = model.clientId;
                        client.Name       = model.name;
                        client.LastName   = model.lastName;
                        client.FullName   = model.name + " " + model.lastName;
                        client.DNI        = model.dni;
                        client.Email      = model.email;
                        client.Phone      = model.phone;
                        client.LocationId = model.locationId;
                        client.DateUpdate = DateTime.Today;
                        client.State      = ConstantHelper.Status.ACTIVE;
                        client.Sex        = model.sex;

                        context.SaveChanges();
                    }

                    Httpresponse     = new HttpResponseMessage(HttpStatusCode.OK);
                    response.Code    = HttpStatusCode.OK;
                    response.Message = "Success";
                    response.Result  = null;
                }

                Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response));
                Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                return(Httpresponse);
            }
            catch
            {
                Httpresponse = new HttpResponseMessage(HttpStatusCode.BadGateway);
                return(Httpresponse);
            }
        }