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(); } } }
public static void Trace(string message, LogLevel level) { //Trace if (level >= _Config.TraceLevel) { TraceMessage m = new TraceMessage(); m.Name = "Argix08"; m.Source = App.Product; m.User = Environment.UserName; m.Computer = Environment.MachineName; m.LogLevel = level; m.Message = message; KronosProxy.WriteLogEntry(m); } }
protected void OnChangeView(object sender, CommandEventArgs e) { // this.btnDrivers.BackColor = System.Drawing.Color.LightSteelBlue; this.btnDrivers.Style["border-bottom-style"] = "solid"; this.btnEmployees.BackColor = System.Drawing.Color.LightSteelBlue; this.btnEmployees.Style["border-bottom-style"] = "solid"; this.btnHelpers.BackColor = System.Drawing.Color.LightSteelBlue; this.btnHelpers.Style["border-bottom-style"] = "solid"; this.btnVendors.BackColor = System.Drawing.Color.LightSteelBlue; this.btnVendors.Style["border-bottom-style"] = "solid"; switch (e.CommandName) { case "Drivers": this.btnDrivers.BackColor = System.Drawing.Color.White; this.btnDrivers.Style["border-bottom-style"] = "none"; break; case "Employees": this.btnEmployees.BackColor = System.Drawing.Color.White; this.btnEmployees.Style["border-bottom-style"] = "none"; break; case "Helpers": this.btnHelpers.BackColor = System.Drawing.Color.White; this.btnHelpers.Style["border-bottom-style"] = "none"; break; case "Vendors": this.btnVendors.BackColor = System.Drawing.Color.White; this.btnVendors.Style["border-bottom-style"] = "none"; break; } this.mIDType = e.CommandName; this.ViewState["IDType"] = this.mIDType; this.mIndex = 0; this.ViewState["Index"] = this.mIndex; Argix.KronosProxy kp = new Argix.KronosProxy(); this.mEmployees = kp.GetEmployeeList(this.mIDType); this.ViewState["Employees"] = this.mEmployees; OnChangePhoto(null, new CommandEventArgs(this.mIDType, null)); }
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; } }
//Interface public IDViewerConfiguration() { //Constructor this.mConfig = KronosProxy.GetUserConfiguration(App.Product, new string[] { Environment.UserName, Environment.MachineName }); }