示例#1
0
        protected void OnCancelClick(object sender, EventArgs e)
        {
            DataObjectLocation location = DataObject.Load <DataObjectLocation>(control.ObjectID);

            if (location.State != ObjectState.Added)
            {
                location.Delete(UserDataContext.GetUserDataContext());
            }
            ScriptManager.RegisterStartupScript(this, GetType(), "CloseWindow", "$telerik.$(function() { GetRadWindow().Close(); } );", true);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            location = (DataObjectLocation)DataObject;

            RTTM.Visible = false;
            if (location != null)
            {
                foreach (string tooltipId in _4screen.CSB.DataAccess.Business.AdWordHelper.GetCampaignObjectIds(location.ObjectID.Value))
                {
                    RTTM.TargetControls.Add(tooltipId, true);
                    RTTM.Visible = true;
                }
            }

            PrintLocation();
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lnkBack.Text        = Helper.GetObjectName(DataObject.ObjectType, false);
            lnkBack.NavigateUrl = Helper.GetMobileOverviewLink(DataObject.ObjectType);
            lnkBack.ID          = null;
            litBack.Text        = Helper.GetObjectName(DataObject.ObjectType, true);

            if ((DataObject.GetUserAccess(UserDataContext.GetUserDataContext()) & ObjectAccessRight.Update) == ObjectAccessRight.Update)
            {
                lnkEdit.Visible     = true;
                lnkEdit.NavigateUrl = "/M/Admin/EditLocation.aspx?OID=" + DataObject.ObjectID + "&ReturnUrl=" + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Request.RawUrl));
            }

            location = (DataObjectLocation)DataObject;

            PrintLocation();
        }
示例#4
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            foreach (string i in Enum.GetNames(typeof(LocationType)))
            {
                string key  = string.Format("Text{0}", i);
                string text = languageShared.GetString(key);
                if (!string.IsNullOrEmpty(text))
                {
                    ListItem item = new ListItem(text, i);
                    CblType.Items.Add(item);
                }
            }

            location = DataObject.Load <DataObjectLocation>(Request.QueryString["OID"].ToNullableGuid());
            if (location.State == ObjectState.Added)
            {
                LitTitle.Text        = language.GetString("LabelAddLocation");
                lbtnSave.Text        = languageShared.GetString("CommandCreate");
                objectExisting       = false;
                location.ObjectID    = Guid.NewGuid();
                location.CommunityID = UserProfile.Current.ProfileCommunityID;
                location.ShowState   = ObjectShowState.Published;
                location.Status      = ObjectStatus.Public;
            }
            else
            {
                LitTitle.Text   = language.GetString("LabelEditLocation");
                lbtnSave.Text   = languageShared.GetString("CommandSave");
                TxtTitle.Text   = location.Title;
                TxtDesc.Text    = location.Description.Replace("<br/>", Environment.NewLine);
                TxtStreet.Text  = location.Street;
                TxtZipCode.Text = location.Zip;
                TxtCity.Text    = location.City;

                foreach (ListItem item in CblType.Items)
                {
                    item.Selected = location.TagList.Contains(item.Value);
                }
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            location = DataAccess.Business.DataObject.Load <DataObjectLocation>(ObjectID, null, true);

            if (location.State == ObjectState.Added)
            {
                location.ObjectID    = ObjectID;
                location.Title       = GuiLanguage.GetGuiLanguage("Shared").GetString("LabelUnnamed");
                location.CommunityID = CommunityID;
                location.ShowState   = ObjectShowState.Draft;
                location.StartDate   = DateTime.Now;
                location.EndDate     = DateTime.Now.AddYears(10);
                location.Insert(UserDataContext.GetUserDataContext());
                location.Title = string.Empty;
            }
            location.SetValuesFromQuerySting();

            FillEditForm();

            this.LnkOpenMap.Attributes.Add("onClick", string.Format("OpenGeoTagWindow('{0}', '{1}');", this.ClientID, languageShared.GetString("TitleMap").StripForScript()));
        }
