예제 #1
0
    // Save the new or updated Input form
    private void Save()
    {
        LookupGroup lookupObj = LookupGroup.GetByKey(lookupGroupId);

        if (lookupObj == null)
        {
            lookupObj = new LookupGroup(lookupGroupId, txtGroupName.Text.Trim(), txtComment.Text.Trim(), (bool)cbMultiChoice.Checked);
        }
        else
        {
            lookupObj.Name        = txtGroupName.Text;
            lookupObj.Comment     = txtComment.Text;
            lookupObj.MultiChoice = cbMultiChoice.Checked;
        }

        if (!lookupObj.Save(SessionState.User.Id))
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = LookupGroup.LastError;
            lbError.Visible  = true;
        }
        else
        {
            lbError.Text     = "Data saved!";
            lbError.CssClass = "hc_success";
            lbError.Visible  = true;
            SessionState.ClearAppLookupGroups();
            if (lookupGroupId < 0)
            {
                lookupGroupId = lookupObj.Id;
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadTab", "<script>DisplayTab(" + lookupObj.Id + ");</script>");            // display new tab
            }
        }
    }
예제 #2
0
 // Delete current Input form
 private void Delete()
 {
     if (panelId.Visible)
     {
         LookupGroup lookupObj = LookupGroup.GetByKey(lookupGroupId);
         if (!lookupObj.Delete(HyperCatalog.Shared.SessionState.User.Id))
         {
             lbError.CssClass = "hc_error";
             lbError.Text     = LookupGroup.LastError;
             lbError.Visible  = true;
         }
         else
         {
             SessionState.ClearAppLookupGroups();
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
         }
     }
 }