protected void Page_Load(object sender, EventArgs e) { tools _tools = new tools(); SecureQueryString QueryStringSeguro; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro(), Request["data"]); Decimal id_clausula = Convert.ToDecimal(QueryStringSeguro["id_clausula"]); Decimal id_empleado = Convert.ToDecimal(QueryStringSeguro["id_empleado"]); Clausula clausula = new Clausula(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable dataTable = clausula.ObtenerContratacionPorId(id_clausula, id_empleado); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; Response.Clear(); Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", "Clausula" + dataRow["TIPO_CLAUSULA"].ToString() + dataRow["EXTENSION"].ToString())); Response.ContentType = dataRow["TIPO"].ToString().Trim(); Response.BinaryWrite((byte[])dataRow["ARCHIVO"]); Response.End(); } }
public Clausula CreateTextToSignature(string keySigner, string emailSigner, string text, string uuidDocument) { try { Clausula clausula = new Clausula(); string url = $"http://demo.d4sign.com.br/api/v1/documents/{uuidDocument}/addhighlight?tokenAPI={this.tokenAPI}&cryptKey={this.cryptKey}"; var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddParameter("key-signer", keySigner); request.AddParameter("email", emailSigner); request.AddParameter("text", text); IRestResponse response = client.Post(request); if (response.ResponseStatus == ResponseStatus.Completed) { clausula = JsonConvert.DeserializeObject <Clausula>(response.Content); } else { clausula = new Clausula { statusDescription = response.StatusDescription }; } return(clausula); } catch { throw; } }
protected void GridView_RESULTADOS_BUSQUEDA_SelectedIndexChanged(object sender, EventArgs e) { Ocultar(); Clausula clausula = new Clausula(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataRow dataRow = clausula.ObtenerPorId(Convert.ToDecimal(this.GridView_RESULTADOS_BUSQUEDA.SelectedDataKey["ID_CLAUSULA"].ToString())); Cargar(dataRow); Mostrar(Acciones.Editar); }
private void Actualizar() { tools _tools = new tools(); Byte[] archivo = null; Int32 archivo_tamaño = 0; String archivo_extension = null; String archivo_tipo = null; bool actualizado = false; decimal id_ocupacion = 0; try { if (FileUpload_archivo.HasFile == true) { using (BinaryReader reader = new BinaryReader(FileUpload_archivo.PostedFile.InputStream)) { archivo = reader.ReadBytes(FileUpload_archivo.PostedFile.ContentLength); archivo_tamaño = FileUpload_archivo.PostedFile.ContentLength; archivo_tipo = FileUpload_archivo.PostedFile.ContentType; archivo_extension = _tools.obtenerExtensionArchivo(FileUpload_archivo.PostedFile.FileName); } } if (DropDownList_ID_OCUPACION.Text.Equals(string.Empty)) { id_ocupacion = 0; } else { id_ocupacion = Convert.ToDecimal(DropDownList_ID_OCUPACION.SelectedValue); } Clausula clausula = new Clausula(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); actualizado = clausula.Actualizar(Convert.ToDecimal(HiddenField_id_clausula.Value), DropDownList_ID_TIPO_CLAUSULA.SelectedValue, DropDownList_ID_ESTADO.SelectedValue, TextBox_DESCRIPCION.Text, Convert.ToDecimal(HiddenField_ID_EMPRESA.Value), id_ocupacion, archivo, archivo_tamaño, archivo_extension, archivo_tipo); if (actualizado.Equals(true)) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "La Clausula fue actualizada correctamente.", Proceso.Correcto); Bloquear(); Ocultar(); Mostrar(Acciones.Editar); DataRow dataRow = clausula.ObtenerPorId(Convert.ToDecimal(HiddenField_id_clausula.Value)); Cargar(dataRow); } else { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "Error al actualizar la Clausula ", Proceso.Error); } } catch (Exception e) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, e.Message, Proceso.Error); } }
private void Cargar(decimal idEmpresa) { Clausula clausula = new Clausula(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); GridView_RESULTADOS_BUSQUEDA.DataSource = clausula.ObtenerPorIdEmpresa(idEmpresa); GridView_RESULTADOS_BUSQUEDA.DataBind(); cliente _cliete = new cliente(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable dataTable = _cliete.ObtenerEmpresaConIdEmpresa(idEmpresa); if (dataTable.Rows.Count.Equals(0)) { return; } if (!string.IsNullOrEmpty(dataTable.Rows[0]["RAZ_SOCIAL"].ToString())) { Label_INFO_ADICIONAL_MODULO.Text = dataTable.Rows[0]["RAZ_SOCIAL"].ToString(); } }
private void Buscar() { DataTable dataTable = new DataTable(); try { Clausula clausula = new Clausula(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); dataTable = clausula.Buscar(Convert.ToDecimal(HiddenField_ID_EMPRESA.Value), TextBox_BUSCAR.Text); if (dataTable.Rows.Equals(0)) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se encontraron registros que cumplan el criterio ingresado.", Proceso.Advertencia); } GridView_RESULTADOS_BUSQUEDA.DataSource = dataTable; GridView_RESULTADOS_BUSQUEDA.DataBind(); } catch (Exception e) { Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, e.Message, Proceso.Error); } dataTable.Dispose(); }