//----------------------------------------------- //SaveData //----------------------------------------------- protected override object SaveData() { AdvPlacesEntity advPlace = (AdvPlacesEntity)LoadObject(); if (advPlace != null) { SPOperation operation; if (pageType == PagesTypes.AdminAdd) { operation = SPOperation.Insert; } else { operation = SPOperation.Update; } status = AdvPlacesFactory.Save(advPlace, operation); } return(advPlace); }
//----------------------------------------------- //LoadObject //----------------------------------------------- protected override object LoadObject() { AdvPlacesEntity advPlaces = new AdvPlacesEntity(); advPlaces.PlaceID = Convert.ToInt32(txtPlaceID.Text); advPlaces.PlaceIdentifier = txtPlaceIdentifier.Text.Trim(); advPlaces.Title = txtTitle.Text; advPlaces.Width = Convert.ToInt32(txtWidth.Text); advPlaces.Height = Convert.ToInt32(txtHeight.Text); if (!string.IsNullOrEmpty(txtDefaultFilePath.Text)) { advPlaces.DefaultFilePath = txtDefaultFilePath.Text; if (txtDefaultFilePath.Text.ToLower().Contains("swf")) { advPlaces.DefaultFileType = AdsTypes.Flash; } else { advPlaces.DefaultFileType = AdsTypes.Photo; } } if (SiteSettings.Adv_HasIsRandom) { advPlaces.IsRandom = cbIsRandom.Checked; } //----------------------------------------------------------------- if (SiteSettings.Adv_EnableSeparatedAd) { advPlaces.EnableSeparatedAd = cbEnableSeparatedAd.Checked; advPlaces.EnableSeparatedCount = Convert.ToInt32(txtEnableSeparatedCount.Text); } //----------------------------------------------------------------- advPlaces.PlaceType = (AdvPlaceTypes)Convert.ToInt32(ddlPlaceType.SelectedValue); //----------------------------------------------------------------- return(advPlaces); }
//----------------------------------------------- //LoadControls //----------------------------------------------- protected override bool LoadControls() { int placeID = Convert.ToInt32(Request.QueryString["id"]); AdvPlacesEntity advPlaces = AdvPlacesFactory.GetObject(placeID); if (advPlaces != null) { txtPlaceID.Text = advPlaces.PlaceID.ToString(); txtPlaceIdentifier.Text = advPlaces.PlaceIdentifier; txtTitle.Text = advPlaces.Title; txtWidth.Text = advPlaces.Width.ToString(); txtHeight.Text = advPlaces.Height.ToString(); txtDefaultFilePath.Text = advPlaces.DefaultFilePath; // txtDefaultFileType.Text = advPlaces.DefaultFileType.ToString(); //----------------------------------------------------------------- if (SiteSettings.Adv_HasIsRandom) { cbIsRandom.Checked = advPlaces.IsRandom; } //----------------------------------------------------------------- if (SiteSettings.Adv_EnableSeparatedAd) { cbEnableSeparatedAd.Checked = advPlaces.EnableSeparatedAd; txtEnableSeparatedCount.Text = advPlaces.EnableSeparatedCount.ToString(); } //----------------------------------------------------------------- ddlPlaceType.SelectedValue = ((int)advPlaces.PlaceType).ToString(); //----------------------------------------------------------------- return(true); } else { return(false); } }