示例#6
0
        private void PrintEvent()
        {
            if (Request.IsAuthenticated)
            {
                string initQuerySegment = "&XCN=" + UserProfile.Current.ProfileCommunityID + "&OID=" + DataObject.ObjectID;
                if (!SiteConfig.UsePopupWindows)
                {
                    initQuerySegment += "&ReturnUrl=" + System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(Request.RawUrl));
                }
                LnkRelCnt.NavigateUrl = string.Format("javascript:radWinOpen('{0}{1}', '{2}', 800, 500, true, null, 'wizardWin')", Helper.GetWizardLink("AddPicturesAndVideos", SiteConfig.UsePopupWindows), initQuerySegment, GuiLanguage.GetGuiLanguage("UserControls.Templates.WebUI.Base").GetString("CommandAddPicturesAndVideos"));
            }
            else
            {
                LnkRelCnt.Enabled = false;
                LnkRelCnt.ToolTip = (new TextControl()
                {
                    LanguageFile = "UserControls.Templates.WebUI.Base", TextKey = "TooltipLoginToAddPhotosAndVideos"
                }).Text;
            }
            LnkRelCnt.ID = null;

            if (!string.IsNullOrEmpty(dataObjectEvent.Image))
            {
                Img.ImageUrl = _4screen.CSB.Common.SiteConfig.MediaDomainName + dataObjectEvent.GetImage(PictureVersion.M);
            }
            else
            {
                Img.Visible = false;
            }

            DataObjectLocation currentLocation = DataObjects.Load <DataObjectLocation>(new QuickParameters()
            {
                Udc            = UserDataContext.GetUserDataContext(),
                DisablePaging  = true,
                IgnoreCache    = true,
                RelationParams = new RelationParams()
                {
                    ChildObjectID = dataObjectEvent.ObjectID
                }
            }).SingleOrDefault();

            if (currentLocation != null)
            {
                LnkLocation.Text        = currentLocation.Title;
                LnkLocation.NavigateUrl = Helper.GetDetailLink(currentLocation.ObjectType, currentLocation.ObjectID.ToString());
                LnkLocation.ID          = null;
                if (!string.IsNullOrEmpty(currentLocation.Street))
                {
                    LitAddress.Text += currentLocation.Street + "<br/>";
                }
                if (!string.IsNullOrEmpty(currentLocation.City))
                {
                    if (!string.IsNullOrEmpty(currentLocation.Zip))
                    {
                        LitAddress.Text += currentLocation.Zip + " " + currentLocation.City + "<br/>";
                    }
                    else
                    {
                        LitAddress.Text += currentLocation.City + "<br/>";
                    }
                }
            }

            LitWhen.Text = dataObjectEvent.StartDate.ToShortDateString();
            if (dataObjectEvent.EndDate != DateTime.MaxValue && dataObjectEvent.EndDate != dataObjectEvent.StartDate)
            {
                LitWhen.Text += " - " + dataObjectEvent.EndDate.ToShortDateString();
            }
            if (!string.IsNullOrEmpty(dataObjectEvent.Time))
            {
                LitWhen.Text += "<br/>" + dataObjectEvent.Time;
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.TagList))
            {
                LitType.Text = string.Join(", ", Helper.GetMappedTagWords(dataObjectEvent.TagList).ToArray());
            }

            if (dataObjectEvent.Website != null)
            {
                TrWebsite.Visible      = true;
                LnkWebsite.Text        = dataObjectEvent.Website.ToString();
                LnkWebsite.NavigateUrl = dataObjectEvent.Website.ToString();
            }
            LnkWebsite.ID = null;

            if (!string.IsNullOrEmpty(dataObjectEvent.Age))
            {
                TrAge.Visible = true;
                LitAge.Text   = dataObjectEvent.Age;
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.Price))
            {
                TrPrice.Visible = true;
                LitPrice.Text   = dataObjectEvent.Price;
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.DescriptionLinked))
            {
                TrDesc.Visible = true;
                LitDesc.Text   = dataObjectEvent.DescriptionLinked;
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.Content))
            {
                TrEvent.Visible = true;
                LitEvent.Text   = dataObjectEvent.Content;
            }

            TrWebsite.ID = null;
            TrAge.ID     = null;
            TrPrice.ID   = null;
            TrDesc.ID    = null;
            LitDesc.ID   = null;
        }
