/// <summary>
        /// Handles Drop Event for setting the Avatar photo.
        /// </summary>
        private void AvatarPhoto_Drop(object sender, DragEventArgs e)
        {
            string[] fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];

            if (fileNames.Length > 0)
            {
                Photo photo = new Photo(fileNames[0]);
                if (App.patient != null && App.patient.Photos != null)
                {
                    // Set IsAvatar to false for the existing photos
                    foreach (Photo existingPhoto in App.patient.Photos)
                    {
                        existingPhoto.IsAvatar = false;
                    }

                    // Make the dropped photo the  avatar photo
                    photo.IsAvatar = true;

                    // Add the avatar photo to the person photos
                    App.patient.Photos.Add(photo);

                    // Bitmap image for the avatar
                    BitmapImage bitmap = new BitmapImage(new Uri(photo.FullyQualifiedPath));

                    // Use BitmapCacheOption.OnLoad to prevent binding the source holding on to the photo file.
                    bitmap.CacheOption = BitmapCacheOption.OnLoad;

                    // Show the avatar
                    AvatarPhoto.Source = bitmap;
                }
            }

            // Mark the event as handled, so the control's native Drop handler is not called.
            e.Handled = true;
        }
Example #2
0
 //
 // GET: /Photo/Create
 public ActionResult Create()
 {
     // return View();
     Photo newPhoto = new Photo();
     newPhoto.CreatedDate = DateTime.Today;
     return View("Create", newPhoto);
 }
 public PhotoRequestedArgs(string user, IPAddress host, Database db, Photo photo)
 {
     this.user = user;
     this.host = host;
     this.db = db;
     this.photo = photo;
 }
		//FIXME: Won't work on non-file uris
		void WriteMetadataToImage (Photo photo)
		{
			string path = photo.DefaultVersionUri.LocalPath;
	
			using (FSpot.ImageFile img = FSpot.ImageFile.Create (photo.DefaultVersionUri)) {
				if (img is FSpot.JpegFile) {
					FSpot.JpegFile jimg = img as FSpot.JpegFile;
				
					jimg.SetDescription (photo.Description);
					jimg.SetDateTimeOriginal (photo.Time.ToLocalTime ());
					jimg.SetXmp (UpdateXmp (photo, jimg.Header.GetXmp ()));
	
					jimg.SaveMetaData (path);
				} else if (img is FSpot.Png.PngFile) {
					FSpot.Png.PngFile png = img as FSpot.Png.PngFile;
				
					if (img.Description != photo.Description)
						png.SetDescription (photo.Description);
				
					png.SetXmp (UpdateXmp (photo, png.GetXmp ()));
	
					png.Save (path);
				}
			}
		}
 public void Wykonaj(Photo.Zdjecie z, System.Collections.Generic.Stack<object> Argumenty)
 {
     if (z.Zaznaczenie.IsEmpty)
     {
         Photo.BitmapFilter.Sharpen(z.Duze, 10);
     }
     else
     {
         if (z.Zaznaczenie.Width < 0)
         {
             z.Zaznaczenie.X += z.Zaznaczenie.Width;
             z.Zaznaczenie.Width *= -1;
         }
         if (z.Zaznaczenie.Height < 0)
         {
             z.Zaznaczenie.Y += z.Zaznaczenie.Height;
             z.Zaznaczenie.Height *= -1;
         }
         Bitmap sharpened = new Bitmap(Math.Abs(z.Zaznaczenie.Width), Math.Abs(z.Zaznaczenie.Height), z.Duze.PixelFormat);
         Graphics g = Graphics.FromImage(sharpened);
         g.DrawImage(z.Duze, new Rectangle(0, 0, sharpened.Width, sharpened.Height), z.Zaznaczenie, GraphicsUnit.Pixel);
         g.Dispose();
         Photo.BitmapFilter.Sharpen(sharpened, 10);
         g = Graphics.FromImage(z.Duze);
         g.DrawImage(sharpened, z.Zaznaczenie);
         g.Dispose();
     }
 }
	public void Populate (Photo [] photos) {
		Hashtable hash = new Hashtable ();
		if (photos != null) {
			foreach (Photo p in photos) {
				foreach (Tag t in p.Tags) {
					if (!hash.Contains (t.Id)) {
						hash.Add (t.Id, t);
					}
				}
			}
		}

		foreach (Widget w in this.Children) {
			w.Destroy ();
		}
		
		if (hash.Count == 0) {
			/* Fixme this should really set parent menu
			   items insensitve */
			MenuItem item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Tags)"));
			this.Append (item);
			item.Sensitive = false;
			item.ShowAll ();
			return;
		}

		foreach (Tag t in hash.Values) {
			TagMenuItem item = new TagMenuItem (t);
			this.Append (item);
			item.ShowAll ();
			item.Activated += HandleActivate;
		}
				
	}
		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Photo photo = null;
			if ( json != null && !json.IsNull )
			{
				photo = new Photo();
				photo.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id"      ) : String.Empty;
				photo.Name        = json.ContainsName("name"        ) ? json.GetValue<string>("name"    ) : String.Empty;
				photo.Icon        = json.ContainsName("icon"        ) ? json.GetValue<string>("icon"    ) : String.Empty;
				photo.Picture     = json.ContainsName("picture"     ) ? json.GetValue<string>("picture" ) : String.Empty;
				photo.Source      = json.ContainsName("source"      ) ? json.GetValue<string>("source"  ) : String.Empty;
				photo.Height      = json.ContainsName("height"      ) ? json.GetValue<int   >("height"  ) : 0;
				photo.Width       = json.ContainsName("width"       ) ? json.GetValue<int   >("width"   ) : 0;
				photo.Link        = json.ContainsName("link"        ) ? json.GetValue<string>("link"    ) : String.Empty;
				photo.Position    = json.ContainsName("position"    ) ? json.GetValue<int   >("position") : 0;
				photo.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				photo.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				
				photo.From        = mapper.Deserialize<Reference>(json.GetValue("from" ));
				photo.Place       = mapper.Deserialize<Page     >(json.GetValue("place"));
				photo.Tags        = mapper.Deserialize<List<Tag>>(json.GetValue("tags" ));
				photo.Images      = mapper.Deserialize<List<Photo.Image>>(json.GetValue("images"));
				if ( photo.Images != null )
				{
					int i = 0;
					if ( photo.Images.Count >= 5 ) photo.OversizedImage = photo.Images[i++];
					if ( photo.Images.Count >= 1 ) photo.SourceImage    = photo.Images[i++];
					if ( photo.Images.Count >= 2 ) photo.AlbumImage     = photo.Images[i++];
					if ( photo.Images.Count >= 3 ) photo.SmallImage     = photo.Images[i++];
					if ( photo.Images.Count >= 4 ) photo.TinyImage      = photo.Images[i++];
				}
			}
			return photo;
		}
	public void Upload (Photo photo, string gallery)
	{
		if (login == null || passwd == null)
			throw new Exception ("Must Login First");

		string path = string.Format ("/{0}/{1}/", login, gallery);
		
		FormClient client = new FormClient (cookies);
		client.SuppressCookiePath = true;
		client.Add ("cmd", "uploadns1");
		client.Add ("start", System.Web.HttpUtility.UrlEncode (path));
		client.Add ("photo", new FileInfo (photo.DefaultVersionUri.LocalPath));
		client.Add ("desc", photo.Description);
		if (photo.Tags != null) {
			StringBuilder taglist = new StringBuilder ();

			foreach (Tag t in photo.Tags) {
				taglist.Append (t.Name + " ");
			}
			
			client.Add ("keywords", taglist.ToString ());
		}

		string upload_url = UploadBaseUrl + path + "?";

		Stream response = client.Submit (upload_url).GetResponseStream ();
		StreamReader reader = new StreamReader (response, Encoding.UTF8);

		Console.WriteLine (reader.ReadToEnd ());
	}
		public VersionNameRequest (RequestType request_type, Photo photo, Gtk.Window parent_window) : base ("version_name_dialog")
		{
			this.request_type = request_type;
			this.photo = photo;

			switch (request_type) {
			case RequestType.Create:
				this.Dialog.Title = Catalog.GetString ("Create New Version");
				prompt_label.Text = Catalog.GetString ("Name:");
				break;

			case RequestType.Rename:
				this.Dialog.Title = Catalog.GetString ("Rename Version");
				prompt_label.Text = Catalog.GetString ("New name:");
				version_name_entry.Text = photo.GetVersion (photo.DefaultVersionId).Name;
				version_name_entry.SelectRegion (0, -1);
				break;
			}

			version_name_entry.ActivatesDefault = true;

			this.Dialog.TransientFor = parent_window;
			this.Dialog.DefaultResponse = ResponseType.Ok;

			Update ();
		}
