private void newTypeClick(object sender, EventArgs e) { if (m_customReportCounter >= Configuration.PreDefinedCustomizeTypeCount) { MessageForm.Show(this, string.Format(Resources.infoCustomerTypeLimit, Configuration.PreDefinedCustomizeTypeCount), Resources.report_center); return; } frmInputBox newType = new frmInputBox(Resources.infoNewTypePrompt, Resources.infoNewTypeTitle, Resources.infoNewTypeDefaultValue); newType.ShowDialog(); if (newType.DialogResult == DialogResult.OK) { string typeName = newType.InputValue; if (typeName.Length > Configuration.PreDefinedCustomizeTypeNameLength) { //we truncate the name typeName = typeName.Substring(0, Configuration.PreDefinedCustomizeTypeNameLength); } UserReportTypeTreeNode addedNode = new UserReportTypeTreeNode(typeName, true); customReportTreeView.Nodes.Add(addedNode); customReportTreeView.SelectedNode = addedNode; saveButton.Enabled = true; } }
private void LoadCustomReports() { customReportTreeView.Nodes.Clear(); MyParent.LoadUserDefinedReports(false);//RALLY DE 6239 m_userReportDictionary = MyParent.UserReportTypesDictionary; if (m_userReportDictionary == null || m_userReportDictionary.Count == 0) { m_customReportCounter = 0; return; } m_customReportCounter = m_userReportDictionary.Count; //we will limit 10 types only UserReportGroupTreeNode tempGroup; UserReportTypeTreeNode tempType; foreach (KeyValuePair <int, UserReportType> type in m_userReportDictionary) { tempType = new UserReportTypeTreeNode(type.Value, false); foreach (KeyValuePair <int, UserReportGroup> group in type.Value.UserReportGroups) { tempGroup = new UserReportGroupTreeNode(group.Value, false); for (int iReport = 0; iReport < group.Value.ReportsArray.Count; iReport++) { // determine report set to use ReportInfo info = (ReportInfo)group.Value.ReportsArray[iReport]; ReportTypes reportTypeID = (ReportTypes)info.TypeID; // START RALLY DE4505 - Do NOT show bingoCard reports if PWP is on. if ((info.ID == BingoCardSalesDetailReport || info.ID == BingoCardSummaryReport) && Configuration.m_playWithPaper && reportTypeID == ReportTypes.Sales) { continue; } //END RALLY DE4505 ReportSetTreeNode setTreeNode = null; foreach (ReportSetTreeNode setNode in tempGroup.Nodes) { if (setNode.ReportType == reportTypeID) { setTreeNode = setNode; break; } } if (setTreeNode == null) { setTreeNode = CreateReportSetTreeNode(reportTypeID); tempGroup.Nodes.Add(setTreeNode); } setTreeNode.Nodes.Add(new ReportTreeNode((ReportInfo)group.Value.ReportsArray[iReport], false)); } tempType.Nodes.Add(tempGroup); } customReportTreeView.Nodes.Add(tempType); } }
private void customReportLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Label != null) { if (e.Label.Length > 0) { if (IsValidAlphaNumeric(e.Label)) { // Stop editing without canceling the label change. e.Node.EndEdit(false); TreeNode tn = customReportTreeView.SelectedNode; tn.Text = e.Label; UserReportGroupTreeNode groupTreeNode = tn as UserReportGroupTreeNode; if (groupTreeNode != null) { if (groupTreeNode.ReportGroup != null) { groupTreeNode.ReportGroup.UserGroupName = tn.Text; saveButton.Enabled = true; } } UserReportTypeTreeNode typeTreeNode = tn as UserReportTypeTreeNode; if (typeTreeNode != null) { if (typeTreeNode.ReportType != null) { typeTreeNode.ReportType.UserReportTypeName = tn.Text; saveButton.Enabled = true; } } } else { /* Cancel the label edit action, inform the user, and * place the node in edit mode again. */ e.CancelEdit = true; MessageForm.Show(this, Resources.infoNameInvalid, Resources.report_center); e.Node.BeginEdit(); } } else { /* Cancel the label edit action, inform the user, and * place the node in edit mode again. */ e.CancelEdit = true; MessageForm.Show(this, Resources.infoNameNotNull, Resources.report_center); e.Node.BeginEdit(); } } }