コード例 #1
0
 public static IEnumerable <Tuple <T1, T2, T3, T4, T5, T6> > Product <T1, T2, T3, T4, T5, T6>
 (
     IEnumerable <T1> iterable0,
     IEnumerable <T2> iterable1,
     IEnumerable <T3> iterable2,
     IEnumerable <T4> iterable3,
     IEnumerable <T5> iterable4,
     IEnumerable <T6> iterable5,
     int repeat = 1
 )
 {
     return(ProductFunction.Product
            (
                iterable0,
                iterable1,
                iterable2,
                iterable3,
                iterable4,
                iterable5,
                repeat
            ));
 }
コード例 #2
0
        /// <summary>
        /// Обновить ссылку на заметку
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> UpdateProductNoteUrl()
        {
            if (WebUrl != null && WebUrl.Length > 0)
            {
                ProductFunction = new ProductFunction();

                string Url = base.ReplyToMessageText;

                int ProductId = ProductGet(ProductEditUrlReply);

                var Product = ProductFunction.UpdateUrl(ProductId, Url);

                ProductFunction.Dispose();

                return(await SendProductFunc(Product));
            }

            else
            {
                return(await ErrorMessage(ProductEditUrlReply, "Ошибка. Введите Url"));
            }
        }
コード例 #3
0
        /// <summary>
        /// Удалить доп.фото у товара
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> RemoveAdditionalPhoto()
        {
            ProductId = Argumetns[0];

            int Attachid = Argumetns[1];

            ProductFunction = new ProductFunction();

            if (ProductFunction.RemoveAdditionalPhoto(ProductId, Attachid) > 0)
            {
                await AnswerCallback("Фотография удалена", true);
            }

            else
            {
                await AnswerCallback("Фотографии не существует", true);
            }

            ProductFunction.Dispose();

            return(OkResult);
        }
コード例 #4
0
        private async Task <IActionResult> AddProduct()
        {
            string product_name = ReplyToMessageText.Trim();

            ProductFunction = new ProductFunction();

            var product = ProductFunction.GetProduct(product_name);

            var categorys = CategoryList();

            bool IsProhibited = ProductFunction.NameIsProhibited(product_name);

            if (product != null)
            {
                return(await SendTextMessageAndForceReply("Товар с таким именем уже существует", EnterProductNameForceReply));
            }

            if (IsProhibited)
            {
                return(await SendTextMessageAndForceReply("Запрещенное название!", EnterProductNameForceReply));
            }

            else
            {
                product = ProductFunction.InsertProduct(product_name, true);

                if (product != null && !IsProhibited)
                {
                    return(await SendTextMessageAndForceReply("Введите название новой категории или выберите уже существующую." + BotMessage.NewLine()
                                                              + BotMessage.Bold("Список категорий:") + categorys, EnterCategoryForceReply + product.Name));
                }

                else
                {
                    return(await SendTextMessageAndForceReply("Неизвестная ошибка", EnterProductNameForceReply));
                }
            }
        }
コード例 #5
0
        public static void RegisterAll()
        {
            BreakExpression.Register();
            ContinueExpression.Register();
            ReturnFunctionExpression.Register();
            AbsFunction.Register();
            ExecuteFile.Register();
            PowFunction.Register();
            ProductFunction.Register();
            HelpFunction.Register();
            SqrtFunction.Register();
            SumDeepFunction.Register();
            SumFunction.Register();
            LengthFunction.Register();

            ConsoleObject.Register();
            TrigonometryObject.Register();
            ThisConstant.Register();

            BooleanValue.Register();
            ComplexValue.Register();
            DecimalValue.Register();
            NullValue.Register();
        }