Example #10
0
 public void SetPhoto(Photo p)
 {
     if (photo != null) photo.PropertyChanged -= new PropertyChangedEventHandler(photo_PropertyChanged);
     photo = p;
     if (photo != null) photo.PropertyChanged += new PropertyChangedEventHandler(photo_PropertyChanged);
     ShowImage();
 }
	public bool Execute (Photo [] photos)
	{
		ProgressDialog progress_dialog = null;

		if (photos.Length > 1) {
			progress_dialog = new ProgressDialog ("Updating Thumbnails",
							      ProgressDialog.CancelButtonType.Stop,
							      photos.Length, parent_window);
		}

		int count = 0;
		foreach (Photo p in photos) {
			if (progress_dialog != null
			    && progress_dialog.Update (String.Format ("Updating picture \"{0}\"", p.Name)))
				break;

			foreach (uint version_id in p.VersionIds) {
				Gdk.Pixbuf thumb = FSpot.ThumbnailGenerator.Create (p.VersionUri (version_id));
				if (thumb !=  null)
					thumb.Dispose ();
			}
			
			count++;
		}

		if (progress_dialog != null)
			progress_dialog.Destroy ();

		return true;
	}
        public override Photo VisitPhoto(Photo photo, AnalyzerExecutionContext executionContext)
        {
            var tag = photo.Tag(Constants.Namespace, Constants.HashMetadataKey);

            if (tag != null)
            {
                List<Photo> list = null;

                if (_cache.ContainsKey(tag.Value))
                {
                    list = _cache[tag.Value];
                }
                else
                {
                    list = new List<Photo>();
                    _cache.Add(tag.Value, list);
                }

                list.Add(photo);

                if (list.Count == 2)
                {
                    var activity = new ResolveDuplicateActivity(list);

                    _currentFolderDuplicates.Add(activity);
                }
            }

            return photo;
        }
Example #13
0
        public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
        {
            VersionNameRequest request = new VersionNameRequest (VersionNameRequest.RequestType.Create,
                                         photo, parent_window);

            string name;
            ResponseType response = request.Run (out name);

            if (response != ResponseType.Ok)
                return false;

            try {
                photo.DefaultVersionId = photo.CreateVersion (name, photo.DefaultVersionId, true);
                store.Commit (photo);
            } catch (Exception e) {
                    string msg = Catalog.GetString ("Could not create a new version");
                    string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to create version \"{1}\""),
                                     e.Message, name);

                    HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent,
                                            Gtk.MessageType.Error, ButtonsType.Ok,
                                            msg,
                                            desc);
                    md.Run ();
                    md.Destroy ();
                    return false;
            }

            return true;
        }
Example #14
0
 internal static Db.Photo ConvertToDatabase(Photo dmn, Db.Photo db)
 {
     CvrtPhoto domain = new CvrtPhoto(dmn);
     db.Url = domain.Url;
     db.Description = domain.Description;
     return db;
 }
Example #15
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            // Create a new person with the specified inputs
            Person newPerson = new Person(FirstNameInputTextBox.Text, LastNameInputTextBox.Text);

            // Setup the properties based on the input
            newPerson.Gender = ((bool)MaleRadioButton.IsChecked) ? Gender.Male : Gender.Female;
            newPerson.BirthPlace = BirthPlaceInputTextBox.Text;
            newPerson.IsLiving = true;

            DateTime birthdate = App.StringToDate(BirthDateInputTextBox.Text);
            if (birthdate != DateTime.MinValue)
                newPerson.BirthDate = birthdate;

            // Setup the avatar photo
            if (!string.IsNullOrEmpty(avatarPhotoPath))
            {
                Photo photo = new Photo(avatarPhotoPath);
                photo.IsAvatar = true;

                // Add the avatar photo to the person photos
                newPerson.Photos.Add(photo);
            }

            family.Current = newPerson;
            family.Add(newPerson);

            family.OnContentChanged();

            RaiseEvent(new RoutedEventArgs(AddButtonClickEvent));
        }