示例#7
0
        private void FillEditForm()
        {
            this.Img.Src = string.Format("{0}/{1}", _4screen.CSB.Common.SiteConfig.MediaDomainName, dataObjectEvent.GetImage(PictureVersion.S));
            this.LnkImage.Attributes.Add("onClick", string.Format("radWinOpen('/Pages/Popups/SinglePictureUpload.aspx?OID={0}&ParentRadWin=wizardWin', 'Bild hochladen', 400, 100, false, null, 'imageWin')", dataObjectEvent.ObjectID));

            RevWebsite.ValidationExpression = Constants.REGEX_URL;

            this.TxtTitle.Text    = dataObjectEvent.Title;
            this.TxtDesc.Text     = dataObjectEvent.Description;
            this.TxtEvent.Content = dataObjectEvent.Content;
            this.TxtWebsite.Text  = dataObjectEvent.Website != null?dataObjectEvent.Website.ToString() : string.Empty;

            this.HFTagWords.Value  = dataObjectEvent.TagList.Replace(Constants.TAG_DELIMITER, ',');
            this.HFStatus.Value    = ((int)dataObjectEvent.Status).ToString();
            this.HFShowState.Value = ((int)dataObjectEvent.ShowState).ToString();
            this.HFCopyright.Value = dataObjectEvent.Copyright.ToString();
            if (dataObjectEvent.Geo_Lat != double.MinValue && dataObjectEvent.Geo_Long != double.MinValue)
            {
                this.HFGeoLat.Value  = dataObjectEvent.Geo_Lat.ToString();
                this.HFGeoLong.Value = dataObjectEvent.Geo_Long.ToString();
            }
            this.HFZip.Value     = dataObjectEvent.Zip;
            this.HFCity.Value    = dataObjectEvent.City;
            this.HFStreet.Value  = dataObjectEvent.Street;
            this.HFCountry.Value = dataObjectEvent.CountryCode;

            this.RDPFromDate.SelectedDate = dataObjectEvent.StartDate;
            this.RDPToDate.SelectedDate   = dataObjectEvent.EndDate == DateTime.MaxValue ? dataObjectEvent.StartDate : dataObjectEvent.EndDate;
            this.TxtTime.Text             = dataObjectEvent.Time;
            this.TxtPrice.Text            = dataObjectEvent.Price;
            this.TxtAge.Text = dataObjectEvent.Age;

            DataObjectLocation currentLocation = DataObjects.Load <DataObjectLocation>(new QuickParameters()
            {
                Udc            = UserDataContext.GetUserDataContext(),
                DisablePaging  = true,
                IgnoreCache    = true,
                RelationParams = new RelationParams()
                {
                    ChildObjectID = dataObjectEvent.ObjectID
                }
            }).SingleOrDefault();

            DDLocations.EmptyMessage   = "Location suchen";
            DDLocations.DataTextField  = "Title";
            DDLocations.DataValueField = "ObjectID";
            DDLocations.DataSource     = DataObjects.Load <DataObjectLocation>(new QuickParameters()
            {
                Udc           = UserDataContext.GetUserDataContext(),
                SortBy        = QuickSort.Title,
                Direction     = QuickSortDirection.Asc,
                DisablePaging = true,
                IgnoreCache   = true
            });
            DDLocations.DataBind();
            if (currentLocation != null)
            {
                DDLocations.SelectedValue = currentLocation.ObjectID.ToString();
            }

            LbtnAddLoc.Attributes.Add("onClick", string.Format("radWinOpen('/Pages/Popups/AddLocation.aspx?OID={0}&CN={1}&ParentRadWin=wizardWin', 'Location hinzufügen', 400, 400, false, 'OnLocationAdded', 'locationWin');", Guid.NewGuid(), dataObjectEvent.CommunityID));

            foreach (string i in Enum.GetNames(typeof(EventType)))
            {
                string key  = string.Format("Text{0}", i);
                string text = languageShared.GetString(key);
                if (!string.IsNullOrEmpty(text))
                {
                    ListItem item = new ListItem(text, i);
                    item.Selected = dataObjectEvent.TagList.Contains(i);
                    CblType.Items.Add(item);
                }
            }
        }
