Beispiel #1
0
        public instructor_list()
        {
            InitializeComponent();
            default_auth = new AuthSetting[] {
                new AuthSetting(Authority.InstructorManage)
            };
            template = new ListTemplate();

            var cargs = new CreateArgs("api/auth/instructors/", User.Api, "创建辅导员用户", Margin: new Thickness(0, 10, 0, 10));

            cargs.items.Add(new CreateArgs.Item("username", "工号", "text"));
            cargs.items.Add(new CreateArgs.Item("password", "密码", "text"));
            cargs.items.Add(new CreateArgs.Item("name", "姓名", "text"));
            cargs.items.Add(new CreateArgs.Item("gender", "性别", "choice", data: gender_choices.ToArray()));
            var args = new ListArgs("api/auth/instructors/", User.Api, Title, Searchable: true, Createable: true, Createargs: cargs);

            args.columns.Add(new ListArgs.Column("id", "工号", ordering: "id",
                                                 hyperlink: ListArgs.autohyperlink("instructor-other-document").add("id").lambda));
            args.columns.Add(new ListArgs.Column("user", "姓名", ordering: "username",
                                                 hyperlink: ListArgs.autohyperlink("instructor-other-document").add("id").lambda));
            args.columns.Add(new ListArgs.Column("gender_related", "性别", type: "choice", data: gender_choices));

            template.Construct(args);
            ContentGrid.Children.Add(template);
        }
        public class_list()
        {
            InitializeComponent();
            default_auth = new AuthSetting[] {
                new AuthSetting(Authority.ClassManage)
            };
            template = new ListTemplate();

            var cargs = new CreateArgs("api/classes/", User.Api, "创建班级", Margin: new Thickness(0, 10, 0, 10));

            cargs.items.Add(new CreateArgs.Item("id", "班级编号", "text"));
            cargs.items.Add(new CreateArgs.Item("grade", "年级", "text"));
            cargs.items.Add(new CreateArgs.Item("college", "学院", "text"));
            cargs.items.Add(new CreateArgs.Item("major", "专业", "text"));
            cargs.items.Add(new CreateArgs.Item("number", "班级", "text"));
            cargs.items.Add(new CreateArgs.Item("as_instructor_set", "辅导员列表(工号)", "multitext"));
            cargs.items.Add(new CreateArgs.Item("as_student_set", "学生列表(学号)", "multitext"));

            var args = new ListArgs("api/classes/", User.Api, Title, Searchable: true, Createable: true, Createargs: cargs);

            args.columns.Add(new ListArgs.Column("id", "班级编号",
                                                 hyperlink: ListArgs.autohyperlink("class-instance").add("id").lambda));
            args.columns.Add(new ListArgs.Column("grade", "年级", ordering: "grade"));
            args.columns.Add(new ListArgs.Column("college", "学院", ordering: "college"));
            args.columns.Add(new ListArgs.Column("major", "专业", ordering: "major"));
            args.columns.Add(new ListArgs.Column("number", "班级", ordering: "number"));

            template.Construct(args);
            ContentGrid.Children.Add(template);
        }