Example #16
0
    // The job of the PhotoRecorder is to create parameters for Photo objects.
    // Rendering of Photo objects can then be performed by PhotoVisualiser.
    public Photo buildNewPhotoData(int para_questGiverID,
	                                 				int para_activityOwnerID,
	                                 				ApplicationID para_activityKey,
	                                 				int para_langAreaID,
	                                 				int para_difficultyIndex)
    {
        // The photo will fall under the quest giver's album.
        GhostbookManagerLight gbMang = GhostbookManagerLight.getInstance();
        //IGBDifficultyReference diffRefMat = gbMang.getDifficultyReferenceMaterial();

        // Extract player avatar details.
        GameObject poRef = PersistentObjMang.getInstance();
        DatastoreScript ds = poRef.GetComponent<DatastoreScript>();
        PlayerAvatarSettings playerAvSettings = (PlayerAvatarSettings) ds.getData("PlayerAvatarSettings");

        // Add background randomisation when assets become available.
        int backgroundID = Random.Range(0,2);

        // Get difficulty name.
        string diffName = gbMang.createDifficultyShortDescription(para_langAreaID,para_difficultyIndex);
        if(diffName == null) { diffName = "N/A"; }

        Photo nwPhoto = new Photo(para_activityKey,
                                  				  backgroundID,
                                  				  new PhotoCharacterElement(para_questGiverID,Random.Range(1,4),null),
                                                  new PhotoCharacterElement(para_activityOwnerID,Random.Range(1,4),null),
                                                  playerAvSettings,
                                  				  Random.Range(1,4),
                                                  diffName,
                                                  null);

        return nwPhoto;
    }
	public PhotoVersionMenu (Photo photo)
	{
		version_id = photo.DefaultVersionId;

		uint [] version_ids = photo.VersionIds;
		item_infos = new MenuItemInfo [version_ids.Length];

		int i = 0;
		foreach (uint id in version_ids) {
			MenuItem menu_item = new MenuItem (photo.GetVersionName (id));
			menu_item.Show ();
			menu_item.Sensitive = true;
			menu_item.Activated += new EventHandler (HandleMenuItemActivated);

			item_infos [i ++] = new MenuItemInfo (menu_item, id);

			Append (menu_item);
		}

		if (version_ids.Length == 1) {
			MenuItem no_edits_menu_item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Edits)"));
			no_edits_menu_item.Show ();
			no_edits_menu_item.Sensitive = false;
			Append (no_edits_menu_item);
		}
	}
    protected void Page_Load(object sender, EventArgs e)
    {
        user = Membership.GetUser();
        if (user != null)
            userName = user.UserName;

        if (Request.Params.AllKeys.Contains<string>("id"))
        {

            photoId = int.Parse(Request.Params.Get("id"));
            try
            {
                photo = new Photo(photoId);
                album = photo.getAlbum();
                photoUrl = "Photos/" + photo.getId() + ".jpg";
                comments = photo.getComments();
            }
            catch (Exception ex)
            {
                Response.Redirect("Default.aspx");
            }

        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Product.ProductPhotos.Any())
     {
         var mainOffer = Product.Offers.FirstOrDefault(item => item.Main);
         if (mainOffer != null )
         {
             if (mainOffer.ColorID != null)
             {
                MainPhoto = Product.ProductPhotos.FirstOrDefault(item => item.ColorID == mainOffer.ColorID) ??
                             Product.ProductPhotos.OrderBy(item => item.Main).ThenBy(item => item.PhotoSortOrder)
                                    .FirstOrDefault() ?? new Photo(0, Product.ProductId, PhotoType.Product);
             }
             else
             {
                 MainPhoto = Product.ProductPhotos.FirstOrDefault(item => item.Main) ?? new Photo(0, Product.ProductId, PhotoType.Product);
             }
         }
         else
         {
             MainPhoto = new Photo(0, Product.ProductId, PhotoType.Product);
         }
     }
     else
     {
     MainPhoto = new Photo(0, Product.ProductId, PhotoType.Product);
     }
 }
		public void UpdateFromSelection (Photo [] sel)
		{
			Hashtable taghash = new Hashtable ();
	
			for (int i = 0; i < sel.Length; i++) {
				foreach (Tag tag in sel [i].Tags) {
					int count = 1;
	
					if (taghash.Contains (tag))
						count = ((int) taghash [tag]) + 1;
	
					if (count <= i)
						taghash.Remove (tag);
					else 
						taghash [tag] = count;
				}
				
				if (taghash.Count == 0)
					break;
			}
	
			selected_photos_tagnames = new ArrayList ();
			foreach (Tag tag in taghash.Keys)
				if ((int) (taghash [tag]) == sel.Length)
					selected_photos_tagnames.Add (tag.Name);
	
			Update ();
		}
        public int Add(Photo newPhoto)
        {
            this.photos.Add(newPhoto);
            this.photos.Save();

            return newPhoto.Id;
        }
Example #22
0
        public ActionResult Create(Photo photo, HttpPostedFileBase image)
        {
            photo.CreatedDate = DateTime.Today;
            if (ModelState.IsValid)

            {
                if(image != null)
                {
                    photo.ImageMimeType = image.ContentType;
                    photo.PhotoFile = new byte[image.ContentLength];
                    image.InputStream.Read(photo.PhotoFile, 0, image.ContentLength);
                    string stringlonglat = CheckLocaiton("India");
                    if(stringlonglat.StartsWith("Success"))
                    {
                        char[] splitChars = { ':' };
                        string[] coordinates = stringlonglat.Split(splitChars);

                    }

                }
                db.Add<Photo>(photo);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View("Create", photo);
        }
    static void Main()
    {
        // Application.Run acts as a simple client
        Photo photo;
        TaggedPhoto foodTaggedPhoto, colorTaggedPhoto, tag;
        BorderedPhoto composition;

        // Compose a photo with two TaggedPhotos and a blue BorderedPhoto
        photo = new Photo();
        foodTaggedPhoto = new TaggedPhoto(photo, "Food");
        colorTaggedPhoto = new TaggedPhoto(foodTaggedPhoto, "Yellow");
        Application.Run(colorTaggedPhoto);
        Console.WriteLine(colorTaggedPhoto.ListTaggedPhotos());

        // Compose a photo with one TaggedPhoto and a yellow BorderedPhoto
        photo = new Photo();
        composition = new BorderedPhoto(photo, Color.Yellow);
        Application.Run(composition);

        // Compose a Hominid with one TaggedPhoto hominid and a yellow BorderedPhoto hominid
        var hominid = new Hominid();
        tag = new TaggedPhoto(hominid, "Shocked!");
        Application.Run(tag);
        Console.WriteLine(tag.ListTaggedPhotos());
    }
	//a now deprecated method to get a single comment for a photo
	public string getPhotoComment(Photo p) { 
		//Photo p = new Photo ();
		p.load ();

		if (p.comments.Count == 0) {
			return "";
		} else return p.comments[0];
	}
Example #25
0
 /*public void setLongName(string name){
     longPageName = name;
 }*/
 public void addPhoto(Photo para_photo, int para_stickPosition)
 {
     if(para_photo != null)
     {
         if(photoCollection == null) { photoCollection = new Dictionary<int, Photo>(); }
         photoCollection.Add(para_stickPosition,para_photo);
     }
 }
        public bool UpdatePhoto(string propertyReference, string photoReference, Photo photo)
        {
            var result = _photoService.UpdatePhoto(propertyReference, photoReference, photo);

            //Do not re auto advertise here as this method is called too much when reordering photos and the auto advertsise takes too long

            return result;
        }
Example #27
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            Image image;
            try
            {
                image = Image.FromStream
                    (ufPhoto.PostedFile.InputStream);
            }
            catch
            {
                lblError.Text = Lang.Trans("Invalid image!");
                return;
            }

            Photo photo;

            if (Session["temp_photo"] == null)
                photo = new Photo();
            else
                photo = (Photo)Session["temp_photo"];

            if (image.Height < Config.Photos.PhotoMinHeight
                || image.Width < Config.Photos.PhotoMinWidth)
            {
                lblError.Text = Lang.Trans("The photo is too small!");
                return;
            }

            photo.Image = image;

            string tempFileName;

            if (!Misc.GetTempFileName(out tempFileName))
                tempFileName = Path.GetTempFileName();

            photo.Image.Save(tempFileName);
            Session["temp_photo_fileName"] = tempFileName;

            if (Config.Photos.AutoApprovePhotos
                || CurrentUserSession.BillingPlanOptions.AutoApprovePhotos.Value
                || CurrentUserSession.Level != null && CurrentUserSession.Level.Restrictions.AutoApprovePhotos)
            {
                photo.Approved = true;
            }
            else
            {
                photo.Approved = false;
            }

            photo.ExplicitPhoto = false;
            chkPrivatePhoto.Enabled = true;

            photo.Image = null;
            Session["temp_photo"] = photo;

            divImageRotateControls.Visible = true;
        }
		public PhotoVersion (Photo photo, uint version_id, System.Uri uri, string md5_sum, string name, bool is_protected)
		{
			this.photo = photo;
			this.version_id = version_id;
			this.uri = uri;
			this.md5_sum = md5_sum;
			this.name = name;
			this.is_protected = is_protected;
		}