示例#8
0
        public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                try
                {
                    dataObjectEvent.Title       = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                    dataObjectEvent.Description = Common.Extensions.StripHTMLTags(this.TxtDesc.Text).CropString(20000);
                    dataObjectEvent.Content     = this.TxtEvent.Content;
                    dataObjectEvent.Website     = !string.IsNullOrEmpty(TxtWebsite.Text) ? new Uri(TxtWebsite.Text) : null;
                    dataObjectEvent.TagList     = Common.Extensions.StripHTMLTags(this.HFTagWords.Value);
                    dataObjectEvent.Status      = ObjectStatus.Public;
                    dataObjectEvent.ShowState   = ObjectShowState.Published;
                    dataObjectEvent.Copyright   = 0;
                    double geoLat;
                    if (double.TryParse(this.HFGeoLat.Value, out geoLat))
                    {
                        dataObjectEvent.Geo_Lat = geoLat;
                    }
                    double geoLong;
                    if (double.TryParse(this.HFGeoLong.Value, out geoLong))
                    {
                        dataObjectEvent.Geo_Long = geoLong;
                    }
                    dataObjectEvent.Zip         = this.HFZip.Value;
                    dataObjectEvent.City        = this.HFCity.Value;
                    dataObjectEvent.Street      = this.HFStreet.Value;
                    dataObjectEvent.CountryCode = this.HFCountry.Value;

                    if (this.RDPFromDate.SelectedDate.HasValue)
                    {
                        dataObjectEvent.StartDate = this.RDPFromDate.SelectedDate.Value;
                    }
                    dataObjectEvent.EndDate = RDPToDate.SelectedDate.HasValue ? RDPToDate.SelectedDate.Value : dataObjectEvent.StartDate;
                    if (dataObjectEvent.StartDate == dataObjectEvent.EndDate)
                    {
                        dataObjectEvent.Featured = 1;
                    }
                    else
                    {
                        dataObjectEvent.Featured = 2;
                    }
                    dataObjectEvent.Time     = Common.Extensions.StripHTMLTags(this.TxtTime.Text);
                    dataObjectEvent.Price    = Common.Extensions.StripHTMLTags(this.TxtPrice.Text);
                    dataObjectEvent.Age      = Common.Extensions.StripHTMLTags(this.TxtAge.Text);
                    dataObjectEvent.Geo_Lat  = double.MinValue;
                    dataObjectEvent.Geo_Long = double.MinValue;

                    if (DDLocations.SelectedValue.IsGuid())
                    {
                        DataObjectLocation location = DataObject.Load <DataObjectLocation>(DDLocations.SelectedValue.ToGuid());
                        if (location.Geo_Lat != Double.MinValue && location.Geo_Long != Double.MinValue)
                        {
                            dataObjectEvent.Geo_Lat  = location.Geo_Lat;
                            dataObjectEvent.Geo_Long = location.Geo_Long;
                        }
                        DataObject.RelDelete(new RelationParams()
                        {
                            Udc = UserDataContext.GetUserDataContext(),
                            ParentObjectType = location.ObjectType,
                            ChildObjectID    = dataObjectEvent.ObjectID,
                            ChildObjectType  = dataObjectEvent.ObjectType
                        });
                        DataObject.RelInsert(new RelationParams()
                        {
                            Udc              = UserDataContext.GetUserDataContext(),
                            ParentObjectID   = location.ObjectID,
                            ParentObjectType = location.ObjectType,
                            ChildObjectID    = dataObjectEvent.ObjectID,
                            ChildObjectType  = dataObjectEvent.ObjectType
                        }, 0);
                    }
                    List <string> tags = new List <string>();
                    foreach (ListItem item in CblType.Items)
                    {
                        if (item.Selected)
                        {
                            tags.Add(item.Value);
                        }
                    }
                    dataObjectEvent.TagList = string.Join(",", tags.ToArray());

                    dataObjectEvent.Update(UserDataContext.GetUserDataContext());

                    return(true);
                }
                catch (Exception ex)
                {
                    LitMsg.Text = language.GetString("MessageSaveError") + ex.Message;
                }
            }
            return(false);
        }