Beispiel #3
0
        public course_list()
        {
            InitializeComponent();
            default_auth = new AuthSetting[] {
                new AuthSetting(Authority.CourseManage)
            };
            template = new ListTemplate();

            var cargs = new CreateArgs("api/courses/basic/", User.Api, "创建课程", Margin: new Thickness(0, 10, 0, 10));

            cargs.items.Add(new CreateArgs.Item("id", "课程编号", "text"));
            cargs.items.Add(new CreateArgs.Item("name", "课程名称", "text"));
            cargs.items.Add(new CreateArgs.Item("teacher", "教师(工号)", "text"));
            cargs.items.Add(new CreateArgs.Item("as_student_set", "学生列表(学号)", "multitext"));


            var args = new ListArgs("api/courses/basic/", User.Api, Title, Searchable: true, Createable: true, Createargs: cargs);

            args.columns.Add(new ListArgs.Column("id", "课程编号", ordering: "id",
                                                 hyperlink: ListArgs.autohyperlink("course-instance").add("id").lambda));
            args.columns.Add(new ListArgs.Column("name", "课程名称", ordering: "name",
                                                 hyperlink: ListArgs.autohyperlink("course-instance").add("id").lambda));
            args.columns.Add(new ListArgs.Column("teacher", "任课教师", ordering: "teacher",
                                                 hyperlink: ListArgs.autohyperlink("teacher-other-document").add("id", "teacher").lambda));

            template.Construct(args);
            ContentGrid.Children.Add(template);
        }
        public admin_schedule()
        {
            InitializeComponent();

            default_auth = new AuthSetting[] {
                new AuthSetting(Authority.Admin)
            };
            template = new ListTemplate();

            var cargs = new CreateArgs("api/schedule/system-schedules/", User.Api, "创建时间表", Margin: new Thickness(0, 10, 0, 10));

            cargs.items.Add(new CreateArgs.Item("year", "学年", "text"));
            cargs.items.Add(new CreateArgs.Item("term", "学期", "text"));
            cargs.items.Add(new CreateArgs.Item("begin", "开始时间", "text"));
            cargs.items.Add(new CreateArgs.Item("end", "结束时间", "text"));


            var args = new ListArgs("api/schedule/system-schedules/", User.Api, Title, Searchable: true, Createable: true, Createargs: cargs);

            args.columns.Add(new ListArgs.Column("id", "编号", ordering: "id",
                                                 hyperlink: ListArgs.autohyperlink("admin-admin-schedule-instance").add("id").lambda));
            args.columns.Add(new ListArgs.Column("year", "学年"));
            args.columns.Add(new ListArgs.Column("term", "学期"));
            args.columns.Add(new ListArgs.Column("begin", "开始时间"));
            args.columns.Add(new ListArgs.Column("end", "结束时间"));

            template.Construct(args);
            ContentGrid.Children.Add(template);
        }
        public ListPage <OrderCloudIntegrationsConversionRate> Filter(ListArgs <OrderCloudIntegrationsConversionRate> rateArgs, OrderCloudIntegrationsExchangeRate rates)
        {
            if (rateArgs.Filters?.Any(filter => filter.PropertyName == "Symbol") ?? false)
            {
                rates.Rates = (
                    from rate in rates.Rates
                    from s in rateArgs.Filters.FirstOrDefault(r => r.PropertyName == "Symbol")?.FilterValues
                    where rate.Currency == s.Term.To <CurrencySymbol>()
                    select rate).ToList();
            }

            var list = new ListPage <OrderCloudIntegrationsConversionRate>()
            {
                Meta = new ListPageMeta()
                {
                    Page       = 1,
                    PageSize   = 1,
                    TotalCount = rates.Rates.Count,
                    ItemRange  = new[] { 1, rates.Rates.Count }
                },
                Items = rates.Rates
            };

            return(list);
        }
Beispiel #6
0
        public async Task <ListPageWithFacets <HSMeProduct> > List(ListArgs <HSMeProduct> args, VerifiedUserContext user)
        {
            var searchText   = args.Search ?? "";
            var searchFields = args.Search != null ? "ID,Name,Description,xp.Facets.supplier" : "";
            var sortBy       = args.SortBy.FirstOrDefault();
            var meProducts   = await _oc.Me.ListProductsAsync <HSMeProduct>(filters : args.ToFilterString(), page : args.Page, search : searchText, searchOn : searchFields, searchType : SearchType.ExactPhrasePrefix, sortBy : sortBy, accessToken : user.AccessToken);

            if (!(bool)(meProducts?.Items?.Any()))
            {
                meProducts = await _oc.Me.ListProductsAsync <HSMeProduct>(filters : args.ToFilterString(), page : args.Page, search : searchText, searchOn : searchFields, searchType : SearchType.AnyTerm, sortBy : sortBy, accessToken : user.AccessToken);

                if (!(bool)(meProducts?.Items?.Any()))
                {
                    //if no products after retry search, avoid making extra calls for pricing details
                    return(meProducts);
                }
            }

            var defaultMarkupMultiplierRequest = GetDefaultMarkupMultiplier(user);
            var exchangeRatesRequest           = GetExchangeRatesForUser(user.AccessToken);
            await Task.WhenAll(defaultMarkupMultiplierRequest, exchangeRatesRequest);

            var defaultMarkupMultiplier = await defaultMarkupMultiplierRequest;
            var exchangeRates           = await exchangeRatesRequest;

            meProducts.Items = meProducts.Items.Select(product => ApplyBuyerProductPricing(product, defaultMarkupMultiplier, exchangeRates)).ToList();

            return(meProducts);
        }
