示例#1
0
        //create a management act (Davy, Lily)
        public string CreateManagementAct(BeheerMaand managementMonth)
        {
            string message = "";
            var    item    = _context.BeheerMaand.Where(b => b.PlantId == managementMonth.PlantId);

            _context.BeheerMaand.Add(managementMonth);
            _context.SaveChanges();

            return(message);
        }
        public string AddBeheerToPlant(long plantId, string beheerdaad, string omschrijving, bool jan, bool feb,
                                       bool mrt, bool apr, bool mei, bool jun, bool jul, bool aug, bool sept, bool okt, bool nov, bool dec,
                                       string frequentie, string m2u)
        {
            string result;

            foreach (var beheerMaand in context.BeheerMaand.Where(p => p.PlantId == plantId).ToList())
            {
                if (beheerMaand.Beheerdaad.ToLower().Trim() == beheerdaad.ToLower().Trim())
                {
                    result = "Waarde is al toegevoegd aan de plant";
                    return(result);
                }
            }

            long newId = context.BeheerMaand.Max(b => b.Id) + 1;

            var beheermaand = new BeheerMaand()
            {
                PlantId           = plantId,
                Beheerdaad        = beheerdaad,
                Omschrijving      = omschrijving,
                Jan               = jan,
                Feb               = feb,
                Mrt               = mrt,
                Apr               = apr,
                Mei               = mei,
                Jun               = jun,
                Jul               = jul,
                Aug               = aug,
                Sept              = sept,
                Okt               = okt,
                Nov               = nov,
                Dec               = dec,
                FrequentiePerJaar = int.Parse(frequentie),
                M2u               = double.Parse(m2u)
            };

            context.BeheerMaand.Add(beheermaand);
            context.SaveChanges();
            result = "Beheermaand toegevoegd aan plant";
            return(result);
        }
示例#3
0
 //delete the selected management act (Davy)
 public void RemoveManagementAct(BeheerMaand ManagementMonth)
 {
     _context.BeheerMaand.Remove(ManagementMonth);
     _context.SaveChanges();
 }
示例#4
0
 //edit the selected management act (Davy)
 public void EditManagementAct(BeheerMaand ManagementMonth)
 {
     _context.BeheerMaand.Update(ManagementMonth);
     _context.SaveChanges();
 }
 public void DeleteBeheerFromPlant(BeheerMaand beheerMaand)
 {
     context.BeheerMaand.Remove(beheerMaand);
     context.SaveChanges();
 }