private void buscar() { clsGestores clsGes = new clsGestores(); StringBuilder strHTML = new StringBuilder(); DataTable dtC = clsGes.dtGetAll(); Session["dtC"] = dtC; strHTML = clsGes.ReturnHTML(dtC); DBDataPlaceHolder.Controls.Add(new Literal { Text = strHTML.ToString() }); }
public String Edit(string id, string tipo, string strNombre, string strApPaterno, string strApMaterno, string strNumeroEmpleado, string strIniciales) { Boolean msg = true; string sResp = ""; clsGestores oClsGestor = new clsGestores(); //if (string.IsNullOrEmpty(strDivision)) { return "Falta agregar la division"; } //if (string.IsNullOrEmpty(strZona)) { return "Falta agregar la Zona"; } //if (string.IsNullOrEmpty(strCorreo)) { return "Falta agregar el Corroe"; } sResp = oClsGestor.Update(id, tipo, strNumeroEmpleado, strNombre, strApPaterno, strApMaterno, strIniciales); //if (msg) { return "La Division se ha actualizado en la base de datos"; } //else { return "Error al actualizar los datos"; } return(sResp); }
public String New(string tipo, string Nombre, string Paterno, string Materno, string strNumeroEmpleado, string strIniciales) { clsGestores oCls = new clsGestores(); Boolean msg = true; string sResp = ""; //if (string.IsNullOrEmpty(CodeCentral)) { return "0-Falta agregar la clave de la Central"; } //if (string.IsNullOrEmpty(Central)) { return "0-Falta agregar la descripción de la Central"; } //msg = oClsCentral.NewCentral(CodeCentral, Central); sResp = oCls.New(tipo, Nombre, Paterno, Materno, strNumeroEmpleado, strIniciales); //Call function to update the Central //if (msg) { return "La Central se creado en la base de datos"; } //else { return "Error al crear la Central de la base de datos"; } return(sResp); }
public String Delete(string strGestor) { Boolean msg = true; clsGestores oClsCon = new clsGestores(); //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 = oClsCon.Delete(strGestor); if (msg) { return("1-El contacto se ha eliminado de la base de datos"); } else { return("0-Error al eliminar el contacto de la base de datos"); } }
public StringBuilder RPU() { ADO.ConnectionDB cn = new ConnectionDB(); String RPU = System.String.Empty; Boolean bRespostExistsRPU = false; strRPUrepeated = new StringBuilder(); clsDivision oclsDivision = new clsDivision(); clsZone oclsZone = new clsZone(); clsGrupo oclsGroup = new clsGrupo(); clsTarifa oclsTarifa = new clsTarifa(); clsGestores oclsGestor = new clsGestores(); Boolean bexistgroup = false; Boolean bExistZone = false; Boolean bExistDivision = false; Boolean bExistTarifa = false; Boolean bExistGestorComercial = false; Boolean bExistGestorMedicion = false; int iNewConvenio = 0; int newRup = 0; DataTable dtConvenio = new DataTable("Convenio"); dtConvenio = InsertConvenio(); if (dtConvenio.Rows.Count > 0) { iNewConvenio = int.Parse(dtConvenio.Rows[0][0].ToString()); intConvenio = iNewConvenio; foreach (DataRow drChargeShiping in dtResult.Rows) { try { //Select Query String strRPU = String.Empty; strRPU = Convert.ToString(drChargeShiping[2]); strRPU = strRPU.Replace(" ", ""); strServiceCFE = strRPU; RPU = GetRPU(); bExistTarifa = oclsTarifa.ExistTarifa(Convert.ToString(drChargeShiping[4])); bexistgroup = oclsGroup.ExistGroup(Convert.ToString(drChargeShiping[6])); bExistDivision = oclsDivision.ExistDivision(Convert.ToString(drChargeShiping[8])); bExistZone = oclsZone.ExistZonaCve(Convert.ToString(drChargeShiping[8]), Convert.ToString(drChargeShiping[7]), Convert.ToString(drChargeShiping[9])); bExistGestorMedicion = oclsGestor.ExistIniciales(Convert.ToString(drChargeShiping[11]), "2"); bExistGestorComercial = oclsGestor.ExistIniciales(Convert.ToString(drChargeShiping[12]), "1"); if (bExistTarifa) { if (bexistgroup) { if (bExistDivision) { //if (bExistZone){ if (bExistGestorMedicion) { if (bExistGestorComercial) { if (!string.IsNullOrEmpty(strServiceCFE)) { strDivision = Convert.ToString(drChargeShiping[8]); strZona = Convert.ToString(drChargeShiping[9]); if (!bExistZone) { // oclsZone.NewZoneByDiv(Convert.ToString(drChargeShiping[7]).Substring(0, 2), strZona, strDivision, strDivision); } strLoadPoint = Convert.ToString(drChargeShiping[1]); strAddressPoint = Convert.ToString(drChargeShiping[3]); strRate = Convert.ToString(drChargeShiping[4]); dblMaxShipping = Convert.ToDouble(drChargeShiping[5]); strGroup = Convert.ToString(drChargeShiping[6]); strCta = Convert.ToString(drChargeShiping[7]); dblDemanda = Convert.ToDouble("0" + drChargeShiping[10]); strGestorComercial = Convert.ToString(drChargeShiping[11]); strGestorMedicion = Convert.ToString(drChargeShiping[12]); //se asignan los campos nuevos if (Convert.ToString(drChargeShiping[13]) != "") { strIdEstatusOferta = Convert.ToString(drChargeShiping[13]); } else { strRPUrepeated.Append("El Estatus Oferta del RPU: " + strServiceCFE + " Contiene datos incorrectos!" + "<br>"); } if (Convert.ToString(drChargeShiping[14]) != "" && Convert.ToUInt32(drChargeShiping[14]) >= 0 && Convert.ToUInt32(drChargeShiping[14]) <= 1) { strConPrelacion = Convert.ToInt32(drChargeShiping[14]); } else { strRPUrepeated.Append("El campo Esta en prelacion del RPU: " + strServiceCFE + " Contiene datos incorrectos!" + "<br>"); } if (Convert.ToString(drChargeShiping[15]) != "" && Convert.ToUInt32(drChargeShiping[15]) >= 0 && Convert.ToUInt32(drChargeShiping[15]) <= 1) { strFirmado = Convert.ToInt32(drChargeShiping[15]); } else { strRPUrepeated.Append("El campo Firmado o prospecto del RPU: " + strServiceCFE + " Contiene datos incorrectos!" + "<br>"); } DataTable DtRup = new DataTable("Convenio"); DtRup = InsertRPU(); if (dtConvenio.Rows.Count > 0) { newRup = int.Parse(dtConvenio.Rows[0][0].ToString()); } } } else { strRPUrepeated.Append("No existe el Gestor Comercial: " + Convert.ToString(drChargeShiping[12]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } else { strRPUrepeated.Append("No existe el Gestor Medición: " + Convert.ToString(drChargeShiping[11]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } //}else{strRPUrepeated.Append("No existe la Zona " + Convert.ToString(drChargeShiping[7]).ToUpper() + " del RPU: " + strServiceCFE + "<br>");} } else { strRPUrepeated.Append("No existe la División: " + Convert.ToString(drChargeShiping[8]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } else { strRPUrepeated.Append("No existe el Grupo: " + Convert.ToString(drChargeShiping[6]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } else { strRPUrepeated.Append("No existe la Tarifa: " + Convert.ToString(drChargeShiping[4]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } catch (Exception ex) { LogError.LogErrorMedicion clsError = new LogError.LogErrorMedicion(); clsError.logMessage = ex.ToString(); clsError.logModule = "RPU"; clsError.LogWrite(); } } } if (strRPUrepeated.Length > 0) { DataTable dtR = new DataTable("dtres"); dtR = EliminaCarga(); int iRes = 0; if (dtR.Rows.Count > 0) { iRes = int.Parse(dtR.Rows[0][0].ToString()); } } return(strRPUrepeated); }
protected void btnAddGestor_Click(object sender, EventArgs e) { clsGestores oCls = new clsGestores(); Boolean bmsg = true; try { string strDivision = ddl_Tipo_New.Items[ddl_Tipo_New.SelectedIndex].Value; string strZone = ddl_Rol_New.Items[ddl_Rol_New.SelectedIndex].Value; string strNumEmpleado = txtNumempleado.Text; string strName = txtName.Text; string strFirstName = txtAP.Text; string strLastName = txtAM.Text; string strIniciales = txtIniciales.Text; if (string.IsNullOrEmpty(strIniciales)) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar las iniciales del Gestor','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerText = "Falta capturar las iniciales del Gestor"; bmsg = false; } if (string.IsNullOrEmpty(strNumEmpleado)) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el número de empleado del gestor','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerText = "Falta capturar el número de empleado del gestor"; bmsg = false; } if (string.IsNullOrEmpty(strZone)) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta seleccionar el Rol del Gestor','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerText = "Falta seleccionar el Rol del Gestor"; bmsg = false; } if (string.IsNullOrEmpty(strDivision)) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta seleccionar el Tipo de Gestor','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerText = "Falta seleccionar el Tipo de Gestor"; bmsg = false; } if (string.IsNullOrEmpty(strName)) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el nombre del gestor','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerText = "Falta capturar el nombre del gestor"; bmsg = false; } if (string.IsNullOrEmpty(strFirstName)) { ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el apellido paterno del Gestor','warning');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerText = "Falta capturar el apellido paterno del Gestor"; bmsg = false; } //if (string.IsNullOrEmpty(strLastName)) //{ // ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','Falta capturar el apellido materno del Gestor','warning');", true); // ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); // //msgErrNew.InnerText = "Falta capturar el apellido paterno del Gestor"; // bmsg = false; //} if (bmsg) { string sResp = ""; sResp = oCls.New(strZone, strName, strFirstName, strLastName, strNumEmpleado, strIniciales); string[] aResp = sResp.Split('-'); if (aResp[0] == "1") { buscar(); //msgErrNew.InnerText = ""; //msgErrNew.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(" $('#msgErrNew').show(); $('#btnaddGestor').click(); };"); sb.Append(" $('#msgErrNew').removeAttr('style');"); sb.Append(" $('#msgErrNew').addClass('alert alert-success text-center');"); sb.Append(" $('#msgErrNew').removeClass('alert alert-danger text-center').addClass('alert alert-success text-center');"); sb.Append(" $('#msgErrNew').show();"); sb.Append(" $('#btnCloseNewx').click(); "); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } else { buscar(); ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('','" + aResp[1] + "','error');", true); ScriptManager.RegisterStartupScript(this, GetType(), "mostrarModal", "mostrarModal('NewCentralModal');", true); //msgErrNew.InnerHtml = "<strong>" + aResp[1] + "</strong> ."; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.onload=function(){"); sb.Append(" $('#msgErrNew').show(); $('#btnaddGestor').click(); };"); sb.Append(" $('#msgErrNew').removeAttr('style');"); sb.Append(" $('#msgErrNew').addClass('alert alert-danger text-center');"); sb.Append(" $('#msgErrNew').removeClass('alert alert-success text-center').addClass('alert alert-danger text-center');"); sb.Append(" $('#msgErrNew').show();"); //sb.Append(" setTimeout(function() { window.location.reload(1); }, 2000); "); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } } else { buscar(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.onload=function(){"); sb.Append(" $('#msgErrNew').show(); $('#btnaddGestor').click(); };"); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } } catch (Exception ex) { clsError.logMessage = ex.ToString(); clsError.logModule = "Page_Load"; clsError.LogWrite(); } }