1 DataTable dtTcu = GetAllTcuInfoBySdId(sdId);
2 DataTable dtToesm = GetAllToesmBySdId(sdId);
3
4 foreach (DataRow row in dtToesm.Rows)
5 {
6 int toesmTcuId = ConvertHelper.ToInt32(row["toesm_manager_tcu_id"]); //店主
7 int shopOaId = ConvertHelper.ToInt32(row["toesm_toes_oa_id"]);
8
9 var rows = dtTcu.AsEnumerable().Where<DataRow>(c => c.RowState != DataRowState.Deleted && c["tc_cu_shop_oa_id"].ToString() == shopOaId.ToString());
10 int rowsCount = rows.Count<DataRow>();
11 if (rows != null)
12 {
13 foreach (DataRow row2 in rows)
14 {
15 int tcuId = ConvertHelper.ToInt32(row2["tc_cuid"]);
16 if (tcuId != toesmTcuId)
17 {
18 dtTcu.Rows[dtTcu.Rows.IndexOf(row2)].Delete();
19 }
20 }
21 }
22 }
23
24 dtTcu.AcceptChanges();
25 return dtTcu;
c.RowState != DataRowState.Deleted //不读取已标记未删除的行(必须判断,否则会抛出异常"读取已删除的行........")
dtTcu.AcceptChanges(); //提交