Пример #1
0
        private void loadPhoto()
        {
            d.Lineup  lineup            = new d.Lineup(LineupId);
            DataTable dtPhotos          = new d.PhotoData().GetPhotosByLineup(LineupId);
            int       lastPhotoPosition = dtPhotos.Rows.Count - 1;

            if (CurrentPhotoIndex > lastPhotoPosition && SuspectIsProcessed)
            {
                pnlPhotoView.Visible     = false;
                pnlFinalComments.Visible = true;
            }
            else
            {
                if (!SuspectIsProcessed && lineup.SuspectPhotoPosition == CurrentPhotoIndex)
                {
                    lblPhoto.Text         = "<img src='" + b.UrlHelper.GetSuspectImageUrl(lineup.SuspectId, b.ImageHelper.LARGE_PHOTO_SUFFIX) + "' border='1'>";
                    CurrentPhotoId        = -1;
                    CurrentPhotoIsSuspect = true;
                }
                else
                {
                    int photoId = Convert.ToInt32(dtPhotos.Rows[CurrentPhotoIndex][0]);
                    lblPhoto.Text = "<img src='" + b.UrlHelper.GetPhotoImageUrl(photoId, b.ImageHelper.LARGE_PHOTO_SUFFIX) + "' border='1'>";
                    CurrentPhotoIndex++;
                    CurrentPhotoId        = photoId;
                    CurrentPhotoIsSuspect = false;
                }
            }
        }
Пример #2
0
        private void BindData()
        {
            int lineupId = Convert.ToInt32(Request["Id"]);

            d.Lineup  lineup   = new d.Lineup(lineupId);
            DataTable dtPhotos = new d.PhotoData().GetPhotosByLineup(lineupId);

            int           photoId;
            int           dtPhotosPosition = 0;
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < POSITIONS; i++)
            {
                sb.Append("\n\t<td style=\"width:96px;\">");
                if (i == lineup.SuspectPhotoPosition)
                {
                    sb.AppendFormat("<img src='{0}' style=\"border:2px red solid;\">", b.UrlHelper.GetSuspectImageUrl(lineup.SuspectId, b.ImageHelper.SMALL_PHOTO_SUFFIX));
                }
                else
                {
                    photoId = Convert.ToInt32(dtPhotos.Rows[dtPhotosPosition][0]);
                    sb.AppendFormat("<img src='{0}' style=\"border:1px #666666 solid;\">", b.UrlHelper.GetPhotoImageUrl(photoId, b.ImageHelper.SMALL_PHOTO_SUFFIX));
                    dtPhotosPosition++;
                }
                sb.Append("</td>");
            }
            ltrLineup.Text = sb.ToString();

            ltrStart.Text = "<a href=\"javascript:open_win(" + lineupId + ");\">Start Lineup Administration</a>";
        }
Пример #3
0
        private void BindData()
        {
            int uncat = new d.PhotoData().GetUncategoriedNumber();

            ltrUncatPhotos.Text = uncat.ToString();
            if (uncat == 0)
            {
                lnkNext12.Visible = false;
            }
        }
Пример #4
0
        private void BindGrid()
        {
            DataSet ds = new d.PhotoData().GetPhotosWithQueryP(makeQuery(), pager.PageSize, pager.CurrentPage);

            if (ds.Tables[0].Rows.Count > 0)
            {
                pnlGrid.Visible      = true;
                dgrPhotos.Prefix     = LinkPrefix;
                dgrPhotos.DataSource = ds.Tables[0];
                dgrPhotos.DataBind();
                pager.AdjustAfterBinding(Convert.ToInt32(ds.Tables[1].Rows[0][0]));
            }
            else
            {
                pnlGrid.Visible = false;
            }
        }
Пример #5
0
        public void Run()
        {
            string sourcePath = "";

            Console.WriteLine("Please provide the path for the directory containing the photos");
            try
            {
                sourcePath = Console.ReadLine();
                string[]    files = Directory.GetFiles(sourcePath);
                d.PhotoData pd    = new d.PhotoData();
                int         total = files.Length;
                Console.WriteLine("There are " + total + " files in the directory. Process all of them? (y/n)");
                string answer = Console.ReadLine();
                if (answer == "y")
                {
                    string   externalref;
                    FileInfo fi;
                    for (int i = 0; i < total; i++)
                    {
                        if (i % 10 == 0)
                        {
                            Console.WriteLine("processing photo " + i + " out of " + total);
                        }

                        fi          = new FileInfo(files[i]);
                        externalref = fi.Name;
                        externalref = externalref.Replace(fi.Extension, "");
                        externalref = externalref.Substring(0, Math.Min(15, externalref.Length));
                        makeImages(pd.Create(externalref), files[i]);
                    }
                    Console.WriteLine("Completed.");
                }
                else
                {
                    Console.WriteLine("Operation aborted.");
                }
            }
            catch (Exception)
            {
                Console.WriteLine("ERROR: " + sourcePath + " does not exist");
            }
        }
