Exemple #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                ListViewProfile profile;
                if (!String.IsNullOrEmpty(_uid))
                {
                    profile = ListViewProfile.Load(_className, _uid, _placeName);
                }
                else
                {
                    profile = new ListViewProfile();
                }
                //fields
                List <string> fields             = new List <string>();
                ColumnPropertiesCollection coll  = new ColumnPropertiesCollection();
                List <ListItem>            items = ListSelector.GetSelectedItems();
                foreach (ListItem item in items)
                {
                    fields.Add(item.Value);
                    coll.Add(new ColumnProperties(item.Value, "150", String.Empty));
                }
                profile.FieldSet  = fields;
                profile.ColumnsUI = coll;

                string uid = (!String.IsNullOrEmpty(_uid)) ? _uid : Guid.NewGuid().ToString();
                profile.Id = uid;

                profile.Name     = txtTitle.Text;
                profile.ReadOnly = false;

                int currentUserId = Mediachase.Ibn.Data.Services.Security.CurrentUserId;

                if (_isSystem)
                {
                    profile.IsSystem = true;
                    profile.IsPublic = true;
                    ListViewProfile.SaveSystemProfile(_className, _placeName, currentUserId, profile);
                }
                else
                {
                    profile.IsSystem = false;
                    profile.IsPublic = cbIsPublic.Checked;
                    ListViewProfile.SaveCustomProfile(_className, _placeName, currentUserId, profile);
                }
                SaveFilters(uid);

                CommandParameters cp = new CommandParameters(_commandName);
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("ViewUid", uid);
                cp.AddCommandArgument("ClassName", _className);
                cp.AddCommandArgument("PlaceName", _placeName);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                ListViewProfile profile;
                if (!String.IsNullOrEmpty(_uid))
                    profile = ListViewProfile.Load(_className, _uid, _placeName);
                else
                    profile = new ListViewProfile();
                //fields
                List<string> fields = new List<string>();
                ColumnPropertiesCollection coll = new ColumnPropertiesCollection();
                List<ListItem> items = ListSelector.GetSelectedItems();
                foreach (ListItem item in items)
                {
                    fields.Add(item.Value);
                    coll.Add(new ColumnProperties(item.Value, "150", String.Empty));
                }
                profile.FieldSet = fields;
                profile.ColumnsUI = coll;

                string uid = (!String.IsNullOrEmpty(_uid)) ? _uid : Guid.NewGuid().ToString();
                profile.Id = uid;

                profile.Name = txtTitle.Text;
                profile.ReadOnly = false;

                int currentUserId = Mediachase.Ibn.Data.Services.Security.CurrentUserId;

                if (_isSystem)
                {
                    profile.IsSystem = true;
                    profile.IsPublic = true;
                    ListViewProfile.SaveSystemProfile(_className, _placeName, currentUserId, profile);
                }
                else
                {
                    profile.IsSystem = false;
                    profile.IsPublic = cbIsPublic.Checked;
                    ListViewProfile.SaveCustomProfile(_className, _placeName, currentUserId, profile);
                }
                SaveFilters(uid);

                CommandParameters cp = new CommandParameters(_commandName);
                cp.CommandArguments = new System.Collections.Generic.Dictionary<string, string>();
                cp.AddCommandArgument("ViewUid", uid);
                cp.AddCommandArgument("ClassName", _className);
                cp.AddCommandArgument("PlaceName", _placeName);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }