1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using DirectService.Tools;
- using JLHHJSvr.BLL;
- using JLHHJSvr.Com;
- using JLHHJSvr.Helper;
- using LJLib.DAL.SQL;
- using LJLib.Net.SPI.Server;
- using LJLib.SQLEX;
- namespace JLHHJSvr.Excutor
- {
- internal sealed class SaveSoftBedFormulaExcutor : ExcutorBase<SaveSoftBedFormulaRequest, SaveSoftBedFormulaResponse>
- {
- protected override void ExcuteInternal(SaveSoftBedFormulaRequest request, object state, SaveSoftBedFormulaResponse rslt)
- {
- var tokendata = BllHelper.GetToken(request.token);
- if (tokendata == null)
- {
- rslt.ErrMsg = "会话已经中断,请重新登录";
- return;
- }
- if (request.formula == null)
- {
- rslt.ErrMsg = "未提交软床公式定义信息";
- return;
- }
- if (string.IsNullOrEmpty(request.formula.formulaname))
- {
- rslt.ErrMsg = "公式名称不能为空,请检查!";
- return;
- }
- using (var con = GlobalVar.ConnectionString.NewSqlConnection())
- using (var cmd = con.CreateCommand())
- {
- con.Open();
- var baseHelper = HelperBase.GetHelper<BasicInfoHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
- var _formula = ObjectHelper.DeepCopy(request.formula);
- using (cmd.Transaction = con.BeginTransaction())
- {
- try
- {
- baseHelper.SaveSoftBedFormula(_formula);
- cmd.Transaction.Commit();
- }
- catch (Exception e)
- {
- rslt.ErrMsg = e.Message;
- cmd.Transaction?.Rollback();
- }
- }
- }
- }
- }
- }
|