Example #29
0
 public void WidthTest()
 {
     Photo target = new Photo();
     int expected = 5; // TODO: Initialize to an appropriate value
     int actual;
     target.Width = expected;
     actual = target.Width;
     Assert.AreEqual(expected, actual);
 }
 public void AddImageToGrid(Photo i_PhotoToAdd)
 {
     PictureBox currentPhotoBox = new PictureBox();
     currentPhotoBox.Image = i_PhotoToAdd.ImageThumb;
     currentPhotoBox.Name = i_PhotoToAdd.PictureNormalURL;
     
     currentPhotoBox.Click += new System.EventHandler(pictureBox_Click);
     imagesFlowLayoutPanel.Controls.Add(currentPhotoBox);
 }
Example #31
0
 public int GetAmount(Photo i_Photo)
 {
     return(i_Photo.LikedBy.Count);
 }
 public PhotoAddOrUpdateResponseDto(Photo entity)
     : base(entity)
 {
 }
Example #33
0
 public bool CompareBySorter(Photo i_Photo1, Photo i_Photo2)
 {
     return(i_Photo1.LikedBy.Count > i_Photo2.LikedBy.Count);
 }
Example #34
0
 public PhotoViewModel(Photo photo)
 {
     PhotoId  = photo.PhotoId;
     ImageUrl = photo.ImageUrl;
 }
Example #35
0
 public BaseFilterTest()
 {
     originalPicture = new Photo(1, 1);
     resultPicture   = new Photo(originalPicture.Width, originalPicture.Height);
 }
 /// <summary>
 /// Action to take when a photo has been selected
 /// </summary>
 /// <param name="photo">The photo.</param>
 private void OnPhotoSelected(Photo photo)
 {
     _navigationFacade.NavigateToPhotoDetailsView(photo);
 }
Example #37
0
 private bool CacheFileExists(Photo existingPhoto)
 {
     return(File.Exists(Path.Combine(_configService.DynamicConfig.CacheFolder, existingPhoto.CacheFolder, "Thumb", existingPhoto.FileName)));
 }
