Ejemplo n.º 1
0
        public static string GetText(this ObjectShowState objectShowState)
        {
            string retVal = string.Empty;

            switch (objectShowState)
            {
            case ObjectShowState.Blocked:
                retVal = "Blockiert";
                break;

            case ObjectShowState.Draft:
                retVal = "Draft";
                break;

            case ObjectShowState.InProgress:
                retVal = "In Bearbeitung";
                break;

            case ObjectShowState.ConversionFailed:
                retVal = "Abgebrochen";
                break;

            case ObjectShowState.Published:
                retVal = "Publiziert";
                break;
            }
            return(retVal);
        }
Ejemplo n.º 2
0
 private void EnableShowState(ObjectShowState objectShowState)
 {
     showStateEnabled    = true;
     TRShowState.Visible = true;
     rdST.Items.Add(new RadComboBoxItem(ObjectShowState.Draft.GetText(), string.Format("{0}", (int)ObjectShowState.Draft)));
     rdST.Items.Add(new RadComboBoxItem(ObjectShowState.Published.GetText(), string.Format("{0}", (int)ObjectShowState.Published)));
     rdST.SelectedIndex = objectShowState == ObjectShowState.Published ? 1 : 0;
     rdST.Enabled       = true;
 }
Ejemplo n.º 3
0
        public override bool SaveStep(ref NameValueCollection queryString)
        {
            ObjectStatus objectStatus     = ObjectStatus.Public;
            bool         managed          = false;
            string       selectedRoles    = null;
            FriendType   friendVisibility = 0;

            if (objectViewHandler != null)
            {
                friendVisibility = objectViewHandler.GetFriendType();
                objectStatus     = objectViewHandler.GetObjectStatus();
                selectedRoles    = objectViewHandler.GetRoles();
                managed          = objectViewHandler.IsManaged();
            }

            ObjectShowState objectShowState = ObjectShowState.Published;

            if (dataObject == null || (dataObject.ObjectType != Helper.GetObjectTypeNumericID("ProfileCommunity") && dataObject.ObjectType != Helper.GetObjectTypeNumericID("Page") && dataObject.ObjectType != Helper.GetObjectTypeNumericID("Community")))
            {
                objectShowState = managed ? ObjectShowState.Draft : ObjectShowState.Published;
            }

            string tagWords = string.Empty;

            if (objectTagHandler != null)
            {
                tagWords = objectTagHandler.GetTags();
            }
            else if (dataObject != null)
            {
                tagWords = dataObject.TagList;
            }

            if (ObjectID.HasValue && dataObject != null && dataObject.State != ObjectState.Added)
            {
                dataObject.TagList          = tagWords;
                dataObject.Status           = objectStatus;
                dataObject.ShowState        = objectShowState;
                dataObject.Copyright        = int.Parse(this.Copyright.SelectedValue);
                dataObject.FriendVisibility = friendVisibility;
                if (!string.IsNullOrEmpty(selectedRoles))
                {
                    var roles = dataObject.RoleRight.Keys.ToArray <string>();
                    foreach (string role in roles)
                    {
                        dataObject.RoleRight[role] = false;
                    }
                    string[] selRoles = selectedRoles.Split(Constants.TAG_DELIMITER);
                    for (int i = 0; i < selRoles.Length; i++)
                    {
                        dataObject.RoleRight[selRoles[i]] = true;
                    }
                }
                double geoLat;
                if (double.TryParse(this.TxtGeoLat.Text, out geoLat))
                {
                    dataObject.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.TxtGeoLong.Text, out geoLong))
                {
                    dataObject.Geo_Long = geoLong;
                }
                dataObject.Zip         = this.HFZip.Value.StripForScript();
                dataObject.City        = this.HFCity.Value.StripForScript();
                dataObject.Street      = this.HFStreet.Value.StripForScript();
                dataObject.CountryCode = this.HFCountry.Value.StripForScript();
                dataObject.Update(UserDataContext.GetUserDataContext());

                /*DataObjectList<DataObject> relatedObjects = DataObjects.Load<DataObject>(new QuickParameters { Udc = UserDataContext.GetUserDataContext(), QuerySourceType = QuerySourceType.MyContent, IgnoreCache = true, DisablePaging = true, RelationParams = new RelationParams { ParentObjectID = dataObject.ObjectID, ExcludeSystemObjects = true } });
                 * foreach (DataObject relatedObject in relatedObjects)
                 * {
                 *  relatedObject.Status = dataObject.Status;
                 *  relatedObject.ShowState = dataObject.ShowState;
                 *  relatedObject.Copyright = dataObject.Copyright;
                 *  relatedObject.FriendVisibility = dataObject.FriendVisibility;
                 *  foreach (KeyValuePair<string, bool> roleRight in dataObject.RoleRight)
                 *  {
                 *      relatedObject.RoleRight[roleRight.Key] = roleRight.Value;
                 *  }
                 *  relatedObject.Update(UserDataContext.GetUserDataContext());
                 * }*/

                if (ObjectType == Helper.GetObjectTypeNumericID("Community") && ObjectID.HasValue && !CommunityID.HasValue)
                {
                    CommunityUsersType  communityUsersType   = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RCBCtyGroups.SelectedValue);
                    CommunityUsersType  communityUploadUsers = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RCBCtyUpload.SelectedValue);
                    DataObjectCommunity communtiy            = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);
                    communtiy.CreateGroupUser = communityUsersType;
                    communtiy.UploadUsers     = communityUploadUsers;
                    communtiy.Managed         = managed;
                    communtiy.Update(UserDataContext.GetUserDataContext());
                }
                return(true);
            }
            else
            {
                // If there isn't an upload session and no object id, we habe to create one
                if (string.IsNullOrEmpty(Request.QueryString["UploadSession"]) && !ObjectID.HasValue)
                {
                    queryString.Add("OID", Guid.NewGuid().ToString());
                }

                queryString.Add("TG", Server.UrlEncode(tagWords));
                queryString.Add("OS", ((int)objectStatus).ToString());
                queryString.Add("SS", ((int)objectShowState).ToString());
                queryString.Add("FT", ((int)friendVisibility).ToString());
                queryString.Add("CR", this.Copyright.SelectedValue);
                if (!string.IsNullOrEmpty(selectedRoles))
                {
                    queryString.Add("SR", string.Format("{0}", Server.UrlEncode(selectedRoles)));
                }
                if (!string.IsNullOrEmpty(this.TxtGeoLat.Text) && !string.IsNullOrEmpty(this.TxtGeoLong.Text))
                {
                    queryString.Add("GC", string.Format("{0},{1}", this.TxtGeoLat.Text, this.TxtGeoLong.Text));
                }
                else
                {
                    queryString.Add("GC", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFZip.Value))
                {
                    queryString.Add("ZP", string.Format("{0}", Server.UrlEncode(this.HFZip.Value)));
                }
                else
                {
                    queryString.Add("ZP", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFCity.Value))
                {
                    queryString.Add("CI", string.Format("{0}", Server.UrlEncode(this.HFCity.Value)));
                }
                else
                {
                    queryString.Add("CI", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFStreet.Value))
                {
                    queryString.Add("RE", string.Format("{0}", Server.UrlEncode(this.HFStreet.Value)));
                }
                else
                {
                    queryString.Add("RE", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFCountry.Value))
                {
                    queryString.Add("CO", string.Format("{0}", Server.UrlEncode(this.HFCountry.Value)));
                }
                else
                {
                    queryString.Add("CO", string.Empty);
                }
                return(true);
            }
        }
