Exemplo n.º 1
0
        public void btnAddMenuItem_Click(Object sender, EventArgs e)
        {
            var    newMenuNode = new ETEMModel.Models.MenuNode();
            var    newUrl      = new ETEMModel.Models.NavURL();
            Button btnSender   = sender as Button;

            if (btnSender != null && btnSender.Text == BaseHelper.GetCaptionString("Add_Btn"))
            {
                int selectedMainMenuItemValue = int.Parse(this.ddlMainMenuItems.SelectedValue.ToString());

                if (selectedMainMenuItemValue != Constants.INVALID_ID_ZERO)
                {
                    int selectedSubMenuItemValue = int.Parse(this.ddlSubMenuItems.SelectedValue.ToString());
                    if (selectedSubMenuItemValue != Constants.INVALID_ID_ZERO)
                    {
                        newMenuNode.parentNode = selectedSubMenuItemValue;
                        newMenuNode.name       = this.tbxNewMenuItemName.Text;
                        newMenuNode.type       = "link";
                    }
                    else
                    {
                        newMenuNode.parentNode = selectedMainMenuItemValue;
                        newMenuNode.name       = this.tbxNewMenuItemName.Text;
                        newMenuNode.type       = "parent";
                    }
                }
                else
                {
                    newMenuNode.parentNode = Constants.INVALID_ID_ZERO;
                    newMenuNode.name       = this.tbxNewMenuItemName.Text;
                    newMenuNode.type       = "root";
                }
            }
            else if (btnSender != null)
            {
                var edittingIndexValue = this.hdnEditingIndexValue.Value;
                newMenuNode            = new ETEMModel.Models.MenuNode();
                newMenuNode.idNode     = int.Parse(edittingIndexValue);
                newMenuNode.name       = this.tbxNewMenuItemName.Text;
                newMenuNode.parentNode = int.Parse(this.ddlCurrentNodePlace.SelectedValue);
                newMenuNode.type       = this.hdnEditingNodeType.Value;
                newUrl.idNavURL        = int.Parse(this.hdnEditingNodeUrlIndex.Value);
            }

            newUrl.URL         = this.txvNavUrl.Text;
            newUrl.code        = "1";
            newUrl.QueryParams = this.tbxQueryParams.Text.Trim();

            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;
            this.ownerPage.CallContext = this.ownerPage.AdminClientRef.MenuNodeSave(newUrl, newMenuNode, this.ownerPage.CallContext);
            CheckIfResultIsSuccess();
            AddResultMessage(this.ownerPage.CallContext);
            this.ownerPage.ReloadMenuNodeDataViewApplication();
        }
Exemplo n.º 2
0
        public void btnAddMenuItem_Click(Object sender, EventArgs e)
        {
            var newMenuNode = new ETEMModel.Models.MenuNode();
            var newUrl = new ETEMModel.Models.NavURL();
            Button btnSender = sender as Button;
            if (btnSender != null && btnSender.Text == BaseHelper.GetCaptionString("Add_Btn"))
            {

                int selectedMainMenuItemValue = int.Parse(this.ddlMainMenuItems.SelectedValue.ToString());

                if (selectedMainMenuItemValue != Constants.INVALID_ID_ZERO)
                {
                    int selectedSubMenuItemValue = int.Parse(this.ddlSubMenuItems.SelectedValue.ToString());
                    if (selectedSubMenuItemValue != Constants.INVALID_ID_ZERO)
                    {
                        newMenuNode.parentNode = selectedSubMenuItemValue;
                        newMenuNode.name = this.tbxNewMenuItemName.Text;
                        newMenuNode.type = "link";
                    }
                    else
                    {
                        newMenuNode.parentNode = selectedMainMenuItemValue;
                        newMenuNode.name = this.tbxNewMenuItemName.Text;
                        newMenuNode.type = "parent";
                    }
                }
                else
                {
                    newMenuNode.parentNode = Constants.INVALID_ID_ZERO;
                    newMenuNode.name = this.tbxNewMenuItemName.Text;
                    newMenuNode.type = "root";


                }


            }
            else if (btnSender != null)
            {
                var edittingIndexValue = this.hdnEditingIndexValue.Value;
                newMenuNode = new ETEMModel.Models.MenuNode();
                newMenuNode.idNode = int.Parse(edittingIndexValue);
                newMenuNode.name = this.tbxNewMenuItemName.Text;
                newMenuNode.parentNode = int.Parse(this.ddlCurrentNodePlace.SelectedValue);
                newMenuNode.type = this.hdnEditingNodeType.Value;
                newUrl.idNavURL = int.Parse(this.hdnEditingNodeUrlIndex.Value);

            }

            newUrl.URL = this.txvNavUrl.Text;
            newUrl.code = "1";
            newUrl.QueryParams = this.tbxQueryParams.Text.Trim();

            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;
            this.ownerPage.CallContext = this.ownerPage.AdminClientRef.MenuNodeSave(newUrl, newMenuNode, this.ownerPage.CallContext);
            CheckIfResultIsSuccess();
            AddResultMessage(this.ownerPage.CallContext);
            this.ownerPage.ReloadMenuNodeDataViewApplication();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new MenuNode object.
 /// </summary>
 /// <param name="idNode">Initial value of the idNode property.</param>
 /// <param name="name">Initial value of the name property.</param>
 public static MenuNode CreateMenuNode(global::System.Int32 idNode, global::System.String name)
 {
     MenuNode menuNode = new MenuNode();
     menuNode.idNode = idNode;
     menuNode.name = name;
     return menuNode;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the MenuNodes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMenuNodes(MenuNode menuNode)
 {
     base.AddObject("MenuNodes", menuNode);
 }