public override BotMessage BuildMsg()
        {
            db = new MarketBotDbContext();

            StockList = db.Stock.Where(s => s.ProductId == ProductId).Include(s => s.Product).OrderByDescending(s => s.Id).ToList();

            Pages = base.BuildDataPage <Stock>(StockList, base.PageSize);

            base.MessageReplyMarkup = base.PageNavigatorKeyboard <Stock>(Pages, Bot.AdminModule.AdminBot.ViewStockHistoryProdCmd, Bot.AdminModule.AdminBot.ModuleName, base.BackToAdminPanelBtn(), Argument: ProductId);

            if (Pages != null && Pages.Count > 0 && Pages[SelectPageNumber] != null)
            {
                var page = Pages[SelectPageNumber];

                int counter = 0;

                base.TextMessage = base.BlueRhombus + " " + StockList.FirstOrDefault().Product.Name + NewLine() + "Всего записей:" + StockList.Count.ToString() +
                                   NewLine() + "Страница " + SelectPageNumber.ToString() + " из " + Pages.Count.ToString() + NewLine() + NewLine();

                foreach (var stock in page)
                {
                    base.TextMessage += "Дата: " + stock.DateAdd.ToString() + " | Было " + (stock.Balance - stock.Quantity).ToString()
                                        + " | Изменение: " + stock.Quantity.ToString() + " | Стало: " + stock.Balance.ToString() + " | комментарий: " + stock.Text + NewLine();

                    counter++;
                }
            }

            return(this);
        }
Пример #2
0
 private void Awake()
 {
     this._expandedPos            = base.transform.localPosition;
     base.transform.localPosition = Vector3.zero;
     this._holder = base.transform.parent.GetComponent <SelectPageNumber>();
     this._self   = base.GetComponent <SelectPageNumber>();
     if (this._tabNum2)
     {
         this._tabNum2.SetActive(false);
     }
     this._tabNum.SetActive(false);
 }
        public override BotMessage BuildMsg()
        {
            db = new MarketBotDbContext();

            ProductList = db.Product.Include(p => p.ProductPrice)
                          .Include(p => p.Category).Include(p => p.Stock).ToList();

            Pages = BuildDataPage <Product>(ProductList);

            base.MessageReplyMarkup = base.PageNavigatorKeyboard <Product>(Pages, Bot.AdminModule.AdminBot.ViewStockCmd, Bot.AdminModule.AdminBot.ModuleName, BackToAdminPanelBtn());

            if (Pages != null && Pages.Count > 0 && Pages.Count >= SelectPageNumber &&
                Pages[SelectPageNumber] != null)
            {
                string message = "";
                base.TextMessage = message;
                int counter = 1; //счетчик
                var page    = Pages[SelectPageNumber];
                int number  = 1; // порядковый номер записи

                base.TextMessage = "Остатки | экспорт в xls " + Bot.AdminModule.ReportsBot.OrderExportCommand + NewLine() +
                                   "Страница " + SelectPageNumber.ToString() + " из " + Pages.Count.ToString() + NewLine();


                foreach (Product product in page)
                {
                    number = PageSize * (SelectPageNumber - 1) + counter;

                    message += NewLine() + number.ToString() + ") " + product.Name + NewLine();

                    if (product.Stock.Count > 0)
                    {
                        message += "Остаток:" + product.Stock.LastOrDefault().Balance.ToString();
                    }

                    if (product.Stock != null && product.Stock.Count == 0 ||
                        product.Stock != null && product.Stock.Count > 0 && product.Stock.OrderByDescending(s => s.Id).FirstOrDefault().Balance == 0)
                    {
                        message += "нет в наличии";
                    }

                    message += NewLine() + "Изменить: /adminproduct" + product.Id.ToString() + NewLine() +
                               "История: /stockhistory" + product.Id.ToString() + NewLine();

                    counter++;
                }
                base.TextMessage += message;
            }

            return(this);
        }
        public override BotMessage BuildMsg()
        {
            PickupList = PickUpPointFunction.PickUpPointList();

            Pages = base.BuildDataPage <PickupPoint>(PickupList, base.SelectPageNumber);


            if (Pages != null && Pages.Count > 0 && Pages.Count >= SelectPageNumber && Pages[SelectPageNumber] != null)
            {
                var page = Pages[SelectPageNumber];

                base.MessageReplyMarkup = base.PageNavigatorKeyboard <PickupPoint>(Pages, AdminBot.ViewPickupPointCmd, AdminBot.ModuleName, base.BackToAdminPanelBtn());

                base.TextMessage = "Список пунктов самовывоза ( всего " + PickupList.Count.ToString() + " )" + NewLine() +
                                   "Страница " + SelectPageNumber.ToString() + " из " + Pages.Count.ToString() + NewLine();

                int number = 1; // порядковый номер записи

                int counter = 1;

                foreach (var pickup in PickupList)
                {
                    number = PageSize * (SelectPageNumber - 1) + counter;

                    if (pickup.Enable)
                    {
                        base.TextMessage += number.ToString() + ") " + pickup.Name + " | скрыть /pickupdisable" + pickup.Id.ToString() + NewLine();
                    }

                    else
                    {
                        base.TextMessage += number.ToString() + ") " + pickup.Name + " | отображать /pickupenable" + pickup.Id.ToString() + NewLine();
                    }

                    counter++;
                }

                base.TextMessage += NewLine() + " Добавить новый пункт самовывоза /addpickuppoint";
            }

            else
            {
                base.TextMessage += NewLine() + " Добавить новый пункт самовывоза /addpickuppoint";

                base.MessageReplyMarkup = base.BackToAdminPanelKeyboard();
            }


            return(this);
        }