Example #38
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Patient;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (ActiveElement != null)
                {
                    dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopy();
                }
                if (Name != null)
                {
                    dest.Name = new List <Hl7.Fhir.Model.HumanName>(Name.DeepCopy());
                }
                if (Telecom != null)
                {
                    dest.Telecom = new List <Hl7.Fhir.Model.ContactPoint>(Telecom.DeepCopy());
                }
                if (GenderElement != null)
                {
                    dest.GenderElement = (Code <Hl7.Fhir.Model.AdministrativeGender>)GenderElement.DeepCopy();
                }
                if (BirthDateElement != null)
                {
                    dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopy();
                }
                if (Deceased != null)
                {
                    dest.Deceased = (Hl7.Fhir.Model.Element)Deceased.DeepCopy();
                }
                if (Address != null)
                {
                    dest.Address = new List <Hl7.Fhir.Model.Address>(Address.DeepCopy());
                }
                if (MaritalStatus != null)
                {
                    dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)MaritalStatus.DeepCopy();
                }
                if (MultipleBirth != null)
                {
                    dest.MultipleBirth = (Hl7.Fhir.Model.Element)MultipleBirth.DeepCopy();
                }
                if (Photo != null)
                {
                    dest.Photo = new List <Hl7.Fhir.Model.Attachment>(Photo.DeepCopy());
                }
                if (Contact != null)
                {
                    dest.Contact = new List <Hl7.Fhir.Model.Patient.ContactComponent>(Contact.DeepCopy());
                }
                if (Animal != null)
                {
                    dest.Animal = (Hl7.Fhir.Model.Patient.AnimalComponent)Animal.DeepCopy();
                }
                if (Communication != null)
                {
                    dest.Communication = new List <Hl7.Fhir.Model.Patient.CommunicationComponent>(Communication.DeepCopy());
                }
                if (CareProvider != null)
                {
                    dest.CareProvider = new List <Hl7.Fhir.Model.ResourceReference>(CareProvider.DeepCopy());
                }
                if (ManagingOrganization != null)
                {
                    dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopy();
                }
                if (Link != null)
                {
                    dest.Link = new List <Hl7.Fhir.Model.Patient.LinkComponent>(Link.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Example #39
0
        private void SendDocument(Photo d)
        {
            //create thumb
            var bytes = d.PreviewBytes;

            if (!CheckDocumentSize((ulong)d.Bytes.Length))
            {
                MessageBox.Show(string.Format(AppResources.MaximumFileSizeExceeded, MediaSizeConverter.Convert((int)Telegram.Api.Constants.MaximumUploadedFileSize)), AppResources.Error, MessageBoxButton.OK);
                return;
            }

            var volumeId = TLLong.Random();
            var localId  = TLInt.Random();
            var secret   = TLLong.Random();

            var thumbLocation = new TLFileLocation //TODO: replace with TLFileLocationUnavailable
            {
                DCId     = new TLInt(0),
                VolumeId = volumeId,
                LocalId  = localId,
                Secret   = secret,
                //Buffer = bytes
            };

            var fileName = String.Format("{0}_{1}_{2}.jpg",
                                         thumbLocation.VolumeId,
                                         thumbLocation.LocalId,
                                         thumbLocation.Secret);

            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (var fileStream = store.CreateFile(fileName))
                {
                    fileStream.Write(bytes, 0, bytes.Length);
                }
            }

            var thumbSize = new TLPhotoSize
            {
                W        = new TLInt(d.Width),
                H        = new TLInt(d.Height),
                Size     = new TLInt(bytes.Length),
                Type     = new TLString(""),
                Location = thumbLocation,
            };

            //create document
            var document = new TLDocument22
            {
                Buffer = d.Bytes,

                Id         = new TLLong(0),
                AccessHash = new TLLong(0),
                Date       = TLUtils.DateToUniversalTimeTLInt(MTProtoService.ClientTicksDelta, DateTime.Now),
                FileName   = new TLString(Path.GetFileName(d.FileName)),
                MimeType   = new TLString("image/jpeg"),
                Size       = new TLInt(d.Bytes.Length),
                Thumb      = thumbSize,
                DCId       = new TLInt(0)
            };

            var media = new TLMessageMediaDocument {
                FileId = TLLong.Random(), Document = document
            };

            var message = GetMessage(TLString.Empty, media);

            BeginOnUIThread(() =>
            {
                var previousMessage = InsertSendingMessage(message);
                IsEmptyDialog       = Items.Count == 0 && LazyItems.Count == 0;

                BeginOnThreadPool(() =>
                                  CacheService.SyncSendingMessage(
                                      message, previousMessage,
                                      TLUtils.InputPeerToPeer(Peer, StateService.CurrentUserId),
                                      m => SendDocumentInternal(message, null)));
            });
        }
Example #40
0
 public GalleryPhoto(IProtoService protoService, Photo photo, string caption)
     : base(protoService)
 {
     _photo   = photo;
     _caption = caption;
 }
 public Task <int> DeletePhotoAsync(Photo photo, CancellationToken cancellationToken)
 {
     return(Task.Factory.StartNew(() => 1));
 }
Example #42
0
 public GalleryPhoto(IProtoService protoService, Photo photo)
     : base(protoService)
 {
     _photo = photo;
 }
        public Photo Process(Photo original, double[] values)
        {
            var parameters = handler.CreateParams(values);

            return(Process(original, parameters));
        }
 public abstract Photo Process(Photo original, TParams parameters);
Example #45
0
 public async Task Insert(Photo photo)
 {
     await objDb.Insert(photo);
 }
Example #46
0
 public DescriptivePhoto(Photo i_Photo, Size i_PicBoxSize) : base(i_PicBoxSize, i_Photo.PictureNormalURL)
 {
     r_PhotoMessage = i_Photo.CreatedTime == null ? k_NoDescriptionMessage : string.Format("{0}{1}", k_CreatedOnString, i_Photo.CreatedTime.ToString());
     SetDescriptionText(string.Empty);
 }
Example #47
0
 public async Task Update(Photo photo)
 {
     await objDb.Update(photo);
 }
Example #48
0
        public void Update()
        {
            if (!Visible || TemporarilyHidden)
            {
                return;
            }
            ShowInstructionalButtons();
            Function.Call(Hash.HIDE_HUD_AND_RADAR_THIS_FRAME);
            Function.Call(Hash._SHOW_CURSOR_THIS_FRAME);


            var res  = UIMenu.GetScreenResolutionMaintainRatio();
            var safe = new PointF(300, 180);

            if (!HideTabs)
            {
                new UIResText(Title, new PointF(safe.X, safe.Y - 80), 1f, UnknownColors.White, Font.ChaletComprimeCologne,
                              UIResText.Alignment.Left)
                {
                    DropShadow = true,
                }.Draw();

                if (Photo == null)
                {
                    new Sprite("char_multiplayer", "char_multiplayer",
                               new PointF((int)res.Width - safe.X - 64, safe.Y - 80), new SizeF(64, 64)).Draw();
                }
                else
                {
                    Photo.Position = new PointF((int)res.Width - safe.X - 100, safe.Y - 80);
                    Photo.Size     = new SizeF(64, 64);
                    Photo.Draw();
                }

                new UIResText(Name, new PointF((int)res.Width - safe.X - 70, safe.Y - 95), 0.7f, UnknownColors.White,
                              Font.ChaletComprimeCologne, UIResText.Alignment.Right)
                {
                    DropShadow = true,
                }.Draw();

                string t = Money;
                if (string.IsNullOrEmpty(Money))
                {
                    t = DateTime.Now.ToString();
                }


                new UIResText(t, new PointF((int)res.Width - safe.X - 70, safe.Y - 60), 0.4f, UnknownColors.White,
                              Font.ChaletComprimeCologne, UIResText.Alignment.Right)
                {
                    DropShadow = true,
                }.Draw();

                string subt = MoneySubtitle;
                if (string.IsNullOrEmpty(MoneySubtitle))
                {
                    subt = "";
                }

                new UIResText(subt, new PointF((int)res.Width - safe.X - 70, safe.Y - 40), 0.4f, UnknownColors.White,
                              Font.ChaletComprimeCologne, UIResText.Alignment.Right)
                {
                    DropShadow = true,
                }.Draw();

                for (int i = 0; i < Tabs.Count; i++)
                {
                    var activeSize = res.Width - 2 * safe.X;
                    activeSize -= 4 * 5;
                    int tabWidth = (int)activeSize / Tabs.Count;

                    Game.EnableControlThisFrame(0, Control.CursorX);
                    Game.EnableControlThisFrame(0, Control.CursorY);

                    var hovering = UIMenu.IsMouseInBounds(safe.AddPoints(new PointF((tabWidth + 5) * i, 0)),
                                                          new SizeF(tabWidth, 40));

                    var tabColor = Tabs[i].Active
                        ? UnknownColors.White
                        : hovering?Color.FromArgb(100, 50, 50, 50) : UnknownColors.Black;

                    new UIResRectangle(safe.AddPoints(new PointF((tabWidth + 5) * i, 0)), new SizeF(tabWidth, 40),
                                       Color.FromArgb(Tabs[i].Active ? 255 : 200, tabColor)).Draw();

                    new UIResText(Tabs[i].Title.ToUpper(), safe.AddPoints(new PointF((tabWidth / 2) + (tabWidth + 5) * i, 5)),
                                  0.35f,
                                  Tabs[i].Active ? UnknownColors.Black : UnknownColors.White, Font.ChaletLondon, UIResText.Alignment.Centered)
                    .Draw();

                    if (Tabs[i].Active)
                    {
                        new UIResRectangle(safe.SubtractPoints(new PointF(-((tabWidth + 5) * i), 10)),
                                           new SizeF(tabWidth, 10), UnknownColors.DodgerBlue).Draw();
                    }

                    if (hovering && Game.IsControlJustPressed(0, Control.CursorAccept) && !Tabs[i].Active)
                    {
                        Tabs[Index].Active  = false;
                        Tabs[Index].Focused = false;
                        Tabs[Index].Visible = false;
                        Index = (1000 - (1000 % Tabs.Count) + i) % Tabs.Count;
                        Tabs[Index].Active     = true;
                        Tabs[Index].Focused    = true;
                        Tabs[Index].Visible    = true;
                        Tabs[Index].JustOpened = true;

                        if (Tabs[Index].CanBeFocused)
                        {
                            FocusLevel = 1;
                        }
                        else
                        {
                            FocusLevel = 0;
                        }

                        Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);
                    }
                }
            }
            Tabs[Index].Draw();

            _sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);

            _sc.Render2D();
        }
