public override global::System.Data.DataSet Clone() { HelperDS cln = ((HelperDS)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { HelperDS ds = new HelperDS(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); HelperDS ds = new HelperDS(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "FeatureBreakdownDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
private void UpdateFeatures() { HelperDS helper = new HelperDS(); txtFeatures.Text = txtFeatures.Text.Replace("; ", ";"); var values = txtFeatures.Text.ToLower().Replace(" ,", ",").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); if (rbTags.Checked) { var results = ds.WorkItem.Where(x => x.Type == "Feature" && x.State != "Removed" && (x.Tags.ToLower().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Any(y => values.Contains(y.Trim().ToLower())))); foreach (var row in results) { helper.FeatureBreakdown.AddFeatureBreakdownRow(row.ID, row.Title, 0, 0, 0, 0, 0, 0, 0m, 0m, 0); } } else if (rbFeatureIDs.Checked) { var ids = txtFeatures.Text.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList().Select(int.Parse).ToList(); foreach (var row in ds.WorkItem.Where(x => ids.Contains(x.ID))) { helper.FeatureBreakdown.AddFeatureBreakdownRow(row.ID, row.Title, 0, 0, 0, 0, 0, 0, 0m, 0m, 0); } } List <DumpDataSet.VW_All_CurrentRow> workItems = new List <DumpDataSet.VW_All_CurrentRow>(); foreach (HelperDS.FeatureBreakdownRow row in helper.FeatureBreakdown.Rows) { workItems.Clear(); bool includeUserStory = chkUserStory.Checked; bool includeBug = chkBugStory.Checked; if (includeUserStory) { workItems.AddRange(ds.VW_All_Current.Where(x => x.Type == "User Story" && x.State.ToLower() != "removed").ToList()); } if (includeBug) { workItems.AddRange(ds.VW_All_Current.Where(x => x.Type == "Bug" && x.State.ToLower() != "removed").ToList()); } row.Closed = workItems.Where(x => x.ParentID == row.FeatureId && x.State == "Closed").Count(); row.InDevelopment = workItems.Where(x => x.ParentID == row.FeatureId && x.State == "Active").Count(); row.InQA = workItems.Where(x => x.ParentID == row.FeatureId && (x.State == "QA" || x.State == "Ready for QA")).Count(); row.InUAT = workItems.Where(x => x.ParentID == row.FeatureId && (x.State == "UAT" || x.State == "Ready for UAT")).Count(); row.TotalStories = workItems.Where(x => x.ParentID == row.FeatureId && x.State != "Removed").Count(); row.PercentComplete = GetPercentComplete(row.TotalStories, row.Closed); row.DevComplete = GetPercentComplete(row.TotalStories, row.InQA + row.InUAT + row.Closed); row.Priority = GetBusinessPriority(row.FeatureId); row.NotStarted = row.TotalStories - (row.Closed + row.InDevelopment + row.InQA + row.InUAT); } int totalFeatures = helper.FeatureBreakdown.Rows.Count; HelperDS.FeatureBreakdownRow totalsRow = helper.FeatureBreakdown.NewFeatureBreakdownRow(); totalsRow.FeatureId = 99999; totalsRow.Title = "Totals"; List <Decimal> decimals = new List <decimal>(); foreach (HelperDS.FeatureBreakdownRow row in helper.FeatureBreakdown.Rows) { if (row.TotalStories == 0) { decimals.Add(0m); } else { decimals.Add(row.PercentComplete); } } totalsRow.PercentComplete = Math.Round(decimals.Average(), 2); totalsRow.Closed = helper.FeatureBreakdown.Sum(x => x.Closed); totalsRow.DevComplete = helper.FeatureBreakdown.Sum(x => x.DevComplete); totalsRow.InDevelopment = helper.FeatureBreakdown.Sum(x => x.InDevelopment); totalsRow.InQA = helper.FeatureBreakdown.Sum(x => x.InQA); totalsRow.InUAT = helper.FeatureBreakdown.Sum(x => x.InUAT); totalsRow.TotalStories = helper.FeatureBreakdown.Sum(x => x.TotalStories); totalsRow.NotStarted = helper.FeatureBreakdown.Sum(x => x.NotStarted); totalsRow.Priority = 1000; totalsRow.Title = string.Format("Totals ({0} stories not started)", totalsRow.TotalStories - totalsRow.InDevelopment - totalsRow.InQA - totalsRow.InUAT - totalsRow.Closed); decimals.Clear(); foreach (HelperDS.FeatureBreakdownRow row in helper.FeatureBreakdown.Rows) { if (row.TotalStories == 0) { decimals.Add(0m); } else { decimals.Add(row.DevComplete); } } totalsRow.DevComplete = Math.Round(decimals.Average(), 2); helper.FeatureBreakdown.AddFeatureBreakdownRow(totalsRow); helper.AcceptChanges(); helper.FeatureBreakdown.DefaultView.Sort = "Priority"; gridFeatures.DataSource = helper.FeatureBreakdown.DefaultView; // gridFeatures.AllowEditing = false; // gridFeatures.Cols["DevComplete"].Format = "P"; // gridFeatures.Cols["PercentComplete"].Format = "P"; // c1FlexGrid1.Cols["Priority"].Visible = false; // for (int i = 1; i < gridFeatures.Rows.Count - 1; i++) // { // int featureid = 0; // Int32.TryParse(gridFeatures.GetData(i, "FeatureId").ToString(), out featureid); // if (featureid > 0) // { // DumpDataSet.WorkItemRow row = ds.WorkItem.Where(x => x.ID == featureid).FirstOrDefault(); // if (row != null) // { // if (row.State == "Done") // { // gridFeatures.Rows[i].Style = gridFeatures.Styles["Done"]; // } // else if (row.Tags.ToLower().Contains("storied")) // { // gridFeatures.Rows[i].Style = gridFeatures.Styles["Storied"]; // } // else // { // gridFeatures.Rows[i].Style = gridFeatures.Styles["MissingStories"]; // // } // } // // } // } // gridFeatures.Rows[gridFeatures.Rows.Count - 1].Style = gridFeatures.Styles["GrandTotal"]; // gridFeatures.AutoSizeCols(); StringBuilder sb = new StringBuilder(); // foreach (var wi in workItems.OrderBy(x => x.ParentID).ThenBy(y => y.State)) // { // sb.AppendFormat("{0}\t{1}\t{2}\t{3}{4}", wi.ID, wi.ParentID, wi.State, wi.ParentTitle, // Environment.NewLine); // } // // var text = sb.ToString(); }