예제 #1
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            lngFeatureListItems.UpdateLangs();
            switch (EditState)
            {
            case "new":
                FeatureListItemInfo fliNew = new FeatureListItemInfo();
                fliNew.FeatureListId = FeatureListId;
                fliNew.Image         = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                fliNew.ViewOrder     = Convert.ToInt32(txtViewOrder.Text);
                int featureListItemId = Controller.NewFeatureListItem(fliNew);
                foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs)
                {
                    featureListItemLang.FeatureListItemId = featureListItemId;
                    Controller.NewFeatureListItemLang(featureListItemLang);
                }
                FeatureListItemId = featureListItemId;
                EditState         = "update";
                break;

            case "update":
                FeatureListItemInfo fliUpdate = Controller.GetFeatureListItemById(FeatureListItemId);
                fliUpdate.Image     = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                fliUpdate.ViewOrder = Convert.ToInt32(txtViewOrder.Text);
                Controller.UpdateFeatureListItem(fliUpdate);

                Controller.DeleteFeatureListItemLangs(FeatureListItemId);
                foreach (FeatureListItemLangInfo featureListItemLang in lngFeatureListItems.Langs)
                {
                    featureListItemLang.FeatureListItemId = FeatureListItemId;
                    Controller.NewFeatureListItemLang(featureListItemLang);
                }
                break;

            default:
                break;
            }
            if (Request.QueryString["adminmode"] != null)
            {
                Response.Redirect(Globals.NavigateURL(TabId, "", "adminmode=featurelistitem", "featurelist=" + FeatureListId.ToString()), true);
            }
            else
            {
                Response.Redirect(EditUrl(), true);
            }
        }