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 SaveAction()
        {
            if (!IsValidData())
            {
                return;
            }

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

            try
            {
                _action = BuyInTimeService.Get(Id);

                _action.ProductId      = productId;
                _action.DiscountInTime = txtDiscount.Text.TryParseFloat();
                _action.DateStart      = txtDateStart.Text.TryParseDateTime();
                _action.DateExpired    = txtDateExpired.Text.TryParseDateTime();
                _action.ShowMode       = ddlShowMode.SelectedValue.TryParseInt();
                _action.ActionText     = ckeActionText.Text;
                _action.IsRepeat       = chkIsRepeat.Checked;
                _action.DaysRepeat     = txtDaysRepeat.Text.TryParseInt(1);
                _action.SortOrder      = txtSortOrder.Text.TryParseInt(0);

                BuyInTimeService.Update(_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;
            }
        }