Exemple #1
0
    // Save the new or updated Input form
    private void ApplyChanges()
    {
        ifObj = HyperCatalog.Business.InputForm.GetByKey(ifId);
        ifObj.PLs.Clear();
        Trace.Warn("Calling PLTree.GetCheckedPLs()");
        PLList checkedPLs = PLTree.GetCheckedPLs();

        foreach (PL pl in checkedPLs)
        {
            ifObj.PLs.Add(pl);
        }
        if (!ifObj.Save(true))
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = HyperCatalog.Business.InputForm.LastError;
            lbError.Visible  = true;
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "RefreshTabs", "<script>RefreshTabs('PLs', " + ifObj.PLs.Count.ToString() + ", 'Usage', " + ifObj.Items.Count.ToString() + ");</script>");
            lbError.Text     = "Data saved!";
            lbError.CssClass = "hc_success";
            lbError.Visible  = true;
        }
    }
Exemple #2
0
 // Save the new or updated Input form
 private void Save()
 {
     ifObj = HyperCatalog.Business.InputForm.GetByKey(ifId);
     if (ifObj == null)
     {
         ifObj = new HyperCatalog.Business.InputForm(-1, string.Empty, string.Empty, string.Empty, SessionState.User.Id,
                                                     null, SessionState.User.Id,
                                                     null, ' ', false);
     }
     ifObj.Name              = txtInputFormName.Text;
     ifObj.ShortName         = txtInputFormShortName.Text;
     ifObj.Description       = txtDescription.Text;
     ifObj.InputFormTypeCode = Convert.ToChar(ddlInputFormType.SelectedValue);
     // If the current item is not null and the inputform active status is changed, force current item to reload input forms
     if (ifObj.IsActive != cbIsActive.Checked && SessionState.CurrentItem != null)
     {
         SessionState.CurrentItem.InputForms.Clear();
         SessionState.CurrentItem.InputForms = null;
     }
     ifObj.IsActive = cbIsActive.Checked;
     if (!ifObj.Save())
     {
         SessionState.ClearAppInputForms();
         lbError.CssClass = "hc_error";
         lbError.Text     = HyperCatalog.Business.InputForm.LastError;
         lbError.Visible  = true;
     }
     else
     {
         if (!panelId.Visible)
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>Redirect(" + ifObj.Id + ");</script>");
         }
         else
         {
             lbError.Text     = "Data saved!";
             lbError.CssClass = "hc_success";
             lbError.Visible  = true;
         }
     }
 }