Ejemplo n.º 1
0
        private void SaveSettings(UserSettingsCategory cate)
        {
            var ouMode           = (OuBrowseViewMode)cate.Properties.GetValue("OuBrowseView", 0);
            var userViewFlags    = (UserBrowseViewMode)cate.Properties.GetValue("UserBrowseView", 0);
            var generalViewFlags = (GeneralViewMode)cate.Properties.GetValue("GeneralBrowseView", 0);

            if (this.orgModeAuto.Checked)
            {
                ouMode = ouMode & (~OuBrowseViewMode.Fixed);
            }
            else if (this.orgModeHierarchical.Checked)
            {
                ouMode = OuBrowseViewMode.Hierarchical | OuBrowseViewMode.Fixed;
            }
            else
            {
                ouMode = OuBrowseViewMode.List | OuBrowseViewMode.Fixed;
            }

            if (this.userViewAuto.Checked)
            {
                userViewFlags = userViewFlags & (~UserBrowseViewMode.Fixed);
            }
            else if (userViewTable.Checked)
            {
                userViewFlags = UserBrowseViewMode.ReducedTable | UserBrowseViewMode.Fixed;
            }
            else if (userViewReduced.Checked)
            {
                userViewFlags = UserBrowseViewMode.ReducedList | UserBrowseViewMode.Fixed;
            }
            else
            {
                userViewFlags = UserBrowseViewMode.DetailList | UserBrowseViewMode.Fixed;
            }

            if (this.generalViewAuto.Checked)
            {
                generalViewFlags = generalViewFlags & (~GeneralViewMode.Fixed);
            }
            else if (this.generalViewList.Checked)
            {
                generalViewFlags = GeneralViewMode.Fixed | GeneralViewMode.List;
            }
            else
            {
                generalViewFlags = GeneralViewMode.Fixed | GeneralViewMode.Table;
            }

            cate.Properties.SetValue("OuBrowseView", (int)ouMode);
            cate.Properties.SetValue("PerPageSizeOption", this.ddlSizePerPage.SelectedIndex);
            cate.Properties.SetValue("UserBrowseView", (int)userViewFlags);
            cate.Properties.SetValue("GeneralBrowseView", (int)generalViewFlags);
        }
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            IDictionary <string, object> dictionary = new Dictionary <string, object>();

            UserSettingsCategory category = (UserSettingsCategory)obj;

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Name", category.Name);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Description", category.Description);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Properties", category.Properties);

            return(dictionary);
        }
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			UserSettingsCategory category = new UserSettingsCategory();

			category.Name = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);
			category.Description = DictionaryHelper.GetValue(dictionary, "Description", string.Empty);

			PropertyValueCollection properties = JSONSerializerExecute.Deserialize<PropertyValueCollection>(dictionary["Properties"]);
			category.Properties.Clear();
			category.Properties.CopyFrom(properties);

			return category;
		}
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            UserSettingsCategory category = new UserSettingsCategory();

            category.Name        = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);
            category.Description = DictionaryHelper.GetValue(dictionary, "Description", string.Empty);

            PropertyValueCollection properties = JSONSerializerExecute.Deserialize <PropertyValueCollection>(dictionary["Properties"]);

            category.Properties.Clear();
            category.Properties.CopyFrom(properties);

            return(category);
        }
Ejemplo n.º 5
0
		private void BindToView(UserSettingsCategory cate)
		{
			var ouMode = (OuBrowseViewMode)cate.Properties.GetValue("OuBrowseView", 0);
			var perPageSize = (int)cate.Properties.GetValue("PerPageSizeOption", 0);
			var userViewFlags = (UserBrowseViewMode)cate.Properties.GetValue("UserBrowseView", 0);
			var generalViewFlags = (GeneralViewMode)cate.Properties.GetValue("GeneralBrowseView", 0);

			this.ddlSizePerPage.SelectedIndex = perPageSize;

			if ((ouMode & OuBrowseViewMode.Fixed) == OuBrowseViewMode.Fixed)
			{
				if ((ouMode & OuBrowseViewMode.Hierarchical) == OuBrowseViewMode.Hierarchical)
				{
					this.orgModeHierarchical.Checked = true;
				}
				else
				{
					this.orgModeList.Checked = true;
				}
			}
			else
			{
				this.orgModeAuto.Checked = true;
			}

			if ((userViewFlags & UserBrowseViewMode.Fixed) == UserBrowseViewMode.Fixed)
			{
				if ((userViewFlags & UserBrowseViewMode.ReducedTable) == UserBrowseViewMode.ReducedTable)
				{
					this.userViewTable.Checked = true;
				}
				else if ((userViewFlags & UserBrowseViewMode.ReducedList) == UserBrowseViewMode.ReducedList)
				{
					this.userViewReduced.Checked = true;
				}
				else
				{
					this.userViewDetail.Checked = true;
				}
			}
			else
			{
				this.userViewAuto.Checked = true;
			}

			if ((generalViewFlags & GeneralViewMode.Fixed) == GeneralViewMode.Fixed)
			{
				if ((generalViewFlags & GeneralViewMode.Table) == GeneralViewMode.Table)
				{
					this.generalViewTable.Checked = true;
				}
				else
				{
					this.generalViewList.Checked = true;
				}
			}
			else
			{
				this.generalViewAuto.Checked = true;
			}
		}