Пример #5
0
 private void OnDrawGizmosSelected()
 {
     if (this.refresh)
     {
         this.refresh = false;
         for (int i = 0; i < this._clues.Count; i++)
         {
             foreach (GameObject gameObject in this._clues[i]._renderers)
             {
                 SelectPageNumber component = gameObject.GetComponent <SelectPageNumber>();
                 if (component)
                 {
                     component.SelfHighlighting = true;
                 }
             }
         }
     }
 }
Пример #6
0
        public override BotMessage BuildMsg()
        {
            db = new MarketBotDbContext();

            if (CategoryId > 0)
            {
                Category = db.Category.Find(CategoryId);
            }

            if (CategoryId == 0)
            {
                Category   = db.Category.Where(c => c.Enable).FirstOrDefault();
                CategoryId = Category.Id;
            }

            if (Category.Product.Count == 0)
            {
                Category.Product = db.Product.Where(p => p.CategoryId == Category.Id && p.Enable == true)
                                   .Include(p => p.ProductPrice).Include(p => p.Category).Include(p => p.Stock).ToList();
            }


            //определям следующую категорию
            var NextCategory = GetNextCategoryId(CategoryId);

            if (NextCategory.Id != CategoryId)
            {
                NextCategoryBtn = BuildInlineBtn(NextCategory.Name, BuildCallData("GetCategory", Bot.CategoryBot.ModuleName, NextCategory.Id), base.Next2Emodji);
            }

            //определяем предыдующую категорию
            var PreviousCategory = GetPreviousCategoryId(CategoryId);

            if (PreviousCategory.Id != CategoryId)
            {
                PreviousCategoryBtn = BuildInlineBtn(PreviousCategory.Name, BuildCallData("GetCategory", Bot.CategoryBot.ModuleName, PreviousCategory.Id), base.Previuos2Emodji, false);
            }

            ProductList = db.Product.Where(p => p.Enable && p.CategoryId == CategoryId)
                          .Include(p => p.ProductPrice).Include(p => p.Category).Include(p => p.Stock).ToList();

            Pages = base.BuildDataPage <Product>(ProductList, this.PageSize);

            string message = base.GoldRhobmus + Bold(Category.Name) + base.GoldRhobmus +
                             NewLine() + "Всего товаров в категории: " + ProductList.Count.ToString() +
                             NewLine() + "Страница " + SelectPageNumber.ToString() + " из " + Pages.Count.ToString() + NewLine();


            if (Pages.Count > 0 && Pages.Count >= SelectPageNumber && Pages[SelectPageNumber] != null)
            {
                var Page = Pages[SelectPageNumber];

                foreach (Product product in Page)
                {
                    message += NewLine() + base.BlueRhombus + product.Name + base.BlueRhombus + NewLine() +
                               "Цена:" + product.CurrentPrice.ToString();

                    if (product.Stock != null && product.Stock.Count == 0 ||
                        product.Stock != null && product.Stock.Count > 0 && product.Stock.OrderByDescending(s => s.Id).FirstOrDefault().Balance == 0)
                    {
                        message += NewLine() + "нет в наличии";
                    }

                    message += NewLine() + "Показать: /item" + product.Id.ToString() + NewLine();
                }

                if (PreviousCategoryBtn != null && NextCategoryBtn != null)
                {
                    base.MessageReplyMarkup = base.PageNavigatorKeyboard <Product>(Pages, Bot.ProductBot.CmdProductPage, Bot.ProductBot.ModuleName, BackBtn,
                                                                                   new InlineKeyboardButton[] { PreviousCategoryBtn, NextCategoryBtn }, CategoryId);
                }

                else
                {
                    base.MessageReplyMarkup = base.PageNavigatorKeyboard <Product>(Pages, Bot.ProductBot.CmdProductPage, Bot.ProductBot.ModuleName, BackBtn,
                                                                                   null, CategoryId);
                }


                db.Dispose();
            }


            base.TextMessage = message;

            return(this);
        }
        public override BotMessage BuildMsg()
        {
            db = new MarketBotDbContext();

            FollowerList = db.Follower.ToList();

            Pages = base.BuildDataPage <Follower>(FollowerList, base.PageSize);

            SearchFollowerBtn = InlineKeyboardButton.WithSwitchInlineQueryCurrentChat("Поиск" + base.SearchEmodji, InlineFind.FindUsers + "|");

            db.Dispose();

            if (Pages != null && Pages.Count > 0 && Pages[SelectPageNumber] != null)
            {
                var page = Pages[SelectPageNumber];

                base.MessageReplyMarkup = base.PageNavigatorKeyboard <Follower>
                                              (Pages,
                                              AdminBot.ViewFollowerListCmd,
                                              AdminBot.ModuleName,
                                              base.BackToAdminPanelBtn(),
                                              new InlineKeyboardButton[] { SearchFollowerBtn });

                base.TextMessage = "Список пользователей (всего " + FollowerList.Count.ToString() + ")" + NewLine() +
                                   "Страница " + SelectPageNumber.ToString() + " из " + Pages.Count.ToString() + NewLine() +
                                   "экспорт в .xlsx " + ReportsBot.FollowerExportCommand + NewLine() + NewLine();

                int number = 1; // порядковый номер записи

                int counter = 1;

                foreach (Follower follower in page)
                {
                    number = PageSize * (SelectPageNumber - 1) + counter;

                    string firstline   = String.Empty; // имя фамилия + никнейм
                    string secondline  = String.Empty; // телефон
                    string reginfoline = String.Empty; // дата регистрации
                    string command     = Bold("Подробнее: ") + " /follower" + follower.Id.ToString() + NewLine();

                    if (follower.UserName != null && follower.UserName != "")
                    {
                        firstline = number.ToString() + ") " + base.ManEmodji2 + " " + follower.FirstName + " "
                                    + follower.LastName + " | " + HrefUrl("https://t.me/" + follower.UserName, follower.UserName) + NewLine();
                    }
                    else
                    {
                        firstline = number.ToString() + ") " + base.ManEmodji2 + " " + follower.FirstName + " "
                                    + follower.LastName + NewLine();
                    }

                    if (follower.Telephone != null && follower.Telephone != "")
                    {
                        secondline = Bold("Телефон:") + follower.Telephone + NewLine();
                    }

                    reginfoline = Bold("Дата регистрации:") + follower.DateAdd.ToString() + NewLine();


                    base.TextMessage += firstline + secondline + reginfoline + command + NewLine();

                    counter++;
                }

                return(this);
            }

            else
            {
                return(null);
            }
        }
        public BotMessage BuildCategoryAdminPage()
        {
            Pages = BuildPages(false);

            var page = Pages[SelectPageNumber];

            int count = 0;

            if (Pages.Keys.Last() != SelectPageNumber && Pages[SelectPageNumber + 1] != null) // Находим следующую страницу
            {
                NextPageBtn = BuildInlineBtn("Следующая стр.", BuildCallData(NextPageCmd, ModuleName, SelectPageNumber + 1), base.Next2Emodji);
            }

            if (Pages.Keys.Last() == SelectPageNumber && SelectPageNumber != 1 && Pages[1] != null)
            {
                // Если текущая страница является последней, то делаем кнопку с сылкой на первую,
                //но при это проверяем не является ли текущая страница первой
                NextPageBtn = BuildInlineBtn("Следующая стр.", BuildCallData(NextPageCmd, ModuleName, 1), base.Next2Emodji);
            }

            //находим предыдующую стр.
            if (SelectPageNumber > 1 && Pages[SelectPageNumber - 1] != null)
            {
                PreviusPageBtn = BuildInlineBtn("Предыдущая стр.", BuildCallData(PreviuousPageCmd, ModuleName, SelectPageNumber - 1), base.Previuos2Emodji, false);
            }

            if (SelectPageNumber == 1 && Pages.Keys.Last() != 1)
            {
                PreviusPageBtn = BuildInlineBtn("Предыдущая стр.", BuildCallData(PreviuousPageCmd, ModuleName, Pages.Keys.Last()), base.Previuos2Emodji, false);
            }


            if (NextPageBtn != null && PreviusPageBtn != null)
            {
                CategoryListBtn = new InlineKeyboardCallbackButton[page.Count + 2][];

                CategoryListBtn[page.Count] = new InlineKeyboardCallbackButton[2];

                CategoryListBtn[page.Count][0] = PreviusPageBtn;

                CategoryListBtn[page.Count][1] = NextPageBtn;
            }

            else
            {
                CategoryListBtn = new InlineKeyboardCallbackButton[page.Count + 1][];
            }

            CategoryListBtn[CategoryListBtn.Length - 1] = new InlineKeyboardCallbackButton[1];

            CategoryListBtn[CategoryListBtn.Length - 1][0] = BackBtn;


            foreach (Category cat in page)
            {
                InlineKeyboardCallbackButton button = new InlineKeyboardCallbackButton(cat.Name,
                                                                                       base.BuildCallData(Cmd, ModuleName, cat.Id));
                CategoryListBtn[count]    = new InlineKeyboardCallbackButton[1];
                CategoryListBtn[count][0] = button;

                count++;
            }

            base.MessageReplyMarkup = new InlineKeyboardMarkup(CategoryListBtn);

            base.TextMessage = "Выберите категорию:" + NewLine() + "Всего категорий: " + Categorys.Count.ToString()
                               + NewLine() + "стр. " + SelectPageNumber.ToString() + " из " + PageCount.ToString();

            return(this);
        }