Ejemplo n.º 1
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var data = new MenuDisplayNameDataModel();

            data.MenuId     = MenuId;
            data.LanguageId = Convert.ToInt32(drpLanguage.SelectedValue);
            data.Value      = txtValue.Text.Trim();
            data.IsDefault  = chkIsDefault.Checked ? 1 : 0;
            MenuDisplayNameDataManager.Create(data, SessionVariables.RequestProfile);
            bindGrid();
            formContainer.Visible = false;
        }
Ejemplo n.º 2
0
        public override int?Save(string action)
        {
            var data = new MenuDataModel();

            data.Name              = Name;
            data.Description       = Description;
            data.SortOrder         = SortOrder;
            data.MenuDisplayName   = DisplayName;
            data.NavigateURL       = NavigateURL;
            data.IsChecked         = IsChecked;
            data.IsVisible         = IsVisible;
            data.ParentMenuId      = ParentMenuId;
            data.PrimaryDeveloper  = PrimaryDeveloper;
            data.ApplicationId     = ApplicationId;
            data.ApplicationModule = ApplicationModule;

            if (action == "Insert")
            {
                var dtMenu = MenuDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtMenu.Rows.Count == 0)
                {
                    data.MenuId = MenuDataManager.Create(data, SessionVariables.RequestProfile);

                    var dataDisplayName = new MenuDisplayNameDataModel();
                    dataDisplayName.MenuId     = data.MenuId;
                    dataDisplayName.Value      = DisplayName;
                    dataDisplayName.LanguageId = ApplicationCommon.LanguageId;
                    dataDisplayName.IsDefault  = 1;

                    MenuDisplayNameDataManager.Create(dataDisplayName, SessionVariables.RequestProfile);
                }

                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                data.MenuId = MenuId;
                MenuDataManager.Update(data, SessionVariables.RequestProfile);
            }

            // not correct ... when doing insert, we didn't get/change the value of ClientID ?
            return(data.MenuId);
        }