示例#1
0
        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()
            });
        }
示例#2
0
        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()
            });
        }
示例#3
0
        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()
            });
        }
示例#4
0
        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 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,
            });
        }
示例#6
0
        public override BaseButton[] CreateRowButtons()
        {
            List <BaseButton> list  = new EditableList <BaseButton>();
            string            title = this.IsFreeze ? "禁用" : "启用";

            list.Add(new ConfirmActionButton("EnableOperation", title, "是否确认操作?"));
            list.Add(new ClientEditModal("Save", "编辑客户"));
            return(list.ToArray());
        }
示例#7
0
            public static List <List <string> > GetMonthList()
            {
                List <string>         MonthList = new EditableList <string>();
                List <List <string> > AllList   = new EditableList <List <string> >();

                MonthList.Add("فروردین");
                MonthList.Add("1");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("اردیبهشت");
                MonthList.Add("2");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("خرداد");
                MonthList.Add("3");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("تیر");
                MonthList.Add("4");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("مرداد");
                MonthList.Add("5");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("شهریور");
                MonthList.Add("6");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("مهر");
                MonthList.Add("7");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("آبان");
                MonthList.Add("8");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("آذر");
                MonthList.Add("9");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("دی");
                MonthList.Add("10");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("بهمن");
                MonthList.Add("11");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();
                MonthList.Add("اسفند");
                MonthList.Add("12");
                AllList.Add(MonthList);
                MonthList = new EditableList <string>();


                return(AllList);
            }
示例#8
0
        /// <summary>
        /// Creates and returns a collection of local detail editing cards for the supplied Idea and Symbol.
        /// </summary>
        public static EditableList <DetailEditingCard> GenerateLocalDetailsFor(Idea SourceIdea, VisualSymbol SourceSymbol,
                                                                               IEnumerable <DetailEditingCard> GeneratedGlobalDetails)
        {
            General.ContractRequires(SourceSymbol == null || SourceSymbol.OwnerRepresentation.RepresentedIdea == SourceIdea);

            var GeneratedLocalDetailEdits = new EditableList <DetailEditingCard>("LocalDetailEdits", null);

            // Add the custom designated details (for this particular Idea), plus its possible custom formats.
            foreach (var Detail in SourceIdea.Details.Where(det => det.ContentDesignator.IsLocal))
            {
                var TargetEditCard = new DetailEditingCard(true, new Assignment <DetailDesignator>(Detail.Designation, true), Detail);
                GeneratedLocalDetailEdits.Add(TargetEditCard);

                // Set any possible custom format
                if (SourceSymbol != null && TargetEditCard != null &&
                    SourceIdea.DetailsCustomLooks.ContainsKey(TargetEditCard.Designator.Value))
                {
                    var FormattedDesignation = SourceIdea.DetailsCustomLooks[TargetEditCard.Designator.Value];
                    if (FormattedDesignation != null && FormattedDesignation.ContainsKey(SourceSymbol))
                    {
                        TargetEditCard.SetLook(FormattedDesignation[SourceSymbol]);
                    }
                }
            }

            // Finally, add custom formats of Local Internal/Property details (not related to an existent detail).
            // Notice that global-designators (those previously generated) are excluded.
            // IMPORTANT: Don't ask solely for Idea-Definitor's detail designators, because for a Converted Idea
            //            can exist globally-defined detail designators which remain declared by the previous Idea-Definition.
            var AssignedCustomLooks = SourceIdea.DetailsCustomLooks
                                      .Where(cuslook => cuslook.Key is LinkDetailDesignator &&
                                             !GeneratedLocalDetailEdits.Any(det => det.Designator.Value.IsEquivalent(cuslook.Key)) &&
                                             (GeneratedGlobalDetails != null &&
                                              !GeneratedGlobalDetails.Any(
                                                  det =>
            {
                if (!(det.Designator.Value is LinkDetailDesignator))
                {
                    return(det.Designator.Value.IsEqual(cuslook.Key));
                }

                var dsnlink = det.Designator.Value.GetFinalContent(SourceIdea) as Link;
                var clklink = cuslook.Key.GetFinalContent(SourceIdea) as Link;

                var result = dsnlink.Target.IsEqual(clklink.Target);
                return(result);
            }))
                                             /*- && !SourceIdea.IdeaDefinitor.DetailDesignators.Any(dsn => dsn.IsEquivalent(cuslook.Key))*/);

            foreach (var CustLook in AssignedCustomLooks)
            {
                // Notice that no detail is supplied because Internal-Detail is just a designator-to-property reference.
                GeneratedLocalDetailEdits.Add(new DetailEditingCard(true, new Assignment <DetailDesignator>(CustLook.Key, true), null));
            }

            return(GeneratedLocalDetailEdits);
        }