Ejemplo n.º 6
0
		private void SaveSettings(UserSettingsCategory cate)
		{
			var ouMode = (OuBrowseViewMode)cate.Properties.GetValue("OuBrowseView", 0);
			var userViewFlags = (UserBrowseViewMode)cate.Properties.GetValue("UserBrowseView", 0);
			var generalViewFlags = (GeneralViewMode)cate.Properties.GetValue("GeneralBrowseView", 0);

			if (this.orgModeAuto.Checked)
			{
				ouMode = ouMode & (~OuBrowseViewMode.Fixed);
			}
			else if (this.orgModeHierarchical.Checked)
			{
				ouMode = OuBrowseViewMode.Hierarchical | OuBrowseViewMode.Fixed;
			}
			else
			{
				ouMode = OuBrowseViewMode.List | OuBrowseViewMode.Fixed;
			}

			if (this.userViewAuto.Checked)
			{
				userViewFlags = userViewFlags & (~UserBrowseViewMode.Fixed);
			}
			else if (userViewTable.Checked)
			{
				userViewFlags = UserBrowseViewMode.ReducedTable | UserBrowseViewMode.Fixed;
			}
			else if (userViewReduced.Checked)
			{
				userViewFlags = UserBrowseViewMode.ReducedList | UserBrowseViewMode.Fixed;
			}
			else
			{
				userViewFlags = UserBrowseViewMode.DetailList | UserBrowseViewMode.Fixed;
			}

			if (this.generalViewAuto.Checked)
			{
				generalViewFlags = generalViewFlags & (~GeneralViewMode.Fixed);
			}
			else if (this.generalViewList.Checked)
			{
				generalViewFlags = GeneralViewMode.Fixed | GeneralViewMode.List;
			}
			else
			{
				generalViewFlags = GeneralViewMode.Fixed | GeneralViewMode.Table;
			}

			cate.Properties.SetValue("OuBrowseView", (int)ouMode);
			cate.Properties.SetValue("PerPageSizeOption", this.ddlSizePerPage.SelectedIndex);
			cate.Properties.SetValue("UserBrowseView", (int)userViewFlags);
			cate.Properties.SetValue("GeneralBrowseView", (int)generalViewFlags);
		}
Ejemplo n.º 7
0
        private void BindToView(UserSettingsCategory cate)
        {
            var ouMode           = (OuBrowseViewMode)cate.Properties.GetValue("OuBrowseView", 0);
            var perPageSize      = (int)cate.Properties.GetValue("PerPageSizeOption", 0);
            var userViewFlags    = (UserBrowseViewMode)cate.Properties.GetValue("UserBrowseView", 0);
            var generalViewFlags = (GeneralViewMode)cate.Properties.GetValue("GeneralBrowseView", 0);

            this.ddlSizePerPage.SelectedIndex = perPageSize;

            if ((ouMode & OuBrowseViewMode.Fixed) == OuBrowseViewMode.Fixed)
            {
                if ((ouMode & OuBrowseViewMode.Hierarchical) == OuBrowseViewMode.Hierarchical)
                {
                    this.orgModeHierarchical.Checked = true;
                }
                else
                {
                    this.orgModeList.Checked = true;
                }
            }
            else
            {
                this.orgModeAuto.Checked = true;
            }

            if ((userViewFlags & UserBrowseViewMode.Fixed) == UserBrowseViewMode.Fixed)
            {
                if ((userViewFlags & UserBrowseViewMode.ReducedTable) == UserBrowseViewMode.ReducedTable)
                {
                    this.userViewTable.Checked = true;
                }
                else if ((userViewFlags & UserBrowseViewMode.ReducedList) == UserBrowseViewMode.ReducedList)
                {
                    this.userViewReduced.Checked = true;
                }
                else
                {
                    this.userViewDetail.Checked = true;
                }
            }
            else
            {
                this.userViewAuto.Checked = true;
            }

            if ((generalViewFlags & GeneralViewMode.Fixed) == GeneralViewMode.Fixed)
            {
                if ((generalViewFlags & GeneralViewMode.Table) == GeneralViewMode.Table)
                {
                    this.generalViewTable.Checked = true;
                }
                else
                {
                    this.generalViewList.Checked = true;
                }
            }
            else
            {
                this.generalViewAuto.Checked = true;
            }
        }