protected void guarda_Click(object sender, EventArgs e) { string es_su_pass = ReporteRNegocio.es_su_pass(USER); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(pass_antigua.Value.ToUpper()); if (es_su_pass != contrasena) { mensaje_pass.Text = "Contraseña actual errónea, reingrese"; } else { usuarioEntity us = new usuarioEntity(); us.cod_usuario = USER.ToUpper(); usuarioBO.encontrar(ref us); clsCrypto.CL_Crypto encriptador2 = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena2 = encriptador2.EncryptData(pass_nueva.Value.ToUpper()); us.clave = contrasena2; us.activado = "true"; us.tipo_usuario = ReporteRNegocio.es_su_tipo(USER); if (usuarioBO.actualizar(us, USER) == "OK") { mensaje_pass.Text = "Contraseña cambiada ! "; } } }
public static usuarioEntity getUserbyName(string name) { try { usuarioEntity us = new usuarioEntity(); using (infoEntities db = new infoEntities()) { AspNetUsers aspUs = db.AspNetUsers.Where(x => x.Email == name).FirstOrDefault(); if (aspUs != null) { us.Id = aspUs.Id; us.Email = aspUs.Email; us.UserName = aspUs.UserName; us.Rol = aspUs.Rol; return(us); } else { throw new Exception("No es posible encontrar el rol del usuario"); } } } catch (Exception ex) { throw new Exception("No es posible encontrar el rol del usuario"); } }
public static usuarioEntity getUserbyId(string id) { try { usuarioEntity us = new usuarioEntity(); using (infoEntities db = new infoEntities()) { AspNetUsers aspUs = db.AspNetUsers.Where(x => x.Id == id).FirstOrDefault(); if (aspUs != null) { us.Email = aspUs.Email; us.UserName = aspUs.UserName; us.Rol = aspUs.Rol; return(us); } else { throw new BusinessException("No es posible encontrar el usuario"); } } } catch (Exception ex) { new TechnicalException("No es posible encontrar el usuario", ex); throw new BusinessException("No es posible encontrar el usuario"); } }
public void LlenarLista() { usuarioEntity vend = new usuarioEntity(); vend = (usuarioEntity)(Session["usuario"]); G_PRINCIPAL.DataSource = ctz_log_cotizacionBO.GetAll(" where cod_vendedor = '" + vend.cod_usuario + "' "); G_PRINCIPAL.DataBind(); }
public JsonResult getUser(string id) { try { usuarioEntity user = usuarioBO.getUserbyId(id); return(Json(user, JsonRequestBehavior.AllowGet)); } catch (BusinessException ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Retorna o conteudo da pagina a partir de uma URL /// </summary> /// <param name="url">URL da pagina. Ex: http://www.microsoft.com.br</param> /// <returns>Texto da pagina</returns> //private string RetornaDocumentText(string url) //{ // HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url); // WebResponse webResponse = httpWebRequest.GetResponse(); // StreamReader streamReader = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8); // return streamReader.ReadToEnd(); //} protected void validar() { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(T_Pass.Text.ToUpper()); //string contrasena3 = encriptador.EncryptData("zsAy0X+UdTDpaKDwPiz/BA=="); //string total = Base.monto_format2(Math.Round(1603500.250, MidpointRounding.AwayFromZero)); string cont2rasena = encriptador.DecryptData("bkJ47VUtVQ/L0SBDQMWicA=="); string cont3rasena = encriptador.DecryptData("fL3tK39Qb3P4loe20QkmHasFJjMLt1oZ"); // GT015 ANTONIA2106 // CG032 ITALIA90 //string documentText = RetornaDocumentText("htt"); ////MessageBox.Show(s_unicode2); usuarioEntity u = new usuarioEntity(); u.cod_usuario = T_User.Text; u.clave = contrasena; string respuesta = usuarioBO.validar(ref u); //string usuario_1_2 = ReporteRNegocio.test_arica(); //ScriptManager.RegisterStartupScript(Page, this.GetType(), "test", "<script language='javascript'>alert('"+ usuario_1_2 + "');</script>", false); if (respuesta == "OK") { if (u.activado != "False") { string login = T_User.Text; Session["user"] = T_User.Text; Session["contraseña"] = contrasena; Session["usuario"] = u; FormsAuthentication.RedirectFromLoginPage(login, false); Response.Redirect("Menu.aspx"); } else { L_Sesion.Text = "Usuario desactivado, vuelva a ingresar."; T_User.Focus(); } } else { L_Sesion.Text = "Usuario y/o Clave inválidos, vuelva a ingresar."; T_User.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { usuarioEntity vend = new usuarioEntity(); vend = (usuarioEntity)(Session["usuario"]); T_VENDEDOR.Text = vend.cod_usuario; T_FECHA_DESDE.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); T_FECHA_HASTA.Text = DateTime.Now.ToString("yyyy-MM-dd"); filtrartodo(); } catch (Exception ex) { } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "cargaknob", "<script>javascript:cargarknob();Datatables();</script>", false); } }
public static List <usuarioEntity> getListaUsuarios() { List <usuarioEntity> usuarios = new List <usuarioEntity>(); try { using (infoEntities db = new infoEntities()) { List <AspNetUsers> users = db.AspNetUsers.Where(x => x.Id != "").OrderBy(x => x.UserName).ToList(); foreach (AspNetUsers user in users) { usuarioEntity usuario = new usuarioEntity(); usuario.UserName = user.UserName; usuarios.Add(usuario); } } } catch (Exception ex) { throw new TechnicalException("No se pudo recuperar lista de usuarios", ex); } return(usuarios); }
public static string encontrar(ref usuarioEntity u) { return(usuarioDAL.encontrar(ref u)); }
public static String eliminar(usuarioEntity b) { return(usuarioDAL.Delete(b)); }
public static String actualizar(usuarioEntity b, string usuario) { return(usuarioDAL.Update(b, usuario)); }
public static String registrar(usuarioEntity b) { return(usuarioDAL.Insert(b)); }
public static string validar(ref usuarioEntity u) { return(usuarioDAL.validar(ref u)); }
private void NUEVO_GUARDAR() { if (txt_cod_usuario.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (txt_clave.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "1" && l_grupos.Text == "" || chk_otro.Checked && l_unidad_negocio.Text == "2" && l_grupos.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_vend.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (r_enviar_correo.Checked && t_correo.Text == "" || r_enviar_2.Checked && t_correo.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else { usuarioEntity us = new usuarioEntity(); us.cod_usuario = txt_cod_usuario.Text; clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(txt_clave.Text.ToUpper()); us.clave = contrasena; if (chk_adm.Checked) { us.admin = "true"; } else { us.admin = "false"; } if (chk_vend.Checked) { us.tipo_usuario = 2; us.nombre_ = ReporteRNegocio.nombre_vendedor(us.cod_usuario); } else if (chk_otro.Checked) { us.tipo_usuario = 3; us.nombre_ = t_nombre_us.Text; } else { us.tipo_usuario = 1; us.nombre_ = t_nombre_us.Text; } if (r_activo.Checked) { us.activado = "true"; } else { us.activado = "false"; } if (r_enviar_2.Checked) { us.enviar2 = "true"; } else { us.enviar2 = "false"; } if (r_enviar_correo.Checked) { us.enviar = "True"; } else { us.enviar = "False"; } if (usuarioBO.encontrar(ref us) == "OK") { //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>repetido_agregar_adm();</script>", false); h3_.InnerText = "Usuario ya se encuentra."; cargar_usuarios(); return; } else { us.correo = t_correo.Text; us.cc = t_cc.Text; if (chk_adm.Checked) { l_unidad_negocio.Text = ReporteRNegocio.obtiene_todos_u_negocio(); l_pantallas.Text = ReporteRNegocio.obtiene_todos_app(); l_grupos.Text = ReporteRNegocio.obtiene_todos_grupos(); } us.u_negocio = l_unidad_negocio.Text; us.grupos = l_grupos.Text; us.app = l_pantallas.Text; if (usuarioBO.registrar(us) == "OK") { h3_.InnerText = "Usuario Agregado."; //chk_adm.Checked = true; t_cc.Text = ""; r_enviar_2.Checked = false; DIV222.Attributes["style"] = "display:none;"; l_unidad_negocio.Text = ""; l_pantallas.Text = ""; l_grupos.Text = ""; DIV2_3.Attributes["style"] = "display:none;"; txt_clave.Text = ""; txt_cod_usuario.Text = ""; t_correo.Text = ""; r_enviar_correo.Checked = false; ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>vaciar_editar();</script>", false); cargar_usuarios(); } } } }
protected void btn_save_Click(object sender, EventArgs e) { usuarioEntity us = new usuarioEntity(); us.cod_usuario = txt_cod_usuario_edit.Text; us.correo = t_correo_editar.Text; if (txt_clave_edit.Text != "") { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(txt_clave_edit.Text.ToUpper()); us.clave = contrasena; } else { us.clave = ReporteRNegocio.es_su_pass(usuario.Text); } if (activado.Checked) { us.activado = "true"; } else { us.activado = "false"; } if (chk_enviar_correo.Checked) { us.enviar = "true"; } else { us.enviar = "false"; } bool elimina = false; if (chk_vend2.Checked) { us.tipo_usuario = 2; l_unidad_negocio.Text = ""; elimina = true; } else if (chk_otro2.Checked) { us.tipo_usuario = 3; } else { us.tipo_usuario = 1; } if (usuarioBO.actualizar(us, usuario.Text) == "OK") { if (elimina) { try { usuarioBO.eliminar_grupos_usuario(usuario.Text); } catch { } } if (l_unidad_negocio.Text != "") { try { usuarioBO.eliminar_grupos_usuario(usuario.Text); } catch { } if (l_unidad_negocio.Text.Contains(",")) { if (l_unidad_negocio.Text.Contains("-- Todos --")) { foreach (ListItem item in d_grupos_2.Items) { usuarioBO.registrar_det(us.cod_usuario, item.ToString()); } } else { string[] grupos = l_unidad_negocio.Text.Split(','); foreach (string grupo in grupos) { usuarioBO.registrar_det(us.cod_usuario, grupo); } } } else { if (l_unidad_negocio.Text == "-- Todos --") { foreach (ListItem item in d_grupos_2.Items) { if (item.ToString() != "-- Todos --") { usuarioBO.registrar_det(us.cod_usuario, item.ToString()); } } } else { usuarioBO.registrar_det(us.cod_usuario, l_unidad_negocio.Text); } } } //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>editado();</script>", false); h3_.InnerText = "Usuario Editado."; cargar_usuarios(); } else { //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>no_editado();</script>", false); h3_.InnerText = "Error al Editar, verifique los datos"; } div_editar_usuario.Visible = false; fondo_modal.Visible = false; cargar_usuarios(); }
protected void G_usuarios_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "delete_") { usuarioEntity us = new usuarioEntity(); us.cod_usuario = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString(); string es_adm = usuarioBO.obtener_adm(us.cod_usuario); if (es_adm != "True") { if (usuarioBO.eliminar(us) == "OK") { h3_.InnerText = "Usuario Eliminado."; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>delete_adm();</script>", false); } cargar_usuarios(); } else { h3_.InnerText = "No puede eliminar un usuario Administrador."; } txt_clave.Text = ""; txt_cod_usuario.Text = ""; t_correo.Text = ""; r_enviar_correo.Checked = false; ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>vaciar_editar();</script>", false); } if (e.CommandName == "Editar") { txt_cod_usuario.Enabled = false; //chk_adm.Attributes["AutoPostBack"] = "True"; h3_.InnerText = "Editar Usuario"; Session["SW_CLICK"] = "EDITAR"; USUARIOS.ActiveViewIndex = 1; //COD_USUARIO = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString(); Session["COD_USUARIO"] = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString(); l_grupos.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[4].ToString(); l_unidad_negocio.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[9].ToString(); l_pantallas.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[11].ToString(); t_correo.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[6].ToString(); t_cc.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[8].ToString(); txt_cod_usuario.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[0].ToString(); t_nombre_us.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[12].ToString(); txt_clave.Text = ""; l_grupos.Text = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[4].ToString(); if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[2].ToString() == "True") { r_activo.Checked = true; } else { r_activo.Checked = false; } if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[5].ToString() == "True") { r_enviar_correo.Checked = true; } else { r_enviar_correo.Checked = false; } if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[7].ToString() == "True") { r_enviar_2.Checked = true; } else { r_enviar_2.Checked = false; } if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[10].ToString() == "1") { //es_vendedor_2 = false; Session["bool_es_vendedor_2"] = false; chk_adm.Checked = true; chk_vend.Checked = false; chk_otro.Checked = false; DIV2_3.Attributes["style"] = "display:none;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:none;"; DIV555.Attributes["style"] = "display:block;"; } else if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[10].ToString() == "2") { //es_vendedor_2 = true; Session["bool_es_vendedor_2"] = true; //unidad_ = ReporteRNegocio.trae_u_negocio(txt_cod_usuario.Text.Trim()); Session["unidad_"] = ReporteRNegocio.trae_u_negocio(txt_cod_usuario.Text.Trim()); string negocio_aux = l_unidad_negocio.Text; DIV555.Attributes["style"] = "display:none;"; chk_adm.Checked = false; chk_vend.Checked = true; chk_otro.Checked = false; string grupo = ReporteRNegocio.grupos_usuario_v_report(txt_cod_usuario.Text).Trim(); Session["grupo_"] = grupo; if (grupo.Contains("Abarrotes") || grupo.Contains("Granos")) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>muestra_check();</script>", false); } cargar_unidad_negocio_vend(grupo); l_unidad_negocio.Text = negocio_aux; cargar_grupo_vend(grupo); cargar_pantallas_vend(grupo); DIV222.Attributes["style"] = "display:block;"; DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; string cod_un = ""; if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[9].ToString() == "") { cod_un = ReporteRNegocio.cod_unineg(grupo); } else { cod_un = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[9].ToString(); } string where = " where cod_unineg in (" + cod_un + ") "; DataTable app = ReporteRNegocio.carga_app_unidad(where); cargar_app_uni(app); foreach (ListItem item in d_unidade_negocio.Items) { List <string> app2 = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[9].ToString().Split(',').ToList(); foreach (string x in app2) { if (x.Trim() == item.Value.Trim()) { item.Selected = true; } } } foreach (ListItem item in d_pantallas.Items) { List <string> app2 = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[11].ToString().Split(',').ToList(); foreach (string x in app2) { if (x.Trim() == item.Value.Trim()) { item.Selected = true; } } } } else { //es_vendedor_2 = false; Session["bool_es_vendedor_2"] = false; chk_adm.Checked = false; chk_vend.Checked = false; chk_otro.Checked = true; string grupo = ReporteRNegocio.grupos_usuario(txt_cod_usuario.Text).Trim(); string u_negoc = ReporteRNegocio.negocio_usuario(txt_cod_usuario.Text).Trim(); if (u_negoc == "" && grupo != "") { u_negoc = ReporteRNegocio.negocio_usuario_por_grupos(agregra_comillas(grupo)); } if (grupo.Contains("Abarrotes") || grupo.Contains("Granos")) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>muestra_check();</script>", false); } DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV555.Attributes["style"] = "display:block;"; cargar_unidad_negocio(); foreach (ListItem item in d_unidade_negocio.Items) { List <string> app2 = u_negoc.Split(',').ToList(); foreach (string x in app2) { if (x.Trim() == item.Value.Trim()) { item.Selected = true; } } } l_unidad_negocio.Text = u_negoc; string where = " where cod_unineg in (" + l_unidad_negocio.Text + ") "; if (grupo == "") { grupo = "-1"; } else { DataTable grupos = ReporteRNegocio.carga_grupo_unidad(" where cod_grupo in (" + agregra_comillas(grupo) + ")"); cargar_grupo_uni(grupos); foreach (ListItem item in d_grupos.Items) { if (G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[4].ToString().Contains(item.ToString())) { item.Selected = true; } } } if (u_negoc == "") { where = " where 1=2 "; } DataTable app = ReporteRNegocio.carga_app_unidad(where); cargar_app_uni(app); foreach (ListItem item in d_pantallas.Items) { List <string> app2 = G_usuarios.DataKeys[Convert.ToInt32(e.CommandArgument)].Values[11].ToString().Split(',').ToList(); foreach (string x in app2) { if (x.Trim() == item.Value.Trim()) { item.Selected = true; } } } } } }
protected void Page_Load(object sender, EventArgs e) { Document doc = new Document(); try { bool enviar_correo = false; string id_cotizacion = ""; DBUtil db = new DBUtil(); usuarioEntity vend = new usuarioEntity(); vend = (usuarioEntity)(Session["usuario"]); if (vend != null) { if (Request.QueryString["idctz"] != null) { id_cotizacion = Request.QueryString["idctz"].ToString(); } if (Request.QueryString["cr"] != null) { if (Request.QueryString["cr"].ToString() == "SI") { enviar_correo = true; } } if (id_cotizacion != "") { ctz_cotizacionEntity ctz = new ctz_cotizacionEntity(); ctz.id_cotizacion = int.Parse(id_cotizacion); if (ctz_cotizacionBO.encontrar(ref ctz) == "OK") { if (ctz.cod_vendedor == vend.cod_usuario) { // string path = Server.MapPath("COTIZACIONES"); string nombre_pdf = "cotizacion_" + vend.cod_usuario + "_" + id_cotizacion; string n_file = "/" + nombre_pdf.Replace(",", "").Replace(".", "").Replace(" ", "").Replace("/", "") + ".pdf"; try { System.IO.File.Delete(path + n_file); } catch (System.IO.IOException ex) { } PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(path + n_file, FileMode.Create)); try { ITextEvents PageEventHandler = new ITextEvents() { ImageFooter = iTextSharp.text.Image.GetInstance(Server.MapPath("~/COTIZADOR/LOGOS/banner.jpg")) }; writer.PageEvent = PageEventHandler; DataTable dt_detalle = new DataTable(); dt_detalle = db.consultar("select * from V_CTZ_COTIZACION_DET where id_cotizacion = " + ctz.id_cotizacion + " order by nom_categ, nom_producto"); // CONFIGURACION PDF //doc.SetPageSize(PageSize.LEGAL.Rotate()); doc.SetMargins(10f, 10f, 20f, 200f); doc.AddTitle("Cotización Soprodi"); doc.AddCreator(vend.nombre_); // ------------ FONTS doc.Open(); // ENCABEZADO (2 Logos y el encabezado superior). PdfPTable tabla_encabezado = new PdfPTable(3); tabla_encabezado.LockedWidth = true; tabla_encabezado.TotalWidth = 575f; float[] widths_enc = new float[] { 100f, 375f, 100f }; tabla_encabezado.SetWidths(widths_enc); // AGREGAR LOGOS iTextSharp.text.Image imagen = creaimagen("~/COTIZADOR/LOGOS/dereyes.png", 80, "c"); iTextSharp.text.Image imagen2 = creaimagen("~/COTIZADOR/LOGOS/soprodi.jpg", 80, "c"); // PRIMERA IMAGEN agregaimagen(ref tabla_encabezado, imagen, 0, "c"); // ************************************************ // ENCABEZADO (DATOS SOPRODI) PdfPTable titulo = new PdfPTable(1); titulo.WidthPercentage = 100; agregacelda(ref titulo, "COTIZACION DE PRODUCTOS", titulo_font, 0, "c"); //agregacelda(ref titulo, "SOCIEDAD PRODUCTORA Y DISTRIBUIDORA S.A", titulo_font, 0, "c"); //agregacelda(ref titulo, "SOPRODI S.A", titulo_font, 0, "c"); //agregacelda(ref titulo, "IMPORTACIONES, EXPORTACIONES,", fuente_negrita, 0, "c"); //agregacelda(ref titulo, "DISTRIBUCIÓN DE PRODUCTOS AGRÍCOLAS", fuente_negrita, 0, "c"); //agregacelda(ref titulo, "TRANSPORTES DE CARGA TERRESTRE,", fuente_negrita, 0, "c"); //agregacelda(ref titulo, "ALMACENAJES, ABARROTES, TRANSPORTE MARÍTIMO Y DE CABOTAJE DE CARGA", fuente_negrita, 0, "c"); //agregacelda(ref titulo, "Casa Matriz: Paradero 9 1/2, Camino Troncal San Pedro - Quillota - Casilla 7 Correo Quillota", fuente_normal, 0, "c"); //agregacelda(ref titulo, "Fono: (56 33) 2292500 - Fax: (56 33) 2318139", fuente_normal, 0, "c"); //agregacelda(ref titulo, "Email: [email protected]", fuente_normal, 0, "c"); agregatabla(ref tabla_encabezado, titulo, 0, "c"); // *********************************************************************************************************************************************** // SEGUNDA IMAGEN Y NUMERO DE COTIZACION PdfPTable columna3 = new PdfPTable(1); columna3.WidthPercentage = 100; agregaimagen(ref columna3, imagen2, 0, "c"); agregacelda(ref columna3, " ", titulo_font, 0, "c"); PdfPTable td_columna3 = new PdfPTable(1); td_columna3.WidthPercentage = 100; agregacelda(ref td_columna3, "COTIZACIÓN #", titulo_font, 0, "c"); agregacelda(ref td_columna3, "***", titulo_font, 0, "c"); agregacelda(ref td_columna3, "Válido hasta", fuente_normal, 0, "c"); agregacelda(ref td_columna3, DateTime.Now.AddDays(2).ToString("dd/MM/yyyy"), fuente_negrita, 0, "c"); agregatabla(ref columna3, td_columna3, 1, "c"); agregatabla(ref tabla_encabezado, columna3, 0, "c"); // ***************************************************************************** // Insertamos el encabezado doc.Add(tabla_encabezado); doc.Add(Chunk.NEWLINE); SaltoLinea(ref doc); // SUB ENCABEZADO PdfPTable tabla_subencabezado = new PdfPTable(1); tabla_subencabezado.WidthPercentage = 100; PdfPTable td_tabla_subencabezado = new PdfPTable(6); td_tabla_subencabezado.TotalWidth = 575f; float[] widthsubencabezado = new float[] { 50f, 10f, 170f, 50f, 10f, 170f }; td_tabla_subencabezado.SetWidths(widthsubencabezado); agregacelda(ref td_tabla_subencabezado, "Señor(es)", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, ":", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, "NOMBRE_CLIENTE", fuente_normal, 0, "i"); agregacelda(ref td_tabla_subencabezado, "R.U.T", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, ":", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, "RUT_CLIENTE", fuente_normal, 0, "i"); agregacelda(ref td_tabla_subencabezado, "Giro", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, ":", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, "GIRO_CLIENTE", fuente_normal, 0, "i"); agregacelda(ref td_tabla_subencabezado, "Comuna", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, ":", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, "COMUNA_CLIENTE", fuente_normal, 0, "i"); agregacelda(ref td_tabla_subencabezado, "Dirección", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, ":", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, "DIRECCION_CLIENTE", fuente_normal, 0, "i"); agregacelda(ref td_tabla_subencabezado, "Ciudad", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, ":", fuente_negrita, 0, "i"); agregacelda(ref td_tabla_subencabezado, "CIUDAD_CLIENTE", fuente_normal, 0, "i"); agregatabla(ref tabla_subencabezado, td_tabla_subencabezado, 1, "i"); doc.Add(tabla_subencabezado); // SUB ENCABEZADO 2 PdfPTable tabla_subencabezado2 = new PdfPTable(3); tabla_subencabezado2.WidthPercentage = 100; PdfPTable td_sub2_1 = new PdfPTable(1); agregacelda(ref td_sub2_1, "FECHA DE EMISION", fuente_negrita, 0, "c"); agregacelda(ref td_sub2_1, ctz.fecha_creacion.ToString("dd/MM/yyyy"), fuente_normal, 0, "c"); agregatabla(ref tabla_subencabezado2, td_sub2_1, 1, "i"); PdfPTable td_sub2_2 = new PdfPTable(1); agregacelda(ref td_sub2_2, "PLAZO DE PAGO", fuente_negrita, 0, "c"); agregacelda(ref td_sub2_2, "CONVENIDO ENTRE LAS PARTES", fuente_normal, 0, "c"); agregatabla(ref tabla_subencabezado2, td_sub2_2, 1, "i"); PdfPTable td_sub2_5 = new PdfPTable(1); agregacelda(ref td_sub2_5, "VENDEDOR", fuente_negrita, 0, "c"); agregacelda(ref td_sub2_5, vend.nombre_, fuente_normal, 0, "c"); agregatabla(ref tabla_subencabezado2, td_sub2_5, 1, "i"); doc.Add(tabla_subencabezado2); // **************************************************************************** SaltoLinea(ref doc); // RECORRER DETALLE// DETALLE int contador_bodegas = 0; int num_columnas = 2; for (int i = 1; i <= 3; i++) { if (dt_detalle.Rows[0]["cod_bodega_" + i].ToString() != "NO") { contador_bodegas++; num_columnas = num_columnas + 5; } } PdfPTable tablaOTZ = new PdfPTable(num_columnas); tablaOTZ.LockedWidth = true; tablaOTZ.TotalWidth = 575f; float[] widthtablaOTZ = new float[] { 0f }; if (num_columnas == 7) { widthtablaOTZ = new float[] { 25f, 200f, 86f, 86f, 86f, 86f, 86f }; } else if (num_columnas == 12) { widthtablaOTZ = new float[] { 25f, 200f, 43f, 43f, 43f, 43f, 43f, 43f, 43f, 43f, 43f, 43f }; } else { widthtablaOTZ = new float[] { 25f, 60f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f, 29f }; } tablaOTZ.SetWidths(widthtablaOTZ); //tablaOTZ.WidthPercentage = 100; // COLSPANS SUPERIORES PdfPCell td1 = new PdfPCell(new Phrase(" ", fuente_negrita)); td1.Colspan = 2; td1.BorderWidth = 1; tablaOTZ.AddCell(td1); for (int i = 1; i <= contador_bodegas; i++) { PdfPCell td2 = new PdfPCell(new Phrase(dt_detalle.Rows[0]["bod" + i].ToString(), fuente_negrita)); td2.Colspan = 5; td2.BorderWidth = 1; tablaOTZ.AddCell(td2); } // FIN COLSPANS agregacelda(ref tablaOTZ, "Nº", fuente_negrita, 1, "c"); //agregacelda(ref tablaOTZ, "Cod. Producto", fuente_negrita, 1, "c"); //agregacelda(ref tablaOTZ, "Categoría", fuente_negrita, 1, "c"); agregacelda(ref tablaOTZ, "Producto", fuente_negrita, 1, "c"); for (int i = 1; i <= contador_bodegas; i++) { agregacelda(ref tablaOTZ, "Precio", fuente_negrita, 1, "c"); agregacelda(ref tablaOTZ, "Precio Unit.", fuente_negrita, 1, "c"); agregacelda(ref tablaOTZ, "Precio Unit c/IVA", fuente_negrita, 1, "c"); agregacelda(ref tablaOTZ, "Cantidad", fuente_negrita, 1, "c"); agregacelda(ref tablaOTZ, "Subtotal neto", fuente_negrita, 1, "c"); } int contador = 1; string aux_cat = ""; foreach (DataRow dr in dt_detalle.Rows) { if (aux_cat != dr["nom_categ"].ToString()) { PdfPCell td_categoria2 = new PdfPCell(new Phrase(" ", fuente_negrita)); PdfPCell td_categoria = new PdfPCell(new Phrase(dr["nom_categ"].ToString(), fuente_negrita)); if (contador_bodegas == 1) { td_categoria.Colspan = 7; td_categoria2.Colspan = 7; } else if (contador_bodegas == 2) { td_categoria.Colspan = 12; td_categoria2.Colspan = 12; } else { td_categoria.Colspan = 17; td_categoria2.Colspan = 17; } td_categoria.BorderWidth = 0; td_categoria2.BorderWidth = 0; tablaOTZ.AddCell(td_categoria2); tablaOTZ.AddCell(td_categoria); agregacelda(ref tablaOTZ, contador.ToString(), fuente_normal, 1, "c"); //agregacelda(ref tablaOTZ, dr["producto"].ToString(), fuente_normal, 1, "c"); //agregacelda(ref tablaOTZ, dr["nom_categ"].ToString(), fuente_normal, 1, "i"); agregacelda(ref tablaOTZ, dr["nom_producto"].ToString(), fuente_normal, 1, "i"); for (int i = 1; i <= contador_bodegas; i++) { agregacelda(ref tablaOTZ, "$ " + int.Parse(dr["precio_con_descuento_" + i].ToString()).ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, "$ " + int.Parse(dr["precio_con_descuento_unitario_" + i].ToString()).ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, "$ " + (int.Parse(dr["precio_con_descuento_unitario_" + i].ToString()) + ((int.Parse(dr["precio_con_descuento_unitario_" + i].ToString()) * 19) / 100)).ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, dr["cantidad_" + i].ToString(), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, "$ " + int.Parse(dr["total_" + i].ToString()).ToString("#,##0"), fuente_negrita, 1, "d"); } aux_cat = dr["nom_categ"].ToString(); } else { agregacelda(ref tablaOTZ, contador.ToString(), fuente_normal, 1, "c"); //agregacelda(ref tablaOTZ, dr["producto"].ToString(), fuente_normal, 1, "c"); //agregacelda(ref tablaOTZ, dr["nom_categ"].ToString(), fuente_normal, 1, "i"); agregacelda(ref tablaOTZ, dr["nom_producto"].ToString(), fuente_normal, 1, "i"); for (int i = 1; i <= contador_bodegas; i++) { agregacelda(ref tablaOTZ, "$ " + int.Parse(dr["precio_con_descuento_" + i].ToString()).ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, "$ " + int.Parse(dr["precio_con_descuento_unitario_" + i].ToString()).ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, "$ " + (int.Parse(dr["precio_con_descuento_unitario_" + i].ToString()) + ((int.Parse(dr["precio_con_descuento_unitario_" + i].ToString()) * 19) / 100)).ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, dr["cantidad_" + i].ToString(), fuente_normal, 1, "d"); agregacelda(ref tablaOTZ, "$ " + int.Parse(dr["total_" + i].ToString()).ToString("#,##0"), fuente_negrita, 1, "d"); } } contador++; } doc.Add(tablaOTZ); SaltoLinea(ref doc); // TOTALES DataTable dt_totales = new DataTable(); string sql = ""; sql += " select bod1.nombre_bodega as nom1, bod2.nombre_bodega as nom2, bod3.nombre_bodega as nom3, sum(total_1) as 'total_1', sum(total_2) as 'total_2' , sum(total_3) as 'total_3' " + " ,sum(total_iva_1) as 'total_iva_1', sum(total_iva_2) as 'total_iva_2', sum(total_iva_3) as 'total_iva_3' " + " from CTZ_Cotizacion_det ctz left join CTZ_Bodegas bod1 on ctz.cod_bodega_1 = bod1.cod_bodega " + " left join CTZ_Bodegas bod2 on ctz.cod_bodega_2 = bod2.cod_bodega " + " left join CTZ_Bodegas bod3 on ctz.cod_bodega_3 = bod3.cod_bodega " + " where id_cotizacion = " + id_cotizacion + " group by bod1.nombre_bodega, bod2.nombre_bodega,bod3.nombre_bodega "; dt_totales = db.consultar(sql); if (dt_totales.Rows.Count > 0) { PdfPTable tablaTotales = new PdfPTable(contador_bodegas); tablaTotales.HorizontalAlignment = Element.ALIGN_RIGHT; if (contador_bodegas == 1) { tablaTotales.WidthPercentage = 20; } else if (contador_bodegas == 2) { tablaTotales.WidthPercentage = 40; } else if (contador_bodegas == 3) { tablaTotales.WidthPercentage = 60; } for (int i = 1; i <= contador_bodegas; i++) { try { int total = int.Parse(dt_totales.Rows[0]["total_" + i].ToString()); int totaliva = int.Parse(dt_totales.Rows[0]["total_iva_" + i].ToString()); if (dt_totales.Rows[0]["nom" + i].ToString() != "NO") { PdfPTable tablaTotales_td = new PdfPTable(2); PdfPCell td_total = new PdfPCell(new Phrase(dt_totales.Rows[0]["nom" + i].ToString(), fuente_negrita)); td_total.Colspan = 2; td_total.BorderWidth = 1; tablaTotales_td.AddCell(td_total); agregacelda(ref tablaTotales_td, "Total Neto", fuente_negrita, 1, "i"); agregacelda(ref tablaTotales_td, "$ " + total.ToString("#,##0"), fuente_normal, 1, "d"); agregacelda(ref tablaTotales_td, "Total c/IVA", fuente_negrita, 1, "i"); agregacelda(ref tablaTotales_td, "$ " + totaliva.ToString("#,##0"), fuente_normal, 1, "d"); agregatabla(ref tablaTotales, tablaTotales_td, 1, "c"); } } catch (Exception) { } } doc.Add(tablaTotales); } else { } SaltoLinea(ref doc); // SERVICIOS DataTable dt_servicios = new DataTable(); dt_servicios = ctz_cotizaciones_serviciosBO.GetAll(" where id_cotizacion = " + id_cotizacion + " and tipo_servicio = 'POR SEPARADO' "); if (dt_servicios.Rows.Count > 0) { PdfPTable tabla_servicios = new PdfPTable(2); tabla_servicios.HorizontalAlignment = Element.ALIGN_RIGHT; tabla_servicios.WidthPercentage = 40; agregacelda(ref tabla_servicios, "Servicio", fuente_negrita, 1, "i"); agregacelda(ref tabla_servicios, "Valor", fuente_negrita, 1, "d"); foreach (DataRow dr_servicio in dt_servicios.Rows) { agregacelda(ref tabla_servicios, dr_servicio["nombre_servicio"].ToString(), fuente_normal, 1, "i"); agregacelda(ref tabla_servicios, "$" + int.Parse(dr_servicio["valor_servicio"].ToString()).ToString("#,##0"), fuente_normal, 1, "d");; } doc.Add(tabla_servicios); } // // FIN SaltoLinea(ref doc); //// COMENTARIO AGREGADO AL PDF //PdfPTable tablacomentario = new PdfPTable(1); //tablacomentario.HorizontalAlignment = Element.ALIGN_LEFT; //tablacomentario.WidthPercentage = 100; //agregacelda(ref tablacomentario, "PRUEBA DE COMENTARIO, VENTA POR SOBRE askldalskdklasdklaskldas", fuente_normal); //doc.Add(tablacomentario); //// //// //SaltoLinea(ref doc); doc.NewPage(); doc.Close(); writer.Close(); string pdfPath = Server.MapPath("~/COTIZADOR/COTIZACIONES/" + n_file); if (enviar_correo) { string htmlcorreo = ""; htmlcorreo += "<div style='text-align:center; display: block !important;' > "; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div> "; htmlcorreo += "</div>"; htmlcorreo += "<div><img src='http://a58.imgup.net/Sopro4d9d.png' style=' float: right; width: 90px;'> </div>"; htmlcorreo += "<h4>Cliente: [NOMBRE_CLIENTE] </h4>"; htmlcorreo += "<p>Con fecha: " + DateTime.Now.ToString("dd/MM/yyyy") + " envío la siguiente cotización adjunta. </p>"; htmlcorreo += "<p>Precios válidos hasta: " + DateTime.Now.AddDays(2).ToString("dd/MM/yyyy") + "</p>"; htmlcorreo += "<h4>Vendedor: " + vend.nombre_ + "</h4>"; htmlcorreo += "<br> Para más detalles diríjase a: <a href='http://www.dereyes.cl/productos.php' > DeReyes.cl </a> <span style='font:5px; color:gray; float:right;'>No Responder Este Correo</span> <br><br>"; htmlcorreo += "<div style='text-align:center; display: block !important;' > "; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#DC1510; float:right; width:12.5%; height:6px'></div>"; htmlcorreo += "<div style='background-color:#005D99; float:right; width:12.5%; height:6px'></div> "; htmlcorreo += "</div>"; Correo cr = new Correo(); cr.EnviarCorreo("*****@*****.**", "*****@*****.**", "Cotización Soprodi", htmlcorreo, "", pdfPath, "SOPRODI"); } else { WebClient client = new WebClient(); Byte[] buffer = client.DownloadData(pdfPath); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", buffer.Length.ToString()); Response.BinaryWrite(buffer); Response.Flush(); Response.End(); } } catch (Exception ex) { doc.Close(); writer.Close(); ERROR.Text = "Ocurrió un problema al generar PDF"; } } else { ERROR.Text = "Esta cotización no es de su propiedad por favor evite ver otras cotizaciones que no le corresponden."; } } } } else { Response.Redirect("Login.aspx"); } } catch (Exception ex) { doc.Close(); ERROR.Text = "Ocurrió un problema al generar PDF"; } }
private void EDITAR_GUARDAR() { if (txt_cod_usuario.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "1" && l_grupos.Text == "" || chk_otro.Checked && l_unidad_negocio.Text == "2" && l_grupos.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_vend.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } //else if (r_enviar_correo.Checked && t_correo.Text == "" || r_enviar_2.Checked && t_correo.Text == "") //{ // h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) // { // DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; // DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; // } //} else { usuarioEntity us = new usuarioEntity(); us.cod_usuario = txt_cod_usuario.Text; if (txt_clave.Text != "") { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(txt_clave.Text.ToUpper()); us.clave = contrasena; } else { //cambiar variable estatica string cod_usuario_session = Session["COD_USUARIO"].ToString(); //us.clave = ReporteRNegocio.es_su_pass(COD_USUARIO); us.clave = ReporteRNegocio.es_su_pass(cod_usuario_session); } if (chk_adm.Checked) { us.admin = "true"; } else { us.admin = "false"; } if (chk_vend.Checked) { us.tipo_usuario = 2; us.nombre_ = ReporteRNegocio.nombre_vendedor(us.cod_usuario); } else if (chk_otro.Checked) { us.tipo_usuario = 3; us.nombre_ = t_nombre_us.Text; } else { us.tipo_usuario = 1; us.nombre_ = t_nombre_us.Text; } if (r_activo.Checked) { us.activado = "true"; } else { us.activado = "false"; } if (r_enviar_2.Checked) { us.enviar2 = "true"; } else { us.enviar2 = "false"; } if (r_enviar_correo.Checked) { us.enviar = "true"; } else { us.enviar = "false"; } us.correo = t_correo.Text; us.cc = t_cc.Text; if (chk_adm.Checked) { l_unidad_negocio.Text = ReporteRNegocio.obtiene_todos_u_negocio(); l_pantallas.Text = ReporteRNegocio.obtiene_todos_app(); l_grupos.Text = ReporteRNegocio.obtiene_todos_grupos(); } us.u_negocio = l_unidad_negocio.Text; us.grupos = l_grupos.Text; us.app = l_pantallas.Text; string cod_usuario_ = txt_cod_usuario.Text; //if (usuarioBO.actualizar(us, COD_USUARIO) == "OK") if (usuarioBO.actualizar(us, cod_usuario_) == "OK") { h3_.InnerText = "Usuario Editado."; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else { h3_.InnerText = "Falló al Editar."; } } }