示例#9
0
        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;
            }
        }
示例#10
0
        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,
            });
        }
示例#11
0
        public static List <DropListModel> GetDropListModels(this Enum obj, string empty = null)
        {
            List <DropListModel> list = new EditableList <DropListModel>();

            if (!string.IsNullOrEmpty(empty))
            {
                list.Add(new DropListModel(null, empty));
            }
            foreach (Enum e in Enum.GetValues(obj.GetType()))
            {
                list.Add(new DropListModel(e.ToString(), e.ToDescriptionString()));
            }

            return(list);
        }
示例#12
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);
        }
        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
                });
            });
        }
示例#14
0
        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);
        }
示例#15
0
        public override BaseButton[] CreateRowButtons()
        {
            List <BaseButton> list = new EditableList <BaseButton>();

            list.Add(new RateOfGroupEditModal("Save", "编辑概率"));
            return(list.ToArray());
        }
示例#16
0
        public override BaseButton[] CreateRowButtons()
        {
            List <BaseButton> list  = new EditableList <BaseButton>();
            string            title = this.IsBlock ? "解禁言" : "禁言";

            list.Add(new ConfirmActionButton("EnableOperation", title, "是否确认操作?"));

            return(list.ToArray());
        }
示例#17
0
        public List <EntityInfoDto> GetEntities(string entityAssemblyName, string applicationProjectPath)
        {
            List <EntityInfoDto> entityInfoDtos = new EditableList <EntityInfoDto>();

            Log.Write("Start looking for an entity from:" + entityAssemblyName);
            Assembly assembly = Assembly.Load(entityAssemblyName);

            if (assembly == null)
            {
                Log.Write($"Assembly {entityAssemblyName} not exists.");
                return(entityInfoDtos);
            }

            var types = assembly.GetTypes();

            foreach (var type in types)
            {
                var interfaces = type.GetInterfaces();
                foreach (var @interface in interfaces)
                {
                    if (false == @interface.IsGenericType)
                    {
                        continue;
                    }
                    if (@interface.GetGenericTypeDefinition() == (typeof(IEntity <>)))
                    {
                        //通过特性获取表名
                        var tableAttributes = type.GetCustomAttributes(typeof(TableAttribute));
                        if (tableAttributes != null && tableAttributes.Any())
                        {
                            EntityInfoDto info = new EntityInfoDto();
                            info.Type      = type;
                            info.Name      = type.Name;
                            info.TableName = ((TableAttribute)(tableAttributes.First())).Name;
                            entityInfoDtos.Add(info);
                            continue;
                        }
                    }
                }
            }

            //检测实体是否有对应的代码
            foreach (var dto in entityInfoDtos)
            {
                string dir = Path.Combine(applicationProjectPath, dto.Name + "s");
                dto.IsExists = Directory.Exists(dir);
            }

            Log.Write("Total number of entities found:" + entityInfoDtos.Count);
            foreach (var dto in entityInfoDtos)
            {
                Log.Write($"[{(dto.IsExists ? "√" : " ")}] {dto.Name} {dto.TableName}");
            }

            return(entityInfoDtos);
        }
