Пример #1
0
    protected override void Render(HtmlTextWriter output)
    {
        //
        Stream stream = null;
        Bitmap image  = null;

        try {
            //Return an image in the web reponse
            Argix.KronosProxy kp       = new Argix.KronosProxy();
            Argix.Employee    employee = kp.GetEmployee(this.mIDType, this.mIDNumber);
            byte[]            bytes    = employee.Photo;
            stream = new MemoryStream(bytes);
            image  = new Bitmap(stream);

            //Render as jpeg to browser
            HttpResponse response = this.Context.Response;
            response.ContentType  = "image/jpeg";
            response.BufferOutput = true;
            response.Clear();
            image.Save(response.OutputStream, ImageFormat.Jpeg);
        }
        catch { }
        finally { if (stream != null)
                  {
                      stream.Dispose();
                  }
                  if (image != null)
                  {
                      image.Dispose();
                  }
        }
    }
Пример #2
0
    protected void OnOk(object sender, EventArgs e)
    {
        //Event handler for export button clicked
        Argix.Employee employee = new Argix.Employee();
        employee.LastName  = this.txtLastName.Text;
        employee.FirstName = this.txtFirstName.Text;
        employee.Middle    = this.txtMiddle.Text;
        employee.Suffix    = this.txtSuffix.Text;
        employee.Location  = this.cdoLocation.SelectedValue;
        Argix.Kronos kronos = new Argix.Kronos();
        bool         res    = kronos.AddEmployee("Helpers", employee);

        Response.Redirect("HelpersEditor.aspx");
    }
Пример #3
0
    protected void OnChangePhoto(object sender, CommandEventArgs e)
    {
        //
        if (this.mIDType.Length > 0)
        {
            switch (e.CommandName)
            {
            case "Back":
                if (this.mIndex > 0)
                {
                    this.mIndex--;
                }
                else
                {
                    this.mIndex = this.mEmployees.Count - 1;
                }
                break;

            case "Next":
                if (this.mIndex < this.mEmployees.Count - 1)
                {
                    this.mIndex++;
                }
                else
                {
                    this.mIndex = 0;
                }
                break;
            }
            this.ViewState["Index"] = this.mIndex;
            Argix.KronosProxy kp       = new Argix.KronosProxy();
            Argix.Employee    employee = kp.GetEmployee(this.mIDType, this.mEmployees[this.mIndex].IDNumber);
            this.lblName.Text      = employee.FirstName + " " + employee.LastName;
            this.imgPhoto.ImageUrl = "~/Photo.aspx?type=" + this.mIDType + "&id=" + employee.IDNumber;
        }
    }