Beispiel #7
0
        public instance()
        {
            InitializeComponent();

            template = new InstanceTemplate();
            var args = new InstanceArgs("api/classrooms/basic/", null, User.Api, Title,
                                        Margin: new Thickness(0, 10, 0, 10));

            args.items.Add(new InstanceArgs.Item("id", "教室编号", "text"));
            args.items.Add(new InstanceArgs.Item("name", "教室名称", "text"));
            args.items.Add(new InstanceArgs.Item("size", "教室大小", "text"));
            template.Construct(args);
            ContentGrid.Children.Add(template);

            list_temp = new ListTemplate();
            var largs = new ListArgs("api/record/classroom-records/", User.Api, "教室使用记录", Searchable: true);

            largs.columns.Add(new ListArgs.Column("id", "编号"));
            largs.columns.Add(new ListArgs.Column("student_name_related", "学生姓名",
                                                  hyperlink: ListArgs.autohyperlink("student-other-document").add("id", "student").lambda));
            largs.columns.Add(new ListArgs.Column("time_in", "进入时间"));
            largs.columns.Add(new ListArgs.Column("time_out", "离开时间"));
            list_temp.Construct(largs);
            //ListGrid.Children.Add(list_temp);
        }
Beispiel #8
0
        public async override Task ExecuteCommandAsync()
        {
            if (Verbose)
            {
                Console.WriteWarning(LocalizedResourceManager.GetString("Option_VerboseDeprecated"));
                Verbosity = Verbosity.Detailed;
            }

            var listCommandRunner = new ListCommandRunner();
            var listEndpoints     = GetEndpointsAsync();

            var list = new ListArgs(Arguments,
                                    listEndpoints,
                                    Settings,
                                    Console,
                                    Console.PrintJustified,
                                    Verbosity == Verbosity.Detailed,
                                    LocalizedResourceManager.GetString("ListCommandNoPackages"),
                                    LocalizedResourceManager.GetString("ListCommand_LicenseUrl"),
                                    LocalizedResourceManager.GetString("ListCommand_ListNotSupported"),
                                    AllVersions,
                                    IncludeDelisted,
                                    Prerelease,
                                    CancellationToken.None);

            await listCommandRunner.ExecuteCommand(list);
        }
Beispiel #9
0
        public async Task <ListPage <HSKitProduct> > List(ListArgs <Document <HSKitProductAssignment> > args, string token)
        {
            var _kitProducts = await _cms.Documents.List <HSKitProductAssignment>("HSKitProductAssignment", args, token);

            var _kitProductList = new List <HSKitProduct>();

            await Throttler.RunAsync(_kitProducts.Items, 100, 10, async product =>
            {
                var parentProduct = await _oc.Products.GetAsync(product.ID);
                var _images       = GetProductImages(product.ID, token);
                var _attachments  = GetProductAttachments(product.ID, token);
                _kitProductList.Add(new HSKitProduct
                {
                    ID                 = parentProduct.ID,
                    Name               = parentProduct.Name,
                    Product            = parentProduct,
                    Images             = await _images,
                    Attachments        = await _attachments,
                    ProductAssignments = await _getKitDetails(product.Doc, token)
                });
            });

            return(new ListPage <HSKitProduct>
            {
                Meta = _kitProducts.Meta,
                Items = _kitProductList
            });
        }
        public async Task <ListPage <SuperHSProduct> > List(ListArgs <HSProduct> args, string token)
        {
            var _productsList = await _oc.Products.ListAsync <HSProduct>(
                filters : args.ToFilterString(),
                search : args.Search,
                searchType : SearchType.ExactPhrasePrefix,
                sortBy : args.SortBy.FirstOrDefault(),
                pageSize : args.PageSize,
                page : args.Page,
                accessToken : token);

            var _superProductsList = new List <SuperHSProduct> {
            };
            await Throttler.RunAsync(_productsList.Items, 100, 10, async product =>
            {
                var priceSchedule = _oc.PriceSchedules.GetAsync(product.DefaultPriceScheduleID, token);
                var _specs        = _oc.Products.ListSpecsAsync(product.ID, null, null, null, 1, 100, null, token);
                var _variants     = _oc.Products.ListVariantsAsync <HSVariant>(product.ID, null, null, null, 1, 100, null, token);
                _superProductsList.Add(new SuperHSProduct
                {
                    Product       = product,
                    PriceSchedule = await priceSchedule,
                    Specs         = (await _specs).Items,
                    Variants      = (await _variants).Items,
                });
            });

            return(new ListPage <SuperHSProduct>
            {
                Meta = _productsList.Meta,
                Items = _superProductsList
            });
        }
