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 btnDelete_Click(object sender, EventArgs e) { System.Web.UI.WebControls.Button btn = (System.Web.UI.WebControls.Button)sender; GridDataItem item = (GridDataItem)btn.NamingContainer; Label lblstudentcode = (Label)item.FindControl("lblstudentcode"); DataTable dt = _requestHandler.CheckRequestDefenceStudent(lblstudentcode.Text); if (dt != null && dt.Rows.Count > 0) { RadWindowManager1.RadAlert(" این دانشجو دفاع در گردش دارد.", 500, 100, "خطا", ""); } else { //delete _requestHandler.Delete_StudentsAllowDefenceMeetingOnline(lblstudentcode.Text); var userId = Session[sessionNames.userID_Karbar].ToString(); commonBusiness.InsertIntoUserLog(int.Parse(userId), DateTime.Now.ToString("HH:mm") , 11, 224 , "حذف اجازه به دانشجو برای برگزاری دفاع به صورت آنلاین", int.Parse(lblstudentcode.Text)); } RfrhgrdDisplayStundetDefenceOnline(); grdDisplayStundetDefenceOnline.Rebind(); }
protected void RadGridLabTest_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem dataItm = e.Item as GridDataItem; RadGrid radGridArvMutation = (RadGrid)sender; Label lblLabSubTestID = (Label)dataItm.FindControl("lblLabSubTestID"); string id = lblLabSubTestID.Text; DataTable table = (DataTable)ViewState["tblLabtestID"]; table.PrimaryKey = new DataColumn[] { table.Columns["SubTestId"] }; if (table.Rows.Find(id) != null) { DataRow dr = table.Rows.Find(id); dr.Delete(); table.AcceptChanges(); ViewState["tblLabtestID"] = table; radGridArvMutation.DataSource = table; radGridArvMutation.DataBind(); } }
//Setup in-grid links protected void rgApprove_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; int site_id = Convert.ToInt32(item.GetDataKeyValue("site_id")); HyperLink hlSiteNo = (HyperLink)item.FindControl("hlSiteNo"); hlSiteNo.Attributes["target"] = "_blank"; hlSiteNo.Attributes["href"] = String.Format("{0}StationInfo.aspx?site_id={1}", Config.SIMSURL, site_id); } //Set custom column header tooltips if (e.Item is GridHeaderItem) { GridHeaderItem header = (GridHeaderItem)e.Item; header["sitefile_md"].ToolTip = "The date when data in the NWISWeb SITEFILE was last modified."; header["revised_dt"].ToolTip = "The date when an element in the manuscript was last modified."; header["approved_dt"].ToolTip = "The date when the manuscript was last approved."; } }
protected void RadOtherVaccine_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem dataItm = e.Item as GridDataItem; Label lblID = (Label)dataItm.FindControl("lblID"); string Id = lblID.Text; DataTable table = (DataTable)ViewState["TblImmunisation"]; table.PrimaryKey = new DataColumn[] { table.Columns["ID"] }; if (table.Rows.Find(Id) != null) { table.Rows.Find(Id).Delete(); table.AcceptChanges(); ViewState["TblImmunisation"] = table; RadOtherVaccine.DataSource = table; RadOtherVaccine.DataBind(); } else { RadOtherVaccine.DataSource = (DataTable)ViewState["TblImmunisation"]; RadOtherVaccine.DataBind(); } }
protected void btnLiquidar_Click(object sender, ImageClickEventArgs e) { int contadorLiquidar = 0; for (int i = 0; i < RadGrid1.Items.Count; i++) { GridDataItem row = RadGrid1.Items[i]; bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked; if (isChecked) { if (row["Estado"].Text == "<div style='Color:Red;'><a style='Color:Red;text-decoration:none;' href='LiquidarOT.aspx?id=8&va=" + row["OT"].Text + "'>Por Liquidar</a></div>") { contadorLiquidar++; respuesta = des.CambiarEstadoOT(row["OT"].Text, 2); resp = des.CambiarEstadoOT_Local(row["OT"].Text, 2); re = des.Historial_Liquidadas(row["OT"].Text.ToUpper(), row["NombreOT"].Text, row["Cliente"].Text, Convert.ToInt32(row["TirajeTotal"].Text.Replace(".", "")), 2, "", Session["Usuario"].ToString());//no lleva observacion } } } Label7.Text = "Se han Liquidado " + contadorLiquidar.ToString() + " OTs."; RefrescarGrilla(); }
protected void IstIdninImzaileIlgiliBelgeleri_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; EFDal ed = new EFDal(); string path = ed.ImzaliDosyalarIddenPathDon(Convert.ToInt32(item["Id"].Text)); //path ="D:\\Projects\\Kalibrasyon\\sfKalibrasyon\\DosyaSistemi\\2\\2016\\7ea0f3e1-db97-4b34-bc9d-32219a1ad516.pdf"; item["Imzalayan"].Text = ed.SignersInfo(path); if (item["Imzalayan"].Text == "00000000-0000-0000-0000-000000000000" || item["Imzalayan"].Text == " ") { item["Imzalayan"].BackColor = System.Drawing.Color.Gainsboro; item["Imzalayan"].Text = "İmzalanmamış"; } else { item["Imzalayan"].BackColor = System.Drawing.Color.LightYellow; item["Imzalayan"].ForeColor = System.Drawing.Color.Red; } FileInfo f = new FileInfo(path); long fSize = f.Length; Label lblSize = (Label)item.FindControl("lblSize"); lblSize.Text = fSize.ToString(); //using (Service1Client proxy = new Service1Client()) //{ // item["Yukleyen"].Text = proxy.kal_UserIddenUserNameDon(Guid.Parse(item["Yukleyen"].Text)); //} //item["DokumanTipi"].Text = ed.DokumanTipiIddenDokumanAdiDon(Convert.ToInt32(item["DokumanTipi"].Text)); } }
protected void rgcandidate_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; //string CanditateName = (item["candidatename"].Controls[0] as TextBox).Text; LinkButton lnkDelete = (LinkButton)item.FindControl("lnkDelete"); Label lblcandidatename1 = (Label)item.FindControl("lblcandidatename1"); lnkDelete.OnClientClick = "javascript:return confirm('Are you sure, Do you want to delete " + lblcandidatename1.Text + "?');"; } if (e.Item is GridDataItem) { GridDataItem dataitem = (GridDataItem)e.Item; LinkButton lnkViewResume = (LinkButton)dataitem.FindControl("lnkViewResume"); if (lnkViewResume.CommandArgument == "null") { lnkViewResume.Visible = false; } } if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode) && (!e.Item.OwnerTableView.IsItemInserted)) { GridEditableItem edititem = (GridEditableItem)e.Item; edititem["jobid"].Enabled = false; edititem["applieddate"].Enabled = false; edititem["Client"].Enabled = false; edititem["candidatename"].Enabled = false; edititem["specialization"].Enabled = false; edititem["experience"].Enabled = false; RadComboBox rdhrStatus = (RadComboBox)edititem.FindControl("rcbstatus"); rdhrStatus.SelectedValue = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[25].ToString(); RadComboBox rdfinalstatus = (RadComboBox)edititem.FindControl("rcbfinalstatus"); rdfinalstatus.SelectedValue = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[27].ToString(); RadEditor rdnotes = (RadEditor)edititem.FindControl("rcbnotes"); rdnotes.Content = ((System.Data.DataRowView)(edititem.DataItem)).Row.ItemArray[28].ToString(); } }
protected void grdTest_ItemDataBound2(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem griditem = e.Item as GridDataItem; if (!griditem["StatusCode"].Text.Equals("10")) { LinkButton lnk = (LinkButton)griditem.FindControl("lnkbtnStatus"); lnk.Enabled = false; lnk.ForeColor = System.Drawing.Color.Gray; } else { griditem.BackColor = System.Drawing.Color.Aqua; } if (griditem["ImgType"].Text.Equals("Soft Copy")) { griditem.BackColor = System.Drawing.Color.Yellow; } } }
protected void grv_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Logger/Daily_Monthly.aspx")).ToList(); var var1 = list.Where(x => x.ControlId.Contains("grv_Trending_lnkChart")).FirstOrDefault(); if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HyperLink lnkChart = (HyperLink)item.FindControl("lnkChart"); lnkChart.Text = (var1 == null) ? "" : var1.Contents; } CultureInfo culture = new CultureInfo("en-GB"); if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; HyperLink lnkChart = (HyperLink)e.Item.FindControl("lnkChart"); lnkChart.Attributes["href"] = "#"; lnkChart.Attributes["onclick"] = String.Format("return ShowChartFormMonthy('{0}','{1}','{2}','{3}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["SiteId"], DateTime.Parse(dataItem["Time"].Text, culture).ToOADate().ToString().Replace('.', '-'), HttpContext.Current.User.Identity.Name, e.Item.ItemIndex); } }
protected void ToggleRowSelection(object sender, EventArgs e) { ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked; bool checkHeader = true; List <string> lstreportsession = new List <string>(); int ro = ((sender as CheckBox).NamingContainer as GridItem).ItemIndex; GridDataItem item = gvPassTable1.MasterTableView.Items[ro]; foreach (GridDataItem item1 in gvPassTable1.MasterTableView.Items) { if (item == item1) { if ((item.FindControl("CheckBox1") as CheckBox).Checked) { gvPassTable1.Items[ro].Selected = true; ViewState["strCVID"] = item.OwnerTableView.DataKeyValues[ro]["strCVID"]; } } else { (item1.FindControl("CheckBox1") as CheckBox).Checked = false; } } }
protected void gvDiscountCodeUsage_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; int discountCodeUsageId = (int)dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["DiscountCodeUsageId"]; DiscountCodeUsage discountUsage = (from dcu in DataContext.DiscountCodeUsages where dcu.DiscountCodeUsageId == discountCodeUsageId select dcu).FirstOrDefault(); dataItem["StartDate"].Text = Support.FormatDate(discountUsage.CreatedDate); dataItem["EndDate"].Text = Support.FormatDate(discountUsage.EndDate); HyperLink lnkCompanyName = (HyperLink)dataItem.FindControl("lnkCompanyName"); if (lnkCompanyName != null) { lnkCompanyName.Text = Support.TruncateString(discountUsage.Company.CompanyName, 40); lnkCompanyName.ToolTip = discountUsage.Company.CompanyName; lnkCompanyName.NavigateUrl = ResolveUrl("~/Company/CompanyDetails.aspx") + "?CompanyID=" + discountUsage.Company.CompanyId.ToString(CultureInfo.InvariantCulture); } } }
void GrdManejoForestal_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { GridDataItem item = (GridDataItem)e.Item; DataSet ds = ClGestion.Get_Datos_Adicionales_Gestion_Manejo(Convert.ToInt32(item.GetDataKeyValue("GestionId"))); LinkButton LnkDictamenJuridico; LnkDictamenJuridico = (LinkButton)item.FindControl("LnkDictamenJuridico"); LnkDictamenJuridico.Text = ds.Tables["DATOS"].Rows[0]["No_Dictamen"].ToString(); LinkButton DocProvidencia; DocProvidencia = (LinkButton)item.FindControl("LnkProvidencia"); DocProvidencia.Text = ds.Tables["DATOS"].Rows[0]["No_Providencia"].ToString(); LinkButton LnkOficioEnmiendas; LnkOficioEnmiendas = (LinkButton)item.FindControl("LnkOficioEnmiendas"); LnkOficioEnmiendas.Text = ds.Tables["DATOS"].Rows[0]["Oficio_Enmiendas"].ToString(); LinkButton LnkOficioDev; LnkOficioDev = (LinkButton)item.FindControl("LnkOficioDev"); LnkOficioDev.Text = ds.Tables["DATOS"].Rows[0]["Oficio_Dev"].ToString(); LinkButton LnkDictamenTecnico; LnkDictamenTecnico = (LinkButton)item.FindControl("LnkDictamenTecnico"); LnkDictamenTecnico.Text = ds.Tables["DATOS"].Rows[0]["Dic_Tec"].ToString(); LinkButton LnkDictamenSubRegional; LnkDictamenSubRegional = (LinkButton)item.FindControl("LnkDictamenSubRegional"); LnkDictamenSubRegional.Text = ds.Tables["DATOS"].Rows[0]["DictamenSubRegional"].ToString(); LinkButton LnkLicenciaForestal; LnkLicenciaForestal = (LinkButton)item.FindControl("LnkLicenciaForestal"); LnkLicenciaForestal.Text = ds.Tables["DATOS"].Rows[0]["NoLicencia"].ToString(); ds.Clear(); } }
//*** //*** RadGridBoxes_ItemCommand protected void RadGridBoxes_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { try { if (e.CommandName == "PerformInsert") // add { GridDataItem item = e.Item as GridDataItem; string tldh_name = Controller.Clean(((TextBox)item.FindControl("tldh_nameTXT")).Text); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { Dictionary <string, string> fields = new Dictionary <string, string>(); fields.Add("tldh_name", tldh_name); fields.Add("createdBy", Session["user_name"].ToString()); con.Open(); Controller.InsertInto(cmd, con, "CNRS_TLDHeader", fields, false); } } } if (e.CommandName == "Update") //edit { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; int tldh_id = (int)item.GetDataKeyValue("tldh_id"); string tldh_name = Controller.Clean(((TextBox)item.FindControl("tldh_nameTXT")).Text); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { Dictionary <string, string> fields = new Dictionary <string, string>(); fields.Add("tldh_name", tldh_name); fields.Add("modifedBy", Session["user_name"].ToString()); fields.Add("modifiedOn", DateTime.Now.ToString()); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("tldh_id", tldh_id.ToString()); con.Open(); Controller.Update(cmd, con, "CNRS_TLDHeader", fields, conditions); AlertJS(); } } } } else if (e.CommandName == "Delete") // inactivate { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; int tldh_id = (int)item.GetDataKeyValue("tldh_id"); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { con.Open(); Controller.Inactivate(cmd, con, "CNRS_TLDHeader", "tldh_id", tldh_id.ToString(), Session["user_name"].ToString()); AlertJS(); } } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
protected void gvDiscountCodes_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.EditItem) { GridDataItem dataItem = (GridDataItem)e.Item; int discountCodeID = (int)dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["DiscountCode.DiscountCodeID"]; DiscountCode discountCode = (from dc in DataContext.DiscountCodes where dc.DiscountCodeID == discountCodeID select dc).FirstOrDefault(); int discountCodeUsageCount = discountCode.DiscountCodeUsages.Count; RadNumericTextBox txtInstanceCount = (RadNumericTextBox)dataItem.FindControl("txtInstanceCount"); txtInstanceCount.Text = discountCode.InstanceCount.ToString(); TextBox txtDiscountCode = (TextBox)dataItem.FindControl("txtDiscountCode"); RadNumericTextBox txtDiscountPercentage = (RadNumericTextBox)dataItem.FindControl("txtDiscountPercentage"); RadNumericTextBox txtDuration = (RadNumericTextBox)dataItem.FindControl("txtDuration"); RadDatePicker dtExpireDate = (RadDatePicker)dataItem.FindControl("dtExpireDate"); Literal litCreatedDate = (Literal)dataItem.FindControl("litCreatedDate"); //There are two edit modes. When there is no usage and if there are usage. if (discountCodeUsageCount == 0) { //means you can edit all the fields. txtDiscountPercentage.Value = (double)discountCode.Discount; txtDiscountCode.Text = discountCode.Code; txtDuration.Value = discountCode.Duration; dtExpireDate.SelectedDate = discountCode.ExpireDate; dtExpireDate.SelectedDate = discountCode.ExpireDate; litCreatedDate.Text = Support.FormatDate(discountCode.CreatedDate); //For expired discounts the min date has to be the expired Date. if (dtExpireDate.SelectedDate < Today) { dtExpireDate.MinDate = dtExpireDate.SelectedDate.Value; } else { dtExpireDate.MinDate = Today; } } else { //Needs to disable unnecessary validation controls since it is in edit mode. RegularExpressionValidator regExMinLengthEdit = (RegularExpressionValidator)dataItem.FindControl("regExMinLengthEdit"); regExMinLengthEdit.Enabled = false; RequiredFieldValidator rqdCodeEditMode = (RequiredFieldValidator)dataItem.FindControl("rqdCodeEditMode"); rqdCodeEditMode.Enabled = false; RequiredFieldValidator rqdDiscountEdit = (RequiredFieldValidator)dataItem.FindControl("rqdDiscountEdit"); rqdDiscountEdit.Enabled = false; RequiredFieldValidator rqdDurationEdit = (RequiredFieldValidator)dataItem.FindControl("rqdDurationEdit"); rqdDurationEdit.Enabled = false; RequiredFieldValidator rqdExpireEdit = (RequiredFieldValidator)dataItem.FindControl("rqdExpireEdit"); rqdExpireEdit.Enabled = false; RequiredFieldValidator rqdInstanceCountEdit = (RequiredFieldValidator)dataItem.FindControl("rqdInstanceCountEdit"); rqdInstanceCountEdit.Enabled = false; //means you can edit only Instance count. txtDiscountCode.Visible = false; txtDiscountPercentage.Visible = false; txtDiscountPercentage.Visible = false; txtDuration.Visible = false; dtExpireDate.Visible = false; //Only shows these fields in read only mode. Label litDiscountCode = (Label)dataItem.FindControl("litDiscountCode"); Literal litExpireDate = (Literal)dataItem.FindControl("litExpireDate"); Literal litDuration = (Literal)dataItem.FindControl("litDuration"); Literal litDiscountPercentage = (Literal)dataItem.FindControl("litDiscountPercentage"); litDiscountCode.Text = Support.TruncateString(discountCode.Code, 15); if (discountCode.Code.Length >= 15) { litDiscountCode.ToolTip = discountCode.Code; } litDiscountCode.Visible = true; litExpireDate.Text = Support.FormatDate(discountCode.ExpireDate); litExpireDate.Visible = true; litCreatedDate.Text = Support.FormatDate(discountCode.CreatedDate); litDuration.Text = discountCode.Duration.ToString() + (discountCode.Duration == 1 ? " week" : " weeks"); litDuration.Visible = true; litDiscountPercentage.Text = (discountCode.Discount / 100).ToString("#0.##%", CultureInfo.InvariantCulture); litDiscountPercentage.Visible = true; } } else if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; DiscountCode discountCode = ((dynamic)dataItem.DataItem).DiscountCode; int discountCodeUsageCount = ((dynamic)dataItem.DataItem).UsageCount; dataItem["DeleteColumn"].Controls[0].Visible = discountCodeUsageCount == 0; if (discountCodeUsageCount > 0) { LinkButton lnkDiscountCode = (LinkButton)dataItem.FindControl("lnkDiscountCode"); lnkDiscountCode.Text = Support.TruncateString(discountCode.Code, 15); if (discountCode.Code.Length >= 15) { lnkDiscountCode.ToolTip = discountCode.Code; } lnkDiscountCode.Visible = true; } else { Label litDiscountCode = (Label)dataItem.FindControl("litDiscountCode"); litDiscountCode.Text = Support.TruncateString(discountCode.Code, 15); if (discountCode.Code.Length >= 15) { litDiscountCode.ToolTip = discountCode.Code; } litDiscountCode.Visible = true; } dataItem["Duration"].Text = discountCode.Duration.ToString() + (discountCode.Duration == 1 ? " week" : " weeks"); dataItem["InstanceCount"].Text = discountCode.InstanceCount.ToString() + (discountCodeUsageCount > 0 ? (" (" + discountCodeUsageCount + " used)") : string.Empty); dataItem["Discount"].Text = (discountCode.Discount / 100).ToString("#0.##%", CultureInfo.InvariantCulture); dataItem["ExpireDate"].Text = Support.FormatDate(discountCode.ExpireDate); dataItem["CreatedDate"].Text = Support.FormatDate(discountCode.CreatedDate); } }
protected void ibMultiCheck_Click(object sender, ImageClickEventArgs e) { int contadorInsert = 0; if (TabContainer1.ActiveTabIndex == 0) { List <Activar> list = new List <Activar>(); StringBuilder str = new StringBuilder(); for (int i = 0; i < RadGrid1.Items.Count; i++) { GridDataItem row = RadGrid1.Items[i]; bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked; if (isChecked) { contadorInsert++; Activar asi = new Activar(); asi.Usuario = row["Usuario"].Text; asi.Estado = 1; list.Add(asi); } } //contador string contadorIns = contadorInsert.ToString(); //llamada procedimiento cUsu.usuarioInactivos(list); ////carga de gridviews cargarInactivos(); //mensaje string popupScript = "<script language='JavaScript'> alert(' ¡Se han Activado " + contadorIns.ToString() + " Cuenta(s) de Usuario ! ');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else if (TabContainer1.ActiveTabIndex == 1) { List <Activar> list2 = new List <Activar>(); StringBuilder str = new StringBuilder(); for (int i = 0; i < RadGrid2.Items.Count; i++) { GridDataItem row = RadGrid2.Items[i]; bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked; if (isChecked) { contadorInsert++; Activar asi = new Activar(); asi.Usuario = row["Usuario"].Text; asi.Estado = 1; list2.Add(asi); } } //contador string contadorIns = contadorInsert.ToString(); //llamada procedimiento cUsu.usuarioDeshabilitados(list2); //////carga de gridviews cargarInactivos(); cargarDeshabilitados(); //mensaje string popupScript = "<script language='JavaScript'> alert(' ¡Se han Habilitado " + contadorIns.ToString() + " Cuenta(s) de Usuario ! ');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } }
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { if (e.CommandName == "phew") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("phew"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO PhewAlbums (UID , AID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewAlbums WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "unphew(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unphew"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO PhewPhotos (UID , PID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewPhotos WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "unphew(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unphew"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM Phew WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "unphew(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unphew"; // return "usual comment" + dRView["P"].ToString(); } // int itemid = int.Parse(k.Text); /* int z = int.Parse(Session["UserID"].ToString()); * string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + itemid + ")"; * dbClass.DataBase(iphew); * * LinkButton lk = (LinkButton)dataItem.FindControl("phew"); * * //How Much.. * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "unphew";*/ } else if (e.CommandName == "unphew") { // DELETE FROM Persons //WHERE LastName='Tjessem' AND FirstName='Jakob' GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("phew"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM PhewAlbums WHERE UID = " + z + " AND AID = " + detid + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewAlbums WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "phew it!(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "phew"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM PhewPhotos WHERE UID = " + z + " AND PID = " + detid + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewPhotos WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "phew it!(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "phew"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "DELETE FROM Phew WHERE UID = " + z + " AND NID = " + detid + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM Phew WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "phew it!(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "phew"; // r } /*int itemid = int.Parse(k.Text); * int X = int.Parse(Session["UserId"].ToString()); * string unphewup = "DELETE FROM Phew WHERE NID = " + itemid + " AND UID = " + X + ""; * dbClass.DataBase(unphewup); * * LinkButton lk = (LinkButton)dataItem.FindControl("phew"); * //How Much * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "phew"; * */ } else if (e.CommandName == "like") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("like"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO [LikeAlbums] (UID , AID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikeAlbums] WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "unlike(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unlike"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO [LikePhotos] (UID , PID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikePhotos] WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "unlike(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unlike"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [Like] WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "unlike(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unlike"; // r } /*int itemid = int.Parse(k.Text); * * int z = int.Parse(Session["UserID"].ToString()); * string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + itemid + ")"; * dbClass.DataBase(iphew); * * LinkButton lk = (LinkButton)dataItem.FindControl("like"); * * //How Much.. * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM [Like] WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Unlike(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "unlike";*/ } else if (e.CommandName == "unlike") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("like"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM [LikeAlbums] WHERE AID = " + detid + " AND UID = " + z + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikeAlbums] WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "like(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "like"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM [LikePhotos] WHERE PID = " + detid + " AND UID = " + z + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikePhotos] WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "like(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "like"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "DELETE FROM [Like] WHERE NID = " + detid + " AND UID = " + z + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [Like] WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "like(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "like"; // r } if (e.CommandName == "Sort" || e.CommandName == "Page") { RadToolTipManager1.TargetControls.Clear(); } } }
//*** //*** RadGridBoxes_ItemCommand protected void RadGridBoxes_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { try { CheckSession(); if (e.CommandName == "PerformInsert") // add { GridDataItem item = e.Item as GridDataItem; string po_id = ""; //string po_number = Controller.Clean(((TextBox)item.FindControl("po_numberTXT")).Text); //string official_number = Controller.Clean(((TextBox)item.FindControl("official_numberTXT")).Text); RadDatePicker add_po_dateRDP = ((RadDatePicker)item.FindControl("po_dateRDPTXT")); string item_id = ((RadComboBox)item.FindControl("item_idRCB")).SelectedValue; //string po_address = ((TextBox)item.FindControl("po_addressTXT")).Text; //string po_contactPerson = Controller.Clean(((TextBox)item.FindControl("po_contactPersonTXT")).Text); string po_date = add_po_dateRDP.SelectedDate.ToString(); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { Dictionary <string, string> fields = new Dictionary <string, string>(); // fields.Add("po_number", po_number); //fields.Add("official_number", official_number); fields.Add("item_id", item_id); fields.Add("po_date", po_date); //fields.Add("po_address", po_address); fields.Add("user_name", Session["user_name"].ToString()); fields.Add("createdBy", Session["user_name"].ToString()); con.Open(); po_id = Controller.InsertInto(cmd, con, "CNRS_PurchaseOrder", fields, true); } } RadGridBoxes.MasterTableView.IsItemInserted = false; if (po_id != "") { NavigateNextStep(item_id, po_id, 0); } } if (e.CommandName == "Update") //edit { if (e.Item is GridDataItem) { string role_id = getRoleID(); GridDataItem item = e.Item as GridDataItem; string po_id = item.GetDataKeyValue("po_id").ToString(); string po_number = Controller.Clean(((TextBox)item.FindControl("po_numberTXT")).Text); string official_number = Controller.Clean(((TextBox)item.FindControl("official_numberTXT")).Text); RadDatePicker po_dateRDP = ((RadDatePicker)item.FindControl("po_dateRDPTXT")); //string po_contactPerson = Controller.Clean(((TextBox)item.FindControl("po_contactPersonTXT")).Text); //string po_address = ((TextBox)item.FindControl("po_addressTXT")).Text; string po_date = po_dateRDP.SelectedDate.ToString(); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { Dictionary <string, string> fields = new Dictionary <string, string>(); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("po_id", po_id); con.Open(); if (role_id == "3") // Secretary { fields.Add("official_number", official_number); //fields.Add("po_date_secretary", DateTime.Now.ToString()); Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions); return; } else if (role_id == "5") // Head of Department { fields.Add("po_number", po_number); fields.Add("po_date_headOfDepartment", DateTime.Now.ToString()); Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions); return; } fields.Clear(); if (role_id == "1") { fields.Add("po_number", po_number); fields.Add("official_number", official_number); } fields.Add("po_date", po_date); fields.Add("user_name", Session["user_name"].ToString()); fields.Add("modifedBy", Session["user_name"].ToString()); fields.Add("modifiedOn", DateTime.Now.ToString()); //fields.Add("po_address", po_address); //fields.Add("po_contactPerson", Session["user_name"].ToString()); Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions); AlertJS(); } } } } else if (e.CommandName == "Delete") // inactivate { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; Label item_idLBL = (Label)item.FindControl("item_idLBL"); string item_id = item_idLBL.Text; int po_id = (int)item.GetDataKeyValue("po_id"); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { con.Open(); Controller.Inactivate(cmd, con, "CNRS_PurchaseOrder", "po_id", po_id.ToString(), Session["user_name"].ToString()); Dictionary <string, string> fields = new Dictionary <string, string>(); fields.Add("active", false.ToString()); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("po_id", po_id.ToString()); if (item_id == "1") //TLD { Controller.Update(cmd, con, "CNRS_TLDDetails", fields, conditions); } else if (item_id == "2") //SSDL { Controller.Update(cmd, con, "CNRS_SSDLServiceFees", fields, conditions); } AlertJS(); } } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
//*** //*** RadGridBoxes_ItemCreated protected void RadGridBoxes_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { string role_id = getRoleID(); CheckSession(); if (e.Item is GridEditableItem && e.Item.IsInEditMode) { RadGridBoxes.MasterTableView.GetColumn("nextStep").Display = false; RadGridBoxes.MasterTableView.GetColumn("Print").Display = false; GridEditableItem item = (GridEditableItem)e.Item; RadComboBox item_idRCB = (RadComboBox)item.FindControl("item_idRCB"); RequiredFieldValidator item_idRFV = (RequiredFieldValidator)item.FindControl("item_idRFV"); Label item_idLBL1 = (Label)item.FindControl("item_idLBL1"); Label startLBL = (Label)item.FindControl("startLBL"); if (e.Item is GridEditFormInsertItem || e.Item is GridDataInsertItem) { // insert item item_idRCB.Visible = true; item_idRFV.Enabled = true; item_idLBL1.Visible = false; startLBL.Visible = false; ArrayList fields = new ArrayList(); fields.Add("item_id"); fields.Add("item_name"); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("active", "true"); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { con.Open(); item_idRCB.DataSource = Controller.SelectFrom(cmd, con, "CNRS_Item", fields, conditions, new ArrayList(), false, false, ""); } } } else { // edit item GridEditableItem editItem = (GridEditableItem)e.Item; RadDatePicker edit_po_dateRDP = ((RadDatePicker)editItem.FindControl("po_dateRDPTXT")); item_idRCB.Visible = false; item_idRFV.Enabled = false; item_idLBL1.Visible = true; startLBL.Visible = true; if (role_id != "1" && role_id != "2") // != admin and != client { edit_po_dateRDP.Enabled = false; } else { edit_po_dateRDP.Enabled = true; } } //RadDatePicker po_dateRDP = (RadDatePicker)item.FindControl("po_dateRDP"); //po_dateRDP.SelectedDate = DateTime.Now; } if (e.Item is GridDataItem) { if (role_id == "6") // Technical Officer { GridDataItem ditem = (GridDataItem)e.Item; Label po_date_end_technicalOfficerLBL = (Label)ditem.FindControl("po_date_end_technicalOfficerLBL"); CheckBox po_date_end_technicalOfficerRCB = (CheckBox)ditem.FindControl("po_date_end_technicalOfficerRCB"); if (po_date_end_technicalOfficerLBL.Text != "") { po_date_end_technicalOfficerLBL.Visible = true; po_date_end_technicalOfficerRCB.Visible = false; } else { po_date_end_technicalOfficerLBL.Visible = false; po_date_end_technicalOfficerRCB.Visible = true; } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
//*** protected void RadGridBoxes_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { string role_id = getRoleID(); if (!(e.Item is GridDataInsertItem) || !(e.Item is GridEditableItem)) { if (e.Item is GridDataItem) { GridDataItem ditem = (GridDataItem)e.Item; Label po_sendItLBL = (Label)ditem.FindControl("po_sendItLBL"); ImageButton EditCommandColumn = (ImageButton)ditem["EditCommandColumn"].Controls[0]; ImageButton DeleteCommandColumn = (ImageButton)ditem["delete"].Controls[0]; if (role_id == "2") { if (po_sendItLBL.Text.Equals("True")) { EditCommandColumn.Visible = false; DeleteCommandColumn.Visible = false; } else { EditCommandColumn.Visible = true; DeleteCommandColumn.Visible = true; } } if (role_id == "1") { Label po_isnewforAdmin = (Label)ditem.FindControl("po_isnewforAdmin"); if (Boolean.Parse(po_isnewforAdmin.Text) == true) { ditem.BackColor = System.Drawing.ColorTranslator.FromHtml("#4F52BA"); ditem.ForeColor = Color.White; } } if (role_id == "3") { Label po_isnewforSectretary = (Label)ditem.FindControl("po_isnewforSectretary"); if (Boolean.Parse(po_isnewforSectretary.Text) == true) { ditem.BackColor = System.Drawing.ColorTranslator.FromHtml("#4F52BA"); ditem.ForeColor = Color.White; } } if (role_id == "4") { Label po_isnewforDirector = (Label)ditem.FindControl("po_isnewforDirector"); if (Boolean.Parse(po_isnewforDirector.Text) == true) { ditem.BackColor = System.Drawing.ColorTranslator.FromHtml("#4F52BA"); ditem.ForeColor = Color.White; } } if (role_id == "5") { Label po_isnewforHOD = (Label)ditem.FindControl("po_isnewforHOD"); if (Boolean.Parse(po_isnewforHOD.Text) == true) { ditem.BackColor = System.Drawing.ColorTranslator.FromHtml("#4F52BA"); ditem.ForeColor = Color.White; } } if (role_id == "6") // Technical Officer { Label po_isnewforTechmical = (Label)ditem.FindControl("po_isnewforTechmical"); if (Boolean.Parse(po_isnewforTechmical.Text) == true) { ditem.BackColor = System.Drawing.ColorTranslator.FromHtml("#4F52BA"); ditem.ForeColor = Color.White; } Label po_date_end_technicalOfficerLBL = (Label)ditem.FindControl("po_date_end_technicalOfficerLBL"); CheckBox po_date_end_technicalOfficerRCB = (CheckBox)ditem.FindControl("po_date_end_technicalOfficerRCB"); if (po_date_end_technicalOfficerLBL.Text != "") { po_date_end_technicalOfficerLBL.Visible = true; po_date_end_technicalOfficerRCB.Visible = false; } else { po_date_end_technicalOfficerLBL.Visible = false; po_date_end_technicalOfficerRCB.Visible = true; } } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
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 (dispositivo != null) { img.OnClientClick = String.Format("newAccesorioFromDispositivo('{0}');", dispositivo.DispositivoId); } if (mode.Equals("S")) { img = (ImageButton)item.FindControl("Exit"); img.Visible = false; } } if (e.Item is GridDataItem) { ImageButton imgb = null; string jCommand = ""; GridDataItem item = (GridDataItem)e.Item; string strKey = item.GetDataKeyValue("AccesorioId").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; } } imgb = (ImageButton)item.FindControl("Select"); jCommand = String.Format("returnValues2('{0}','{1}');", strKey, item["Descripcion"].Text); imgb.OnClientClick = jCommand; if (caller == "AccesorioAsignadoForm") { imgb.Visible = true; } // assign the appropiate javascript function to edit button imgb = (ImageButton)item.FindControl("Edit"); if (mode == "S") { imgb.Visible = false; } else { jCommand = String.Format("editAccesorio({0});", strKey); if (dispositivo != null) { jCommand = String.Format("editAccesorioFromDispositivo({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.ResourceDosimetria.DeleteRecordQuestion + " " + item["Descripcion"].Text, Resources.ResourceDosimetria.DeleteRecord); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Crear; } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridCommandItem) { GridCommandItem item = (GridCommandItem)e.Item; ImageButton imgb = (ImageButton)item.FindControl("New"); string jCommand = ""; if (empresa != null) { jCommand = String.Format("newDireccion('Empresa', {0}, '{1}')", empresa.EmpresaId, caller); } if (instalacion != null) { jCommand = String.Format("newDireccion('Instalacion', {0}, '{1}')", instalacion.InstalacionId, caller); } imgb.OnClientClick = jCommand; //imgb.Visible = permiso.Crear; } if (e.Item is GridDataItem) { ImageButton imgb = null; string jCommand = ""; GridDataItem item = (GridDataItem)e.Item; string strKey = item.GetDataKeyValue("DireccionId").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("returnValues2('{0}','{1}');", strKey, item["DirPostal"].Text); 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("editDireccion('{0}','{1}');", strKey, caller); 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["DirPostal"].Text, Resources.ResourceLainsaSci.DeleteRecord); imgb.OnClientClick = jCommand; //imgb.Visible = permiso.Crear; } }
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 (revision != null) { img.OnClientClick = String.Format("newSustitucionRevision({0});", revision.RevisionId); img.Visible = false; // no tengo claro si merece o no tratamiento. } } if (e.Item is GridDataItem) { ImageButton imgb = null; string jCommand = ""; GridDataItem item = (GridDataItem)e.Item; string strKey = item.GetDataKeyValue("SustitucionId").ToString(); if (CntLainsaSci.FechaNula(DateTime.Parse(item["Fecha"].Text))) { item["Fecha"].Text = ""; } // 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["Fecha"].Text, "Sustitucion"); 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("editSustitucion({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["SustitucionId"].Text, Resources.ResourceLainsaSci.DeleteRecord); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Crear; } }
/// <summary> /// Description: If by voyage is selected , for all vessels voyage ddl wil populate based on search date /// </summary> protected void ddlVoyage_SelectedIndexChanged(object sender, EventArgs e) { try { DateTime Startdate; Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text)); //Startdate= Convert.ToDateTime(txtStartDate.Text); DateTime EndDate; EndDate = Convert.ToDateTime(UDFLib.ConvertToDate(txtEndDate.Text)); //EndDate = Convert.ToDateTime(txtEndDate.Text); int KPI_ID = 1; DropDownList ddlVoyage = (DropDownList)sender; GridDataItem item = (GridDataItem)ddlVoyage.NamingContainer; Label avg = (Label)item.FindControl("Vessel_Average"); HiddenField hdf = (HiddenField)item.FindControl("hdVesselID"); LinkButton lnkVessel = (LinkButton)item.FindControl("Item_Name"); item["Average"].BackColor = System.Drawing.Color.White; avg.Text = "0"; if (ddlVoyage.SelectedIndex != 0) { string val = ddlVoyage.SelectedValue.Trim().Split(':')[0] + ":" + ddlVoyage.SelectedValue.Trim().Split(':')[1]; DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(hdf.Value)).Tables[0]; if (dtq.Rows[0][0].ToString() != "") { Startdate = Convert.ToDateTime(dtq.Rows[0][1].ToString()); // hiddenVesselStartDate.Value = dtq.Rows[0][0].ToString(); // hiddenStartDate.Text = dtq.Rows[0][0].ToString(); hiddenStartDate.Value = Startdate.ToString("dd-MM-yyyy"); } if (dtq.Rows[dtq.Rows.Count - 1][0].ToString() != "") { EndDate = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1][1].ToString()); //hiddenVesselEndDate.Value = dtq.Rows[dtq.Rows.Count - 1][0].ToString(); //hiddenEndDate.Text = dtq.Rows[dtq.Rows.Count - 1][0].ToString(); hiddenEndDate.Value = EndDate.ToString("dd-MM-yyyy"); } } DataTable dt = BLL_TMSA_PI.GetVoyageData(ddlVoyage.SelectedValue.Trim(), Convert.ToInt32(hdf.Value), KPI_ID).Tables[0]; if (dt.Rows.Count > 0) { avg.Text = Math.Round(Convert.ToDouble(dt.Rows[0]["Value"].ToString()), 2).ToString(); if (Convert.ToDouble(avg.Text) == 0) { lnkVessel.Enabled = false; item["Vessel"].BackColor = System.Drawing.Color.White; } else { lnkVessel.Enabled = true; } } else { lnkVessel.Enabled = false; item["Vessel"].BackColor = System.Drawing.Color.White; } Label Vessel_Goal = (Label)item.FindControl("Vessel_Goal"); Label eedi = (Label)item.FindControl("eedi"); if (Convert.ToDouble(avg.Text) > 0 && Convert.ToDouble(eedi.Text) > 0) { if ((Convert.ToDouble(avg.Text) < Convert.ToDouble(Vessel_Goal.Text))) { item["Average"].BackColor = System.Drawing.Color.White; } if (Convert.ToDouble(avg.Text) > Convert.ToDouble(eedi.Text)) { item["Average"].BackColor = System.Drawing.ColorTranslator.FromHtml("#FFC7CE"); } else if ((Convert.ToDouble(avg.Text) > Convert.ToDouble(Vessel_Goal.Text)) && (Convert.ToDouble(avg.Text) < Convert.ToDouble(eedi.Text))) { item["Average"].BackColor = System.Drawing.ColorTranslator.FromHtml("#FABF8F"); } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void btnGuardar_Click(object sender, EventArgs e) { List <Prod_Terminados> list = new List <Prod_Terminados>(); Prod_Terminados asi = new Prod_Terminados(); int contadorMala = 0; if (txtCodigo.Text != "") { for (int i = 0; i < RadGrid1.Items.Count; i++) { GridDataItem row = RadGrid1.Items[i]; bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked; //if (isChecked) //{ bool resp; string id = row["id_ProductosTerminados"].Text; string estado = row["Estado"].Text; if (estado == "<div style='Color:Green;'>Aprobado</div>") { //cambiar a estado 4 // resp = cPT.CerrarPaso3(Convert.ToInt32(row["id_ProductosTerminados"].Text), Session["Usuario"].ToString(), 8); //hacer la diferencia y generar correo if (cPT.CorreoPrimerDespacho(row["OT"].Text.Trim(), "cjerias", 0) == false) { //generar correo bool rrr = cPT.CorreoPrimerDespacho(row["OT"].Text.Trim(), "cjerias", 1); generarCorreo(row["OT"].Text.Trim(), cPT.CargarPalletsCorreo(txtCodigo.Text.Trim(), row["OT"].Text.Trim(), 2), row["NombreOT"].Text); } } else if (estado == "<div style='Color:Blue;'>Pendiente</div>") { contadorMala = contadorMala + 1; //cambia a estado 5 // resp = cPT.CerrarPaso3(Convert.ToInt32(row["id_ProductosTerminados"].Text), Session["Usuario"].ToString(), 6); } else if (estado == "<div style='Color:Red;'>Rechazado</div>") { // contadorMala = contadorMala + 1; //cambia a estado 5 // resp = cPT.CerrarPaso3(Convert.ToInt32(row["id_ProductosTerminados"].Text), Session["Usuario"].ToString(), 6); } //} } if (contadorMala == 0) { for (int i = 0; i < RadGrid1.Items.Count; i++) { GridDataItem row = RadGrid1.Items[i]; bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked; //if (isChecked) //{ bool resp; string id = row["id_ProductosTerminados"].Text; string estado = row["Estado"].Text; if (estado == "<div style='Color:Green;'>Aprobado</div>") { //cambiar a estado 4 resp = cPT.CerrarPaso3(Convert.ToInt32(row["id_ProductosTerminados"].Text), Session["Usuario"].ToString(), 8); } else if (estado == "<div style='Color:Blue;'>Pendiente</div>") { contadorMala = contadorMala + 1; //cambia a estado 5 resp = cPT.CerrarPaso3(Convert.ToInt32(row["id_ProductosTerminados"].Text), Session["Usuario"].ToString(), 6); } else if (estado == "<div style='Color:Red;'>Rechazado</div>") { // contadorMala = contadorMala + 1; //cambia a estado 5 resp = cPT.CerrarPaso3(Convert.ToInt32(row["id_ProductosTerminados"].Text), Session["Usuario"].ToString(), 6); } //} } DivMensaje.Visible = true; imgMensaje.ImageUrl = "../../Images/tick.png"; lblMensaje.Text = "Registros Guardados Correctamente."; lblMensaje.ForeColor = Color.White; DivMensaje.Attributes.Add("style", "background-color:Green"); //cg RadGrid1.DataSource = cPT.BuscaPalletCerrado(txtCodigo.Text); RadGrid1.DataBind(); txtCodigo.Text = ""; } else { DivMensaje.Visible = true; imgMensaje.ImageUrl = "../../Images/cross.png"; lblMensaje.Text = "Debe Asignar Estado a las Guias!"; lblMensaje.ForeColor = Color.White; DivMensaje.Attributes.Add("style", "background-color:Red"); //cg RadGrid1.DataSource = cPT.BuscaPalletRecepcion(txtCodigo.Text); RadGrid1.DataBind(); } } else { //mal } }
protected void RadGridLabOrder_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; Telerik.Web.UI.RadButton btnReportResults = (Telerik.Web.UI.RadButton)item.FindControl("btnReportResults"); btnReportResults.NavigateUrl = "frmLabOrderTouchResults.aspx?patientId=" + Request.QueryString["PatientID"].ToString(); } }
protected void RadGrid1_ItemCommand1(object sender, GridCommandEventArgs e) { if (e.CommandName == "displaycomments") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); string wtf = k.Text; RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text; DataTable dt = new DataTable(); thecbox.Visible = true; if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string getcomments = @"SELECT [User].Name, [User].ID, AlbumComments.ID AS CID, AlbumComments.Comment, AlbumComments.AID, AlbumComments.UID, Propic.Image, Propic.[Current] FROM [User] INNER JOIN AlbumComments ON [User].ID = AlbumComments.UID INNER JOIN Propic ON AlbumComments.UID = Propic.UID WHERE (AlbumComments.AID = " + detid + @") AND (Propic.[Current] = 1) ORDER BY CID"; dt = dbClass.ReturnDT(getcomments); if (dt.Rows.Count == 0) { RadGrid2.Visible = false; RadTextBox1.EmptyMessage = "Be the 1st to comment"; } else { RadGrid2.DataSource = dt; RadGrid2.DataBind(); } } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string getcomments = @"SELECT [User].Name, [User].ID, PhotoComments.ID AS CID, PhotoComments.Comment, PhotoComments.PID, PhotoComments.UID, Propic.Image, Propic.[Current] FROM [User] INNER JOIN PhotoComments ON [User].ID = PhotoComments.UID INNER JOIN Propic ON PhotoComments.UID = Propic.UID WHERE (Propic.[Current] = 1) AND (PhotoComments.PID = " + detid + @") ORDER BY CID"; dt = dbClass.ReturnDT(getcomments); if (dt.Rows.Count == 0) { RadGrid2.Visible = false; RadTextBox1.EmptyMessage = "Be the 1st to comment"; } else { RadGrid2.DataSource = dt; RadGrid2.DataBind(); } } else { int detid = int.Parse(wtf.Substring(7)); string getcomments = @"SELECT [User].Name, [User].ID, Comments.ID AS CID, Comments.Comment, Comments.ItemID, Comments.UID, Propic.Image, Propic.[Current] FROM [User] INNER JOIN Comments ON [User].ID = Comments.UID INNER JOIN Propic ON Comments.UID = Propic.UID WHERE (Comments.ItemID = " + detid + @") AND (Propic.[Current] = 1) ORDER BY CID"; dt = dbClass.ReturnDT(getcomments); if (dt.Rows.Count == 0) { RadGrid2.Visible = false; RadTextBox1.EmptyMessage = "Be the 1st to comment"; } else { RadTextBox1.EmptyMessage = "Click to comment on the post.."; RadGrid2.Visible = true; RadGrid2.DataSource = dt; RadGrid2.DataBind(); } } /*int itemid = int.Parse(k.Text); * * DataTable dt = new DataTable(); * string getc = @"SELECT [User].Name, [User].ID, Comments.ID AS CID, Comments.Comment, Comments.ItemID, Comments.UID, Propic.Image, Propic.[Current] * FROM [User] INNER JOIN * Comments ON [User].ID = Comments.UID INNER JOIN * Propic ON Comments.UID = Propic.UID * WHERE (Comments.ItemID = " + itemid + @") AND (Propic.[Current] = 1) * ORDER BY CID"; * dt = dbClass.ReturnDT(getc); * * if (dt.Rows.Count == 0) * { * RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text; * } * else * { * RadGrid2.Columns.FindByUniqueName("loadit").FooterText = k.Text; * RadGrid2.DataSource = dt; * RadGrid2.DataBind(); * } * * ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>fleXenv.updateScrollBars();</script>", false); */ } else if (e.CommandName == "phew") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("phew"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO PhewAlbums (UID , AID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewAlbums WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unphew"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO PhewPhotos (UID , PID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewPhotos WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unphew"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM Phew WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unphew"; // return "usual comment" + dRView["P"].ToString(); } // int itemid = int.Parse(k.Text); /* int z = int.Parse(Session["UserID"].ToString()); * string iphew = "INSERT INTO Phew (UID , NID)VALUES (" + z + "," + itemid + ")"; * dbClass.DataBase(iphew); * * LinkButton lk = (LinkButton)dataItem.FindControl("phew"); * * //How Much.. * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Unphew(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "unphew";*/ } else if (e.CommandName == "unphew") { // DELETE FROM Persons //WHERE LastName='Tjessem' AND FirstName='Jakob' GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("phew"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM PhewAlbums WHERE UID = " + z + " AND AID = " + detid + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewAlbums WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "phew"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM PhewPhotos WHERE UID = " + z + " AND PID = " + detid + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM PhewPhotos WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "phew"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "DELETE FROM Phew WHERE UID = " + z + " AND NID = " + detid + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM Phew WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "phew"; // r } /*int itemid = int.Parse(k.Text); * int X = int.Parse(Session["UserId"].ToString()); * string unphewup = "DELETE FROM Phew WHERE NID = " + itemid + " AND UID = " + X + ""; * dbClass.DataBase(unphewup); * * LinkButton lk = (LinkButton)dataItem.FindControl("phew"); * //How Much * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM Phew WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Phew It!(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "phew"; * */ } else if (e.CommandName == "like") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("like"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO [LikeAlbums] (UID , AID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikeAlbums] WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Unlike(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unlike"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "INSERT INTO [LikePhotos] (UID , PID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikePhotos] WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Unlike(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unlike"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + detid + ")"; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [Like] WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Unlike(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "unlike"; // r } /*int itemid = int.Parse(k.Text); * * int z = int.Parse(Session["UserID"].ToString()); * string iphew = "INSERT INTO [Like] (UID , NID)VALUES (" + z + "," + itemid + ")"; * dbClass.DataBase(iphew); * * LinkButton lk = (LinkButton)dataItem.FindControl("like"); * * //How Much.. * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM [Like] WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Unlike(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "unlike";*/ } else if (e.CommandName == "unlike") { GridDataItem dataItem = (GridDataItem)e.Item; Label k = (Label)dataItem.FindControl("hell"); LinkButton lk = (LinkButton)dataItem.FindControl("like"); string wtf = k.Text; int z = int.Parse(Session["UserID"].ToString()); if (wtf.StartsWith("album")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM [LikeAlbums] WHERE AID = " + detid + " AND UID = " + z + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikeAlbums] WHERE AID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Like(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "like"; // return "album" + dRView["AlID"].ToString(); } else if (wtf.StartsWith("photo")) { int detid = int.Parse(wtf.Substring(5)); string iphew = "DELETE FROM [LikePhotos] WHERE PID = " + detid + " AND UID = " + z + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [LikePhotos] WHERE PID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Like(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "like"; // return "photo" + dRView["AlID"].ToString(); } else { int detid = int.Parse(wtf.Substring(7)); string iphew = "DELETE FROM [Like] WHERE NID = " + detid + " AND UID = " + z + ""; dbClass.DataBase(iphew); //How Much DataTable dt = new DataTable(); string getcvalue = "SELECT * FROM [Like] WHERE NID = " + detid + ""; dt = dbClass.ReturnDT(getcvalue); lk.Text = "Like(" + dt.Rows.Count.ToString() + ")"; lk.CommandName = "like"; // r } /* int itemid = int.Parse(k.Text); * int X = int.Parse(Session["UserId"].ToString()); * string unphewup = "DELETE FROM [Like] WHERE NID = " + itemid + " AND UID = " + X + ""; * dbClass.DataBase(unphewup); * * LinkButton lk = (LinkButton)dataItem.FindControl("like"); * //How Much * DataTable dt = new DataTable(); * string getcvalue = "SELECT * FROM [Like] WHERE NID = " + itemid + ""; * dt = dbClass.ReturnDT(getcvalue); * lk.Text = "Like(" + dt.Rows.Count.ToString() + ")"; * lk.CommandName = "like";*/ } }
public void item_click(object sender, EventArgs e) { try { GridDataItem item = (GridDataItem)((LinkButton)sender).NamingContainer; DropDownList ddlVoyage = (DropDownList)item.FindControl("ddlVoyage"); foreach (GridDataItem gvr in rgdItems.Items) { gvr["Vessel"].BackColor = System.Drawing.Color.White; } if (CheckBox1.Checked) { if (ddlVoyage.SelectedIndex <= 0) { string stralert = "alert('Please select a voyage ');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Alert", stralert, true); } else { item["Vessel"].BackColor = System.Drawing.Color.Yellow; } } else { item["Vessel"].BackColor = System.Drawing.Color.Yellow; } LinkButton itemName = (LinkButton)item.FindControl("Item_Name"); HiddenField hdf = (HiddenField)item.FindControl("hdVesselID"); Label hiddenStartDate = (Label)item.FindControl("hdnVesselStartDate"); Label hiddenEndDate = (Label)item.FindControl("hdnVesselEndDate"); int index2 = item.ItemIndex; hiddenVesselStartDate.Value = UDFLib.ConvertToDefaultDt(txtStartDate.Text); hiddenVesselEndDate.Value = UDFLib.ConvertToDefaultDt(txtEndDate.Text); getGoal(); string vesselname = itemName.Text; bool voyage = false; string jsMethodName = null; string val = ""; string val1 = ""; string val2 = ""; if (CheckBox1.Checked) { if (ddlVoyage.SelectedIndex > 0) { val = ddlVoyage.SelectedValue.Trim().Split(':')[0] + ":" + ddlVoyage.SelectedValue.Trim().Split(':')[1]; val1 = ddlVoyage.SelectedValue.Trim().Split(':')[0]; val2 = ddlVoyage.SelectedValue.Trim().Split(':')[1]; DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(hdf.Value)).Tables[0]; if (dtq.Rows[0][1].ToString() != "") { hiddenStartDate.Text = dtq.Rows[0][1].ToString(); } if (dtq.Rows[dtq.Rows.Count - 1][1].ToString() != "") { hiddenEndDate.Text = dtq.Rows[dtq.Rows.Count - 1][1].ToString(); } voyage = true; jsMethodName = "showChart2('" + val1 + "','" + val2 + "','" + hiddenStartDate.Text + "','" + hiddenEndDate.Text + "','" + vesselname + "','" + hdf.Value + "','" + voyage + "','" + ddlVoyage.SelectedValue.Trim() + "')"; } } else { jsMethodName = "showChart2('" + val1 + "','" + val2 + "','" + Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text)).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text)).ToString("yyyy-MM-dd") + "','" + vesselname + "','" + hdf.Value + "','" + voyage + "','" + ddlVoyage.SelectedValue.Trim() + "')"; } ScriptManager.RegisterClientScriptBlock(this, typeof(string), "uniqueKey", jsMethodName, true); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
private void ShowMDSButtons(GridDataItem item, bool showTheButtons) { // ------------------------------------------ // check to make sure the user have permissions to add otherwise do not show button if (Session["KenticoUserInfo"] == null) return; var kenticoUserInfo = (UserInfo)Session["KenticoUserInfo"]; var userInfo = UserInfoProvider.GetUserInfo(kenticoUserInfo.UserName); var currentUser = new CurrentUserInfo(userInfo, true); if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", "EditForm")) { var button = (ImageButton)item.FindControl("AddAsNewMyDocsResource"); if (button != null) { button.Enabled = false; button.CssClass = "disabledButton"; } //item.FindControl("AddAsNewMyDocsResource").Visible = false; return; } // ------------------------------------------ item.FindControl("AddAsNewMyDocsResource").Visible = showTheButtons; //item.FindControl("AddAsNewDistrictResource").Visible = showTheButtons; //item.FindControl("AddAsNewStateResource").Visible = showTheButtons; }
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 (instalacion != null) { img.OnClientClick = String.Format("newDispositivoFromInstalacion('{0}');", instalacion.InstalacionId); } if (dispositivo != null) // antes mode.Equals("S") { img.OnClientClick = String.Format("newAccesorioFromDispositivo('{0}');", dispositivo.DispositivoId); img = (ImageButton)item.FindControl("Exit"); img.Visible = false; } } if (e.Item is GridDataItem) { ImageButton imgb = null; string jCommand = ""; GridDataItem item = (GridDataItem)e.Item; if (CntLainsaSci.FechaNula(DateTime.Parse(item["FechaCaducidad"].Text))) { item["FechaCaducidad"].Text = ""; } string strKey = item.GetDataKeyValue("DispositivoId").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; } } if (item["Caducado"].Text == "True") { item.BackColor = System.Drawing.Color.DeepPink; } // in order to assign the appropiate javascript function to select button imgb = (ImageButton)item.FindControl("Select"); string nomLargo = String.Format("({0}) [{3}] {1} / {2} ", item["Nombre"].Text, item["Instalacion.Empresa.Nombre"].Text, item["Instalacion.Nombre"].Text, item["ModeloDispositivo.Nombre"].Text); if (LL == "") { jCommand = String.Format("returnValues3('{0}','{1}','{2}');", strKey, nomLargo, "Dispositivo"); } else { jCommand = String.Format("returnValues3('{0}','{1}','{2}');", strKey, nomLargo, "Dispositivo2"); } imgb.OnClientClick = jCommand; if (caller == "RevisionNoPeriodica" && item["Operativo"].Text == "False") { imgb.Visible = false; } else 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("editDispositivo({0});", strKey); if (instalacion != null) { jCommand = String.Format("editDispositivoFromInstalacion({0});", strKey); } if (mode.Equals("S")) { jCommand = String.Format("editAccesorioFromDispositivo('{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["DispositivoId"].Text, Resources.ResourceLainsaSci.DeleteRecord); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Crear; } }
protected void radGridPrintStatus_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; string rowId = item["MenuId"].Text; LinkButton editLink = (LinkButton)item.FindControl("gvlnkbtnViewMenu"); editLink.Attributes["href"] = "javascript:void(0);"; editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", rowId, e.Item.ItemIndex); } if (e.Item.ItemType == GridItemType.NestedView) { GridNestedViewItem NestedView = (GridNestedViewItem)e.Item; if (NestedView != null) { Label lblVirginAppId = e.Item.FindControl("lblVirginAppId") as Label; string virginUserid = lblVirginAppId.Text; LinkButton link3 = e.Item.FindControl("LinkButton3") as LinkButton; link3.Attributes["href"] = "javascript:void(0);"; link3.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", virginUserid); Label lblVirginAppId1 = e.Item.FindControl("lblVirginAppId") as Label; string virginUserid1 = lblVirginAppId1.Text; LinkButton link5 = e.Item.FindControl("LinkButton5") as LinkButton; link5.Attributes["href"] = "javascript:void(0);"; link5.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", virginUserid1); Label lblVirginAppId2 = e.Item.FindControl("lblVirginAppId") as Label; string virginUserid2 = lblVirginAppId2.Text; LinkButton link7 = e.Item.FindControl("LinkButton7") as LinkButton; link7.Attributes["href"] = "javascript:void(0);"; link7.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", virginUserid2); Label lblVirginAppId3 = e.Item.FindControl("lblVirginAppId2") as Label; string virginUserid3 = lblVirginAppId3.Text; LinkButton link = e.Item.FindControl("LinkButton") as LinkButton; link.Attributes["href"] = "javascript:void(0);"; link.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", virginUserid3); Label lblVirginAppId4 = e.Item.FindControl("lblVirginAppId2") as Label; string virginUserid4 = lblVirginAppId4.Text; LinkButton link2 = e.Item.FindControl("LinkButton2") as LinkButton; link2.Attributes["href"] = "javascript:void(0);"; link2.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", virginUserid4); Label lblCatererAppId = e.Item.FindControl("lblCatererAppId") as Label; string catererUserid = lblCatererAppId.Text; LinkButton link4 = e.Item.FindControl("LinkButton4") as LinkButton; link4.Attributes["href"] = "javascript:void(0);"; link4.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", catererUserid); Label lblCatererAppId2 = e.Item.FindControl("lblCatererAppId2") as Label; string catererUserid2 = lblCatererAppId2.Text; LinkButton link1 = e.Item.FindControl("LinkButton1") as LinkButton; link1.Attributes["href"] = "javascript:void(0);"; link1.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", catererUserid2); Label lblTranslatorAppId = e.Item.FindControl("lblTranslatorAppId") as Label; string translatorUserid = lblTranslatorAppId.Text; LinkButton link6 = e.Item.FindControl("LinkButton6") as LinkButton; link6.Attributes["href"] = "javascript:void(0);"; link6.Attributes["onclick"] = String.Format("return ShowViewApprover('{0}');", translatorUserid); } } if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; Label printStatus = e.Item.FindControl("gvlblPrintOrderStatus") as Label; string printStatusID = printStatus.Text; Label language = e.Item.FindControl("gvlblLanguageId") as Label; string languageID = language.Text; Image imgStatus = e.Item.FindControl("gvimgPrintOrderStatus") as Image; LinkButton lnkbtnordernow = e.Item.FindControl("gvlnkbtnOrderNow") as LinkButton; lnkbtnordernow.ForeColor = System.Drawing.ColorTranslator.FromHtml("#818181"); lnkbtnordernow.Enabled = false; if (languageID == "1") { if (Convert.ToInt32(printStatusID) == 1) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/EngStatus1InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 2) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/EngStatus2InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 3) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/EngStatus3InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 6) { var activeCycle = _cycleManagement.GetActiveCycle(); var selectedCycle = Convert.ToInt64(ddlCycle.SelectedValue); if (activeCycle.Id == selectedCycle) { lnkbtnordernow.ForeColor = System.Drawing.ColorTranslator.FromHtml("#B72B3C"); lnkbtnordernow.Enabled = true; } imgStatus.ImageUrl = "~/Images/ApprovalStatus/EngStatusApproved.png"; } } else { if (Convert.ToInt32(printStatusID) == 1) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/OthStatus1InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 2) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/OthStatus2InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 3) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/OthStatus3InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 4) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/OthStatus4InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 5) { imgStatus.ImageUrl = "~/Images/ApprovalStatus/OthStatus5InProgress.png"; } else if (Convert.ToInt32(printStatusID) == 6) { var activeCycle = _cycleManagement.GetActiveCycle(); var selectedCycle = Convert.ToInt64(ddlCycle.SelectedValue); if (activeCycle.Id == selectedCycle) { lnkbtnordernow.ForeColor = System.Drawing.ColorTranslator.FromHtml("#B72B3C"); lnkbtnordernow.Enabled = true; } imgStatus.ImageUrl = "~/Images/ApprovalStatus/OthStatusApproved.png"; } } } if (e.Item.ItemType == GridItemType.NestedView) { GridNestedViewItem NestedView = (GridNestedViewItem)e.Item; if (NestedView != null) { Label printStatus = e.Item.FindControl("gvlblNestPrintOrderStatus") as Label; string printStatusID = printStatus.Text; Label language = e.Item.FindControl("gvlblNestLanguageId") as Label; string languageID = language.Text; Panel pnlForFive = e.Item.FindControl("pnlLanguageForFive") as Panel; Panel pnlForThree = e.Item.FindControl("pnlLanguageForThree") as Panel; Label lblProof33 = e.Item.FindControl("gvlblProof33") as Label; if (languageID == "1") { pnlForFive.Visible = false; pnlForThree.Visible = true; Image imgApproveStatus1 = e.Item.FindControl("gvimgProof31") as Image; Image imgApproveStatus2 = e.Item.FindControl("gvimgProof32") as Image; Image imgApproveStatus3 = e.Item.FindControl("gvimgProof33") as Image; if (Convert.ToInt32(printStatusID) == 1) { lblProof33.Text = "Final Proof"; imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/EngStatus1Incomplete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/EngStatus2Incomplete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/EngStatus3Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 2) { lblProof33.Text = "Final Proof"; imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/EngStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/EngStatus2Incomplete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/EngStatus3Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 3) { lblProof33.Text = "Final Proof"; imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/EngStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/EngStatus2Complete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/EngStatus3Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 6) { lblProof33.Text = "Approved"; imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/EngStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/EngStatus2Complete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/EngStatus3Complete.png"; } } else { pnlForFive.Visible = true; pnlForThree.Visible = false; Image imgApproveStatus1 = e.Item.FindControl("gvimgProof51") as Image; Image imgApproveStatus2 = e.Item.FindControl("gvimgProof52") as Image; Image imgApproveStatus3 = e.Item.FindControl("gvimgProof53") as Image; Image imgApproveStatus4 = e.Item.FindControl("gvimgProof54") as Image; Image imgApproveStatus5 = e.Item.FindControl("gvimgProof55") as Image; if (Convert.ToInt32(printStatusID) == 1) { imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/OthStatus1Incomplete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/OthStatus2Incomplete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/OthStatus3Incomplete.png"; imgApproveStatus4.ImageUrl = "~/Images/ApprovalStatus/OthStatus4Incomplete.png"; imgApproveStatus5.ImageUrl = "~/Images/ApprovalStatus/OthStatus5Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 2) { imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/OthStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/OthStatus2Incomplete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/OthStatus3Incomplete.png"; imgApproveStatus4.ImageUrl = "~/Images/ApprovalStatus/OthStatus4Incomplete.png"; imgApproveStatus5.ImageUrl = "~/Images/ApprovalStatus/OthStatus5Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 3) { imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/OthStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/OthStatus2Complete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/OthStatus3Incomplete.png"; imgApproveStatus4.ImageUrl = "~/Images/ApprovalStatus/OthStatus4Incomplete.png"; imgApproveStatus5.ImageUrl = "~/Images/ApprovalStatus/OthStatus5Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 4) { imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/OthStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/OthStatus2Complete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/OthStatus3Complete.png"; imgApproveStatus4.ImageUrl = "~/Images/ApprovalStatus/OthStatus4Incomplete.png"; imgApproveStatus5.ImageUrl = "~/Images/ApprovalStatus/OthStatus5Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 5) { imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/OthStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/OthStatus2Complete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/OthStatus3Complete.png"; imgApproveStatus4.ImageUrl = "~/Images/ApprovalStatus/OthStatus4Complete.png"; imgApproveStatus5.ImageUrl = "~/Images/ApprovalStatus/OthStatus5Incomplete.png"; } else if (Convert.ToInt32(printStatusID) == 6) { Label lblProof55 = e.Item.FindControl("gvlblProof55") as Label; lblProof55.Text = "Approved"; imgApproveStatus1.ImageUrl = "~/Images/ApprovalStatus/OthStatus1Complete.png"; imgApproveStatus2.ImageUrl = "~/Images/ApprovalStatus/OthStatus2Complete.png"; imgApproveStatus3.ImageUrl = "~/Images/ApprovalStatus/OthStatus3Complete.png"; imgApproveStatus4.ImageUrl = "~/Images/ApprovalStatus/OthStatus4Complete.png"; imgApproveStatus5.ImageUrl = "~/Images/ApprovalStatus/OthStatus5Complete.png"; } } } } } catch (Exception ex) { //write to Elma ErrorSignal.FromCurrentContext().Raise(ex); } }
private void ToggleCheckBox(GridDataItem dataItem, bool toggleValue) { var rowCheckBox = (CheckBox)dataItem.FindControl("rowCheckBox"); if (rowCheckBox.Visible) { rowCheckBox.Checked = toggleValue; dataItem.Selected = toggleValue; } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridCommandItem) { GridCommandItem item = (GridCommandItem)e.Item; ImageButton img = (ImageButton)item.FindControl("New"); if (crear) { img.Visible = permiso.Crear; } else { img.Visible = false; } if (dispositivo != null) { img.OnClientClick = String.Format("newRevisionFromDispositivo('{0}');", dispositivo.DispositivoId); } if (mode.Equals("S")) { img = (ImageButton)item.FindControl("Exit"); img.Visible = false; } img = (ImageButton)item.FindControl("Generar"); if (img != null && dispositivo == null) { img.Visible = false; } img = (ImageButton)item.FindControl("Exit"); if (!crear) { img.Visible = false; } } if (e.Item is GridDataItem) { ImageButton imgb = null; string jCommand = ""; GridDataItem item = (GridDataItem)e.Item; string strKey = item.GetDataKeyValue("RevisionId").ToString(); Revision revision = CntLainsaSci.GetRevision(int.Parse(strKey), ctx); if (CntLainsaSci.FechaNula(DateTime.Parse(item["FechaRevision"].Text))) { item["FechaRevision"].Text = ""; } if (CntLainsaSci.FechaNula(DateTime.Parse(item["FechaProgramada"].Text))) { item["FechaProgramada"].Text = ""; } if (item["CaduProx"].Text == "True") { item.BackColor = System.Drawing.Color.DeepPink; } if (item["PlantillaRevision.NoPeriodica"].Text == "True") { item.BackColor = System.Drawing.Color.LightBlue; } //item["dispositivo"].Text = revision.PlanificacionRevision.dispositivo.Nombre; //item["PlantillaRevision"].Text=revision.PlanificacionRevision.PlantillaRevision.Descripcion; //item["FechaProgramada"].Text = String.Format("{0:dd/MM/yyyy}", revision.FechaProgramada); // 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,"Revision"); //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"); if (revision.Estado == CntLainsaSci.EstadoRevision.Planificada.ToString()) { imgb.Visible = false; } else { jCommand = String.Format("editRevision({0});", strKey); if (dispositivo != null) { jCommand = String.Format("editRevisionFromDispositivo({0},{1});", strKey, dispositivo.DispositivoId); } 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["RevisionId"].Text, Resources.ResourceLainsaSci.DeleteRecord); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Crear; } }