123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using DirectService.Tools;
- using JLHHJSvr.BLL;
- using JLHHJSvr.Com;
- using JLHHJSvr.Com.Model;
- using JLHHJSvr.Helper;
- using JLHHJSvr.LJException;
- using JLHHJSvr.LJFramework.Tools;
- using JLHHJSvr.Tools;
- using LJLib.DAL.SQL;
- using LJLib.Net.SPI.Server;
- namespace JLHHJSvr.Excutor
- {
- internal sealed class SaveMattressInterfaceExcutor : ExcutorBase<SaveMattressInterfaceRequest, SaveMattressInterfaceResponse>
- {
- Dictionary<string, object> replacements = new Dictionary<string, object>();
- protected override void ExcuteInternal(SaveMattressInterfaceRequest request, object state, SaveMattressInterfaceResponse rslt)
- {
- var tokendata = BllHelper.GetToken(request.token);
- if (tokendata == null)
- {
- rslt.ErrMsg = "会话已经中断,请重新登录";
- return;
- }
- if (request.mattress == null)
- {
- rslt.ErrMsg = "缺少主表信息";
- return;
- }
- if (request.interfaceList == null || !request.interfaceList.Any())
- {
- rslt.ErrMsg = "缺少产品配置明细";
- return;
- }
- if (request.qdList == null || !request.qdList.Any())
- {
- rslt.ErrMsg = "缺少产品清单明细";
- return;
- }
- using (var con = new SqlConnection(GlobalVar.ConnectionString))
- using (var cmd = con.CreateCommand())
- {
- con.Open();
- // 初始化属性
- AutoInit.AutoInitS(cmd, request.mattress);
- foreach (var mx in request.interfaceList)
- {
- AutoInit.AutoInitS(cmd, mx);
- }
- foreach (var mx in request.qdList)
- {
- AutoInit.AutoInitS(cmd, mx);
- }
- var interfaceHelper = HelperBase.GetHelper<InterfaceHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
-
- using (cmd.Transaction = con.BeginTransaction())
- {
- try
- {
- interfaceHelper.SaveMattressInterface(request.mattress, request.interfaceList, request.qdList);
- cmd.Transaction.Commit();
- }
- catch (Exception e)
- {
- cmd.Transaction.Rollback();
- rslt.ErrMsg = e.ToString();
- }
- }
- }
- }
- }
- }
|