Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long id;

            if (long.TryParse(Request["id"], out id))
            {
                selectedItem = MasterPagesMapper.GetByID(id);

                if (!IsPostBack)
                {
                    UpdateFieldsFromObject();
                }
            }

            this.Page.Title = this.SectionTitle.Text = GetSectionTitle();
        }
Exemple #2
0
        protected void Save_OnClick(object sender, EventArgs e)
        {
            if (selectedItem == null)
            {
                selectedItem = MasterPagesMapper.CreateObject();
            }
            else
            {
                selectedItem = BaseMapper.GetObjectFromContext <MasterPage>(selectedItem);
            }

            UpdateObjectFromFields();

            Return returnObj = selectedItem.Validate();

            if (!returnObj.IsError)
            {
                if (selectedItem.ID == 0)
                {
                    returnObj = MasterPagesMapper.Insert(selectedItem);
                }
                else
                {
                    returnObj = MasterPagesMapper.Update(selectedItem);
                }
            }

            if (returnObj.IsError)
            {
                DisplayErrorMessage("Error Saving Item", returnObj.Error);
            }
            else
            {
                SettingsMapper.ClearCache();
                DisplaySuccessMessage("Successfully Saved Item");
            }
        }
 public static Return DeletePermanently(MasterPage obj)
 {
     return(Delete(MapperKey, obj));
 }
 public static Return Update(MasterPage obj)
 {
     obj.DateLastModified = DateTime.Now;
     return(Update(MapperKey, obj));
 }