22,209
社区成员
发帖
与我相关
我的任务
分享
sql+=@"BEGIN TRANSACTION
if not exists(select * from T_PersonInfo where id=@empid)
INSERT INTO T_PersonInfo(id,name,k_rate,AdminRate,SubsidyRate,bank_account,bank_Name,bank_City,company_place,orgId,dept_cost_center,status,person_cost_center,job,jobPart,part_info,in_job_date,work_city,phone,email,education,sex,person_id,passport_id,birthday,nationality,politics,marriage,reg_place,reg_address,linkman,emergent_phone,live_place,live_address,zip_code,contract_timelimit,contract_date_op,contract_date_ed,probation,change_date,BenchId,stateFlag)
select @empid,@name,@k_rate,@AdminRate,@SubsidyRate,@bank_account,@bank_Name,@bank_City,@company_place,@orgId,@dept_cost_center,@status,@person_cost_center,@job,@jobPart,@part_info,@in_job_date,@work_city,@phone,@email,@education,@sex,@person_id,@passport_id,@birthday,@nationality,@politics,@marriage,@reg_place,@reg_address,@linkman,@emergent_phone,@live_place,@live_address,@zip_code,@contract_timelimit,@contract_date_op,@contract_date_ed,@probation,@change_date,@benchId,@stateFlag
if @@error<>0
ROLLBACK TRANSACTION return
";
sql+=@" Update T_ArchiveInfo Set staffId=@empid,lastModifyDate=@lastModifyDate where staffId=@oldId
if @@error<>0
ROLLBACK TRANSACTION return
";
sql+=@" if not exists(select * from T_EmailGroupRelation where staffId=@empid) ";
for(int i=0;i<list.Count;i++){
sql+=@"Insert Into T_EmailGroupRelation(id,staffId,emailGroup,bolSend) values(@id,@empid,@emailGroup"+i+",@bolSend"+i+");";
}
sql+=@"
if @@error<>0
ROLLBACK TRANSACTION return
if not exists(select * from T_EmailGroupRelation where staffId=@oldId) delete T_PersonInfo where id=@oldId
if @@error<>0
ROLLBACK TRANSACTION return
else
COMMIT TRANSACTION
";