protected void UpdateValues(GridDataItem updatedItem) { TextBox txtBox = (TextBox)updatedItem.FindControl("txtBoxName"); SqlDataSource1.UpdateParameters["ProductName"].DefaultValue = txtBox.Text; txtBox = (TextBox)updatedItem.FindControl("txtQuantityPerUnit"); SqlDataSource1.UpdateParameters["QuantityPerUnit"].DefaultValue = txtBox.Text; txtBox = (TextBox)updatedItem.FindControl("txtUnitPrice"); SqlDataSource1.UpdateParameters["UnitPrice"].DefaultValue = txtBox.Text; txtBox = (TextBox)updatedItem.FindControl("txtUnitsOnOrder"); SqlDataSource1.UpdateParameters["UnitsOnOrder"].DefaultValue = txtBox.Text; DropDownList ddl = (DropDownList)updatedItem.FindControl("ddlUnitsInStock"); SqlDataSource1.UpdateParameters["UnitsInStock"].DefaultValue = ddl.SelectedValue; CheckBox chkBox = (CheckBox)updatedItem.FindControl("chkBoxDiscontinued"); SqlDataSource1.UpdateParameters["Discontinued"].DefaultValue = chkBox.Checked.ToString(); SqlDataSource1.UpdateParameters["ProductID"].DefaultValue = updatedItem.GetDataKeyValue("ProductID").ToString(); try { SqlDataSource1.Update(); } catch (Exception ex) { SetMessage(Server.HtmlEncode("Unable to update Products. Reason: " + ex.StackTrace).Replace("'", "'").Replace("\r\n", "<br />")); } SetMessage("Product with ID: " + updatedItem.GetDataKeyValue("ProductID") + " updated"); }
protected void rgAudits_ItemDataBound(object sender, GridItemEventArgs e) { if ("Records".Equals(e.Item.OwnerTableView.Name)) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; int rms_audit_record_id = Convert.ToInt32(item.GetDataKeyValue("rms_audit_record_id")); var audit_rec = db.AuditRecords.FirstOrDefault(p => p.rms_audit_record_id == rms_audit_record_id); HyperLink hlAnalysisNotes = (HyperLink)item.FindControl("hlAnalysisNotes"); hlAnalysisNotes.NavigateUrl = String.Format("javascript:OpenPopup('Modal/ReportPopup.aspx?view=analysisnotesbydaterange&rms_record_id={0}&beg_dt={1:MM/dd/yyyy}&end_dt={2:MM/dd/yyyy}')", audit_rec.rms_record_id, audit_rec.Audit.audit_beg_dt, audit_rec.Audit.audit_end_dt); } } else { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; int rms_audit_id = Convert.ToInt32(item.GetDataKeyValue("rms_audit_id")); var audit = db.Audits.FirstOrDefault(p => p.rms_audit_id == rms_audit_id); HyperLink hlEditAudit = (HyperLink)item.FindControl("hlEditAudit"); hlEditAudit.NavigateUrl = String.Format("../Task/Audit.aspx?rms_audit_id={0}", rms_audit_id); } if (e.Item.IsInEditMode) { GridEditableItem edititem = (GridEditableItem)e.Item; int rms_audit_id = Convert.ToInt32(edititem.GetDataKeyValue("rms_audit_id")); var audit = db.Audits.FirstOrDefault(p => p.rms_audit_id == rms_audit_id); Literal ltlType = (Literal)edititem.FindControl("ltlAuditType"); Literal ltlResults = (Literal)edititem.FindControl("ltlAuditResults"); Literal ltlReason = (Literal)edititem.FindControl("ltlReason"); Literal ltlData = (Literal)edititem.FindControl("ltlData"); Literal ltlFindings = (Literal)edititem.FindControl("ltlFindings"); RadListView rlvAuditDocs = (RadListView)edititem.FindControl("rlvAuditDocs"); rlvAuditDocs.DataSource = audit.AuditDocuments.Select(p => new { rms_audit_document_id = p.rms_audit_document_id, document_nm = p.document_nm }).OrderBy(p => p.document_nm); rlvAuditDocs.DataBind(); ltlType.Text = audit.AuditType.type + ": " + audit.AuditType.description; ltlResults.Text = audit.AuditResult.result + audit.AuditResult.description; ltlReason.Text = audit.audit_reason; ltlData.Text = audit.audit_data; ltlFindings.Text = audit.audit_findings; } } }
protected void dgvResumen_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem gridItem = e.Item as GridDataItem; int vIdCompetencia = int.Parse(gridItem.GetDataKeyValue("ID_COMPETENCIA").ToString()); string vClasificacion = vListaPersonal.Where(t => t.ID_COMPETENCIA == vIdCompetencia).FirstOrDefault().CL_CLASIFICACION; gridItem["CL_COLOR"].ToolTip = vClasificacion; } }
protected void grdAbyari_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { GridDataItem gr = e.Item as GridDataItem; if (gr == null) { return; } int Id = gr.GetDataKeyValue("ID").ToInt32(); ViewState["SelectetValue"] = Id; }
protected void btnEliminar_Click(object sender, EventArgs e) { GridDataItem item = grdVersiones.SelectedItems[0] as GridDataItem; idVersion = Guid.Parse(item.GetDataKeyValue("ID_VERSION").ToString()); VersionesNegocio neg = new VersionesNegocio(); E_RESULTADO resultado = neg.EliminaVersion(idVersion); string vMensaje = resultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE; UtilMensajes.MensajeResultadoDB(rwmAlertas, vMensaje, resultado.CL_TIPO_MENSAJE, pCallBackFunction: null); grdVersiones.Rebind(); }
protected void rgNews_EditCommand(object source, GridCommandEventArgs e) { GridDataItem dataItem = (GridDataItem)e.Item; String id = dataItem.GetDataKeyValue("Id").ToString(); Response.Redirect(Common.GenerateAdminUrl("approvenews", "newsid=" + id)); //newsid = Convert.ToInt32(id); //LoadCategories(0, null, rcbCategories); //ChangeMode(true); //LoadNewsContent(NewsId); //rgNews.EditIndexes.Clear(); }
protected void grdCapacitacion_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem gridItem = e.Item as GridDataItem; int vIdCompetencia = int.Parse(gridItem.GetDataKeyValue("ID_COMPETENCIA").ToString()); string vDsCompetencia = vLstDnc.Where(t => t.ID_COMPETENCIA == vIdCompetencia).FirstOrDefault().DS_COMPETENCIA; gridItem["NB_COMPETENCIA"].ToolTip = vDsCompetencia; } }
protected void cmbProjStatus_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox cmb = sender as RadComboBox; GridDataItem gridItem = (cmb.NamingContainer as GridDataItem); int projId = Convert.ToInt32(gridItem.GetDataKeyValue("projectID").ToString()); int status = Convert.ToInt32(cmb.SelectedValue); if (projBLL.updateRepairStatus(projId, status)) { getProjectData(); } }
protected void rglocationjobs_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { try { GridDataItem item = (GridDataItem)e.Item; _ctid = Convert.ToInt32(item.GetDataKeyValue("Lid")); _countryid = Convert.ToInt32(item.GetDataKeyValue("CountryId")); _stateid = Convert.ToInt32(item.GetDataKeyValue("StateId")); _cityid = Convert.ToInt32(item.GetDataKeyValue("CityId")); if (Session["SignInOrganizationId"] != null) { _clientid = Convert.ToInt32(Session["SignInOrganizationId"].ToString()); } objLocationBAL.DeleteLocation(_ctid, _clientid); rglocationjobs.Rebind(); } catch { e.Canceled = true; } }
protected void GridProject_SelectedIndexChanged(object sender, EventArgs e) { if (GridProject.SelectedItems.Count > 0) { GridDataItem gridItem = GridProject.SelectedItems[0] as GridDataItem; int projId = Convert.ToInt32(gridItem.GetDataKeyValue("projectID").ToString()); if (projId > 0) { getDetailData(projId); } } }
protected void gridMain_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e) { GridTableView detailtabl = e.DetailTableView; int recSkip = detailtabl.CurrentPageIndex * gridMain.PageSize; int recTake = detailtabl.PageSize; GridDataItem parentItem = detailtabl.ParentItem; int customerID = int.Parse(parentItem.GetDataKeyValue("ID").ToString()); FilesController cont = new FilesController(); detailtabl.VirtualItemCount = cont.CountFilesByCustomerID(customerID); detailtabl.DataSource = cont.GetFilesByCustomerID(customerID, recSkip, recTake); }
protected void RadGrid_Attributes_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem myItem = (GridDataItem)e.Item; string myItemID = myItem.GetDataKeyValue("Attribute_IndexID").ToString(); HyperLink myAddOptionLink = (HyperLink)myItem["TemplateColumn_Actions"].FindControl("hlink_Edit_AttributeOption"); myAddOptionLink.Attributes["href"] = "#"; myAddOptionLink.Attributes["onclick"] = string.Format("return Show_ControlManager('Products/PoP_AttributeOptions.aspx?Attribute_IndexID={0}');", myItemID); } }
protected void btnDownloadAttachment_Click(object sender, EventArgs e) { RadButton btnDownload = (RadButton)sender; GridDataItem item = (GridDataItem)btnDownload.NamingContainer; string requestID = item.GetDataKeyValue("ID").ToString(); RadWindow1.NavigateUrl = "AttachmentModal.aspx?RequestID=" + requestID; string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); }
protected void rgjobs_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { GridDataItem item = (GridDataItem)e.Item; _jid = Convert.ToInt32(item.GetDataKeyValue("Jid")); if (Session["SignInOrganizationId"] != null) { _clientid = Convert.ToInt32(Session["SignInOrganizationId"].ToString()); } objJobsBAL.DeleteJobByClientId(_jid, _clientid); rgjobs.Rebind(); }
protected void RadGridM_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; RadGrid gridP = item["PastDueReleaseNo"].FindControl("RadGridP") as RadGrid; RadGrid grid0 = item["Day0ReleaseNo"].FindControl("RadGrid0") as RadGrid; RadGrid grid1 = item["Day1ReleaseNo"].FindControl("RadGrid1") as RadGrid; RadGrid grid2 = item["Day2ReleaseNo"].FindControl("RadGrid2") as RadGrid; RadGrid grid3 = item["Day3ReleaseNo"].FindControl("RadGrid3") as RadGrid; RadGrid grid4 = item["Day4ReleaseNo"].FindControl("RadGrid4") as RadGrid; SqlDataSourceP.SelectParameters[0].DefaultValue = item.GetDataKeyValue("PastDueReleaseNo").ToString(); SqlDataSource0.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day0ReleaseNo").ToString(); SqlDataSource1.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day1ReleaseNo").ToString(); SqlDataSource2.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day2ReleaseNo").ToString(); SqlDataSource3.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day3ReleaseNo").ToString(); SqlDataSource4.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day4ReleaseNo").ToString(); gridP.DataSource = SqlDataSourceP.Select(DataSourceSelectArguments.Empty); grid0.DataSource = SqlDataSource0.Select(DataSourceSelectArguments.Empty); grid1.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty); grid2.DataSource = SqlDataSource2.Select(DataSourceSelectArguments.Empty); grid3.DataSource = SqlDataSource3.Select(DataSourceSelectArguments.Empty); grid4.DataSource = SqlDataSource4.Select(DataSourceSelectArguments.Empty); gridP.DataBind(); grid0.DataBind(); grid1.DataBind(); grid2.DataBind(); grid3.DataBind(); grid4.DataBind(); } }
void vGrid_ItemDataBound(object sender, GridItemEventArgs e) { int vEvaluadoMeta, vPeriodoMeta; if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HtmlGenericControl DivGridColor = (HtmlGenericControl)item.FindControl("DivGridColor"); vEvaluadoMeta = int.Parse(item.GetDataKeyValue("ID_EVALUADO_META").ToString()); vPeriodoMeta = int.Parse(item.GetDataKeyValue("ID_PERIODO").ToString()); PeriodoDesempenoNegocio nDesempeno = new PeriodoDesempenoNegocio(); var vMetasEvaluado = nDesempeno.ObtieneMetasComparacion(idEvaluadoMeta: vEvaluadoMeta, idEvaluado: vIdEvaluado, pIdPeriodo: vPeriodoMeta).FirstOrDefault(); if (vMetasEvaluado != null) { DivGridColor.Style.Add("background", vMetasEvaluado.COLOR_NIVEL); DivGridColor.Attributes.Add("title", vMetasEvaluado.NIVEL_ALZANZADO); HtmlGenericControl vControlGridEvidencias = (HtmlGenericControl)item.FindControl("DivGridEvidencias"); System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); if (vMetasEvaluado.FG_EVIDENCIA == true) { img.Attributes["src"] = "../Assets/images/Aceptar.png"; } else { img.Attributes["src"] = "../Assets/images/Cancelar.png"; } vControlGridEvidencias.Controls.Add(img); } else { // DivGridColor.Style.Add("background", "#F2F2F2"); DivGridColor.InnerText = "N/A"; DivGridColor.Attributes.Add("title", "N/A"); HtmlGenericControl vControlGridEvidencias = (HtmlGenericControl)item.FindControl("DivGridEvidencias"); System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); img.Attributes["src"] = "../Assets/images/Cancelar.png"; vControlGridEvidencias.Controls.Add(img); } } }
protected void gridMain_InsertCommand(object source, GridCommandEventArgs e) { if (e.Item.OwnerTableView.Name == "Master") { var editableItem = ((GridEditableItem)e.Item); using (var dbContext = new OTERTConnStr()) { var curSale = new Sales(); Hashtable values = new Hashtable(); editableItem.ExtractValues(values); if (Session["SalesType"] != null) { SalesType = int.Parse(Session["SalesType"].ToString()); } if (SalesType > 0) { try { curSale.Name = (string)values["Name"]; curSale.Type = SalesType; dbContext.Sales.Add(curSale); dbContext.SaveChanges(); } catch (Exception) { ShowErrorMessage(-1); } finally { SalesType = -1; Session.Remove("SalesType"); } } else { ShowErrorMessage(-1); } } } else if (e.Item.OwnerTableView.Name == "Details") { GridTableView detailtabl = (GridTableView)e.Item.OwnerTableView; GridDataItem parentItem = (GridDataItem)detailtabl.ParentItem; int salesID = int.Parse(parentItem.GetDataKeyValue("ID").ToString()); var editableItem = ((GridEditableItem)e.Item); using (var dbContext = new OTERTConnStr()) { var curSaleFurmula = new SalesFormulas(); Hashtable values = new Hashtable(); editableItem.ExtractValues(values); curSaleFurmula.SalesID = salesID; curSaleFurmula.Distance = decimal.Parse((string)values["Distance"]); curSaleFurmula.SalePercent = decimal.Parse((string)values["SalePercent"]); dbContext.SalesFormulas.Add(curSaleFurmula); try { dbContext.SaveChanges(); } catch (Exception) { ShowErrorMessage(-1); } } } }
protected void rgFactura_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; WebControl Button = default(WebControl); string clickHandler = string.Empty; Button = (WebControl)item["Autorizar"].Controls[0]; clickHandler = Button.Attributes["onclick"]; Button.Attributes["onclick"] = clickHandler.Replace("[[ID]]", item.GetDataKeyValue("Numero").ToString()); } }
protected void CboPersonaSubReg_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { int PersonaId = 0; if (e.Value != "") { PersonaId = Convert.ToInt32(e.Value); } RadComboBox combo = (RadComboBox)sender; GridDataItem item = (GridDataItem)combo.NamingContainer; ClRegiones.SP_Actualiza_SubRegional(Convert.ToInt32(item.GetDataKeyValue("SubRegionId")), PersonaId); }
private void InstructionsGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; int communicationStatusID = (int)item.GetDataKeyValue("CommunicationStatusID"); if ((communicationStatusID != (int)MWFCommunicationStatusEnum.ReceivedOnDevice)) { TableCell cell = item["CommunicationStatus"]; cell.ForeColor = System.Drawing.ColorTranslator.FromHtml("#EF4337"); } } }
protected void rgdFactores_SelectedIndexChanged(object sender, EventArgs e) { GridDataItem item = (GridDataItem)rgdFactores.SelectedItems[0]; vIdFactor = int.Parse(item.GetDataKeyValue("ID_SELECCION").ToString()); bool vValida = true; vValida = (vlstPruebas.Where(w => w.ID_PRUEBA == vIdPrueba).FirstOrDefault().CL_PRUEBA == "INGLES")? false:true; CargaCompetencias(); btnAgregar.Enabled = vValida; btnEliminar.Enabled = vValida; }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; if (item.GetDataKeyValue("psEstado").ToString() == "PAGADO") { item["ESTATUS"].ForeColor = Color.Green; // chanmge particuler cell e.Item.BackColor = System.Drawing.Color.LightGoldenrodYellow; // for whole row } else if (item.GetDataKeyValue("psEstado").ToString() == "ABONADO") { item["ESTATUS"].ForeColor = Color.Yellow; // chanmge particuler cell e.Item.BackColor = System.Drawing.Color.LightGoldenrodYellow; // for whole row } else if (item.GetDataKeyValue("psEstado").ToString() == "SIN PAGAR") { item["ESTATUS"].ForeColor = Color.Red; // chanmge particuler cell e.Item.BackColor = System.Drawing.Color.LightGoldenrodYellow; // for whole row } } }
protected void rgSites_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; int site_id = Convert.ToInt32(item.GetDataKeyValue("site_id")); var currSite = db.Sites.FirstOrDefault(p => p.site_id == site_id); LinkButton lbAssignRecord = (LinkButton)item.FindControl("lbAssignRecord"); lbAssignRecord.OnClientClick = String.Format("openWin('{0}','newrecord', '{1}'); return false;", currSite.site_id, Config.SIMSURL); } }
protected void gvMaterialBalance_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem item = e.Item as GridDataItem; // using columnuniquename //string str1 = item["Name"].Text; // using DataKey int ID = int.Parse(item.GetDataKeyValue("MaterialBalanceID").ToString()); ConnectionString conn = new ConnectionString(); string connectionSql = conn.GetConnectionString().ToString(); SqlHelper.ExecuteNonQuery(connectionSql, "DeleteMaterialBalance", ID); gvMaterialBalance.Rebind(); }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { ImageButton imgb = null; GridDataItem item = (GridDataItem)e.Item; string strKey = item.GetDataKeyValue("DispositivoId").ToString(); if (item["Caducado"].Text == "True") { item.BackColor = System.Drawing.Color.DeepPink; } } }
protected void rgAdminLogIn_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; switch (e.DetailTableView.Name) { case "AccountType": { int LoginId = Convert.ToInt32(dataItem.GetDataKeyValue("LoginId")); e.DetailTableView.DataSource = GetAccountType(LoginId); break; } case "Account": { int LoginId = Convert.ToInt32(dataItem.GetDataKeyValue("LoginId")); int AccountTypeId = Convert.ToInt32(dataItem.GetDataKeyValue("AccountTypeId")); e.DetailTableView.DataSource = GetLoginTable(LoginId, AccountTypeId); break; } } }
protected void DeleteDutyKSA(object sender, GridCommandEventArgs e) { if (sender is RadGrid) { GridDataItem gridItem = e.Item as GridDataItem; int jQFactorID = int.Parse(gridItem.GetDataKeyValue("JQFactorID").ToString()); JobAnalysisDutyKSAFactor dutyKSAFactor = new JobAnalysisDutyKSAFactor(jQFactorID); dutyKSAFactor.UpdatedByID = base.CurrentUserID; dutyKSAFactor.Delete(); rgDutyKSA.Rebind(); } }
protected void btnAccept_Click(object sender, EventArgs e) { foreach (GridItem item in gridSummary.MasterTableView.Items) { GridDataItem dataitem = (GridDataItem)item; TableCell cell = dataitem["ClientSelectColumn"]; CheckBox checkBox = (CheckBox)cell.Controls[0]; if (checkBox.Checked) { string value = dataitem.GetDataKeyValue("RECORD_ID").ToString(); } } }
protected void Button3_Click(object sender, EventArgs e) { string carr_id = DD_carrier.SelectedItem.Value; try { // get carrier barcode CageReportsDAO crdao = new CageReportsDAO(); string carrbarcode = crdao.GetCarrierBarcode(carr_id); // get cage barcode Button btn = (Button)sender; GridDataItem dataitem = (GridDataItem)btn.NamingContainer; String scageid = dataitem.GetDataKeyValue("cage_id").ToString(); Int32 icageid = Int32.Parse(scageid); string cagebarcode = crdao.GetCageBarcode(icageid); // call ready to despatch DespatchDAO desdao = new DespatchDAO(); string cagename = desdao.ProcessBarcode(carrbarcode, cagebarcode, username); Label1.Text = "Cage " + scageid + " Is Ready For despatch"; Label1.ForeColor = Color.Blue; Label1.Visible = true; } catch (Exception ex) { Label1.Text = "Error:" + ex.Message.Substring(ex.Message.IndexOf(" ", 0), (ex.Message.IndexOf("ORA", 1) - ex.Message.IndexOf(" ", 0))); Label1.Visible = true; Label1.ForeColor = Color.Red; } //RadGrid2.Rebind(); this.BindData_troverview(carr_id); RadGrid2.Rebind(); GetCageIds(); HiddenField1.Value = cages; }
protected void FlangeGridView_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; string SEQ = item.GetDataKeyValue("SEQ").ToString(); string system_no = WebTools.GetExpr("SYSTEM_NO", "FLANGE_SYS_DATA", " SEQ = " + SEQ); string sub_system_no = WebTools.GetExpr("SUB_SYSTEM_NO", "FLANGE_SYS_DATA", " SEQ = " + SEQ); string uniq = system_no + "_" + sub_system_no.Replace("/", "_"); string filename = uniq + ".pdf"; string pdf_url = WebTools.GetExpr("PATH", "DIR_OBJECTS", " PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND DIR_OBJ = 'PIDHC'"); string pdf_asp_url = WebTools.GetExpr("ASP_PATH", "DIR_OBJECTS", " PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND DIR_OBJ = 'PIDHC'"); string full_pdf_path = pdf_url + filename; string full_asp_path = pdf_asp_url + filename; Label pdf_label = (Label)item.FindControl("pdf"); if (File.Exists(full_pdf_path)) { string url = "<a title='Hard Copy PDF' href='" + full_asp_path + "' target='_blank'><img src='../Images/New-Icons/pdf.png'/></a>"; Label pdficon = (Label)item.FindControl("pdf"); if (pdficon != null) { pdficon.Text = url; } } string filename1 = uniq + ".pdf"; string pdf_url1 = WebTools.GetExpr("PATH", "DIR_OBJECTS", " PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND DIR_OBJ = 'PIDMARKUP'"); string pdf_asp_url1 = WebTools.GetExpr("ASP_PATH", "DIR_OBJECTS", " PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND DIR_OBJ = 'PIDMARKUP'"); string full_pdf_path1 = pdf_url1 + filename1; string full_asp_path1 = pdf_asp_url1 + filename1; Label pdf_label1 = (Label)item.FindControl("MPpdf"); if (File.Exists(full_pdf_path1)) { string url = "<a title='Markup Copy PDF' href='" + full_asp_path1 + "' target='_blank'><img src='../Images/New-Icons/pdf.png'/></a>"; Label pdficon = (Label)item.FindControl("MPpdf"); if (pdficon != null) { pdficon.Text = url; } } } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridCommandItem) { GridCommandItem item = (GridCommandItem)e.Item; ImageButton img = (ImageButton)item.FindControl("New"); img.Visible = permiso.Crear; } if (e.Item is GridDataItem) { ImageButton imgb = null; string jCommand = ""; GridDataItem item = (GridDataItem)e.Item; string strKey = item.GetDataKeyValue("ResponsableId").ToString(); // when it returns from form with new record if (Session["NewRecordId"] != null) { if (strKey == Session["NewRecordId"] as String) { item.Selected = true; Session["NewRecordId"] = null; } } // in order to assign the appropiate javascript function to select button imgb = (ImageButton)item.FindControl("Select"); jCommand = String.Format("returnValues3('{0}','{1}','{2}');", strKey, item["Nombre"].Text, "Responsable"); imgb.OnClientClick = jCommand; if (mode == "S") { imgb.Visible = true; } else { imgb.Visible = false; } // assign the appropiate javascript function to edit button imgb = (ImageButton)item.FindControl("Edit"); jCommand = String.Format("editResponsable({0});", strKey); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Ver; // assign to delete button (not needed by now) imgb = (ImageButton)item.FindControl("Delete"); jCommand = String.Format("return radconfirm('{0}',event,300,100,'','{1}');", Resources.ResourceLainsaSci.DeleteRecordQuestion + " " + item["ResponsableId"].Text, Resources.ResourceLainsaSci.DeleteRecord); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Crear; } }
/// <summary> /// Method that retrieves the DataKeyValue related to a RadGrid based on the GridDataItem(Row) selected /// </summary> /// <param name="item">The row selected in the RadGrid for Add/Remove</param> /// <returns></returns> private int GetStudentIDFromGridItem(GridDataItem item) { return Int32.Parse(item.GetDataKeyValue("ID").ToString()); }
private void eliminarDatos(GridDataItem g) { int id_var_dependiente = int.Parse(g.GetDataKeyValue("id_var_dependiente").ToString()); Consulta c = new Consulta(); try { DataTable objDtDatos = c.consultarDetalleGrupoDependencia(0); DataRow[] rows = objDtDatos.Select("id_var_dependiente = " + id_var_dependiente); if (rows.Length > 0) { this.RadWindowManager1.RadAlert("No se puede eliminar el registro, existen detalles de grupos que hacen referencia al registro, " + "Primero debe eliminar los detalles de cruces de campos dependientes", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); return; } RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta(); InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name)); VariableDependiente v = c.consultarVariablesDependientesOBJ(id_var_dependiente); i.IUDvariablesDependientes(v, 4); this.RadWindowManager1.RadAlert("Registro eliminado correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); cargarGrilla(); } catch (Exception ex) { Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex); this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.error_message), null, Utilities.pathImageMessage(TypeMessage.error_message)); } }
//Selects the items down in the hierarchy private void SelectChildTableItems(GridDataItem dataItem) { dataItem.Expanded = ExpandedRows.Contains(dataItem.GetDataKeyValue(dataItem.OwnerTableView.DataKeyNames[0]).ToString()); //If the item is expanded selects the child items if it is not the expanded the items should not be selected if (dataItem.Expanded) { GridTableView nestedTableView = dataItem.ChildItem.NestedTableViews[0]; this.SelectItems(TableViews[nestedTableView.Name], nestedTableView.Items, null); } }
private void adicionarExtension(GridDataItem g) { Consulta c = new Consulta(); Int16 idExtension = Convert.ToInt16(g.GetDataKeyValue("value")); string codArchivo = ViewState["CodArchivo"].ToString(); if (c.consultarExtensionXarchivoOBJ(codArchivo, idExtension) == null) { ExtensionXarchivo e = new ExtensionXarchivo(); RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta(); InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name)); try { e.extension = c.consultarExtensionesOBJ(idExtension); e.archivo = c.consultarArchivoParametrizado(codArchivo); i.IUDextensionXarchivo(e, 2); this.RadWindowManager1.RadAlert("Extension agregada correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); cargarGrilla2(); } catch (Exception ex) { Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex); this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.error_message), null, Utilities.pathImageMessage(TypeMessage.error_message)); } } else { this.RadWindowManager1.RadAlert("La extension ya se encuentra asociada al archivo seleccionado", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); } }
/// <summary> /// Build an item key that will uniquely identify a grid item /// among all the items in the RadGrid hierarchy. Use a combination /// of the OwnerTableView.UniqueID and the set of all data values. /// </summary> protected string BuildItemKey(GridDataItem item) { string[] keyNames = item.OwnerTableView.DataKeyNames; if (keyNames.Length == 0) return item.ItemIndexHierarchical; string returnKey = item.OwnerTableView.UniqueID + "::"; foreach (string keyName in keyNames) { returnKey += item.GetDataKeyValue(keyName).ToString(); if (keyName != keyNames[keyNames.Length - 1]) { returnKey += "::"; } } return returnKey; }
private void guardarDatos(GridDataItem g) { DataRow[] d = this.tablaDatos2.Select("id_var_dependiente = " + g.OwnerTableView.DataKeyValues[g.ItemIndex]["id_var_dependiente"]); if (d.Length == 0) { Consulta c = new Consulta(); RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta(); InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name)); DetalleGrupoDependiente g1 = new DetalleGrupoDependiente(0); try { g1.varDependiente = c.consultarVariablesDependientesOBJ((int)g.OwnerTableView.DataKeyValues[g.ItemIndex]["id_var_dependiente"]); g1.estado = c.consultarEstadoParametrizacionOBJ(Convert.ToInt32(g.GetDataKeyValue("estado_parametrizado"))); int idEncabezado = Request.QueryString["idEncabezado"] != null ? Convert.ToInt32(Request.QueryString["idEncabezado"]) : 0; g1.encabezadoGrupo = c.consultarEncabezadoGruposDependenciasOBJ(idEncabezado); g1.descripcion = "Cruce Automatico"; i.IUDdetGrupoVariableDependiente(g1, 2); this.RadWindowManager1.RadAlert("Datos agregados correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); cargarGrilla2(); } catch(Exception ex) { Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex); this.RadWindowManager1.RadAlert(Utilities.errorMessage(),400,200,Utilities.windowTitle(TypeMessage.error_message), null, Utilities.pathImageMessage(TypeMessage.error_message)); } } else { this.RadWindowManager1.RadAlert("La validación que intenta agrupar ya se encuentra en el grupo.", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); } }
private void adicionarArchivo(GridDataItem g) { Consulta c = new Consulta(); ArchivoDependiente a = c.consultarArchivosDependientesOBJ(this.ddlTipoArchivo.SelectedValue, g.GetDataKeyValue("cod_archivo").ToString()); if (a == null) { try { RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta(); InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name)); a = new ArchivoDependiente(); a.archivo = c.consultarArchivoParametrizado(this.ddlTipoArchivo.SelectedValue); a.archivoDep = c.consultarArchivoParametrizado(g.GetDataKeyValue("cod_archivo").ToString()); i.IUDarchivoDependiente(a, 2); cargarTabla2(); this.RadWindowManager1.RadAlert("Archivo asociado correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); } catch (Exception ex) { Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex); this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.error_message)); } } else { this.RadWindowManager1.RadAlert("El archivo seleccionado ya se encuentra asociado", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); } }
private void eliminarArchivo(GridDataItem g) { Consulta c = new Consulta(); try { ArchivoDependiente a = c.consultarArchivosDependientesOBJ(g.GetDataKeyValue("cod_archivo").ToString(), g.GetDataKeyValue("cod_archivo_dep").ToString()); if (a != null) { RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta c1 = new RipsValidadorDao.ConnectionDB.AutenticationProvider.Consulta(); InsertUpdateDelete i = new InsertUpdateDelete(c1.consultarUsuarioXnombre(User.Identity.Name)); i.IUDarchivoDependiente(a, 4); cargarTabla2(); this.RadWindowManager1.RadAlert("Archivo eliminado correctamente", 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.information_message)); } } catch(Exception ex) { Logger.generarLogError(ex.Message, new System.Diagnostics.StackFrame(true), ex); this.RadWindowManager1.RadAlert(Utilities.errorMessage(), 400, 200, Utilities.windowTitle(TypeMessage.information_message), null, Utilities.pathImageMessage(TypeMessage.error_message)); } }