コード例 #1
0
ファイル: OrderManagement.cs プロジェクト: anestis-alm/Eagro
        public Order CreateOrder(OrderOption orderOption)
        {
            BasketManagement   bskMng = new BasketManagement(db);
            ProductManagement  prdMng = new ProductManagement(db);
            CustomerManagement cstMng = new CustomerManagement(db);
            Order order = new Order
            {
                Basket              = bskMng.FindBasketById(orderOption.BasketId),
                Customer            = cstMng.FindCustomerById(orderOption.CustomerId),
                OrderName           = orderOption.OrderName,
                OrderAddress        = orderOption.OrderAddress,
                OrderCity           = orderOption.OrderCity,
                OrderState          = orderOption.OrderState,
                OrderCountry        = orderOption.OrderCountry,
                OrderPhone          = orderOption.OrderPhone,
                OrderEmail          = orderOption.OrderEmail,
                OrderCost           = bskMng.TotalBasketCost(orderOption.BasketId),
                OrderDate           = DateTime.Now,
                OrderShipped        = false,
                OrderTrackingNumber = ""
            };


            db.Orders.Add(order);
            db.SaveChanges();

            prdMng.AvailableQuantity(orderOption.BasketId);

            return(order);
        }
コード例 #2
0
        /// <summary>
        /// 정렬: OrderOption 열거형의 데이터에 따른 정렬 조건 처리
        /// </summary>
        /// <param name="orderOption">OrderOption 열거형</param>
        /// <returns>읽기전용(IEnumerable)으로 정렬된 레코드셋</returns>
        public IEnumerable <Category> Ordering(OrderOption orderOption)
        {
            IEnumerable <Category> categories;

            switch (orderOption)
            {
            case OrderOption.Ascending:
                //[a] 확장 메서드 사용
                categories = _categories.OrderBy(c => c.CategoryName);
                break;

            case OrderOption.Descending:
                //[b] 쿼리 식 사용
                categories = (from category in _categories
                              orderby category.CategoryName descending
                              select category);
                break;

            default:
                //[c] 기본 값
                categories = _categories;
                break;
            }

            return(categories);
        }
コード例 #3
0
        public OrderOption CreateOrder(CustomerOptions customerOpt)
        {
            if (customerOpt == null)
            {
                return(null);
            }
            Customer customer = dbContext.Customers.Find(customerOpt.Id);

            if (customer == null)
            {
                return(null);
            }
            Order order = new Order {
                Customer = customer
            };

            dbContext.Orders.Add(order);
            dbContext.SaveChanges();
            OrderOption orderOption = new OrderOption
            {
                CustomerName = customer.FirstName + " " + customer.LastName,
                Id           = order.Id
            };

            return(orderOption);
        }
コード例 #4
0
        public IQueryable <BookListDto> SearchBooks(OrderOption orderOption, BooksFilterBy filterBy, string filterValue, int pageNumber = 0, int pageSize = 10)
        {
            var query = _context.Books
                        .AsNoTracking()                        // Because this is a read only query, you add AsNoTracking
                        .MapBookToDto()                        // Uses the Select query object, which will pick out/calculate the data it needs
                        .OrderBooksBy(orderOption)             // Adds the commands to order the data by using the given option
                        .FilterBooksBy(filterBy, filterValue); // Adds the commands to filter data

            return(query.Page(pageNumber, pageSize));
        }
コード例 #5
0
ファイル: DeskQuote.cs プロジェクト: thompson-kevin/cit365
        private double CalcRushOrderCost(OrderOption orderOption, double surfaceArea)
        {
            switch (orderOption)
            {
            case OrderOption.ThreeDay:
                if (surfaceArea < 1000)
                {
                    return(60);
                }
                else if (surfaceArea >= 1000 && surfaceArea <= 2000)
                {
                    return(70);
                }
                else if (surfaceArea > 2000)
                {
                    return(80);
                }
                break;

            case OrderOption.FiveDay:
                if (surfaceArea < 1000)
                {
                    return(40);
                }
                else if (surfaceArea >= 1000 && surfaceArea <= 2000)
                {
                    return(50);
                }
                else if (surfaceArea > 2000)
                {
                    return(60);
                }
                break;

            case OrderOption.SevenDay:
                if (surfaceArea < 1000)
                {
                    return(30);
                }
                else if (surfaceArea >= 1000 && surfaceArea <= 2000)
                {
                    return(35);
                }
                else if (surfaceArea > 2000)
                {
                    return(40);
                }
                break;

            default:
                return(0);
            }
            return(-1);
        }
