void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("StatusID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { //Status Type DropDownList ddl = WTSUtility.CreateGridDropdownList(_dtStatusType, "StatusType", "StatusType", "StatusTypeID", itemId, row.Cells[DCC.IndexOf("StatusTypeID")].Text.Replace(" ", " ").Trim(), row.Cells[DCC.IndexOf("StatusType")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("StatusType")].Controls.Add(ddl); row.Cells[DCC.IndexOf("Status")].Controls.Add(WTSUtility.CreateGridTextBox("Status", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Status")].Text.Trim()))); row.Cells[DCC.IndexOf("DESCRIPTION")].Controls.Add(WTSUtility.CreateGridTextBox("Description", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("DESCRIPTION")].Text.Trim()))); row.Cells[DCC.IndexOf("WorkType_Count")].Controls.Add(createIntersectLink(itemId, row.Cells[DCC.IndexOf("WorkType_Count")].Text.Replace(" ", " ").Trim(), "WorkTypes")); row.Cells[DCC.IndexOf("SORT_ORDER")].Controls.Add(WTSUtility.CreateGridTextBox("Sort_Order", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("SORT_ORDER")].Text.Trim()), true)); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } string dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkItem_Count")].Text).Trim(); int count = 0; if (!CanEdit || !int.TryParse(dependencies, out count) || count > 0) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("Status")].Text.Trim())); } }
private void FormatRowDisplay(ref GridViewRow row) { for (int i = 0; i < row.Cells.Count; i++) { if (DCC[i].ColumnName.Contains("AOREstimation_AORAssocID")) { row.Cells[i].Style["display"] = "none"; } decimal val; bool isNumeric = decimal.TryParse(row.Cells[i].Text, out val); if (isNumeric) { row.Cells[i].Style["text-align"] = "center"; } } string itemId = row.Cells[DCC.IndexOf("AOREstimation_AORAssocID")].Text.Trim(); row.Cells[DCC.IndexOf("Notes")].Controls.Add(WTSUtility.CreateGridTextBox(field: "Notes", itemId: itemId, text: Server.HtmlDecode(row.Cells[DCC.IndexOf("Notes")].Text.Replace(" ", " ").Trim()))); if (DCC.Contains("Deployment")) { row.Cells[DCC.IndexOf("Deployment")].Style["text-align"] = "center"; } if (DCC.Contains("Primary")) { row.Cells[DCC.IndexOf("Primary")].Style["text-align"] = "center"; } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WorkAreaID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { for (int x = 3; x < DCC.Count - 4; x++) { row.Cells[x].Controls.Add(CreateCheckBox(Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkAreaID")].Text.Replace(" ", " ")), Server.HtmlDecode(row.Cells[x].Text))); } row.Cells[DCC.IndexOf("ProposedPriorityRank")].Controls.Add(WTSUtility.CreateGridTextBox("Sort_Order", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("ProposedPriorityRank")].Text.Replace(" ", " ").Trim()), true)); if (row.Cells[DCC.IndexOf("WorkItem_Count")].Text != "0") { row.Cells[DCC.IndexOf("WorkItem_Count")].Controls.Add(CreateLink("Task", itemId, row.Cells[DCC.IndexOf("WorkItem_Count")].Text)); } if (row.Cells[DCC.IndexOf("RQMT_Count")].Text != "0") { row.Cells[DCC.IndexOf("RQMT_Count")].Controls.Add(CreateLink("RQMT", itemId, row.Cells[DCC.IndexOf("RQMT_Count")].Text)); } } }
public override int Execute() { List <System.Net.Mail.Attachment> mailAttachments = null; if (Attachments != null && Attachments.Count > 0) { mailAttachments = new List <Attachment>(); foreach (var att in Attachments) { mailAttachments.Add(new Attachment(new System.IO.MemoryStream(att.Value), att.Key)); } } if (WTSUtility.Send_Email(ToAddresses, CcAddresses, BccAddresses, Subject, Body, FromAddress, FromDisplayName, FormatAsHtml, Priority, mailAttachments, SendCcToSystemEmail)) { return((int)EventStatusEnum.Complete); } else { // TODO: RESCHEDULE THE EMAIL IF FALSE IS RETURNED AND EMAIL LOOKS LEGIT (HAS NO CONFIG ISSUES LIKE MISSING DESTINATION) if ( ((ToAddresses != null && ToAddresses.Count > 0) || (CcAddresses != null && CcAddresses.Count > 0) || (BccAddresses != null && BccAddresses.Count > 0)) && (!string.IsNullOrWhiteSpace(Subject) || !string.IsNullOrWhiteSpace(Body) || (mailAttachments != null && mailAttachments.Count > 0)) && !string.IsNullOrWhiteSpace(FromAddress) ) { EventQueue.Instance.RescheduleEvent(this, DateTime.Now.AddMinutes(60)); } return((int)EventStatusEnum.Error); } }
private void loadWorkRequest() { DataTable dt = WorkRequest.WorkRequest_Get(workRequestID: this.WorkRequestID); if (dt != null && dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; ListItem item = null; this.spanWorkRequestNumber.InnerText = row["WORKREQUESTID"].ToString(); this.txtTitle.Text = row["TITLE"].ToString(); WTSUtility.SelectDdlItem(ddlContract, row["CONTRACTID"].ToString(), row["CONTRACT"].ToString()); WTSUtility.SelectDdlItem(ddlOrganization, row["ORGANIZATIONID"].ToString(), row["ORGANIZATION"].ToString()); textAreaDescription.InnerHtml = row["DESCRIPTION"].ToString(); WTSUtility.SelectDdlItem(ddlRequestType, row["REQUESTTYPEID"].ToString(), row["REQUESTTYPE"].ToString()); WTSUtility.SelectDdlItem(ddlRequestGroup, row["RequestGroupID"].ToString(), row["RequestGroup"].ToString()); WTSUtility.SelectDdlItem(ddlScope, row["WTS_SCOPEID"].ToString(), row["SCOPE"].ToString()); WTSUtility.SelectDdlItem(ddlEffort, row["EFFORTID"].ToString(), row["EFFORT"].ToString()); WTSUtility.SelectDdlItem(ddlSubmittedBy, row["SUBMITTEDBY"].ToString(), row["Submitted_Name"].ToString()); WTSUtility.SelectDdlItem(ddlSME, row["SMEID"].ToString(), row["SME"].ToString()); WTSUtility.SelectDdlItem(ddlLead_IA_TW, row["LEAD_IA_TWID"].ToString(), row["Lead_IA_TW"].ToString()); WTSUtility.SelectDdlItem(ddlLeadResource, row["LEAD_RESOURCEID"].ToString(), row["Lead_Resource"].ToString()); WTSUtility.SelectDdlItem(ddlPriority, row["OP_PRIORITYID"].ToString(), row["PRIORITY"].ToString()); textAreaJustification.InnerHtml = row["JUSTIFICATION"].ToString(); this.labelCreated.Text = row["CREATEDBY"].ToString() + " - " + row["CREATEDDATE"].ToString(); this.labelUpdated.Text = row["UPDATEDBY"].ToString() + " - " + row["UPDATEDDATE"].ToString(); } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); string itemId = row.Cells[DCC.IndexOf("WTS_RESOURCEID")].Text.Trim(); bool isChecked = false; if (row.Cells[DCC.IndexOf("ReceiveSREMail")].HasControls() && row.Cells[DCC.IndexOf("ReceiveSREMail")].Controls[0] is CheckBox) { isChecked = ((CheckBox)row.Cells[DCC.IndexOf("ReceiveSREMail")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ReceiveSREMail")].Text == "1") { isChecked = true; } row.Cells[DCC.IndexOf("ReceiveSREMail")].Controls.Clear(); row.Cells[DCC.IndexOf("ReceiveSREMail")].Controls.Add(WTSUtility.CreateGridCheckBox("ReceiveSREMail", itemId, isChecked)); if (row.Cells[DCC.IndexOf("IncludeInSRCounts")].HasControls() && row.Cells[DCC.IndexOf("IncludeInSRCounts")].Controls[0] is CheckBox) { isChecked = ((CheckBox)row.Cells[DCC.IndexOf("IncludeInSRCounts")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("IncludeInSRCounts")].Text == "1") { isChecked = true; } row.Cells[DCC.IndexOf("IncludeInSRCounts")].Controls.Clear(); row.Cells[DCC.IndexOf("IncludeInSRCounts")].Controls.Add(WTSUtility.CreateGridCheckBox("IncludeInSRCounts", itemId, isChecked)); }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("Narrative_CONTRACTID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); row.Attributes.Add("narrativeID", _narrativeID.ToString()); row.Attributes.Add("productVersionID", _productVersion.ToString()); if (CanEdit) { DropDownList ddl = null; ddl = WTSUtility.CreateGridDropdownList(_dtProductVersion, "ProductVersion", "ProductVersion", "ProductVersionID", itemId, row.Cells[DCC.IndexOf("ProductVersionID")].Text, row.Cells[DCC.IndexOf("ProductVersion")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("ProductVersion")].Controls.Add(ddl); ddl = WTSUtility.CreateGridDropdownList(_dtCONTRACT, "CONTRACT", "CONTRACT", "CONTRACTID", itemId, row.Cells[DCC.IndexOf("CONTRACTID")].Text, row.Cells[DCC.IndexOf("CONTRACT")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("CONTRACT")].Controls.Add(ddl); ddl = WTSUtility.CreateGridDropdownList(_dtWorkloadAllocation, "WorkloadAllocation", "WorkloadAllocation", "WorkloadAllocationID", itemId, row.Cells[DCC.IndexOf("WorkloadAllocationID")].Text.Replace(" ", " ").Trim(), row.Cells[DCC.IndexOf("WorkloadAllocation")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("WorkloadAllocation")].Controls.Add(ddl); ddl = WTSUtility.CreateGridDropdownList(_dtImage, "ImageName", "ImageName", "ImageID", itemId, row.Cells[DCC.IndexOf("ImageID")].Text.Replace(" ", " ").Trim(), row.Cells[DCC.IndexOf("ImageName")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("ImageName")].Controls.Add(ddl); row.Cells[DCC.IndexOf("Narrative")].Controls.Add(WTSUtility.CreateGridTextBox("Narrative", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Narrative")].Text.Replace(" ", " ").Trim()))); row.Cells[DCC.IndexOf("Description")].Controls.Add(WTSUtility.CreateGridTextBox("Description", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Description")].Text.Replace(" ", " ").Trim()), false, true)); DataTable dtSort = new DataTable("dtSort"); dtSort.Columns.Add("Sort"); dtSort.Columns.Add("SortID"); dtSort.Rows.Add("1", "1"); dtSort.Rows.Add("2", "2"); dtSort.Rows.Add("3", "3"); dtSort.Rows.Add("4", "4"); ddl = WTSUtility.CreateGridDropdownList(dtSort, "Sort", "Sort", "SortID", itemId, row.Cells[DCC.IndexOf("Sort")].Text, row.Cells[DCC.IndexOf("Sort")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("Sort")].Controls.Add(ddl); bool archive = false; if (row.Cells[DCC.IndexOf("Archive")].HasControls() && row.Cells[DCC.IndexOf("Archive")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("Archive")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("Archive")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("Archive")].Controls.Clear(); row.Cells[DCC.IndexOf("Archive")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } }
private void printChildRows(DataRow parentRow, Worksheet ws, ref int rowCount, ref DataTable childRaw) { DataTable child = null; int ID = parentRow.Field <int>("WTS_SYSTEM_SUITEID"); child = MasterData.SystemList_Get(); child.DefaultView.RowFilter = "WTS_SystemSuiteID = " + ID; child = child.DefaultView.ToTable(); int i = 0, j = 1; formatChild(child); printChildHeader(ws, ref rowCount, child.Columns); foreach (DataRow row in child.Rows) { WTSUtility.importDataRow(ref childRaw, row); j = 2; foreach (object value in row.ItemArray) { ws.Cells[rowCount + i, j].PutValue(value); j++; } i++; } rowCount += child.Rows.Count; }
private void InitControls() { LoadOrganizations(); LoadAvailableRoles(); WTS_User u = null; if (!IsNew) { LoadUserValues(out u); } else { chkApproved.Visible = false; chkApproved.Disabled = true; labelForChkApproved.Visible = false; chkLocked.Visible = false; chkLocked.Disabled = true; labelForChkLocked.Visible = false; buttonUnlock.Visible = false; buttonUnlock.Disabled = true; chkArchive.Visible = false; chkArchive.Disabled = true; labelForChkArchive.Visible = false; WTSUtility.SelectDdlItem(this.ddlOrganization, ((int)UserManagement.Organization.Unauthorized).ToString()); } if (this.IsUserAdmin) { ddlOrganization.Enabled = true; if (!IsNew) { chkApproved.Disabled = false; if (u.IsLocked) { buttonUnlock.Visible = true; buttonUnlock.Disabled = false; } else { buttonUnlock.Visible = false; buttonUnlock.Disabled = true; } } } else { ddlOrganization.Enabled = false; chkApproved.Disabled = true; chkLocked.Disabled = true; buttonUnlock.Visible = false; chkArchive.Disabled = true; } if (ViewOnly) { DisableEdit(); } }
void gridOrganizations_GridRowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; DataRow dr = ((DataRowView)row.DataItem).Row; row.Attributes.Add("ReportQueueID", Convert.ToString(dr[(int)ColIdx.ReportQueueID])); formatColumnDisplay(ref row); if (Convert.ToBoolean(dr[(int)ColIdx.Download])) { row.Cells[(int)ColIdx.Download].Controls.Add(WTSUtility.CreateGridDownloadHyperLink(Convert.ToString(dr[(int)ColIdx.ReportQueueID]), dr[(int)ColIdx.Name].ToString().Replace("'", ""))); } else { row.Cells[(int)ColIdx.Download].Text = ""; string status = row.Cells[(int)ColIdx.Status].Text; if (status == "Queued") { row.Cells[(int)ColIdx.Download].Text = row.Cells[(int)ColIdx.Status].Text; row.Cells[(int)ColIdx.Download].Style["color"] = "green"; } else if (status == "Executing") { row.Cells[(int)ColIdx.Download].Text = "<img src=\"Images/Loaders/loader.gif\" width=\"16px\" height=\"16px\">"; } else if (status == "Error") { row.Cells[(int)ColIdx.Download].Text = row.Cells[(int)ColIdx.Status].Text; row.Cells[(int)ColIdx.Download].Style["color"] = "red"; } } if (LoggedInUserID == Convert.ToInt64(dr[(int)ColIdx.WTS_RESOURCEID]) || UserCanArchiveReports()) { row.Cells[(int)ColIdx.Archive].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", Convert.ToString(dr[(int)ColIdx.ReportQueueID]), Convert.ToBoolean(dr[(int)ColIdx.Archive]))); } else { row.Cells[(int)ColIdx.Archive].Text = ""; } if (LoggedInUserID == Convert.ToInt64(dr[(int)ColIdx.WTS_RESOURCEID]) || UserCanDeleteReports()) { string cleanName = dr[(int)ColIdx.Name].ToString().Replace("'", ""); string reportQueueID = Convert.ToString(dr[(int)ColIdx.ReportQueueID]); if (Convert.ToBoolean(dr[(int)ColIdx.Download])) { row.Cells[(int)ColIdx.Delete].Controls.Add(WTSUtility.CreateGridImageButton(reportQueueID, cleanName, "imgmailreport_" + reportQueueID, "Images/Icons/email.png", 0, "imgMail_click(" + reportQueueID + ", '" + cleanName + "')", "Email Report " + cleanName, "Email Report " + cleanName, "padding-right:5px;cursor:pointer;")); } row.Cells[(int)ColIdx.Delete].Controls.Add(WTSUtility.CreateGridDeleteButton(reportQueueID, cleanName, 0, "Images/Icons/cross.png")); } else { row.Cells[(int)ColIdx.Delete].Text = ""; } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WorkType_WTS_RESOURCEID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { string selectedId = row.Cells[DCC.IndexOf("WTS_RESOURCEID")].Text; string selectedText = row.Cells[DCC.IndexOf("USERNAME")].Text; if (selectedId == "0") { selectedId = _dtResource.Rows[0]["WTS_RESOURCEID"].ToString(); } if (itemId != "0") { row.Cells[DCC.IndexOf("X")].Controls.Add(CreateCheckBox(itemId)); } DropDownList ddl = null; ddl = WTSUtility.CreateGridDropdownList(_dtResource, "USERNAME", "USERNAME", "WTS_RESOURCEID", itemId, selectedId, selectedText, null); row.Cells[DCC.IndexOf("USERNAME")].Controls.Add(ddl); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } if (!CanEdit) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("PriorityID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanEdit) { row.Cells[DCC.IndexOf("PriorityType")].Controls.Add(createDDL(DtPT, "PriorityType", "PriorityTypeID", itemId, row.Cells[DCC.IndexOf("PriorityTypeID")].Text.Trim(), row.Cells[DCC.IndexOf("PriorityType")].Text.Trim())); row.Cells[DCC.IndexOf("Priority")].Controls.Add(WTSUtility.CreateGridTextBox("Priority", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Priority")].Text.Trim()))); row.Cells[DCC.IndexOf("DESCRIPTION")].Controls.Add(WTSUtility.CreateGridTextBox("Description", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("DESCRIPTION")].Text.Trim()))); row.Cells[DCC.IndexOf("SORT_ORDER")].Controls.Add(WTSUtility.CreateGridTextBox("Sort_Order", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("SORT_ORDER")].Text.Trim()), true)); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } string wrDependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkRequest_Count")].Text).Trim(); string wiDependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkItem_Count")].Text).Trim(); int count = 0; if (!CanEdit || (int.TryParse(wiDependencies, out count) && count > 0) || int.TryParse(wrDependencies, out count) && count > 0) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("Priority")].Text.Trim())); } }
private void initControls() { grdRequest.GridHeaderRowDataBound += grdRequest_GridHeaderRowDataBound; grdRequest.GridRowDataBound += grdRequest_GridRowDataBound; grdRequest.GridPageIndexChanging += grdRequest_GridPageIndexChanging; WTSUtility.SelectDdlItem(ddlView, this.MyView.ToString()); }
private DropDownList CreateDropDownList(string typeName, string typeID , DataTable dt, string field , string textField, string valueField , string value, string text = "" , List <string> attributes = null) { DropDownList ddl = new DropDownList(); textField = Server.HtmlDecode(textField).Trim(); valueField = Server.HtmlDecode(valueField).Trim(); value = Server.HtmlDecode(value).Trim(); text = Server.HtmlDecode(text).Trim(); ddl.Width = new Unit(95, UnitType.Percentage); ddl.Attributes["class"] = "saveable"; ddl.Attributes["onchange"] = "input_change(this);"; ddl.Attributes.Add("typeName", typeName); ddl.Attributes.Add("typeID", typeID); ddl.Attributes.Add("field", field); ddl.Attributes.Add("original_value", value); ddl.Style["background-color"] = "#F5F6CE"; if (dt == null) { return(ddl); } ListItem item = null; foreach (DataRow row in dt.Rows) { item = new ListItem(); item.Text = row[textField].ToString(); item.Value = row[valueField].ToString(); if (attributes != null && attributes.Count > 0) { foreach (string key in attributes) { item.Attributes.Add(key.Trim(), key.Trim()); } } if (ddl.Items.FindByValue(item.Value) == null) { ddl.Items.Add(item); } } WTSUtility.SelectDdlItem(ddl, string.IsNullOrWhiteSpace(value) ? "0" : value, text); if (searchMode) { ddl.Attributes["disabled"] = "1"; } return(ddl); }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WORKITEMTYPE_StatusID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { string selectedId = row.Cells[DCC.IndexOf("STATUSID")].Text; string selectedText = row.Cells[DCC.IndexOf("STATUS")].Text; DropDownList ddl = null; ddl = WTSUtility.CreateGridDropdownList(_dtStatus, "STATUS", "STATUS", "STATUSID", itemId, selectedId, selectedText, null); ddl.Enabled = (_qfWorkItemTypeID == 0); row.Cells[DCC.IndexOf("STATUS")].Controls.Add(ddl); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } if (!CanEdit) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("WORKITEMTYPE_StatusID")].Text.Trim())); } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { _columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("EffortArea_SizeID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { DropDownList ddl = WTSUtility.CreateGridDropdownList(dt: _dtEffortArea, field: "EffortArea", textField: "EffortArea", valueField: "EffortAreaID", itemId: itemId, value: row.Cells[DCC.IndexOf("EffortAreaID")].Text, text: row.Cells[DCC.IndexOf("EffortArea")].Text, attributes: null); if (this._qfEffortAreaID != 0) { ddl.Enabled = false; } row.Cells[DCC.IndexOf("EffortArea")].Controls.Add(ddl); ddl = WTSUtility.CreateGridDropdownList(dt: _dtEffortSize, field: "EffortSize", textField: "EffortSize", valueField: "EffortSizeID", itemId: itemId, value: row.Cells[DCC.IndexOf("EffortSizeID")].Text, text: row.Cells[DCC.IndexOf("EffortSize")].Text, attributes: null); if (this._qfEffortSizeID != 0) { ddl.Enabled = false; } row.Cells[DCC.IndexOf("EffortSize")].Controls.Add(ddl); row.Cells[DCC.IndexOf("Description")].Controls.Add(WTSUtility.CreateGridTextBox(field: "Description", itemId: itemId, text: Server.HtmlDecode(row.Cells[DCC.IndexOf("Description")].Text.Replace(" ", " ").Trim()))); row.Cells[DCC.IndexOf("MinValue")].Controls.Add(WTSUtility.CreateGridTextBox(field: "MinValue", itemId: itemId, text: row.Cells[DCC.IndexOf("MinValue")].Text, isNumber: true)); row.Cells[DCC.IndexOf("MaxValue")].Controls.Add(WTSUtility.CreateGridTextBox(field: "MaxValue", itemId: itemId, text: row.Cells[DCC.IndexOf("MaxValue")].Text, isNumber: true)); row.Cells[DCC.IndexOf("Unit")].Controls.Add(WTSUtility.CreateGridTextBox(field: "Unit", itemId: itemId, text: row.Cells[DCC.IndexOf("Unit")].Text, isNumber: false)); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } if (CanEdit) { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("EffortArea")].Text.Trim())); } }
void grdCerts_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); string itemId = row.Cells[DCC.IndexOf("Resource_CertificationID")].Text.Trim(); row.Attributes.Add("itemID", itemId); if (CanView) { //add textboxes row.Cells[DCC.IndexOf("Resource_Certification")].Controls.Add(WTSUtility.CreateGridTextBox("Resource_Certification", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Resource_Certification")].Text.Trim()))); row.Cells[DCC.IndexOf("Description")].Controls.Add(WTSUtility.CreateGridTextBox("Description", itemId, row.Cells[DCC.IndexOf("Description")].Text.Replace(" ", " ").Trim())); TextBox txt = WTSUtility.CreateGridTextBox("Expiration", itemId, row.Cells[DCC.IndexOf("Expiration_Date")].Text.Replace(" ", "").Trim()); txt.Attributes.Add("date", "true"); txt.Style["width"] = "80px"; txt.CssClass = "date"; row.Cells[DCC.IndexOf("Expiration_Date")].Style["vertical-align"] = "bottom"; row.Cells[DCC.IndexOf("Expiration_Date")].Controls.Add(txt); bool expired = false; if (row.Cells[DCC.IndexOf("Expired")].HasControls() && row.Cells[DCC.IndexOf("Expired")].Controls[0] is CheckBox) { expired = ((CheckBox)row.Cells[DCC.IndexOf("Expired")].Controls[0]).Checked; } row.Cells[DCC.IndexOf("Expired")].Controls.Clear(); row.Cells[DCC.IndexOf("Expired")].Controls.Add(WTSUtility.CreateGridCheckBox("Expired", itemId, expired)); } if (!CanEdit) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "../Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("Resource_Certification")].Text.Trim(), 1)); } if (itemId == "0") { row.Style["display"] = "none"; } }
void grdHardware_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); string itemId = row.Cells[DCC.IndexOf("WTS_Resource_HardwareID")].Text.Trim(); row.Attributes.Add("itemID", itemId); if (CanEdit) { //add edit controls row.Cells[DCC.IndexOf("HardwareType")].Controls.Add(createDDL(DtHT, "HardwareType", "HardwareTypeID", itemId, row.Cells[DCC.IndexOf("HardwareTypeID")].Text.Trim(), row.Cells[DCC.IndexOf("HardwareType")].Text.Trim())); row.Cells[DCC.IndexOf("DeviceName")].Controls.Add(WTSUtility.CreateGridTextBox("DeviceName", itemId, row.Cells[DCC.IndexOf("DeviceName")].Text.Replace(" ", " ").Trim())); row.Cells[DCC.IndexOf("DeviceSN_Tag")].Controls.Add(WTSUtility.CreateGridTextBox("DeviceSN_Tag", itemId, row.Cells[DCC.IndexOf("DeviceSN_Tag")].Text.Replace(" ", " ").Trim())); row.Cells[DCC.IndexOf("Description")].Controls.Add(WTSUtility.CreateGridTextBox("Description", itemId, row.Cells[DCC.IndexOf("Description")].Text.Replace(" ", " ").Trim())); bool hasDevice = false; if (row.Cells[DCC.IndexOf("HasDevice")].HasControls() && row.Cells[DCC.IndexOf("HasDevice")].Controls[0] is CheckBox) { hasDevice = ((CheckBox)row.Cells[DCC.IndexOf("HasDevice")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("HasDevice")].Text == "1") { hasDevice = true; } row.Cells[DCC.IndexOf("HasDevice")].Controls.Clear(); row.Cells[DCC.IndexOf("HasDevice")].Controls.Add(WTSUtility.CreateGridCheckBox("HasDevice", itemId, hasDevice)); row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("DeviceName")].Text.Trim(), 1)); } else { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "../Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } if (itemId == "0") { row.Style["display"] = "none"; } }
private void exportExcel(DataTable dt) { DataTable copydt = dt.Copy(); formatParent(ref copydt); String strName = "Master Grid - Allocation Group"; Workbook wb = new Workbook(FileFormatType.Xlsx); wb.Worksheets.Add(); MemoryStream ms = new MemoryStream(); Worksheet ws = wb.Worksheets[1]; ws.Name = "Allocation Group"; Worksheet wsRaw = wb.Worksheets[0]; wsRaw.Name = "Allocation Group Raw"; int rowCount = 0; DataTable Raw = null, parentRaw = null, childRaw = null; foreach (DataRow parentRow in copydt.Rows) { if (parentRow.Field <int>("ALLOCATIONGROUPID") != 0) { WTSUtility.importDataRow(ref parentRaw, parentRow); printParentHeader(ws, ref rowCount, copydt.Columns); printParent(parentRow, ws, ref rowCount); rowCount++; printChildRows(parentRow, ws, ref rowCount, ref childRaw); rowCount++; } } Raw = WTSUtility.JoinDataTables(parentRaw, childRaw, (row1, row2) => row1.Field <string>("ALLOCATIONGROUPID") == row2.Field <string>("Group ID")); formatRaw(Raw); ws.Cells.DeleteColumn(0); ws.AutoFitColumns(); wsRaw.Cells.ImportDataTable(Raw, true, "A1"); wsRaw.AutoFitColumns(); wb.Save(ms, SaveFormat.Xlsx); Response.BufferOutput = true; Response.ContentType = "application/xlsx"; Response.AddHeader("content-disposition", "attachment; filename=" + strName + ".xlsx"); Response.BinaryWrite(ms.ToArray()); Response.End(); }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WTS_RESOURCEID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { string selectedId = row.Cells[DCC.IndexOf("WTS_RESOURCEID")].Text; string selectedText = Server.HtmlDecode(row.Cells[DCC.IndexOf("USERNAME")].Text); DropDownList ddl = null; ddl = WTSUtility.CreateGridDropdownList(_dtResource, "USERNAME", "USERNAME", "WTS_RESOURCEID", itemId, selectedId, selectedText, null); row.Cells[DCC.IndexOf("USERNAME")].Controls.Add(ddl); bool actionTeam = false; if (row.Cells[DCC.IndexOf("ActionTeam")].HasControls() && row.Cells[DCC.IndexOf("ActionTeam")].Controls[0] is CheckBox) { actionTeam = ((CheckBox)row.Cells[DCC.IndexOf("ActionTeam")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ActionTeam")].Text == "1") { actionTeam = true; } row.Cells[DCC.IndexOf("ActionTeam")].Controls.Clear(); row.Cells[DCC.IndexOf("ActionTeam")].Controls.Add(CreateCheckBox(Server.HtmlDecode(row.Cells[DCC.IndexOf("WTS_RESOURCEID")].Text.Replace(" ", " ")), actionTeam ? "1" : "0")); for (int x = 7; x < row.Cells.Count - 1; x++) { row.Cells[x].Controls.Add(CreateCheckBox(Server.HtmlDecode(row.Cells[DCC.IndexOf("WTS_RESOURCEID")].Text.Replace(" ", " ")), Server.HtmlDecode(row.Cells[x].Text))); } } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("AORReleaseDeliverable_ID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); row.Attributes.Add("aorid", row.Cells[DCC.IndexOf("AOR #")].Text.Trim()); row.Attributes.Add("aorreleaseid", row.Cells[DCC.IndexOf("AORRelease_ID")].Text.Trim()); if (CanEdit) { TextBox txt = WTSUtility.CreateGridTextBox("Weight", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Weight")].Text.Replace(" ", " ").Trim()), true); txt.MaxLength = 3; row.Cells[DCC.IndexOf("Weight")].Controls.Add(txt); } string risk = row.Cells[DCC.IndexOf("Risk")].Text; if (risk.Contains("High")) row.Cells[DCC.IndexOf("Risk")].Style["background-color"] = "red"; else if (risk.Contains("Moderate")) row.Cells[DCC.IndexOf("Risk")].Style["background-color"] = "yellow"; else row.Cells[DCC.IndexOf("Risk")].Style["background-color"] = "limegreen"; if (this.CanViewAOR) { row.Cells[DCC.IndexOf("AOR #")].Style["text-align"] = "center"; row.Cells[DCC.IndexOf("AOR #")].Controls.Add(CreateLink(row.Cells[DCC.IndexOf("AOR #")].Text, row.Cells[DCC.IndexOf("AORRelease_ID")].Text)); } row.Cells[DCC.IndexOf("Avg. Resources")].Style["text-align"] = "center"; //add Total row to top of grid (as part of header to keep fixed) if (row.RowIndex == 0 && hasData) { FixedTotalRow(row); } }
DropDownList createDDL(DataTable dt, string textField, string valueField, string itemId, string value, string text = "") { DropDownList ddl = new DropDownList(); ddl.ID = string.Format("txt{0}_{1}", textField.Trim().Replace(" ", ""), itemId); ddl.Attributes["name"] = ddl.ID; ddl.Attributes.Add("itemId", itemId); ddl.Attributes.Add("original_value", value.Replace(" ", "")); ddl.Style["width"] = "99%"; ddl.Style["background-color"] = "#F5F6CE"; ddl.DataSource = dt; ddl.DataTextField = textField; ddl.DataValueField = valueField; ddl.DataBind(); WTSUtility.SelectDdlItem(ddl, value, text); return(ddl); }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { _columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("AOREstimationID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { row.Cells[DCC.IndexOf("AOREstimationName")].Controls.Add(WTSUtility.CreateGridTextBox(field: "AOREstimationName", itemId: itemId, text: Server.HtmlDecode(row.Cells[DCC.IndexOf("AOREstimationName")].Text.Replace(" ", " ").Trim()))); row.Cells[DCC.IndexOf("Description")].Controls.Add(WTSUtility.CreateGridTextBox(field: "Description", itemId: itemId, text: Server.HtmlDecode(row.Cells[DCC.IndexOf("Description")].Text.Replace(" ", " ").Trim()))); row.Cells[DCC.IndexOf("Notes")].Controls.Add(WTSUtility.CreateGridTextBox(field: "Notes", itemId: itemId, text: Server.HtmlDecode(row.Cells[DCC.IndexOf("Notes")].Text.Replace(" ", " ").Trim()))); //bool archive = false; //if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() // && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) //{ // archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; //} //else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") //{ // archive = true; //} //row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); //row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } if (CanEdit) { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("AOREstimationName")].Text.Trim())); } }
private void loadGridData() { _dtUser = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: ""); Page.ClientScript.RegisterArrayDeclaration("_userList", JsonConvert.SerializeObject(_dtUser, Newtonsoft.Json.Formatting.None)); _dtAllocation_Unused = MasterData.Allocation_Get_All_Unused(); Page.ClientScript.RegisterArrayDeclaration("_Allocation_Unused", JsonConvert.SerializeObject(_dtAllocation_Unused, Newtonsoft.Json.Formatting.None)); DataTable dt = null; if (_refreshData || Session["AllocationGroup_Assignment"] == null) { dt = MasterData.AllocationGroup_Assignment_Get(this._qfWorkAreaID); HttpContext.Current.Session["AllocationGroup_Assignment"] = dt; } else { dt = (DataTable)HttpContext.Current.Session["AllocationGroup_Assignment"]; } if (dt != null) { this.DCC = dt.Columns; Page.ClientScript.RegisterArrayDeclaration("_dcc", JsonConvert.SerializeObject(DCC, Newtonsoft.Json.Formatting.None)); spanRowCount.InnerText = dt.Rows.Count.ToString(); InitializeColumnData(ref dt); dt.AcceptChanges(); iti_Tools_Sharp.DynamicHeader head = WTSUtility.CreateGridMultiHeader(dt); if (head != null) { grdMD.DynamicHeader = head; } int count = dt.Rows.Count; count = count > 0 ? count - 1 : count; spanRowCount.InnerText = count.ToString(); } grdMD.DataSource = dt; grdMD.DataBind(); }
private void printChildRows(DataRow parentRow, Worksheet ws, ref int rowCount, ref DataTable childRaw) { DataTable child = null; int ID = parentRow.Field<int>("ALLOCATIONID"); child = MasterData.Allocation_SystemList_Get(allocationID: ID); int i = 0, j = 1; formatChild(child); printChildHeader(ws, ref rowCount, child.Columns); foreach (DataRow row in child.Rows) { WTSUtility.importDataRow(ref childRaw, row); j = 2; foreach (object value in row.ItemArray) { ws.Cells[rowCount + i, j].PutValue(value); j++; } i++; } rowCount += child.Rows.Count; }
private void LoadUserValues(out WTS_User u) { u = new WTS_User(); MembershipUser mu; if (this.IsCurrentUser) { u = _loggedInUser; mu = _loggedInMembershipUser; LoadUserRoles(mu); } else { u.Load(this.UserId); if (!string.IsNullOrWhiteSpace(u.Membership_UserID) && u.Membership_UserID != Guid.Empty.ToString()) { mu = Membership.GetUser(new Guid(u.Membership_UserID)); LoadUserRoles(mu); } else { mu = UserManagement.GetMembershipUser(u.Email, u.Username); if (mu != null) { u.Membership_UserID = mu.ProviderUserKey.ToString(); LoadUserRoles(mu); } } } this.MembershipUserId = u.Membership_UserID; if (ddlOrganization.Items.FindByValue(u.OrganizationID.ToString()) == null) { ddlOrganization.Items.Add(new ListItem(u.Organization, u.OrganizationID.ToString())); } WTSUtility.SelectDdlItem(ddlOrganization, u.OrganizationID.ToString()); chkApproved.Checked = u.IsApproved; chkLocked.Checked = u.IsLocked; chkArchive.Checked = u.Archive; }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("ALLOCATIONID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { row.Cells[DCC.IndexOf("X")].Controls.Clear(); row.Cells[DCC.IndexOf("X")].Controls.Add(WTSUtility.CreateGridCheckBox("X", itemId, false)); } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WTS_SYSTEM_SUITEID")].Text.Trim(); if (itemId == "-1") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { row.Cells[DCC.IndexOf("WTS_SYSTEM_SUITE")].Controls.Add(WTSUtility.CreateGridTextBox("WTS_SYSTEM_SUITE", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("WTS_SYSTEM_SUITE")].Text.Trim()))); row.Cells[DCC.IndexOf("DESCRIPTION")].Controls.Add(WTSUtility.CreateGridTextBox("DESCRIPTION", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("DESCRIPTION")].Text.Trim()))); row.Cells[DCC.IndexOf("Abbreviation")].Controls.Add(WTSUtility.CreateGridTextBox("Abbreviation", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Abbreviation")].Text.Trim()).Trim(), false, false, 4)); if (DCC.IndexOf("System Review") > 0) { row.Cells[DCC.IndexOf("System Review")].Controls.Add(new LiteralControl(row.Cells[DCC.IndexOf("System Review")].Text + " ")); } if (DCC.IndexOf("System Review") > 0) { row.Cells[DCC.IndexOf("System Review")].Controls.Add(CreateLink("ReviewSystem", row.Cells[DCC.IndexOf("WTS_SYSTEM_SUITEID")].Text)); } if (DCC.IndexOf("Resource Review") > 0) { row.Cells[DCC.IndexOf("Resource Review")].Controls.Add(new LiteralControl(row.Cells[DCC.IndexOf("Resource Review")].Text + " ")); } if (DCC.IndexOf("Resource Review") > 0) { row.Cells[DCC.IndexOf("Resource Review")].Controls.Add(CreateLink("ReviewResource", row.Cells[DCC.IndexOf("WTS_SYSTEM_SUITEID")].Text)); } row.Cells[DCC.IndexOf("SORTORDER")].Controls.Add(WTSUtility.CreateGridTextBox("SORTORDER", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("SORTORDER")].Text.Trim()), true)); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } string dependencies; int count = 0; if (ddlChildView.SelectedValue == "0") { dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("System_Count")].Text).Trim(); int.TryParse(dependencies, out count); } else if (ddlChildView.SelectedValue == "1") { dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkArea_Count")].Text).Trim(); int.TryParse(dependencies, out count); } else if (ddlChildView.SelectedValue == "2") { dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("Resource_Count")].Text).Trim(); int.TryParse(dependencies, out count); } else if (ddlChildView.SelectedValue == "3") { dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkActivity_Count")].Text).Trim(); int.TryParse(dependencies, out count); } if (!string.IsNullOrEmpty(itemId) && itemId != "0") { //add expand/collapse buttons HtmlGenericControl divChildren = new HtmlGenericControl(); divChildren.Style["display"] = "table-row"; divChildren.Style["text-align"] = "right"; HtmlGenericControl divChildrenButtons = new HtmlGenericControl(); divChildrenButtons.Style["display"] = "table-cell"; divChildrenButtons.Controls.Add(createShowHideButton(true, "Show", itemId)); divChildrenButtons.Controls.Add(createShowHideButton(false, "Hide", itemId)); HtmlGenericControl divChildCount = new HtmlGenericControl(); divChildCount.InnerText = string.Format("({0})", count.ToString()); divChildCount.Style["display"] = "table-cell"; divChildCount.Style["padding-left"] = "2px"; divChildren.Controls.Add(divChildrenButtons); divChildren.Controls.Add(divChildCount); //buttons to show/hide child grid row.Cells[DCC["X"].Ordinal].Controls.Clear(); row.Cells[DCC["X"].Ordinal].Controls.Add(divChildren); //add child grid row for Task Items Table table = (Table)row.Parent; GridViewRow childRow = createChildRow(itemId); table.Rows.AddAt(table.Rows.Count, childRow); } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("WorkType_ORGANIZATIONID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { string selectedId = row.Cells[DCC.IndexOf("WorkTypeID")].Text; string selectedText = row.Cells[DCC.IndexOf("WorkType")].Text; if (itemId == "0" && _qfWorkTypeID != 0) { selectedId = _qfWorkTypeID.ToString(); selectedText = string.Empty; } DropDownList ddl = null; ddl = WTSUtility.CreateGridDropdownList(_dtWorkType, "WorkType", "WorkType", "WorkTypeID", itemId, selectedId, selectedText, null); ddl.Enabled = (_qfWorkTypeID == 0); row.Cells[DCC.IndexOf("WorkType")].Controls.Add(ddl); selectedId = row.Cells[DCC.IndexOf("ORGANIZATIONID")].Text; selectedText = row.Cells[DCC.IndexOf("ORGANIZATION")].Text.Replace(" ", ""); if (itemId == "0" && _qfWorkTypeID != 0) { selectedId = _dtOrganization.Rows[0]["ORGANIZATIONID"].ToString(); selectedText = _dtOrganization.Rows[0]["ORGANIZATION"].ToString(); } ddl = WTSUtility.CreateGridDropdownList(_dtOrganization, "ORGANIZATION", "ORGANIZATION", "ORGANIZATIONID", itemId, selectedId, selectedText, null); row.Cells[DCC.IndexOf("ORGANIZATION")].Controls.Add(ddl); bool archive = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { archive = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { archive = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, archive)); } //string dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkItem_Count")].Text).Trim(); //int count = 0; if (!CanEdit) //|| !int.TryParse(dependencies, out count) //|| count > 0) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("ORGANIZATION")].Text.Trim() + " - " + row.Cells[DCC.IndexOf("WorkType")].Text.Trim())); } }
void grdMD_GridRowDataBound(object sender, GridViewRowEventArgs e) { columnData.SetupGridBody(e.Row); GridViewRow row = e.Row; formatColumnDisplay(ref row); //add edit link string itemId = row.Cells[DCC.IndexOf("ProductVersionID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } row.Attributes.Add("itemID", itemId); if (CanView) { bool chked = false; row.Cells[DCC.IndexOf("ProductVersion")].Controls.Add(WTSUtility.CreateGridTextBox("ProductVersion", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("ProductVersion")].Text.Replace(" ", " ").Trim()))); row.Cells[DCC.IndexOf("DESCRIPTION")].Controls.Add(WTSUtility.CreateGridTextBox("Description", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("DESCRIPTION")].Text.Replace(" ", " ").Trim()))); row.Cells[DCC.IndexOf("SORT_ORDER")].Controls.Add(WTSUtility.CreateGridTextBox("Sort_Order", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("SORT_ORDER")].Text.Replace(" ", " ").Trim()), true)); DateTime nDate = new DateTime(); DateTime.TryParse(Server.HtmlDecode(row.Cells[DCC.IndexOf("StartDate")].Text.Replace(" ", " ").Trim()), out nDate); row.Cells[DCC.IndexOf("StartDate")].Controls.Add(WTSUtility.CreateGridTextBox("StartDate", itemId, nDate.ToString() == "1/1/0001 12:00:00 AM" ? "" : Server.HtmlDecode(String.Format("{0:MM/dd/yyyy}", nDate)))); DateTime.TryParse(Server.HtmlDecode(row.Cells[DCC.IndexOf("EndDate")].Text.Replace(" ", " ").Trim()), out nDate); row.Cells[DCC.IndexOf("EndDate")].Controls.Add(WTSUtility.CreateGridTextBox("EndDate", itemId, nDate.ToString() == "1/1/0001 12:00:00 AM" ? "" : Server.HtmlDecode(String.Format("{0:MM/dd/yyyy}", nDate)))); if (row.Cells[DCC.IndexOf("DefaultSelection")].HasControls() && row.Cells[DCC.IndexOf("DefaultSelection")].Controls[0] is CheckBox) { chked = ((CheckBox)row.Cells[DCC.IndexOf("DefaultSelection")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("DefaultSelection")].Text == "1") { chked = true; } row.Cells[DCC.IndexOf("DefaultSelection")].Controls.Clear(); row.Cells[DCC.IndexOf("DefaultSelection")].Controls.Add(WTSUtility.CreateGridCheckBox("DefaultSelection", itemId, chked)); //Status DropDownList ddl = WTSUtility.CreateGridDropdownList(_dtStatus, "Status", "Status", "StatusID", itemId, row.Cells[DCC.IndexOf("StatusID")].Text.Replace(" ", " ").Trim(), row.Cells[DCC.IndexOf("Status")].Text.Replace(" ", " ").Trim(), null); row.Cells[DCC.IndexOf("Status")].Controls.Add(ddl); chked = false; if (row.Cells[DCC.IndexOf("ARCHIVE")].HasControls() && row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0] is CheckBox) { chked = ((CheckBox)row.Cells[DCC.IndexOf("ARCHIVE")].Controls[0]).Checked; } else if (row.Cells[DCC.IndexOf("ARCHIVE")].Text == "1") { chked = true; } row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Clear(); row.Cells[DCC.IndexOf("ARCHIVE")].Controls.Add(WTSUtility.CreateGridCheckBox("Archive", itemId, chked)); //chked = false; //if (row.Cells[DCC.IndexOf("INCLUDEINHOTLIST")].HasControls() // && row.Cells[DCC.IndexOf("INCLUDEINHOTLIST")].Controls[0] is CheckBox) //{ // chked = ((CheckBox)row.Cells[DCC.IndexOf("INCLUDEINHOTLIST")].Controls[0]).Checked; //} //else if (row.Cells[DCC.IndexOf("INCLUDEINHOTLIST")].Text == "1") //{ // chked = true; //} //row.Cells[DCC.IndexOf("INCLUDEINHOTLIST")].Controls.Clear(); //row.Cells[DCC.IndexOf("INCLUDEINHOTLIST")].Controls.Add(WTSUtility.CreateGridCheckBox("Include In Hot List", itemId, chked)); } TextBox obj = WTSUtility.CreateGridTextBox("Narrative", itemId, Server.HtmlDecode(row.Cells[DCC.IndexOf("Narrative")].Text.Replace(" ", " ").Trim()), false, true); if (!CanView) { obj.ReadOnly = true; obj.ForeColor = System.Drawing.Color.Gray; } row.Cells[DCC.IndexOf("Narrative")].Controls.Add(obj); string dependencies = Server.HtmlDecode(row.Cells[DCC.IndexOf("WorkItem_Count")].Text).Trim(); int count = 0; if (!CanEdit || !int.TryParse(dependencies, out count) || count > 0) { Image imgBlank = new Image(); imgBlank.Height = 10; imgBlank.Width = 10; imgBlank.ImageUrl = "Images/Icons/blank.png"; imgBlank.AlternateText = ""; row.Cells[DCC["X"].Ordinal].Controls.Add(imgBlank); } else { row.Cells[DCC["X"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId, row.Cells[DCC.IndexOf("ProductVersion")].Text.Trim())); } if (!string.IsNullOrEmpty(itemId) && itemId != "0") { //add expand/collapse buttons HtmlGenericControl divChildren = new HtmlGenericControl(); divChildren.Style["display"] = "table-row"; divChildren.Style["text-align"] = "right"; HtmlGenericControl divChildrenButtons = new HtmlGenericControl(); divChildrenButtons.Style["display"] = "table-cell"; divChildrenButtons.Controls.Add(createShowHideButton(true, "Show", itemId)); divChildrenButtons.Controls.Add(createShowHideButton(false, "Hide", itemId)); HtmlGenericControl divChildCount = new HtmlGenericControl(); divChildCount.InnerText = string.Format("({0})", row.Cells[DCC.IndexOf("Session_Count")].Text); divChildCount.Style["display"] = "table-cell"; divChildCount.Style["padding-left"] = "2px"; divChildren.Controls.Add(divChildrenButtons); divChildren.Controls.Add(divChildCount); //buttons to show/hide child grid row.Cells[DCC["Z"].Ordinal].Controls.Clear(); row.Cells[DCC["Z"].Ordinal].Controls.Add(divChildren); //add child grid row for Task Items Table table = (Table)row.Parent; GridViewRow childRow = createChildRow(itemId); table.Rows.AddAt(table.Rows.Count, childRow); } }