Beispiel #11
0
        public classroom_list()
        {
            InitializeComponent();
            default_auth = new AuthSetting[] {
                new AuthSetting(Authority.ClassroomManage)
            };
            template = new ListTemplate();

            var cargs = new CreateArgs("api/classrooms/basic/", User.Api, "创建教室", Margin: new Thickness(0, 10, 0, 10));

            cargs.items.Add(new CreateArgs.Item("id", "教室编号", "text"));
            cargs.items.Add(new CreateArgs.Item("name", "教室名称", "text"));
            cargs.items.Add(new CreateArgs.Item("size", "教室大小", "text"));
            cargs.items.Add(new CreateArgs.Item("password", "教室密码", "text"));

            var args = new ListArgs("api/classrooms/basic/", User.Api, Title, Searchable: true, Createable: true, Createargs: cargs);

            args.columns.Add(new ListArgs.Column("id", "教室编号",
                                                 hyperlink: ListArgs.autohyperlink("classroom-instance").add("id").lambda));
            args.columns.Add(new ListArgs.Column("name", "教室名称", ordering: "name",
                                                 hyperlink: ListArgs.autohyperlink("classroom-instance").add("id").lambda));
            args.columns.Add(new ListArgs.Column("size", "教室大小", ordering: "size"));

            template.Construct(args);
            ContentGrid.Children.Add(template);
        }
Beispiel #12
0
        public other_document()
        {
            InitializeComponent();

            //txt_gender.Choices = gender_choices;
            template = new InstanceTemplate();

            var args = new InstanceArgs("api/auth/users/", null, User.Api, "个人资料", Deleteable: false);

            args.margin = new Thickness(0, 10, 0, 10);
            args.items.Add(new InstanceArgs.Item("id", "用户名", "text"));
            args.items.Add(new InstanceArgs.Item("name", "姓名", "text"));
            args.items.Add(new InstanceArgs.Item("gender", "性别", "choice", data: gender_choices.ToArray()));
            args.items.Add(new InstanceArgs.Item("register_time", "注册时间", "text"));
            args.items.Add(new InstanceArgs.Item("last_login_time", "最近登录", "text"));

            template.Construct(args);
            ContentGrid.Children.Add(template);

            list_temp = new ListTemplate();
            var largs = new ListArgs(null, User.Api, "管理的班级");

            largs.columns.Add(new ListArgs.Column("id", "班级编号",
                                                  hyperlink: ListArgs.autohyperlink("class-instance").add("id").lambda));
            largs.columns.Add(new ListArgs.Column("name", "班级名称",
                                                  hyperlink: ListArgs.autohyperlink("class-instance").add("id").lambda));

            list_temp.Construct(largs);
            ListGrid.Children.Add(list_temp);
        }
Beispiel #13
0
        public instance()
        {
            InitializeComponent();

            template = new InstanceTemplate();
            var args = new InstanceArgs("api/classes/", null, User.Api, Title,
                                        Margin: new Thickness(0, 10, 0, 10));

            args.items.Add(new InstanceArgs.Item("id", "班级编号", "text"));
            args.items.Add(new InstanceArgs.Item("grade", "年级", "text"));
            args.items.Add(new InstanceArgs.Item("college", "学院", "text"));
            args.items.Add(new InstanceArgs.Item("major", "专业", "text"));
            args.items.Add(new InstanceArgs.Item("number", "班号", "text"));
            template.Construct(args);
            ContentGrid.Children.Add(template);

            list_temp = new ListTemplate();
            var largs = new ListArgs(null, User.Api, "学生列表");

            largs.columns.Add(new ListArgs.Column("id", "学号", customaction: HyperlinkToStudent));
            largs.columns.Add(new ListArgs.Column("name", "姓名", customaction: HyperlinkToStudent));
            list_temp.Construct(largs);
            ListGrid.Children.Add(list_temp);

            list_temp2 = new ListTemplate();
            var largs2 = new ListArgs(null, User.Api, "辅导员列表");

            largs2.columns.Add(new ListArgs.Column("id", "工号", customaction: HyperlinkToInstructor));
            largs2.columns.Add(new ListArgs.Column("name", "姓名", customaction: HyperlinkToInstructor));
            list_temp2.Construct(largs2);
            ListGrid2.Children.Add(list_temp2);
        }
