protected void btnSaveAssetTypeChanges_Click(object sender, EventArgs e) { foreach (GridDataItem assetCategoryItem in rdAssetTypeGrid.Items) { GridNestedViewItem detailView = (GridNestedViewItem)assetCategoryItem.ChildItem; if (detailView != null) { GridTableView tableView = detailView.NestedTableViews.First(); foreach (GridDataItem assetTypeItem in tableView.Items) { Hashtable assetTypeValues = new Hashtable(); assetTypeItem.ExtractValues(assetTypeValues); int assetTypeId = Convert.ToInt32(assetTypeValues["AssetTypeId"].ToString()); AssetTypeEntity assetType = new AssetTypeEntity(assetTypeId); TextBox txtName = assetTypeItem.FindControl("txtName") as TextBox; TextBox txtAssetTypeDescription = assetTypeItem.FindControl("txtAssetTypeDescription") as TextBox; TextBox txtSpanishLabel = assetTypeItem.FindControl("txtSpanishLabel") as TextBox; DropDownList ddlAssetTypeCategory = assetTypeItem.FindControl("ddlAssetTypeCategory") as DropDownList; assetType.Name = txtName.Text.Trim().Length > 0 ? txtName.Text.Trim() : ""; assetType.Description = txtAssetTypeDescription.Text.Trim().Length > 0 ? txtAssetTypeDescription.Text.Trim() : ""; assetType.SpanishLabel = txtSpanishLabel.Text.Trim().Length > 0 ? txtSpanishLabel.Text.Trim() : ""; assetType.AssetCategoryId = Convert.ToInt32(ddlAssetTypeCategory.SelectedValue); assetType.Save(); } } } }
protected void rgDepartmentSent_ItemCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName == "download_fileInbox") { GridNestedViewItem ditem = (GridNestedViewItem)e.Item; string filename = e.CommandArgument.ToString(); if (filename != "No") { if (filename != "Not Available") { string FolderName = string.Empty; FolderName = Convert.ToString(Session["CampusName"]); String path = Server.MapPath("~/SentAttachment/" + FolderName + "/" + filename); // string path = MapPath("~/InboxAttachment/" + filename); byte[] bts = System.IO.File.ReadAllBytes(path); Response.Clear(); Response.ClearHeaders(); Response.AddHeader("Content-Type", "Session/octet-stream"); Response.AddHeader("Content-Length", bts.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); Response.BinaryWrite(bts); Response.Flush(); Response.End(); return; } } } } catch (Exception ex) { } }
protected void grdBranches_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridNestedViewItem) { GridNestedViewItem nestedItem = e.Item as GridNestedViewItem; Branch branch = nestedItem.DataItem as Branch; RadGrid grid = nestedItem.FindControl("grdProductsInBranches") as RadGrid; List <ProductsInBranch> list = (from pb in entities.ProductsInBranches where pb.BranchID == branch.BranchID select pb).ToList(); grid.DataSource = list; grid.DataBind(); } }
protected void btnSaveAssetTypePrices_Click(object sender, EventArgs e) { foreach (GridDataItem assetCategoryItem in rdAssetTypeGrid.Items) { GridNestedViewItem detailView = (GridNestedViewItem)assetCategoryItem.ChildItem; if (detailView != null) { GridTableView tableView = detailView.NestedTableViews.First(); foreach (GridDataItem assetTypeItem in tableView.Items) { Hashtable assetTypeValues = new Hashtable(); assetTypeItem.ExtractValues(assetTypeValues); int serviceLocationAssetTypeId = Convert.ToInt32(assetTypeValues["ServiceLocationAssetTypeId"].ToString()); ServiceLocationAssetTypeEntity serviceLocationAssetType = new ServiceLocationAssetTypeEntity(serviceLocationAssetTypeId); TextBox txtPricePerUnit = assetTypeItem.FindControl("txtPricePerUnit") as TextBox; HiddenField hdnOrigPrice = assetTypeItem.FindControl("hdnOrigPrice") as HiddenField; decimal price = 0; decimal origPrice = Convert.ToDecimal(hdnOrigPrice.Value.Trim().Replace("$", "")); if (txtPricePerUnit.Text.Trim().Length > 0) { price = Convert.ToDecimal(txtPricePerUnit.Text.Trim().Replace("$", "")); } serviceLocationAssetType.PricePerUnit = price; serviceLocationAssetType.Save(); if (price != origPrice) { ChangeLogEntity cle = new ChangeLogEntity(); cle.UserId = sm.AuthenticatedUser.UserId; cle.ChangeDate = DateTime.Now; cle.ChangeTypeId = (int)ChangeTypeEntity.ChangeTypes.AssetTypePriceChange; cle.Save(); ServiceLocationAssetTypeChangeLogEntity slatcle = new ServiceLocationAssetTypeChangeLogEntity(); slatcle.ServiceLocationAssetTypeId = serviceLocationAssetType.ServiceLocationAssetTypeId; slatcle.ChangeLog = cle; slatcle.Save(); } } } } messages.AddSuccessDiv("Asset types successfully saved"); }
private void SaveAssignments() { foreach (GridDataItem item in rdAccountGrid.Items) { GridNestedViewItem detailView = (GridNestedViewItem)item.ChildItem; if (detailView != null) { GridTableView tableView = detailView.NestedTableViews.First(); if (tableView.Name == "WeekView") { foreach (GridDataItem childItem in tableView.Items) { Hashtable values = new Hashtable(); childItem.ExtractValues(values); int aeaeId = Convert.ToInt32(values["AccountEmployeeAssignmentId"].ToString()); AccountEmployeeAssignmentEntity acctEmployeeAssgnmnt = new AccountEmployeeAssignmentEntity(aeaeId); if (acctEmployeeAssgnmnt != null) { List <string> days = new List <string>() { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; foreach (string day in days) { DropDownList ddlEmployees = childItem.FindControl("ddlEmployees" + day) as DropDownList; if (ddlEmployees.SelectedValue != "") { acctEmployeeAssgnmnt.GetFieldByName(day).CurrentValue = Convert.ToInt32(ddlEmployees.SelectedValue); } else { acctEmployeeAssgnmnt.GetFieldByName(day).CurrentValue = null; } } acctEmployeeAssgnmnt.IsDirty = true; acctEmployeeAssgnmnt.Save(); } } } } } }
protected void RadGrid_VariantSpliter_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem myItem = (GridDataItem)e.Item; string myItemID = myItem.GetDataKeyValue("Variant_SpliterID").ToString(); HyperLink myAddPropertyLink = (HyperLink)myItem["Variant_SpliterID"].FindControl("hlink_AddProperty"); myAddPropertyLink.Attributes["href"] = "#"; myAddPropertyLink.Attributes["onclick"] = string.Format("return Show_ControlManager('PoP_PropertyCreate.aspx?Variant_SpliterID={0}&Action=Create');", myItemID); HyperLink myEditLink = (HyperLink)myItem["Variant_SpliterID"].FindControl("hlink_EditSpliter"); myEditLink.Attributes["href"] = "#"; myEditLink.Attributes["onclick"] = string.Format("return Show_ControlManager('PoP_SpliterEditor.aspx?Variant_SpliterID={0}');", myItemID); LinkButton myDeleteLink = (LinkButton)myItem["Variant_SpliterID"].FindControl("lbtn_DeleteSpliter"); myDeleteLink.OnClientClick = string.Format("return confirm('Are you sure you want to delete spliter \"{0}\" ?');", DataBinder.Eval(myItem.DataItem, "Spliter_Name")); } if (e.Item is GridNestedViewItem) { GridNestedViewItem myNestedItem = (GridNestedViewItem)e.Item; string myItemID = myNestedItem.ParentItem.GetDataKeyValue("Variant_SpliterID").ToString(); RadGrid myRadGrid = (RadGrid)myNestedItem.FindControl("RadGrid_VariantProperties"); ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); List <Variant_Property> myVariant_Properties = myProductVariantMgr.Get_Product_Variant_Properties_BySpliterID(myItemID); if (myVariant_Properties.Count < 1) { myRadGrid.Visible = false; } else { myRadGrid.DataSource = myVariant_Properties; myRadGrid.DataBind(); } } }
protected void grdProducts_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridNestedViewItem) { GridNestedViewItem nestedItem = e.Item as GridNestedViewItem; Product product = nestedItem.DataItem as Product; if (!product.IsSpecial) { string name = nestedItem.ParentItem.OwnerTableView.Columns[0].DataTypeName; } else { RadGrid grid = nestedItem.FindControl("grdChildProducts") as RadGrid; /*if (grid != null) * { * grid.DataSource = product.Products1; * grid.DataBind(); * * }*/ } } }
protected void rg_features_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridNestedViewItem) { GridNestedViewItem nested_item = (GridNestedViewItem)e.Item; String feat_cpy_id = ((HiddenField)nested_item.FindControl("hf_feat_cpy_id")).Value; System.Web.UI.HtmlControls.HtmlIframe iframe = ((System.Web.UI.HtmlControls.HtmlIframe)nested_item.FindControl("if_ltmpl")); if (dd_issue.Items.Count > 0 && dd_issue.SelectedItem != null) { iframe.Attributes.Add("src", "trackeradvertiserlist.aspx?feat_cpy_id=" + feat_cpy_id + "&issue_name=" + dd_issue.SelectedItem.Text); //src='<%#: String.Format(("trackeradvertiserlist.aspx?feat_cpy_id={0}"), Eval("feat_cpy_id")) %>' // for aspx iframe.Attributes.Add("onload", "resizeIframe(this);"); } } else if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; String cpy_id = item["feat_cpy_id"].Text; // View Company LinkButton lb = (LinkButton)item["Feature"].FindControl("lb_view_cpy"); lb.OnClientClick = "radopen('trackercompanycontacteditor.aspx?cpy_id=" + Server.UrlEncode(cpy_id) + "&cpy_type=f&issue=" + Server.UrlEncode(dd_issue.SelectedItem.Text) + "', 'rw_ss_editor'); return false;"; lb.Text = Server.HtmlEncode(Util.TruncateText(Server.HtmlDecode(lb.Text), 30)); if (item["Region"].Text == " ") { item.Display = false; //item.Attributes.Add("style", "background-color:#363636; height:20px !important;"); //item.CssClass = "bottomLine " + (item.ItemIndex % 2 == 0 ? "rgRow" : "rgAltRow"); //div.RadGrid tr.bottomLine td { //border-bottom: 1px solid red; //} } //// Completeness Indicators (for widget/brochure/twitter etc) //String[] Indications = new String[] { "Widget", "Brochure", "Infographics", "WebCopy", "SampleTweets"}; //foreach (String i in Indications) //{ // ImageButton imbtn_s = (ImageButton)item[i].FindControl("imbtn_"+i); // HtmlGenericControl div = (HtmlGenericControl)item[i].FindControl("div_" + i); // ram.AjaxSettings.AddAjaxSetting(div, div); // ajaxify the div // if (imbtn_s.CommandName == "Y") // imbtn_s.ImageUrl = "~/images/smartsocial/ico_tick.png"; // else // imbtn_s.ImageUrl = "~/images/smartsocial/ico_cross.png"; //} // Shared Indicators String[] ShareIndications = new String[] { "twitter", "facebook", "linkedin", "website", "other" }; foreach (String i in ShareIndications) { ImageButton imbtn_s = (ImageButton)item[i].FindControl("imbtn_so_" + i); HtmlGenericControl div = (HtmlGenericControl)item[i].FindControl("div_so_" + i); ram.AjaxSettings.AddAjaxSetting(div, div); // ajaxify the div if (imbtn_s.CommandName == "1") { imbtn_s.ImageUrl = "~/images/smartsocial/ico_tick.png"; } else { imbtn_s.ImageUrl = "~/images/smartsocial/ico_cross.png"; } } // Truncate writer int WriterTrunc = 8; Label lbl_editor = (Label)item["Editor"].FindControl("lbl_editor"); if (lbl_editor.Text != String.Empty && lbl_editor.Text.Length > WriterTrunc) { RadToolTip rtt_editor = (RadToolTip)item["Editor"].FindControl("rtt_editor"); lbl_editor.Text = HttpUtility.HtmlEncode(Util.TruncateText(HttpUtility.HtmlDecode(lbl_editor.Text), WriterTrunc)); } // Truncate/tooltip mags int MagTrunc = 10; Label lbl_rm = (Label)item["RegionMag"].FindControl("lbl_rm"); if (lbl_rm.Text != String.Empty && lbl_rm.Text.Length > MagTrunc) { RadToolTip rtt_rm = (RadToolTip)item["RegionMag"].FindControl("rtt_rm"); lbl_rm.Text = HttpUtility.HtmlEncode(Util.TruncateText(HttpUtility.HtmlDecode(lbl_rm.Text), MagTrunc)); } Label lbl_sm = (Label)item["SectorMag"].FindControl("lbl_sm"); if (lbl_sm.Text != String.Empty && lbl_sm.Text.Length > MagTrunc) { RadToolTip rtt_sm = (RadToolTip)item["SectorMag"].FindControl("rtt_sm"); lbl_sm.Text = HttpUtility.HtmlEncode(Util.TruncateText(HttpUtility.HtmlDecode(lbl_sm.Text), MagTrunc)); } // Notes RadButton rb_ss_notes = (RadButton)item["Notes"].FindControl("rb_ss_notes"); HtmlGenericControl div_notes = (HtmlGenericControl)item["Notes"].FindControl("div_notes"); RadTextBox tb_ss_notes = (RadTextBox)div_notes.FindControl("tb_ss_notes"); tb_ss_notes.ClientEvents.OnBlur = "function(sender, args){ $find('" + rb_ss_notes.ClientID + "').click(); }"; ram.AjaxSettings.AddAjaxSetting(rb_ss_notes, div_notes); // ajaxify the div //// Case Studies //int CSTrunc = 16; //for (int i = 1; i < 6; i++) //{ // String UnqName = "cs" + i; // if (item[UnqName].Text != " " && item[UnqName].Text.Length >= CSTrunc) // Util.AddRadToolTipToRadGridCell(item[UnqName], true, CSTrunc); //} //// Notes tooltip //if (item["SSNotes"].Text != " ") // Util.AddRadToolTipToRadGridCell(item["SSNotes"], false, 0, "#dcfadc"); // Add smartsocial button String SmartSocialPageParamID = item["SSParam"].Text; if (SmartSocialPageParamID != " " && dd_issue.Items.Count > 0 && dd_issue.SelectedItem != null) { //item["Feature"].BackColor = Color.FromName("#dcfadc"); ImageButton imbtn_smartsocial = new ImageButton(); //imbtn_smartsocial.ToolTip = "View the SMARTsocial profile for this feature."; imbtn_smartsocial.ImageUrl = "~/images/smartsocial/ico_logo_alpha.png"; imbtn_smartsocial.Height = 16; imbtn_smartsocial.Width = 16; imbtn_smartsocial.Style.Add("margin-left", "2px"); imbtn_smartsocial.Style.Add("border-bottom", "solid 1px green;"); // Set language param String language = String.Empty; if (dd_region.Items.Count > 0 && dd_region.SelectedItem != null) { switch (dd_region.SelectedItem.Text) { case "Brazil": language = "&l=p"; break; case "Latin America": language = "&l=s"; break; } } imbtn_smartsocial.OnClientClick = "window.open('/dashboard/smartsocial/project.aspx?ss=" + SmartSocialPageParamID + language + "&iss=" + dd_issue.SelectedItem.Text + "','_newtab'); return false;"; item["SSProfile"].Controls.Add(imbtn_smartsocial); RadToolTip rtt_view_ss = (RadToolTip)item["SSProfile"].FindControl("rtt_ss_view"); rtt_view_ss.TargetControlID = imbtn_smartsocial.ClientID; } } }
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); } }
protected void rg_contacts_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridNestedViewItem) { GridNestedViewItem nested_item = (GridNestedViewItem)e.Item; HiddenField hf_ctc_id = (HiddenField)nested_item.FindControl("hf_ctc_id"); ContactTemplate ctc_template = (ContactTemplate)nested_item.FindControl("ctc_template"); ctc_template.DuplicateLeadCheckingEnabled = this.DuplicateLeadCheckingEnabled; // Bind existing contacts String ContactID = hf_ctc_id.Value; ctc_template.BindContact(ContactID, IncludeContactTypes, TargetSystem, OnlyShowTargetSystemContactTypes, hf_user_id.Value); RadButton btn_update = (RadButton)nested_item.FindControl("btn_update"); btn_update.ValidationGroup = "vg_" + ContactID; btn_update.OnClientClicking = "function(button,args){ValidateContact('" + btn_update.ValidationGroup + "');}"; RadButton btn_remove_dnc = (RadButton)nested_item.FindControl("btn_remove_dnc"); btn_remove_dnc.Visible = ctc_template.HasKillWarning; RadButton btn_remove_estimated = (RadButton)nested_item.FindControl("btn_remove_estimated"); btn_remove_estimated.Visible = ctc_template.IsEmailEstimated; RadButton btn_verifiy_email = (RadButton)nested_item.FindControl("btn_verifiy_email"); btn_verifiy_email.Visible = false;// !ctc_template.IsEmailVerified && ctc_template.WorkEmail != String.Empty; RadButton btn_add_context = (RadButton)nested_item.FindControl("btn_add_context"); btn_add_context.Visible = !OnlyShowContextualContacts; if (ctc_template.DontContactReason == "Already being Pursued by Someone Else") { btn_remove_dnc.Text = "Remove Being Pursued Notice"; } else if (ctc_template.HasDoNotContact) { btn_remove_dnc.Text = "Remove Do-Not-Contact"; } if (AllowKillingLeads) { // check to see if we allow kill of lead String qry = "SELECT GROUP_CONCAT(LeadID) as 'LeadID' FROM dbl_lead WHERE ProjectID IN (SELECT ProjectID FROM dbl_project WHERE UserID=@userid) AND Active=1 AND ContactID=@ctc_id"; DataTable dt_lead = SQL.SelectDataTable(qry, new String[] { "@userid", "@ctc_id" }, new Object[] { hf_user_id.Value, ContactID }); if (dt_lead.Rows.Count > 0) { String LeadID = dt_lead.Rows[0]["LeadID"].ToString(); // this is a group concat of Lead entries for this user, so will kill all active in current projects RadButton btn_kill = (RadButton)nested_item.FindControl("btn_kill"); btn_kill.Visible = true; btn_kill.OnClientClicking = "function (button,args){ var rw = GetRadWindow(); var rwm = rw.get_windowManager(); setTimeout(function ()" + "{ rwm.open('multikill.aspx?lead_ids=" + Server.UrlEncode(LeadID) + "&kill_from_viewer=1', 'rw_kill_leads'); }, 0);}"; } } // Disable invalid leads' checkboxes if (SelectableContacts) { ArrayList NewContactIDs = (ArrayList)ViewState["NewContactIDs"]; ArrayList ForcedSelectedContactIDs = (ArrayList)ViewState["ForcedSelectedContactIDs"]; if (!ctc_template.IsValidContact || ForcedSelectedContactIDs.Count > 0 || NewContactIDs.Count > 0) { foreach (GridDataItem item in rg_contacts.Items) { if (ContactID == item["ContactID"].Text) { if (NewContactIDs.Contains(ContactID)) { ((CheckBox)item.FindControl("cb_select")).Checked = true; break; } if (!ctc_template.IsValidContact) { ((CheckBox)item.FindControl("cb_select")).Enabled = false; break; } else if (ForcedSelectedContactIDs.Contains(ContactID)) { ((CheckBox)item.FindControl("cb_select")).Enabled = false; ((CheckBox)item.FindControl("cb_select")).Checked = true; ctc_template.SelectFirstContactTypeForTargetSystem(ContactID, TargetSystem); break; } } } } } } else if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; String ctc_id = item["ContactID"].Text; // Completion indicator (based on company completion) int completion = 0; Int32.TryParse(item["Completion"].Text, out completion); item["Completion"].Text = String.Empty; String CssClass = "LowRatingCell HandCursor"; if (completion >= 66) { CssClass = "HighRatingCell HandCursor"; } else if (completion >= 33) { CssClass = "MediumRatingCell HandCursor"; } item["Completion"].CssClass = CssClass; item["Completion"].ToolTip = "Contact information is " + completion + "% complete."; ContactEmailManager ContactEmailManager = (ContactEmailManager)item["BEmailLink"].FindControl("ContactEmailManager"); ContactEmailManager.ConfigureControl(true, "BindContactProxy", ctc_id); if (SelectableContacts) { // Don't Contact Reason if ((item["DontContactReason"].Text != " " && !item["DontContactReason"].Text.Contains("soft")) || item["DontContactUntil"].Text != " ") { item["Select"].ToolTip = "Do-not-contact is set, expand for more details."; item["Select"].CssClass = "DoNotContact HandCursor"; } else { item["Select"].CssClass = "HandCursor"; } } } }
protected void rgDepartment_ItemCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName == "Deptdownload_file") { GridNestedViewItem ditem = (GridNestedViewItem)e.Item; string filename = e.CommandArgument.ToString(); if (filename != "No") { if (filename != "Not Available") { string FolderName = string.Empty; FolderName = Convert.ToString(Session["CampusName"]); string path = MapPath("~/InboxAttachment/" + FolderName + "/" + filename); // string path = MapPath("~/InboxAttachment/" + filename); byte[] bts = System.IO.File.ReadAllBytes(path); Response.Clear(); Response.ClearHeaders(); Response.AddHeader("Content-Type", "Application/octet-stream"); Response.AddHeader("Content-Length", bts.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); Response.BinaryWrite(bts); Response.Flush(); Response.End(); return; } } } if (e.CommandName == "DeleteInboxDeptemail") { GridDataItem ditem = (GridDataItem)e.Item; e.Item.Selected = true; string DeleteID = e.CommandArgument.ToString(); Boolean result = false; result = DataAccessManager.GetDeleteStdLeadInbox(DeleteID); if (result == true) { DepartmentInboxEmail(); rgDepartment.Rebind(); } } if (e.CommandName == "imgbtnreplystd") { GridDataItem ditem = (GridDataItem)e.Item; Label EmailReceived = (Label)ditem.FindControl("EmailReceived"); Label EmailSubject = (Label)ditem.FindControl("EmailSubject"); Label lbdeptEmailBody = (Label)ditem.FindControl("lbdeptEmailBody"); // Rtxtemailtodept.Text = EmailReceived.Text; //RtxtemailSubjectdept.Text = "Re:" + EmailSubject.Text; //REditComposeBodydept.Content = "<br/><br/>-----------------------------------------------------<br/>" + lbdeptEmailBody.Text; Session["ReplyDeptEmailTo"] = EmailReceived.Text; Session["ReplyDeptEmailSubject"] = "Re:" + EmailSubject.Text; Session["ReplyDeptEmailComposeBody"] = "<br/><br/>-----------------------------------------------------<br/>" + lbdeptEmailBody.Text; Response.Redirect("~/frmdepartmentcomposeemail.aspx", false); } if (e.CommandName == "ExpandCollapse") { GridDataItem ditem = (GridDataItem)e.Item; HiddenField hdn = (HiddenField)ditem.ChildItem.FindControl("hdnInboxID"); string inboxid = hdn.Value; Boolean result = false; result = DataAccessManager.GetUpdateUnread(inboxid, "true"); if (result == true) { GridDataItem item = (GridDataItem)e.Item; Label EmailReceived = item.FindControl("EmailReceived") as Label; Label EmailSubject = item.FindControl("EmailSubject") as Label; Label EmailReceivedDatetime = item.FindControl("EmailReceivedDatetime") as Label; Label Attachment = item.FindControl("Attachment") as Label; CheckBox chkBoolean = item.FindControl("ItemChkboxEmailIsRead") as CheckBox; EmailSubject.ForeColor = System.Drawing.Color.Blue; chkBoolean.Checked = true; EmailReceived.Font.Bold = false; EmailSubject.Font.Bold = false; Attachment.Font.Bold = false; EmailReceivedDatetime.Font.Bold = false; } } } catch (Exception ex) { // Following Code comment beacause download button given error always // } }
protected void grdCursos_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { GridDataItem i = (GridDataItem)e.Item; int pCursoId = int.Parse(i.GetDataKeyValue("ID_CURSO").ToString()); if (!i.Expanded) { GridNestedViewItem nestedItem = (GridNestedViewItem)i.ChildItem; RadGrid grdCursosInstructor = (RadGrid)nestedItem.FindControl("grdCursosInstructor"); RadGrid grdCursosCompetencia = (RadGrid)nestedItem.FindControl("grdCursosCompetencia"); RadGrid grdCursosTema = (RadGrid)nestedItem.FindControl("grdCursosTema"); CursoNegocio nCursoInstructor = new CursoNegocio(); SPE_OBTIENE_C_CURSO_Result lista = nCursoInstructor.ObtieneCursos(pCursoId).FirstOrDefault(); List <E_CURSO_INSTRUCTOR> vLstCurso = new List <E_CURSO_INSTRUCTOR>(); if (lista.XML_INSTRUCTOR != null & lista.XML_INSTRUCTOR != "") { vLstCurso = XElement.Parse(lista.XML_INSTRUCTOR).Elements("INSTRUCTOR").Select(el => new E_CURSO_INSTRUCTOR { ID_INSTRUCTOR_CURSO = UtilXML.ValorAtributo <int>(el.Attribute("ID_INSTRUCTOR_CURSO")), ID_INSTRUCTOR = UtilXML.ValorAtributo <int>(el.Attribute("ID_INSTRUCTOR")), CL_INSTRUCTOR = UtilXML.ValorAtributo <string>(el.Attribute("CL_INSTRUCTOR")), NB_INSTRUCTOR = UtilXML.ValorAtributo <string>(el.Attribute("NB_INSTRUCTOR")), }).ToList(); } grdCursosInstructor.DataSource = vLstCurso; grdCursosInstructor.Rebind(); List <E_CURSO_COMPETENCIA> vLstCompetencia = new List <E_CURSO_COMPETENCIA>(); if (lista.XML_COMPETENCIAS != null & lista.XML_COMPETENCIAS != "") { vLstCompetencia = XElement.Parse(lista.XML_COMPETENCIAS).Elements("COMPETENCIA").Select(el => new E_CURSO_COMPETENCIA { ID_CURSO_COMPETENCIA = UtilXML.ValorAtributo <int>(el.Attribute("ID_CURSO_COMPETENCIA")), ID_COMPETENCIA = UtilXML.ValorAtributo <int>(el.Attribute("ID_COMPETENCIA")), CL_TIPO_COMPETENCIA = UtilXML.ValorAtributo <string>(el.Attribute("CL_TIPO_COMPETENCIA")), NB_COMPETENCIA = UtilXML.ValorAtributo <string>(el.Attribute("NB_COMPETENCIA")), }).ToList(); } grdCursosCompetencia.DataSource = vLstCompetencia; grdCursosCompetencia.Rebind(); List <E_TEMA> vLstTema = new List <E_TEMA>(); if (lista.XML_TEMAS != null & lista.XML_TEMAS != "") { vLstTema = XElement.Parse(lista.XML_TEMAS).Elements("TEMA").Select(el => new E_TEMA { ID_TEMA = UtilXML.ValorAtributo <int>(el.Attribute("ID_TEMA")), CL_TEMA = UtilXML.ValorAtributo <string>(el.Attribute("CL_TEMA")), NB_TEMA = UtilXML.ValorAtributo <string>(el.Attribute("NB_TEMA")), NO_DURACION = UtilXML.ValorAtributo <string>(el.Attribute("NO_DURACION")) }).ToList(); } grdCursosTema.DataSource = vLstTema; grdCursosTema.Rebind(); } foreach (GridItem item in grdCursos.MasterTableView.Items) { item.Expanded = false; } e.Item.Expanded = i.Expanded; } }
protected void grdInstructores_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { GridDataItem i = (GridDataItem)e.Item; int pInstructorId = int.Parse(i.GetDataKeyValue("ID_INSTRUCTOR").ToString()); if (!i.Expanded) { GridNestedViewItem nestedItem = (GridNestedViewItem)i.ChildItem; RadGrid grdCursosInstructor = (RadGrid)nestedItem.FindControl("grdCursos"); RadGrid grdCompetenciasInstructor = (RadGrid)nestedItem.FindControl("grdCompetencia"); RadGrid grdTelefono = (RadGrid)nestedItem.FindControl("grdTelefono"); //RadTextBox txtEmail = (RadTextBox)nestedItem.FindControl("txtEmail"); System.Web.UI.HtmlControls.HtmlGenericControl txtTblEmail = (System.Web.UI.HtmlControls.HtmlGenericControl)nestedItem.FindControl("txtTblEmail"); InstructorNegocio nInstructorCurso = new InstructorNegocio(); E_INSTRUCTORES lista = nInstructorCurso.ObtieneInstructor(pInstructorId).FirstOrDefault(); List <E_INSTRUCTOR_CURSO> vLstCurso = new List <E_INSTRUCTOR_CURSO>(); if (lista.XML_CURSOS != null & lista.XML_CURSOS != "") { vLstCurso = XElement.Parse(lista.XML_CURSOS).Elements("CURSO").Select(el => new E_INSTRUCTOR_CURSO { ID_INSTRUCTOR_CURSO = UtilXML.ValorAtributo <int>(el.Attribute("ID_INSTRUCTOR_CURSO")), ID_CURSO = UtilXML.ValorAtributo <int>(el.Attribute("ID_CURSO")), CL_CURSO = UtilXML.ValorAtributo <string>(el.Attribute("CL_CURSO")), NB_CURSO = UtilXML.ValorAtributo <string>(el.Attribute("NB_CURSO")), }).ToList(); } grdCursosInstructor.DataSource = vLstCurso; grdCursosInstructor.Rebind(); List <E_INSTRUCTOR_COMPETENCIA> vLstCompetencia = new List <E_INSTRUCTOR_COMPETENCIA>(); if (lista.XML_COMPETENCIAS != null & lista.XML_COMPETENCIAS != "") { vLstCompetencia = XElement.Parse(lista.XML_COMPETENCIAS).Elements("COMPETENCIA").Select(el => new E_INSTRUCTOR_COMPETENCIA { ID_INSTRUCTOR_COMPETENCIA = UtilXML.ValorAtributo <int>(el.Attribute("ID_INSTRUCTOR_COMPETENCIA")), ID_COMPETENCIA = UtilXML.ValorAtributo <int>(el.Attribute("ID_COMPETENCIA")), CL_COMPETENCIA = UtilXML.ValorAtributo <string>(el.Attribute("CL_COMPETENCIA")), NB_COMPETENCIA = UtilXML.ValorAtributo <string>(el.Attribute("NB_COMPETENCIA")), }).ToList(); } grdCompetenciasInstructor.DataSource = vLstCompetencia; grdCompetenciasInstructor.Rebind(); txtTblEmail.InnerText = lista.CL_CORREO_ELECTRONICO; List <E_TIPO_TELEFONO> vLstTipoTelefono = new List <E_TIPO_TELEFONO>(); vLstTipoTelefono = XElement.Parse(lista.XML_NO_TELEFONO_TIPOS).Elements("ITEM").Select(el => new E_TIPO_TELEFONO { NB_TEXTO = UtilXML.ValorAtributo <String>(el.Attribute("NB_TEXTO")), NB_VALOR = UtilXML.ValorAtributo <String>(el.Attribute("NB_VALOR")) }).ToList(); List <E_TELEFONO> vLstTelefono = new List <E_TELEFONO>(); if (lista.XML_TELEFONOS != null & lista.XML_TELEFONOS != "") { vLstTelefono = XElement.Parse(lista.XML_TELEFONOS).Elements("TELEFONO").Select(el => new E_TELEFONO { NB_TELEFONO = UtilXML.ValorAtributo <string>(el.Attribute("NO_TELEFONO")), CL_TIPO = UtilXML.ValorAtributo <string>(el.Attribute("CL_TIPO")), NB_TIPO = (vLstTipoTelefono.FirstOrDefault(f => f.NB_VALOR.Equals(UtilXML.ValorAtributo <string>(el.Attribute("CL_TIPO")))) ?? new E_TIPO_TELEFONO()).NB_TEXTO }).ToList(); } grdTelefono.DataSource = vLstTelefono; grdTelefono.Rebind(); } foreach (GridItem item in grdInstructores.MasterTableView.Items) { item.Expanded = false; } e.Item.Expanded = i.Expanded; } }