void btnSave_Click(object sender, EventArgs e)
        {
            if (this.SaveToBase)
            {
                ViewPreference.ShowAllMetaField();

                string hiddenColumns = in_leftcol_hide.Value;
                if (hiddenColumns.Length > 0)
                {
                    foreach (string fieldName in hiddenColumns.Split(','))
                    {
                        ViewPreference.HideMetaField(fieldName);
                    }
                }
            }
            else
            {
                ViewPreference.Attributes.Set("tmp_columnsToShow", in_rightcol_hide.Value);
                ViewPreference.Attributes.Set("tmp_columnsToHide", in_leftcol_hide.Value);


                CurrentView.AvailableFields.Clear();
                List <MetaField> allFields = CHelper.GetAllMetaFields(CurrentView);

                foreach (string s in in_rightcol_hide.Value.Split(','))
                {
                    foreach (MetaField field in allFields)
                    {
                        if (field.Name == s)
                        {
                            CurrentView.AvailableFields.Add(field);
                        }
                    }
                }
            }

            UserMetaViewPreference.Save((int)DataContext.Current.CurrentUserId, ViewPreference);
            CHelper.UpdateParentPanel(this);
        }
示例#2
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                if (cp.CommandArguments["groupType"] == null || cp.CommandArguments["primaryKeyId"] == null)
                {
                    throw new ArgumentException("Some expected parameters are null for CollapseExpandBlockTimesheetHandler");
                }

                string ViewName = CHelper.GetFromContext("MetaViewName").ToString();

                if (ViewName != null && ViewName != string.Empty)
                {
                    MetaView CurrentView = Mediachase.Ibn.Data.DataContext.Current.MetaModel.MetaViews[ViewName];
                    if (CurrentView == null)
                    {
                        throw new ArgumentException(String.Format("Cant find MetaView: {0}", ViewName));
                    }

                    McMetaViewPreference mvPref = Mediachase.Ibn.Core.UserMetaViewPreference.Load(CurrentView, Mediachase.IBN.Business.Security.CurrentUser.UserID);
                    if (cp.CommandArguments["groupType"] == MetaViewGroupByType.Primary.ToString())
                    {
                        MetaViewGroupUtil.CollapseOrExpand(MetaViewGroupByType.Primary, mvPref, cp.CommandArguments["primaryKeyId"]);
                    }
                    else
                    {
                        MetaViewGroupUtil.CollapseOrExpand(MetaViewGroupByType.Secondary, mvPref, cp.CommandArguments["primaryKeyId"]);
                    }

                    CHelper.RequireBindGrid();
                    CHelper.AddToContext("DontShowEditPopup", 1);
                    UserMetaViewPreference.Save(Mediachase.IBN.Business.Security.CurrentUser.UserID, mvPref);
                }
            }
        }