Beispiel #14
0
        public async Task <List <HSLineItemOrder> > BuyerLineItemDetail(ListArgs <HSOrder> args, BuyerReportViewContext viewContext, string userID, string locationID, DecodedToken decodedToken)
        {
            IList <ListFilter> filters = new List <ListFilter>();

            filters.Add(ApplyBuyerLineContext(viewContext, userID, locationID, decodedToken));

            foreach (var filter in args.Filters)
            {
                filters.Add(ApplyBuyerLineFilter(filter));
            }

            CosmosListOptions listOptions = new CosmosListOptions()
            {
                PageSize      = -1,
                Sort          = "OrderID",
                SortDirection = SortDirection.ASC,
                Filters       = filters,
            };

            IQueryable <LineItemDetailData> queryable = _lineItemDetail.GetQueryable()
                                                        .Where(order =>
                                                               order.PartitionKey == "PartitionValue");

            QueryRequestOptions requestOptions = new QueryRequestOptions
            {
                MaxItemCount   = listOptions.PageSize,
                MaxConcurrency = -1
            };

            CosmosListPage <LineItemDetailData> lineItemDataResponse = await _lineItemDetail.GetItemsAsync(queryable, requestOptions, listOptions);

            List <LineItemDetailData> lineItemData = lineItemDataResponse.Items;

            listOptions.ContinuationToken = lineItemDataResponse.Meta.ContinuationToken;

            while (listOptions.ContinuationToken != null)
            {
                CosmosListPage <LineItemDetailData> responseWithToken = await _lineItemDetail.GetItemsAsync(queryable, requestOptions, listOptions);

                lineItemData.AddRange(responseWithToken.Items);
                listOptions.ContinuationToken = responseWithToken.Meta.ContinuationToken;
            }

            var lineItems = new List <HSLineItemOrder>();

            foreach (LineItemDetailData detailData in lineItemData)
            {
                foreach (HSLineItem lineDetail in detailData.Data.LineItems)
                {
                    lineItems.Add(new HSLineItemOrder
                    {
                        HSOrder    = detailData.Data.Order,
                        HSLineItem = lineDetail
                    });
                }
            }

            return(lineItems);
        }
        /// <summary>
        /// Intended for public API based consumption. Hence the ListArgs implementation
        /// </summary>
        /// <param name="rateArgs"></param>
        /// <param name="currency"></param>
        /// <returns></returns>
        public async Task <ListPage <OrderCloudIntegrationsConversionRate> > Get(ListArgs <OrderCloudIntegrationsConversionRate> rateArgs, CurrencySymbol currency)
        {
            var rates = await _cache.GetOrAddAsync($"exchangerates_{currency}", () => {
                return(_blob.Get <OrderCloudIntegrationsExchangeRate>($"{currency}.json"));
            }, TimeSpan.FromHours(1));

            return(Filter(rateArgs, rates));
        }
 public async Task <ListPage <HSCatalog> > List(string buyerID, ListArgs <HSCatalog> args, VerifiedUserContext user)
 {
     return(await _oc.UserGroups.ListAsync <HSCatalog>(buyerID,
                                                       filters : "xp.Type=Catalog",
                                                       search : args.Search,
                                                       pageSize : args.PageSize,
                                                       page : args.Page,
                                                       accessToken : user.AccessToken));
 }
Beispiel #17
0
        public async Task <ListPage <TaxCode> > ListTaxCodesAsync(ListArgs <TaxCode> hsListArgs)
        {
            var args        = TaxCodeMapper.Map(hsListArgs);
            var avataxCodes = await _avaTax.ListTaxCodesAsync(args.Filter, args.Top, args.Skip, args.OrderBy);

            var codeList = TaxCodeMapper.Map(avataxCodes, args);

            return(codeList);
        }