コード例 #6
0
ファイル: OrderOption.ascx.cs プロジェクト: lulzzz/BrandStore
 /// <summary>
 /// Determins if the current option should be checked
 /// </summary>
 /// <param name="opt"></param>
 /// <returns></returns>
 protected bool DetermineSelected(OrderOption opt)
 {
     if (this.Datasource.OrderOptions.Count == 0)
     {
         return(opt.DefaultIsChecked);
     }
     else
     {
         return(Datasource.OrderOptions.Any(xOpt => xOpt.Equals(opt)));
     }
 }
コード例 #7
0
        /// <summary>
        /// [11] 정렬
        /// </summary>
        public IEnumerable <CategoryBase> Ordering(OrderOption orderOption)
        {
            List <CategoryBase> categories = new List <CategoryBase>();

            using (SqlConnection con = new SqlConnection(_connectionString))
            {
                con.Open();

                string sql = @" Select Top 1000 * From CategoriesBases ";

                switch (orderOption)
                {
                case OrderOption.Ascending:
                    sql += " Order By CategoryName Asc ";
                    break;

                case OrderOption.Descending:
                    sql += " Order By CategoryName Desc ";
                    break;

                default:
                    sql += "";
                    break;
                }

                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.CommandType = CommandType.Text;

                // CommandBehavior.CloseConnection: 데이터리더 닫힐 때 커넥션도 닫힘
                SqlDataReader dr =
                    cmd.ExecuteReader(CommandBehavior.CloseConnection);
                //[!] Read() 메서드로 데이터 있는만큼 반복
                while (dr.Read())
                {
                    var categoryId   = dr.GetInt32(0);
                    var categoryName =
                        (dr["CategoryName"] == DBNull.Value) ? "" : dr.GetString(1);

                    // 개체 리터럴을 통해서 값 채우기
                    categories.Add(new CategoryBase
                    {
                        CategoryId   = categoryId,
                        CategoryName = categoryName
                    });
                }

                dr.Close();
            }

            return(categories);
        }
コード例 #8
0
ファイル: OrderManagement.cs プロジェクト: anestis-alm/Eagro
        public List <Order> FindOrderByCustomer(OrderOption orderOption)
        {
            if (orderOption == null)
            {
                return(null);
            }
            if (orderOption.OrderName == null)
            {
                return(null);
            }

            return(db.Orders
                   .Where(ord => ord.OrderName == orderOption.OrderName)
                   .ToList());
        }
コード例 #9
0
        public virtual OrderOption InsertOrderOption(OrderOption entity)
        {
            OrderOption other = new OrderOption();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into OrderOption ( [OrderOptionGUID]
				,[Name]
				,[Description]
				,[Cost]
				,[DisplayOrder]
				,[DefaultIsChecked]
				,[TaxClassID]
				,[ExtensionData]
				,[CreatedOn] )
				Values
				( @OrderOptionGUID
				, @Name
				, @Description
				, @Cost
				, @DisplayOrder
				, @DefaultIsChecked
				, @TaxClassID
				, @ExtensionData
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@OrderOptionID", entity.OrderOptionId)
                    , new SqlParameter("@OrderOptionGUID", entity.OrderOptionGuid)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@Description", entity.Description ?? (object)DBNull.Value)
                    , new SqlParameter("@Cost", entity.Cost)
                    , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                    , new SqlParameter("@DefaultIsChecked", entity.DefaultIsChecked)
                    , new SqlParameter("@TaxClassID", entity.TaxClassId)
                    , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetOrderOption(Convert.ToInt32(identity)));
            }
            return(entity);
        }
コード例 #10
0
        public IActionResult CreateOrder()
        {
            int customerId = 15;

            OrderOption orderOption = orderService.CreateOrder(customerId);

            int orderId = orderOption.OrderId;

            List <ProductOptions> productsOpts = productService.GetAllProduct();
            OrderModel            productModel = new OrderModel
            {
                products = productsOpts,
                orderId  = orderId
            };

            return(View(productModel));
        }