Example #49
0
        public void InitializeNews()
        {
            if (!_dbContext.News.Any())
            {
                News          news;
                int           numberOfDummyNews = 150;
                Random        r        = new Random();
                DateTime      dateTime = new DateTime(2019, 04, 01, 0, 0, 0);
                List <string> sections = new List <string>()
                {
                    "poland", "sport", "business", "world", "policy"
                };

                CloudinarySettings.Transformations(_dummyPhoto, out string urlHuge, out string urlLarge,
                                                   out string urlBig, out string urlMedium, out string urlSmall);

                for (int i = 0; i < numberOfDummyNews; i++)
                {
                    dateTime = dateTime.Add(new TimeSpan(days: 0, hours: r.Next(0, 15), minutes: r.Next(0, 100), seconds: r.Next(0, 100)));

                    string title;
                    do
                    {
                        title = Lorem.Sentence(6);
                    } while (title.Length < 35);

                    string shortTitle;
                    do
                    {
                        shortTitle = Lorem.Sentence(5);
                    } while (shortTitle.Length < 25);

                    news = new News()
                    {
                        ShortTitle  = shortTitle,
                        Title       = title,
                        Heading     = Lorem.Sentence(11),
                        Content     = Lorem.Paragraph(35),
                        Section     = sections[r.Next(0, 5)],
                        AddedAt     = dateTime,
                        IsImportant = r.Next(0, 7) > 2 ? true : false,
                        AuthorId    = r.Next(2, 7)
                    };

                    var photo = new Photo()
                    {
                        UrlHuge   = urlHuge,
                        UrlLarge  = urlLarge,
                        UrlBig    = urlBig,
                        UrlMedium = urlMedium,
                        UrlSmall  = urlSmall,
                        NewsId    = i,
                        News      = news
                    };

                    var comments = new List <Comment>();

                    var x = r.Next(0, 10) - 4;
                    if (x > 0)
                    {
                        for (int z = 0; z < x; z++)
                        {
                            var comment = new Comment()
                            {
                                AuthorId = r.Next(5, 20),
                                Content  = Lorem.Sentence(12),
                                NewsId   = i,
                                News     = news
                            };
                            _dbContext.Add <Comment>(comment);
                            comments.Add(comment);
                        }
                    }

                    news.Photo    = photo;
                    news.Comments = comments;

                    _dbContext.Add <News>(news);
                    _dbContext.Add <Photo>(photo);
                }

                AddNews("policy", _policyImgs, dateTime);
                AddNews("poland", _polandImgs, dateTime);
                AddNews("world", _worldImgs, dateTime);
                AddNews("business", _businessImgs, dateTime);
                AddNews("sport", _sportImgs, dateTime);

                _dbContext.SaveChanges();
            }
        }
Example #50
0
        public ActionResult UploadPicture(string comment, HttpPostedFileBase[] files, Photo photo)
        {
            if (!ModelState.IsValid)
            {
                return(View(photo));
            }
            if (files == null)
            {
                ModelState.AddModelError("error", "Ingen Bild!");
                return(View(photo));
            }
            foreach (var file in files)
            {
                file.SaveAs(
                    Path.Combine(Server.MapPath("~/Image"), file.FileName));
                photos.Add(new Photo {
                    PhotoID = Guid.NewGuid(), PhotoName = file.FileName, PhotoComment = new List <Comments> {
                        new Comments {
                            CommentOnPicture = comment
                        }
                    }
                });
            }

            return(View());
        }
Example #51
0
    private void EmbedCommonInformation()
    {
        // Work upon the selected photos here.
        Photo     firstphoto      = ((DeskFlickrUI.SelectedPhoto)_selectedphotos[0]).photo;
        string    commonTitle     = firstphoto.Title;
        string    commonDesc      = firstphoto.Description;
        int       commonPrivacy   = GetIndexOfPrivacyBox(firstphoto);
        int       commonLicense   = GetIndexOfLicenseBox(firstphoto);
        ArrayList tagschosen      = firstphoto.Tags;
        bool      isanyphotodirty = false;

        foreach (DeskFlickrUI.SelectedPhoto sel in _selectedphotos)
        {
            Photo p = sel.photo;
            if (!commonTitle.Equals(p.Title))
            {
                commonTitle = "";
            }
            if (!commonDesc.Equals(p.Description))
            {
                commonDesc = "";
            }
            if (commonPrivacy != GetIndexOfPrivacyBox(p))
            {
                commonPrivacy = 0;
            }
            if (commonLicense != GetIndexOfLicenseBox(p))
            {
                commonLicense = 0;
            }
            tagschosen = Utils.GetIntersection(tagschosen, p.Tags);
            if (!_isuploadmode && IsPhotoEdited(p))
            {
                isanyphotodirty = true;
            }
        }
        entry1.Text           = commonTitle;
        textview5.Buffer.Text = commonDesc;

        _ignorechangedevent = true;
        {
            combobox1.Active      = commonPrivacy;
            combobox2.Active      = commonLicense;
            textview3.Buffer.Text = Utils.GetDelimitedString(tagschosen, " ");
        }
        _ignorechangedevent = false;

        if (_isblogmode)
        {
            BlogEntry firstblogentry  = ((DeskFlickrUI.BlogSelectedPhoto)_selectedphotos[0]).blogentry;
            string    commonblogtitle = firstblogentry.Title;
            string    commonblogdesc  = firstblogentry.Desc;
            foreach (DeskFlickrUI.BlogSelectedPhoto bsel in _selectedphotos)
            {
                if (!commonblogtitle.Equals(bsel.blogentry.Title))
                {
                    commonblogtitle = "";
                }
                if (!commonblogdesc.Equals(bsel.blogentry.Desc))
                {
                    commonblogdesc = "";
                }
            }
            entry4.Text           = commonblogtitle;
            textview7.Buffer.Text = commonblogdesc;
        }

        image3.Sensitive  = false;
        image3.Pixbuf     = null;
        button3.Sensitive = false;
        button4.Sensitive = false;
        label7.Text       = "";
        label7.Sensitive  = false;
        SetPhotoLink("");
        button9.Sensitive = isanyphotodirty;
        SetActivateComments(false);
    }