示例#18
0
        /// <summary>
        /// Creates and returns a collection of global detail editing cards for the supplied Idea and Symbol.
        /// </summary>
        public static EditableList <DetailEditingCard> GenerateGlobalDetailsFor(Idea SourceIdea, VisualSymbol SourceSymbol)
        {
            General.ContractRequires(SourceSymbol == null || SourceSymbol.OwnerRepresentation.RepresentedIdea == SourceIdea);

            var GeneratedGlobalDetailEdits = new EditableList <DetailEditingCard>("GlobalDetailEdits", null);

            // First, populate considering the predefined designations of Global scope
            // IMPORTANT: This also concatenates non-local details (designations predefined in the previous Idea-Definition of a CONVERTED Source-Idea).
            var Designators = SourceIdea.IdeaDefinitor.DetailDesignators.Concat(
                SourceIdea.Details.Where(det => !det.AssignedDesignator.IsLocal).Select(det => det.Designation)).Distinct();

            foreach (var Designator in Designators)
            {
                var NewDetEdit = new DetailEditingCard(true, new Assignment <DetailDesignator>(Designator, false),
                                                       SourceIdea.Details.FirstOrDefault(det => det.Designation.IsEqual(Designator)));

                if (SourceSymbol != null && SourceIdea.DetailsCustomLooks.ContainsKey(Designator) &&
                    SourceIdea.DetailsCustomLooks[Designator].ContainsKey(SourceSymbol))
                {
                    NewDetEdit.SetLook(SourceIdea.DetailsCustomLooks[Designator][SourceSymbol]);
                }

                GeneratedGlobalDetailEdits.Add(NewDetEdit);
            }

            // Then, add the custom designated details (for this particular Idea)
            foreach (var Detail in SourceIdea.Details)
            {
                var MatchPredefDsnIndex = GeneratedGlobalDetailEdits.IndexOfMatch(PredefDsn => PredefDsn.Designator.Value.IsEqual(Detail.Designation));
            }

            // Plus, set possible custom formats.
            foreach (var Detail in SourceIdea.Details)
            {
                var MatchPredefDsnIndex = GeneratedGlobalDetailEdits.IndexOfMatch(PredefDsn => PredefDsn.Designator.Value.IsEqual(Detail.Designation));

                if (SourceSymbol != null && MatchPredefDsnIndex >= 0)
                {
                    var TargetEditCard = GeneratedGlobalDetailEdits[MatchPredefDsnIndex];

                    // Set any possible custom format
                    if (TargetEditCard != null && SourceIdea.DetailsCustomLooks.ContainsKey(TargetEditCard.Designator.Value))
                    {
                        var FormattedDesignation = SourceIdea.DetailsCustomLooks[TargetEditCard.Designator.Value];

                        if (FormattedDesignation != null && FormattedDesignation.ContainsKey(SourceSymbol))
                        {
                            TargetEditCard.SetLook(FormattedDesignation[SourceSymbol]);
                        }
                    }
                }
            }

            return(GeneratedGlobalDetailEdits);
        }
示例#19
0
        public static string[] SetupTestSetMembers(string memberPrefix = "", int count = 20)
        {
            var members = new EditableList <string>();

            for (var i = 0; i < 20; i++)
            {
                members.Add($"{memberPrefix}{i}");
            }

            return(members.ToArray());
        }
示例#20
0
        public List <Activity> GetActivityByRoleId(int roleId)
        {
            List <Activity> activitiesByRoleId    = new EditableList <Activity>();
            var             roleDistributionQuery = Context.RoleDistributions.Where(rd => rd.RoleId == roleId);

            roleDistributionQuery.ToList().ForEach(rd =>
            {
                activitiesByRoleId.Add(rd.Activity);
            });
            return(activitiesByRoleId);
        }
示例#21
0
        public void TestMethod1()
        {
            Numbers = new EditableList <int>();

            FResults = new EditableList <int>();
            using (FResults.SyncWith(Numbers, x => x * x))
            {
                Results = FResults.AsViewableList();

                // when doing more than one change:
                // use beginupdate/endupdate to reduce syncing events
                Numbers.BeginUpdate();
                try
                {
                    Numbers.Add(4);
                    Numbers.Add(7);
                }
                finally
                {
                    Numbers.EndUpdate();
                }

                // Magically results (x*x) are already added to the Results list
                foreach (var r in Results)
                {
                    Debug.WriteLine(r);
                }

                // You can't add a result to the public Results list
                // Results.Add(17);

                // again: change source collection:
                Numbers.Add(8);

                // synced results collection is already updated.
                foreach (var r in Results)
                {
                    Debug.WriteLine(r);
                }
            }
        }
        /// <summary>
        /// Creates and returns a collection of global detail editing cards for the supplied definitor.
        /// </summary>
        public static EditableList <DetailDefinitionCard> GenerateGlobalDetailsForDefinitor(IdeaDefinition Definitor)
        {
            var GeneratedGlobalDetailDefs = new EditableList <DetailDefinitionCard>("GlobalDetailDefs", null);

            foreach (var PredefDesignator in Definitor.DetailDesignators)
            {
                var NewDetEdit = new DetailDefinitionCard(true, new Assignment <DetailDesignator>(PredefDesignator, false));
                GeneratedGlobalDetailDefs.Add(NewDetEdit);
            }

            return(GeneratedGlobalDetailDefs);
        }