示例#9
0
        private void PrintEvent()
        {
            LitTitle.Text = dataObjectEvent.Title.EscapeForXHTML();

            if (!string.IsNullOrEmpty(dataObjectEvent.Image))
            {
                Img.ImageUrl = _4screen.CSB.Common.SiteConfig.MediaDomainName + dataObjectEvent.GetImage(PictureVersion.S);
            }
            else
            {
                Img.Visible = false;
            }

            DataObjectLocation currentLocation = DataObjects.Load <DataObjectLocation>(new QuickParameters()
            {
                Udc            = UserDataContext.GetUserDataContext(),
                DisablePaging  = true,
                IgnoreCache    = true,
                RelationParams = new RelationParams()
                {
                    ChildObjectID = dataObjectEvent.ObjectID
                }
            }).SingleOrDefault();

            if (currentLocation != null)
            {
                LnkLocation.Text        = currentLocation.Title;
                LnkLocation.NavigateUrl = Helper.GetMobileDetailLink(currentLocation.ObjectType, currentLocation.ObjectID.ToString());
                LnkLocation.ID          = null;
                if (!string.IsNullOrEmpty(currentLocation.Street))
                {
                    LitAddress.Text += currentLocation.Street + "<br/>";
                }
                if (!string.IsNullOrEmpty(currentLocation.City))
                {
                    if (!string.IsNullOrEmpty(currentLocation.Zip))
                    {
                        LitAddress.Text += currentLocation.Zip + " " + currentLocation.City + "<br/>";
                    }
                    else
                    {
                        LitAddress.Text += currentLocation.City + "<br/>";
                    }
                }
            }
            if (DataObject.Geo_Lat != Double.MinValue)
            {
                pnlGeoTag.Visible     = true;
                pnlGeoTag.ID          = null;
                lnkGeoTag.NavigateUrl = "http://maps.google.com/?q=" + DataObject.Geo_Lat + "," + DataObject.Geo_Long + "&z=14";
                lnkGeoTag.ID          = null;
            }

            LitWhen.Text = dataObjectEvent.StartDate.ToShortDateString();
            if (dataObjectEvent.EndDate != DateTime.MaxValue && dataObjectEvent.EndDate != dataObjectEvent.StartDate)
            {
                LitWhen.Text += " - " + dataObjectEvent.EndDate.ToShortDateString();
            }
            if (!string.IsNullOrEmpty(dataObjectEvent.Time))
            {
                LitWhen.Text += "<br/>" + dataObjectEvent.Time.EscapeForXHTML();
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.TagList))
            {
                LitType.Text = string.Join(", ", Helper.GetMappedTagWords(dataObjectEvent.TagList).ToArray());
            }

            if (dataObjectEvent.Website != null)
            {
                TrWebsite.Visible      = true;
                LnkWebsite.Text        = dataObjectEvent.Website.ToString().EscapeForXHTML();
                LnkWebsite.NavigateUrl = dataObjectEvent.Website.ToString();
            }
            LnkWebsite.ID = null;

            if (!string.IsNullOrEmpty(dataObjectEvent.Age))
            {
                TrAge.Visible = true;
                LitAge.Text   = dataObjectEvent.Age.EscapeForXHTML();
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.Price))
            {
                TrPrice.Visible = true;
                LitPrice.Text   = dataObjectEvent.Price.EscapeForXHTML();
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.Description))
            {
                TrDesc.Visible = true;
                LitDesc.Text   = dataObjectEvent.Description.EscapeForXHTML();
            }

            if (!string.IsNullOrEmpty(dataObjectEvent.Content))
            {
                TrDesc.Visible = true;
                LitEvent.Text  = dataObjectEvent.Content.EscapeForXHTML();
            }

            TrWebsite.ID = null;
            TrAge.ID     = null;
            TrPrice.ID   = null;
            LitDesc.ID   = null;
        }
