コード例 #1
0
        public static void AddOption(string fixtureID, string workcenter, string optionName, double prodTime, int?SectionLength = null)
        {
            using (var db = new TimeContext())
            {
                var fixture = db.Fixtures.Where(item => item.FxCode == fixtureID && item.WorkCenter == workcenter).FirstOrDefault();
                if (fixture == null)
                {
                    FixtureTB.AddInstance(fixtureID, workcenter);
                }
                fixture = db.Fixtures.Where(item => item.FxCode == fixtureID && item.WorkCenter == workcenter).FirstOrDefault();
                OptionTB optionindex = new OptionTB();
                if (SectionLength == null)
                {
                    optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime).FirstOrDefault();
                }
                else
                {
                    optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime && item.sectionLength == SectionLength).FirstOrDefault();
                }


                if (!fixture.Options.Contains(optionindex))
                {
                    fixture.Options.Add(optionindex);
                }

                db.SaveChanges();
            }
        }
コード例 #2
0
        public static void AddOption(string product, string workcenter, string optionName, double prodTime, int?SectionLength = null)
        {
            using (var db = new TimeContext())
            {
                var prod = db.Prod.Where(item => item.ProdCode == product && item.WorkCenter == workcenter).FirstOrDefault();


                OptionTB optionindex = new OptionTB();
                if (SectionLength == null)
                {
                    optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime).FirstOrDefault();
                }
                else
                {
                    optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime && item.sectionLength == SectionLength).FirstOrDefault();
                }


                if (!prod.Options.Contains(optionindex))
                {
                    prod.Options.Add(optionindex);
                }

                db.SaveChanges();
            }
        }
コード例 #3
0
 public static void AddParam(string optionName, double prodTime, string ParamName, string ParamValue, int?SectionLength = null)
 {
     using (var db = new TimeContext())
     {
         OptionTB optionindex = new OptionTB();
         if (SectionLength == null)
         {
             optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime).FirstOrDefault();
         }
         else
         {
             optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime && item.sectionLength == SectionLength).FirstOrDefault();
         }
         var paramindex = db.Params.Where(item => item.ParamName == ParamName && item.ParamValue == ParamValue).FirstOrDefault();
         if (!optionindex.Params.Contains(paramindex))
         {
             optionindex.Params.Add(paramindex);
             db.SaveChanges();
         }
     }
 }
コード例 #4
0
 public void AddOption(OptionTB option)
 {
     Options.Add(option);
 }
コード例 #5
0
 public void AddOptions(OptionTB Option)
 {
     Options.Add(Option);
 }