Пример #1
0
 public static void Save(FAQCategory faqCat)
 {
     using (var ctx = new BMIKidsEntities(ConnectionString))
     {
         try
         {
             ctx.FAQCategories.ApplyChanges(faqCat);
             ctx.SaveChanges();
         }
         catch (Exception ex)
         {
             LogUtility.WriteEntryEventLog("faqCat_DataProvider_DataProvider", ex, EventLogEntryType.Information);
             if (ex.InnerException != null)
                 throw ex.InnerException;
             throw;
         }
     }
 }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            FAQCategory cpCat = null;
            if (UtilityMethod.GetRequestParameter("pcid").IsInt32())
            {
                int? cpcatId = UtilityMethod.GetRequestParameter("pcid").ToInt32();
                cpCat = FAQ_DataProvider.GetFAQCategory(cpcatId).FirstOrDefault();
            }

            if (cpCat == null)
                cpCat = new FAQCategory();

            cpCat.Title = faCatName.Text;
            cpCat.SortOrderId = Convert.ToInt32(SortOrder.SelectedValue);

            string action = UtilityMethod.GetRequestParameter("act");
            if (action.ToLower() == "edit")
            {
                cpCat.MarkAsModified();
                FAQ_DataProvider.Save(cpCat);
                Page.Response.Redirect("PCategoryList.aspx");

            }
            else if (action.ToLower() == "del")
            {
                cpCat.MarkAsDeleted();
                FAQ_DataProvider.Save(cpCat);
                Page.Response.Redirect("PCategoryList.aspx");

            }
            else if (action.ToLower() == "new")
            {
                FAQ_DataProvider.Save(cpCat);
                Page.Response.Redirect("PCategoryList.aspx");
            }


        }
Пример #3
0
     private void FixupFAQCategory(FAQCategory previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.FAQs.Contains(this))
         {
             previousValue.FAQs.Remove(this);
         }
 
         if (FAQCategory != null)
         {
             if (!FAQCategory.FAQs.Contains(this))
             {
                 FAQCategory.FAQs.Add(this);
             }
 
             CategoryId = FAQCategory.CategoryId;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("FAQCategory")
                 && (ChangeTracker.OriginalValues["FAQCategory"] == FAQCategory))
             {
                 ChangeTracker.OriginalValues.Remove("FAQCategory");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("FAQCategory", previousValue);
             }
             if (FAQCategory != null && !FAQCategory.ChangeTracker.ChangeTrackingEnabled)
             {
                 FAQCategory.StartTracking();
             }
         }
     }