Beispiel #1
0
        private void BindData()
        {
            DataTable dtSuspects = new d.SuspectData().GetAllSuspectsByCase(getCaseId());

            cblSuspects.DataSource     = dtSuspects;
            cblSuspects.DataTextField  = "externalref";
            cblSuspects.DataValueField = "Id";
            cblSuspects.DataCheckField = "Selected";
            cblSuspects.DataBind();
        }
Beispiel #2
0
        protected override int SaveItem()
        {
            string number        = tbxNumber.Text.Trim();
            string description   = tbxDescription.Text.Trim();
            string gender        = ddlGender.SelectedValue;
            int    raceId        = Convert.ToInt32(ddlRace.SelectedValue);
            int    hairColorId   = Convert.ToInt32(ddlHairColor.SelectedValue);
            int    ageRangeId    = Convert.ToInt32(ddlAgeRange.SelectedValue);
            int    weightRangeId = Convert.ToInt32(ddlWeightRange.SelectedValue);

            int suspectId = new d.SuspectData().Create(
                number, description, gender, raceId, hairColorId, ageRangeId, weightRangeId, Identity.UserId);

            if (suspectId < 0)
            {
                valUnique.IsValid = false;
                return(0);
            }
            else
            {
                FileInfo fi = new FileInfo(tbxFile.PostedFile.FileName);
                if (!b.ImageHelper.IsImage(fi.Extension))
                {
                    valFileType.IsValid = false;
                    return(0);
                }

                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);
        }
Beispiel #3
0
        private void BindData()
        {
            DataTable dtSuspects = new d.SuspectData().GetRecords(dgrSuspects.SortExpression);

            if (dtSuspects.Rows.Count > 0)
            {
                pnlGrid.Visible        = true;
                dgrSuspects.Prefix     = LinkPrefix;
                dgrSuspects.DataSource = dtSuspects;
                dgrSuspects.DataBind();
            }
            else
            {
                pnlGrid.Visible = false;
            }
        }
Beispiel #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int suspectId = Convert.ToInt32(Request["Id"]);

            d.SuspectData sd = new d.SuspectData();
            sd.Delete(suspectId);

            string sPath = Server.MapPath(b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.SMALL_PHOTO_SUFFIX));
            string mPath = Server.MapPath(b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.MEDIUM_PHOTO_SUFFIX));
            string lPath = Server.MapPath(b.UrlHelper.GetSuspectImageUrl(suspectId, b.ImageHelper.LARGE_PHOTO_SUFFIX));

            File.Delete(sPath);
            File.Delete(mPath);
            File.Delete(lPath);

            Response.Redirect("suspectList.aspx");
        }