示例#23
0
        /// <summary>
        /// Моделируем поступление нового платежа в последние 30 секунд
        /// </summary>
        public static void AddNewTransfer()
        {
            var newTrasferId = ++lastTransferId;

            transfers.Add(new NuWmTransfer(1890.5m, DateTime.Now.AddMilliseconds(-1),
                                           "Зачисление N: 1102427100 / 3142-3 (Элекснет), номер чека: 9193.",
                                           newTrasferId, new Purse(WmCurrency.R, MoqCompanyPurseId), newTrasferId,
                                           DateTime.Now.AddMilliseconds(-1), 0m, 0, false, 0,
                                           (WmId)161045341777,
                                           0, 1094.71m, new Purse(WmCurrency.R, 353227462352), 46456842,
                                           TransferType.Normal));
        }
示例#24
0
        public List <Question> GetQuestions(int surveyId)
        {
            var             questionAssignment = _surveyQuestionRepository.GetAllList(a => a.SurveyId == surveyId);
            List <Question> questions          = new EditableList <Question>();

            foreach (var surveyQuestion in questionAssignment)
            {
                var question = _questionRepository.Get(surveyQuestion.QuestionId);
                question.Order = surveyQuestion.Order;
                questions.Add(question);
            }
            return(questions.OrderBy(a => a.Order).ToList());
        }
示例#25
0
        private IList <RefreshmentItem> AddRefreshmentsToMealOrder(List <int> productIds)
        {
            IList <RefreshmentItem> refreshments = new EditableList <RefreshmentItem>();

            foreach (var productId in productIds)
            {
                var refreshmentItem = db.RefreshmentItems.Find(productId);
                if (refreshmentItem != null)
                {
                    refreshments.Add(refreshmentItem);
                }
            }
            return(refreshments);
        }
示例#26
0
        public async Task <List <Question> > GetQuestionsAsync(int surveyId)
        {
            var questionAssignment = await _surveyQuestionRepository.GetAllListAsync(a => a.SurveyId == surveyId);

            List <Question> questions = new EditableList <Question>();

            foreach (var surveyQuestion in questionAssignment)
            {
                var question = await _questionRepository.GetAsync(surveyQuestion.QuestionId);

                question.Order = surveyQuestion.Order;
                questions.Add(question);
            }
            return(questions.OrderBy(a => a.Order).ToList());
        }
        private void TestReadings(double expected, List <double> readings)
        {
            List <ReadingData> readingsData = new EditableList <ReadingData>();

            foreach (var readingData in readings)
            {
                readingsData.Add(new ReadingData()
                {
                    LAeq = readingData
                });
            }

            var result = ReadingData.Average(readingsData);

            Assert.AreEqual(Math.Round(expected, 2), Math.Round(result.LAeq, 2));
        }
示例#28
0
        public IEnumerable <Folder> FolderPathToBreadcrumbs(string folderPath)
        {
            List <Folder> breadcrumbs = new EditableList <Folder>();

            if (string.IsNullOrEmpty(folderPath))
            {
                breadcrumbs.Add(Folder.Root);
            }
            else
            {
                var folderNames = folderPath.Split("\\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                breadcrumbs.AddRange(GenerateBreadcrumbsFromFolderNames(folderNames));
            }

            return(breadcrumbs);
        }
示例#29
0
        void node_Added(IViewableCollection <INode2> collection, INode2 item)
        {
            item.Added   += node_Added;
            item.Removed += node_Removed;

            foreach (var node in item)
            {
                node_Added(item, node);
            }

            var project = item.NodeInfo?.UserData as IProject;

            if (project != null && !FLoadedProjects.Contains(project))
            {
                FLoadedProjects.Add(project);
            }
        }
示例#30
0
 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;
 }
示例#31
0
        private static async Task <List <EmailFileAttachment> > ConvertAttachmentCollection(AttachmentCollection attachmenCollection)
        {
            var emailFileAttachments = new EditableList <EmailFileAttachment>();

            var fileAttachments = attachmenCollection.Where(attachment => attachment is FileAttachment);

            foreach (var fileAttachment in fileAttachments)
            {
                var emailFileAttachment = await ExchangeHandler.ConvertFileAttachment(fileAttachment as FileAttachment);

                emailFileAttachments.Add(emailFileAttachment);
            }

            return(emailFileAttachments);

            // return attachmenCollection.Where(attachment => attachment is FileAttachment).Select(async attachment => await ExchangeHandler.ConvertFileAttachment(attachment as FileAttachment)).ToList();
        }
示例#32
0
    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;
    }