1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Linq;
- using JLHHJSvr.BLL;
- using JLHHJSvr.Com;
- using JLHHJSvr.Helper;
- using JLHHJSvr.LJException;
- using LJLib.DAL.SQL;
- using LJLib.Net.SPI.Server;
- using LJLib.SQLEX;
- namespace JLHHJSvr.Excutor
- {
- internal sealed class DeleteSoftBedQuoteExcutor : ExcutorBase<DeleteSoftBedQuoteRequest, DeleteSoftBedQuoteResponse>
- {
- protected override void ExcuteInternal(DeleteSoftBedQuoteRequest request, object state, DeleteSoftBedQuoteResponse rslt)
- {
- var tokendata = BllHelper.GetToken(request.token);
- if (tokendata == null)
- {
- rslt.ErrMsg = "会话已经中断,请重新登录";
- return;
- }
- if (!request.list.Any())
- {
- rslt.ErrMsg = "至少提交一条需要删除的记录";
- return;
- }
- using (var con = GlobalVar.ConnectionString.NewSqlConnection())
- using (var cmd = con.CreateCommand())
- {
- con.Open();
- var softBedHelper = HelperBase.GetHelper<SoftBedHelper>(cmd);
- using (cmd.Transaction = con.BeginTransaction())
- {
- try
- {
- foreach(var mx in request.list)
- {
- softBedHelper.DeleteSoftBed(mx.softbed_id);
- }
- cmd.Transaction.Commit();
- }
- catch (Exception e)
- {
- cmd.Transaction?.Rollback();
- rslt.ErrMsg = e.Message;
- }
- }
- }
- }
- }
- }
|