示例#1
0
        private void SaveWrapStyle()
        {
            WrapStyle style = WrapStyleDataSource.Load(WrapStyleId);

            style.Name         = Name.Text;
            style.ThumbnailUrl = ThumbnailUrl.Text;
            style.ImageUrl     = ImageUrl.Text;
            style.Price        = AlwaysConvert.ToDecimal(Price.Text);
            style.TaxCodeId    = AlwaysConvert.ToInt(TaxCode.SelectedValue);
            style.Save();
        }
        protected void WrapStylesGrid_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int       wrapStyleId = (int)WrapStylesGrid.DataKeys[e.NewEditIndex].Value;
            WrapStyle style       = WrapStyleDataSource.Load(wrapStyleId);

            if (style != null)
            {
                AddPanel.Visible  = false;
                EditPanel.Visible = true;
                EditCaption.Text  = string.Format(EditCaption.Text, style.Name);
                EditWrapStyleDialog editDialog = EditPanel.FindControl("EditWrapStyleDialog1") as EditWrapStyleDialog;
                if (editDialog != null)
                {
                    editDialog.WrapStyleId = wrapStyleId;
                }
            }
        }
示例#3
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            WrapStyle style = WrapStyleDataSource.Load(WrapStyleId);

            if (style != null)
            {
                Name.Text             = style.Name;
                ThumbnailUrl.Text     = style.ThumbnailUrl;
                ImageUrl.Text         = style.ImageUrl;
                Price.Text            = string.Format("{0:F2}", style.Price);
                TaxCode.SelectedIndex = -1;
                ListItem item = TaxCode.Items.FindByValue(style.TaxCodeId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }
            }
        }
示例#4
0
        private void DoneEditing()
        {
            UpdatePanel stylesAjax = AbleCommerce.Code.PageHelper.RecursiveFindControl(this.Page, "WrapStylesAjax") as UpdatePanel;

            if (stylesAjax != null)
            {
                GridView stylesGrid = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "WrapStylesGrid") as GridView;
                if (stylesGrid != null)
                {
                    stylesGrid.EditIndex = -1;
                    stylesGrid.DataBind();
                }
                Panel addPanel = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "AddPanel") as Panel;
                if (addPanel != null)
                {
                    addPanel.Visible = true;
                }
                Panel editPanel = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "EditPanel") as Panel;
                if (editPanel != null)
                {
                    editPanel.Visible = false;
                }
                Notification savedMessage = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "SavedWrapStyleMessage") as Notification;
                if (savedMessage != null)
                {
                    savedMessage.Visible = false;
                    string    name  = string.Empty;
                    WrapStyle style = WrapStyleDataSource.Load(WrapStyleId);
                    if (style != null)
                    {
                        name = style.Name;
                    }
                    savedMessage.Text = string.Format(savedMessage.Text, name);
                }
            }
        }