コード例 #1
0
ファイル: lineupAdd2.aspx.cs プロジェクト: ic4f/oldcode
        private void BindLists(d.Suspect suspect)
        {
            d.VisualCriteriaData vcd = new d.VisualCriteriaData();

            cblGender.Items.Clear();
            cblGender.Items.Add(new ListItem("male", "'m'"));
            cblGender.Items.Add(new ListItem("female", "'f'"));
            cblGender.SelectedValue = "'" + suspect.Gender + "'";

            cblRace.DataSource     = vcd.GetRaceList();
            cblRace.DataTextField  = "description";
            cblRace.DataValueField = "id";
            cblRace.DataBind();
            cblRace.SelectedValue = suspect.RaceId.ToString();

            cblHair.DataSource     = vcd.GetHairColorList();
            cblHair.DataTextField  = "description";
            cblHair.DataValueField = "id";
            cblHair.DataBind();
            cblHair.SelectedValue = suspect.HairColorId.ToString();

            cblAge.DataSource     = vcd.GetAgeRangeList();
            cblAge.DataTextField  = "description";
            cblAge.DataValueField = "id";
            cblAge.DataBind();
            cblAge.SelectedValue = suspect.AgeRangeId.ToString();

            cblWeight.DataSource     = vcd.GetWeightRangeList();
            cblWeight.DataTextField  = "description";
            cblWeight.DataValueField = "id";
            cblWeight.DataBind();
            cblWeight.SelectedValue = suspect.WeightRangeId.ToString();
        }
コード例 #2
0
        protected override int SaveItem()
        {
            int suspectId = GetId();

            d.Suspect suspect = new d.Suspect(suspectId);
            suspect.Number        = tbxNumber.Text.Trim();
            suspect.Description   = tbxDescription.Text.Trim();
            suspect.Gender        = ddlGender.SelectedValue;
            suspect.RaceId        = Convert.ToInt32(ddlRace.SelectedValue);
            suspect.HairColorId   = Convert.ToInt32(ddlHairColor.SelectedValue);
            suspect.AgeRangeId    = Convert.ToInt32(ddlAgeRange.SelectedValue);
            suspect.WeightRangeId = Convert.ToInt32(ddlWeightRange.SelectedValue);
            suspect.ModifiedBy    = Identity.UserId;

            if (suspect.Update() < 0)
            {
                valUnique.IsValid = false;
                return(0);
            }

            if (tbxFile.PostedFile.ContentLength > 0)
            {
                FileInfo fi = new FileInfo(tbxFile.PostedFile.FileName);
                if (!b.ImageHelper.IsImage(fi.Extension))
                {
                    valFileType.IsValid = false;
                    return(0);
                }
                else
                {
                    double ratio = b.ImageHelper.DIMENSIONS_RATIO;

                    int    sWidth  = b.ImageHelper.SMALL_PHOTO_WIDTH;
                    int    sHeight = (int)(sWidth / ratio);
                    string sPath   = Server.MapPath(b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.SMALL_PHOTO_SUFFIX));

                    int    mWidth  = b.ImageHelper.MEDIUM_PHOTO_WIDTH;
                    int    mHeight = (int)(mWidth / ratio);
                    string mPath   = Server.MapPath(b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.MEDIUM_PHOTO_SUFFIX));

                    int    lWidth  = b.ImageHelper.LARGE_PHOTO_WIDTH;
                    int    lHeight = (int)(lWidth / ratio);
                    string lPath   = Server.MapPath(b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.LARGE_PHOTO_SUFFIX));

                    b.ImageHelper iHelper = new b.ImageHelper();
                    iHelper.MakeImage(tbxFile.PostedFile, sPath, sWidth, sHeight, ratio);
                    iHelper.MakeImage(tbxFile.PostedFile, mPath, mWidth, mHeight, ratio);
                    iHelper.MakeImage(tbxFile.PostedFile, lPath, lWidth, lHeight, ratio);
                }
            }
            return(1);
        }
コード例 #3
0
ファイル: lineupAdd2.aspx.cs プロジェクト: ic4f/oldcode
        private void BindData()
        {
            ltrJsHelper1.Text = System.Configuration.ConfigurationSettings.AppSettings["JsHelper1"];
            ltrJsHelper2.Text = System.Configuration.ConfigurationSettings.AppSettings["JsHelper2"];

            btnSave.Attributes["onclick"] = "javascript:return confirm('Are you sure you want to save this lineup? No further edits will be allowed.')";

            d.Lineup  lineup  = new d.Lineup(getLineupId());
            d.Suspect suspect = new d.Suspect(lineup.SuspectId);

            BindPosition();
            BindLineup(lineup.SuspectId);
            BindLists(suspect);
            BindToDisplayList();
            BindPhotos();
        }
コード例 #4
0
ファイル: lineupAdd.aspx.cs プロジェクト: ic4f/oldcode
 private void BindSuspect()
 {
     if (ddlSuspect.SelectedValue != "")
     {
         int    suspectId  = Convert.ToInt32(ddlSuspect.SelectedValue);
         double width      = b.ImageHelper.MEDIUM_PHOTO_WIDTH;
         double height     = width * 0.75;
         string suspectUrl = b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.MEDIUM_PHOTO_SUFFIX);
         lblSuspect.Text = "<img src='" + suspectUrl + "' border='1'>";
         d.Suspect s = new d.Suspect(suspectId);
         lblGender.Text = s.Gender;
         lblRace.Text   = s.Race;
         lblHair.Text   = s.HairColor;
         lblAge.Text    = s.AgeRange;
         lblWeight.Text = s.WeightRange;
         lblNotes.Text  = s.Description;
     }
 }
コード例 #5
0
        private void BindData()
        {
            d.Suspect suspect = new d.Suspect(GetId());
            tbxNumber.Text      = suspect.Number;
            tbxDescription.Text = suspect.Description;
            string urlMedium = b.UrlHelper.GetSuspectImageUrl(GetId(), b.ImageHelper.MEDIUM_PHOTO_SUFFIX);

            ltrPhoto.Text = "<img src='" + urlMedium + "' align='right' border='1'>";

            d.VisualCriteriaData vcd = new d.VisualCriteriaData();

            ddlGender.Items.Clear();
            ddlGender.Items.Add(new ListItem("male", "m"));
            ddlGender.Items.Add(new ListItem("female", "f"));
            ddlGender.SelectedValue = suspect.Gender;

            ddlRace.DataSource     = vcd.GetRaceList();
            ddlRace.DataTextField  = "description";
            ddlRace.DataValueField = "id";
            ddlRace.DataBind();
            ddlRace.SelectedValue = suspect.RaceId.ToString();

            ddlHairColor.DataSource     = vcd.GetHairColorList();
            ddlHairColor.DataTextField  = "description";
            ddlHairColor.DataValueField = "id";
            ddlHairColor.DataBind();
            ddlHairColor.SelectedValue = suspect.HairColorId.ToString();

            ddlAgeRange.DataSource     = vcd.GetAgeRangeList();
            ddlAgeRange.DataTextField  = "description";
            ddlAgeRange.DataValueField = "id";
            ddlAgeRange.DataBind();
            ddlAgeRange.SelectedValue = suspect.AgeRangeId.ToString();

            ddlWeightRange.DataSource     = vcd.GetWeightRangeList();
            ddlWeightRange.DataTextField  = "description";
            ddlWeightRange.DataValueField = "id";
            ddlWeightRange.DataBind();
            ddlWeightRange.SelectedValue = suspect.WeightRangeId.ToString();
        }
コード例 #6
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;
        }