public String getContactCFE_byRUP(string strRPU) { clsZone oClsZone = new clsZone(); clsContactCFE oClsContactoCFE = new clsContactCFE(); DataTable dtZone; StringBuilder strHTMLGroup = new StringBuilder(); dtZone = oClsContactoCFE.getByRUP(strRPU); if (dtZone == null) { return("Error al recuperar los datos"); } else { if (dtZone.Rows.Count > 0) { strHTMLGroup = oClsContactoCFE.ReturnHTMLRup(dtZone); return(strHTMLGroup.ToString()); //return "<div class='table-responsive'><table class='table table-hover table-bordred table-striped table-bordered'><thead><tr class='filters'><th class='text-center'>CFE</th></tr></thead><tbody><tr><td>Juna Pérez <p>Av. 5 de Mayo No. 1390 Col. Napoles </p><p><a href='mailto:[email protected]'>[email protected]</a> </p></td></tr></tbody></table></div>: "; } else { return("No hay datos para mostrar"); } } }
/// <summary> /// Save new CFE contact /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { clsContactCFE oClsContactCFE = new clsContactCFE(); Boolean bmsg = false; try { msgErrNew.InnerText = ""; msgErrNew.Style.Add("display", "none"); string strTitle = cmbTitle.Items[cmbTitle.SelectedIndex].Value; string strDivision = cmbNewDivision.Items[cmbNewDivision.SelectedIndex].Value; string strZone = cmbNewZone.Items[cmbNewZone.SelectedIndex].Value; string strName = txtName.Text; string strFirstName = txtFN.Text; string strLastName = txtLN.Text; string strCharge = txtCharge.Text; string strWorkTel = txtWorkTel.Text; string strExt = txtExt.Text; string strCel = txtCel.Text; string strPuesto = txtCharge.Text; string strEmail = txtEmail.Text; if (string.IsNullOrEmpty(strDivision)) { msgErrNew.InnerText = ""; msgErrNew.Style.Add("display", "inline"); msgErrNew.InnerText = "Falta seleccionar La división y la zona"; } if (string.IsNullOrEmpty(strZone)) { msgErrNew.InnerText = ""; msgErrNew.Style.Add("display", "inline"); msgErrNew.InnerText = "Falta seleccionar La división y la zona"; } if (!string.IsNullOrEmpty(strDivision) && !string.IsNullOrEmpty(strZone) && !string.IsNullOrEmpty(strName)) { bmsg = oClsContactCFE.NewContactCFE(strTitle, strDivision, strZone, strName, strFirstName, strLastName, strCharge, strWorkTel, strExt, strCel, strEmail, strPuesto); if (!bmsg) { msgErrNew.InnerText = ""; msgErrNew.Style.Add("display", "inline"); msgErrNew.InnerText = "Falta seleccionar La división y la zona"; } else { Response.Redirect("contactocfe.aspx"); } } } catch (Exception ex) { clsError.logMessage = ex.ToString(); clsError.logModule = "Page_Load"; clsError.LogWrite(); } }
private void buscar() { clsZone oClsZone = new clsZone(); clsContactCFE oClsContactoCFE = new clsContactCFE(); DataTable dtZone; StringBuilder strHTMLGroup = new StringBuilder(); try { msgErrorSearch.InnerText = ""; msgErrorSearch.Style.Add("display", "none"); string strDivision = ddl_Divisiones.Items[ddl_Divisiones.SelectedIndex].Value; string strZone = string.Empty; if (ddl_Zonas.SelectedIndex != -1) { strZone = ddl_Zonas.Items[ddl_Zonas.SelectedIndex].Value; } dtZone = oClsContactoCFE.ValidateFilters(strDivision, strZone); if (dtZone == null) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Error al recuperar los datos','warning');", true); //msgErrorSearch.InnerText = ""; //msgErrorSearch.Style.Add("display", "inline"); //msgErrorSearch.InnerText = "Error al recuperar los datos"; } else { if (dtZone.Rows.Count > 0) { strHTMLGroup = oClsContactoCFE.ReturnHTMLDivision(dtZone); DBDataPlaceHolder.Controls.Add(new Literal { Text = strHTMLGroup.ToString() }); } else { //msgErrorSearch.InnerText = ""; //msgErrorSearch.Style.Add("display", "inline"); //msgErrorSearch.InnerText = "No hay datos para mostrar"; ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','No hay datos para mostrar','warning');", true); } } } catch (Exception ex) { clsError.logMessage = ex.ToString(); clsError.logModule = "btnSearch_Click"; clsError.LogWrite(); msgErrorSearch.InnerText = ""; msgErrorSearch.Style.Add("display", "inline"); msgErrorSearch.InnerHtml = ex.ToString(); } }
private void Buscar() { clsZone oClsZone = new clsZone(); clsContactCFE oClsContactoCFE = new clsContactCFE(); DataTable dtZone; StringBuilder strHTMLGroup = new StringBuilder(); try { msgErrorSearch.InnerText = ""; msgErrorSearch.Style.Add("display", "none"); string strDivision = cmbSearchDivision.Items[cmbSearchDivision.SelectedIndex].Value; string strZone = string.Empty; if (cmbSearchZone.SelectedIndex != -1) { strZone = cmbSearchZone.Items[cmbSearchZone.SelectedIndex].Value; } dtZone = oClsContactoCFE.ValidateFilters(strDivision, strZone); if (dtZone == null) { msgErrorSearch.InnerText = ""; msgErrorSearch.Style.Add("display", "inline"); msgErrorSearch.InnerText = "Error al recuperar los datos"; } else { if (dtZone.Rows.Count > 0) { strHTMLGroup = oClsContactoCFE.ReturnHTMLDivision(dtZone); DBDataPlaceHolder.Controls.Add(new Literal { Text = strHTMLGroup.ToString() }); } else { msgErrorSearch.InnerText = ""; msgErrorSearch.Style.Add("display", "inline"); msgErrorSearch.InnerText = "No hay datos para mostrar"; } } } catch (Exception ex) { clsError.logMessage = ex.ToString(); clsError.logModule = "btnSearch_Click"; clsError.LogWrite(); msgErrorSearch.InnerText = ""; msgErrorSearch.Style.Add("display", "inline"); msgErrorSearch.InnerHtml = ex.ToString(); } }
public String EditContactCFE(string strID, string strTitulo, string strDivision, string strZona, string strCorreo, string strNombre, string strApPaterno, string strApMaterno, string strTelTrabajo, string strExt, string strCelular, string strPuesto) { String msg = ""; clsContactCFE oClsContactCFE = new clsContactCFE(); //if (string.IsNullOrEmpty(strDivision)) { return "Falta agregar la división"; } //if (string.IsNullOrEmpty(strZona)) { return "Falta agregar la Zona"; } //if (string.IsNullOrEmpty(strCorreo)) { return "Falta agregar el Corro electrónico"; } msg = oClsContactCFE.UpdateDivision(strID, strTitulo, strDivision, strZona, strCorreo, strNombre, strApPaterno, strApMaterno, strTelTrabajo, strExt, strCelular, strPuesto); //if (msg) { return "La Division se ha actualizado en la base de datos"; } //else { return "Error al actualizar los datos"; } return(msg); }
public String DeleteContactCFE(string strId) { Boolean msg = true; clsContactCFE oClsContactCFE = new clsContactCFE(); //if (string.IsNullOrEmpty(strDivision)) { return "Falta agregar la division"; } //if (string.IsNullOrEmpty(strZone)) { return "Falta agregar la Zona"; } //if (string.IsNullOrEmpty(strEmail)) { return "Falta agregar el Corroe"; } msg = oClsContactCFE.DeleteContactCFE(strId, 0); if (msg) { return("El contacto se ha eliminado de la base de datos"); } else { return("Error al eliminar el contacto de la base de datos"); } }
protected void Button1_Click(object sender, EventArgs e) { if (!IsPostBack) { return; } else { clsContactCFE oClsContactCFE = new clsContactCFE(); Boolean bmsg = true; try { msgErrNew.InnerText = ""; msgErrNew.Style.Add("display", "none"); string strTitle = cmbTitle.Text; string strDivision = ddl_Divisiones_New.Items[ddl_Divisiones_New.SelectedIndex].Value; string strZone = ddl_Zonas_New.Items[ddl_Zonas_New.SelectedIndex].Value; string strName = txtName.Text; string strFirstName = txtFN.Text; string strLastName = txtLN.Text; string strCharge = txtCharge.Text; string strWorkTel = txtWorkTel.Text; string strExt = txtExt.Text; string strCel = txtCel.Text; string strPuesto = txtCharge.Text; string strEmail = txtEmail.Text; if (string.IsNullOrEmpty(strEmail)) { //msgErrNew.InnerText = ""; //msgErrNew.Style.Add("display", "inline"); ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el correo electrónico.','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewDivisionModal');", true); //msgErrNewDivision.InnerText = "Falta capturar el correo electrónico."; bmsg = false; } if (string.IsNullOrEmpty(strFirstName)) { //msgErrNew.InnerText = ""; //msgErrNew.Style.Add("display", "inline"); ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el apellido paterno.','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewDivisionModal');", true); //msgErrNewDivision.InnerText = "Falta capturar el apellido paterno."; bmsg = false; } if (string.IsNullOrEmpty(strName)) { //msgErrNew.InnerText = ""; //msgErrNew.Style.Add("display", "inline"); //msgErrNewDivision.InnerText = "Falta capturar el nombre."; ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el nombre.','warning');", true); bmsg = false; } if (string.IsNullOrEmpty(strZone)) { //msgErrNew.InnerText = ""; //msgErrNew.Style.Add("display", "inline"); ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta seleccionar la zona.','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewDivisionModal');", true); //msgErrNewDivision.InnerText = "Falta seleccionar la zona."; bmsg = false; } if (string.IsNullOrEmpty(strDivision)) { //msgErrNew.InnerText = ""; //msgErrNew.Style.Add("display", "inline"); ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta seleccionar la división y la zona','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewDivisionModal');", true); //msgErrNewDivision.InnerText = "Falta seleccionar La división y la zona"; bmsg = false; } if (bmsg) { string sResp = ""; sResp = oClsContactCFE.NewContactCFE(strTitle, strDivision, strZone, strName, strFirstName, strLastName, strCharge, strWorkTel, strExt, strCel, strEmail, strPuesto); string[] aResp = sResp.Split('-'); if (aResp[0] == "1") { //msgErrNewDivision.InnerHtml = "<strong>" + aResp[1] + "</strong> ."; ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','" + aResp[1] + "','success');", true); //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("<script type = 'text/javascript'>"); //sb.Append("window.onload=function(){"); ////sb.Append(" $('#msgErrNewDivision').show(); $('#btnaddContac').click(); };"); //sb.Append(" $('#msgErrNewDivision').removeAttr('style');"); //sb.Append(" $('#msgErrNewDivision').addClass('alert alert-success text-center');"); //sb.Append(" $('#msgErrNewDivision').removeClass('alert alert-danger text-center').addClass('alert alert-success text-center');"); //sb.Append(" $('#msgErrNewDivision').show();"); //sb.Append(" $('#btnCloseNewx').click(); "); //sb.Append("</script>"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); buscar(); } else { //msgErrNewDivision.InnerHtml = "<strong>" + aResp[1] + "</strong> ."; ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','" + aResp[1] + "','error');", true); buscar(); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewDivisionModal');", true); //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("<script type = 'text/javascript'>"); //sb.Append("window.onload=function(){"); ////sb.Append(" $('#msgErrNewDivision').show(); $('#btnaddContac').click(); };"); //sb.Append(" $('#msgErrNewDivision').removeAttr('style');"); //sb.Append(" $('#msgErrNewDivision').addClass('alert alert-danger text-center');"); //sb.Append(" $('#msgErrNewDivision').removeClass('alert alert-success text-center').addClass('alert alert-danger text-center');"); //sb.Append(" $('#msgErrNewDivision').show();"); ////sb.Append(" setTimeout(function() { window.location.reload(1); }, 2000); "); //sb.Append("</script>"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } } else { //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("<script type = 'text/javascript'>"); //sb.Append("window.onload=function(){"); ////sb.Append(" $('#msgErrNewDivision').show(); $('#btnaddContac').click(); };"); //sb.Append("</script>"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } } catch (Exception ex) { clsError.logMessage = ex.ToString(); clsError.logModule = "Page_Load"; clsError.LogWrite(); } } }