Beispiel #18
0
 public async Task <ListPage <HSCatalog> > List(string buyerID, ListArgs <HSCatalog> args, DecodedToken decodedToken)
 {
     return(await _oc.UserGroups.ListAsync <HSCatalog>(buyerID,
                                                       filters : "xp.Type=Catalog",
                                                       search : args.Search,
                                                       pageSize : args.PageSize,
                                                       page : args.Page,
                                                       accessToken : decodedToken.AccessToken));
 }
        public void has_filtered_symbols()
        {
            var args = new ListArgs <OrderCloudIntegrationsConversionRate>()
            {
                Filters = new List <ListFilter>()
                {
                    new ListFilter()
                    {
                        PropertyName = "Symbol",
                        FilterValues = new List <ListFilterValue>()
                        {
                            new ListFilterValue()
                            {
                                Operator = ListFilterOperator.Equal, Term = "CAD"
                            },
                            new ListFilterValue()
                            {
                                Operator = ListFilterOperator.Equal, Term = "USD"
                            }
                        }
                    }
                }
            };
            var rates = new OrderCloudIntegrationsExchangeRate()
            {
                BaseSymbol = CurrencySymbol.EUR,
                Rates      = new List <OrderCloudIntegrationsConversionRate>()
                {
                    new OrderCloudIntegrationsConversionRate()
                    {
                        Currency = CurrencySymbol.EUR, Icon = "", Name = "EUR", Rate = 1, Symbol = "€"
                    },
                    new OrderCloudIntegrationsConversionRate()
                    {
                        Currency = CurrencySymbol.USD, Icon = "", Name = "USD", Rate = 1.01456, Symbol = "$"
                    },
                    new OrderCloudIntegrationsConversionRate()
                    {
                        Currency = CurrencySymbol.CAD, Icon = "", Name = "CAD", Rate = 2.65487, Symbol = "$"
                    },
                    new OrderCloudIntegrationsConversionRate()
                    {
                        Currency = CurrencySymbol.BGN, Icon = "", Name = "BGN", Rate = 31.357, Symbol = "лв"
                    }
                }
            };
            var filtered = _command.Filter(args, rates);

            Assert.IsTrue(filtered.Meta.TotalCount == 2);
            Assert.IsTrue(filtered.Items.Count == 2);
            Assert.IsTrue(filtered.Items.Any(i => i.Currency == CurrencySymbol.USD));
            Assert.IsTrue(filtered.Items.Any(i => i.Currency == CurrencySymbol.CAD));
            Assert.IsFalse(filtered.Items.Any(i => i.Currency == CurrencySymbol.BGN));
        }
        /// <summary>
        /// Intended for public API based consumption. Hence the ListArgs implementation
        /// </summary>
        /// <param name="rateArgs"></param>
        /// <param name="currency"></param>
        /// <returns></returns>
        public async Task <ListPage <OrderCloudIntegrationsConversionRate> > Get(ListArgs <OrderCloudIntegrationsConversionRate> rateArgs, CurrencySymbol currency)
        {
            try
            {
                return(await GetCachedRates(rateArgs, currency));
            } catch (Exception ex)
            {
                await Update();

                return(await GetCachedRates(rateArgs, currency));
            }
        }
        public async Task <ListPage <HSLocationUserGroup> > ListUserGroupsForNewUser(ListArgs <HSLocationUserGroup> args, string buyerID, string homeCountry, VerifiedUserContext verifiedUser)
        {
            var userGroups = await _oc.UserGroups.ListAsync <HSLocationUserGroup>(
                buyerID,
                search : args.Search,
                filters : $"xp.Country={homeCountry}&xp.Type=BuyerLocation",
                page : args.Page,
                pageSize : 100
                );

            return(userGroups);
        }
Beispiel #22
0
        public async Task <ListPage <HSLocationUserGroup> > ListUserGroupsByCountry(ListArgs <HSLocationUserGroup> args, string buyerID, string userID, VerifiedUserContext verifiedUser)
        {
            var user = await _oc.Users.GetAsync(
                buyerID,
                userID
                );

            var userGroups = new ListPage <HSLocationUserGroup>();
            var assigned   = args.Filters.FirstOrDefault(f => f.Name == "assigned").QueryParams.
                             FirstOrDefault(q => q.Item1 == "assigned").Item2;

            if (!bool.Parse(assigned))
            {
                userGroups = await _oc.UserGroups.ListAsync <HSLocationUserGroup>(
                    buyerID,
                    search : args.Search,
                    filters : $"xp.Country={user.xp.Country}&xp.Type=BuyerLocation",
                    page : args.Page,
                    pageSize : 100
                    );
            }
            else
            {
                var userUserGroupAssignments = await GetUserUserGroupAssignments("BuyerLocation", buyerID, userID, verifiedUser);

                var userBuyerLocationAssignments = new List <HSLocationUserGroup>();
                foreach (var assignment in userUserGroupAssignments)
                {
                    //Buyer Location user groups are formatted as {buyerID}-{userID}.  This eliminates the unnecessary groups that end in "-{OrderApproval}", for example, helping performance.
                    if (assignment.UserGroupID.Split('-').Length == 2)
                    {
                        var userGroupLocation = await _oc.UserGroups.GetAsync <HSLocationUserGroup>(
                            buyerID,
                            assignment.UserGroupID
                            );

                        if (args.Search == null || userGroupLocation.Name.ToLower().Contains(args.Search))
                        {
                            userBuyerLocationAssignments.Add(userGroupLocation);
                        }
                    }
                }
                userGroups.Items = userBuyerLocationAssignments;
                userGroups.Meta  = new ListPageMeta()
                {
                    Page     = 1,
                    PageSize = 100
                };
            }
            return(userGroups);
        }
