protected void gdPagos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //e.Row.Cells[0].Text = ((e.Row.Cells[11].Text.ToString() != "0") && (e.Row.Cells[12].Text.ToString() != "0") ? "FNC" : ((e.Row.Cells[11].Text.ToString() != "0") ? "F" : "NC")); e.Row.Cells[0].Text = getTipoDoc(hdd_tipo_documento.Value); switch (hdd_tipo_documento.Value) { case "1": case "2": case "4": if (e.Row.Cells[5].Text.ToString() != " ") { DBConn oConn = new DBConn(); if (oConn.Open()) { cAntBancos oBancos = new cAntBancos(ref oConn); oBancos.NKeyBanco = e.Row.Cells[5].Text.ToString(); DataTable dt = oBancos.Get(); if (dt != null) { if (dt.Rows.Count > 0) { e.Row.Cells[5].Text = dt.Rows[0]["ncod"].ToString() + " - " + dt.Rows[0]["snombre"].ToString(); } } dt = null; } oConn.Close(); } break; } } }
protected void gdPagos_RowCommand(object sender, GridViewCommandEventArgs e) { LinkButton lnkBtn = (LinkButton)e.CommandSource; // the button GridViewRow myRow = (GridViewRow)lnkBtn.Parent.Parent; // the row GridView myGrid = (GridView)sender; // the gridview string pCodDocumento = gdPagos.DataKeys[myRow.RowIndex].Value.ToString(); // value of the datakey if (e.CommandName == "NO") { DBConn oConn = new DBConn(); if (oConn.Open()) { cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn); oDocumentosPago.CodDocumento = pCodDocumento; DataTable dt = oDocumentosPago.Get(); if (dt != null) { if (dt.Rows.Count > 0) { idRow1.Visible = true; idRow2.Visible = true; idRow3.Visible = true; hdd_cod_documento.Value = dt.Rows[0]["cod_documento"].ToString(); lblRazonSocialPago.Text = dt.Rows[0]["nom_deudor"].ToString(); lblcuentacorriente.Text = dt.Rows[0]["cuenta_corriente"].ToString(); lblFechtransaccion.Text = dt.Rows[0]["fch_documento"].ToString(); lblNumOperacion.Text = dt.Rows[0]["num_documento"].ToString(); cAntBancos oBancos = new cAntBancos(ref oConn); oBancos.NKeyBanco = dt.Rows[0]["cod_banco"].ToString(); DataTable dtBanco = oBancos.Get(); if (dtBanco != null) { if (dtBanco.Rows.Count > 0) { lblBanco.Text = dtBanco.Rows[0]["ncod"].ToString() + " - " + dtBanco.Rows[0]["snombre"].ToString(); } } dtBanco = null; lblimporte.Text = string.Format("{0:N0}", int.Parse(dt.Rows[0]["importe"].ToString())); hdd_importe.Value = dt.Rows[0]["importe"].ToString(); } } dt = null; oConn.Close(); } btnAceptar.Visible = false; btnRechazar.Visible = false; if ((hdd_tipo_documento.Value == "1") || (hdd_tipo_documento.Value == "2") || (hdd_tipo_documento.Value == "4")) { idColBanco.Visible = true; } } else if (e.CommandName == "SI") { DBConn oConn = new DBConn(); if (oConn.Open()) { cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn); oDocumentosPago.CodDocumento = pCodDocumento; DataTable dt = oDocumentosPago.Get(); if (dt != null) { if (dt.Rows.Count > 0) { oDocumentosPago.ImporteRecibido = dt.Rows[0]["importe"].ToString(); } } dt = null; oDocumentosPago.Discrepancia = "0"; oDocumentosPago.Accion = "EDITAR"; oDocumentosPago.Put(); oConn.Close(); } onLoadGrid(); } }
protected void gdPagos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string cCodDocumento = gdPagos.DataKeys[e.Row.RowIndex].Values["cod_documento"].ToString(); string sNodCodDocumento = gdPagos.DataKeys[e.Row.RowIndex].Values["nod_cod_documento"].ToString(); foreach (DataControlFieldCell cell in e.Row.Cells) { foreach (Control control in cell.Controls) { LinkButton BtnlnkSI = control as LinkButton; if ((BtnlnkSI != null) && (BtnlnkSI.CommandName == "SI") && (!string.IsNullOrEmpty(sNodCodDocumento))) { BtnlnkSI.Visible = false; } else if ((BtnlnkSI != null) && (BtnlnkSI.CommandName == "NO") && (!string.IsNullOrEmpty(sNodCodDocumento))) { BtnlnkSI.Visible = false; } } } DBConn oConn = new DBConn(); if (oConn.Open()) { cAntDocumentosPago oAntDocumentosPago = new cAntDocumentosPago(ref oConn); oAntDocumentosPago.CodDocumento = cCodDocumento; DataTable dt = oAntDocumentosPago.GetValDoc(); if (dt != null) { if (dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(dt.Rows[0]["valida_cheque"].ToString())) { if (dt.Rows[0]["valida_cheque"].ToString() == "1") { e.Row.Cells[3].CssClass = "green_text"; } else { e.Row.Cells[3].CssClass = "red_text"; } } else { e.Row.Cells[3].CssClass = "blue_text"; } if ((!string.IsNullOrEmpty(e.Row.Cells[15].Text.ToString())) && (e.Row.Cells[15].Text.ToString() != " ")) { if (!string.IsNullOrEmpty(dt.Rows[0]["valida_cuenta"].ToString())) { if (dt.Rows[0]["valida_cuenta"].ToString() == "1") { e.Row.Cells[5].CssClass = "green_text"; } else { e.Row.Cells[5].CssClass = "red_text"; } } else { e.Row.Cells[5].CssClass = "blue_text"; } } if (!string.IsNullOrEmpty(dt.Rows[0]["valida_banco"].ToString())) { if (dt.Rows[0]["valida_banco"].ToString() == "1") { e.Row.Cells[7].CssClass = "green_text"; } else { e.Row.Cells[7].CssClass = "red_text"; } } else { e.Row.Cells[7].CssClass = "blue_text"; } if ((!string.IsNullOrEmpty(e.Row.Cells[15].Text.ToString())) && (e.Row.Cells[15].Text.ToString() != " ")) { if (!string.IsNullOrEmpty(dt.Rows[0]["valida_monto"].ToString())) { if (dt.Rows[0]["valida_monto"].ToString() == "1") { e.Row.Cells[8].CssClass = "green_text"; } else { e.Row.Cells[8].CssClass = "red_text"; } } else { e.Row.Cells[8].CssClass = "blue_text"; } } if (!string.IsNullOrEmpty(dt.Rows[0]["imagen_frente"].ToString())) { e.Row.Cells[13].CssClass = "green_text"; } else { e.Row.Cells[13].CssClass = "blue_text"; } foreach (DataControlFieldCell cell in e.Row.Cells) { foreach (Control control in cell.Controls) { HyperLink btn_img = control as HyperLink; if ((btn_img != null) && (btn_img.ID == "btn_img_frente")) { btn_img.NavigateUrl = "https://www.dbtlatam.com/cheques/antalis/" + dt.Rows[0]["imagen_frente"].ToString(); btn_img.Attributes.Add("data-fancybox", string.Empty); } else if ((btn_img != null) && (btn_img.ID == "btn_img_atras")) { btn_img.NavigateUrl = "https://www.dbtlatam.com/cheques/antalis/" + dt.Rows[0]["imagen_atras"].ToString(); btn_img.Attributes.Add("data-fancybox", string.Empty); } } } } else { e.Row.Cells[3].CssClass = "blue_text"; e.Row.Cells[5].CssClass = "blue_text"; e.Row.Cells[7].CssClass = "blue_text"; e.Row.Cells[8].CssClass = "blue_text"; e.Row.Cells[13].CssClass = "blue_text"; } } dt = null; } oConn.Close(); //e.Row.Cells[2].Text = ((e.Row.Cells[13].Text.ToString() != "0") && (e.Row.Cells[14].Text.ToString() != "0") ? "FNC" : ((e.Row.Cells[13].Text.ToString() != "0") ? "F" : "NC")); e.Row.Cells[2].Text = getTipoDoc(hdd_tipo_documento.Value); switch (hdd_tipo_documento.Value) { case "1": case "2": case "4": if (e.Row.Cells[7].Text.ToString() != " ") { if (oConn.Open()) { cAntBancos oBancos = new cAntBancos(ref oConn); oBancos.NKeyBanco = e.Row.Cells[7].Text.ToString(); DataTable dt = oBancos.Get(); if (dt != null) { if (dt.Rows.Count > 0) { e.Row.Cells[7].Text = dt.Rows[0]["ncod"].ToString() + " - " + dt.Rows[0]["snombre"].ToString(); } } dt = null; } oConn.Close(); } break; } } }