Esempio n. 1
0
        protected void ram1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.Argument))
            {
                string[] arrNote = e.Argument.Split('|');
                if (arrNote.Length > 0 && arrNote[0] == "S")
                { //SAVE
                    bool      isNew = false;
                    PhotoNote item;
                    if (arrNote[1] == "-1")
                    {
                        item  = picture.Notes.AddNode(udc, udc.UserID, udc.Nickname);
                        isNew = true;
                    }
                    else
                    {
                        item = picture.Notes.ItemByID(arrNote[1]);
                    }

                    if (item != null)
                    {
                        item.Text    = arrNote[2];
                        item.WhoIsID = arrNote[3];
                        item.WhoIs   = arrNote[4];
                        item.Left    = int.Parse(arrNote[8]);
                        item.Top     = int.Parse(arrNote[9]);
                        item.Width   = int.Parse(arrNote[10]);
                        item.Height  = int.Parse(arrNote[11]);
                        if (arrNote[7] == "2")
                        {
                            item.Public = true;
                        }
                        picture.Update(UserDataContext.GetUserDataContext());
                        if (isNew)
                        {
                            UserActivities.InsertAnotatedObject(udc, picture.ObjectID.Value);
                        }
                    }
                }
                else if (arrNote.Length > 0 && arrNote[0] == "D")
                {
                    picture.Notes.RemoveNode(arrNote[1]);
                    picture.Update(UserDataContext.GetUserDataContext());
                }

                btnHide.Visible = (picture.Notes.Count > 0);
                btnShow.Visible = (picture.Notes.Count > 0);
            }
        }
Esempio n. 2
0
        public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString)
        {
            try
            {
                picture.Title            = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                picture.Description      = Common.Extensions.StripHTMLTags(this.TxtDesc.Text).CropString(20000);
                picture.TagList          = Common.Extensions.StripHTMLTags(this.TxtTagWords.Text);
                picture.Status           = (ObjectStatus)Enum.Parse(typeof(ObjectStatus), this.HFStatus.Value);
                picture.ShowState        = (ObjectShowState)Enum.Parse(typeof(ObjectShowState), this.HFShowState.Value);
                picture.FriendVisibility = (FriendType)Enum.Parse(typeof(FriendType), this.HFFriendType.Value);
                picture.Copyright        = int.Parse(this.HFCopyright.Value);
                double geoLat;
                if (double.TryParse(this.TxtGeoLat.Text, out geoLat))
                {
                    picture.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.TxtGeoLong.Text, out geoLong))
                {
                    picture.Geo_Long = geoLong;
                }
                picture.Zip         = this.HFZip.Value;
                picture.City        = this.HFCity.Value;
                picture.Street      = this.HFStreet.Value;
                picture.CountryCode = this.HFCountry.Value;

                picture.Update(UserDataContext.GetUserDataContext());

                return(true);
            }
            catch (Exception ex)
            {
                this.LitMsg.Text = string.Format("{0}: ", language.GetString("MessageSaveError")) + ex.Message;
                return(false);
            }
        }