Beispiel #23
0
        public async Task <ListPage <TaxCode> > ListTaxCodesAsync(ListArgs <TaxCode> hsListArgs)
        {
            if (ShouldMockAvalaraResponse())
            {
                return(CreateMockTaxCodeList());
            }

            var args        = TaxCodeMapper.Map(hsListArgs);
            var avataxCodes = await _avaTax.ListTaxCodesAsync(args.Filter, args.Top, args.Skip, args.OrderBy);

            var codeList = TaxCodeMapper.Map(avataxCodes, args);

            return(codeList);
        }
        public void model_binder_filter_string_match(string expression, List <Tuple <string, string> > args)
        {
            var query = new ListArgs <Product>()
            {
                Filters = new List <ListFilter>()
                {
                    new ListFilter()
                    {
                        QueryParams = args
                    }
                }
            };

            Assert.IsTrue(expression == query.ToFilterString());
        }
Beispiel #25
0
        public admin_schedule_instance()
        {
            InitializeComponent();
            //生成概要信息区域
            template = new InstanceTemplate();
            var args = new InstanceArgs("api/schedule/system-schedules/", null, User.Api, Title);

            args.margin = new Thickness(0, 10, 0, 10);
            args.items.Add(new InstanceArgs.Item("id", "编号", "text"));
            args.items.Add(new InstanceArgs.Item("year", "学年", "text", EditAbleStatus.Writeable));
            args.items.Add(new InstanceArgs.Item("term", "学期", "text", EditAbleStatus.Writeable));
            args.items.Add(new InstanceArgs.Item("begin", "开始时间", "text", EditAbleStatus.Writeable));
            args.items.Add(new InstanceArgs.Item("end", "结束时间", "text", EditAbleStatus.Writeable));
            template.Construct(args);
            ContentGrid.Children.Add(template);
            //生成列表区域
            list_temp = new ListTemplate();
            var clargs = new CreateArgs("api/schedule/system-schedule-items/", User.Api, "创建时间表项");

            clargs.items.Add(new CreateArgs.Item("no", "节次", "text"));
            clargs.items.Add(new CreateArgs.Item("begin", "上课时间", "text"));
            clargs.items.Add(new CreateArgs.Item("end", "下课时间", "text"));
            clargs.items.Add(new CreateArgs.Item("system_schedule", "系统时间表", "hidden", data: "system_schedule"));

            var largs = new ListArgs("api/schedule/system-schedule-items/", User.Api, "时间表项", Createable: true, Createargs: clargs);

            largs.columns.Add(new ListArgs.Column("id", "编号", customaction: UpdateScheduleItemInstance));
            largs.columns.Add(new ListArgs.Column("no", "节次", customaction: UpdateScheduleItemInstance));
            largs.columns.Add(new ListArgs.Column("begin", "上课时间"));
            largs.columns.Add(new ListArgs.Column("end", "下课时间"));

            list_temp.Construct(largs);
            ListGrid.Children.Add(list_temp);
            //生成项的详情区域
            instance_temp = new InstanceTemplate();
            var iargs = new InstanceArgs("api/schedule/system-schedule-items/", null, User.Api, "表项信息");

            iargs.items.Add(new InstanceArgs.Item("id", "编号", "text"));
            iargs.items.Add(new InstanceArgs.Item("no", "节次", "text", EditAbleStatus.Writeable));
            iargs.items.Add(new InstanceArgs.Item("begin", "上课时间", "text", EditAbleStatus.Writeable));
            iargs.items.Add(new InstanceArgs.Item("end", "下课时间", "text", EditAbleStatus.Writeable));
            iargs.deleteaction = () => {       //当按下子项的删除按钮时
                InstanceGrid.Children.Clear(); //仅仅是不显示该区域。
                list_temp.UpdateData();        //刷新列表。
            };

            instance_temp.Construct(iargs);
        }
