protected void EntityDataSource1_Inserted(object sender, 
        EntityDataSourceChangedEventArgs e)
    {
        PhotoAlbum myPhotoAlbum = (PhotoAlbum)e.Entity;

        Response.Redirect(string.Format(
            "ManagePhotoAlbum.aspx?PhotoAlbumId={0}", myPhotoAlbum.Id.ToString()));
    }
 protected void DetailsDataSource_Inserted(object sender, System.Web.UI.WebControls.EntityDataSourceChangedEventArgs e)
 {
     if (e.Exception == null || e.ExceptionHandled)
     {
         Session["Record_Info"] = "Rekord zostaƂ dodany";
         Response.Redirect(table.GetActionPath(PageAction.Details, e.Entity));
     }
 }
 // Method that sends the user to the previous page, if the sixth item in a category is deleted
 protected void EntityDataSourceGeneral_Deleted(object sender, EntityDataSourceChangedEventArgs e)
 {
     int nrOfCurShownItms = dbListView.Items.Count() - 1;
     if (nrOfCurShownItms == 0)
     {
         DataPager dataPWithNrs = dbListView.FindControl("DataPagerNxtPrevEtc") as DataPager;
         dataPWithNrs.SetPageProperties(0, 5, true);
     }
 }
Example #4
0
 protected void EntityDataSourceTowns_Inserted(object sender, EntityDataSourceChangedEventArgs e)
 {
     if (e.Exception != null)
     {
         this.errorMessage.InnerText = "You must first select country!";
         this.errorDiv.Visible = true;
         e.ExceptionHandled = true;
         return;
     }
 }
Example #5
0
 void DetailsDataSource_Inserted(object sender, EntityDataSourceChangedEventArgs e)
 {
     if (e.Entity != null)
        {
             Response.Redirect(table.GetActionPath(PageAction.Details, e.Entity));
        }
        else
        {
             ShowError("Error: Your data could not be saved.");
        }
 }
        public void VersionDeleted(object sender, EntityDataSourceChangedEventArgs e)
        {
            using (var eds = new Data.WikipediaEntities())
            {
                Data.Version ver = e.Entity as Data.Version;
                var art = eds.Articles.Where(article => article.Id == ver.ArticleId).First();

                if (art.Versions.Count == 0)
                {
                    eds.Articles.DeleteObject(art);
                    eds.SaveChanges();
                }
            }
        }
Example #7
0
 private void CheckForOptimisticConcurrencyException(EntityDataSourceChangedEventArgs e, string function)
 {
     if (e.Exception != null && e.Exception is OptimisticConcurrencyException)
     {
         var concurrencyExceptionValidator = new CustomValidator();
         concurrencyExceptionValidator.IsValid = false;
         concurrencyExceptionValidator.ErrorMessage =
             "The record you attempted to edit or delete was modified by another " +
             "user after you got the original value. The edit or delete operation was canceled " +
             "and the other user's values have been displayed so you can " +
             "determine whether you still want to edit or delete this record.";
         Page.Validators.Add(concurrencyExceptionValidator);
         e.ExceptionHandled = true;
     }
 }
Example #8
0
        //-------------------------------------------------------------------------------------------
        void DetailsDataSource_Inserted(object sender, EntityDataSourceChangedEventArgs e)
        {
            if (!String.IsNullOrEmpty(Request["ParentId"]))
               {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "refreshParent", "<script type='text/javascript'>parent.refreshParent('" + Request["ParentId"] + "');</script>", false);
               }

               IAuditable auditData = e.Entity as IAuditable;
               string url = "Details.aspx?Id={0}&WindowId={1}&ParentId={2}&IFrame={3}";
               url = String.Format(url, auditData.Id, Request["WindowId"], Request["ParentId"], Request["IFrame"]);

               if (Request["IFrame"] == "true")
               {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "refreshParent2", "<script type='text/javascript'>document.location.href = '" + url + "';</script>", false);
               }
               else
               {
                    Response.Redirect(url);
               }
        }
Example #9
0
 protected void CoursesEntityDataSource_Updated(object sender, EntityDataSourceChangedEventArgs e)
 {
     CheckForOptimisticConcurrencyException(e, "update");
 }