Пример #6
0
        protected override int SaveItem()
        {
            d.Photo   photo;
            string    photoId;
            DataTable dtPhotos = new d.PhotoData().GetNextNUncategorized(photosToDisplay);

            foreach (DataRow dr in dtPhotos.Rows)
            {
                photo               = new d.Photo(Convert.ToInt32(dr[0]));
                photoId             = photo.Id.ToString();
                photo.Gender        = Page.Request[makeHiddenId(photoId, GENDER_TYPE)].Replace("'", "");
                photo.RaceId        = Convert.ToInt32(Page.Request[makeHiddenId(photoId, RACE_TYPE)]);
                photo.HairColorId   = Convert.ToInt32(Page.Request[makeHiddenId(photoId, HAIR_TYPE)]);
                photo.AgeRangeId    = Convert.ToInt32(Page.Request[makeHiddenId(photoId, AGE_TYPE)]);
                photo.WeightRangeId = Convert.ToInt32(Page.Request[makeHiddenId(photoId, WEIGHT_TYPE)]);
                photo.IsCategorized = true;
                photo.ModifiedBy    = Identity.UserId;
                photo.Update();
            }
            return(1);
        }
Пример #7
0
        private void BindPhotos()
        {
            int       toDisplay = Convert.ToInt32(ddlToDisplay.SelectedValue);
            DataSet   ds        = new d.PhotoData().GetPhotosWithQuery(makeQuery(), "order by p.id ", toDisplay);
            DataTable dtPhotos  = ds.Tables[0];

            if (dtPhotos.Rows.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (DataRow dr in dtPhotos.Rows)
                {
                    sb.AppendFormat("<img src='{0}' style=\"margin:3px;border:1px #666666 solid;\" onClick=\"add({1});\" id='{1}' name='{1}'>",
                                    b.UrlHelper.GetPhotoImageUrl(Convert.ToInt32(dr[0]), b.ImageHelper.SMALL_PHOTO_SUFFIX), dr[0]);
                }

                ltrPhotos.Text  = sb.ToString();
                ltrResults.Text = "Displaying <b>" + Math.Min(dtPhotos.Rows.Count, toDisplay) + "</b> photos out of <b>" + ds.Tables[1].Rows[0][0] + "</b> matching your search criteria";
            }
            else
            {
                ltrResults.Text = "There are no photos in the database that match your criteria";
            }
        }
Пример #8
0
        private void BindData()
        {
            int lineupId = Convert.ToInt32(Request["Id"]);

            d.Lineup  lineup   = new d.Lineup(lineupId);
            DataTable dtPhotos = new d.PhotoData().GetPhotosByLineup(lineupId);

            int           photoId;
            int           dtPhotosPosition = 0;
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < POSITIONS; i++)
            {
                sb.Append("\n\t<td style=\"width:96px;\">");
                if (i == lineup.SuspectPhotoPosition)
                {
                    sb.AppendFormat("<img src='{0}' style=\"border:2px red solid;\">", b.UrlHelper.GetSuspectImageUrl(lineup.SuspectId, b.ImageHelper.SMALL_PHOTO_SUFFIX));
                }
                else
                {
                    photoId = Convert.ToInt32(dtPhotos.Rows[dtPhotosPosition][0]);
                    sb.AppendFormat("<img src='{0}' style=\"border:1px #666666 solid;\">", b.UrlHelper.GetPhotoImageUrl(photoId, b.ImageHelper.SMALL_PHOTO_SUFFIX));
                    dtPhotosPosition++;
                }
                sb.Append("</td>");
            }
            ltrLineup.Text = sb.ToString();

            ltrDescription.Text = lineup.Description;
            ltrNotes.Text       = lineup.Notes;

            d.CCase ccase = new d.CCase(lineup.CaseId);
            ltrCase.Text = ccase.Number;

            d.Suspect suspect = new d.Suspect(lineup.SuspectId);
            ltrSuspect.Text = suspect.Number;
        }