protected void ugTransformations_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "edit")
        {
            string isManager = IsSiteManager ? "&sitemanager=true" : String.Empty;

            URLHelper.Redirect(String.Format(
                                   "HierarchicalTransformations_Transformations_Edit.aspx?guid={0}&objectid={1}&templatetype={2}&editonlycode={3}&tabmode={4}&instanceguid={5}&aliaspath={6}{7}",
                                   actionArgument,
                                   TransInfo.TransformationID,
                                   TemplateType,
                                   mDialogMode,
                                   QueryHelper.GetInteger("tabmode", 0),
                                   QueryHelper.GetGuid("instanceguid", Guid.Empty),
                                   QueryHelper.GetString("aliaspath", ""), isManager)
                               );
        }
        if (actionName == "delete")
        {
            HierarchicalTransformations transf = LoadTransformation();
            transf.DeleteTransformation(new Guid(Convert.ToString(actionArgument)));
            TransInfo.TransformationHierarchicalXML = transf.GetXML();
            TransformationInfoProvider.SetTransformation(TransInfo);

            //Reloads data
            ugTransformations.ReloadData();
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //Validate data
        string errorMessage = new Validator().NotEmpty(ucTransformations.Value, GetString("transformationedit.erroremptytransformation")).Result;

        if ((errorMessage == "") && (txtLevel.Text.Trim() != String.Empty) && (!ValidationHelper.IsInteger(txtLevel.Text)))
        {
            errorMessage = GetString("development.invalidtransformationlevel");
        }

        if (String.IsNullOrEmpty(txtLevel.Text))
        {
            txtLevel.Text = "-1";
        }

        int level = ValidationHelper.GetInteger(txtLevel.Text, -1);

        if (level < -1)
        {
            errorMessage = GetString("development.invalidtransformationlevel");
        }

        if (errorMessage != String.Empty)
        {
            lblError.Text    = errorMessage;
            lblError.Visible = true;
            return;
        }

        //Fill the info
        if (mHierInfo == null)
        {
            mHierInfo        = new HierarchicalTransformationInfo();
            mHierInfo.ItemID = Guid.NewGuid();
        }


        mHierInfo.ItemLevel          = ValidationHelper.GetInteger(txtLevel.Text, 0);
        mHierInfo.TransformationName = ucTransformations.Value.ToString();
        mHierInfo.Value    = ucClassSelector.Value.ToString();
        mHierInfo.ItemType = HierarchicalTransformations.StringToUniViewItemType(drpTemplateType.SelectedValue);

        if ((mTransformations != null) && (TransInfo != null))
        {
            mTransformations.SetTransformation(mHierInfo);
            TransInfo.TransformationHierarchicalXML = mTransformations.GetXML();
            TransformationInfoProvider.SetTransformation(TransInfo);
            HierarchicalID = mHierInfo.ItemID;

            RaiseOnSaved();
        }

        lblInfo.Visible  = true;
        lblError.Visible = false;
    }
예제 #3
0
    protected void ugTransformations_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "edit")
        {
            string isManager = IsSiteManager ? "&sitemanager=true" : String.Empty;
            URLHelper.Redirect("HierarchicalTransformations_Transformations_Edit.aspx?guid=" + actionArgument + "&transid=" + TransInfo.TransformationID + "&templatetype=" + TemplateType + "&editonlycode=" + mDialogMode + "&tabmode=" + QueryHelper.GetInteger("tabmode", 0) + isManager);
        }
        if (actionName == "delete")
        {
            HierarchicalTransformations transf = LoadTransformation();
            transf.DeleteTransformation(new Guid(Convert.ToString(actionArgument)));
            TransInfo.TransformationHierarchicalXML = transf.GetXML();
            TransformationInfoProvider.SetTransformation(TransInfo);

            //Reloads data
            ugTransformations.ReloadData();
        }
    }