public AddCustomWallsDlg(UserInterface.Tent tent) { this.tent = tent; InitializeComponent(); if (tent == UserInterface.Tent.Frame || tent == UserInterface.Tent.ClearSpan) { // Disable all Fiesta options this.lbl_FPlain.Enabled = false; this.lbl_FWindow.Enabled = false; this.nud_FPlain.Enabled = false; this.nud_FWindow.Enabled = false; // Hide all Fiesta options this.lbl_FPlain.Visible = false; this.lbl_FWindow.Visible = false; this.nud_FPlain.Visible = false; this.nud_FWindow.Visible = false; // Move buttons up and resize Form this.btn_AllToZero.Location = new System.Drawing.Point(13, 82); this.btn_Done.Location = new System.Drawing.Point(129, 82); this.btn_Cancel.Location = new System.Drawing.Point(204, 82); this.ClientSize = new System.Drawing.Size(284, 119); } }
/// <summary> /// Updates the properties of the class depending on the values currently in the dialog. /// </summary> public void UpdateProperties() { this.TentSize = cb_size.Text; this.Qty = nud_qty.Value; this.CoverType = cb_coverType.Text; this.TieDown = cb_holddown.Text; this.Walls = cb_walls.Text; this.Legs = cb_legs.Text; this.TypeOfTent = tent; }
private static IEnumerable <Database> ReadTentDatabase <Database>(UserInterface.Tent typeOfTent) { string filename = null; #if DEBUG switch (typeOfTent) { case UserInterface.Tent.Small: filename = @"../../SmallTents.csv"; break; case UserInterface.Tent.Large: filename = @"../../LargeTents.csv"; break; case UserInterface.Tent.Frame: filename = @"../../Frames.csv"; break; case UserInterface.Tent.ClearSpan: filename = @"../../ClearSpans.csv"; break; } #else switch (typeOfTent) { case UserInterface.Tent.Small: filename = @"SmallTents.csv"; break; case UserInterface.Tent.Large: filename = @"LargeTents.csv"; break; case UserInterface.Tent.Frame: filename = @"Frames.csv"; break; case UserInterface.Tent.ClearSpan: filename = @"ClearSpans.csv"; break; } #endif // Initiate a reader System.IO.StreamReader reader = new System.IO.StreamReader(filename); // Initiate CSVHelper's CSV Reader var csv = new CsvReader(reader); // Get the records in the CSV file according to class SmallTentDB var records = csv.GetRecords <Database>(); return(records); }
public TentListItem(UserInterface.Tent TentType, string TentSizes, int TentQty, string TentCoverTypes, string TentHoldDowns, string TentWalls, string TentLegs) { this.tentType = TentType; this.tentSizes = TentSizes; this.tentQties = TentQty; this.tentCoverTypes = TentCoverTypes; this.tentHoldDowns = TentHoldDowns; this.tentWalls = TentWalls; this.tentLegs = TentLegs; }
/// <summary> /// Creates a new dialog object and shows it to the user. After making the selections, the values in the main dialog are updated with them. /// </summary> private void openTentDialog(UserInterface.Tent tent) { var tentDialog = new AddTentDlg(tent); tentDialog.ShowDialog(); if (tentDialog.Code == true) { this.tentDGV.Rows.Add(); this.tentDGV.Rows[TentCtr].Cells[0].Value = tentDialog.TypeOfTent; this.tentDGV.Rows[TentCtr].Cells[1].Value = tentDialog.TentSize; this.tentDGV.Rows[TentCtr].Cells[2].Value = tentDialog.Qty.ToString(); this.tentDGV.Rows[TentCtr].Cells[3].Value = tentDialog.CoverType; this.tentDGV.Rows[TentCtr].Cells[4].Value = tentDialog.TieDown; this.tentDGV.Rows[TentCtr].Cells[5].Value = tentDialog.Walls; this.tentDGV.Rows[TentCtr].Cells[6].Value = tentDialog.Legs; TentCtr++; } UpdateList(); }
public AddTentDlg(UserInterface.Tent tent) { this.tent = tent; InitializeComponent(); switch (tent) { case UserInterface.Tent.Large: this.Text = "Add Large Tent"; this.cb_size.Items.AddRange(new object[] { "40x40", "40x60", "40x80", "40x100", "40x120", "40x140", "40x160", "40x180", "40x200", "40x220", "40x240", "40x260", "40x280", "40x300", "60x40", "60x60", "60x70", "60x80", "60x90", "60x100", "60x110", "60x120", "60x130", "60x140", "60x150", "60x160", "60x170", "60x180", "60x190", "60x200", "60x210", "60x220", "60x230", "60x240", "60x250", "90x60", "90x90", "90x120", "90x150", "90x180", "90x210", "90x240", "90x270", "90x300" }); this.cb_size.SelectedIndex = 0; this.cb_holddown.Items.AddRange(new object[] { "Pins", "1 ton Concrete Block" }); this.cb_holddown.SelectedIndex = 0; this.cb_coverType.Enabled = false; // No cover types //this.cb_coverType.Items.AddRange(new object[] { //"Regular", //"New", //"Old", //"Barbecue", //"Soft"}); //this.cb_coverType.SelectedIndex = 0; this.cb_walls.Items.AddRange(new object[] { "Full Plain", "Full Window", "Half Plain Half Window", "Full Plain Fiesta", "Full Window Fiesta", "Half Plain Half Window Fiesta", "None" }); this.cb_legs.Items.AddRange(new object[] { "8 ft", "10 ft" }); this.cb_walls.SelectedIndex = 0; break; case UserInterface.Tent.Small: this.Text = "Add Small Tent"; this.cb_size.Items.AddRange(new object[] { "10x10", "10x15", "10x20", "15x15", "20x20", "20x30", "20x40", "30x30", "Hexagon", "" }); this.cb_size.SelectedIndex = 0; // TODO: Give option to choose which type of blocks to bring this.cb_holddown.Items.AddRange(new object[] { "Pins", "Water Barrels", "250 lb Concrete Block", "400 lb Concrete Block", "600 lb Concrete Block", "1/2 ton Concrete Block", "1 ton Concrete Block" }); this.cb_holddown.SelectedIndex = 0; this.cb_coverType.Items.AddRange(new object[] { "Regular", "New", "Old", "Barbecue", "Soft", "Number 1", "Number 2", "Number 3", "Number 4", "Number 5", "Number 6", "Number 7", "Number 8", }); this.cb_coverType.SelectedIndex = 0; // No 8x10 Window walls this.cb_walls.Items.AddRange(new object[] { "Full Plain", "Full Window", "Half Plain Half Window", "Full Plain Fiesta", "Full Window Fiesta", "Half Plain Half Window Fiesta", "None" }); this.cb_walls.SelectedIndex = 0; // TODO: Can't have 10 foot fiesta walls (if 10 ft legs is selected) this.cb_legs.Items.AddRange(new object[] { "8 ft", "8 ft Adjustable", "10 ft", "10 ft Adjustable", "Hexagon" }); this.cb_legs.SelectedIndex = 0; break; case UserInterface.Tent.Frame: this.Text = "Add Frame"; this.cb_size.Items.AddRange(new object[] { "30x30", "30x40", "30x45", "30x50", "30x55", "30x60", "30x65", "30x70", "30x75", "30x80", "30x85", "30x90", "30x95", "30x100", "30x105", "30x110", "30x115", "30x120", "30x125", "30x130", "30x135", "30x140", "30x145", "30x150", "30x155", "30x160", "30x165", "30x170", "30x175", "30x180", "30x185", "30x190", "30x195", "30x200", "30x205", "30x210", "30x215", "30x220", "30x225", "30x230", "30x235", "30x240", "" }); this.cb_size.SelectedIndex = 0; this.cb_holddown.Items.AddRange(new object[] { "Pins", "Water Barrels", "1/2 ton Concrete Block", "1 ton Concrete Block" }); this.cb_holddown.SelectedIndex = 0; this.cb_coverType.Items.AddRange(new object[] { "Regular", "New", "Old" }); this.cb_coverType.SelectedIndex = 0; this.cb_walls.Items.AddRange(new object[] { "Full Plain", "Full Window", "Half Plain Half Window", "None" }); this.cb_walls.SelectedIndex = 0; this.cb_legs.Items.AddRange(new object[] { "8 ft", "10 ft" }); this.cb_legs.SelectedIndex = 0; break; case UserInterface.Tent.ClearSpan: this.Text = "Add ClearSpan"; this.cb_size.Items.AddRange(new object[] { "30x15", "30x30", "30x40", "30x45", "30x50", "30x55", "30x60", "30x65", "30x70", "30x75", "30x80", "30x85", "30x90", "30x95", "30x100", "30x105", "30x110", "30x115", "30x120", "30x125", "30x130", "30x135", "30x140", "30x145", "30x150", "30x155", "30x160", "30x165", "30x170", "30x175", "30x180", "30x185", "30x190", "30x195", "30x200", "30x205", "30x210", "30x215", "30x220", "30x225", "30x230", "30x235", "30x240", "40x15", "40x30", "40x40", "40x45", "40x50", "40x55", "40x60", "40x65", "40x70", "40x75", "40x80", "40x85", "40x90", "40x95", "40x100", "40x105", "40x110", "40x115", "40x120", "40x125", "40x130", "40x135", "40x140", "40x145", "40x150", "40x155", "40x160", "40x165", "40x170", "40x175", "40x180", "40x185", "40x190", "40x195", "40x200", "40x205", "40x210", "40x215", "40x220", "40x225", "40x230", "40x235", "40x240", "50x15", "50x30", "50x40", "50x45", "50x50", "50x55", "50x60", "50x65", "50x70", "50x75", "50x80", "50x85", "50x90", "50x95", "50x100", "50x105", "50x110", "50x115", "50x120", "50x125", "50x130", "50x135", "50x140", "50x145", "50x150", "50x155", "50x160", "50x165", "50x170", "50x175", "50x180", "50x185", "50x190", "50x195", "50x200", "50x205", "50x210", "50x215", "50x220", "50x225", "50x230", "50x235", "50x240" }); this.cb_size.SelectedIndex = 0; this.cb_holddown.Enabled = false; this.cb_coverType.Items.AddRange(new object[] { "Regular", "Clear" }); this.cb_coverType.SelectedIndex = 0; this.cb_walls.Items.AddRange(new object[] { "Full Plain", "Full Bay Window", "Full French Window", "Half Plain Half Bay Window", "None" }); this.cb_walls.SelectedIndex = 0; this.cb_legs.Items.AddRange(new object[] { "8 ft", "10 ft" }); this.cb_legs.SelectedIndex = 0; break; default: break; } // end switch }
public ItemCounts CountTents(ref ListNames ListOfLists) { // Declare lists of TentItems List <TentItems> MetalItemList = new List <TentItems>(); List <TentItems> WallList = new List <TentItems>(); List <TentItems> CoverList = new List <TentItems>(); List <TentItems> HoldDownList = new List <TentItems>(); // Declare object of ItemCounts class ItemCounts counts = new ItemCounts(); // Declare variables. Legs leg = Legs.none; string legTentType = null; IDatabase db = new SmallTentDB(); IEnumerable <SmallTentDB> SmallDB = ReadTentDatabase <SmallTentDB>(UserInterface.Tent.Small); List <SmallTentDB> Small = SmallDB.ToList(); IEnumerable <LargeTentDB> LargeDB = ReadTentDatabase <LargeTentDB>(UserInterface.Tent.Large); List <LargeTentDB> Large = LargeDB.ToList(); IEnumerable <FrameDB> FrameDB = ReadTentDatabase <FrameDB>(UserInterface.Tent.Frame); List <FrameDB> Frame = FrameDB.ToList(); IEnumerable <ClearSpanDB> ClearSpanDB = ReadTentDatabase <ClearSpanDB>(UserInterface.Tent.ClearSpan); List <ClearSpanDB> ClearSpan = ClearSpanDB.ToList(); // Loop through all tents for (int i = 0; i < ListOfLists.tentType.Count; ++i) { // Get the quantity of that particular tent int qty = ListOfLists.tentQties[i]; // Get the cover size, type of cover and type of tent string size = ListOfLists.tentSizes[i]; UserInterface.Tent typeOfTent = ListOfLists.tentType[i]; string coverType = ListOfLists.tentCoverTypes[i]; // Depending on the type and size of tent, get the appropriate row in the database. switch (ListOfLists.tentType[i]) { case UserInterface.Tent.Small: { legTentType = "ST"; // Get the appropriate row from the small tent database, depending on the size of the tent. SmallTentDB SmallRow = Small.Find(b => b.Size == size); db = SmallRow; if (SmallRow != null) { // Metal list // TODO: string builder for legs, cable, poteau de milieu HandleList("Pipe", SmallRow.Pipe * qty, MetalItemList); HandleList("Pipe 5ft", SmallRow.Pipe5 * qty, MetalItemList); HandleList("T - 20", SmallRow.SmallTee * qty, MetalItemList); HandleList("T - 30", SmallRow.LargeTee * qty, MetalItemList); HandleList("Entures", SmallRow.Enture * qty, MetalItemList); if (size == "Hexagon") { HandleList("Coins Hex", SmallRow.Corner * qty, MetalItemList); HandleList("Hexagone", qty, CoverList); } else { HandleList("Coins", SmallRow.Corner * qty, MetalItemList); HandleList(SmallRow.Size + " " + coverType, qty, CoverList); } HandleList("Brace - 30", SmallRow.Brace * qty, MetalItemList); HandleList(string.Format("PM {0}", size), SmallRow.MiddlePost * qty, MetalItemList); HandleList(string.Format("Cables {0}", size), SmallRow.Cable * qty, WallList); } } break; case UserInterface.Tent.Large: legTentType = "BT"; // Get the appropriate row from the large tent database, depending on the size of the tent. LargeTentDB LargeRow = Large.Find(b => b.Size == size); db = LargeRow; if (LargeRow != null) { HandleList(string.Format("PM {0}", size.Substring(0, 2)), LargeRow.MiddlePost * qty, MetalItemList); HandleList("Plates", LargeRow.Plates * qty, MetalItemList); HandleList(string.Format("Mid {0}' x 20' {1}", size.Substring(0, 2), coverType), LargeRow.Mid20 * qty, CoverList); HandleList(string.Format("Mid {0}' x 30' {1}", size.Substring(0, 2), coverType), LargeRow.Mid30 * qty, CoverList); HandleList(string.Format("End {0}' {1}", size.Substring(0, 2), coverType), 2 * qty, CoverList); } break; case UserInterface.Tent.Frame: // Get the appropriate row from the frame database, depending on the size of the tent. FrameDB FrameRow = Frame.Find(b => b.Size == size); db = FrameRow; if (FrameRow != null) { // TODO: Handle mids and ends after database is fixed HandleList("Mid 10' " + coverType, FrameRow.Cover10 * qty, CoverList); HandleList("Mid 15' " + coverType, FrameRow.Cover15 * qty, CoverList); HandleList("End Frame " + coverType, qty, CoverList); } break; case UserInterface.Tent.ClearSpan: // Get the appropriate row from the ClearSpan database, depending on the size of the tent. ClearSpanDB ClearSpanRow = ClearSpan.Find(b => b.Size == size); db = ClearSpanRow; // Get the width of the ClearSpan int ClearSpanWidth = Convert.ToInt32(size.Substring(0, 2)); if (ClearSpanRow != null) { HandleList(string.Format("ClearSpan {0}' x 10' {1}", ClearSpanWidth.ToString(), coverType), ClearSpanRow.Cover10 * qty, CoverList); HandleList(string.Format("ClearSpan {0}' x 15' {1}", ClearSpanWidth.ToString(), coverType), ClearSpanRow.Cover15 * qty, CoverList); switch (ClearSpanWidth) { case 30: HandleList("Triangle 30'", ClearSpanRow.Triangle * qty, CoverList); break; case 40: HandleList("Triangle 40'", ClearSpanRow.Triangle * qty, CoverList); break; case 50: HandleList("Triangle 50'", ClearSpanRow.Triangle * qty, CoverList); break; } if (ListOfLists.tentWalls[i] != "None") { switch (ListOfLists.tentWalls[i]) { case "Full Plain": HandleList("Mur CSP 10'", ClearSpanRow.CSPWalls10 * qty, WallList); HandleList("Mur CSP 15'", ClearSpanRow.CSPWalls15 * qty, WallList); HandleList("Mur CSP 20'", ClearSpanRow.CSPWalls20 * qty, WallList); break; case "Full Bay Window": HandleList("Mur CSP 10' Bay", ClearSpanRow.CSPWalls10 * qty, WallList); HandleList("Mur CSP 15' Bay", ClearSpanRow.CSPWalls15 * qty, WallList); HandleList("Mur CSP 20' Bay", ClearSpanRow.CSPWalls20 * qty, WallList); break; case "Full French Window": HandleList("Mur CSP 10' FW", ClearSpanRow.CSPWalls10 * qty, WallList); HandleList("Mur CSP 15' FW", ClearSpanRow.CSPWalls15 * qty, WallList); HandleList("Mur CSP 20' FW", ClearSpanRow.CSPWalls20 * qty, WallList); break; case "Half Plain Half Bay Window": HandleList("Mur CSP 10'", (int)System.Math.Ceiling((double)ClearSpanRow.CSPWalls10 / 2) * qty, WallList); HandleList("Mur CSP 15'", (int)System.Math.Ceiling((double)ClearSpanRow.CSPWalls15 / 2) * qty, WallList); HandleList("Mur CSP 20'", (int)System.Math.Ceiling((double)ClearSpanRow.CSPWalls20 / 2) * qty, WallList); HandleList("Mur CSP 10' Bay", (int)System.Math.Ceiling((double)ClearSpanRow.CSPWalls10 / 2) * qty, WallList); HandleList("Mur CSP 15' Bay", (int)System.Math.Ceiling((double)ClearSpanRow.CSPWalls15 / 2) * qty, WallList); HandleList("Mur CSP 20' Bay", (int)System.Math.Ceiling((double)ClearSpanRow.CSPWalls20 / 2) * qty, WallList); break; } } } break; } // Hold Down list switch (ListOfLists.tentHoldDowns[i]) { case "Pins": HandleList("White Pins", db.PinsW * qty, HoldDownList); HandleList("Red Pins", db.PinsR * qty, HoldDownList); break; case "Water Barrels": HandleList("Water Barrels", db.Barrels * qty, HoldDownList); break; case "250 lb Concrete Block": HandleList("250 lb Block", db.Concrete250 * qty, HoldDownList); break; case "400 lb Concrete Block": HandleList("400 lb Block", db.Concrete400 * qty, HoldDownList); break; case "600 lb Concrete Block": HandleList("600 lb Block", db.Concrete600 * qty, HoldDownList); break; case "1/2 ton Concrete Block": HandleList("1/2 ton Block", db.ConcreteHalfTon * qty, HoldDownList); break; case "1 ton Concrete Block": HandleList("1 ton Block", db.ConcreteTon * qty, HoldDownList); break; } //Comealongs HandleList("Come Along", db.ComeAlong * qty, HoldDownList); // If the tent is not hexagon, build the string for type of legs and handle it string tentLegs = ListOfLists.tentLegs[i]; if (tentLegs != "Hexagon") { string LegsForList = string.Format("Pattes {0} {1}", tentLegs, legTentType); HandleList(LegsForList, db.Legs * qty, MetalItemList); // Assign enum depending on leg type if (tentLegs == "8 ft" || tentLegs == "8 ft Adjustable") { leg = Legs.shortLegs; } else if (tentLegs == "10 ft" || tentLegs == "10 ft Adjustable") { leg = Legs.longLegs; } } else { // If the size of the cover selected is not hexagon, throw an error. if (ListOfLists.tentSizes[i] != "Hexagon") { throw new Exception("Hexagon legs were chosen, but the cover type for this tent is not Hexagon."); } else { // Assign shortLegs enum to leg variable because hex tents have 8' high walls... leg = Legs.shortLegs; HandleList("Pattes Hex", db.Legs * qty, MetalItemList); } } // This can definitely be optimized but it works... // Insert walls in list. if (leg != Legs.none && ListOfLists.tentWalls[i] != "None") { string leg_length = null; if (leg == Legs.longLegs) { leg_length = ", 10'"; } switch (ListOfLists.tentWalls[i]) { case "Full Plain": HandleList(string.Format("Murs 10' P{0}", leg_length), db.Walls10 * qty, WallList); HandleList(string.Format("Murs 15' P{0}", leg_length), db.Walls15 * qty, WallList); HandleList(string.Format("Murs 20' P{0}", leg_length), db.Walls20 * qty, WallList); break; case "Full Window": HandleList(string.Format("Murs 10' W{0}", leg_length), db.Walls10 * qty, WallList); HandleList(string.Format("Murs 15' W{0}", leg_length), db.Walls15 * qty, WallList); HandleList(string.Format("Murs 20' W{0}", leg_length), db.Walls20 * qty, WallList); break; case "Half Plain Half Window": HandleList(string.Format("Murs 10' P{0}", leg_length), (int)System.Math.Ceiling((double)db.Walls10 / 2) * qty, WallList); HandleList(string.Format("Murs 15' P{0}", leg_length), (int)System.Math.Ceiling((double)db.Walls15 / 2) * qty, WallList); HandleList(string.Format("Murs 20' P{0}", leg_length), (int)System.Math.Ceiling((double)db.Walls20 / 2) * qty, WallList); HandleList(string.Format("Murs 10' W{0}", leg_length), (int)System.Math.Ceiling((double)db.Walls10 / 2) * qty, WallList); HandleList(string.Format("Murs 15' W{0}", leg_length), (int)System.Math.Ceiling((double)db.Walls15 / 2) * qty, WallList); HandleList(string.Format("Murs 20' W{0}", leg_length), (int)System.Math.Ceiling((double)db.Walls20 / 2) * qty, WallList); break; case "Full Plain Fiesta": HandleList(string.Format("Murs 10' PF, {0}", leg_length), db.Walls10 * qty, WallList); HandleList(string.Format("Murs 15' PF, {0}", leg_length), db.Walls15 * qty, WallList); HandleList(string.Format("Murs 20' PF, {0}", leg_length), db.Walls20 * qty, WallList); break; case "Full Window Fiesta": HandleList(string.Format("Murs 10' WF, {0}", leg_length), db.Walls10 * qty, WallList); HandleList(string.Format("Murs 15' WF, {0}", leg_length), db.Walls15 * qty, WallList); HandleList(string.Format("Murs 20' WF, {0}", leg_length), db.Walls20 * qty, WallList); break; case "Half Plain Half Window Fiesta": HandleList(string.Format("Murs 10' PF, {0}", leg_length), (int)System.Math.Ceiling((double)db.Walls10 / 2) * qty, WallList); HandleList(string.Format("Murs 15' PF, {0}", leg_length), (int)System.Math.Ceiling((double)db.Walls15 / 2) * qty, WallList); HandleList(string.Format("Murs 20' PF, {0}", leg_length), (int)System.Math.Ceiling((double)db.Walls20 / 2) * qty, WallList); HandleList(string.Format("Murs 10' WF, {0}", leg_length), (int)System.Math.Ceiling((double)db.Walls10 / 2) * qty, WallList); HandleList(string.Format("Murs 15' WF, {0}", leg_length), (int)System.Math.Ceiling((double)db.Walls15 / 2) * qty, WallList); HandleList(string.Format("Murs 20' WF, {0}", leg_length), (int)System.Math.Ceiling((double)db.Walls20 / 2) * qty, WallList); break; } } } // Collect all the lists into the "counts" object to be returned. counts.Covers = CoverList; counts.Metal = MetalItemList; counts.TieDowns = HoldDownList; counts.Walls = WallList; return(counts); }