/// <summary> /// Procesa la solicitud de un bono /// </summary> /// <param name="bono"></param> private void ProcessBond(requests_bonds bono) { try { BonosCOM bonos = new BonosCOM(); DataSet ds = bonos.sp_Update_Request_Bond_Automatic(bono); string vmensaje = ""; if (ds.Tables[0].Columns.Contains("mensaje")) { vmensaje = ds.Tables[0].Rows[0]["mensaje"].ToString(); } if (vmensaje == "") { System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "AlertGO('El bono del empleado ha sido " + (bono.id_request_status == (int)enumerators.bonds_status.authorization ? "autorizado" : "rechazado") + " con éxito.', 'compensaciones_autorizacion_atomaticos.aspx');", true); } else { Toast.Error("Error al procesar solicitud : " + vmensaje, this); } } catch (Exception ex) { Toast.Error("Error al procesar solicitud: " + ex.Message, this); } }
/// <summary> /// Procesa la solicitud de un bono /// </summary> /// <param name="bono"></param> private void ProcessBond(requests_bonds bono) { try { BonosCOM bonos = new BonosCOM(); DataSet ds = bonos.sp_Update_Request_Bond(bono); System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "AlertGO('El bono del empleado ha sido " + (bono.id_request_status == (int)enumerators.bonds_status.authorization?"autorizado":"rechazado") + " con éxito.', 'compensaciones_autorizacion.aspx');", true); } catch (Exception ex) { Toast.Error("Error al procesar solicitud: " + ex.Message, this); } }
protected void lnkrechazarsolicitud_Click(object sender, EventArgs e) { try { txtAuthorizationAmount.BorderColor = System.Drawing.Color.Green; amount_correct.Visible = true; amount_error.Visible = false; int id_bonds = Convert.ToInt32(hdnIdRequestBond.Value == "" ? "0" : hdnIdRequestBond.Value); decimal amount = Convert.ToDecimal(txtAuthorizationAmount.Text == "" ? "0" : txtAuthorizationAmount.Text.Replace("$", "").Replace(",", "")); if (id_bonds == 0) { Toast.Error("Error al procesar solicitud", this); } else if (tdAuthorizationComments.Text == "") { Toast.Error("Error al procesar solicitud: Ingrese comentarios de autorización", this); } else if (amount == 0) { txtAuthorizationAmount.BorderStyle = BorderStyle.Solid; txtAuthorizationAmount.BorderColor = System.Drawing.Color.Red; amount_correct.Visible = false; amount_error.Visible = true; Toast.Error("Error al procesar solicitud: Ingrese un monto valido.", this); } else { requests_bonds bono = new requests_bonds(); bono.id_request_bond = id_bonds; bono.authorization_amount = amount; bono.modified_by = Session["usuario"] as string; bono.authorization_comments = tdAuthorizationComments.Text; bono.id_request_status = (int)enumerators.bonds_status.not_approved; ProcessBond(bono); } } catch (Exception ex) { Toast.Error("Error al procesar solicitud: " + ex.Message, this); } finally { InitTables(); load_modal.Style["display"] = "none"; } }
protected void lnkautorizartodoss_Click(object sender, EventArgs e) { try { if (txtCommentstodos.Text == "") { Toast.Error("Error al procesar solicitud: Ingrese comentarios de autorización", this); } else { if (ViewState[hdfguid.Value + "-dt_reporte"] != null) { DataTable dt = new DataTable(); dt = ViewState[hdfguid.Value + "-dt_reporte"] as DataTable; foreach (DataRow row in dt.Rows) { string id_bonds = row["id_request_bond"].ToString(); string amount = row["authorization_amount"].ToString(); requests_bonds bono = new requests_bonds(); bono.id_request_bond = Convert.ToInt32(id_bonds); bono.authorization_amount = Convert.ToDecimal(amount); bono.modified_by = Session["usuario"] as string; bono.authorization_comments = txtCommentstodos.Text; bono.id_request_status = (int)enumerators.bonds_status.authorization; ProcessBond(bono); } } } } catch (Exception ex) { Toast.Error("Error al procesar solicitud: " + ex.Message, this); } finally { InitTables(); load_modal.Style["display"] = "none"; } }
public DataSet sp_Update_Request_Bond_Automatic(requests_bonds bono) { DataSet ds = new DataSet(); List <SqlParameter> listparameters = new List <SqlParameter>(); Datos data = new Datos(); listparameters.Add(new SqlParameter() { ParameterName = "@authorization_amount", SqlDbType = SqlDbType.Int, Value = bono.authorization_amount }); listparameters.Add(new SqlParameter() { ParameterName = "@id_request_status", SqlDbType = SqlDbType.Int, Value = bono.id_request_status }); listparameters.Add(new SqlParameter() { ParameterName = "@authorization_comments", SqlDbType = SqlDbType.Int, Value = bono.authorization_comments }); listparameters.Add(new SqlParameter() { ParameterName = "@modified_by", SqlDbType = SqlDbType.Int, Value = bono.modified_by }); listparameters.Add(new SqlParameter() { ParameterName = "@id_request_bond", SqlDbType = SqlDbType.Int, Value = bono.id_request_bond }); try { //ds = data.datos_Clientes(listparameters); ds = data.enviar("sp_Update_Request_Bond_Automatic", listparameters, false, 4); } catch (Exception ex) { throw ex; } return(ds); }
public DataSet Agregar(requests_bonds bono) { DataSet ds = new DataSet(); List <SqlParameter> listparameters = new List <SqlParameter>(); Datos data = new Datos(); listparameters.Add(new SqlParameter() { ParameterName = "@employee_number", SqlDbType = SqlDbType.Int, Value = bono.employee_number }); listparameters.Add(new SqlParameter() { ParameterName = "@authorization_amount", SqlDbType = SqlDbType.Int, Value = bono.authorization_amount }); listparameters.Add(new SqlParameter() { ParameterName = "@period_date_of", SqlDbType = SqlDbType.Int, Value = bono.period_date_of }); listparameters.Add(new SqlParameter() { ParameterName = "@period_date_to", SqlDbType = SqlDbType.Int, Value = bono.period_date_to }); listparameters.Add(new SqlParameter() { ParameterName = "@id_bond_type", SqlDbType = SqlDbType.Int, Value = bono.id_bond_type }); listparameters.Add(new SqlParameter() { ParameterName = "@id_request_status", SqlDbType = SqlDbType.Int, Value = bono.id_request_status }); listparameters.Add(new SqlParameter() { ParameterName = "@number_hours", SqlDbType = SqlDbType.Int, Value = bono.number_hours }); listparameters.Add(new SqlParameter() { ParameterName = "@folio_pmtracker", SqlDbType = SqlDbType.Int, Value = bono.folio_pmtracker }); listparameters.Add(new SqlParameter() { ParameterName = "@week", SqlDbType = SqlDbType.Int, Value = bono.week }); listparameters.Add(new SqlParameter() { ParameterName = "@month", SqlDbType = SqlDbType.Int, Value = bono.month }); listparameters.Add(new SqlParameter() { ParameterName = "@year", SqlDbType = SqlDbType.Int, Value = bono.year }); listparameters.Add(new SqlParameter() { ParameterName = "@selected_date", SqlDbType = SqlDbType.Int, Value = bono.selected_date }); listparameters.Add(new SqlParameter() { ParameterName = "@requisition_comments", SqlDbType = SqlDbType.Int, Value = bono.requisition_comments }); listparameters.Add(new SqlParameter() { ParameterName = "@modified_by", SqlDbType = SqlDbType.Int, Value = bono.created_by }); listparameters.Add(new SqlParameter() { ParameterName = "@created_by", SqlDbType = SqlDbType.Int, Value = bono.created_by }); listparameters.Add(new SqlParameter() { ParameterName = "@CC_Emp", SqlDbType = SqlDbType.Int, Value = bono.CC_Empleado }); listparameters.Add(new SqlParameter() { ParameterName = "@CC_Cob", SqlDbType = SqlDbType.Int, Value = bono.CC_Cargo }); try { //ds = data.datos_Clientes(listparameters); ds = data.enviar("sp_Insert_Requests_Bonds", listparameters, false, 4); } catch (Exception ex) { throw ex; } return(ds); }