コード例 #11
0
        public static void SetColumnAdorners(GridView gvResults, IList <OrderOption> orderOptions)
        {
            for (int i = 0; i < orderOptions.Count; i++)
            {
                OrderOption oo = orderOptions[i];

                var fullKey = oo.Token.FullKey();

                SortGridViewColumnHeader header = gvResults.Columns
                                                  .Select(c => (SortGridViewColumnHeader)c.Header)
                                                  .FirstOrDefault(c => c.RequestColumn.Name == fullKey);

                if (header != null)
                {
                    header.CreateAdorner(oo.OrderType, i);
                    oo.Header = header;
                }
            }
        }
コード例 #12
0
        public virtual OrderOption OrderOptionFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            OrderOption entity = new OrderOption();

            entity.OrderOptionId    = (System.Int32)dr["OrderOptionID"];
            entity.OrderOptionGuid  = (System.Guid)dr["OrderOptionGUID"];
            entity.Name             = dr["Name"].ToString();
            entity.Description      = dr["Description"].ToString();
            entity.Cost             = (System.Decimal)dr["Cost"];
            entity.DisplayOrder     = (System.Int32)dr["DisplayOrder"];
            entity.DefaultIsChecked = (System.Byte)dr["DefaultIsChecked"];
            entity.TaxClassId       = (System.Int32)dr["TaxClassID"];
            entity.ExtensionData    = dr["ExtensionData"].ToString();
            entity.CreatedOn        = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
コード例 #13
0
        public OrderOption GetOrder(int orderId)
        {
            Order    order    = dbContext.Orders.Include(o => o.Customer).FirstOrDefault(x => x.Id == orderId);
            Customer customer = dbContext.Customers.Find(order.Customer.Id);

            List <int>          products      = new List <int>();
            List <OrderProduct> orderProducts = dbContext.OrderProducts
                                                .Include(op => op.Product)
                                                .Where(op => op.Order.Equals(order)).ToList();

            orderProducts.ForEach(op => products.Add(op.Product.Id));

            OrderOption orderOption = new OrderOption
            {
                CustomerName = customer.FirstName + " " + customer.LastName,
                Id           = order.Id,
                Products     = products
            };

            return(orderOption);
        }
コード例 #14
0
        public virtual OrderOption UpdateOrderOption(OrderOption entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            OrderOption other = GetOrderOption(entity.OrderOptionId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update OrderOption set  [OrderOptionGUID]=@OrderOptionGUID
							, [Name]=@Name
							, [Description]=@Description
							, [Cost]=@Cost
							, [DisplayOrder]=@DisplayOrder
							, [DefaultIsChecked]=@DefaultIsChecked
							, [TaxClassID]=@TaxClassID
							, [ExtensionData]=@ExtensionData
							, [CreatedOn]=@CreatedOn 
							 where OrderOptionID=@OrderOptionID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@OrderOptionID", entity.OrderOptionId)
                , new SqlParameter("@OrderOptionGUID", entity.OrderOptionGuid)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@Description", entity.Description ?? (object)DBNull.Value)
                , new SqlParameter("@Cost", entity.Cost)
                , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                , new SqlParameter("@DefaultIsChecked", entity.DefaultIsChecked)
                , new SqlParameter("@TaxClassID", entity.TaxClassId)
                , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetOrderOption(entity.OrderOptionId));
        }
コード例 #15
0
        public void ChangeOrders(IList <OrderOption> orderOptions)
        {
            if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift || (orderOptions.Count == 1 && orderOptions[0].Header == this))
            {
            }
            else
            {
                foreach (var oo in orderOptions)
                {
                    if (oo.Header != null)
                    {
                        oo.Header.CleanAdorner();
                    }
                }

                orderOptions.Clear();
            }

            OrderOption order = orderOptions.SingleOrDefaultEx(oo => oo.Header == this);

            if (order != null)
            {
                order.Header.FlipAdorner();
                order.OrderType = order.Header.sortAdorner.OrderType;
            }
            else
            {
                this.CreateAdorner(OrderType.Ascending, orderOptions.Count);

                orderOptions.Add(new OrderOption()
                {
                    Token     = this.RequestColumn.Token,
                    OrderType = OrderType.Ascending,
                    Header    = this,
                });
            }
        }
コード例 #16
0
        public IEnumerable <Person> ReadPeople(OrderOption order)
        {
            IEnumerable <Person> orderedResult = null;

            switch (order)
            {
            case OrderOption.birthdate:
                orderedResult = ReadPeople().OrderBy(x => x.DateOfBirth);
                break;

            case OrderOption.gender:
                orderedResult = ReadPeople().OrderBy(x => x.Gender).ThenBy(x => x.LastName);
                break;

            case OrderOption.name:
                orderedResult = ReadPeople().OrderByDescending(x => x.LastName);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(order));
            }

            return(orderedResult);
        }
