Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
               /*
                if (Session["Photo"] != null && Session["PhotoType"] != null)
                {
                    img1.ImageUrl = "~/TeacherPhotoShow.aspx";
                }
                else
                {
                    img1.ImageUrl = "~/Content/default.jpg";
                }*/
                int id = Convert.ToInt32( Request.QueryString.Get("ID"));
                if (id != 0)
                {
                    CQGJEntities CQGJ = new CQGJEntities();
                    Session["TeacherID"] = id;
                    this.teacher = (from t in CQGJ.Teacher
                                    where t.TeacherID == id
                                    select t).First();
                    if (this.teacher.Photo != null || this.teacher.PhotoType != null)
                    {
                        img1.ImageUrl = "~/TeacherPhotoShow.aspx?ID=" + id;

                    }
                    else
                    {
                        img1.ImageUrl = "~/Content/images/user-head.jpg";
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CQGJEntities CQGJ = new CQGJEntities();
            if (Request.QueryString["ID"] != null)
            {
                try
                {
                   int iID = int.Parse(Request.QueryString["ID"].ToString());
                   Teacher teacher = (from c in CQGJ.Teacher
                                      where c.TeacherID == iID
                                      select c).First();

                   Response.ContentType = teacher.PhotoType;
                   Response.BinaryWrite((byte[])teacher.Photo);
                }
                catch
                {
                }
            }
        }