public PowerCord(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { wiresQty = row.Field <string>("Wires Qty"), Workcenter = row.Field <string>("Work Center") } into grp select new { workcenter = grp.Key.Workcenter, wires = grp.Key.wiresQty, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); foreach (var row in newSort) { ParametersTB.AddInstance("WiresQty", row.wires); OptionTB.AddInstance(optionName, row.Sum); OptionTB.AddParam(optionName, row.Sum, "WiresQty", row.wires); using (var db = new TimeContext()) { foreach (var fixture in db.Fixtures) { FixtureTB.AddOption(fixture.FxCode, row.workcenter, optionName, row.Sum); } } } }
public Hanger(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Product ID"), SectionType = row.Field <string>("Section Type"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { Product = grp.Key.ID, sectionType = grp.Key.SectionType, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Total Time (min)"))) }).ToList(); foreach (var row in newSort) { OptionTB.AddInstance(optionName, row.Sum); ProdTB.AddInstance(row.Product, row.workcenter); ParametersTB.AddInstance("SectionType", row.sectionType); ProdTB.AddOption(row.Product, row.workcenter, optionName, row.Sum); OptionTB.AddParam(optionName, row.Sum, "SectionType", row.sectionType); } }
public CB(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Fixture Type"), Workcenter = row.Field <string>("Work Center"), LampQty = row.Field <string>("Lamp Qty") } into grp //orderby grp.Key select new { ID = grp.Key.ID, LampQty = grp.Key.LampQty, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time(min)"))) }).ToList(); foreach (var row in newSort) { FixtureTB.AddInstance(row.ID, row.workcenter); OptionTB.AddInstance(optionName, row.Sum); ParametersTB.AddInstance("LampQty", row.LampQty); OptionTB.AddParam(optionName, row.Sum, "LampQty", row.LampQty); FixtureTB.AddOption(row.ID, row.workcenter, optionName, row.Sum); } }
public Housing(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Product ID"), Length = row.Field <string>("Length"), mounting = row.Field <string>("Flange"), section = row.Field <string>("Section"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { Product = grp.Key.ID, length = Int32.Parse(grp.Key.Length), workcenter = grp.Key.Workcenter, section = grp.Key.section, mounting = grp.Key.mounting, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time(min)"))) }).ToList(); foreach (var row in newSort) { var mounting = row.mounting; switch (mounting) { case "Spackle Flange": mounting = "DS"; break; case "Flangeless": mounting = "D"; break; default: mounting = "-"; break; } OptionTB.AddInstance(optionName, row.Sum, row.length); ProdTB.AddInstance(row.Product, row.workcenter); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("Section", row.section); parameters.Add("Mounting", mounting); foreach (var instace in parameters) { ParametersTB.AddInstance(instace.Key, instace.Value); OptionTB.AddParam(optionName, row.Sum, instace.Key, instace.Value, row.length); } ProdTB.AddOption(row.Product, row.workcenter, optionName, row.Sum, row.length); } }
public Pack(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Product ID"), mounting = row.Field <string>("Description"), Workcenter = row.Field <string>("Work Center"), Length = row.Field <string>("Length") } into grp //orderby grp.Key select new { Product = grp.Key.ID, workcenter = grp.Key.Workcenter, mounting = grp.Key.mounting, Length = grp.Key.Length, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); using (var db = new TimeContext()) { foreach (var row in newSort) { int length = Int32.Parse(row.Length); string mounting = row.mounting; switch (mounting) { case "Spackle Flange": mounting = "DS"; break; case "Flangeless": mounting = "D"; break; default: mounting = "-"; break; } ProdTB.AddInstance(row.Product, row.workcenter); OptionTB.AddInstance(optionName, row.Sum, length); ParametersTB.AddInstance("Mounting", mounting); ProdTB.AddOption(row.Product, row.workcenter, optionName, row.Sum); OptionTB.AddParam(optionName, row.Sum, "Mounting", mounting, length); } } }
public Length(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); Dictionary <string, List <string> > SectionParam = new Dictionary <string, List <string> >(); foreach (DataRow row in dt.Rows) { SectionParam["SR1"] = new List <string> { row["SR1"].ToString(), row["Cartridge 1 SR1"].ToString(), row["Cartridge 2 SR1"].ToString(), row["Cartridge 3 SR1"].ToString() }; SectionParam["SRM"] = new List <string> { row["SRM"].ToString(), row["Cartridge 1 SRM"].ToString(), row["Cartridge 2 SRM"].ToString(), row["Cartridge 3 SRM"].ToString() }; SectionParam["SRE"] = new List <string> { row["SRE"].ToString(), row["Cartridge 1 SRE"].ToString(), row["Cartridge 2 SRE"].ToString(), row["Cartridge 3 SRE"].ToString() }; int length = Int32.Parse(row["Length (feet)"].ToString()); OptionTB.AddInstance(optionName, 0.0, length); foreach (KeyValuePair <string, List <string> > section in SectionParam) { foreach (var x in section.Value) { if (!string.IsNullOrEmpty(x)) { ParametersTB.AddInstance(section.Key, x); OptionTB.AddParam(optionName, 0.0, section.Key, x, length); } } } } }
public ExitW(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Fixture Type"), Section = row.Field <string>("Section"), Circtuit = row.Field <string>("Circuit"), Ballast = row.Field <string>("Kind Of Ballast/Driver"), Workcenter = row.Field <string>("Work Center") } into grp select new { fixture = grp.Key.ID, Section = grp.Key.Section, Circtuit = grp.Key.Circtuit, workcenter = grp.Key.Workcenter, Ballast = grp.Key.Ballast, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); foreach (var row in newSort) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("Section", row.Section); parameters.Add("Circuit", row.Circtuit); parameters.Add("Ballast", row.Ballast); FixtureTB.AddInstance(row.fixture, row.workcenter); OptionTB.AddInstance(optionName, row.Sum); foreach (var instace in parameters) { ParametersTB.AddInstance(instace.Key, instace.Value); OptionTB.AddParam(optionName, row.Sum, instace.Key, instace.Value); } FixtureTB.AddOption(row.fixture, row.workcenter, optionName, row.Sum); } }
public PowerC(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { Section = row.Field <string>("Section"), Circtuit = row.Field <string>("Circuit"), Ballast = row.Field <string>("Kind Of Ballast/Driver"), length = row.Field <string>("Length"), Workcenter = row.Field <string>("Work Center") } into grp select new { Section = grp.Key.Section, Circtuit = grp.Key.Circtuit, workcenter = grp.Key.Workcenter, Ballast = grp.Key.Ballast, length = grp.Key.length, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Total Time (min)"))) }).ToList(); foreach (var row in newSort) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("Section", row.Section); parameters.Add("Circuit", row.Circtuit); parameters.Add("Ballast", row.Ballast); int length = Int32.Parse(row.length); OptionTB.AddInstance(optionName, row.Sum, length); foreach (var instace in parameters) { ParametersTB.AddInstance(instace.Key, instace.Value); OptionTB.AddParam(optionName, row.Sum, instace.Key, instace.Value, length); } using (var db = new TimeContext()) { foreach (var fixture in db.Fixtures.Where(r => r.WorkCenter == row.workcenter)) { FixtureTB.AddOption(fixture.FxCode, row.workcenter, optionName, row.Sum, length); } } } }
public CartBoard(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Cartridge/Board"), Desc = row.Field <string>("Description"), Type = row.Field <string>("Type"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { cartboard = grp.Key.ID, desc = grp.Key.Desc, type = grp.Key.Type, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Total Time"))) }).ToList(); bool morepage; var products = UD03BO.GetRows(@"Key1 = 'PRODUCTID'", "", 0, 0, out morepage); foreach (var row in newSort) { var prodlist = (from myRow in products.UD03.AsEnumerable() where myRow.Field <string>("CartBoard_c") == row.cartboard && myRow.Field <string>("Direct_C") == row.desc select myRow.Field <string>("Key2")).ToList(); foreach (var prod in prodlist) { using (var db = new TimeContext()) { ProdTB.AddInstance(prod, row.workcenter); OptionTB.AddInstance(optionName, row.Sum); ParametersTB.AddInstance("Type", row.type); ProdTB.AddOption(prod, row.workcenter, optionName, row.Sum); OptionTB.AddParam(optionName, row.Sum, "Type", row.type); } } } }
public OpTest(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Fixture Type"), light = row.Field <string>("Lighting"), citcuit = row.Field <string>("Circuit"), LampQty = row.Field <string>("Lamp/Cartridge Qty"), Length = row.Field <string>("Length"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { Fixture = grp.Key.ID, light = grp.Key.light, circuit = grp.Key.citcuit, lampQty = grp.Key.LampQty, length = Int32.Parse(grp.Key.Length), workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); foreach (var row in newSort) { Dictionary <string, string> parameters = new Dictionary <string, string>(); FixtureTB.AddInstance(row.Fixture, row.workcenter); OptionTB.AddInstance(optionName, row.Sum, row.length); parameters.Add("Circuit", row.circuit); parameters.Add("LampQty", row.lampQty); parameters.Add("Light", row.light); foreach (var value in parameters) { ParametersTB.AddInstance(value.Key, value.Value); OptionTB.AddParam(optionName, row.Sum, value.Key, value.Value, row.length); } FixtureTB.AddOption(row.Fixture, row.workcenter, optionName, row.Sum); } }
public Optic(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Family Product"), Optic = row.Field <string>("Optic"), Length = row.Field <string>("Length"), Workcenter = row.Field <string>("Work Center") } into grp select new { ProdFam = grp.Key.ID, Optic = grp.Key.Optic, Length = grp.Key.Length, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); using (var db = new TimeContext()) { foreach (var row in newSort) { ProdFamTB.AddInstance(row.ProdFam, row.workcenter); int length = Int32.Parse(row.Length); OptionTB.AddInstance(optionName, row.Sum, length); ParametersTB.AddInstance("Optic", row.Optic); OptionTB.AddParam(optionName, row.Sum, "Optic", row.Optic); ProdFamTB.AddOption(row.ProdFam, row.workcenter, optionName, row.Sum, length); db.SaveChanges(); } } }
public MKits(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Fixture Type"), Mouting = row.Field <string>("Mounting Suspension"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { Fixture = grp.Key.ID, mounting = grp.Key.Mouting, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Total Time (min)"))) }).ToList(); using (var db = new TimeContext()) { foreach (var row in newSort) { FixtureTB.AddInstance(row.Fixture, row.workcenter); OptionTB.AddInstance(optionName, row.Sum); ParametersTB.AddInstance("Mounting", row.mounting); OptionTB.AddParam(optionName, row.Sum, "Mounting", row.mounting); FixtureTB.AddOption(row.Fixture, row.workcenter, optionName, row.Sum); } } }