Example #52
0
        public async Task <int> DeletePhotoAsync(Photo Photo)
        {
            await InitializeAsync();

            return(await SQLiteAsyncConnection.DeleteAsync(Photo));
        }
Example #53
0
        public void Add(Photo photo)
        {
            unitOfWork.Photos.Add(photo);

            unitOfWork.Save();
        }
Example #54
0
        private void ButtonAgregar_Click(object sender, EventArgs e)
        {
            bool check = true;

            string codigo = Id.ValueId("miembro", "codigo").ToString();;

            string nombre = TextBoxNombre.Text;

            if (!EvaluateTextBox.EString(nombre, 20, true, "Nombres"))
            {
                check = false;
            }

            string ap_paterno = TextBoxPaterno.Text;

            if (!EvaluateTextBox.EString(ap_paterno, 10, true, "Apellido Paterno"))
            {
                check = false;
            }

            string ap_materno = TextBoxMaterno.Text;

            if (!EvaluateTextBox.EString(ap_materno, 10, true, "Apellido Materno"))
            {
                check = false;
            }

            string dni = TextBoxDni.Text;

            if (!EvaluateTextBox.EString(dni, 8, true, "DNI"))
            {
                check = false;
            }

            //  0 = soltero    1 = casado    2 = viudo    3 = divorciado
            int estado_civil = -1;

            if (CheckBoxSoltero.Checked == true)
            {
                estado_civil = 0;
            }
            else if (CheckBoxCasado.Checked == true)
            {
                estado_civil = 1;
            }
            else if (CheckBoxViudo.Checked == true)
            {
                estado_civil = 2;
            }
            else if (CheckBoxDivorciado.Checked == true)
            {
                estado_civil = 3;
            }

            if (estado_civil == -1)
            {
                MessageBox.Show("Estado Civl Requerido");
                check = false;
            }



            string provincia = TextBoxProvincia.Text;

            if (!EvaluateTextBox.EString(provincia, 30, true, "Provincia"))
            {
                check = false;
            }

            string distrito = TextBoxDistrito.Text;

            if (!EvaluateTextBox.EString(distrito, 30, true, "Distrito"))
            {
                check = false;
            }

            string direccion = TextBoxDireccion.Text;

            if (!EvaluateTextBox.EString(direccion, 50, true, "Dirección"))
            {
                check = false;
            }

            string referencia = TextBoxReferencia.Text;

            if (!EvaluateTextBox.EString(referencia, 40, false, "Referencia"))
            {
                check = false;
            }

            // 0 = hombre    1 = mujer
            bool sexo = false;

            if (CheckBoxFemenino.Checked == true)
            {
                sexo = true;
            }
            if (CheckBoxFemenino.Checked == false && CheckBoxMasculino.Checked == false)
            {
                MessageBox.Show("Sexo Requerido");
                check = false;
            }

            string celular = TextBoxCelular.Text;

            if (!EvaluateTextBox.EString(celular, 12, false, "Celular"))
            {
                check = false;
            }

            string telefono = TextBoxTelefono.Text;

            if (!EvaluateTextBox.EString(telefono, 10, false, "Telefono"))
            {
                check = false;
            }

            string email = TextBoxEmail.Text;

            if (!EvaluateTextBox.EString(email, 40, false, "E-mail"))
            {
                check = false;
            }

            string estudios = TextBoxEstudios.Text;

            if (!EvaluateTextBox.EString(estudios, 50, false, "Estudios"))
            {
                check = false;
            }

            string fch_nacimiento = "";

            fch_nacimiento += DateNacimiento.Value.Year.ToString() + "-";
            fch_nacimiento += DateNacimiento.Value.Month.ToString() + "-";
            fch_nacimiento += DateNacimiento.Value.Day.ToString();

            string fch_bautismo = "";

            fch_bautismo += DateBautismo.Value.Year.ToString() + "-";
            fch_bautismo += DateBautismo.Value.Month.ToString() + "-";
            fch_bautismo += DateBautismo.Value.Day.ToString();

            //FOTOOOO
            byte[] imagen = null;
            if (PictureBoxFoto.Image != null)
            {
                imagen = Photo.Image_To_Bytes(PictureBoxFoto.Image);
            }

            bool activo = true;

            if (CheckBoxActivo.Checked == false)
            {
                activo = false;
            }

            int id_iglesia = 1;

            if (check)
            {
                if (imagen == null)
                {
                    SqlConnection conexion = new SqlConnection(General_Values.str_connection);

                    string cadena = "INSERT INTO miembro (codigo, nombre, ap_paterno, ap_materno, dni, estado_civil, provincia, distrito, " +
                                    "direccion, referencia, sexo, celular, telefono, email, estudios, fch_nacimiento, fch_bautismo, activo, id_iglesia) " +
                                    "values (@codigo, @nombre, @ap_paterno, @ap_materno, @dni, @estado_civil, @provincia, @distrito, @direccion, " +
                                    "@referencia, @sexo, @celular, @telefono, @email, @estudios, @fch_nacimiento, @fch_bautismo, @activo, @id_iglesia)";

                    SqlCommand comando = new SqlCommand(cadena, conexion);
                    comando.Parameters.AddWithValue("@codigo", codigo);
                    comando.Parameters.AddWithValue("@nombre", nombre);
                    comando.Parameters.AddWithValue("@ap_paterno", ap_paterno);
                    comando.Parameters.AddWithValue("@ap_materno", ap_materno);
                    comando.Parameters.AddWithValue("@dni", dni);
                    comando.Parameters.AddWithValue("@estado_civil", estado_civil);
                    comando.Parameters.AddWithValue("@provincia", provincia);
                    comando.Parameters.AddWithValue("@distrito", distrito);
                    comando.Parameters.AddWithValue("@direccion", direccion);
                    comando.Parameters.AddWithValue("@referencia", referencia);
                    comando.Parameters.AddWithValue("@sexo", sexo);
                    comando.Parameters.AddWithValue("@celular", celular);
                    comando.Parameters.AddWithValue("@telefono", telefono);
                    comando.Parameters.AddWithValue("@email", email);
                    comando.Parameters.AddWithValue("@estudios", estudios);
                    comando.Parameters.AddWithValue("@fch_nacimiento", fch_nacimiento);
                    comando.Parameters.AddWithValue("@fch_bautismo", fch_bautismo);
                    comando.Parameters.AddWithValue("@activo", activo);
                    comando.Parameters.AddWithValue("@id_iglesia", id_iglesia);

                    MessageBox.Show("Los datos se guardaron correctamente");

                    conexion.Open();
                    comando.ExecuteNonQuery();
                    conexion.Close();

                    this.Close();
                }
                else
                {
                    SqlConnection conexion = new SqlConnection(General_Values.str_connection);

                    string cadena = "INSERT INTO miembro (codigo, nombre, ap_paterno, ap_materno, dni, estado_civil, provincia, distrito, " +
                                    "direccion, referencia, sexo, celular, telefono, email, estudios, fch_nacimiento, fch_bautismo, foto, activo, id_iglesia) " +
                                    "values (@codigo, @nombre, @ap_paterno, @ap_materno, @dni, @estado_civil, @provincia, @distrito, @direccion, " +
                                    "@referencia, @sexo, @celular, @telefono, @email, @estudios, @fch_nacimiento, @fch_bautismo, @foto, @activo, @id_iglesia)";

                    SqlCommand comando = new SqlCommand(cadena, conexion);
                    comando.Parameters.AddWithValue("@codigo", codigo);
                    comando.Parameters.AddWithValue("@nombre", nombre);
                    comando.Parameters.AddWithValue("@ap_paterno", ap_paterno);
                    comando.Parameters.AddWithValue("@ap_materno", ap_materno);
                    comando.Parameters.AddWithValue("@dni", dni);
                    comando.Parameters.AddWithValue("@estado_civil", estado_civil);
                    comando.Parameters.AddWithValue("@provincia", provincia);
                    comando.Parameters.AddWithValue("@distrito", distrito);
                    comando.Parameters.AddWithValue("@direccion", direccion);
                    comando.Parameters.AddWithValue("@referencia", referencia);
                    comando.Parameters.AddWithValue("@sexo", sexo);
                    comando.Parameters.AddWithValue("@celular", celular);
                    comando.Parameters.AddWithValue("@telefono", telefono);
                    comando.Parameters.AddWithValue("@email", email);
                    comando.Parameters.AddWithValue("@estudios", estudios);
                    comando.Parameters.AddWithValue("@fch_nacimiento", fch_nacimiento);
                    comando.Parameters.AddWithValue("@fch_bautismo", fch_bautismo);
                    comando.Parameters.AddWithValue("@foto", imagen);
                    comando.Parameters.AddWithValue("@activo", activo);
                    comando.Parameters.AddWithValue("@id_iglesia", id_iglesia);

                    MessageBox.Show("Los datos se guardaron correctamente");

                    conexion.Open();
                    comando.ExecuteNonQuery();
                    conexion.Close();

                    this.Close();
                }
            }
        }
 public MemoryWithOnePhotoDTO(int id, string title, string subTitle, DateTime startDate, DateTime endDate, Location location, Photo photo)
 {
     Id        = id;
     Title     = title;
     SubTitle  = subTitle;
     StartDate = startDate;
     EndDate   = endDate;
     Location  = location;
     Photo     = photo;
 }
