public bool showTicket(TextBlock tbNote, string ticketNumber) { SDTicket.RequestLongForm ticketInfo = SDTicket.getServiceTicketEntry(ticketNumber); if (ticketInfo != null) { tbNote.Inlines.Clear(); tbNote.Inlines.Add(new Run("Category: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.CATEGORY + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("By: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.CREATEDBY + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("Time: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.CREATEDTIME + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("Dept: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.DEPARTMENT + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("Requester: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.REQUESTER + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("E-Mail: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.REQUESTEREMAIL + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("Subject: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.SUBJECT + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("Desc: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.SHORTDESCRIPTION.TrimStart().Replace(" ", " ") + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); tbNote.Inlines.Add(new Run("Technician: ") { FontWeight = FontWeights.Bold }); tbNote.Inlines.Add(new Run(ticketInfo.TECHNICIAN + Environment.NewLine) { Foreground = Brushes.MidnightBlue }); return(true); } else { tbNote.Inlines.Clear(); tbNote.Inlines.Add(new Run("Unable to find ticket") { FontWeight = FontWeights.Bold }); return(false); // MarkTicketAsBad(ticketNumber); } }
public void Load() { DataTable dtCategories = new DataTable(); dtCategories.Columns.Add("Name"); sdCategories = SDTicket.readCategorySubcategoryAndItem(); foreach (var cat in sdCategories.operation.Details) { dtCategories.Rows.Add(cat.NAME); } dgCat.ItemsSource = dtCategories.DefaultView; /* * txtMessage.Text = ""; * * sdCategories = sdCat; * taskID = id; * parent = p; * serviceID = ServiceID; * * DataTable dtCategories = new DataTable(); * dtCategories.Columns.Add("Name"); * * foreach (var cat in sdCategories.operation.Details) * dtCategories.Rows.Add(cat.NAME); * dgCat.ItemsSource = dtCategories.DefaultView; * * dgSubCat.ItemsSource = null; * dgItem.ItemsSource = null; * dgSLA.ItemsSource = parent.dtSLA.DefaultView; * * if (id != "") * { * lblTitle.Text = "Edit Task"; * foreach (DataRow dr in dtTasks.Rows) * { * if (dr["TaskID"].ToString() == id) * { * txtName.Text = dr["Name"].ToString(); * rectBiz.Opacity = (dr["ForBusinessAssoc"].ToString() == "True") ? 1d : 0.2d; * rectOps.Opacity = (dr["ForOperationsAssoc"].ToString() == "True") ? 1d : 0.2d; * rectIT.Opacity = (dr["ForITAssoc"].ToString() == "True") ? 1d : 0.2d; * * string cat = dr["ServiceDeskCategory"].ToString(); * string sub = dr["ServiceDeskSubCategory"].ToString(); * string item = dr["ServiceDeskItem"].ToString(); * * txtDescription.Text = dr["Description"].ToString(); * * setDataGridByColumn(dgSLA, "ServiceLevelAgreementID", dr["ServiceLevelAgreementID"].ToString()); * * if (cat != "") * { * if (setDataGridToValue(dgCat, cat) == false) * { * txtMessage.Text = "Category \"" + cat + "\" is not in ServiceDesk"; * } * else * { * fillSubcategories(cat); * if (sub != "") * { * if (setDataGridToValue(dgSubCat, sub) == false) * { * txtMessage.Text = "Subcategory \"" + sub + "\" is not in ServiceDesk under category " + cat; * } * else * { * fillItmes(cat, sub); * if (item != "") * { * if (setDataGridToValue(dgItem, item) == false) * txtMessage.Text = "Item \"" + item + "\" is not in ServiceDesk under category " + cat + " and subcategory " + sub; * } * } * } * } * } * } * } * } * * else * { * lblTitle.Text = "Add Task"; * txtName.Text = ""; * txtDescription.Text = ""; * rectBiz.Opacity = 1d; * rectOps.Opacity = 1d; * rectIT.Opacity = 1d; * dgSLA.SelectedIndex = -1; * dgCat.SelectedIndex = -1; * dgSubCat.SelectedIndex = -1; * dgItem.SelectedIndex = -1; * } * * * //loadGroupData(); * //dgIcons.ItemsSource = dtGroups.DefaultView; * * //foreach (DataRow dr in dtGroups.Rows) * //{ * // if (dr["ID"].ToString() == id) * // { * // txtName.Text = dr["Name"].ToString(); * // txtButtonText.Text = dr["ButtonText"].ToString(); * // txtButtonTitle.Text = dr["ButtonTitle"].ToString(); * // } * //} */ }