오류: 이미 존재하는 엔티티를 추가할 수 없습니다.

4073 단어 잘못
삽입할 객체를 주기적으로 인스턴스화해야 합니다.그렇지 않으면 알림: "이미 존재하는 실체를 추가할 수 없습니다."
 public bool ImportToPool()
{
DataTable dt = ImportExcel();
//return DAL.SmsPoolService.ImportFromDataBable(dt);
////SmsPool Pool = new SmsPool();

////Pool.ApplyID = this.ApplyID;
////Pool.NetOperationID = 0;
////Pool.PriorityLevel = 0;

////Pool.CheckFlag = " ";
////Pool.CheckContentFlag = " ";

string[] numArr = this.Numbers.Trim(',').Split(',');
//Pool.SrcNumbers = this.Numbers;
//Pool.ObjNum = "";
//Pool.SmsContent = "";
//Pool.SmsCount = 0;
DAL.SmsPoolService PoolSvs = new SmsPoolService();
////SmsPool Pool = new SmsPool();//
for (int i = 0; i < dt.Rows.Count; i++)
{
//DAL.SmsPoolService PoolSvs = new SmsPoolService();
SmsPool Pool = new SmsPool();

Pool.ApplyID = this.ApplyID;
Pool.NetOperationID = 0;
Pool.PriorityLevel = 0;

Pool.CheckFlag = " ";
Pool.CheckContentFlag = " ";

Pool.SrcNum = numArr[i%numArr.Length];
Pool.ObjNum = dt.Rows[i][0].ToString();
Pool.SmsContent = dt.Rows[i][1].ToString();
Pool.SmsCount =(int) Math.Ceiling((Pool.SmsContent.Length * 0.1) / MyConst.SmsMaxCharCount);
PoolSvs.Insert(Pool);
}
return true;
}

좋은 웹페이지 즐겨찾기