Beispiel #1
0
        protected void SaveRecord(bool newRecord)
        {
            // new record / exiting record //

            object oldEntity = null;

            if (newRecord)
            {
                Entity = new CRM_Fund();
                db.CRM_Funds.InsertOnSubmit(Entity);
                Entity.OrderNo = Code.Utils.Ordering.Ordering.GetNextOrderID(db.CRM_Funds);
            }

            Entity.Name             = txtName.Text;
            Entity.ThankyouTemplate = txtTemplate.Text;
            Entity.IsActive         = chkIsActive.Checked;

            db.SubmitChanges();



            if (oldEntity != null)
            {
                CRM.Code.History.History.RecordLinqUpdate(AdminUser, oldEntity, Entity);
                db.SubmitChanges();
            }
            else
            {
                CRM.Code.History.History.RecordLinqInsert(AdminUser, Entity);
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RunSecurity(CRM.Code.Models.Admin.AllowedSections.NotSet);
            Entity = db.CRM_Funds.SingleOrDefault(c => c.ID.ToString() == Request.QueryString["id"]);

            btnSubmitChanges.Visible = PermissionManager.CanUpdate;
            if (!PermissionManager.CanAdd && Entity == null)
            {
                Response.Redirect("list.aspx");
            }

            ucLogHistory.IHistory = Entity;
            ucLogNotes.INotes     = Entity;
            CRMContext            = Entity;
            // buttons //

            btnSubmit.EventHandler        = btnSubmit_Click;
            btnSubmitChanges.EventHandler = btnSubmitChanges_Click;
            btnDelete.EventHandler        = btnDelete_Click;

            // Security //

            btnSubmitChanges.Visible = PermissionManager.CanUpdate;
            btnDelete.Visible        = PermissionManager.CanDelete;
            if (!PermissionManager.CanAdd && Entity == null)
            {
                Response.Redirect("list.aspx");
            }

            // confirmations //

            confirmationDelete.StandardDeleteHidden("fund", btnRealDelete_Click);

            // process //

            if (!IsPostBack)
            {
                if (Entity != null)
                {
                    PopulateFields();
                }
            }
        }