Ejemplo n.º 4
0
        public void Save(DataObject loadedDataObject)
        {
            ObjectStatus objectStatus;
            bool         managed          = false;
            string       selectedRoles    = null;
            FriendType   friendVisibility = 0;

            if (objectViewHandler != null)
            {
                friendVisibility = objectViewHandler.GetFriendType();
                objectStatus     = objectViewHandler.GetObjectStatus();
                selectedRoles    = objectViewHandler.GetRoles();
                managed          = objectViewHandler.IsManaged();
            }
            else
            {
                objectStatus     = loadedDataObject.Status;
                friendVisibility = loadedDataObject.FriendVisibility;
            }

            ObjectShowState objectShowState = ObjectShowState.Published;

            if (loadedDataObject == null || (loadedDataObject.ObjectType != Helper.GetObjectTypeNumericID("ProfileCommunity") && loadedDataObject.ObjectType != Helper.GetObjectTypeNumericID("Page") && loadedDataObject.ObjectType != Helper.GetObjectTypeNumericID("Community")))
            {
                objectShowState = managed ? ObjectShowState.Draft : ObjectShowState.Published;
            }

            string tagWords;

            if (objectTagHandler != null)
            {
                tagWords = objectTagHandler.GetTags();
            }
            else
            {
                tagWords = loadedDataObject.TagList;
            }

            loadedDataObject.TagList          = tagWords;
            loadedDataObject.Status           = objectStatus;
            loadedDataObject.ShowState        = objectShowState;
            loadedDataObject.FriendVisibility = friendVisibility;
            loadedDataObject.Copyright        = int.Parse(this.Copyright.SelectedValue);
            if (!string.IsNullOrEmpty(selectedRoles))
            {
                var roles = loadedDataObject.RoleRight.Keys.ToArray <string>();
                foreach (string role in roles)
                {
                    loadedDataObject.RoleRight[role] = false;
                }
                string[] selRoles = selectedRoles.Split(Constants.TAG_DELIMITER);
                for (int i = 0; i < selRoles.Length; i++)
                {
                    loadedDataObject.RoleRight[selRoles[i]] = true;
                }
            }
            double geoLat;

            if (double.TryParse(this.TxtGeoLat.Text, out geoLat))
            {
                loadedDataObject.Geo_Lat = geoLat;
            }
            double geoLong;

            if (double.TryParse(this.TxtGeoLong.Text, out geoLong))
            {
                loadedDataObject.Geo_Long = geoLong;
            }
            loadedDataObject.Zip         = this.HFZip.Value.StripForScript();
            loadedDataObject.City        = this.HFCity.Value.StripForScript();
            loadedDataObject.Street      = this.HFStreet.Value.StripForScript();
            loadedDataObject.CountryCode = this.HFCountry.Value.StripForScript();
        }