protected void btnGrabar_Click(object sender, EventArgs e) { BL_SOL_ANDAMIOS obj = new BL_SOL_ANDAMIOS(); DataTable dt = new DataTable(); if (lblrpta.Text == "R") { if (txtrechazo.Text != string.Empty) { dt = obj.uspUPD_SOL_ANDAMIOS_PROCESAR(Convert.ToInt32(lblCodigo.Text), lblrpta.Text, txtrechazo.Text.Trim(), Session["IDE_USUARIO"].ToString()); BL_SOL_ANDAMIOS objCorreo = new BL_SOL_ANDAMIOS(); objCorreo.SP_ENVIARCORREO_SOL_ANDAMIOS_RPTA(Convert.ToInt32(lblCodigo.Text)); string cleanMessage = "Registro procesado"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); limpiar(); Listar("", ""); } else { string cleanMessage = "Ingresar sustento"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } }
protected void Listar() { string estado = string.Empty; if (ddlEstados.SelectedIndex == 0) { estado = string.Empty; } else { estado = ddlEstados.SelectedValue.ToString(); } BL_SOL_ANDAMIOS obj = new BL_SOL_ANDAMIOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_SOL_ANDAMIOS_USUARIO(Session["IDE_USUARIO"].ToString(), estado, ddlanio.SelectedValue.ToString()); if (dtResultado.Rows.Count > 0) { //GridView1.Visible = true; GridView1.DataSource = dtResultado; GridView1.DataBind(); } else { //GridView1.Visible = false; GridView1.DataSource = dtResultado; GridView1.DataBind(); } }
protected void Listar() { BL_SOL_ANDAMIOS Obj = new BL_SOL_ANDAMIOS(); DataTable dtResultado = new DataTable(); dtResultado = Obj.uspSEL_SOL_ANDAMIOS_IDE(Convert.ToInt32(lblCodigo.Text)); if (dtResultado.Rows.Count > 0) { txtDuracion.Text = dtResultado.Rows[0]["DURACION"].ToString(); ddlCapataz.SelectedValue = dtResultado.Rows[0]["CAPATAZ_DNI"].ToString(); ddlSupervisor.SelectedValue = dtResultado.Rows[0]["SUPERVIDOR_DNI"].ToString(); txtRequerimiento.Text = dtResultado.Rows[0]["FECHA_REQUERIDA"].ToString(); txtFecEntrega.Text = dtResultado.Rows[0]["FECHA_ENTREGA"].ToString(); txtTermino.Text = dtResultado.Rows[0]["FECHA_TERMINO"].ToString(); txtDesmontaje.Text = dtResultado.Rows[0]["FECHA_DESMONTAJE"].ToString(); txtObservacion.Text = dtResultado.Rows[0]["OBSERVACIONES"].ToString(); txtHoras.Text = dtResultado.Rows[0]["HORAS"].ToString(); string estado = dtResultado.Rows[0]["FLG_VISIBLE"].ToString(); ddlEstados.SelectedValue = dtResultado.Rows[0]["ESTADO"].ToString(); lblTicket.Text = dtResultado.Rows[0]["TICKET"].ToString(); if (estado == "4" || estado == "5") { btn.Visible = false; } else { btn.Visible = true; } } }
protected void Guardar() { string cleanMessage = string.Empty; BE_SOL_ANDAMIOS oBESol = new BE_SOL_ANDAMIOS(); oBESol.IDE_ANDAMIOS = Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text); oBESol.USUARIO_ATENCION = Session["IDE_USUARIO"].ToString(); oBESol.SUPERVIDOR_DNI = ddlSupervisor.SelectedValue.ToString(); oBESol.SUPERVIDOR = ddlSupervisor.SelectedItem.ToString(); oBESol.CAPATAZ_DNI = ddlCapataz.SelectedValue.ToString(); oBESol.CAPATAZ = ddlCapataz.SelectedItem.ToString(); oBESol.DURACION = Convert.ToInt32(string.IsNullOrEmpty(txtDuracion.Text) ? "0" : txtDuracion.Text); oBESol.HORAS = Convert.ToDecimal(string.IsNullOrEmpty(txtHoras.Text) ? "0" : txtHoras.Text); oBESol.FECHA_ENTREGA = txtFecEntrega.Text.ToString(); oBESol.FECHA_TERMINO = txtTermino.Text.ToString(); oBESol.FECHA_DESMONTAJE = txtDesmontaje.Text.ToString(); oBESol.OBSERVACIONES = txtObservacion.Text; oBESol.ESTADO = Convert.ToInt32(ddlEstados.SelectedValue.ToString()); int dtrpta = 0; dtrpta = new BL_SOL_ANDAMIOS().uspUPD_SOL_ANDAMIOS(oBESol); if (dtrpta > 0) { int estado = Convert.ToInt32(ddlEstados.SelectedValue.ToString()); if (estado == 4 || estado == 5) { BL_SOL_ANDAMIOS objCorreo = new BL_SOL_ANDAMIOS(); objCorreo.SP_ENVIARCORREO_SOL_ANDAMIOS_RPTA(Convert.ToInt32(lblCodigo.Text)); } Listar(); cleanMessage = "Registro exitoso."; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } }
protected void btnPrioridad_Click(object sender, EventArgs e) { BL_SOL_ANDAMIOS objCorreo = new BL_SOL_ANDAMIOS(); objCorreo.uspSEL_SOL_ANDAMIOS_PRIORIDAD(Convert.ToInt32(ddlPrioridad.SelectedValue), Convert.ToInt32(lblCodigo.Text)); string cleanMessage = "Registro satisfactorio"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); Listar("", ""); }
protected void CartaDatos(string IDE_ANDAMIOS) { DataTable dtResultado = new DataTable(); BL_SOL_ANDAMIOS obj = new BL_SOL_ANDAMIOS(); dtResultado = obj.uspSEL_SOL_ANDAMIOS_IDE(Convert.ToInt32(IDE_ANDAMIOS)); if (dtResultado.Rows.Count > 0) { lblTicket.Text = dtResultado.Rows[0]["TICKET"].ToString(); lblCodigo.Text = dtResultado.Rows[0]["IDE_ANDAMIOS"].ToString(); txtrequerida.Text = dtResultado.Rows[0]["FECHA_REQUERIDA"].ToString(); //txtrequerida.Text = dtResultado.Rows[0]["FECHA_ATENCION"].ToString(); ddlPersonal.SelectedValue = dtResultado.Rows[0]["SOLICITANTE"].ToString(); ddlarea.SelectedValue = dtResultado.Rows[0]["IDE_AREA"].ToString(); ddlSolicitud.SelectedValue = dtResultado.Rows[0]["IDE_SOLICITUD"].ToString(); ddlTipo.SelectedValue = dtResultado.Rows[0]["IDE_TIPO"].ToString(); ddlespecialidad.SelectedValue = dtResultado.Rows[0]["IDE_ESPECIALIDAD"].ToString(); txtcomentarios.Text = dtResultado.Rows[0]["COMENTARIOS"].ToString(); txtCodAndamio.Text = dtResultado.Rows[0]["ANDAMIOS"].ToString(); //txtFechaDestino.Text = dtResultado.Rows[0]["D_FECHA"].ToString(); } }
protected void btnviar_Click(object sender, EventArgs e) { string cleanMessage = string.Empty; CECOS_GESTOR = Request.QueryString["CECOS_GESTOR"].ToString(); if (txtrequerida.Text.Trim() == string.Empty) { cleanMessage = "Ingresar fecha de requerimiento"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else if (ddlPersonal.SelectedValue == string.Empty) { cleanMessage = "Falta indicar personal solicitante"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { // Si el directorio no existe, crearlo if (!Directory.Exists(Server.MapPath(FolderANDAMIOS))) { Directory.CreateDirectory(FolderANDAMIOS); } String fileExtension = string.Empty; Boolean fileOK = false; string fileArchivo = string.Empty; if (FileUpload1.HasFile) { string fileName = FileUpload1.FileName.ToString(); int length = FileUpload1.PostedFile.ContentLength; fileExtension = Path.GetExtension(FileUpload1.FileName); String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { // Se carga la ruta física de la carpeta temp del sitio string ruta = Server.MapPath(FolderANDAMIOS); // Si el directorio no existe, crearlo if (!Directory.Exists(ruta)) { Directory.CreateDirectory(ruta); } string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.PostedFile.FileName); // Verificar que el archivo no exista if (File.Exists(archivo)) { fileArchivo = "AND_" + CECOS_GESTOR + "_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName); FileUpload1.SaveAs(ruta + fileArchivo); } else { fileArchivo = "AND_" + CECOS_GESTOR + "_" + Path.GetFileName(FileUpload1.FileName); //FileUpload1.SaveAs(archivo); FileUpload1.SaveAs(ruta + fileArchivo); } } catch (Exception ex) { cleanMessage = "Archivo no puedo ser cargado"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } BE_SOL_ANDAMIOS oBESol = new BE_SOL_ANDAMIOS(); oBESol.IDE_ANDAMIOS = Convert.ToInt32(string.IsNullOrEmpty(lblCodigo.Text) ? "0" : lblCodigo.Text); oBESol.ANDAMIOS = txtCodAndamio.Text.Trim(); oBESol.FECHA = string.Empty; oBESol.IDE_USUARIO = Session["IDE_USUARIO"].ToString(); oBESol.SOLICITANTE = ddlPersonal.SelectedValue.ToString(); oBESol.FILE_ANDAMIOS = fileArchivo; oBESol.FILE_RUTA = FolderANDAMIOS; oBESol.COMENTARIOS = txtcomentarios.Text.ToString(); oBESol.ESPECIALIDAD = ddlespecialidad.SelectedValue; oBESol.AREA = ddlarea.SelectedValue; oBESol.SOLICITUD = ddlSolicitud.SelectedValue; oBESol.TIPO = ddlTipo.SelectedValue; oBESol.FECHA_REQUERIDA = txtrequerida.Text; oBESol.IPCENTRO = CECOS_GESTOR; //BL_Session.IP_CENTRO.ToString(); int dtrpta = 0; dtrpta = new BL_SOL_ANDAMIOS().uspINS_SOL_ANDAMIOS(oBESol); if (dtrpta > 0) { cleanMessage = "Registro exitoso."; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } } }
protected void Listar(string campo, string direccion) { string estado = string.Empty; if (ddlEstados.SelectedIndex == 0) { estado = string.Empty; } else { estado = ddlEstados.SelectedValue.ToString(); } string area = string.Empty; if (ddlarea.SelectedIndex == 0) { area = string.Empty; } else { area = ddlarea.SelectedValue.ToString(); } string especialidad = string.Empty; if (ddlespecialidad.SelectedIndex == 0) { especialidad = string.Empty; } else { especialidad = ddlespecialidad.SelectedValue.ToString(); } string centro = string.Empty; if (ddlcentro.SelectedIndex == 0) { centro = string.Empty; } else { centro = ddlcentro.SelectedValue.ToString(); } BL_SOL_ANDAMIOS obj = new BL_SOL_ANDAMIOS(); DataTable dtResultado = new DataTable(); dtResultado = obj.uspSEL_SOL_ANDAMIOS_BANDEJA(Session["IDE_USUARIO"].ToString(), estado, ddlanio.SelectedValue.ToString(), txtTicket.Text, campo, direccion, centro, area, especialidad); if (dtResultado.Rows.Count > 0) { GridView1.DataSource = dtResultado; GridView1.DataBind(); } else { GridView1.DataSource = dtResultado; GridView1.DataBind(); } }
protected void btnDescarga_Click(object sender, ImageClickEventArgs e) { string estado = string.Empty; if (ddlEstados.SelectedIndex == 0) { estado = string.Empty; } else { estado = ddlEstados.SelectedValue.ToString(); } string area = string.Empty; if (ddlarea.SelectedIndex == 0) { area = string.Empty; } else { area = ddlarea.SelectedValue.ToString(); } string especialidad = string.Empty; if (ddlespecialidad.SelectedIndex == 0) { especialidad = string.Empty; } else { especialidad = ddlespecialidad.SelectedValue.ToString(); } string centro = string.Empty; if (ddlcentro.SelectedIndex == 0) { centro = string.Empty; } else { centro = ddlcentro.SelectedValue.ToString(); } BL_SOL_ANDAMIOS obj = new BL_SOL_ANDAMIOS(); DataTable dtResultadoeExcel = new DataTable(); dtResultadoeExcel = obj.uspSEL_SOL_ANDAMIOS_BANDEJA(Session["IDE_USUARIO"].ToString(), estado, ddlanio.SelectedValue.ToString(), txtTicket.Text, "", "", centro, area, especialidad); if (dtResultadoeExcel.Rows.Count > 0) { //ExcelHelper.ToExcel(dtResultadoeExcel, "CJI3_" + ddlEstados.SelectedItem + ".xls", Page.Response); gvExcel.DataSource = dtResultadoeExcel; gvExcel.DataBind(); GridViewExportUtil.Export("ANDAMIOS_" + DateTime.Now + ".xls", gvExcel); return; } else { } }