private void LoadAction()
        {
            _action = BuyInTimeService.Get(Id);

            if (_action != null)
            {
                var product = ProductService.GetProduct(_action.ProductId);

                txtProductArtNo.Text      = product.ArtNo;
                txtDiscount.Text          = _action.DiscountInTime.ToString();
                txtDateStart.Text         = _action.DateStart.ToString();
                txtDateExpired.Text       = _action.DateExpired.ToString();
                ddlShowMode.SelectedValue = _action.ShowMode.ToString();
                ckeActionText.Text        = _action.ActionText;
                chkIsRepeat.Checked       = _action.IsRepeat;
                txtDaysRepeat.Text        = _action.DaysRepeat.ToString();
                txtSortOrder.Text         = _action.SortOrder.ToString();

                if (_action.Picture.IsNotEmpty())
                {
                    pnlPicture.Visible = true;
                    fuPucture.Visible  = false;
                    liPicture.Text     = string.Format("<img src='pictures/{0}'/>", _action.Picture);
                }
                else
                {
                    pnlPicture.Visible = false;
                    fuPucture.Visible  = true;
                }
            }
        }
        private void CreateAction()
        {
            if (!IsValidData())
            {
                return;
            }

            var productId = ProductService.GetProductId(txtProductArtNo.Text);

            try
            {
                var action = new BuyInTimeProductModel()
                {
                    ProductId      = productId,
                    DiscountInTime = txtDiscount.Text.TryParseFloat(),
                    DateStart      = txtDateStart.Text.TryParseDateTime(),
                    DateExpired    = txtDateExpired.Text.TryParseDateTime(),
                    ShowMode       = ddlShowMode.SelectedValue.TryParseInt(),
                    ActionText     = ckeActionText.Text,
                    IsRepeat       = chkIsRepeat.Checked,
                    DaysRepeat     = txtDaysRepeat.Text.TryParseInt(1),
                    SortOrder      = txtSortOrder.Text.TryParseInt(0)
                };

                BuyInTimeService.Add(action);

                txtProductArtNo.Text = txtDiscount.Text = txtDateExpired.Text = txtDateStart.Text = string.Empty;

                if (fuPucture.HasFile)
                {
                    if (!FileHelpers.CheckFileExtension(fuPucture.FileName, FileHelpers.eAdvantShopFileTypes.Image))
                    {
                        MsgErr("Неправильный формат");
                        return;
                    }

                    var fileName = action.Id + Path.GetExtension(fuPucture.FileName);

                    if (!Directory.Exists(BuyInTimeService.PicturePath))
                    {
                        Directory.CreateDirectory(BuyInTimeService.PicturePath);
                    }

                    fuPucture.SaveAs(BuyInTimeService.PicturePath + fileName);
                    BuyInTimeService.UpdatePicture(action.Id, fileName);
                }
            }
            catch (Exception ex)
            {
                MsgErr("cant add" + ex);
            }

            txtProductArtNo.Text = string.Empty;
        }
        protected void DeletePicture_Click(object sender, EventArgs e)
        {
            if (_action == null)
            {
                _action = BuyInTimeService.Get(Id);
            }

            var filepath = BuyInTimeService.PicturePath + _action.Picture;

            if (File.Exists(filepath))
            {
                File.Delete(filepath);
                BuyInTimeService.UpdatePicture(_action.Id, null);

                pnlPicture.Visible = false;
                fuPucture.Visible  = true;
            }
        }