コード例 #6
0
        private async Task <IActionResult> UpdPhoto()
        {
            ProductFunction = new ProductFunction();

            string product_name = OriginalMessage.Substring(UploadImageForceReply.Length);

            Product = ProductFunction.GetProduct(product_name);

            int ProductId = -1;

            if (base.PhotoId != null && Product != null)
            {
                int FsId = await InsertToAttachmentFs(base.PhotoId);

                Product = ProductFunction.UpdateMainPhoto(Product.Id, FsId);
                AttachmentTelegramFunction.AddAttachmentTelegram(FsId, base.BotInfo.Id, base.PhotoId);
                ProductFunction.Dispose();
                ProductId = Product.Id;
            }

            if (Product != null) // удалось загрузить файл
            {
                ProductFuncMsg = new ProductFuncMessage(Product);
                await SendMessage(ProductFuncMsg.BuildMsg());
            }

            else
            {
                await SendMessage(new BotMessage { TextMessage = "Не удалось загрузить файл!" });

                ProductFuncMsg = new ProductFuncMessage(ProductId);
                await SendMessage(ProductFuncMsg.BuildMsg());
            }

            return(OkResult);
        }
コード例 #7
0
        /// <summary>
        /// Обновить категорию
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> UpdateProductCategory()
        {
            ProductFunction = new ProductFunction();

            int ProductId = ProductGet(ProductEditCategoryReply);

            string CatName = base.ReplyToMessageText;

            var category = CategoryFunction.GetCategory(CatName);

            if (category != null)
            {
                var product = ProductFunction.UpdateCategory(ProductId, category.Id);
                ProductFunction.Dispose();
                return(await SendProductFunc(product));
            }
            else
            {
                ProductFunction.Dispose();
                await SendMessage(new BotMessage { TextMessage = "Категория не найдена!" });

                return(await SendCategoryList());
            }
        }
コード例 #8
0
        /// <summary>
        /// Обновить остатки
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> UpdateProductStock()
        {
            int Value = 0;

            int ProductId = ProductGet(ProductEditStockReply);

            ProductFunction = new ProductFunction();

            try
            {
                Value = Convert.ToInt32(base.ReplyToMessageText);

                var product = ProductFunction.UpdateStock(ProductId, Value, "Значение изменено через панель администратора");

                ProductFunction.Dispose();

                return(await SendProductFunc(product));
            }

            catch
            {
                return(await ErrorMessage(ProductEditStockReply, "Неверный формат данных!"));
            }
        }
コード例 #9
0
        /// <summary>
        /// Обновить описание
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> UpdateProductText()
        {
            if (base.ReplyToMessageText.Length <= 100)
            {
                ProductFunction = new ProductFunction();

                string Text = base.ReplyToMessageText;

                int ProductId = ProductGet(ProductEditNameRelpy);

                var Product = ProductFunction.UpdateText(ProductId, Text);

                ProductFunction.Dispose();

                return(await SendProductFunc(Product));
            }

            else
            {
                await SendMessage(new BotMessage { TextMessage = "Ошибка! Максимум 100 символов" });

                return(OkResult);
            }
        }
コード例 #10
0
 public IActionResult Photos(int id)
 {
     ViewBag.ProductId = id;
     return(View(ProductFunction.GetAdditionalPhoto(id)));
 }
コード例 #11
0
        public IActionResult Index()
        {
            var products = ProductFunction.GetAllProductList();

            return(View(products));
        }
コード例 #12
0
 public string GetDictEx(string[] list,int functioncount, ProductFunction func,string kind)
 {
     string html = string.Empty;
     html += "<input type=\"checkbox\" name=\"function";
     html += functioncount;
     html += "\"";
     if (list.Contains(func.FunctionID.ToString()))
         html += " checked=\"checked\"";
     html += "class=\"function " + kind + "\" id=\"checkbox-" + globali + "\" value=\"";
     html += func.FunctionID;
     html += "\" />";
     html += func.FunctionName;
     html += "<br />";
     return html;
 }
コード例 #13
0
 public string GetDict(int functioncount, ProductFunction func, string kind)
 {
     globali++;
     string html = string.Empty;
     html += "<input type=\"checkbox\" name=\"function";
     html += functioncount;
     html += "\"";
     html += "class=\"function " + kind + "\" id=\"checkbox-" + globali + "\" value=\"";
     html += func.FunctionID;
     html += "\" />";
     html += func.FunctionName;
     html += "<br />";
     return html;
 }