private void UpdateDB() { int i = 0; int prtID = cutlistData.GetPartID(prop.PartName); foreach (DataRowView s in lbPri1.Items) { if (lbPri1.GetSelected(i)) { cutlistData.SetProgramPriority(prtID, (int)s["MACHID"], 1); } if (lbPri2.GetSelected(i)) { cutlistData.SetProgramPriority(prtID, (int)s["MACHID"], 2); } if (lbPri3.GetSelected(i)) { cutlistData.SetProgramPriority(prtID, (int)s["MACHID"], 3); } if (!lbPri1.GetSelected(i) && !lbPri2.GetSelected(i) && !lbPri3.GetSelected(i)) { cutlistData.SetProgramExists(prtID, (int)s["MACHID"], false); } i++; } }