protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["BranchID"] != null) // 如果有GroupID { string sBranchID = this.Request.QueryString["BranchID"].ToString(); LPWeb.Model.Branches model = new LPWeb.Model.Branches(); try { this.iBranchID = Convert.ToInt32(sBranchID); model = branchManager.GetModel(iBranchID); //Response.ContentType = getreader["markType"] as string; //Response.ContentType = "image/jpeg"; //Response.OutputStream.Write(model.WebsiteLogo, 0, model.WebsiteLogo.Length); //("width:330px; height:64px"); if (model.WebsiteLogo == null) { return; } int iWidth = 330; int iHeight = 90; ImageConverter imc = new ImageConverter(); System.Drawing.Image _img = imc.ConvertFrom(null, null, model.WebsiteLogo) as System.Drawing.Image; int iOrgWidth = Convert.ToInt32(_img.Width); int iOrgHeight = Convert.ToInt32(_img.Height); ResizeImg(iOrgWidth, iOrgHeight, ref iWidth, ref iHeight); Bitmap _Bitmap = new Bitmap(iWidth, iHeight); Graphics _Graphcis = Graphics.FromImage(_Bitmap); _Graphcis.DrawImage(System.Drawing.Image.FromStream(new MemoryStream(model.WebsiteLogo)), 0, 0, iWidth, iHeight); _Graphcis.Dispose(); MemoryStream ms = new MemoryStream(); _Bitmap.Save(ms, ImageFormat.Png); ms.Flush(); byte[] bData = ms.GetBuffer(); ms.Close(); Response.BinaryWrite(bData); Response.End(); } catch { } } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["BranchID"] != null) // 如果有GroupID { string sBranchID = this.Request.QueryString["BranchID"].ToString(); LPWeb.Model.Branches model = new LPWeb.Model.Branches(); try { this.iBranchID = Convert.ToInt32(sBranchID); model = branchManager.GetModel(iBranchID); //Response.ContentType = getreader["markType"] as string; Response.ContentType = "image/jpeg"; Response.OutputStream.Write(model.WebsiteLogo, 0, model.WebsiteLogo.Length); Response.End(); } catch { } } }
private void FillBranch() { try { LPWeb.Model.Branches model = branchManager.GetModel(iBranchID); ddlBranchName.SelectedValue = iBranchID.ToString(); ckbEnabled.Checked = model.Enabled; if (model.GroupID.HasValue && ddlGroupAccess.Items.FindByValue(model.GroupID.Value.ToString()) != null) { ddlGroupAccess.SelectedValue = model.GroupID.Value.ToString();//设置选中项 } else { ddlGroupAccess.SelectedValue = "0"; } txbDescription.Text = model.Desc; txbAddress.Text = model.BranchAddress; txbCity.Text = model.City; txbZip.Text = model.Zip; ddlState.Text = model.BranchState; txbPhone.Text = model.Phone; txbFax.Text = model.Fax; txbEmail.Text = model.Email; txbWebURL.Text = model.WebURL; chkHomeBranch.Checked = model.HomeBranch; chkHomeBranch.Attributes.Add("cid", "chkHomeBranch"); chkHomeBranch.Attributes.Add("BranchID", model.BranchId.ToString()); #region find HomeBranch = true BranchId var homebranchId = 0; if (model.HomeBranch != true) { var ds = branchManager.GetList(1, " HomeBranch = 1 ", "BranchId"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { homebranchId = Convert.ToInt32(ds.Tables[0].Rows[0]["BranchId"]); } } else { homebranchId = model.BranchId; } chkHomeBranch.Attributes.Add("HomeBranchID", homebranchId.ToString()); #endregion if (model.WebsiteLogo == null) { Image1.ImageUrl = "../images/YourLogo.jpg"; } else if (model.WebsiteLogo.Length < 1) { Image1.ImageUrl = "../images/YourLogo.jpg"; } else { Image1.ImageUrl = "BranchLogo.aspx?BranchID=" + iBranchID.ToString() + "&ss=" + DateTime.Now.Millisecond.ToString(); } txbLicense1.Text = model.License1; txbLicense2.Text = model.License2; txbLicense3.Text = model.License3; txbLicense4.Text = model.License4; txbLicense5.Text = model.License5; txbDisclaimer.Text = model.Disclaimer; } catch { } }