Beispiel #26
0
        public async Task <ListPage <HSCatalog> > List(string buyerID, ListArgs <HSCatalog> args, VerifiedUserContext user)
        {
            var queryParamsForCatalogUserGroup = new Tuple <string, string>("xp.Type", "Catalog");

            args.Filters.Add(new ListFilter()
            {
                QueryParams = new List <Tuple <string, string> > {
                    queryParamsForCatalogUserGroup
                }
            });
            return(await _oc.UserGroups.ListAsync <HSCatalog>(buyerID, filters : args.ToFilterString(),
                                                              search : args.Search,
                                                              pageSize : args.PageSize,
                                                              page : args.Page,
                                                              accessToken : user.AccessToken));
        }
        public detail()
        {
            InitializeComponent();

            list_temp = new ListTemplate();
            var largs = new ListArgs(null, User.Api, "出勤记录表", Searchable: true);

            largs.columns.Add(new ListArgs.Column("id", "编号"));
            largs.columns.Add(new ListArgs.Column("student", "学生姓名"));
            largs.columns.Add(new ListArgs.Column("course_manage", "课程编号"));
            largs.columns.Add(new ListArgs.Column("date", "日期"));
            largs.columns.Add(new ListArgs.Column("course_number", "节次"));
            largs.columns.Add(new ListArgs.Column("status", "出勤状态", type: "choice", data: AttendanceState.attendance_state));
            list_temp.Construct(largs);
            ListGrid.Children.Add(list_temp);
        }
Beispiel #28
0
        public static TaxCodesListArgs Map(ListArgs <TaxCode> source)
        {
            var taxCategory       = source?.Filters?[0]?.FilterValues?[0]?.Term ?? "";       // TODO - error if no term provided
            var taxCategorySearch = taxCategory.Trim('0');
            var search            = source.Search;
            var filter            = search != "" ? $"isActive eq true and taxCode startsWith '{taxCategorySearch}' and (taxCode contains '{search}' OR description contains '{search}')" : $"isActive eq true and taxCode startsWith '{taxCategorySearch}'";

            return(new TaxCodesListArgs()
            {
                Filter = filter,
                Top = source.PageSize,
                Skip = (source.Page - 1) * source.PageSize,
                CodeCategory = taxCategory,
                OrderBy = null
            });
        }
Beispiel #29
0
        public void NoticeA()
        {
            ListArgs.Add(new EmailFormEventArgs
            {
                To = _toAll,
                Cc = _cc,
                // Subject = string.Format("品质异常通知-请尽快回复临时措施-{0}", _formMsg),

                Subject  = $"[{_ncr.PartNo}] 发生品质异常({DateTime.Now.ToString("MM/dd")})",
                NickName = "All",
                Title    = $"料号:{_ncr.PartNo}",
                From     = "BPM",
                Content  = $"<p>以下为新发生的品质异常,请相关人员及时回复临时措施!!!{_path}</p><div>{_content}</div>",
                Date     = DateTime.Now,
                Link     = $"点击进入系统{_path}"
            });
        }
        public void Process(ListArgs args)
        {
            if (args == null) return;
            var publications = _service.GetApplicablePublications(new Guid(Constants.PipelineEventIds.ListDeletion));
            if (!publications.Any())
                return;

            foreach (var publication in publications)
            {
                foreach (var channel in publication.GetChannels())
                {
                    _message.Text = $"List {args.ContactList.Name} has been deleted.";
                    _message.UpdateChannelInfo(channel, publication);
                    _service.PublishMessage(_message);
                }
            }
        }
Beispiel #31
0
        public static FList NewList(ListArgs listArgs)
        {
            var fList = NewT <FList, GList>(listArgs);

            if (listArgs != null)
            {
                if (listArgs.onState != null)
                {
                    fList.SetState(listArgs.onState);
                }
                if (listArgs.onClickItem != null)
                {
                    fList.OnClickItem(listArgs.onClickItem);
                }
            }

            return(fList);
        }