示例#10
0
        private bool Save()
        {
            try
            {
                List <string> tags = new List <string>();
                foreach (ListItem item in CblType.Items)
                {
                    if (item.Selected)
                    {
                        tags.Add(item.Value);
                    }
                }
                DateTime?startDate = null;
                DateTime?endDate   = null;
                try { startDate = DateTime.Parse(TxtStartDate.Text); }
                catch { }
                try { endDate = DateTime.Parse(TxtEndDate.Text); }
                catch { }

                if (string.IsNullOrEmpty(TxtTitle.Text.StripHTMLTags()))
                {
                    pnlStatus.Visible = true;
                    litStatus.Text    = language.GetString("MessageTitleRequired");
                }
                else if (tags.Count == 0)
                {
                    pnlStatus.Visible = true;
                    litStatus.Text    = language.GetString("MessageLocationTypeRequired");
                }
                else if (!startDate.HasValue)
                {
                    pnlStatus.Visible = true;
                    litStatus.Text    = language.GetString("MessageEventDateRequired");
                }
                else if (endDate.HasValue && startDate.Value > endDate.Value)
                {
                    pnlStatus.Visible = true;
                    litStatus.Text    = language.GetString("MessageStartDateAfterEndDate");
                }
                else
                {
                    dataObjectEvent.Title       = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                    dataObjectEvent.Description = Common.Extensions.StripHTMLTags(this.TxtDesc.Text).CropString(20000);
                    dataObjectEvent.Content     =
                        TxtText.Text.StripHTMLTags().Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "<br/>");
                    dataObjectEvent.Copyright = 0;
                    dataObjectEvent.StartDate = startDate.Value;
                    dataObjectEvent.EndDate   = endDate.HasValue ? endDate.Value : startDate.Value;
                    if (dataObjectEvent.StartDate == dataObjectEvent.EndDate)
                    {
                        dataObjectEvent.Featured = 1;
                    }
                    else
                    {
                        dataObjectEvent.Featured = 2;
                    }
                    dataObjectEvent.Time     = Common.Extensions.StripHTMLTags(this.TxtTime.Text);
                    dataObjectEvent.Price    = Common.Extensions.StripHTMLTags(this.TxtPrice.Text);
                    dataObjectEvent.Age      = Common.Extensions.StripHTMLTags(this.TxtAge.Text);
                    dataObjectEvent.TagList  = string.Join(",", tags.ToArray());
                    dataObjectEvent.Geo_Lat  = double.MinValue;
                    dataObjectEvent.Geo_Long = double.MinValue;

                    if (objectExisting)
                    {
                        dataObjectEvent.Update(UserDataContext.GetUserDataContext());
                    }
                    else
                    {
                        dataObjectEvent.Insert(UserDataContext.GetUserDataContext());
                    }

                    if (DdlLocations.SelectedValue.IsGuid())
                    {
                        DataObjectLocation location =
                            DataObject.Load <DataObjectLocation>(DdlLocations.SelectedValue.ToGuid());
                        if (location.Geo_Lat != Double.MinValue && location.Geo_Long != Double.MinValue)
                        {
                            dataObjectEvent.Geo_Lat  = location.Geo_Lat;
                            dataObjectEvent.Geo_Long = location.Geo_Long;
                        }
                        DataObject.RelDelete(new RelationParams()
                        {
                            Udc = UserDataContext.GetUserDataContext(),
                            ParentObjectType = location.ObjectType,
                            ChildObjectID    = dataObjectEvent.ObjectID,
                            ChildObjectType  = dataObjectEvent.ObjectType
                        });
                        DataObject.RelInsert(new RelationParams()
                        {
                            Udc              = UserDataContext.GetUserDataContext(),
                            ParentObjectID   = location.ObjectID,
                            ParentObjectType = location.ObjectType,
                            ChildObjectID    = dataObjectEvent.ObjectID,
                            ChildObjectType  = dataObjectEvent.ObjectType
                        }, 0);
                    }
                    dataObjectEvent.Update(UserDataContext.GetUserDataContext());

                    return(true);
                }
            }
            catch (Exception e)
            {
                pnlStatus.Visible = true;
                litStatus.Text    = "Event konnte nicht gespeichert werden: " + e.Message;
            }
            return(false);
        }
