protected void btnModalEnviarSOATM_Click(object sender, EventArgs e) { if (txtModalNewSOATM.Text == "" || txtModalNewSOATM.Text == string.Empty) { txtAlerta1.Visible = true; } else { try { string vQuery = "STEISP_ATMAdminComponentesATM 18, '" + Session["codsoATM"] + "','" + txtModalNewSOATM.Text + "', '" + Session["USUARIO"].ToString() + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { txtAlerta1.Visible = false; txtModalNewSOATM.Text = string.Empty; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Sistema operativo modificado con éxito", WarningType.Success); UpdateGridView.Update(); cargarData(); } else { txtAlerta1.Text = "No se pudo modificar el sistema operativo"; txtAlerta1.Visible = true; } } catch (Exception Ex) { throw; } } }
protected void btnModalEnviardetMATM_Click(object sender, EventArgs e) { if (txtModalNewdetMATM.Text == "" || txtModalNewdetMATM.Text == string.Empty || DDLModeloATM.SelectedValue == "0") { //H5Alerta1.Visible = true; txtAlerta1.Visible = true; } else { try { string vQuery = "STEISP_ATM_DetalleModelo 3, '" + DDLModeloATM.SelectedValue + "','" + Session["coddetM"] + "','" + txtModalNewdetMATM.Text + "','" + Session["USUARIO"].ToString() + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { txtAlerta1.Visible = false; txtModalNewdetMATM.Text = string.Empty; DDLModeloATM.SelectedValue = "0"; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Detalle de modelo modificado con éxito", WarningType.Success); UpdateGridView.Update(); cargarData(); } else { txtAlerta1.Text = "No se pudo modificar el detalle de modelo"; txtAlerta1.Visible = true; } } catch (Exception Ex) { throw; } } }
protected void btnModalAprobNotificacion_Click(object sender, EventArgs e) { try { string vQuery = "STEISP_ATM_Aprobaciones 1, '" + Session["codNotificacion"] + "','" + txtcomentarioReprogramaNotif.Text + "', '" + Session["USUARIO"].ToString() + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Notificación aprobada con éxito", WarningType.Success); LimpiarNotificacion(); UpNotif.Update(); Session.Clear(); Response.Redirect("buscarAprobarNotificacion.aspx"); } else { Mensaje("No se pudo aprobar la notificación", WarningType.Warning); } } catch (Exception Ex) { Mensaje(Ex.Message, WarningType.Danger); } }
protected void BtnAceptar_Click(object sender, EventArgs e) { if (DDLUsuarios.SelectedValue == "0") { Mensaje("Seleccione un usuario", WarningType.Success); } else { String vUsuario = ""; DataTable vDatos2 = new DataTable(); String vQuery2 = "[STEISP_ATM_Generales] 46,'" + DDLUsuarios.SelectedValue + "'"; vDatos2 = vConexion.ObtenerTabla(vQuery2); foreach (DataRow item in vDatos2.Rows) { vUsuario = item["idUsuario"].ToString(); } if (vUsuario == "") { string vQuery = "[STEISP_ATM_SELECCIONES] 4, '" + DDLUsuarios.SelectedValue + "','" + Session["USUARIO"] + "', '" + CBPermisos.Checked + "'," + "'" + CBMantenimiento.Checked + "','" + CBCreaNotif.Checked + "', " + CBCreaVerif.Checked + ",'" + CBAprobarVerif.Checked + "'," + "'" + CBReprogramar.Checked + "','" + CBCalendario.Checked + "','" + CBAvance.Checked + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { Mensaje("Permiso creado con éxito", WarningType.Success); limpiar(); TBLPermisos.Visible = false; BtnAceptar.Visible = false; DDLUsuarios.SelectedValue = "0"; } } else { string vQuery = "[STEISP_ATM_SELECCIONES] 5, '" + DDLUsuarios.SelectedValue + "', '" + CBPermisos.Checked + "'," + "'" + CBMantenimiento.Checked + "','" + CBCreaNotif.Checked + "', " + CBCreaVerif.Checked + ",'" + CBAprobarVerif.Checked + "'," + "'" + CBReprogramar.Checked + "','" + CBCalendario.Checked + "','" + CBAvance.Checked + "','" + Session["USUARIO"] + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { Mensaje("Permiso modificado con éxito", WarningType.Success); limpiar(); TBLPermisos.Visible = false; BtnAceptar.Visible = false; DDLUsuarios.SelectedValue = "0"; } } } }
protected void btnReprogramarNotif_Click(object sender, EventArgs e) { //lbModalFechaMan.Text = ""; if (txtNewFechaInicio.Text == "" || txtNewFechaInicio.Text == string.Empty) { txtAlerta1.Visible = true; H5Alerta.Visible = true; } else { String vFormato = "yyyy/MM/dd"; string NewFecha = Convert.ToDateTime(txtNewFechaInicio.Text).ToString(vFormato); try { string vQuery = "STEISP_ATM_Reprogramacion 1, '" + Session["codNotificacionRE"] + "','" + NewFecha + "', '" + Session["USUARIO"].ToString() + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo != 0) { CorreoReprogramar(); //string vQuery2 = "STEISP_ATM_VerificacionTotal 8, '" + Session["codNotificacionRE"] + "'"; // vConexion.ejecutarSQL(vQuery2); string vQuery3 = "STEISP_ATM_Reprogramacion 4, '" + Session["codNotificacionRE"] + "'"; vConexion.ejecutarSQL(vQuery3); H5Alerta.Visible = false; txtAlerta1.Visible = false; H5Alerta.Visible = false; Session["ATM_IDZONA_REPROGRAMAR"] = null; Session["UsuResponsable"] = null; txtNewFechaInicio.Text = string.Empty; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Mantenimiento reprogramado con éxito", WarningType.Success); UpdateGridView.Update(); //EnviarCorreo(); cargarData(); } else { H5Alerta.InnerText = "No se pudo reprogramar mantenimiento"; H5Alerta.Visible = true; } } catch (Exception Ex) { Mensaje(Ex.Message, WarningType.Danger); } } }
void TransaccionInventario() { try { DataTable vDatos = (DataTable)Session["ATM_MATERIALES_VERIF"]; for (int i = 0; i < vDatos.Rows.Count; i++) { string vMantenimiento = vDatos.Rows[i]["idMantenimiento"].ToString(); string vStock = vDatos.Rows[i]["idStock"].ToString(); int vCantidadSolicitada = Convert.ToInt32(vDatos.Rows[i]["cantidad"].ToString()); //int vUbi = Convert.ToInt32(vDatos.Rows[i]["idUbi"].ToString()); String vQuery = "[STEISP_INVENTARIO_Stock] 2," + vStock; DataTable vDataStock = vConexion.ObtenerTabla(vQuery); Decimal vCantidad = Convert.ToDecimal(vDataStock.Rows[0]["cantidad"].ToString()); Decimal vCantidadActual = vCantidad - Convert.ToDecimal(vCantidadSolicitada); String vNombreMaterial = vDataStock.Rows[0]["descripcion"].ToString(); if (vCantidadActual < 0) { throw new Exception("No hay suficiente material de " + vNombreMaterial + " en existencia"); } Decimal vPrecioDec = Convert.ToDecimal(vCantidadSolicitada) * Convert.ToDecimal(vDataStock.Rows[0]["precioUnit"].ToString()); String vPrecio = vPrecioDec.ToString().Replace(",", "."); String vCodigoUbi = Session["ATM_CODUBI_MATERIAL"].ToString(); String vUsuario = Session["USUARIO"].ToString(); String vUsuResponsable = Session["ATM_USUARIO_MATERIAL"].ToString(); //Session["ATM_USUARIO_MATERIAL"].ToString() generarxml vMaestro = new generarxml(); Object[] vDatosMaestro = new object[10]; vDatosMaestro[0] = vCodigoUbi; vDatosMaestro[1] = vStock; vDatosMaestro[2] = Session["ATM_INVUBI_MATERIAL"]; vDatosMaestro[3] = vUsuResponsable; //Responsable vDatosMaestro[4] = "Mantenimiento ATM"; vDatosMaestro[5] = vCantidadSolicitada; vDatosMaestro[6] = ""; // Serie vDatosMaestro[7] = vPrecio; vDatosMaestro[8] = vUsuario; vDatosMaestro[9] = "6"; String vXML = vMaestro.ObtenerMaestroString(vDatosMaestro); vXML = vXML.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", ""); vQuery = "[STEISP_INVENTARIO_Principal] 1" + "," + vStock + "," + vCantidadActual + ",'" + vXML + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); } } catch (Exception) { throw new Exception(); } }
protected void btnNuevaFecha_Click(object sender, EventArgs e) { if (txtMotivoCambio.Text == "" || txtNewFecha.Text == "") { txtAlerta2.Visible = true; } else { String vFormato = "yyyy/MM/dd"; //"dd/MM/yyyy HH:mm:ss" String vNewFecha = Convert.ToDateTime(txtNewFecha.Text).ToString(vFormato); String vOriginalFecha = Convert.ToDateTime(Session["FECHA_MANTENIMIENTO_CAMBIO"]).ToString(vFormato); string vQuery = "STEISP_ATM_CancelarMantenimiento 8, '" + Session["ID_MANTENIMIENTO_CAMBIO"] + "','" + vOriginalFecha + "'," + "'" + vNewFecha + "','" + txtMotivoCambio.Text + "','" + Session["USUARIO"] + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo != 0) { string estado = ""; if (Convert.ToDateTime(txtNewFecha.Text) >= DateTime.Now) { estado = "1"; } else { estado = "11"; } string vQuery2 = "STEISP_ATM_CancelarMantenimiento 9, '" + Session["ID_MANTENIMIENTO_CAMBIO"] + "','" + estado + "'"; vConexion.ejecutarSQL(vQuery2); txtMotivoCambio.Text = ""; txtNewFecha.Text = ""; txtAlerta2.Visible = false; cargarData(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Se cambió fecha exitósamente.", WarningType.Success); } } }
protected void btnModalVerif_Click(object sender, EventArgs e) { try { string vQuery = "STEISP_ATM_VERIFICACION 5, '" + Session["USUARIO"].ToString() + "','" + Session["ATM_CODVERIF"] + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Lista de verificación finalizada con éxito", WarningType.Success); Response.Redirect("buscarAprobarVerificacion.aspx"); } else { Mensaje("No se pudo finalizar lista de verificación", WarningType.Warning); } } catch (Exception Ex) { throw; } }
void usuariosJefeAgentes() { try { string codATM = Request.QueryString["cod"]; DataTable vDatos = (DataTable)Session["NotifJefeAgenciaATMCorrectivo"]; if (vDatos != null) { for (int i = 0; i < vDatos.Rows.Count; i++) { string correos = vDatos.Rows[i]["Correo"].ToString(); string vNombre = vDatos.Rows[i]["Nombre"].ToString(); string vApellido = vDatos.Rows[i]["Apellido"].ToString(); string vQuery = "STEISP_ATM_NotificacionCorrectivo 2, '" + codATM + "','" + correos + "','" + vNombre + "','" + vApellido + "','" + txtsysaid.Text + "'"; vConexion.ejecutarSQL(vQuery); } } } catch (Exception Ex) { throw; } }
protected void btnModalCncelar_Click(object sender, EventArgs e) { if (txtMotivo.Text == "" || txtMotivo.Text == string.Empty) { txtAlerta.Visible = true; } else { txtAlerta.Visible = false; try { string vQuery = "STEISP_ATM_CancelarMantenimiento 3,'" + txtMotivo.Text + "','" + Session["USUARIO"] + "', '" + Session["ID_MANT_CANCELAR"] + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { string vQuery2 = "STEISP_ATM_CancelarMantenimiento 4,'" + Session["ID_MANT_CANCELAR"] + "'"; vConexion.ejecutarSQL(vQuery2); txtMotivo.Text = string.Empty; TxBuscarATM.Text = ""; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Mantenimiento de ATM cancelado con éxito", WarningType.Success); cargarData(); txtAlerta.Visible = false; } else { txtAlerta.Text = "No se pudo modificar el modelo"; txtAlerta.Visible = true; } } catch (Exception Ex) { throw; } } }
protected void btnModalEnviarNotificacion_Click(object sender, EventArgs e) { try { string vQuery = "STEISP_ATM_CrearATM 1, '" + txtcodATM.Text + "','" + txtnombreATM.Text + "'," + "" + DDLestado.SelectedValue + "," + DDLsucursalATM.SelectedValue + "," + "" + DDLUbicacionATM.SelectedValue + "," + DDLTipoATM.SelectedValue + "," + "" + DDLDetalleModelo.SelectedValue + ", " + DDLTipoCarga.SelectedValue + "," + "" + DDLProcesadorATM.SelectedValue + "," + DDLTecladoATM.SelectedValue + "," + "'" + txtserieATM.Text + "','" + txtramATM.Text + " GB" + "', " + DDLso.SelectedValue + "," + "'" + txtserieDisco.Text + "','" + txtcapacidadDisco.Text + " GB" + "'," + DDLmarca.SelectedValue + "," + "'" + txtIP.Text + "','" + txtpuerto.Text + "','" + txtlatitud.Text + "','" + txtlongitud.Text + "'," + "'" + txtdireccion.Text + "','" + Session["USUARIO"].ToString() + "','" + txtinventarioATM.Text + "', '" + DDLversionSw.SelectedValue + "','" + txtcodUbicacion.Text + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); //VALIDA QUE ATM ESTE ACTIVO String vQuery2 = "STEISP_ATM_VERIFICACION 9, '" + txtcodATM.Text + "',1"; DataTable vDatos2 = vConexion.ObtenerTabla(vQuery2); //INGRESAR UBICACIONES string IDUbi = "5"; String vQuery3 = "STEISP_INVENTARIO_Ubicaciones 3, '" + IDUbi + "', '" + DDLsucursalATM.SelectedValue + "','" + txtcodUbicacion.Text + "','" + txtdireccion.Text + "','" + Session["USUARIO"].ToString() + "','" + txtnombreATM.Text + "'"; DataTable vDatos3 = vConexion.ObtenerTabla(vQuery3); if (vInfo == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Limpiar(); cargarDataATM(); Mensaje("ATM creada con éxito", WarningType.Success); } else { Mensaje("No se pudo crear el ATM", WarningType.Warning); } } catch (Exception Ex) { throw; } }
protected void btnMantSinRealizar_Click(object sender, EventArgs e) { if (txtMotivo.Text == "") { txtAlerta.Visible = true; } else { string vQuery = "STEISP_ATM_NotificacionCorrectivo 4, '" + Session["ID_COR"] + "','" + txtMotivo.Text + "', '" + Session["USUARIO"].ToString() + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { EnviarCorreo(); txtMotivo.Text = ""; cargarData(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Mantenimiento fue cancelado exitosamente.", WarningType.Success); } } }
public void procesarArchivo(DataSet vArchivo, ref int vSuccess, string DireccionCarga, string TipoProceso) { try { if (vArchivo.Tables[0].Rows.Count > 0) { DataTable vDatos = vArchivo.Tables[0]; string vQuery = ""; //Boolean idEmpleado = false; Session["CODATM_SUBIDO"] = "Completo"; Session["FECHA_SUBIDO"] = "Completo"; for (int i = 0; i < vDatos.Rows.Count; i++) { String CodATM = vDatos.Rows[i]["CodigoATM"].ToString(); String Fecha = vDatos.Rows[i]["FECHA"].ToString(); //String vFormato = "yyyy/MM/dd"; //"dd/MM/yyyy HH:mm:ss" string vFechaMant = Convert.ToDateTime(Fecha).Year.ToString(); string vCodATM = ""; String vQuery2 = "SPSTEI_ATM 3, '" + CodATM + "'"; DataTable vDatos2 = vConexionATM.ObtenerTablaATM(vQuery2); foreach (DataRow item in vDatos2.Rows) { Session["CODATM_MANT"] = item["codATM"].ToString(); vCodATM = item["codATM"].ToString(); } if (Session["CODATM_MANT"].ToString() != CodATM) { if (Session["CODATM_SUBIDO"].ToString() == "Completo") { Session["CODATM_SUBIDO"] = ""; } Session["CODATM_SUBIDO"] = Session["CODATM_SUBIDO"] + ", " + CodATM; } DateTime today = DateTime.Today; string vYear = Convert.ToString(today.Year); if (vFechaMant != vYear) { if (Session["FECHA_SUBIDO"].ToString() == "Completo") { Session["FECHA_SUBIDO"] = ""; } Session["FECHA_SUBIDO"] = Session["FECHA_SUBIDO"] + ", " + CodATM; } } if (Session["CODATM_SUBIDO"].ToString() != "Completo" || Session["FECHA_SUBIDO"].ToString() != "Completo") { throw new Exception(); } else { if (TipoProceso == "LISTA_MAN") { Boolean vCodATM = false, vFecha = false; foreach (DataColumn item in vDatos.Columns) { if (item.ColumnName.ToString() == "CodigoATM") { vCodATM = true; } if (item.ColumnName.ToString() == "FECHA") { vFecha = true; } } if (vCodATM && vFecha) { for (int i = 0; i < vDatos.Rows.Count; i++) { String CodATM = vDatos.Rows[i]["CodigoATM"].ToString(); String Fecha = vDatos.Rows[i]["FECHA"].ToString(); String vFormato = "yyyy/MM/dd"; //"dd/MM/yyyy HH:mm:ss" String vFechaMant = Convert.ToDateTime(Fecha).ToString(vFormato); String ATM = ""; String FECHA = ""; DataTable vDatosP = new DataTable(); String vQueryP = "STEISP_ATM_Generales 40,'" + CodATM + "'"; vDatosP = vConexion.ObtenerTabla(vQueryP); foreach (DataRow item in vDatosP.Rows) { ATM = item["codATM"].ToString(); FECHA = Convert.ToDateTime(item["fechaMantenimiento"].ToString()).ToString(vFormato); } if (ATM == CodATM && FECHA == vFechaMant) { Session["FechaRepetida"] = Session["FechaRepetida"] + ", " + CodATM + "-" + vFechaMant; } else { vQuery = "STEISP_ATM_Mantenimientos '" + vFechaMant + "'" + ",'" + CodATM + "'" + ",'" + Session["USUARIO"].ToString() + "'"; //Session["FechaRepetida"] = null; int vRespuesta = vConexion.ejecutarSQL(vQuery); //VALIDA QUE ATM ESTE ACTIVO String vQuery2 = "STEISP_ATM_VERIFICACION 8, '" + CodATM + "'"; DataTable vDatos2 = vConexion.ObtenerTabla(vQuery2); if (vRespuesta == 1) { vSuccess++; } } } } } } } else { throw new Exception("No contiene ninguna hoja de excel."); } } catch (Exception ex) { LbMensaje.Text = ex.Message; } }
protected void btnMantSinRealizar_Click(object sender, EventArgs e) { try { if (txtdetalleCancela.Text == "" || DDLModalMotivo.SelectedValue == "0" || DDLModalcambioPor.SelectedValue == "0") { H5Alerta.Visible = true; txtAlerta2.Visible = true; } else { if (DDLModalMotivo.SelectedValue == "5") { try { string vQuery = "STEISP_ATM_CancelarVerificacion 2, '" + Session["ATM_ID_CANCELAR_VERIF_MODAL"] + "','" + DDLModalMotivo.SelectedValue + "','" + DDLModalcambioPor.SelectedValue + "','" + Session["USUARIO"].ToString() + "', '" + DDLModalNewTecnico.SelectedValue + "','" + txtdetalleCancela.Text + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo == 1) { CorreoCancelar(); H5Alerta.Visible = false; txtAlerta2.Visible = false; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Verificación cancelada con éxito", WarningType.Success); UpdateGridView.Update(); limpiarModalVerificacion(); cargarData(); } else { H5Alerta.InnerText = "No se pudo realizar la acción"; H5Alerta.Visible = true; } } catch (Exception Ex) { throw; } } else { try { string vQuery = "STEISP_ATM_CancelarVerificacion 1, '" + Session["ATM_ID_CANCELAR_VERIF_MODAL"] + "','" + DDLModalMotivo.SelectedValue + "','" + DDLModalcambioPor.SelectedValue + "','" + Session["USUARIO"].ToString() + "', '" + DDLModalNewTecnico.SelectedValue + "','" + txtdetalleCancela.Text + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); if (vInfo != 0) { H5Alerta.Visible = false; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Pop", "closeModal();", true); Mensaje("Verificación cancelada con éxito", WarningType.Success); // CorreoCancelar(); UpdateGridView.Update(); limpiarModalVerificacion(); cargarData(); } else { H5Alerta.InnerText = "No se pudo realizar la acción"; H5Alerta.Visible = true; } } catch (Exception Ex) { throw; } } H5Alerta.Visible = false; txtAlerta2.Visible = false; } } catch (Exception EX) { Mensaje(EX.Message, WarningType.Danger); } }
//public static byte[] SaveImageToByteArray(Image images, int jpegQuality = 75) //{ // //System.Web.UI.WebControls.Image images = new System.Web.UI.WebControls.Image(); // using (var ms = new MemoryStream()) // { // var jpegEncoder = GetEncoder(ImageFormat.Jpeg); // var encoderParameters = new EncoderParameters(1); // encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, (long)jpegQuality); // images.Save(ms, jpegEncoder, encoderParameters); // return ms.ToArray(); // } //} //private Image getImageFromBytes(byte[] myByteArray) //{ // System.IO.MemoryStream newImageStream = new System.IO.MemoryStream(myByteArray, 0, myByteArray.Length); // Image image = Image.FromStream(newImageStream, true); // Bitmap resized = new Bitmap(image, image.Width / 2, image.Height / 2); // image.Dispose(); // newImageStream.Dispose(); // return resized; //} protected void btnPrueba_Click(object sender, EventArgs e) { //if (FUDiscoDuro.HasFile) //{ // // Find the fileUpload control // string filename = FUDiscoDuro.FileName; // // Check if the directory we want the image uploaded to actually exists or not // if (!Directory.Exists(MapPath(@"Uploaded-Files"))) // { // // If it doesn't then we just create it before going any further // Directory.CreateDirectory(MapPath(@"Uploaded-Files")); // } // // Specify the upload directory // string directory = Server.MapPath(@"Uploaded-Files\"); // // Create a bitmap of the content of the fileUpload control in memory // Bitmap originalBMP = new Bitmap(FUDiscoDuro.FileContent); // // Calculate the new image dimensions // int origWidth = originalBMP.Width; // int origHeight = originalBMP.Height; // int sngRatio = origWidth / origHeight; // int newWidth = 100; // int newHeight = newWidth / sngRatio; // //int newWidth = 100; // //int newHeight = newWidth / sngRatio; // // Create a new bitmap which will hold the previous resized bitmap // Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight); // // Create a graphic based on the new bitmap // Graphics oGraphics = Graphics.FromImage(newBMP); // // Set the properties for the new graphic file // oGraphics.SmoothingMode = SmoothingMode.AntiAlias; oGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic; // // Draw the new graphic based on the resized bitmap // oGraphics.DrawImage(originalBMP, 0, 0, newWidth, newHeight); // // Save the new graphic file to the server // newBMP.Save(directory + "tn_" + filename); // // Once finished with the bitmap objects, we deallocate them. // originalBMP.Dispose(); // newBMP.Dispose(); // oGraphics.Dispose(); // //Image1.ImageUrl = @"/Uploaded-Files/tn_" + filename; //} //IMAGENES1 //String vNombreDepot1 = String.Empty; //HttpPostedFile bufferDeposito1 = FUDiscoDuro.PostedFile; //byte[] vFileDeposito1 = null; //string vExtension1 = string.Empty; //if (bufferDeposito1 != null) //{ // vNombreDepot1 = FUDiscoDuro.FileName; // Stream vStream1 = bufferDeposito1.InputStream; // BinaryReader vReader1 = new BinaryReader(vStream1); // vFileDeposito1 = vReader1.ReadBytes((int)vStream1.Length); // vExtension1 = System.IO.Path.GetExtension(FUDiscoDuro.FileName); //} //String vArchivo1 = String.Empty; //if (vFileDeposito1 != null) // vArchivo1 = Convert.ToBase64String(vFileDeposito1); Bitmap originalBMP = new Bitmap(FUDiscoDuro.FileContent); byte[] imageData; var newSize = originalBMP.Width / 3; //var newHeight = originalBMP.Height * newSize / originalBMP.Width; var newHeight = originalBMP.Height / 3; //newSize = originalBMP.Width*3; //newSize = originalBMP.Width * newSize / originalBMP.Height; Bitmap originalBMP2 = new Bitmap(originalBMP.GetThumbnailImage(newSize, newHeight, null, IntPtr.Zero)); using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) { originalBMP.Save(stream, ImageFormat.Jpeg); stream.Position = 0; imageData = new byte[stream.Length]; stream.Read(imageData, 0, imageData.Length); stream.Close(); } string vArchivo1 = Convert.ToBase64String(imageData); // Bitmap newImage = new Bitmap(newWidth, newHeight); //using (Graphics gr = Graphics.FromImage(newImage)) //{ // gr.SmoothingMode = SmoothingMode.HighQuality; // gr.InterpolationMode = InterpolationMode.HighQualityBicubic; // gr.PixelOffsetMode = PixelOffsetMode.HighQuality; // gr.DrawImage(imgDiscoDuro, new Rectangle(0, 0, newWidth, newHeight)); //} string vQuery = "[STEISP_ATM_Generales] 42, '" + vArchivo1 + "'"; Int32 vInfo = vConexion.ejecutarSQL(vQuery); DataTable vDatos2 = new DataTable(); String vQuery2 = "STEISP_ATM_Generales 43"; vDatos2 = vConexion.ObtenerTabla(vQuery2); foreach (DataRow item in vDatos2.Rows) { string vImagen1 = item["IMG"].ToString(); string srcImgen1 = "data:image;base64," + vImagen1; imgDiscoDuro.Src = srcImgen1; } }