コード例 #17
0
ファイル: OrderOption.ascx.cs プロジェクト: lulzzz/BrandStore
        public void ForEachItemTemplate(Repeater rpt, out List <OrderOption> updatedOptions)
        {
            updatedOptions = new List <OrderOption>();
            foreach (RepeaterItem rptItem in rpt.Items)
            {
                if (rptItem.ItemType == ListItemType.Item ||
                    rptItem.ItemType == ListItemType.AlternatingItem)
                {
                    //                    itemAction(rptItem);

                    DataCheckBox chkSelected = rptItem.FindControl <DataCheckBox>("chkSelected");
                    if (chkSelected != null &&
                        chkSelected.Checked &&
                        chkSelected.Visible)
                    {
                        OrderOption xOpt = base.Datasource.AllOrderOptions.FirstOrDefault(opt => opt.UniqueID.ToString().EqualsIgnoreCase(chkSelected.Data.ToString()));
                        if (xOpt != null)
                        {
                            updatedOptions.Add(xOpt);
                        }
                    }
                }
            }
        }
コード例 #18
0
ファイル: OrderOption.ascx.cs プロジェクト: lulzzz/BrandStore
        /// <summary>
        /// Displays proper cost text
        /// </summary>
        /// <param name="opt"></param>
        /// <returns></returns>
        protected string DisplayCost(OrderOption opt)
        {
            string  displayText = string.Empty;
            decimal cost        = opt.Cost;

            if (cost == decimal.Zero)
            {
                // display FREE
                displayText = AppLogic.GetString("shoppingcart.aspx.16", this.ThisCustomer.SkinID, this.ThisCustomer.LocaleSetting);
            }
            else
            {
                if (Datasource.VatEnabled)
                {
                    if (Datasource.VatIsInclusive)
                    {
                        cost += opt.TaxRate;
                    }

                    // sample display format would be:
                    // $10.00 ex vat
                    //  VAT: $1.00
                    displayText  = Localization.CurrencyStringForDisplayWithExchangeRate(cost, this.ThisCustomer.CurrencySetting);
                    displayText += "&nbsp;";
                    displayText += CommonLogic.IIF(Datasource.VatIsInclusive, AppLogic.GetString("setvatsetting.aspx.6", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("setvatsetting.aspx.7", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));
                    displayText += "VAT: " + ThisCustomer.CurrencyString(opt.TaxRate);
                }
                else
                {
                    displayText = Localization.CurrencyStringForDisplayWithExchangeRate(cost, this.ThisCustomer.CurrencySetting);
                }
            }


            return(displayText);
        }
コード例 #19
0
 public IEnumerable <CompanyModel> Ordering(OrderOption orderOption)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Lädt die Kanäle, die der lokale Nutzer abonniert hat und macht diese über die MyChannels Property abrufbar.
        /// </summary>
        public async Task LoadMyChannelsAsync()
        {
            List<Channel> channels;
            try
            {
                if (ChannelCollection == null || ChannelCollection.Count == 0)
                {
                    Debug.WriteLine("Loading subscribed channels from DB.");

                    // Frage abonnierte Kanäle ab.
                    channels = await Task.Run(() => channelController.GetMyChannels());

                    // Sortiere Liste nach aktuellen Anwendungseinstellungen.
                    channels = await Task.Run(() => sortChannelsByApplicationSetting(channels));

                    // Mache Kanäle über Property abrufbar.
                    ChannelCollection = new ObservableCollection<Channel>(channels);

                    // Speichere die aktuell gültigen Anwendungseinstellungen zwischen.
                    AppSettings currentSettings = channelController.GetApplicationSettings();
                    cachedGeneralListSettings = currentSettings.GeneralListOrderSetting;
                    cachedChannelOrderSettings = currentSettings.ChannelOderSetting;

                    // Speichere die Kanäle im Lookup-Verzeichnis.
                    foreach (Channel channel in channels)
                    {
                        currentChannels.Add(channel.Id, channel);
                    }
                }
                else
                {
                    Debug.WriteLine("It seems the homescreen view was taken from the cache. We check for local updates");

                    // Prüfe zunächst, ob die Einstellungen aktualisiert wurden.
                    AppSettings currentAppSettings = channelController.GetApplicationSettings();
                    if (currentAppSettings.GeneralListOrderSetting != cachedGeneralListSettings ||
                        currentAppSettings.ChannelOderSetting != cachedChannelOrderSettings)
                    {
                        // Restrukturierung der Liste abonnierter Kanäle durch neu laden.
                        channels = await Task.Run(() => channelController.GetMyChannels());
                        await reloadChannelCollectionCompletelyAsync(channels);

                        // Aktualisiere die nun für die View geltenden Einstellungen.
                        cachedGeneralListSettings = currentAppSettings.GeneralListOrderSetting;
                        cachedChannelOrderSettings = currentAppSettings.ChannelOderSetting;
                    }
                    else
                    {
                        // Führe nur lokale Synchronisation durch.
                        channels = await Task.Run(() => channelController.GetMyChannels());
                        await updateViewModelChannelCollectionAsync(channels);
                    }             

                    // Führe Aktualisierung von Anzahl ungelesener Nachrichten Properties der Kanäle aus.
                    await UpdateNumberOfUnreadAnnouncementsAsync();
                }
            }
            catch(ClientException e)
            {
                Debug.WriteLine("Error during loading process of subscribed channels.");
                displayError(e.ErrorCode);
            }

            checkCommandExecution();
        }
コード例 #21
0
        public static IQueryable <BookListDto> OrderBooksBy(this IQueryable <BookListDto> books, OrderOption orderOption)
        {
            switch (orderOption)
            {
            case OrderOption.SimpleOrder:
                return(books.OrderByDescending(x => x.BookId));

            case OrderOption.ByVotes:
                return(books.OrderByDescending(x => x.ReviewAverageVotes));

            case OrderOption.ByPublicationDate:
                return(books.OrderByDescending(x => x.PublishedOn));

            case OrderOption.ByPriceLowestFirst:
                return(books.OrderBy(x => x.ActualPrice));

            case OrderOption.ByPriceHighestFirst:
                return(books.OrderByDescending(x => x.ActualPrice));

            default:
                throw new ArgumentOutOfRangeException(nameof(orderOption), orderOption, null);
            }
        }
コード例 #22
0
 public IEnumerable <ArticleBase> Ordering(OrderOption orderOption)
 {
     throw new NotImplementedException();
 }
コード例 #23
0
 public IEnumerable <UserPriceData> Ordering(OrderOption orderOption)
 {
     throw new NotImplementedException();
 }
コード例 #24
0
        internal static IQueryable <Product> GetWithAppliedOrder(this IQueryable <Product> entities, OrderOption opt)
        {
            switch (opt)
            {
            case OrderOption.ByDateDecending:
                return(entities.OrderByDescending(x => x.PublishDateTime));

            case OrderOption.LikesCount:
                return(entities.OrderByDescending(x => x.LikeCount));

            case OrderOption.VisitNumber:
                return(entities.OrderByDescending(x => x.VisitCount));

            case OrderOption.Random:
                return(entities.OrderByDescending(x => Guid.NewGuid()).Distinct());

            default: return(entities);
            }
        }
        /// <summary>
        /// Lade die Kanäle, für die der eingeloggte Moderator als Verantwortlicher eingetragen ist.
        /// </summary>
        public async Task LoadManagedChannelsAsync()
        {
            Moderator activeModerator = channelController.GetLocalModerator();
            if (activeModerator == null)
            {
                Debug.WriteLine("No active moderator found. Can't perform loading.");
                return;
            }

            try
            {
                // Prüfe, ob Seite aus dem Cache kommt oder nicht.
                if (ChannelCollection == null || ChannelCollection.Count == 0)
                {
                    Debug.WriteLine("The managed channels need to be loaded completely.");

                    List<Channel> managedChannelList = await Task.Run(() => channelController.GetManagedChannels(activeModerator.Id));

                    // Sortiere nach aktuellen Anwendungseinstellungen.
                    managedChannelList = await Task.Run(() => sortChannelsByApplicationSetting(managedChannelList));

                    ChannelCollection = new ObservableCollection<Channel>(managedChannelList);

                    // Speichere die aktuell gültigen Anwendungseinstellungen zwischen.
                    AppSettings currentSettings = channelController.GetApplicationSettings();
                    cachedGeneralListSettings = currentSettings.GeneralListOrderSetting;
                    cachedChannelOrderSettings = currentSettings.ChannelOderSetting;

                    // Füge Kanäle noch dem Lookup-Verzeichnis hinzu.
                    foreach (Channel channel in managedChannelList)
                    {
                        currentChannels.Add(channel.Id, channel);
                    }

                    // Führe noch Aktualisierung mit Daten des REST Servers aus, so dass der lokale Datensatz auf den neuesten Stand kommt. 
                    await updateChannelModeratorRelationshipsAsync(false);
                }
                else
                {
                    // Seite kommt aus dem Cache.
                    Debug.WriteLine("We already have managed channels from cache.");
                    
                    // Prüfe zunächst, ob die Einstellungen aktualisiert wurden.
                    AppSettings currentAppSettings = channelController.GetApplicationSettings();
                    if (currentAppSettings.GeneralListOrderSetting != cachedGeneralListSettings ||
                        currentAppSettings.ChannelOderSetting != cachedChannelOrderSettings)
                    {
                        // Aktualisiere Liste nach Änderung der Einstellungen.
                        // Lade zunächst die aktuellsten lokal gehaltenen Daten.
                        List<Channel> managedChannelList = await Task.Run(() => channelController.GetManagedChannels(activeModerator.Id));

                        await reloadChannelCollectionCompletelyAsync(managedChannelList);

                        // Aktualisiere die nun für die View geltenden Einstellungen.
                        cachedGeneralListSettings = currentAppSettings.GeneralListOrderSetting;
                        cachedChannelOrderSettings = currentAppSettings.ChannelOderSetting;
                    }
                    else
                    {
                        // Synchronisiere nur die im ViewModel gehaltene Liste von Kanälen mit den
                        // lokal im System vorhanden Kanälen.
                        List<Channel> localManagedChannelList = await Task.Run(() => channelController.GetManagedChannels(activeModerator.Id));
                        await updateViewModelChannelCollectionAsync(localManagedChannelList);
                    }
                }
            }
            catch (ClientException ex)
            {
                Debug.WriteLine("Error occurred during loading of managedChannels.");
                displayError(ex.ErrorCode);
            }
        }
        /// <summary>
        /// Lädt die Gruppen, in denen der lokale Nutzer Teilnehmer ist und 
        /// macht diese über Properties zugreifbar.
        /// </summary>
        public async Task LoadMyGroupsAsync()
        {
            if (LocalUser == null)
            {
                // Setze lokales Nutzerobjekt.
                LocalUser = groupController.GetLocalUser();
            }

            List<Group> groups = null;
            try
            {
                if (GroupCollection == null || GroupCollection.Count == 0)
                {
                    Debug.WriteLine("LoadMyGroupsAsync: Not from cache. Load groups from DB.");

                    // Frage Gruppen aus der Datenbank ab.
                    groups = await Task.Run(() => groupController.GetAllGroups());
                    Debug.WriteLine("LoadMyGroupsAsync: There are {0} group elements in the list.", groups.Count);

                    // Sortiere Gruppen anhand von aktuellen Anwendungseinstellungen.
                    groups = await Task.Run(() => sortGroupsByApplicationSettings(groups));

                    // Mache Gruppen über Property abrufbar.
                    GroupCollection = new ObservableCollection<Group>(groups);

                    // Speichere die aktuell gültigen Anwendungseinstellungen zwischen.
                    AppSettings currentSettings = groupController.GetApplicationSettings();
                    cachedGroupOrderSettings = currentSettings.GroupOrderSetting;

                    // Füge Gruppen dem Lookup Verzeichnis hinzu.
                    foreach (Group group in groups)
                    {
                        currentGroups.Add(group.Id, group);
                    }
                }
                else
                {
                    Debug.WriteLine("LoadMyGroupsAsync: Seems like page comes from cache.");

                    // Prüfe zunächst, ob die Einstellungen aktualisiert wurden.
                    AppSettings currentAppSettings = channelController.GetApplicationSettings();
                    if (currentAppSettings.GroupOrderSetting != cachedGroupOrderSettings)
                    {
                        Debug.WriteLine("LoadMyGroupsAsync: Reloading completely.");
                        // Restrukturierung der Liste von Gruppen durch neu laden.
                        List<Group> localGroups = await Task.Run(() => groupController.GetAllGroups());
                        await ReloadGroupCollectionCompletelyAsync(localGroups);

                        // Aktualisiere die nun für die View geltenden Einstellungen.
                        cachedGroupOrderSettings = currentAppSettings.GroupOrderSetting;
                    }
                    else
                    {
                        Debug.WriteLine("LoadMyGroupsAsync: Perform local sync.");
                        // Führe nur lokale Synchronisation durch.
                        Task<List<int>> localGroups = Task.Run(() => groupController.GetLocalGroupIdentifiers());
                        List<Group> modifiedGroups = await Task.Run(() => groupController.GetDirtyGroups());
                        List<int> localGroupSnapshot = await localGroups;
                        await updateViewModelGroupCollectionAsync(modifiedGroups, localGroupSnapshot);

                        // Setze Dirty-Flag zurück.
                        groupController.ResetDirtyFlagsOnGroups();
                    }
                }
            }
            catch (ClientException ex)
            {
                Debug.WriteLine("Error during loading process of my groups");
                displayError(ex.ErrorCode);
            }

            checkCommandExecution();
        }
コード例 #27
0
 public IEnumerable <CategoryBase> Ordering(OrderOption orderOption)
 {
     return(_repository.Ordering(orderOption));
 }
コード例 #28
0
 public IEnumerable <Twelve> Ordering(OrderOption orderOption)
 {
     throw new System.NotImplementedException();
 }
        /// <summary>
        /// Aktualisiert die Anordnungseinstellungen bezüglich Auflistungen in der Anwendung.
        /// </summary>
        /// <param name="generalListSettings">Angabe, ob Listeninhalt grundsätzlich aufsteigend oder absteigend nach Ordnungskriterium sortiert werden soll.</param>
        /// <param name="announcementOrderSetting">Angabe, ob Nachrichten von unten nach oben oder von oben nach unten augelistet werden sollen.</param>
        /// <param name="channelOrderSettings">Ordnungskriterium für Auflistungen von Kanälen.</param>
        /// <param name="groupOrderSettings">Ordnungskriterium für Auflistungen von Gruppen.</param>
        /// <param name="conversationOrderSettings">Ordnungskriterium für Auflistungen von Konversationen.</param>
        /// <param name="ballotOrderSettings">Ordnungskriteriumg für Auflistungen von Abstimmungen.</param>
        public void UpdateListSettings(OrderOption generalListSettings, OrderOption announcementOrderSetting, OrderOption channelOrderSettings, 
            OrderOption groupOrderSettings, OrderOption conversationOrderSettings, OrderOption ballotOrderSettings)
        {
            // Hole die aktuellen Anwendungseinstellungen.
            AppSettings appSettings = GetApplicationSettings();

            appSettings.GeneralListOrderSetting = generalListSettings;
            appSettings.AnnouncementOrderSetting = announcementOrderSetting;
            appSettings.ChannelOderSetting = channelOrderSettings;
            appSettings.GroupOrderSetting = groupOrderSettings;
            appSettings.ConversationOrderSetting = conversationOrderSettings;
            appSettings.BallotOrderSetting = ballotOrderSettings;

            try
            {
                Debug.WriteLine("Update list settings. New values are {0}, {1}, {2}, {3}, {4}, {5}.",
                    generalListSettings,
                    announcementOrderSetting,
                    channelOrderSettings,
                    groupOrderSettings,
                    conversationOrderSettings,
                    ballotOrderSettings);
                applicationSettingsDatabaseManager.UpdateApplicationSettings(appSettings);
            }
            catch (DatabaseException ex)
            {
                Debug.WriteLine("An error occurred during the list settings update. The error message is {0}.", ex.Message);
                throw new ClientException(ErrorCodes.LocalDatabaseException, ex.Message);
            }

            // Lege neues AppSettings Objekt in den Cache.
            AppSettingsCache.GetInstance().CacheApplicationSettings(appSettings);
        }
コード例 #30
0
 public OrderOption InsertOrderOption(OrderOption entity)
 {
     return(_iOrderOptionRepository.InsertOrderOption(entity));
 }
コード例 #31
0
 public OrderService(OrderOption option)
 {
     this._option = option;
 }
コード例 #32
0
 public virtual OrderOption DeleteOrderOption(OrderOption entity)
 {
     this.DeleteOrderOption(entity.OrderOptionId);
     return(entity);
 }
コード例 #33
0
 public IEnumerable <AnswerComment> Ordering(OrderOption orderOption)
 {
     throw new NotImplementedException();
 }
コード例 #34
0
 public OrderOption UpdateOrderOption(OrderOption entity)
 {
     return(_iOrderOptionRepository.UpdateOrderOption(entity));
 }