protected void dgSalidaMateriales_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { dgSalidaMateriales.JSProperties["cpOperacionesCot"] = null; UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": string url = "SalidaMateriales.aspx?Id=" + int.Parse(dgSalidaMateriales.GetRowValues(e.VisibleIndex, "Id").ToString()); Response.RedirectLocation = url; break; case "Anular": try { //SalidaMateriales Cot_anular = wu.SalidaMateriales.ObtenerPorId(int.Parse(dgSalidaMateriales.GetRowValues(e.VisibleIndex, "Id").ToString())); //Cot_anular.IdEstado = 36; //wu.SalidaMaterial.Actualizar(Cot_anular); wu.Grabar(); cargarSalidaMateriales(); dgSalidaMateriales.JSProperties["cpOperacionesCot"] = "Operación realizada con éxito"; } catch (Exception ex) { dgSalidaMateriales.JSProperties["cpOperacionesCot"] = "Ha ocurrido un error inesperado: " + ex.Message; } break; case "VerReporteSM": Session["ItemClickeado"] = "SalidaMateriales"; dgSalidaMateriales.JSProperties["cpRedireccion"] = "Reporte.aspx?salma=" + int.Parse(dgSalidaMateriales.GetRowValues(e.VisibleIndex, "Id").ToString()); break; } }
protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { long id = long.Parse(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName).ToString()); if (e.ButtonID == "GridEdit") { setHdf(hdfID, id); setMode(CGlobal.FunctionMode.EditMode); initFuncMode(); } else if (e.ButtonID == "GridDelete") { try { objUser.Delete(id); setMode(CGlobal.FunctionMode.SearchMode); initFuncMode(); } catch (Exception ex) { HELPER.CError.ErrorType err = HELPER.CError.Parse(ex.Message); if (err == CError.ErrorType.InUse) { HELPER.Client.Alert(this, "Dữ liệu đã được sử dụng. Không thể xóa được!"); } else { HELPER.Client.Alert(this, "Lỗi xóa dữ liệu!"); } } } }
protected void gridProjects_OnCustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { Debug.WriteLine("**** gridProjects_OnCustomButtonCallback"); ASPxGridView grid = (ASPxGridView)sender; string keyValue = grid.GetRowValues(e.VisibleIndex, "dataproj_pk").ToString(); //gv.JSProperties["cpKeyValue"] = keyValue; if (e.ButtonID == "btnDelete") { SQL_utils sql = new SQL_utils("data"); sql.NonQuery_from_SQLstring("update dp.DataProject set IsDeleted=1, deleted=getdate(), deletedBy=sec.systemuser() where dataproj_pk = " + keyValue); sql.Close(); DataTable dt = GetProjects(); gridProjects.DataSource = dt; gridProjects.DataBind(); } else if (e.ButtonID == "btnUndelete") { SQL_utils sql = new SQL_utils("data"); sql.NonQuery_from_SQLstring("update dp.DataProject set IsDeleted=0, deleted=null, deletedBy=null where dataproj_pk = " + keyValue); sql.Close(); DataTable dt = GetProjects(); gridProjects.DataSource = dt; gridProjects.DataBind(); } }
protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { // long myNotiID = long.Parse(CGlobal.getDataByColumn(myNotiID, "NotificationID", "V_MyNotification")); List <Object> selectItemsID = new List <object>(); selectItemsID.Add(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName)); accept(selectItemsID); }
protected void ASPxGridView2_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnview") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView2.GetDataRow(Gid); int id = Convert.ToInt32(dr["id"].ToString()); Response.Redirect("~/StudentAfair/ViewDocuments.aspx?id=" + id); } }
protected void ListBudgetGrid_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "BudgetGridEdit") { string doc_number = ListBudgetGrid.GetRowValues(ListBudgetGrid.FocusedRowIndex, "DocNumber").ToString(); string work_line = ListBudgetGrid.GetRowValues(ListBudgetGrid.FocusedRowIndex, "WorkLine").ToString(); Session["mrp_docNum"] = doc_number.ToString(); Session["mrp_wrkLine"] = work_line.ToString(); ASPxWebControl.RedirectOnCallback("mrp_preview.aspx?DocNum=" + doc_number.ToString() + "&WrkFlwLn=" + work_line.ToString()); } }
protected void dgUsuarios_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": Usuario user = wu.Usuario.ObtenerPorId(int.Parse(dgUsuarios.GetRowValues(e.VisibleIndex, "Id").ToString())); break; } }
protected void GridCustomerViewTmp_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "ButtonBooking") { ASPxGridView grid = sender as ASPxGridView; int index = e.VisibleIndex; string id = grid.GetRowValues(index, "id").ToString(); ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute("~/SupportForms/BookingView.aspx?id=" + id)); } }
protected void GridBookingProcessView_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "ButtonBookingDetails") { ASPxGridView grid = sender as ASPxGridView; int index = e.VisibleIndex; string id = grid.GetRowValues(index, "Id").ToString(); ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute("~/AspxArea/Booking/Forms/BookingProcessDetailsProView.aspx?id=" + id)); } }
protected void UiVistaBodegasAsociadas_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "Desasociar") { string value = (sender as DevExpress.Web.ASPxGridView).GetRowValues(e.VisibleIndex, "WAREHOUSE_X_ZONE_ID").ToString(); UsuarioDeseaDesAsociarBodegaAZona.Invoke(sender, new ZonaArgumento { BodegaPorZona = new BodegasPorZona { WAREHOUSE_X_ZONE_ID = Convert.ToInt32(value) } }); } }
protected void GridUnitOfferView_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "ButtonPriceList") { ASPxGridView grid = sender as ASPxGridView; int index = e.VisibleIndex; string offercode = grid.GetRowValues(index, "OfferCode").ToString(); string sitecode = grid.GetRowValues(index, "SiteCode").ToString(); string unitcode = grid.GetRowValues(index, "UnitCode").ToString(); ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute("~/AspxArea/PriceList/Forms/RetailPriceForm.aspx?sc=" + sitecode + "&oc=" + offercode + "&uc=" + unitcode)); } }
protected void GridView_Pagos_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { try { int IdPago = Convert.ToInt32(GridView_Pagos.GetRowValues(e.VisibleIndex, "IdPago")); Session["TicketImprimir"] = IdPago; //GenerarTicket(IdPago); PopupControl_Ticket.ShowOnPageLoad = true; //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "printReport();", true); } catch (Exception Ex) { FG.Controlador_Error(Ex, Page.Response); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["EmpID"].ToString()); if (e.ButtonID == "btnview") { Response.Redirect("~/HR/ViewEmployee.aspx?id=" + id); } else { ASPxGridView1.SettingsEditing.Mode = (GridViewEditingMode)id; } }
protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { try { long id = long.Parse(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName).ToString()); if (e.ButtonID == "GridEdit") { HELPER.Client.Alert(this, "Đã nộp yêu cầu!"); Response.Redirect(Request.RawUrl); } } catch (Exception ex) { HELPER.Client.Alert(this, "Lỗi xin vào khóa học! " + ex.ToString()); } }
protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { long id = long.Parse(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName).ToString()); if (e.ButtonID == "GridEdit") { setHdf(hdfID, id); setMode(CGlobal.FunctionMode.EditMode); initFuncMode(); } else if (e.ButtonID == "GridDelete") { DatabaseDAO dao = new DatabaseDAO(); objProblemsTestCase = new BUS.BUS_ProblemsTestCases(dao); obj = new BUS.BUS_Problems(dao); BUS.BUS_ProblemsInContest objProblemsInContest = new BUS.BUS_ProblemsInContest(dao); try { dao.BeginTransaction(); objProblemsTestCase.ProblemId = id; objProblemsTestCase.DeleteByProblemId(); objProblemsInContest.DeleteByProblem(id); obj.Delete(id); dao.EndTransaction(); setMode(CGlobal.FunctionMode.SearchMode); initFuncMode(); } catch (Exception ex) { dao.RollBack(); HELPER.CError.ErrorType err = HELPER.CError.Parse(ex.Message); if (err == CError.ErrorType.InUse) { HELPER.Client.Alert(this, "Dữ liệu đã được sử dụng. Không thể xóa được!"); } else { HELPER.Client.Alert(this, "Lỗi xóa dữ liệu!"); } } } }
protected void gridHangHoa_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "KhoiPhuc") { int ID = Int32.Parse(gridHangHoa.GetRowValues(VisibleIndexHere, gridHangHoa.KeyFieldName).ToString()); data = new dtDuLieu(); data.KhoiHangHoa(ID); LoadDanhSachHangHoa(); } if (e.ButtonID == "Xoa") { int ID = Int32.Parse(gridHangHoa.GetRowValues(VisibleIndexHere, gridHangHoa.KeyFieldName).ToString()); data = new dtDuLieu(); data.XoaHangHoa(ID); LoadDanhSachHangHoa(); } }
protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { try { long id = long.Parse(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName).ToString()); if (e.ButtonID == "GridEdit") { BUS.BUS_MyContest obj = new BUS.BUS_MyContest(); obj.ContestId = id; obj.Insert(); HELPER.Client.Alert(this, "Đã nộp yêu cầu!"); // Response.Redirect(Request.RawUrl); } } catch (Exception ex) { HELPER.Client.Alert(this, "Bạn đã nộp yêu cầu vào khóa học này rồi! " + ex.ToString()); } }
protected void dgRequerimientos_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": string url = "Requerimientos.aspx?Id=" + int.Parse(dgRequerimientos.GetRowValues(e.VisibleIndex, "Id").ToString()); Response.RedirectLocation = url; break; case "Anular": try { Requerimiento Req_anular = wu.Requerimiento.ObtenerPorId(int.Parse(dgRequerimientos.GetRowValues(e.VisibleIndex, "Id").ToString())); if (Req_anular.IdEstado == 27) { dgRequerimientos.JSProperties["cpOperacionGrid"] = "Operación denegada, el requerimiento ya ha sido aprobado"; } else if (Req_anular.IdEstado == 28) { dgRequerimientos.JSProperties["cpOperacionGrid"] = "Operación denegada, el requerimiento ya ha sido anulado"; } else { Req_anular.IdEstado = 28; wu.Requerimiento.Actualizar(Req_anular); wu.Grabar(); cargarRequerimientos(); dgRequerimientos.JSProperties["cpOperacionGrid"] = "Operación realizada con éxito"; } } catch (Exception ex) { dgRequerimientos.JSProperties["cpOperacionGrid"] = "Ha ocurrido un error: " + ex.Message; } break; case "VerReporte": break; } }
protected void grvContests_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { long id = long.Parse(grvContests.GetRowValues(e.VisibleIndex, grvContests.KeyFieldName).ToString()); if (e.ButtonID == "GridEdit") { setHdf(hdfID, id); setMode(CGlobal.FunctionMode.EditMode); if (!string.IsNullOrEmpty(CGlobal.getDataByColumn(id, "StartTime", "Contests"))) { txtIsLimitTime.Checked = true; txtIsLimitTime_CheckedChanged(new object(), new EventArgs()); } initFuncMode(); } else if (e.ButtonID == "GridDelete") { try { objContest.Delete(id); setMode(CGlobal.FunctionMode.SearchMode); initFuncMode(); } catch (Exception ex) { HELPER.CError.ErrorType err = HELPER.CError.Parse(ex.Message); if (err == CError.ErrorType.InUse) { HELPER.Client.Alert(this, "Dữ liệu đã được sử dụng. Không thể xóa được!"); } else { HELPER.Client.Alert(this, "Lỗi xóa dữ liệu!"); } } } }
protected void GridTouristUnitView_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { ASPxGridView grid = sender as ASPxGridView; int index = e.VisibleIndex; if (e.ButtonID == "ButtonPriceList") { string unitcode = grid.GetRowValues(index, "UnitCode").ToString(); string sitecode = grid.GetRowValues(index, "SiteCode").ToString(); // Response.Redirect("~/AspxArea/PriceList/Forms/PurchasePriceForm.aspx?sc=" + sitecode + "&oc=" + unitcode); ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute("~/AspxArea/PriceList/Forms/PurchasePriceForm.aspx?sc=" + sitecode + "&uc=" + unitcode)); } else if (e.ButtonID == "ButtonUnit") { string unitcode = grid.GetRowValues(index, "UnitCode").ToString(); string sitecode = grid.GetRowValues(index, "SiteCode").ToString(); string tourOperatorCode = grid.GetRowValues(index, "TourOperatorCode").ToString(); string id = grid.GetRowValues(index, "id").ToString(); ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute("~/AspxArea/MasterData/Forms/UnitForm.aspx?id=" + id + "&sc=" + sitecode + "&uc=" + unitcode + "&to=" + tourOperatorCode + "&plt=" + "1")); } }
protected void dgRequerimientos_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": string url = "AprobarRequerimientos.aspx?Id=" + int.Parse(dgRequerimientos.GetRowValues(e.VisibleIndex, "Id").ToString()); Response.RedirectLocation = url; break; case "Anular": try { Requerimiento Req_anular = wu.Requerimiento.ObtenerPorId(int.Parse(dgRequerimientos.GetRowValues(e.VisibleIndex, "Id").ToString())); Req_anular.IdEstado = 28; wu.Requerimiento.Actualizar(Req_anular); wu.Grabar(); MostrarMensajes("Operación realizada con éxito"); } catch (Exception ex) { MostrarMensajes("Ha ocurrido un error: " + ex.Message); } break; } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnPay") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); FillGrid(); DataRow dr = ASPxGridView1.GetDataRow(Gid); DataTable dt = ASPxGridView1.DataSource as DataTable; int id = Convert.ToInt32(dr["EmpID"].ToString()); dr["Paid"] = Convert.ToBoolean(true); for (int i = 0; i < dt.Rows.Count; i++) { new Employee().saveSallary(Convert.ToInt32(ddlMonth.SelectedValue.ToString()), Convert.ToInt32(ddlYear.SelectedValue.ToString()), 0, dt.Rows[i]); } Session["table"] = dt; /* dt.Rows.RemoveAt(Gid); * dt.Rows.InsertAt(dr,Gid);*/ //ASPxGridView1.DataSource = dt; ASPxGridView1.DataBind(); //Response.Redirect("~/HR/ViewEmployee.aspx?id=" + id); } }
protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { long myNotiID = long.Parse(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName).ToString()); if (e.ButtonID == "GridDelete") { try { objMyNoti.Delete(myNotiID); } catch (Exception ex) { HELPER.CError.ErrorType err = HELPER.CError.Parse(ex.Message); if (err == CError.ErrorType.InUse) { HELPER.Client.Alert(this, "Dữ liệu đã được sử dụng. Không thể xóa được!"); } else { HELPER.Client.Alert(this, "Lỗi xóa dữ liệu!"); } } } }
protected void GridBookingProcessView_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "ButtonBookingDetails") { ASPxGridView grid = sender as ASPxGridView; List <BookingProcessViewModel> list = (List <BookingProcessViewModel>)grid.DataSource; //Todo: Ivane da li trebas ovaj code ?? int index = e.VisibleIndex; string id = grid.GetRowValues(index, "Id").ToString(); /* string country = (string) grid.GetRowValues(index, "Country") ?? string.Empty; * string placename = grid.GetRowValues(index, "PlaceName").ToString(); * string firstname = grid.GetRowValues(index, "FirstName").ToString(); * string lastname = grid.GetRowValues(index, "LastName").ToString(); * * var item = list.Find(p => p.Id == id); * * var bookingitems = item.BookingProcessItemList;*/ // Response.Redirect("~/AspxArea/PriceList/Forms/PurchasePriceForm.aspx?sc=" + sitecode + "&oc=" + unitcode); ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute("~/AspxArea/Booking/Forms/BookingProcessDetailsProView.aspx?id=" + id)); } }
//Metodo que se ejecuta cuando se da clic en botón eliminar, descargar archivo o procesar archivo protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { try { if (Session["Cadena"] == null) { Response.Redirect("Login.aspx"); return; } //ds_filesDS.ConnectionString = Session["Cadena"].ToString(); string cmdString = string.Empty; string connString = Session["Cadena"].ToString(); ASPxGridView grid = sender as ASPxGridView; var tmp = grid.GetRowValues(e.VisibleIndex, grid.KeyFieldName); DataTable dt = new DataTable(); if (e.ButtonID == "btnEliminar") { cmdString = "DELETE FROM [FILESDS] WHERE [FILESDSKEY] = @FILESDSKEY"; using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using (SqlCommand comm = new SqlCommand()) { comm.Connection = conn; comm.CommandText = cmdString; comm.Parameters.Add("@FILESDSKEY", SqlDbType.UniqueIdentifier).Value = tmp; using (SqlDataReader reader = comm.ExecuteReader()) { if (!reader.HasRows) { dt = null; } else { dt.Load(reader); } } } conn.Close(); } //Se actualiza grid UpdateGrid(); AlertSuccess("Archivo eliminado con éxito"); } else if (e.ButtonID == "ID_DOWNLOAD") { byte[] bytes = null; string nombreArchivo = ""; var parent = System.IO.Directory.GetParent(Environment.CurrentDirectory); string path = parent.Parent + "\\DS"; string target = path + ""; //Crea un directorio if (!Directory.Exists(target)) { Directory.CreateDirectory(target); } cmdString = "SELECT TOP 1 ARCHIVO, DSNAME FROM [FILESDS] WHERE [FILESDSKEY] = @val1 "; using (SqlConnection conn = new SqlConnection(connString)) { using (SqlCommand comm = new SqlCommand()) { comm.Connection = conn; comm.CommandText = cmdString; comm.Parameters.Add("@val1", SqlDbType.UniqueIdentifier).Value = tmp; conn.Open(); SqlDataReader reader = comm.ExecuteReader(); if (!reader.HasRows) { dt = null; } else { reader.Read(); bytes = (byte[])reader["ARCHIVO"]; nombreArchivo = (string)reader["DSNAME"]; File.WriteAllBytes(path + "\\" + nombreArchivo, bytes); AlertSuccess("Se descargo el archivo: " + nombreArchivo); } } //(sender as ASPxGridView).JSProperties["cpResult"] = "DS\\" + nombreArchivo; conn.Close(); } // Response.Clear(); // Response.ContentType = "application/winrar"; // Response.AddHeader("content-disposition", "attachment;filename=" + nombreArchivo); //// Response.TransmitFile(Server.MapPath(path + "\\" + nombreArchivo)); // Response.TransmitFile(path + "\\" + nombreArchivo); // HttpContext.Current.ApplicationInstance.CompleteRequest(); // Response.End(); } if (e.ButtonID == "ID_PROCESAR") { // AQUI SE DEBE MANDAR A EJECUTAR EL SP QUE PROCESA LOS ARCHIVOS. try { string rfc = Session["RFC"].ToString().Trim(); if (rfc == null) { Response.Redirect("Login.aspx"); return; } TRespuesta res; IExpedienteComercioservice v1 = new IExpedienteComercioservice(); res = v1.Procesads(tmp.ToString(), rfc); string respuesta = res.ToString(); } catch (Exception exc) { int idusuario = 0; string mensaje = ""; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "CargasDataStage-ASPxGridView1_CustomButtonCallback", exc, lblCadena.Text, ref mensaje); AlertError("Error al conectarse con el WebServices, intentelo más tarde"); } #region codigo anterior ////Valida de cada fila del grid si el estatus esta Procesado entonces el botón Procesar Archivo queda inhabilitado //DataTable dtU = new DataTable(); //dtU = UpdateGrid(); //Session["Grid"] = dtU; //if (Session["Grid"] != null && ((DataTable)(Session["Grid"])).Rows.Count > 0) //{ // for (int i = 0; i < ((DataTable)(Session["Grid"])).Rows.Count; i++) // { // var status = grid.GetRowValues(i, "STATUSDS"); // if(status.ToString().ToUpper().Trim().Equals("PROCESADO")) // { // ASPxButton button = grid.FindRowCellTemplateControl(i, (GridViewDataColumn)grid.Columns["ACCION"], "ID_PROCESAR") as ASPxButton; // var col = ASPxGridView1. Columns[8] as GridViewCommandColumn; // col.CustomButtons["ID_PROCESAR"].Visibility = GridViewCustomButtonVisibility.Invisible; // } // //ASPxCheckBox chkConsultar = detailGridDocumentos.FindRowCellTemplateControl(i, (GridViewDataColumn)detailGridDocumentos.Columns["PDF"], "chkConsultar") as ASPxCheckBox; // //ASPxCheckBox chkConsultar = Grid2.FindRowCellTemplateControl(i, (GridViewDataColumn)Grid2.Columns["Consultar"], "chkConsultar") as ASPxCheckBox; // //ASPxButton btnProcesarFile = ASPxGridView1.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1.Columns["ACCIONES"], "btnProcesarFile") as ASPxButton; // //if (ASPxGridView1.GetRowValues(i, "STATUSDS").ToString().Equals("PROCESADO")) // // btnProcesarFile.Enabled = false; // //else // // btnProcesarFile.Enabled = true; // } // //foreach (DataRow fila in ((DataTable)(Session["Grid"])).Rows) // //{ // // if (fila["STATUSDS"].ToString().Trim().ToUpper().Equals("PROCESADO")) // // { // // } // //} //} #endregion //Se actualiza grid UpdateGrid(); } } catch (Exception ex) { AlertError(ex.Message); int idusuario = 0; string mensaje = ""; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "CargasDataStage-ASPxGridView1_CustomButtonCallback", ex, lblCadena.Text, ref mensaje); } }
protected void dgCotizaciones_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { dgCotizaciones.JSProperties["cpOperacionesCot"] = null; UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": string url = "Cotizaciones.aspx?Id=" + int.Parse(dgCotizaciones.GetRowValues(e.VisibleIndex, "Id").ToString()); Response.RedirectLocation = url; break; case "Anular": try { Cotizacion Cot_anular = wu.Cotizacion.ObtenerPorId(int.Parse(dgCotizaciones.GetRowValues(e.VisibleIndex, "Id").ToString())); if (Cot_anular.IdEstado == 36) { dgCotizaciones.JSProperties["cpOperacionesCot"] = "Operación denegada, la cotización ya ha sido anulada"; } else if (Cot_anular.IdEstado == 47) { dgCotizaciones.JSProperties["cpOperacionesCot"] = "Operación denegada, la cotización ya ha sido convertida en orden de venta"; } else { Cot_anular.IdEstado = 36; wu.Cotizacion.Actualizar(Cot_anular); wu.Grabar(); cargarCotizaciones(); dgCotizaciones.JSProperties["cpOperacionesCot"] = "Operación realizada con éxito"; } } catch (Exception ex) { dgCotizaciones.JSProperties["cpOperacionesCot"] = "Ha ocurrido un error inesperado: " + ex.Message; } break; case "btnToOrdenVenta": string mensaje = null; try { Cotizacion cot_ov = new Cotizacion(); using (var db = new UnidadDeTrabajo()) { cot_ov = db.Cotizacion.ObtenerPorId(int.Parse(dgCotizaciones.GetRowValues(e.VisibleIndex, "Id").ToString())); } bool resultado = false; switch (cot_ov.IdEstado) { case 47: mensaje = "Operación denegada: la cotización ya es una orden de venta"; break; case 36: mensaje = "Operación denegada: la cotización ha sido anulada"; break; } int idusuario = Session["IdUserActive"] != null?int.Parse(Session["IdUserActive"].ToString()) : 1; if (mensaje == null) { resultado = wu.Cotizacion.ConvertirCotizacion_OrdenVenta(int.Parse(dgCotizaciones.GetRowValues(e.VisibleIndex, "Id").ToString()), idusuario); if (resultado) { using (var db = new UnidadDeTrabajo()) { cot_ov = db.Cotizacion.ObtenerPorId(int.Parse(dgCotizaciones.GetRowValues(e.VisibleIndex, "Id").ToString())); cot_ov.IdEstado = 47; db.Cotizacion.Actualizar(cot_ov); db.Grabar(); } dgCotizaciones.JSProperties["cpOperacionesCot"] = "Operación realizada con éxito"; } cargarCotizaciones(); } else { dgCotizaciones.JSProperties["cpOperacionesCot"] = mensaje; } } catch (Exception ex) { dgCotizaciones.JSProperties["cpOperacionesCot"] = "Ha ocurrido un erro inesperado: " + ex.Message; } break; case "VerReporteC": Session["ItemClickeado"] = "Cotizacion"; dgCotizaciones.JSProperties["cpRedireccion"] = "Reporte.aspx?Cot=" + int.Parse(dgCotizaciones.GetRowValues(e.VisibleIndex, "Id").ToString()); break; } }
protected void dgOrdenesTrabajo_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": //dgRecepcionDetalle.Visible = true; int?[] estateBad = { 44, 64 }; lblOperacion.Text = "2"; OrdenTrabajo ot = wu.OrdenTrabajo.ObtenerPorId(int.Parse(dgOrdenesTrabajo.GetRowValues(e.VisibleIndex, "Id").ToString())); lblIdOrden.Text = ot.IdOrdenTrabajo.ToString(); deFechaEmision.Value = ot.FechaEmision; //deFechaEntregaO.Value = ot.FechaEntregaO; deFechaEntregaF.Value = ot.FechaEntregaF; txtTrabajo.Value = ot.Trabajo; cmbEjecutivo.Value = ot.IdEjecutivo; if (ot.IdClienteNatural > 0) { cmbCliente.DataSource = wu.Cliente.ListadoClientesDatosGenerales(); cmbCliente.ValueField = "IdCliente"; cmbCliente.TextField = "ApelNom"; cmbCliente.DataBind(); } else { cmbCliente.DataSource = wu.Empresa.ObtenerListaEmpresas(); cmbCliente.ValueField = "Id"; cmbCliente.TextField = "RazonSocial"; cmbCliente.DataBind(); } cmbCliente.Value = ot.IdClienteNatural > 0 ? ot.IdClienteNatural : ot.IdClienteJuridico; sePlaUnCol.Value = ot.NumeroPlacasUnColor; seTotalPlacas.Value = ot.TotalPlacas; //seNumOrdenado.Value = ot.NumeroOrdenado; //txtTamAbierto.Value = ot.TamañoAbierto; //txtLiniaje.Value = ot.Liniaje; //cmbEstado.ClientEnabled = false; //cmbEstado.Value = ot.IdEstado; //txtMaquina.Value = ot.Maquina; //sePagPortada.Value = ot.PagPortada; //sePagInteriores.Value = ot.PaginaInteriores; //txtColores.Value = ot.Colores; //txtIColor.Value = ot.IColor; seNumSelecciones.Value = ot.NumeroSelecciones; //cbxFullColor.Value = ot.FullColor; //cbxPaneles.Value = ot.Paneles; cbxCTP.Value = ot.Ctp; cbxCanson.Value = ot.Canson; txtObservacionesMain.Value = ot.Observaciones; cmbOperador.Text = ot.Operadores; //cmbOperadorB.Text = ot.OperadoresBodegaInventario; //txtObservacionesB.Text = ot.ComentariosBodegaInventario; seContacto.Value = ot.Contacto; cmbOperadorP.Text = ot.OperadoresPrensa; txtObservacionesP.Text = ot.ComentariosPrensa; cmbOperadorPP.Text = ot.OperadoresPosPrensa; txtObservacionesPP.Text = ot.ComentariosPosPrensa; rbColores.Value = ot.Colores; seCantPlieg.Value = ot.CantidadPliegos; seCantResmas.Value = ot.CantidadResmas; txtDescPli.Value = ot.DescripcionPliegos; txtxDescResmas.Value = ot.DescripcionResmas; txtDemPli.Value = ot.DemasiaPliegos; txtDemResmas.Value = ot.DemasiaResmas; txtMedPli.Value = ot.MedidaPliegos; txtMedResmas.Value = ot.MedidaResmas; txtTamCortPli.Value = ot.TamañoCortePliego; txtTamCortResmas.Value = ot.TamañoCorteResmas; //seCostoTotal.Value = ot.CostoTotalOrden; //seAdelanto.Value = ot.AdelantoPago; //seSaldoOrden.Value = ot.CostoTotalOrden - ot.AdelantoPago; if (estateBad.Contains(ot.IdEstado)) { btnACeptarMain.ClientEnabled = false; } else { btnACeptarMain.ClientEnabled = true; } PosPrensaOrdenTrabajo ppot = wu.PosPrensaOrdenTrabajo.ObtenerPosPrensaOrdenTrabajo_IdOrden(ot.IdOrdenTrabajo); cbxAl.Value = ppot.Al; cbxAnillado.Value = ppot.Anillado; cbxBarnizado.Value = ppot.Barnizado; cbxBrillante.Value = ppot.Brillante; cbxBrillante1.Value = ppot.Brillante1; cbxCompaginado.Value = ppot.Compaginado; cbxDel.Value = ppot.Del; cbxDobleRing.Value = ppot.DobleRing; cbxEncolado.Value = ppot.Encolado; cbxEngrampado.Value = ppot.Engrampado; cbxMate.Value = ppot.Mate; cbxMate1.Value = ppot.Mate1; cbxNumerado.Value = ppot.Numerado; cbxPerforado.Value = ppot.Perforado; cbxPlastificado.Value = ppot.Plastificado; cbxRefilado.Value = ppot.Refilado; cbxTira.Value = ppot.Tira; cbxTira1.Value = ppot.Tira1; cbxTiraRet.Value = ppot.TiraRetira; cbxTiraRet1.Value = ppot.RetiraRetira1; cbxTroquelado.Value = ppot.Troquelado; //CargarDatosBodegaInventario(ot.IdOrdenTrabajo); //CargarDatosPrensaOrdenTrabajo(ot.IdOrdenTrabajo); AutoCorriativoOrdenTrabajo aot = wu.AutoCorriativoOrdenTrabajo.ObtenerAutocorriativo_IdOrden(ot.IdOrdenTrabajo); txtCantidadAut.Value = aot.CantidadAut; txtHojasAut.Value = aot.HojasAut; cbxCB.Value = aot.CbAUt; txtCB.Value = aot.ValorCbAut; cbxCF.Value = aot.cbCfAut; txtCF.Value = aot.ValorCfAut; cbxCFB.Value = aot.CfbAut; txtCFB.Value = aot.ValorCfbAut; cbxCFB1.Value = aot.CfbAut1; txtCFB1.Value = aot.ValorCfbAut1; cbxCFB1.Value = aot.CfbAut2; txtCFB1.Value = aot.ValorCfbAut2; pcEditorOrdenesTrabajo.ShowOnPageLoad = true; break; case "Anular": OrdenTrabajo ordenTrabajo = wu.OrdenTrabajo.ObtenerPorId(int.Parse(dgOrdenesTrabajo.GetRowValues(e.VisibleIndex, "Id").ToString())); OrdenVenta ov = wu.OrdenVenta.ObtenerPorId(wu.OrdenTrabajo.ObtenerOrdenVentaId_x_IdOrdenTrabajo(ordenTrabajo.IdOrdenTrabajo)); if (ov.IdEstado == 48) { int IdCv = wu.ComprobanteVenta.ObtenerComprobanteId_OrdenVenta(ov.Id); int IdNc = wu.ComprobanteVenta.ObtenerNotasCreaditoAO_x_IdComprobante(IdCv); if (IdNc > 0) { ordenTrabajo.IdEstado = 44; wu.OrdenTrabajo.Actualizar(ordenTrabajo); wu.Grabar(); cargarOrdenesTrabajo(); } else { MostrarMensajes("Operación denegada: ya se ha facturado la orden de venta asociada a esta orden de trabajo"); } } else { ordenTrabajo.IdEstado = 44; wu.OrdenTrabajo.Actualizar(ordenTrabajo); wu.Grabar(); cargarOrdenesTrabajo(); } break; case "showReport": Session["ItemClickeado"] = "OrdenTrabajo"; string url = "Reporte.aspx?ot=" + int.Parse(dgOrdenesTrabajo.GetRowValues(e.VisibleIndex, "Id").ToString()); Response.Write("<script>window.open('" + url + "','_blank');</script>"); break; case "entregarOrden": OrdenTrabajo ort = wu.OrdenTrabajo.ObtenerPorId(int.Parse(dgOrdenesTrabajo.GetRowValues(e.VisibleIndex, "Id").ToString())); if (ort.IdEstado != 64) { ort.IdEstado = 64; wu.OrdenTrabajo.Actualizar(ort); wu.Grabar(); } else { MostrarMensajes("Orden de Trabajo Finalizada"); } cargarOrdenesTrabajo(); break; } }
protected void POTable_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (Session["CreatorKey"] == null) { Response.RedirectLocation = "default.aspx"; return; } ASPxHiddenField text = POTable.FindHeaderTemplateControl(POTable.Columns[0], "HiddenVal") as ASPxHiddenField; text["hidden_value"] = ""; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string PK = POTable.GetRowValues(POTable.FocusedRowIndex, "PK").ToString(); string query = "SELECT COUNT(*) FROM " + MRPClass.POTableName() + " WHERE CreatorKey = '" + Session["CreatorKey"].ToString() + "' AND PK = '" + PK + "'"; SqlCommand comm = new SqlCommand(query, conn); int result = Convert.ToInt32(comm.ExecuteScalar()); if (result > 0) { if (e.ButtonID == "Edit") { if (POTable.FocusedRowIndex > -1) { Session["PO_PK"] = PK; string docNum = POTable.GetRowValues(POTable.FocusedRowIndex, "MRPNumber").ToString(); string poNumber = POTable.GetRowValues(POTable.FocusedRowIndex, "PONumber").ToString(); Session["MRP_Number"] = docNum; //query if po number already PO //string query_po = "SELECT COUNT(*) FROM[dbo].[tbl_POCreation_Details] WHERE PONumber = '" + poNumber + "'"; //SqlCommand cmd = new SqlCommand(query_po, conn); //int result_po = Convert.ToInt32(cmd.ExecuteScalar()); //MRPClass.PrintString(":" + result_po); //if (result_po > 0) // text["hidden_value"] = "AlreadyPO"; //else Response.RedirectLocation = "mrp_pocreatededit.aspx?PONum=" + poNumber.ToString(); // string query_po = "SELECT COUNT(*) FROM[dbo].[tbl_POCreation_Details] WHERE PONumber = '" + poNumber + "'"; // SqlCommand cmd = new SqlCommand(query_po, conn); // int result_po = Convert.ToInt32(cmd.ExecuteScalar()); // //MRPClass.PrintString(":" + result_po); // if (result_po > 0) // text["hidden_value"] = "AlreadyPO"; // else // Response.RedirectLocation = "mrp_poaddedit.aspx?DocNum=" + docNum.ToString(); } } if (e.ButtonID == "Delete") { if (POTable.FocusedRowIndex > -1) { string delete = "DELETE FROM " + MRPClass.POTableName() + " WHERE [PK] ='" + PK + "'"; SqlCommand cmd = new SqlCommand(delete, conn); cmd.ExecuteNonQuery(); BindPO(); } } } else { text["hidden_value"] = "InvalidCreator"; } }
//Metodo que se ejecuta cuando se da clic en botón eliminar, descargar archivo o procesar archivo protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { try { if (Session["Cadena"] == null) { Response.Redirect("Login.aspx"); return; } //ds_filesDS.ConnectionString = Session["Cadena"].ToString(); string cmdString = string.Empty; string connString = Session["Cadena"].ToString(); ASPxGridView grid = sender as ASPxGridView; var tmp = grid.GetRowValues(e.VisibleIndex, grid.KeyFieldName); DataTable dt = new DataTable(); if (e.ButtonID == "btnEliminar") { cmdString = "DELETE FROM [FILESPECA] WHERE [FPKEY] = @FPKEY"; using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using (SqlCommand comm = new SqlCommand()) { comm.Connection = conn; comm.CommandText = cmdString; comm.Parameters.Add("@FPKEY", SqlDbType.UniqueIdentifier).Value = tmp; using (SqlDataReader reader = comm.ExecuteReader()) { if (!reader.HasRows) { dt = null; } else { dt.Load(reader); } } } conn.Close(); } //Se actualiza grid UpdateGrid(); AlertSuccess("Archivo eliminado con éxito"); } else if (e.ButtonID == "ID_DOWNLOAD") { byte[] bytes = null; string nombreArchivo = ""; var parent = System.IO.Directory.GetParent(Environment.CurrentDirectory); string path = parent.Parent + "\\DS"; string target = path + ""; //Crea un directorio if (!Directory.Exists(target)) { Directory.CreateDirectory(target); } cmdString = "SELECT TOP 1 ARCHIVO, PECANAME FROM [FILESPECA] WHERE [FPKEY] = @val1 "; using (SqlConnection conn = new SqlConnection(connString)) { using (SqlCommand comm = new SqlCommand()) { comm.Connection = conn; comm.CommandText = cmdString; comm.Parameters.Add("@val1", SqlDbType.UniqueIdentifier).Value = tmp; conn.Open(); SqlDataReader reader = comm.ExecuteReader(); if (!reader.HasRows) { dt = null; } else { reader.Read(); bytes = (byte[])reader["ARCHIVO"]; nombreArchivo = (string)reader["PECANAME"]; File.WriteAllBytes(path + "\\" + nombreArchivo, bytes); AlertSuccess("Se descargo el archivo: " + nombreArchivo); } } //(sender as ASPxGridView).JSProperties["cpResult"] = "DS\\" + nombreArchivo; conn.Close(); } } if (e.ButtonID == "ID_PROCESAR") { // AQUI SE DEBE MANDAR A EJECUTAR EL SP QUE PROCESA LOS ARCHIVOS. try { string rfc = Session["RFC"].ToString().Trim(); if (rfc == null) { Response.Redirect("Login.aspx"); return; } TRespuesta res; IExpedienteComercioservice v1 = new IExpedienteComercioservice(); res = v1.Procesapeca(tmp.ToString(), rfc); string respuesta = res.ToString(); } catch (Exception exc) { int idusuario = 0; string mensaje = ""; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "ASPxGridView1_CustomButtonCallback", exc, lblCadena.Text, ref mensaje); AlertError("Error al conectarse con el WebServices, intentelo más tarde"); } //Se actualiza grid UpdateGrid(); } } catch (Exception ex) { AlertError(ex.Message); int idusuario = 0; string mensaje = ""; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "CargasPeca-ASPxGridView1_CustomButtonCallback", ex, lblCadena.Text, ref mensaje); } }
protected void dgOrdenVentaes_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { UnidadDeTrabajo wu = new UnidadDeTrabajo(); switch (e.ButtonID) { case "Editar": string url = "OrdenesVenta.aspx?Id=" + int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString()); Response.RedirectLocation = url; break; case "Anular": OrdenVenta Cot_anular = wu.OrdenVenta.ObtenerPorId(int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString())); if (Cot_anular.IdEstado == 48) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya ha sido facturada"; } else if (Cot_anular.IdEstado == 40) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya ha sido Anulada"; } else if (Cot_anular.IdEstado == 59) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya es una Orden de Trabajo"; } else { Cot_anular.IdEstado = 40; wu.OrdenVenta.Actualizar(Cot_anular); wu.Grabar(); cargarOrdenVentaes(); dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación realizada con éxito"; } break; case "btnVender": OrdenVenta Cot_vender = wu.OrdenVenta.ObtenerPorId(int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString())); if (Cot_vender.IdEstado == 48) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya ha sido facturada"; } else if (Cot_vender.IdEstado == 40) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya ha sido Anulada"; } else if (Cot_vender.IdEstado == 59) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya es una Orden de Trabajo"; } else { if (wu.OrdenVentaDetalle.ContarDetalleOrdenVentaMayorStock(int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString())) == 0) { Cot_vender.IdEstado = 48; wu.OrdenVenta.Actualizar(Cot_vender); try { wu.Grabar(); dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación realizada con éxito"; } catch (Exception ex) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "error:" + ex.InnerException.Message; } cargarOrdenVentaes(); } else { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: No hay suficientes unidades en stock"; } } break; case "btnToOt": OrdenVenta ordenv = wu.OrdenVenta.ObtenerPorId(int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString())); if (ordenv.IdEstado == 48) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya ha sido facturada"; } else if (ordenv.IdEstado == 40) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya ha sido Anulada"; } else if (ordenv.IdEstado == 59) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: La orden de venta ya es una Orden de Trabajo"; } else if (ordenv.TipoOrdenVenta.Contains("Directa")) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación denegada: Este tipo de orden de venta no puede convertirse en orden de trabajo"; } else { try { if (wu.OrdenVenta.ConvertirOrdenVenta_OrdenTrabajo(ordenv.Id, Session["IdUserActive"] != null ? int.Parse(Session["IdUserActive"].ToString()) : 1) == "") { ordenv.IdEstado = 59; wu.OrdenVenta.Actualizar(ordenv); wu.Grabar(); cargarOrdenVentaes(); dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Operación realizada correctamente"; } } catch (Exception ex) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "Error: " + ex.Message; } } break; case "showReport": OrdenVenta ov = wu.OrdenVenta.ObtenerPorId(int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString())); if (ov.IdEstado != 48) { dgOrdenesVenta.JSProperties["cpOperacionesGrid"] = "La orden de venta " + ov.Id + " aún no tiene comprobante"; } else { int IdCv = wu.ComprobanteVenta.ObtenerComprobanteId_OrdenVenta(ov.Id); ComprobanteVenta cv = wu.ComprobanteVenta.ObtenerPorId(IdCv); switch (cv.IdTipoDocumento) { case 1: //Factura Session["ItemClickeado"] = "Factura"; break; case 2: //Boleta Session["ItemClickeado"] = "Boleta"; break; case 3: //TicketVenta Session["ItemClickeado"] = "TicketVenta"; break; } dgOrdenesVenta.JSProperties["cpRedireccion"] = "Reporte.aspx?cv=" + IdCv; } break; case "showProforma": Session["ItemClickeado"] = "Proforma"; dgOrdenesVenta.JSProperties["cpRedireccion"] = "Reporte.aspx?ovp=" + int.Parse(dgOrdenesVenta.GetRowValues(e.VisibleIndex, "Id").ToString()); break; } }