protected void Page_Load(Object sender, EventArgs e) { administratorMasterPage = (AdministratorMasterPage)Page.Master; administratorMasterPage.AddMenuItems(); administratorMasterPage.InitializeMasterPageComponents(); dataAccess = administratorMasterPage.dataAccess; AdministratorLoginDAO administratorLoginDAO = new AdministratorLoginDAO(dataAccess.GetConnection()); List <Object> loginList = administratorLoginDAO.GetAllLogins(); String[] columnNames = new String[] { "Login" }; String alterScript = "window.open('LoginSettings.aspx?loginId=' + {0}, 'Settings', 'width=540,height=600');"; EditableListButton[] buttons = new EditableListButton[] { // Botões que devem aparecer para os items da lista new EditableListButton("Editar", alterScript, ButtonTypeEnum.Edit), }; EditableList editableList = new EditableList(configurationArea, columnNames, buttons); foreach (AdministratorLogin login in loginList) { editableList.InsertItem(login.id, false, new String[1] { login.username }); } editableList.DrawList(); // O clique do botão chama o script de alteração passando "id = 0", a tela de alteração // interpreta "id = 0" como "criar um novo", o id é então gerado no banco de dados. btnNovo.Attributes.Add("onClick", String.Format(alterScript, 0)); }
public async Task <IDictionary <QuestionWithOffered, Answer> > GetQuestionsWithAnswersAsync(long?abpSessionUserId, int surveyId) { var result = new Dictionary <QuestionWithOffered, Answer>(); List <QuestionWithOffered> questionWithOffereds = new EditableList <QuestionWithOffered>(); var questionAssignment = (await _surveyQuestionRepository.GetAllListAsync(a => a.SurveyId == surveyId)).OrderBy(a => a.Order); foreach (var surveyQuestion in questionAssignment) { var question = await _questionRepository.GetAsync(surveyQuestion.QuestionId); var questionWithOffered = new QuestionWithOffered() { Question = question, OfferedAnswers = GetOfferedAnswers(question.Id, surveyId).ToList() }; questionWithOffereds.Add(questionWithOffered); } foreach (var question in questionWithOffereds) { //Answer from the user var answer = _answerRepository.GetAllIncluding(a => a.SelectedAnswers).FirstOrDefault(a => a.QuestionId == question.Question.Id && a.CreatorUserId == abpSessionUserId && a.SurveyId == surveyId) ?? new Answer() { SelectedAnswers = new List <SelectedAnswer>() }; result.Add(question, answer); } return(result); }
public ReturnModel <TenantListDto> GetTenantsTable(RequestModel <object> input) { if (AbpSession.TenantId == null) { CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant); CurrentUnitOfWork.DisableFilter(AbpDataFilters.MustHaveTenant); CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete); } int count; var query = TenantManager.Tenants; List <Expression <Func <Tenant, string> > > searchs = new EditableList <Expression <Func <Tenant, string> > >(); searchs.Add(a => a.Name); searchs.Add(a => a.TenancyName); var filteredByLength = GenerateTableModel(input, query, searchs, "Id", out count); return(new ReturnModel <TenantListDto>() { iTotalDisplayRecords = count, recordsTotal = query.Count(), recordsFiltered = filteredByLength.Count, length = input.length, data = filteredByLength.Select(a => a.MapTo <TenantListDto>()).ToArray(), draw = input.draw, }); }
public void Setup() { LoggerMock = new Mock <ILogger>(); ApprovalServiceMock = new Mock <IApprovalService>(); AmqSettingsMock = new Mock <IOptions <AmqSettings> >(); AmqSettingsMock.SetupGet(o => o.Value).Returns(new AmqSettings()); EFContext = EFContextFactory.CreateInMemoryEFContext(); _technicalFeeService = new Mock <ITechnicalFeeService>(); RevisionPermissionService = new Mock <ICostStageRevisionPermissionService>(); CostStageRevisionService = new Mock <ICostStageRevisionService>(); CostBuilderMock = new Mock <ICostBuilder>(); var costBuilders = new EditableList <Lazy <ICostBuilder, PluginMetadata> > { new Lazy <ICostBuilder, PluginMetadata>( () => CostBuilderMock.Object, new PluginMetadata { BuType = BuType.Pg }) }; var userServiceMock = new Mock <IUserService>(); var configuration = new MapperConfiguration(config => config.AddProfiles( typeof(AdminProfile), typeof(SupportingDocumentProfile) ) ); var mapper = new Mapper(configuration); ActivityLogServiceMock = new Mock <IActivityLogService>(); _eventServiceMock = new Mock <IEventService>(); CostApprovalService = new CostApprovalService(ApprovalServiceMock.Object, _technicalFeeService.Object, EFContext, costBuilders, userServiceMock.Object, ActivityLogServiceMock.Object, _eventServiceMock.Object, RevisionPermissionService.Object, CostStageRevisionService.Object ); User = new UserIdentity { Email = "UserName", AgencyId = Guid.NewGuid(), Id = Guid.NewGuid() }; Service = new CostStageRevisionService( LoggerMock.Object, mapper, EFContext, new[] { new Lazy <ICostBuilder, PluginMetadata>( () => CostBuilderMock.Object, new PluginMetadata { BuType = BuType.Pg }) } ); }
public void SortTest() { EditableList <EditableTestObject> dataList = new EditableList <EditableTestObject>(); dataList.Add(EditableTestObject.CreateInstance(1, "John", 60)); dataList.Add(EditableTestObject.CreateInstance(1, "John", 60)); dataList.Add(EditableTestObject.CreateInstance(1, "John", 60)); dataList.Add(EditableTestObject.CreateInstance(2, "Tester", 70)); dataList.Add(EditableTestObject.CreateInstance(2, "Tester", 70)); dataList.Add(EditableTestObject.CreateInstance(2, "Tester", 70)); dataList.Add(EditableTestObject.CreateInstance(3, "Tester", 70)); dataList.Add(EditableTestObject.CreateInstance(3, "Tester", 70)); dataList.Add(EditableTestObject.CreateInstance(3, "Tester", 70)); BindingSource bindingSource = new BindingSource(dataList, null); bindingSource.Sort = "ID"; int prev = 0; foreach (EditableTestObject o in dataList) { Assert.IsTrue(o.ID >= prev); prev = o.ID; } bindingSource[0] = EditableTestObject.CreateInstance(2, "John", 60); prev = 0; foreach (EditableTestObject o in dataList) { Assert.IsTrue(o.ID >= prev); prev = o.ID; } }
public void TestGetMissingParentIds_TreeEntity_5() { var id = Guid.NewGuid(); var id2 = Guid.NewGuid(); var id3 = Guid.NewGuid(); List <TreeEntitySample> samples = new EditableList <TreeEntitySample> { new TreeEntitySample(id2, $"{id},{id2},") { ParentId = id }, new TreeEntitySample(id3, $"{id},{id2},{id3}") { ParentId = id2 }, new TreeEntitySample(id2, $"{id},{id2},") { ParentId = id }, new TreeEntitySample(id3, $"{id},{id2},{id3}") { ParentId = id2 } }; var result = samples.GetMissingParentIds <TreeEntitySample, Guid, Guid?>(); Assert.Single(result); Assert.Equal(id, result[0].ToGuid()); }
public List <MajorProjectTotalmodel> GetMajorProjectTotal(Period currentPeriod, string majorId) { List <MajorProjectTotalmodel> projectTotal = new EditableList <MajorProjectTotalmodel>(); var projectsId = _db.SectionProjectsRels.Where(x => x.Section.Period.Number == currentPeriod.Number && x.Section.Period.Year == currentPeriod.Year) .Select(x => x.Project.Id) .ToList(); foreach (var p in projectsId) { var result = _db.ProjectMajorRels.Where(x => x.Major.MajorId == majorId && x.Project.Id == p) .Where(x => x.Project != null) .Select(x => new { x.Major.Name, x.Major.MajorId }).Distinct().ToList(); if (result.Count > 0) { projectTotal.Add(new MajorProjectTotalmodel { Major = result.ElementAt(0).Name, Total = result.Count, MajorId = result.ElementAt(0).MajorId }); } } return(projectTotal); }
public ReturnModel <CategoryDto> GetCategories(RequestModel <object> requestModel) { int count; var categories = _categoryRepository.GetAll(); List <Expression <Func <Category, string> > > searchs = new EditableList <Expression <Func <Category, string> > >(); searchs.Add(a => a.Name); searchs.Add(a => a.DisplayName); var filteredElements = GenerateTableModel(requestModel, categories, searchs, "Name", out count); return(new ReturnModel <CategoryDto>() { data = filteredElements.Select(a => new CategoryDto() { Id = a.Id, Languages = AsyncHelper.RunSync(() => GetAvailableLangs(a.Id)), Name = a.Name, DisplayName = a.DisplayName }).ToArray(), draw = requestModel.draw, length = requestModel.length, recordsTotal = count, iTotalDisplayRecords = count, iTotalRecords = categories.Count(), recordsFiltered = categories.Count() }); }
public SelectInventoryForm(Model model) { _model = model; InitializeComponent(); _list = _model.InventoryGetAll(); Filter(); }
protected override void SetupPropertyGet(Mock <IObjectEditor> editorMock, IPropertyInfo property, Func <ValueInfo <int> > valueGet) { base.SetupPropertyGet(editorMock, property, valueGet); editorMock.Setup(oe => oe.GetValueAsync <IReadOnlyList <int> >(property, null)).ReturnsAsync(() => { var valueInfo = valueGet(); int value = valueInfo.Value; int[] values = (int[])Enum.GetValues(typeof(FlagsTestEnum)); List <int> setValues = new EditableList <int> (); for (int i = 0; i < values.Length; i++) { int v = values[i]; if ((value & v) == v) { setValues.Add(v); } } return(new ValueInfo <IReadOnlyList <int> > { Value = setValues, Source = valueInfo.Source, SourceDescriptor = valueInfo.SourceDescriptor, CustomExpression = valueInfo.CustomExpression, ValueDescriptor = valueInfo.ValueDescriptor }); }); }
public override BaseButton[] CreateRowButtons() { List <BaseButton> list = new EditableList <BaseButton>(); list.Add(new RateOfGroupEditModal("Save", "编辑概率")); return(list.ToArray()); }
public void SetDataSource(IObject parent, EditableList <T> list, int?haCode = null) { m_DataSourceParent = parent; m_DataSource = list; m_DataSource.ForEach(SetEnvironment); Refresh(m_DataSource, String.Empty); DxControlsHelper.SetGridConstraints(Grid.GridControl, ObjectAccessor.MetaInterface(BusinessObject.GetType())); if (m_DataSource != null) { m_DataSource.Creator = CreateNewItem; } VisualizePermissions(); var acc = BusinessObject.GetAccessor() as IObjectCreator; if (acc != null) { using (DbManagerProxy manager = CreateDbManagerProxy()) { BusinessObject = acc.CreateFake(manager, parent, haCode); var layout = GetLayout(); if (layout != null) { layout.RefreshActionButtons(); } InitGridBehavior(BusinessObject, manager); } } LoadGridLayout(); }
/// <summary> /// </summary> /// <param name="dataSource"></param> /// <param name="filterString"></param> public virtual void Refresh(EditableList <T> dataSource, string filterString) { var oldRowHandle = m_ListGridControl.GridView.FocusedRowHandle; Grid.GridControl.DataSource = dataSource; if (dataSource == null) { return; } foreach (T obj in dataSource) { obj.ValidationEnd += ObjOnValidationEnd; obj.Validation += ShowError; } if (!String.IsNullOrEmpty(filterString)) { filterString = String.Format("!IsMarkedToDelete and ({0})", filterString); Grid.GridView.ActiveFilter.NonColumnFilter = filterString; } else { Grid.GridView.ActiveFilter.NonColumnFilter = "!IsMarkedToDelete"; } int newRowHandle = Grid.GridView.FocusedRowHandle; if (oldRowHandle == newRowHandle) { RefreshFocusedItem(); } }
/// <summary> /// Составляет промежуточные таблицы для таблицы тестов /// </summary> /// <param name="labTests"></param> /// <returns></returns> public static List <SummaryTable> GetSummaryTables(EditableList <VectorLabTest> labTests) { var summaryTables = new List <SummaryTable>(); foreach (var labTest in labTests) { if (labTest.IsMarkedToDelete) { continue; } if (!labTest.idfsTestName.HasValue) { continue; } var idTestName = labTest.idfsTestName.Value; if (summaryTables.Count(c => c.idTestName == idTestName) > 0) { continue; } var summaryTable = new SummaryTable(); summaryTable.ParseTestTable(labTests, idTestName, labTest.strTestName); summaryTables.Add(summaryTable); } return(summaryTables); }
/// <summary> /// Ceate process definition /// </summary> /// <param name="definition"></param> /// <param name="status"></param> /// <param name="version"></param> /// <param name="accounts"></param> /// <exception cref="NotImplementedException"></exception> public void Create(ProcessDefinition definition, ProcessDefStatusEnum status, int version, params AccountData[] accounts) { Md5CalcVisitor visitor = new Md5CalcVisitor(); definition.Accept(visitor); string md5 = visitor.CalculateMd5(); if (_collection.Find(f => f.FlowId == definition.FlowId && string.Equals(f.Md5, md5)).Count() != 0) { throw new ArgumentException($"Persistend Workflow definition FlowId={definition.FlowId} Md5={md5} already exists."); } List <AccountData> accountsList = new EditableList <AccountData>(); if (accounts != null) { accountsList.AddRange(accounts); } ProcessDefinitionPersistence pd = new ProcessDefinitionPersistence { Id = definition.Id, FlowId = definition.FlowId, Version = version, Name = definition.Name, Description = definition.Description, LastModified = DateTime.UtcNow, Status = (int)status, Md5 = md5, JsonProcessDefinition = ToBase64(JsonConvert.SerializeObject(definition)), Accounts = accountsList }; _collection.InsertOne(pd); }
public void CloneTest() { var src = new EditableList <int> { 1, 2, 3 }; var clone = (EditableList <int>)src.Clone(); Assert.AreEqual(src.Count, clone.Count); Assert.AreEqual(src.NewItems.Count, clone.NewItems.Count); Assert.AreEqual(src.DelItems.Count, clone.DelItems.Count); src.AcceptChanges(); clone = (EditableList <int>)src.Clone(); Assert.AreEqual(src.Count, clone.Count); Assert.AreEqual(src.NewItems.Count, clone.NewItems.Count); Assert.AreEqual(src.DelItems.Count, clone.DelItems.Count); src.RemoveAt(1); clone = (EditableList <int>)src.Clone(); Assert.AreEqual(src.Count, clone.Count); Assert.AreEqual(src.NewItems.Count, clone.NewItems.Count); Assert.AreEqual(src.DelItems.Count, clone.DelItems.Count); }
public ReturnModel <PageDto> GetPageList(RequestModel <object> input) { var query = _pageRepository.GetAll(); List <Expression <Func <Page, string> > > searchs = new EditableList <Expression <Func <Page, string> > >(); searchs.Add(a => a.Name); searchs.Add(a => a.Category.DisplayName); searchs.Add(a => a.TemplateName); int count; var pages = GenerateTableModel(input, query, searchs, "Name", out count); return(new ReturnModel <PageDto>() { data = pages.Select(a => new PageDto() { Id = a.Id, Langs = AsyncHelper.RunSync(() => GetAvailableLangs(a.Id)), Title = a.Name, CategoryName = a.CategoryId.HasValue ? GetCategoryName(a) : "", TemplateName = a.TemplateName, }).ToArray(), draw = input.draw, length = input.length, recordsTotal = count, iTotalDisplayRecords = count, iTotalRecords = query.Count(), recordsFiltered = pages.Count() }); }
public ActionResult ContactDetails(long rootKey, long contactedCasePersonId, bool getFromSession = true) { HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null); ViewBag.CanUpdate = humanCaseAccessor.CanUpdate; ViewBag.RootKey = rootKey; if (getFromSession) { var contactedCasePerson = (ContactedCasePerson)ModelStorage.Get(Session.SessionID, contactedCasePersonId, null); return(View(contactedCasePerson)); } var humanCase = (HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null); EditableList <ContactedCasePerson> list = humanCase.ContactedPerson; var root = (long)((HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null)).Key; ContactedCasePerson item; if (contactedCasePersonId == 0) { using (DbManagerProxy manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { var accessor = ContactedCasePerson.Accessor.Instance(null); item = accessor.Create(manager, humanCase, rootKey); item.NewObject = true; ModelStorage.Put(Session.SessionID, root, item.idfContactedCasePerson, null, item); return(View(item)); } } item = list.SingleOrDefault(c => c.idfContactedCasePerson == contactedCasePersonId); ModelStorage.Put(Session.SessionID, root, item.idfContactedCasePerson, null, item); return(View(item)); }
protected void Page_Load(object sender, EventArgs e) { settingsMasterPage = (SettingsMasterPage)Page.Master; settingsMasterPage.InitializeMasterPageComponents(); int deviceId; Boolean isNumeric = int.TryParse(Request.QueryString["deviceId"], out deviceId); if (!isNumeric) { EmbedClientScript.ShowErrorMessage(this, "Os parâmetros passados para a página não estão em um formato válido.", true); return; } printingDeviceDAO = new PrintingDeviceDAO(settingsMasterPage.dataAccess.GetConnection()); List <Object> counterHistory = printingDeviceDAO.GetCounterHistory(deviceId); String[] columnNames = new String[] { "Contador", "Data" }; EditableList editableList = new EditableList(displayArea, columnNames, null); foreach (Object counter in counterHistory) { PageCounter pageCounter = (PageCounter)counter; String[] counterProperties = new String[] { pageCounter.counter.ToString(), String.Format("{0:dd/MM/yyyy HH:mm}", pageCounter.date) }; editableList.InsertItem(pageCounter.id, false, counterProperties); } editableList.DrawList(); }
public ReturnModel <UserListDto> GetUsersForTable(RequestModel <object> model) { int totalCount; var query = _userRepository.GetAll(); List <Expression <Func <User, string> > > searchs = new EditableList <Expression <Func <User, string> > >(); searchs.Add(a => a.UserName); searchs.Add(a => a.EmailAddress); searchs.Add(a => a.Name); searchs.Add(a => a.Surname); var filterByLength = GenerateTableModel(model, query, searchs, "UserName", out totalCount); return(new ReturnModel <UserListDto>() { draw = model.draw, length = model.length, recordsTotal = totalCount, iTotalDisplayRecords = totalCount, iTotalRecords = query.Count(), data = filterByLength.Select(a => a.MapTo <UserListDto>()).ToArray(), recordsFiltered = filterByLength.Count() }); }
protected void Page_Load(Object sender, EventArgs e) { administratorMasterPage = (AdministratorMasterPage)Page.Master; administratorMasterPage.AddMenuItems(); administratorMasterPage.InitializeMasterPageComponents(); TenantDAO tenantDAO = new TenantDAO(administratorMasterPage.dataAccess.GetConnection()); LicenseDAO licenseDAO = new LicenseDAO(administratorMasterPage.dataAccess.GetConnection()); String[] columnNames = new String[] { "Empresa", "Quantidade de Licenças" }; String addScript = "window.open('AddLicenses.aspx?tenantId=' + {0}, 'AddLicenses', 'width=540,height=600');"; EditableListButton[] buttons = new EditableListButton[] { // Botões que devem aparecer para os items da lista new EditableListButton("Adicionar", addScript, ButtonTypeEnum.Edit) }; EditableList editableList = new EditableList(configurationArea, columnNames, buttons); List <Object> tenantList = tenantDAO.GetAllTenants(); foreach (Tenant tenant in tenantList) { String[] itemProperties = new String[] { tenant.alias, licenseDAO.GetAllLicenses(tenant.id).Count.ToString() }; editableList.InsertItem(tenant.id, false, itemProperties); } editableList.DrawList(); }
private static EditableList <VetFarmTree> RootTreeToFarm(DbManagerProxy manager, IObject Parent, EditableList <RootFarmTree> roots, long?idfCase = null) { var farmTree = new EditableList <VetFarmTree>(); var treeAccessor = VetFarmTree.Accessor.Instance(null); foreach (var farmroot in roots.Where(x => x.idfParentParty == null)) { VetFarmTree farmItem = treeAccessor.CreateNewT(manager, Parent, farmroot._HACode); farmTree.Add(farmItem); foreach (var herdroot in roots.Where(x => x.idfParentParty == farmroot.idfParty)) { VetFarmTree herdItem = treeAccessor.CreateHerd(manager, Parent, farmItem); herdItem.strName = herdroot.strName; farmTree.Add(herdItem); foreach (var speciesroot in roots.Where(x => x.idfParentParty == herdroot.idfParty)) { VetFarmTree species = treeAccessor.CreateSpecies(manager, Parent, herdItem); species.idfsSpeciesTypeReference = speciesroot.idfsSpeciesTypeReference; species.SpeciesType = speciesroot.SpeciesType; species.strHerdName = herdItem.strName; farmTree.Add(species); } } } if (idfCase.HasValue) { farmTree.ForEach(x => x.idfCase = idfCase.Value); } return(farmTree); }
public SelectCarForm(Model model) { _model = model; InitializeComponent(); _list = _model.CarGetAll(); Filter(); }
public void When_Perform_Get_Request_To_EducationOrganizationList_Return_Education_Organization_List() { // Arrange var schools = new EditableList <School> { new School() }; var leas = new EditableList <LocalEducationAgency> { new LocalEducationAgency() }; _mockOdsApiFacade.Setup(x => x.GetAllSchools()).Returns(schools); _mockOdsApiFacade.Setup(x => x.GetAllLocalEducationAgencies()).Returns(leas); _mockOdsApiFacadeFactory.Setup(x => x.Create()) .Returns(Task.FromResult(_mockOdsApiFacade.Object)); _controller = new EducationOrganizationsController(_mockOdsApiFacadeFactory.Object, _mockMapper.Object, _mockInstanceContext.Object); // Act var result = _controller.EducationOrganizationList().Result as PartialViewResult; // Assert result.ShouldNotBeNull(); var model = (EducationOrganizationViewModel)result.ViewData.Model; model.ShouldNotBeNull(); model.Schools.Count.ShouldBeGreaterThan(0); model.LocalEducationAgencies.Count.ShouldBeGreaterThan(0); }
/// <summary> /// Для указанной табличной секции /// </summary> /// <param name="sectionNode"></param> /// <param name="activityParameters"></param> /// <returns></returns> public static int GetNumForNewRow(this FlexNode sectionNode, EditableList <ActivityParameter> activityParameters) { var idParameters = sectionNode.GetIDParametersForSection(); var numRow = 0; var findedRows = 0; foreach (var ap in activityParameters) { if (ap.IsMarkedToDelete) { continue; } if (!ap.idfsParameter.HasValue || !ap.intNumRow.HasValue) { continue; } if (!idParameters.Contains(ap.idfsParameter.Value)) { continue; } if (ap.intNumRow > numRow) { numRow = ap.intNumRow.Value; } findedRows++; } if (findedRows > 0) { numRow++; } return(numRow); }
public void Setup() { var approvalServiceMock = new Mock <IApprovalService>(); var amqSettingsMock = new Mock <IOptions <AmqSettings> >(); amqSettingsMock.SetupGet(o => o.Value).Returns(new AmqSettings()); _efContext = EFContextFactory.CreateInMemoryEFContext(); var technicalFeeService = new Mock <ITechnicalFeeService>(); var revisionPermissionService = new Mock <ICostStageRevisionPermissionService>(); var costStageRevisionService = new Mock <ICostStageRevisionService>(); _costBuilderMock = new Mock <ICostBuilder>(); var costBuilders = new EditableList <Lazy <ICostBuilder, PluginMetadata> > { new Lazy <ICostBuilder, PluginMetadata>( () => _costBuilderMock.Object, new PluginMetadata { BuType = BuType.Pg }) }; var userServiceMock = new Mock <IUserService>(); var activityLogServiceMock = new Mock <IActivityLogService>(); var eventServiceMock = new Mock <IEventService>(); _target = new CostApprovalService(approvalServiceMock.Object, technicalFeeService.Object, _efContext, costBuilders, userServiceMock.Object, activityLogServiceMock.Object, eventServiceMock.Object, revisionPermissionService.Object, costStageRevisionService.Object ); }
public async Task <ReturnModel <AuditLogDto> > GetAuditLogTable(RequestModel <object> input) { if (AbpSession.TenantId == null) { CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant); CurrentUnitOfWork.DisableFilter(AbpDataFilters.MustHaveTenant); } int count; var query = _auditLogRepository.GetAll(); List <Expression <Func <AuditLog, string> > > searchs = new EditableList <Expression <Func <AuditLog, string> > >(); searchs.Add(a => a.MethodName); searchs.Add(a => a.ClientIpAddress); searchs.Add(a => a.BrowserInfo); searchs.Add(a => a.ClientName); searchs.Add(a => a.Exception); searchs.Add(a => a.ServiceName); searchs.Add(a => a.CustomData); searchs.Add(a => a.Exception); var filteredByLength = GenerateTableModel(input, query, searchs, "MethodName", out count); return(new ReturnModel <AuditLogDto>() { iTotalDisplayRecords = count, recordsTotal = query.Count(), recordsFiltered = filteredByLength.Count, length = input.length, data = await GetModel(filteredByLength), draw = input.draw, }); }
//protected new List<FlexNode> ChildList { get; set; } public FlexNode(FlexNode parentNode, FlexItem ffObject, EditableList <ActivityParameter> activityParameters, FFPresenterModel model) : base(parentNode, ffObject) { m_ActivityParameters = activityParameters; m_Model = model; UseFullPath = false; idfRow = -1; }
public EventPublicationRecord(IEvent ev) { Status = EventPublicationStatus.Unpublished; Id = ev.PublicationRecordId; PortableEvent = new PortableEvent(ev, EventSchemaGenerator.GenerateSchema(ev.GetType())); Created = DateTime.UtcNow; QueryReferences = new EditableList <IdentifierQueryReference>(); }
public PermissionDefinition(string name, string displayName = null, string description = null, PermissionType type = PermissionType.Common) { Name = name; PermissionType = type; DisplayName = displayName; Description = description; Children = new EditableList <PermissionDefinition>(); }
public CommandPublicationRecord(ICommand command) { Status = CommandPublicationStatus.Unpublished; Id = command.PublicationRecordId; PortableCommand = new PortableCommand(command, CommandSchemaGenerator.GenerateSchema(command.GetType())); Created = DateTime.UtcNow; QueryReferences = new EditableList <IdentifierQueryReference>(); }
public async Task <PagedResultDto <VWEmployeesDto> > GetAllVW(VWEmployeesGetAllInputDto input) { if (input.Id == 0) { var querys = _VwRepository.GetAll().Where(p => !p.IsDeleted).Where(input.Where); var count = await querys.CountAsync(); var data = await querys.OrderBy(p => p.Id).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToListAsync(); var list = data.MapTo <List <VWEmployeesDto> >(); return(new PagedResultDto <VWEmployeesDto>(count, list)); } else { var Querybufid = _Repository.GetAll().SingleOrDefault(p => p.Id == input.Id); IQueryable <VW_Employee> querys; int count = 0; List <VW_Employee> data = new EditableList <VW_Employee>(); List <VWEmployeesDto> list = new List <VWEmployeesDto>(); if (Querybufid.ParentId == 0 && Querybufid.OrganizationType == PublicEnum.OrganizationType.集团) { int[] FDepartmentIDArr = GetOneselfAndJunior(new int[] { input.Id }); querys = _VwRepository.GetAll().Where(p => !p.IsDeleted).Where(input.Where).Where(w => FDepartmentIDArr.Contains(w.FDepartment)); count = await _ERepository.GetAll().CountAsync(); data = await querys.OrderBy(p => p.Id).Skip(input.MaxResultCount * (input.SkipCount)).Take(input.MaxResultCount).ToListAsync(); list = data.MapTo <List <VWEmployeesDto> >(); } else if (Querybufid.OrganizationType == PublicEnum.OrganizationType.公司) { querys = _VwRepository.GetAll().Where(input.Where).Where(p => p.IsDeleted == false && p.FOrganizationUnitId == input.Id); count = await querys.CountAsync(); data = await querys.OrderBy(p => p.Id).Skip(input.MaxResultCount * (input.SkipCount)).Take(input.MaxResultCount).ToListAsync(); list = data.MapTo <List <VWEmployeesDto> >(); } else if (Querybufid.OrganizationType == PublicEnum.OrganizationType.部门) { int[] FDepartmentIDArr = GetOneselfAndJunior(new int[] { input.Id }); querys = _VwRepository.GetAll().Where(p => p.IsDeleted == false && FDepartmentIDArr.Contains(p.FDepartment)).Where(input.Where); count = await querys.CountAsync(); data = await querys.OrderBy(p => p.Id).Skip(input.MaxResultCount * (input.SkipCount)).Take(input.MaxResultCount).ToListAsync(); list = data.MapTo <List <VWEmployeesDto> >(); } return(new PagedResultDto <VWEmployeesDto>(count, list)); } }
public StringTrackView(TLStringTrack track, TimelineView tv, RulerView rv) : base(track, tv, rv) { Keyframes = new EditableList<StringKeyframeView>(); KFSyncer = Keyframes.SyncWith(Model.Keyframes, kf => { var kv = new StringKeyframeView(kf, this); kf.NeighbourChanged += NeedsRebuild; var kfs = Model.Keyframes.ToList(); var prev = kfs.FindLastIndex(x => x.Time.Value < kf.Time.Value); kv.AddToSceneGraphAt(KeyframeGroup, Keyframes.Count - 1 - prev); return kv; }, kv => { kv.Dispose(); }); Background.Click += Background_MouseClick; KeyframeDefinition.StartX = 0; KeyframeDefinition.StartY = -25f; KeyframeDefinition.EndX = 0; KeyframeDefinition.EndY = 25f; KeyframeDefinition.ID = Model.GetID() + "_KF"; KeyframeDefinition.Transforms = new SvgTransformCollection(); KeyframeDefinition.Transforms.Add(new SvgScale(1, 1)); CollapsedKeyframeDefinition.ID = Model.GetID() + "_CKF"; CollapsedKeyframeDefinition.StartX = 0; CollapsedKeyframeDefinition.StartY = -25f; CollapsedKeyframeDefinition.EndX = 0; CollapsedKeyframeDefinition.EndY = 25f; CollapsedKeyframeDefinition.Transforms = new SvgTransformCollection(); CollapsedKeyframeDefinition.Transforms.Add(new SvgScale(1, 1)); KeyframeGroup.ID = "Keyframes"; CurrentValue.FontSize = 12; CurrentValue.X = 5; CurrentValue.CustomAttributes["class"] = "trackfont"; CurrentValue.CustomAttributes["pointer-events"] = "none"; CurrentValue.Y = 24; UpdateScene(); }
void Filter() { EditableList<Inventory> list; string filter = _filter.Text.Trim(); if (string.IsNullOrEmpty(filter)) list = _list; else { list = new EditableList<Inventory>(); foreach (Inventory item in _list) { if (item.DisplayString.IndexOf(filter) != -1) list.Add(item); } } objectBinder.List = list; }
void ShowOrders() { EditableList<GridItem> items = new EditableList<GridItem>(); using (DbManager db = new DbManager()) foreach (Order order in new OrderAccessor().GetAll(db)) items.Add(new GridItem(order, GetCarName(order.CarId))); objectBinder.List = items; }
public ValueTrackView(TLValueTrack track, TimelineView tv, RulerView rv) : base(track, tv, rv) { Keyframes = new EditableList<ValueKeyframeView>(); KFSyncer = Keyframes.SyncWith(Model.Keyframes, kf => { var kv = new ValueKeyframeView(kf, this); kf.NeighbourChanged += NeedsRebuild; var kfs = Model.Keyframes.ToList(); var prev = kfs.FindLastIndex(x => x.Time.Value < kf.Time.Value); kv.AddToSceneGraphAt(KeyframeGroup, Keyframes.Count - 1 - prev); return kv; }, kv => { kv.Model.NeighbourChanged -= NeedsRebuild; kv.Dispose(); }); CurveSyncer = Curves.SyncWith(Model.Curves, cu => { var cv = new CurveView(cu, this); cv.AddToSceneGraphAt(CurveGroup); return cv; }, cv => { cv.Dispose(); } ); Background.Click += Background_MouseClick; KeyframeDefinition.CenterX = 0; KeyframeDefinition.CenterY = 0; KeyframeDefinition.Radius = 3; KeyframeDefinition.ID = Model.GetID() + "_KF"; KeyframeDefinition.Transforms = new SvgTransformCollection(); KeyframeDefinition.Transforms.Add(new SvgScale(1, 1)); EaseNoneDefinition.ID = Model.GetID() + "_NE"; EaseNoneDefinition.StartX = 0; EaseNoneDefinition.StartY = -25f; EaseNoneDefinition.EndX = 0; EaseNoneDefinition.EndY = 25f; EaseNoneDefinition.Transforms = new SvgTransformCollection(); EaseNoneDefinition.Transforms.Add(new SvgScale(1, 1)); var half = Model.CCollapsedHeight / 2f; EaseInDefinition.ID = Model.GetID() + "_EI"; EaseInDefinition.Points = new SvgUnitCollection(); AddPoint(EaseInDefinition, new PointF(0, -half)); AddPoint(EaseInDefinition, new PointF(-half, 0)); AddPoint(EaseInDefinition, new PointF(0, half)); EaseInDefinition.Transforms = new SvgTransformCollection(); EaseInDefinition.Transforms.Add(new SvgScale(1, 1)); EaseOutDefinition.ID = Model.GetID() + "_EO"; EaseOutDefinition.Points = new SvgUnitCollection(); AddPoint(EaseOutDefinition, new PointF(0, -half)); AddPoint(EaseOutDefinition, new PointF(half, 0)); AddPoint(EaseOutDefinition, new PointF(0, half)); EaseOutDefinition.Transforms = new SvgTransformCollection(); EaseOutDefinition.Transforms.Add(new SvgScale(1, 1)); EaseInOutDefinition.ID = Model.GetID() + "_EIO"; EaseInOutDefinition.Points = new SvgUnitCollection(); AddPoint(EaseInOutDefinition, new PointF(0, -half)); AddPoint(EaseInOutDefinition, new PointF(half, 0)); AddPoint(EaseInOutDefinition, new PointF(0, half)); AddPoint(EaseInOutDefinition, new PointF(-half, 0)); EaseInOutDefinition.Transforms = new SvgTransformCollection(); EaseInOutDefinition.Transforms.Add(new SvgScale(1, 1)); CurveGroup.ID = "Curves"; KeyframeGroup.ID = "Keyframes"; CurrentValue.FontSize = 12; CurrentValue.X = 5; CurrentValue.CustomAttributes["class"] = "trackfont"; CurrentValue.CustomAttributes["pointer-events"] = "none"; CurrentValue.Y = 24; UpdateScene(); }
public void DisplayEditor(JobsEditor _js, string xmlText, bool _isEditMode) { js = _js; isEditMode = _isEditMode; try { this.SuspendLayout(); Clear(); ResizeEditor(); if (!xmlText.Equals(String.Empty)) { xdoc = new XmlDocument(); xdoc.LoadXml(xmlText); string moduleType = xdoc.FirstChild.Attributes["moduleType"].Value; int row = 0; foreach (XmlNode node in xdoc.FirstChild.Attributes) { tableLayoutPanel1.RowCount = row + 1; TableLayoutPanelCellPosition posLeft = new TableLayoutPanelCellPosition(0, row); Label l = new Label(); l.Text = node.Name; l.TextAlign = ContentAlignment.MiddleLeft; l.Width = Convert.ToInt32(tableLayoutPanel1.ColumnStyles[0].Width); tableLayoutPanel1.SetCellPosition(l, posLeft); tableLayoutPanel1.Controls.Add(l); if (moduleType.Equals("DataTableJoiner") && node.Name.Equals("OutputColumns")) { Panel p = new Panel(); p.Height = 140; p.Width = Convert.ToInt32(tableLayoutPanel1.Width - tableLayoutPanel1.ColumnStyles[0].Width) - 28; string[] list = node.InnerXml.Split(';'); TableLayoutPanelCellPosition posRight = new TableLayoutPanelCellPosition(1, row); el = new EditableList(); el.ListBox.DataSource = list; el.Enabled = protectedFields.Contains(node.Name.ToLower()) ? false : true; if (isEditMode) el.TextChanged += new EventHandler(XmlNodeTextChanged); el.Width = p.Width - 180; el.Height = 140; el.Top = 0; el.Left = 0; Button bAdd = new Button(); bAdd.Text = "Add"; bAdd.Top = 10; bAdd.Left = p.Width - 150; bAdd.Click += new EventHandler(bAdd_Click); Button bRemove = new Button(); bRemove.Text = "Remove"; bRemove.Top = 50; bRemove.Left = p.Width - 150; bRemove.Click += new EventHandler(bRemove_Click); p.Controls.AddRange(new Control[] { el, bAdd, bRemove }); tableLayoutPanel1.SetCellPosition(p, posRight); tableLayoutPanel1.Controls.Add(p); } else { TableLayoutPanelCellPosition posRight = new TableLayoutPanelCellPosition(1, row); TextBox t = new TextBox(); t.Multiline = true; t.WordWrap = true; t.Text = node.InnerXml; t.Enabled = protectedFields.Contains(node.Name.ToLower()) ? false : true; if (isEditMode) t.TextChanged += new EventHandler(XmlNodeTextChanged); t.Width = Convert.ToInt32(tableLayoutPanel1.Width - tableLayoutPanel1.ColumnStyles[0].Width) - 8; t.Height = Convert.ToInt32(t.Height * (1.0 + (Math.Truncate(t.TextLength / 60.0)))); tableLayoutPanel1.SetCellPosition(t, posRight); tableLayoutPanel1.Controls.Add(t); } row++; } } this.Visible = true; tableLayoutPanel1.Visible = true; SetSaveVisibility(); EnableUpdateButton(isEditMode); isDirty = false; } catch (Exception ex) { Console.Write(ex); } finally { this.ResumeLayout(); } }
public OrderForm(Model model, Order order, EditableList<OrderInventory> items) { _model = model; _order = order; _new = _order.Id == 0; foreach (Inventory item in _model.InventoryGetAll()) _inventories.Add(item.Id, item); foreach (OrderInventory item in items) _gridItems.Add(new GridItem(item, GetInventoryName(item.InventoryId))); _gridItems.AcceptChanges(); InitializeComponent(); _date.Value = _order.OrderDateTime; objectBinder.List = _gridItems; SetCar(); SetAllTotal(); }
public IEditableList<string> CreateNewEditableList(string parent, string attribute, string item, bool useTransaction) { if (useTransaction) { WorldModel.UndoLogger.StartTransaction(string.Format("Set '{0}' {1} to '{2}'", parent, attribute, item)); } Element element = (parent == null) ? null : m_worldModel.Elements.Get(parent); QuestList<string> newList = new QuestList<string>(); if (item != null) newList.Add(item); if (element != null) { element.Fields.Set(attribute, newList); // setting an element field will clone the value, so we want to return the new list newList = element.Fields.GetAsType<QuestList<string>>(attribute); } EditableList<string> newValue = new EditableList<string>(this, newList); if (useTransaction) { WorldModel.UndoLogger.EndTransaction(); } return newValue; }