public static Timing_Option ContainsTimeOption(Fixture fixture, Timing_Option timing_Option) { var result = fixture.Timing_Option.Where(r => r.Name == timing_Option.Name && r.Categories.Equals(timing_Option.Categories) && r.Parameters.Equals(timing_Option.Parameters) && r.Fixture == timing_Option.Fixture && r.Timing_WorkStations == timing_Option.Timing_WorkStations).FirstOrDefault(); return(result); }
public static Timing_Option addTimeOptionCustom(Fixture fixture, List <Category> Categories, List <Parameter> Parameters, Timing_WorkStations workStations, string OptionName, decimal OptionValue) { Timing_Option Input = new Timing_Option() { Name = OptionName, Time = OptionValue, Fixture = fixture, Categories = Categories, Parameters = Parameters, Timing_WorkStations = workStations }; return(Input); }
public static Timing_Option addTimeOptionCustom(Fixture fixture, Category Category, Parameter Parameter, Timing_WorkStations workStations, string OptionName, decimal OptionValue) { Timing_Option Input = new Timing_Option() { Name = OptionName, Time = OptionValue, Fixture = fixture, Timing_WorkStations = workStations }; //Input.Categories.Add(Category); Input.Parameters.Add(Parameter); return(Input); }
public static void addTimeOption() { HashSet <Timing_Option> globalopts = new HashSet <Timing_Option>(); List <Fixture> fixtures = new List <Fixture>(); using (var DWdb = new DWModel()) { using (var db = new SSRS()) { var prod = db.ProdTBs.ToList(); foreach (var item in prod) { foreach (var opt in item.OptionTBs) { var fixture = DWdb.Fixtures.Where(r => r.Code == item.Code).FirstOrDefault(); var workstation = DWdb.Timing_WorkStations.Where(r => r.Name == item.WorkCenter).FirstOrDefault(); if (fixture != null && workstation != null) { var optnew = new Timing_Option() { Name = opt.OptionName, Time = (decimal)opt.ProdTime, Fixture = fixture, Timing_WorkStations = workstation }; //DWdb.Timing_Option.Add(optnew); //DWdb.SaveChanges(); globalopts.Add(optnew); } } } } foreach (var item in globalopts) { DWdb.Timing_Option.Add(item); DWdb.SaveChanges(); } } }