示例#11
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            DdlLocations.DataTextField  = "Title";
            DdlLocations.DataValueField = "ObjectID";
            DdlLocations.DataSource     = DataObjects.Load <DataObjectLocation>(new QuickParameters()
            {
                Udc           = UserDataContext.GetUserDataContext(),
                SortBy        = QuickSort.Title,
                Direction     = QuickSortDirection.Asc,
                DisablePaging = true,
                IgnoreCache   = true
            });
            DdlLocations.DataBind();

            foreach (string i in Enum.GetNames(typeof(EventType)))
            {
                string key  = string.Format("Text{0}", i);
                string text = languageShared.GetString(key);
                if (!string.IsNullOrEmpty(text))
                {
                    ListItem item = new ListItem(text, i);
                    CblType.Items.Add(item);
                }
            }

            dataObjectEvent = DataObject.Load <DataObjectEvent>(Request.QueryString["OID"].ToNullableGuid());
            if (dataObjectEvent.State == ObjectState.Added)
            {
                LitTitle.Text               = language.GetString("LabelAddEvent");
                lbtnSave.Text               = languageShared.GetString("CommandCreate");
                objectExisting              = false;
                dataObjectEvent.ObjectID    = Guid.NewGuid();
                dataObjectEvent.CommunityID = UserProfile.Current.ProfileCommunityID;
                dataObjectEvent.ShowState   = ObjectShowState.Published;
                dataObjectEvent.Status      = ObjectStatus.Public;
            }
            else
            {
                LitTitle.Text = language.GetString("LabelEditEvent");
                lbtnSave.Text = languageShared.GetString("CommandSave");
                TxtTitle.Text = dataObjectEvent.Title;
                TxtDesc.Text  = dataObjectEvent.Description;
                if (!string.IsNullOrEmpty(dataObjectEvent.Content))
                {
                    TxtText.Text = dataObjectEvent.Content.Replace("<br/>", Environment.NewLine);
                }
                TxtStartDate.Text = dataObjectEvent.StartDate.ToString("dd.MM.yyyy");
                TxtEndDate.Text   = dataObjectEvent.EndDate.ToString("dd.MM.yyyy");
                TxtTime.Text      = dataObjectEvent.Time;
                TxtAge.Text       = dataObjectEvent.Age;
                TxtPrice.Text     = dataObjectEvent.Price;

                DataObjectLocation currentLocation = DataObjects.Load <DataObjectLocation>(new QuickParameters()
                {
                    Udc            = UserDataContext.GetUserDataContext(),
                    DisablePaging  = true,
                    IgnoreCache    = true,
                    RelationParams = new RelationParams()
                    {
                        ChildObjectID = dataObjectEvent.ObjectID
                    }
                }).SingleOrDefault();
                if (currentLocation != null)
                {
                    DdlLocations.SelectedValue = currentLocation.ObjectID.ToString();
                }

                foreach (ListItem item in CblType.Items)
                {
                    item.Selected = dataObjectEvent.TagList.Contains(item.Value);
                }
            }
        }