Example #56
0
 public void EditPhoto(Photo photo)
 {
     db.Entry(photo).State = EntityState.Modified;
     db.SaveChanges();
 }
Example #57
0
 public void AddPhoto(Photo photo)
 {
     db.Photos.Add(photo);
     db.SaveChanges();
 }
Example #58
0
 public void RemovePhoto(Photo photo)
 {
     _context.Photos.Remove(photo);
 }
Example #59
0
        private void SetUpCameraOutputs(int width, int height)
        {
            _manager = (CameraManager)_context.GetSystemService(Context.CameraService);

            string[] cameraIds = _manager.GetCameraIdList();

            _cameraId = cameraIds[0];

            for (int i = 0; i < cameraIds.Length; i++)
            {
                CameraCharacteristics chararc = _manager.GetCameraCharacteristics(cameraIds[i]);

                SensorOrientation = (int)chararc.Get(CameraCharacteristics.SensorOrientation);//Back:4032*3024,Front:3264*2448

                int[] faceDetector    = (int[])chararc.Get(CameraCharacteristics.StatisticsInfoAvailableFaceDetectModes);
                int   maxFaceDetector = (int)chararc.Get(CameraCharacteristics.StatisticsInfoMaxFaceCount);

                if (faceDetector != null)
                {
                    List <Integer> faceDetectorList = new List <Integer>();
                    foreach (var faceD in faceDetector)
                    {
                        faceDetectorList.Add((Integer)faceD);
                    }

                    if (maxFaceDetector > 0)
                    {
                        mFaceDetectSupported = true;
                        mFaceDetectMode      = (int)Collections.Max(faceDetectorList);
                    }
                }

                var facing = (Integer)chararc.Get(CameraCharacteristics.LensFacing);
                if (facing != null && facing == (Integer.ValueOf((int)LensFacing.Back)))
                {
                    _cameraId = cameraIds[i];

                    //Phones like Galaxy S10 have 2 or 3 frontal cameras usually the one with flash is the one
                    //that should be chosen, if not It will select the first one and that can be the fish
                    //eye camera
                    if (HasFLash(chararc))
                    {
                        break;
                    }
                }
            }

            var characteristics = _manager.GetCameraCharacteristics(_cameraId);
            var map             = (StreamConfigurationMap)characteristics.Get(CameraCharacteristics.ScalerStreamConfigurationMap);

            //if (_supportedJpegSizes == null && characteristics != null)
            //{
            //    _supportedJpegSizes = ((StreamConfigurationMap)characteristics.Get(CameraCharacteristics.ScalerStreamConfigurationMap)).GetOutputSizes((int)ImageFormatType.Jpeg);
            //}

            //if (_supportedJpegSizes != null && _supportedJpegSizes.Length > 0)
            //{
            //    _idealPhotoSize = GetOptimalSize(_supportedJpegSizes, 1050, 1400); //MAGIC NUMBER WHICH HAS PROVEN TO BE THE BEST
            //}

            //_imageReader = ImageReader.NewInstance(_idealPhotoSize.Width, _idealPhotoSize.Height, ImageFormatType.Jpeg, 1);
            _previewSize = map.GetOutputSizes((int)ImageFormatType.Jpeg)[0];
            _imageReader = ImageReader.NewInstance(480, 680, ImageFormatType.Jpeg, 1);
            var readerListener = new ImageAvailableListener();

            readerListener.Photo += (sender, buffer) =>
            {
                Photo?.Invoke(this, buffer);
            };

            _flashSupported = HasFLash(characteristics);

            _imageReader.SetOnImageAvailableListener(readerListener, _backgroundHandler);

            //_previewSize = GetOptimalSize(map.GetOutputSizes(Class.FromType(typeof(SurfaceTexture))), width, height);
        }
Example #60
0
 public void UnlikePhoto(Photo photoModel, string UserId)
 {
     photoModel.NumberOfLikes--;
     photoModel.Likes.RemoveAll(c => c.UserId == UserId);
     UpdatePhoto(photoModel);
 }