protected void btnNewPlan_Click(object sender, EventArgs e) { ClearControl(pnlDetails); txtWishDescription.Text = ""; PageState = Action.Add; CurrentWish = new Wish(); pnlResult.Visible = false; pnlDetails.Visible = true; }
protected void dgPlans_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { PageState = Action.Update; CurrentWish = Wish_DataProvider.GetWish(dgPlans.DataKeys[e.NewSelectedIndex].Value.ToInt32()).FirstOrDefault(); ClearControl(pnlDetails); txtWishAmount.Text = CurrentWish.WishAmount.ToString(); txtWishDescription.Text = CurrentWish.WishDescription; txtWishName.Text = CurrentWish.WishName; SmallPicDeleteLnk.Visible = !string.IsNullOrEmpty(CurrentWish.WiShPicSmall); LargePicDeleteLnk.Visible = !string.IsNullOrEmpty(CurrentWish.WishPic); pnlDetails.Visible = true; }
public static void SaveWish(Wish Wish) { using (var ctx = new BMIKidsEntities(ConnectionString)) { try { ctx.Wishes.ApplyChanges(Wish); ctx.SaveChanges(); } catch (Exception ex) { LogUtility.WriteEntryEventLog("Wish_DataProvider", ex, EventLogEntryType.Information); if (ex.InnerException != null) throw ex.InnerException; throw; } } }
private void FixupWish(Wish previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.Kids_Wishes.Contains(this)) { previousValue.Kids_Wishes.Remove(this); } if (Wish != null) { if (!Wish.Kids_Wishes.Contains(this)) { Wish.Kids_Wishes.Add(this); } WishId = Wish.WishId; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("Wish") && (ChangeTracker.OriginalValues["Wish"] == Wish)) { ChangeTracker.OriginalValues.Remove("Wish"); } else { ChangeTracker.RecordOriginalValue("Wish", previousValue); } if (Wish != null && !Wish.ChangeTracker.ChangeTrackingEnabled) { Wish.StartTracking(); } } }