private void simpleButton1_Click(object sender, EventArgs e) { foreach (DataRow rws in dt.Rows) { rws["C"] = false; } PowerPicSelect ppsn = new PowerPicSelect(); ppsn.EachListID = _obj.UID; IList<PowerPicSelect> liss = UCDeviceBase.DataService.GetList<PowerPicSelect>("SelectPowerPicSelectList", ppsn); foreach (PowerPicSelect pps in liss) { foreach (DataRow rw in dt.Rows) { if (pps.PicSelectID == rw["A"].ToString()) rw["C"] = true; } } FrmPicTypeSelect fpt = new FrmPicTypeSelect(); fpt.DT = dt; if (fpt.ShowDialog() == DialogResult.OK) { dt = fpt.DT; int c = 0; foreach (PowerPicSelect pps1 in liss) { c = 0; foreach (DataRow rw in dt.Rows) { if (pps1.PicSelectID == rw["A"].ToString() && (bool)rw["C"]) c = 1; } if (c == 0) { UCDeviceBase.DataService.Delete<PowerPicSelect>(pps1); } } foreach (DataRow rw1 in dt.Rows) { c = 0; if ((bool)rw1["C"]) { foreach (PowerPicSelect pps2 in liss) { if (pps2.PicSelectID == rw1["A"].ToString()) c = 1; } if (c == 0) { PowerPicSelect pp3 = new PowerPicSelect(); pp3.EachListID = _obj.UID; pp3.PicSelectID = rw1["A"].ToString(); pp3.PicSelectName = rw1["B"].ToString(); UCDeviceBase.DataService.Create<PowerPicSelect>(pp3); } } } } }
private void simpleButton1_Click(object sender, EventArgs e) { foreach (DataRow rws in dt.Rows) { rws["C"] = false; } PowerPicSelect ppsn = new PowerPicSelect(); ppsn.EachListID = _obj.UID; IList <PowerPicSelect> liss = UCDeviceBase.DataService.GetList <PowerPicSelect>("SelectPowerPicSelectList", ppsn); foreach (PowerPicSelect pps in liss) { foreach (DataRow rw in dt.Rows) { if (pps.PicSelectID == rw["A"].ToString()) { rw["C"] = true; } } } FrmPicTypeSelect fpt = new FrmPicTypeSelect(); fpt.DT = dt; if (fpt.ShowDialog() == DialogResult.OK) { dt = fpt.DT; int c = 0; foreach (PowerPicSelect pps1 in liss) { c = 0; foreach (DataRow rw in dt.Rows) { if (pps1.PicSelectID == rw["A"].ToString() && (bool)rw["C"]) { c = 1; } } if (c == 0) { UCDeviceBase.DataService.Delete <PowerPicSelect>(pps1); } } foreach (DataRow rw1 in dt.Rows) { c = 0; if ((bool)rw1["C"]) { foreach (PowerPicSelect pps2 in liss) { if (pps2.PicSelectID == rw1["A"].ToString()) { c = 1; } } if (c == 0) { PowerPicSelect pp3 = new PowerPicSelect(); pp3.EachListID = _obj.UID; pp3.PicSelectID = rw1["A"].ToString(); pp3.PicSelectName = rw1["B"].ToString(); UCDeviceBase.DataService.Create <PowerPicSelect>(pp3); } } } } }